Merge remote-tracking branch 'origin/master' into merge-2.4
[profile/ivi/opencv.git] / modules / videoio / src / precomp.hpp
1 /*M///////////////////////////////////////////////////////////////////////////////////////
2 //
3 //  IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING.
4 //
5 //  By downloading, copying, installing or using the software you agree to this license.
6 //  If you do not agree to this license, do not download, install,
7 //  copy or use the software.
8 //
9 //
10 //                        Intel License Agreement
11 //                For Open Source Computer Vision Library
12 //
13 // Copyright (C) 2000, Intel Corporation, all rights reserved.
14 // Third party copyrights are property of their respective owners.
15 //
16 // Redistribution and use in source and binary forms, with or without modification,
17 // are permitted provided that the following conditions are met:
18 //
19 //   * Redistribution's of source code must retain the above copyright notice,
20 //     this list of conditions and the following disclaimer.
21 //
22 //   * Redistribution's in binary form must reproduce the above copyright notice,
23 //     this list of conditions and the following disclaimer in the documentation
24 //     and/or other materials provided with the distribution.
25 //
26 //   * The name of Intel Corporation may not be used to endorse or promote products
27 //     derived from this software without specific prior written permission.
28 //
29 // This software is provided by the copyright holders and contributors "as is" and
30 // any express or implied warranties, including, but not limited to, the implied
31 // warranties of merchantability and fitness for a particular purpose are disclaimed.
32 // In no event shall the Intel Corporation or contributors be liable for any direct,
33 // indirect, incidental, special, exemplary, or consequential damages
34 // (including, but not limited to, procurement of substitute goods or services;
35 // loss of use, data, or profits; or business interruption) however caused
36 // and on any theory of liability, whether in contract, strict liability,
37 // or tort (including negligence or otherwise) arising in any way out of
38 // the use of this software, even if advised of the possibility of such damage.
39 //
40 //M*/
41
42 #ifndef __VIDEOIO_H_
43 #define __VIDEOIO_H_
44
45 #include "opencv2/videoio.hpp"
46
47 #include "opencv2/core/utility.hpp"
48 #include "opencv2/core/private.hpp"
49
50 #include "opencv2/imgcodecs.hpp"
51
52 #include "opencv2/imgproc/imgproc_c.h"
53 #include "opencv2/imgcodecs/imgcodecs_c.h"
54 #include "opencv2/videoio/videoio_c.h"
55
56 #include <stdlib.h>
57 #include <stdio.h>
58 #include <string.h>
59 #include <limits.h>
60 #include <ctype.h>
61 #include <assert.h>
62
63 #if defined WIN32 || defined WINCE
64     #if !defined _WIN32_WINNT
65         #ifdef HAVE_MSMF
66             #define _WIN32_WINNT 0x0600 // Windows Vista
67         #else
68             #define _WIN32_WINNT 0x0500 // Windows 2000
69         #endif
70     #endif
71
72     #include <windows.h>
73     #undef small
74     #undef min
75     #undef max
76     #undef abs
77 #endif
78
79 #ifdef HAVE_TEGRA_OPTIMIZATION
80 #include "opencv2/videoio/videoio_tegra.hpp"
81 #endif
82
83 #define __BEGIN__ __CV_BEGIN__
84 #define __END__  __CV_END__
85 #define EXIT __CV_EXIT__
86
87 /***************************** CvCapture structure ******************************/
88
89 struct CvCapture
90 {
91     virtual ~CvCapture() {}
92     virtual double getProperty(int) { return 0; }
93     virtual bool setProperty(int, double) { return 0; }
94     virtual bool grabFrame() { return true; }
95     virtual IplImage* retrieveFrame(int) { return 0; }
96     virtual int getCaptureDomain() { return CV_CAP_ANY; } // Return the type of the capture object: CV_CAP_VFW, etc...
97 };
98
99 /*************************** CvVideoWriter structure ****************************/
100
101 struct CvVideoWriter
102 {
103     virtual ~CvVideoWriter() {}
104     virtual bool writeFrame(const IplImage*) { return false; }
105 };
106
107 CvCapture * cvCreateCameraCapture_V4L( int index );
108 CvCapture * cvCreateCameraCapture_DC1394( int index );
109 CvCapture * cvCreateCameraCapture_DC1394_2( int index );
110 CvCapture* cvCreateCameraCapture_MIL( int index );
111 CvCapture* cvCreateCameraCapture_Giganetix( int index );
112 CvCapture * cvCreateCameraCapture_CMU( int index );
113 CV_IMPL CvCapture * cvCreateCameraCapture_TYZX( int index );
114 CvCapture* cvCreateFileCapture_Win32( const char* filename );
115 CvCapture* cvCreateCameraCapture_VFW( int index );
116 CvCapture* cvCreateFileCapture_VFW( const char* filename );
117 CvVideoWriter* cvCreateVideoWriter_Win32( const char* filename, int fourcc,
118                                           double fps, CvSize frameSize, int is_color );
119 CvVideoWriter* cvCreateVideoWriter_VFW( const char* filename, int fourcc,
120                                         double fps, CvSize frameSize, int is_color );
121 CvCapture* cvCreateCameraCapture_DShow( int index );
122 CvCapture* cvCreateCameraCapture_MSMF( int index );
123 CvCapture* cvCreateFileCapture_MSMF (const char* filename);
124 CvVideoWriter* cvCreateVideoWriter_MSMF( const char* filename, int fourcc,
125                                         double fps, CvSize frameSize, int is_color );
126 CvCapture* cvCreateCameraCapture_OpenNI( int index );
127 CvCapture* cvCreateFileCapture_OpenNI( const char* filename );
128 CvCapture* cvCreateCameraCapture_Android( int index );
129 CvCapture* cvCreateCameraCapture_XIMEA( int index );
130 CvCapture* cvCreateCameraCapture_AVFoundation(int index);
131
132 CvCapture* cvCreateFileCapture_Images(const char* filename);
133 CvVideoWriter* cvCreateVideoWriter_Images(const char* filename);
134
135 CvCapture* cvCreateFileCapture_XINE (const char* filename);
136
137
138 #define CV_CAP_GSTREAMER_1394           0
139 #define CV_CAP_GSTREAMER_V4L            1
140 #define CV_CAP_GSTREAMER_V4L2           2
141 #define CV_CAP_GSTREAMER_FILE           3
142
143 CvCapture* cvCreateCapture_GStreamer(int type, const char *filename);
144 CvCapture* cvCreateFileCapture_FFMPEG_proxy(const char* filename);
145
146
147 CvVideoWriter* cvCreateVideoWriter_FFMPEG_proxy( const char* filename, int fourcc,
148                                             double fps, CvSize frameSize, int is_color );
149
150 CvCapture * cvCreateFileCapture_QT (const char  * filename);
151 CvCapture * cvCreateCameraCapture_QT  (const int     index);
152
153 CvVideoWriter* cvCreateVideoWriter_QT ( const char* filename, int fourcc,
154                                         double fps, CvSize frameSize, int is_color );
155
156 CvCapture* cvCreateFileCapture_AVFoundation (const char * filename);
157 CvVideoWriter* cvCreateVideoWriter_AVFoundation( const char* filename, int fourcc,
158                                                 double fps, CvSize frameSize, int is_color );
159
160
161 CvCapture * cvCreateCameraCapture_Unicap  (const int     index);
162 CvCapture * cvCreateCameraCapture_PvAPI  (const int     index);
163 CvVideoWriter* cvCreateVideoWriter_GStreamer( const char* filename, int fourcc,
164                                             double fps, CvSize frameSize, int is_color );
165
166 namespace cv
167 {
168     class IVideoCapture
169     {
170     public:
171         virtual ~IVideoCapture() {}
172         virtual double getProperty(int) { return 0; }
173         virtual bool setProperty(int, double) { return 0; }
174         virtual bool grabFrame() = 0;
175         virtual bool retrieveFrame(int, cv::OutputArray) = 0;
176         virtual int getCaptureDomain() { return CAP_ANY; } // Return the type of the capture object: CAP_VFW, etc...
177     };
178 };
179
180 #endif /* __VIDEOIO_H_ */