]> rtime.felk.cvut.cz Git - opencv.git/commitdiff
update include/lib files of ffmpeg to 0.5.1 version. Add support Windows64 under...
authoralekcac <alekcac@73c94f0f-984f-4a5f-82bc-2d8db8d8ee08>
Fri, 12 Mar 2010 11:49:10 +0000 (11:49 +0000)
committeralekcac <alekcac@73c94f0f-984f-4a5f-82bc-2d8db8d8ee08>
Fri, 12 Mar 2010 11:49:10 +0000 (11:49 +0000)
git-svn-id: https://code.ros.org/svn/opencv/trunk@2798 73c94f0f-984f-4a5f-82bc-2d8db8d8ee08

24 files changed:
opencv/3rdparty/include/ffmpeg_/avcodec.h
opencv/3rdparty/include/ffmpeg_/avformat.h
opencv/3rdparty/include/ffmpeg_/imgconvert.h
opencv/3rdparty/include/ffmpeg_/integer.h
opencv/3rdparty/include/ffmpeg_/rgb2rgb.h
opencv/3rdparty/include/ffmpeg_/rtp.h
opencv/3rdparty/include/ffmpeg_/rtsp.h
opencv/3rdparty/include/ffmpeg_/rtspcodes.h
opencv/3rdparty/lib/libavcodec.a
opencv/3rdparty/lib/libavcodec64.a [new file with mode: 0644]
opencv/3rdparty/lib/libavdevice.a
opencv/3rdparty/lib/libavdevice64.a [new file with mode: 0644]
opencv/3rdparty/lib/libavformat.a
opencv/3rdparty/lib/libavformat64.a [new file with mode: 0644]
opencv/3rdparty/lib/libavutil.a
opencv/3rdparty/lib/libavutil64.a [new file with mode: 0644]
opencv/3rdparty/lib/videoInput64.lib [new file with mode: 0644]
opencv/CMakeLists.txt
opencv/include/opencv/cxoperations.hpp
opencv/include/opencv/cxtypes.h
opencv/interfaces/ffopencv/CMakeLists.txt
opencv/interfaces/ffopencv/ffopencv.cpp
opencv/src/highgui/CMakeLists.txt
opencv/src/highgui/window_w32.cpp

index 0fcde984c0e167a42d47318c4ccbd30d551e873c..2f2e4210e7d2178ef0f8029bbe965f2784682b06 100644 (file)
@@ -31,7 +31,7 @@
 
 #define LIBAVCODEC_VERSION_MAJOR 52
 #define LIBAVCODEC_VERSION_MINOR 20
-#define LIBAVCODEC_VERSION_MICRO  0
+#define LIBAVCODEC_VERSION_MICRO  1
 
 #define LIBAVCODEC_VERSION_INT  AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \
                                                LIBAVCODEC_VERSION_MINOR, \
@@ -501,6 +501,7 @@ typedef struct RcOverride{
 #define CODEC_FLAG2_CHUNKS        0x00008000 ///< Input bitstream might be truncated at a packet boundaries instead of only at frame boundaries.
 #define CODEC_FLAG2_NON_LINEAR_QUANT 0x00010000 ///< Use MPEG-2 nonlinear quantizer.
 #define CODEC_FLAG2_BIT_RESERVOIR 0x00020000 ///< Use a bit reservoir when encoding if possible
+#define CODEC_FLAG2_MBTREE        0x00040000 ///< Use macroblock tree ratecontrol (x264 only)
 
 /* Unsupported options :
  *              Syntax Arithmetic coding (SAC)
@@ -2332,6 +2333,16 @@ typedef struct AVCodecContext {
      * Set to time_base ticks per frame. Default 1, e.g., H.264/MPEG-2 set it to 2.
      */
     int ticks_per_frame;
+
+    /**
+     * explicit P-frame weighted prediction analysis method
+     * 0: off
+     * 1: fast blind weighting (one reference duplicate with -1 offset)
+     * 2: smart weighting (full fade detection analysis)
+     * - encoding: Set by user.
+     * - decoding: unused
+     */
+    int weighted_p_pred;
 } AVCodecContext;
 
 /**
@@ -3344,4 +3355,30 @@ void av_register_hwaccel(AVHWAccel *hwaccel);
  */
 AVHWAccel *av_hwaccel_next(AVHWAccel *hwaccel);
 
+
+/**
+ * Lock operation used by lockmgr
+ */
+enum AVLockOp {
+  AV_LOCK_CREATE,  ///< Create a mutex
+  AV_LOCK_OBTAIN,  ///< Lock the mutex
+  AV_LOCK_RELEASE, ///< Unlock the mutex
+  AV_LOCK_DESTROY, ///< Free mutex resources
+};
+
+/**
+ * Register a user provided lock manager supporting the operations
+ * specified by AVLockOp. \p mutex points to a (void *) where the
+ * lockmgr should store/get a pointer to a user allocated mutex. It's
+ * NULL upon AV_LOCK_CREATE and != NULL for all other ops.
+ *
+ * @param cb User defined callback. Note: FFmpeg may invoke calls to this
+ *           callback during the call to av_lockmgr_register().
+ *           Thus, the application must be prepared to handle that.
+ *           If cb is set to NULL the lockmgr will be unregistered.
+ *           Also note that during unregistration the previously registered
+ *           lockmgr callback may also be invoked.
+ */
+int av_lockmgr_register(int (*cb)(void **mutex, enum AVLockOp op));
+
 #endif /* AVCODEC_AVCODEC_H */
index a11d50dd1bd0c76c835f205aa6e8f9d43cce85c2..f4c2287e508325328ce8040bf814799b3de8b1ab 100644 (file)
@@ -1035,7 +1035,7 @@ AVChapter *ff_new_chapter(AVFormatContext *s, int id, AVRational time_base,
  * @param pts_den denominator to convert to seconds (MPEG: 90000)
  */
 void av_set_pts_info(AVStream *s, int pts_wrap_bits,
-                     int pts_num, int pts_den);
+                     unsigned int pts_num, unsigned int pts_den);
 
 #define AVSEEK_FLAG_BACKWARD 1 ///< seek backward
 #define AVSEEK_FLAG_BYTE     2 ///< seeking based on position in bytes
index 1ab552457131608d6c81b2d598b386bbddc0abed..f05afd698435be811a79c97a70776ec9365f2aa6 100644 (file)
@@ -24,6 +24,7 @@
 #ifndef AVCODEC_IMGCONVERT_H
 #define AVCODEC_IMGCONVERT_H
 
+//#include <stdint.h>
 #include "avcodec.h"
 
 int ff_fill_linesize(AVPicture *picture, int pix_fmt, int width);
index 2a4d703166128c637be0d7f0001f05de158219dd..d4d0201db4f9131c5d06cd3497fc9a14222e3b06 100644 (file)
  * You should have received a copy of the GNU Lesser General Public
  * License along with FFmpeg; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
  */
 
 /**
- * @file integer.h
+ * @file libavutil/integer.h
  * arbitrary precision integers
  * @author Michael Niedermayer <michaelni@gmx.at>
  */
 
-#ifndef INTEGER_H
-#define INTEGER_H
+#ifndef AVUTIL_INTEGER_H
+#define AVUTIL_INTEGER_H
+
+#include <stdint.h>
+#include "common.h"
 
 #define AV_INTEGER_SIZE 8
 
@@ -35,48 +37,50 @@ typedef struct AVInteger{
     uint16_t v[AV_INTEGER_SIZE];
 } AVInteger;
 
-AVInteger av_add_i(AVInteger a, AVInteger b);
-AVInteger av_sub_i(AVInteger a, AVInteger b);
+AVInteger av_add_i(AVInteger a, AVInteger b) av_const;
+AVInteger av_sub_i(AVInteger a, AVInteger b) av_const;
 
 /**
- * returns the rounded down value of the logarithm of base 2 of the given AVInteger.
- * this is simply the index of the most significant bit which is 1. Or 0 of all bits are 0
+ * Returns the rounded-down value of the base 2 logarithm of the given
+ * AVInteger. This is simply the index of the most significant bit
+ * which is 1, or 0 if all bits are 0.
  */
-int av_log2_i(AVInteger a);
-AVInteger av_mul_i(AVInteger a, AVInteger b);
+int av_log2_i(AVInteger a) av_const;
+AVInteger av_mul_i(AVInteger a, AVInteger b) av_const;
 
 /**
- * returns 0 if a==b, 1 if a>b and -1 if a<b.
+ * Returns 0 if a==b, 1 if a>b and -1 if a<b.
  */
-int av_cmp_i(AVInteger a, AVInteger b);
+int av_cmp_i(AVInteger a, AVInteger b) av_const;
 
 /**
- * bitwise shift.
- * @param s the number of bits by which the value should be shifted right, may be negative for shifting left
+ * bitwise shift
+ * @param s the number of bits by which the value should be shifted right,
+            may be negative for shifting left
  */
-AVInteger av_shr_i(AVInteger a, int s);
+AVInteger av_shr_i(AVInteger a, int s) av_const;
 
 /**
- * returns a % b.
- * @param quot a/b will be stored here
+ * Returns a % b.
+ * @param quot a/b will be stored here.
  */
 AVInteger av_mod_i(AVInteger *quot, AVInteger a, AVInteger b);
 
 /**
- * returns a/b.
+ * Returns a/b.
  */
-AVInteger av_div_i(AVInteger a, AVInteger b);
+AVInteger av_div_i(AVInteger a, AVInteger b) av_const;
 
 /**
- * converts the given int64_t to an AVInteger.
+ * Converts the given int64_t to an AVInteger.
  */
-AVInteger av_int2i(int64_t a);
+AVInteger av_int2i(int64_t a) av_const;
 
 /**
- * converts the given AVInteger to an int64_t.
- * if the AVInteger is too large to fit into an int64_t,
- * then only the least significant 64bit will be used
+ * Converts the given AVInteger to an int64_t.
+ * If the AVInteger is too large to fit into an int64_t,
+ * then only the least significant 64 bits will be used.
  */
-int64_t av_i2int(AVInteger a);
+int64_t av_i2int(AVInteger a) av_const;
 
-#endif // INTEGER_H
+#endif /* AVUTIL_INTEGER_H */
index 5ad3ec71b487fbdc06bb436ad9de586addedd795..df912c8533444a4699ebd9a9b3641df127f30cd8 100644 (file)
@@ -1,8 +1,8 @@
 /*
- *  rgb2rgb.h, Software RGB to RGB convertor
- *  pluralize by Software PAL8 to RGB convertor
- *               Software YUV to YUV convertor
- *               Software YUV to RGB convertor
+ *  software RGB to RGB converter
+ *  pluralize by Software PAL8 to RGB converter
+ *               Software YUV to YUV converter
+ *               Software YUV to RGB converter
  *  Written by Nick Kurshev.
  *  palette & YUV & runtime CPU stuff by Michael (michaelni@gmx.at)
  *
  *
  * You should have received a copy of the GNU Lesser General Public
  * License along with FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
-#ifndef RGB2RGB_INCLUDED
-#define RGB2RGB_INCLUDED
+#ifndef SWSCALE_RGB2RGB_H
+#define SWSCALE_RGB2RGB_H
 
-// Note: do not fix the dependence on stdio.h
+#include <inttypes.h>
 
-/* A full collection of rgb to rgb(bgr) convertors */
-extern void (*rgb24to32)   (const uint8_t *src, uint8_t *dst, long src_size);
-extern void (*rgb24to16)   (const uint8_t *src, uint8_t *dst, long src_size);
-extern void (*rgb24to15)   (const uint8_t *src, uint8_t *dst, long src_size);
-extern void (*rgb32to24)   (const uint8_t *src, uint8_t *dst, long src_size);
+/* A full collection of RGB to RGB(BGR) converters */
+extern void (*rgb24tobgr32)(const uint8_t *src, uint8_t *dst, long src_size);
+extern void (*rgb24tobgr16)(const uint8_t *src, uint8_t *dst, long src_size);
+extern void (*rgb24tobgr15)(const uint8_t *src, uint8_t *dst, long src_size);
+extern void (*rgb32tobgr24)(const uint8_t *src, uint8_t *dst, long src_size);
 extern void (*rgb32to16)   (const uint8_t *src, uint8_t *dst, long src_size);
 extern void (*rgb32to15)   (const uint8_t *src, uint8_t *dst, long src_size);
 extern void (*rgb15to16)   (const uint8_t *src, uint8_t *dst, long src_size);
-extern void (*rgb15to24)   (const uint8_t *src, uint8_t *dst, long src_size);
+extern void (*rgb15tobgr24)(const uint8_t *src, uint8_t *dst, long src_size);
 extern void (*rgb15to32)   (const uint8_t *src, uint8_t *dst, long src_size);
 extern void (*rgb16to15)   (const uint8_t *src, uint8_t *dst, long src_size);
-extern void (*rgb16to24)   (const uint8_t *src, uint8_t *dst, long src_size);
+extern void (*rgb16tobgr24)(const uint8_t *src, uint8_t *dst, long src_size);
 extern void (*rgb16to32)   (const uint8_t *src, uint8_t *dst, long src_size);
 extern void (*rgb24tobgr24)(const uint8_t *src, uint8_t *dst, long src_size);
-extern void (*rgb24tobgr16)(const uint8_t *src, uint8_t *dst, long src_size);
-extern void (*rgb24tobgr15)(const uint8_t *src, uint8_t *dst, long src_size);
+extern void (*rgb24to16)   (const uint8_t *src, uint8_t *dst, long src_size);
+extern void (*rgb24to15)   (const uint8_t *src, uint8_t *dst, long src_size);
 extern void (*rgb32tobgr32)(const uint8_t *src, uint8_t *dst, long src_size);
 extern void (*rgb32tobgr16)(const uint8_t *src, uint8_t *dst, long src_size);
 extern void (*rgb32tobgr15)(const uint8_t *src, uint8_t *dst, long src_size);
 
-extern void rgb24tobgr32(const uint8_t *src, uint8_t *dst, long src_size);
-extern void rgb32tobgr24(const uint8_t *src, uint8_t *dst, long src_size);
-extern void rgb16tobgr32(const uint8_t *src, uint8_t *dst, long src_size);
-extern void rgb16tobgr24(const uint8_t *src, uint8_t *dst, long src_size);
-extern void rgb16tobgr16(const uint8_t *src, uint8_t *dst, long src_size);
-extern void rgb16tobgr15(const uint8_t *src, uint8_t *dst, long src_size);
-extern void rgb15tobgr32(const uint8_t *src, uint8_t *dst, long src_size);
-extern void rgb15tobgr24(const uint8_t *src, uint8_t *dst, long src_size);
-extern void rgb15tobgr16(const uint8_t *src, uint8_t *dst, long src_size);
-extern void rgb15tobgr15(const uint8_t *src, uint8_t *dst, long src_size);
-extern void rgb8tobgr8  (const uint8_t *src, uint8_t *dst, long src_size);
-
-
-extern void palette8torgb32(const uint8_t *src, uint8_t *dst, long num_pixels, const uint8_t *palette);
-extern void palette8tobgr32(const uint8_t *src, uint8_t *dst, long num_pixels, const uint8_t *palette);
-extern void palette8torgb24(const uint8_t *src, uint8_t *dst, long num_pixels, const uint8_t *palette);
-extern void palette8tobgr24(const uint8_t *src, uint8_t *dst, long num_pixels, const uint8_t *palette);
-extern void palette8torgb16(const uint8_t *src, uint8_t *dst, long num_pixels, const uint8_t *palette);
-extern void palette8tobgr16(const uint8_t *src, uint8_t *dst, long num_pixels, const uint8_t *palette);
-extern void palette8torgb15(const uint8_t *src, uint8_t *dst, long num_pixels, const uint8_t *palette);
-extern void palette8tobgr15(const uint8_t *src, uint8_t *dst, long num_pixels, const uint8_t *palette);
+void rgb24to32   (const uint8_t *src, uint8_t *dst, long src_size);
+void rgb32to24   (const uint8_t *src, uint8_t *dst, long src_size);
+void rgb16tobgr32(const uint8_t *src, uint8_t *dst, long src_size);
+void rgb16to24   (const uint8_t *src, uint8_t *dst, long src_size);
+void rgb16tobgr16(const uint8_t *src, uint8_t *dst, long src_size);
+void rgb16tobgr15(const uint8_t *src, uint8_t *dst, long src_size);
+void rgb15tobgr32(const uint8_t *src, uint8_t *dst, long src_size);
+void rgb15to24   (const uint8_t *src, uint8_t *dst, long src_size);
+void rgb15tobgr16(const uint8_t *src, uint8_t *dst, long src_size);
+void rgb15tobgr15(const uint8_t *src, uint8_t *dst, long src_size);
+void bgr8torgb8  (const uint8_t *src, uint8_t *dst, long src_size);
+
+
+void palette8topacked32(const uint8_t *src, uint8_t *dst, long num_pixels, const uint8_t *palette);
+void palette8topacked24(const uint8_t *src, uint8_t *dst, long num_pixels, const uint8_t *palette);
+void palette8torgb16(const uint8_t *src, uint8_t *dst, long num_pixels, const uint8_t *palette);
+void palette8tobgr16(const uint8_t *src, uint8_t *dst, long num_pixels, const uint8_t *palette);
+void palette8torgb15(const uint8_t *src, uint8_t *dst, long num_pixels, const uint8_t *palette);
+void palette8tobgr15(const uint8_t *src, uint8_t *dst, long num_pixels, const uint8_t *palette);
 
 /**
- *
- * height should be a multiple of 2 and width should be a multiple of 16 (if this is a
- * problem for anyone then tell me, and ill fix it)
- * chrominance data is only taken from every secound line others are ignored FIXME write HQ version
+ * Height should be a multiple of 2 and width should be a multiple of 16.
+ * (If this is a problem for anyone then tell me, and I will fix it.)
+ * Chrominance data is only taken from every second line, others are ignored.
+ * FIXME: Write high quality version.
  */
 //void uyvytoyv12(const uint8_t *src, uint8_t *ydst, uint8_t *udst, uint8_t *vdst,
 
 /**
- *
- * height should be a multiple of 2 and width should be a multiple of 16 (if this is a
- * problem for anyone then tell me, and ill fix it)
+ * Height should be a multiple of 2 and width should be a multiple of 16.
+ * (If this is a problem for anyone then tell me, and I will fix it.)
  */
 extern void (*yv12toyuy2)(const uint8_t *ysrc, const uint8_t *usrc, const uint8_t *vsrc, uint8_t *dst,
                           long width, long height,
                           long lumStride, long chromStride, long dstStride);
 
 /**
- *
- * width should be a multiple of 16
+ * Width should be a multiple of 16.
  */
 extern void (*yuv422ptoyuy2)(const uint8_t *ysrc, const uint8_t *usrc, const uint8_t *vsrc, uint8_t *dst,
                              long width, long height,
                              long lumStride, long chromStride, long dstStride);
 
 /**
- *
- * height should be a multiple of 2 and width should be a multiple of 16 (if this is a
- * problem for anyone then tell me, and ill fix it)
+ * Height should be a multiple of 2 and width should be a multiple of 16.
+ * (If this is a problem for anyone then tell me, and I will fix it.)
  */
 extern void (*yuy2toyv12)(const uint8_t *src, uint8_t *ydst, uint8_t *udst, uint8_t *vdst,
                           long width, long height,
                           long lumStride, long chromStride, long srcStride);
 
 /**
- *
- * height should be a multiple of 2 and width should be a multiple of 16 (if this is a
- * problem for anyone then tell me, and ill fix it)
+ * Height should be a multiple of 2 and width should be a multiple of 16.
+ * (If this is a problem for anyone then tell me, and I will fix it.)
  */
 extern void (*yv12touyvy)(const uint8_t *ysrc, const uint8_t *usrc, const uint8_t *vsrc, uint8_t *dst,
                           long width, long height,
                           long lumStride, long chromStride, long dstStride);
 
 /**
- *
- * height should be a multiple of 2 and width should be a multiple of 2 (if this is a
- * problem for anyone then tell me, and ill fix it)
- * chrominance data is only taken from every secound line others are ignored FIXME write HQ version
+ * Width should be a multiple of 16.
+ */
+extern void (*yuv422ptouyvy)(const uint8_t *ysrc, const uint8_t *usrc, const uint8_t *vsrc, uint8_t *dst,
+                             long width, long height,
+                             long lumStride, long chromStride, long dstStride);
+
+/**
+ * Height should be a multiple of 2 and width should be a multiple of 2.
+ * (If this is a problem for anyone then tell me, and I will fix it.)
+ * Chrominance data is only taken from every second line, others are ignored.
+ * FIXME: Write high quality version.
  */
 extern void (*rgb24toyv12)(const uint8_t *src, uint8_t *ydst, uint8_t *udst, uint8_t *vdst,
                            long width, long height,
@@ -143,4 +144,4 @@ extern void (*yvu9_to_yuy2)(const uint8_t *src1, const uint8_t *src2, const uint
 
 void sws_rgb2rgb_init(int flags);
 
-#endif
+#endif /* SWSCALE_RGB2RGB_H */
index fec76305179635e82ea7cfe3c2b6526e55c13fe9..a97caf94fa0c7df5e3a186792abff251d005f80d 100644 (file)
@@ -1,6 +1,6 @@
 /*
  * RTP definitions
- * Copyright (c) 2002 Fabrice Bellard.
+ * Copyright (c) 2002 Fabrice Bellard
  *
  * This file is part of FFmpeg.
  *
  * License along with FFmpeg; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
-#ifndef RTP_H
-#define RTP_H
+#ifndef AVFORMAT_RTP_H
+#define AVFORMAT_RTP_H
 
-#define RTP_MIN_PACKET_LENGTH 12
-#define RTP_MAX_PACKET_LENGTH 1500 /* XXX: suppress this define */
+#include "avcodec.h"
 
-int rtp_init(void);
-int rtp_get_codec_info(AVCodecContext *codec, int payload_type);
-
-/** return < 0 if unknown payload type */
-int rtp_get_payload_type(AVCodecContext *codec);
-
-typedef struct RTPDemuxContext RTPDemuxContext;
-typedef struct rtp_payload_data_s rtp_payload_data_s;
-RTPDemuxContext *rtp_parse_open(AVFormatContext *s1, AVStream *st, URLContext *rtpc, int payload_type, rtp_payload_data_s *rtp_payload_data);
-int rtp_parse_packet(RTPDemuxContext *s, AVPacket *pkt,
-                     const uint8_t *buf, int len);
-void rtp_parse_close(RTPDemuxContext *s);
-
-extern AVOutputFormat rtp_muxer;
-extern AVInputFormat rtp_demuxer;
+/**
+ * Return the payload type for a given codec.
+ *
+ * @param codec The context of the codec
+ * @return In case of unknown payload type or dynamic payload type, a
+ * negative value is returned; otherwise, the payload type (the 'PT' field
+ * in the RTP header) is returned.
+ */
+int ff_rtp_get_payload_type(AVCodecContext *codec);
 
-int rtp_get_local_port(URLContext *h);
-int rtp_set_remote_url(URLContext *h, const char *uri);
-void rtp_get_file_handles(URLContext *h, int *prtp_fd, int *prtcp_fd);
+/**
+ * Initialize a codec context based on the payload type.
+ *
+ * Fill the codec_type and codec_id fields of a codec context with
+ * information depending on the payload type; for audio codecs, the
+ * channels and sample_rate fields are also filled.
+ *
+ * @param codec The context of the codec
+ * @param payload_type The payload type (the 'PT' field in the RTP header)
+ * @return In case of unknown payload type or dynamic payload type, a
+ * negative value is returned; otherwise, 0 is returned
+ */
+int ff_rtp_get_codec_info(AVCodecContext *codec, int payload_type);
 
 /**
- * some rtp servers assume client is dead if they don't hear from them...
- * so we send a Receiver Report to the provided ByteIO context
- * (we don't have access to the rtcp handle from here)
+ * Return the encoding name (as defined in
+ * http://www.iana.org/assignments/rtp-parameters) for a given payload type.
+ *
+ * @param payload_type The payload type (the 'PT' field in the RTP header)
+ * @return In case of unknown payload type or dynamic payload type, a pointer
+ * to an empty string is returned; otherwise, a pointer to a string containing
+ * the encoding name is returned
  */
-int rtp_check_and_send_back_rr(RTPDemuxContext *s, int count);
+const char *ff_rtp_enc_name(int payload_type);
 
-extern URLProtocol rtp_protocol;
+/**
+ * Return the codec id for the given encoding name and codec type.
+ *
+ * @param buf A pointer to the string containing the encoding name
+ * @param codec_type The codec type
+ * @return In case of unknown encoding name, CODEC_ID_NONE is returned;
+ * otherwise, the codec id is returned
+ */
+enum CodecID ff_rtp_codec_id(const char *buf, enum CodecType codec_type);
 
 #define RTP_PT_PRIVATE 96
 #define RTP_VERSION 2
@@ -61,67 +76,4 @@ extern URLProtocol rtp_protocol;
 #define RTCP_TX_RATIO_NUM 5
 #define RTCP_TX_RATIO_DEN 1000
 
-/** Structure listing useful vars to parse RTP packet payload*/
-typedef struct rtp_payload_data_s
-{
-    int sizelength;
-    int indexlength;
-    int indexdeltalength;
-    int profile_level_id;
-    int streamtype;
-    int objecttype;
-    char *mode;
-
-    /** mpeg 4 AU headers */
-    struct AUHeaders {
-        int size;
-        int index;
-        int cts_flag;
-        int cts;
-        int dts_flag;
-        int dts;
-        int rap_flag;
-        int streamstate;
-    } *au_headers;
-    int nb_au_headers;
-    int au_headers_length_bytes;
-    int cur_au_index;
-} rtp_payload_data_t;
-
-typedef struct AVRtpPayloadType_s
-{
-    int pt;
-    const char enc_name[50]; /* XXX: why 50 ? */
-    enum CodecType codec_type;
-    enum CodecID codec_id;
-    int clock_rate;
-    int audio_channels;
-} AVRtpPayloadType_t;
-
-#if 0
-typedef enum {
-  RTCP_SR   = 200,
-  RTCP_RR   = 201,
-  RTCP_SDES = 202,
-  RTCP_BYE  = 203,
-  RTCP_APP  = 204
-} rtcp_type_t;
-
-typedef enum {
-  RTCP_SDES_END    =  0,
-  RTCP_SDES_CNAME  =  1,
-  RTCP_SDES_NAME   =  2,
-  RTCP_SDES_EMAIL  =  3,
-  RTCP_SDES_PHONE  =  4,
-  RTCP_SDES_LOC    =  5,
-  RTCP_SDES_TOOL   =  6,
-  RTCP_SDES_NOTE   =  7,
-  RTCP_SDES_PRIV   =  8,
-  RTCP_SDES_IMG    =  9,
-  RTCP_SDES_DOOR   = 10,
-  RTCP_SDES_SOURCE = 11
-} rtcp_sdes_type_t;
-#endif
-
-extern AVRtpPayloadType_t AVRtpPayloadTypes[];
-#endif /* RTP_H */
+#endif /* AVFORMAT_RTP_H */
index ddf2448e26d3f6fc719948f037bfddb854bbd98a..d44926ac3a92d05361f3df770654c687cce18b76 100644 (file)
@@ -1,6 +1,6 @@
 /*
  * RTSP definitions
- * Copyright (c) 2002 Fabrice Bellard.
+ * Copyright (c) 2002 Fabrice Bellard
  *
  * This file is part of FFmpeg.
  *
  * License along with FFmpeg; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
-#ifndef RTSP_H
-#define RTSP_H
+#ifndef FFMPEG_RTSP_H
+#define FFMPEG_RTSP_H
 
+#include <stdint.h>
+#include "avformat.h"
 #include "rtspcodes.h"
+#include "rtpdec.h"
+#include "network.h"
 
-enum RTSPProtocol {
-    RTSP_PROTOCOL_RTP_UDP = 0,
-    RTSP_PROTOCOL_RTP_TCP = 1,
-    RTSP_PROTOCOL_RTP_UDP_MULTICAST = 2,
+/**
+ * Network layer over which RTP/etc packet data will be transported.
+ */
+enum RTSPLowerTransport {
+    RTSP_LOWER_TRANSPORT_UDP = 0,           /**< UDP/unicast */
+    RTSP_LOWER_TRANSPORT_TCP = 1,           /**< TCP; interleaved in RTSP */
+    RTSP_LOWER_TRANSPORT_UDP_MULTICAST = 2, /**< UDP/multicast */
+    RTSP_LOWER_TRANSPORT_NB
+};
+
+/**
+ * Packet profile of the data that we will be receiving. Real servers
+ * commonly send RDT (although they can sometimes send RTP as well),
+ * whereas most others will send RTP.
+ */
+enum RTSPTransport {
+    RTSP_TRANSPORT_RTP, /**< Standards-compliant RTP */
+    RTSP_TRANSPORT_RDT, /**< Realmedia Data Transport */
+    RTSP_TRANSPORT_NB
 };
 
 #define RTSP_DEFAULT_PORT   554
@@ -37,54 +56,227 @@ enum RTSPProtocol {
 #define RTSP_RTP_PORT_MIN 5000
 #define RTSP_RTP_PORT_MAX 10000
 
+/**
+ * This describes a single item in the "Transport:" line of one stream as
+ * negotiated by the SETUP RTSP command. Multiple transports are comma-
+ * separated ("Transport: x-read-rdt/tcp;interleaved=0-1,rtp/avp/udp;
+ * client_port=1000-1001;server_port=1800-1801") and described in separate
+ * RTSPTransportFields.
+ */
 typedef struct RTSPTransportField {
-    int interleaved_min, interleaved_max;  /**< interleave ids, if TCP transport */
-    int port_min, port_max; /**< RTP ports */
-    int client_port_min, client_port_max; /**< RTP ports */
-    int server_port_min, server_port_max; /**< RTP ports */
-    int ttl; /**< ttl value */
+    /** interleave ids, if TCP transport; each TCP/RTSP data packet starts
+     * with a '$', stream length and stream ID. If the stream ID is within
+     * the range of this interleaved_min-max, then the packet belongs to
+     * this stream. */
+    int interleaved_min, interleaved_max;
+
+    /** UDP multicast port range; the ports to which we should connect to
+     * receive multicast UDP data. */
+    int port_min, port_max;
+
+    /** UDP client ports; these should be the local ports of the UDP RTP
+     * (and RTCP) sockets over which we receive RTP/RTCP data. */
+    int client_port_min, client_port_max;
+
+    /** UDP unicast server port range; the ports to which we should connect
+     * to receive unicast UDP RTP/RTCP data. */
+    int server_port_min, server_port_max;
+
+    /** time-to-live value (required for multicast); the amount of HOPs that
+     * packets will be allowed to make before being discarded. */
+    int ttl;
+
     uint32_t destination; /**< destination IP address */
-    enum RTSPProtocol protocol;
+
+    /** data/packet transport protocol; e.g. RTP or RDT */
+    enum RTSPTransport transport;
+
+    /** network layer transport protocol; e.g. TCP or UDP uni-/multicast */
+    enum RTSPLowerTransport lower_transport;
 } RTSPTransportField;
 
-typedef struct RTSPHeader {
+/**
+ * This describes the server response to each RTSP command.
+ */
+typedef struct RTSPMessageHeader {
+    /** length of the data following this header */
     int content_length;
+
     enum RTSPStatusCode status_code; /**< response code from server */
+
+    /** number of items in the 'transports' variable below */
     int nb_transports;
-    /** in AV_TIME_BASE unit, AV_NOPTS_VALUE if not used */
+
+    /** Time range of the streams that the server will stream. In
+     * AV_TIME_BASE unit, AV_NOPTS_VALUE if not used */
     int64_t range_start, range_end;
+
+    /** describes the complete "Transport:" line of the server in response
+     * to a SETUP RTSP command by the client */
     RTSPTransportField transports[RTSP_MAX_TRANSPORTS];
-    int seq; /**< sequence number */
+
+    int seq;                         /**< sequence number */
+
+    /** the "Session:" field. This value is initially set by the server and
+     * should be re-transmitted by the client in every RTSP command. */
     char session_id[512];
-} RTSPHeader;
-
-/** the callback can be used to extend the connection setup/teardown step */
-enum RTSPCallbackAction {
-    RTSP_ACTION_SERVER_SETUP,
-    RTSP_ACTION_SERVER_TEARDOWN,
-    RTSP_ACTION_CLIENT_SETUP,
-    RTSP_ACTION_CLIENT_TEARDOWN,
+
+    /** the "RealChallenge1:" field from the server */
+    char real_challenge[64];
+
+    /** the "Server: field, which can be used to identify some special-case
+     * servers that are not 100% standards-compliant. We use this to identify
+     * Windows Media Server, which has a value "WMServer/v.e.r.sion", where
+     * version is a sequence of digits (e.g. 9.0.0.3372). Helix/Real servers
+     * use something like "Helix [..] Server Version v.e.r.sion (platform)
+     * (RealServer compatible)" or "RealServer Version v.e.r.sion (platform)",
+     * where platform is the output of $uname -msr | sed 's/ /-/g'. */
+    char server[64];
+} RTSPMessageHeader;
+
+/**
+ * Client state, i.e. whether we are currently receiving data (PLAYING) or
+ * setup-but-not-receiving (PAUSED). State can be changed in applications
+ * by calling av_read_play/pause().
+ */
+enum RTSPClientState {
+    RTSP_STATE_IDLE,    /**< not initialized */
+    RTSP_STATE_PLAYING, /**< initialized and receiving data */
+    RTSP_STATE_PAUSED,  /**< initialized, but not receiving data */
+};
+
+/**
+ * Identifies particular servers that require special handling, such as
+ * standards-incompliant "Transport:" lines in the SETUP request.
+ */
+enum RTSPServerType {
+    RTSP_SERVER_RTP,  /**< Standards-compliant RTP-server */
+    RTSP_SERVER_REAL, /**< Realmedia-style server */
+    RTSP_SERVER_WMS,  /**< Windows Media server */
+    RTSP_SERVER_NB
 };
 
-typedef struct RTSPActionServerSetup {
-    uint32_t ipaddr;
-    char transport_option[512];
-} RTSPActionServerSetup;
+/**
+ * Private data for the RTSP demuxer.
+ */
+typedef struct RTSPState {
+    URLContext *rtsp_hd; /* RTSP TCP connexion handle */
+
+    /** number of items in the 'rtsp_streams' variable */
+    int nb_rtsp_streams;
+
+    struct RTSPStream **rtsp_streams; /**< streams in this session */
+
+    /** indicator of whether we are currently receiving data from the
+     * server. Basically this isn't more than a simple cache of the
+     * last PLAY/PAUSE command sent to the server, to make sure we don't
+     * send 2x the same unexpectedly or commands in the wrong state. */
+    enum RTSPClientState state;
+
+    /** the seek value requested when calling av_seek_frame(). This value
+     * is subsequently used as part of the "Range" parameter when emitting
+     * the RTSP PLAY command. If we are currently playing, this command is
+     * called instantly. If we are currently paused, this command is called
+     * whenever we resume playback. Either way, the value is only used once,
+     * see rtsp_read_play() and rtsp_read_seek(). */
+    int64_t seek_timestamp;
+
+    /* XXX: currently we use unbuffered input */
+    //    ByteIOContext rtsp_gb;
+
+    int seq;                          /**< RTSP command sequence number */
+
+    /** copy of RTSPMessageHeader->session_id, i.e. the server-provided session
+     * identifier that the client should re-transmit in each RTSP command */
+    char session_id[512];
+
+    /** the negotiated data/packet transport protocol; e.g. RTP or RDT */
+    enum RTSPTransport transport;
+
+    /** the negotiated network layer transport protocol; e.g. TCP or UDP
+     * uni-/multicast */
+    enum RTSPLowerTransport lower_transport;
+
+    /** brand of server that we're talking to; e.g. WMS, REAL or other.
+     * Detected based on the value of RTSPMessageHeader->server or the presence
+     * of RTSPMessageHeader->real_challenge */
+    enum RTSPServerType server_type;
+
+    /** The last reply of the server to a RTSP command */
+    char last_reply[2048]; /* XXX: allocate ? */
+
+    /** RTSPStream->transport_priv of the last stream that we read a
+     * packet from */
+    void *cur_transport_priv;
+
+    /** The following are used for Real stream selection */
+    //@{
+    /** whether we need to send a "SET_PARAMETER Subscribe:" command */
+    int need_subscription;
+
+    /** stream setup during the last frame read. This is used to detect if
+     * we need to subscribe or unsubscribe to any new streams. */
+    enum AVDiscard real_setup_cache[MAX_STREAMS];
+
+    /** the last value of the "SET_PARAMETER Subscribe:" RTSP command.
+     * this is used to send the same "Unsubscribe:" if stream setup changed,
+     * before sending a new "Subscribe:" command. */
+    char last_subscription[1024];
+    //@}
+} RTSPState;
+
+/**
+ * Describes a single stream, as identified by a single m= line block in the
+ * SDP content. In the case of RDT, one RTSPStream can represent multiple
+ * AVStreams. In this case, each AVStream in this set has similar content
+ * (but different codec/bitrate).
+ */
+typedef struct RTSPStream {
+    URLContext *rtp_handle;   /**< RTP stream handle (if UDP) */
+    void *transport_priv; /**< RTP/RDT parse context */
+
+    /** corresponding stream index, if any. -1 if none (MPEG2TS case) */
+    int stream_index;
+
+    /** interleave IDs; copies of RTSPTransportField->interleaved_min/max
+     * for the selected transport. Only used for TCP. */
+    int interleaved_min, interleaved_max;
+
+    char control_url[1024];   /**< url for this stream (from SDP) */
+
+    /** The following are used only in SDP, not RTSP */
+    //@{
+    int sdp_port;             /**< port (from SDP content) */
+    struct in_addr sdp_ip;    /**< IP address (from SDP content) */
+    int sdp_ttl;              /**< IP Time-To-Live (from SDP content) */
+    int sdp_payload_type;     /**< payload type */
+    //@}
+
+    /** rtp payload parsing infos from SDP (i.e. mapping between private
+     * payload IDs and media-types (string), so that we can derive what
+     * type of payload we're dealing with (and how to parse it). */
+    RTPPayloadData rtp_payload_data;
+
+    /** The following are used for dynamic protocols (rtp_*.c/rdt.c) */
+    //@{
+    /** handler structure */
+    RTPDynamicProtocolHandler *dynamic_handler;
 
-typedef int FFRTSPCallback(enum RTSPCallbackAction action,
-                           const char *session_id,
-                           char *buf, int buf_size,
-                           void *arg);
+    /** private data associated with the dynamic protocol */
+    PayloadContext *dynamic_protocol_context;
+    //@}
+} RTSPStream;
 
 int rtsp_init(void);
-void rtsp_parse_line(RTSPHeader *reply, const char *buf);
+void rtsp_parse_line(RTSPMessageHeader *reply, const char *buf);
 
+#if LIBAVFORMAT_VERSION_INT < (53 << 16)
 extern int rtsp_default_protocols;
+#endif
 extern int rtsp_rtp_port_min;
 extern int rtsp_rtp_port_max;
-extern AVInputFormat rtsp_demuxer;
 
 int rtsp_pause(AVFormatContext *s);
 int rtsp_resume(AVFormatContext *s);
 
-#endif /* RTSP_H */
+#endif /* FFMPEG_RTSP_H */
index 74cfb5d5b9f3c543d740a0ab7b06601413fd7401..9ee96bfcd0a8c5fac997ffb7eccf9684e2b1ed16 100644 (file)
@@ -19,6 +19,9 @@
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
+#ifndef AVFORMAT_RTSPCODES_H
+#define AVFORMAT_RTSPCODES_H
+
 /** RTSP handling */
 enum RTSPStatusCode {
 RTSP_STATUS_OK              =200, /**< OK */
@@ -34,3 +37,4 @@ RTSP_STATUS_SERVICE         =503, /**< Service Unavailable */
 RTSP_STATUS_VERSION         =505, /**< RTSP Version not supported */
 };
 
+#endif /* AVFORMAT_RTSPCODES_H */
index 736858adc89906ab8f6d911c49b9f7f688838c81..2754d10df5444c077a8d654b857a62feb4910e8d 100644 (file)
Binary files a/opencv/3rdparty/lib/libavcodec.a and b/opencv/3rdparty/lib/libavcodec.a differ
diff --git a/opencv/3rdparty/lib/libavcodec64.a b/opencv/3rdparty/lib/libavcodec64.a
new file mode 100644 (file)
index 0000000..68e9ad7
Binary files /dev/null and b/opencv/3rdparty/lib/libavcodec64.a differ
index a6f77a31ff12625ca738b6939c281698f637436e..063bbedd1e057f6ca71c873c2949c418c1f2c012 100644 (file)
Binary files a/opencv/3rdparty/lib/libavdevice.a and b/opencv/3rdparty/lib/libavdevice.a differ
diff --git a/opencv/3rdparty/lib/libavdevice64.a b/opencv/3rdparty/lib/libavdevice64.a
new file mode 100644 (file)
index 0000000..0bd2a7f
Binary files /dev/null and b/opencv/3rdparty/lib/libavdevice64.a differ
index 524043fa72b7b80bd8e43ca805462ed9925c099a..08ffab445d2b9c8bf537c194cba5d1019c707e15 100644 (file)
Binary files a/opencv/3rdparty/lib/libavformat.a and b/opencv/3rdparty/lib/libavformat.a differ
diff --git a/opencv/3rdparty/lib/libavformat64.a b/opencv/3rdparty/lib/libavformat64.a
new file mode 100644 (file)
index 0000000..b44edef
Binary files /dev/null and b/opencv/3rdparty/lib/libavformat64.a differ
index fd65b2e732dbac190521a7b5d512b89c191c3826..5db2c6969e782aa9de577b9d2fe230dfa2f98d60 100644 (file)
Binary files a/opencv/3rdparty/lib/libavutil.a and b/opencv/3rdparty/lib/libavutil.a differ
diff --git a/opencv/3rdparty/lib/libavutil64.a b/opencv/3rdparty/lib/libavutil64.a
new file mode 100644 (file)
index 0000000..daf4b62
Binary files /dev/null and b/opencv/3rdparty/lib/libavutil64.a differ
diff --git a/opencv/3rdparty/lib/videoInput64.lib b/opencv/3rdparty/lib/videoInput64.lib
new file mode 100644 (file)
index 0000000..5a205a0
Binary files /dev/null and b/opencv/3rdparty/lib/videoInput64.lib differ
index d538911d4b67a9d7e9a396bf862d19a74eaf4526..8dd80a4b78560c42fe5bf265028c72c0d51ae720 100644 (file)
@@ -683,6 +683,13 @@ if(MSVC)
 endif()\r
 \r
 if(CMAKE_COMPILER_IS_GNUCXX)\r
+\r
+       if(WIN32)\r
+               if(CMAKE_CXX_COMPILER MATCHES "64")\r
+                       set(MINGW64 1)\r
+               endif()\r
+       endif()\r
+\r
     # High level of warnings.\r
     set(EXTRA_C_FLAGS "${EXTRA_C_FLAGS} -Wall")\r
 \r
index 46f906fc0f5e1fafe951500c92953ebe65e702d8..f24b4f4a670cd4e22df0580d07548ee7e21b8265 100644 (file)
@@ -2581,7 +2581,7 @@ template<typename _Tp> inline ptrdiff_t operator - (const SeqIterator<_Tp>& a,
                                                     const SeqIterator<_Tp>& b)
 {
     ptrdiff_t delta = a.index - b.index, n = a.seq->total;
-    if( std::abs(delta) > n )
+    if( std::abs(static_cast<long>(delta)) > n )
         delta += delta < 0 ? n : -n;
     return delta;
 }
index 6563ffe609b926bb848055f6e6ad94ac4185f970..dab1899b66663deaa3263453f61b2924b1215a78 100644 (file)
@@ -73,6 +73,9 @@
   #if ((defined WIN32 || defined _WIN32 || defined WIN64 || defined _WIN64) && \
       (_MSC_VER >= 1400 || defined CV_ICC)) \
       || (defined __SSE2__ && defined __GNUC__ && __GNUC__ >= 4)
+    #if defined WIN64
+               #include <intrin.h>
+       #endif
     #include <emmintrin.h>
     #define CV_SSE2 1
     #if (_MSC_VER >= 1500 || defined CV_ICC) || \
index 48e865ad59ec83cacba574ee6b1cce0801dd1766..5b1c4034993fe57a51e2674a6df7baee37c2e678 100644 (file)
@@ -15,11 +15,18 @@ else ()
 add_dependencies(${the_target} cxcore)
 target_link_libraries(${the_target} cxcore 
                       ${CMAKE_SOURCE_DIR}/3rdparty/lib/libgcc_.a
-                      ${CMAKE_SOURCE_DIR}/3rdparty/lib/libmingwex_.a
-                      ${CMAKE_SOURCE_DIR}/3rdparty/lib/libavformat.a
-                      ${CMAKE_SOURCE_DIR}/3rdparty/lib/libavcodec.a
-                      ${CMAKE_SOURCE_DIR}/3rdparty/lib/libavutil.a
-                      ${CMAKE_SOURCE_DIR}/3rdparty/lib/libwsock32_.a)
+                      ${CMAKE_SOURCE_DIR}/3rdparty/lib/libmingwex_.a)
+       if(WIN32 AND MINGW64)
+       target_link_libraries(${the_target} ${CMAKE_SOURCE_DIR}/3rdparty/lib/libavformat64.a
+                              ${CMAKE_SOURCE_DIR}/3rdparty/lib/libavcodec64.a
+                              ${CMAKE_SOURCE_DIR}/3rdparty/lib/libavutil64.a
+                                                         libws2_32.a)
+    else()
+               target_link_libraries(${the_target} ${CMAKE_SOURCE_DIR}/3rdparty/lib/libavformat.a
+                              ${CMAKE_SOURCE_DIR}/3rdparty/lib/libavcodec.a
+                              ${CMAKE_SOURCE_DIR}/3rdparty/lib/libavutil.a
+                                                         ${CMAKE_SOURCE_DIR}/3rdparty/lib/libwsock32_.a)
+    endif()
 endif ()
 
 set_target_properties(${the_target} PROPERTIES
index 45c2aa593a6ba5a2e434c565ae7a34e893d49ea8..1061535db2ce60d72e46eec01a8c904784294d52 100644 (file)
@@ -555,9 +555,15 @@ That's all there is to it!
 #pragma comment(lib, "libmsvcrtd_.a")
 #endif
 #endif
+#ifdef WIN64
+#pragma comment(lib, "libavformat64.a")
+#pragma comment(lib, "libavcodec64.a")
+#pragma comment(lib, "libavutil64.a")
+#else
 #pragma comment(lib, "libavformat.a")
 #pragma comment(lib, "libavcodec.a")
 #pragma comment(lib, "libavutil.a")
+#endif
 #pragma comment(lib, "libwsock32_.a")
 
 #endif
index dda70ec90912d0668f2b407b61bc843bf6272647..07710c23bae96e3a2eeca7184bbbf2bbb0d912ad 100644 (file)
@@ -249,8 +249,12 @@ if(WIN32)
        endif()
 
        if(MINGW)
-               target_link_libraries(${the_target} vfw32 winmm videoInput strmiids)
-       endif()
+               if(MINGW64)
+                       target_link_libraries(${the_target} msvfw32 avifil32 avicap32 winmm videoInput64 strmiids)
+               else()
+                       target_link_libraries(${the_target} vfw32 winmm videoInput strmiids)
+               endif()  
+    endif()
 endif()
 
 if(APPLE)
index a428542fd0635758f0b99049734fa0c263ae12aa..426ab6d73212ad802c3326d4915548c6d56206d7 100644 (file)
@@ -397,62 +397,64 @@ void cvChangeMode_W32( const char* name, double prop_value)//Yannick Verdie
 
        CV_FUNCNAME( "cvChangeMode_W32" );
 
-    __BEGIN__;
+       __BEGIN__;
 
-    CvWindow* window;
+       CvWindow* window;
 
-    if(!name)
-        CV_ERROR( CV_StsNullPtr, "NULL name string" );
+       if(!name)
+               CV_ERROR( CV_StsNullPtr, "NULL name string" );
 
-    window = icvFindWindowByName( name );
-    if( !window )
-        CV_ERROR( CV_StsNullPtr, "NULL window" );
+       window = icvFindWindowByName( name );
+       if( !window )
+               CV_ERROR( CV_StsNullPtr, "NULL window" );
 
        if(window->flags & CV_WINDOW_AUTOSIZE)//if the flag CV_WINDOW_AUTOSIZE is set
-        EXIT;
-
-       DWORD dwStyle = GetWindowLongPtr(window->frame, GWL_STYLE);
-       CvRect position;
-       
-       if (window->status==CV_WINDOW_FULLSCREEN && prop_value==CV_WINDOW_NORMAL)
-       {
-               icvLoadWindowPos(window->name,position );
-               SetWindowLongPtr(window->frame, GWL_STYLE, dwStyle | WS_CAPTION);
-               
-               SetWindowPos(window->frame, HWND_TOP, position.x, position.y , position.width,position.height, SWP_NOZORDER | SWP_FRAMECHANGED);
-               window->status=CV_WINDOW_NORMAL;
-               
                EXIT;
-       }
-       
-       if (window->status==CV_WINDOW_NORMAL && prop_value==CV_WINDOW_FULLSCREEN)
+
        {
-               //save dimension
-               RECT rect;
-               GetWindowRect(window->frame, &rect);
-               CvRect RectCV = cvRect(rect.left, rect.top,rect.right - rect.left, rect.bottom - rect.top);
-               icvSaveWindowPos(window->name,RectCV );
-       
-               //Look at coordinate for fullscreen
-               HMONITOR hMonitor;
-               MONITORINFO mi;
-               hMonitor = MonitorFromRect(&rect, MONITOR_DEFAULTTONEAREST);
-               
-               mi.cbSize = sizeof(mi);
-               GetMonitorInfo(hMonitor, &mi);
-       
-               //fullscreen
-               position.x=mi.rcMonitor.left;position.y=mi.rcMonitor.top;
-               position.width=mi.rcMonitor.right - mi.rcMonitor.left;position.height=mi.rcMonitor.bottom - mi.rcMonitor.top;
-               SetWindowLongPtr(window->frame, GWL_STYLE, dwStyle & ~WS_CAPTION);
-       
-               SetWindowPos(window->frame, HWND_TOP, position.x, position.y , position.width,position.height, SWP_NOZORDER | SWP_FRAMECHANGED);
-               window->status=CV_WINDOW_FULLSCREEN;
-               
-               EXIT;
+               DWORD dwStyle = GetWindowLongPtr(window->frame, GWL_STYLE);
+               CvRect position;
+
+               if (window->status==CV_WINDOW_FULLSCREEN && prop_value==CV_WINDOW_NORMAL)
+               {
+                       icvLoadWindowPos(window->name,position );
+                       SetWindowLongPtr(window->frame, GWL_STYLE, dwStyle | WS_CAPTION);
+
+                       SetWindowPos(window->frame, HWND_TOP, position.x, position.y , position.width,position.height, SWP_NOZORDER | SWP_FRAMECHANGED);
+                       window->status=CV_WINDOW_NORMAL;
+
+                       EXIT;
+               }
+
+               if (window->status==CV_WINDOW_NORMAL && prop_value==CV_WINDOW_FULLSCREEN)
+               {
+                       //save dimension
+                       RECT rect;
+                       GetWindowRect(window->frame, &rect);
+                       CvRect RectCV = cvRect(rect.left, rect.top,rect.right - rect.left, rect.bottom - rect.top);
+                       icvSaveWindowPos(window->name,RectCV );
+
+                       //Look at coordinate for fullscreen
+                       HMONITOR hMonitor;
+                       MONITORINFO mi;
+                       hMonitor = MonitorFromRect(&rect, MONITOR_DEFAULTTONEAREST);
+
+                       mi.cbSize = sizeof(mi);
+                       GetMonitorInfo(hMonitor, &mi);
+
+                       //fullscreen
+                       position.x=mi.rcMonitor.left;position.y=mi.rcMonitor.top;
+                       position.width=mi.rcMonitor.right - mi.rcMonitor.left;position.height=mi.rcMonitor.bottom - mi.rcMonitor.top;
+                       SetWindowLongPtr(window->frame, GWL_STYLE, dwStyle & ~WS_CAPTION);
+
+                       SetWindowPos(window->frame, HWND_TOP, position.x, position.y , position.width,position.height, SWP_NOZORDER | SWP_FRAMECHANGED);
+                       window->status=CV_WINDOW_FULLSCREEN;
+
+                       EXIT;
+               }
        }
 
-    __END__;
+       __END__;
 }
 
 CV_IMPL int cvNamedWindow( const char* name, int flags )