• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 #define __BEGIN__ __CV_BEGIN__
80 #define __END__  __CV_END__
81 #define EXIT __CV_EXIT__
82 
83 /***************************** CvCapture structure ******************************/
84 
85 struct CvCapture
86 {
~CvCaptureCvCapture87     virtual ~CvCapture() {}
getPropertyCvCapture88     virtual double getProperty(int) const { return 0; }
setPropertyCvCapture89     virtual bool setProperty(int, double) { return 0; }
grabFrameCvCapture90     virtual bool grabFrame() { return true; }
retrieveFrameCvCapture91     virtual IplImage* retrieveFrame(int) { return 0; }
getCaptureDomainCvCapture92     virtual int getCaptureDomain() { return CV_CAP_ANY; } // Return the type of the capture object: CV_CAP_VFW, etc...
93 };
94 
95 /*************************** CvVideoWriter structure ****************************/
96 
97 struct CvVideoWriter
98 {
~CvVideoWriterCvVideoWriter99     virtual ~CvVideoWriter() {}
writeFrameCvVideoWriter100     virtual bool writeFrame(const IplImage*) { return false; }
101 };
102 
103 CvCapture * cvCreateCameraCapture_V4L( int index );
104 CvCapture * cvCreateCameraCapture_DC1394( int index );
105 CvCapture * cvCreateCameraCapture_DC1394_2( int index );
106 CvCapture* cvCreateCameraCapture_MIL( int index );
107 CvCapture* cvCreateCameraCapture_Giganetix( int index );
108 CvCapture * cvCreateCameraCapture_CMU( int index );
109 CV_IMPL CvCapture * cvCreateCameraCapture_TYZX( int index );
110 CvCapture* cvCreateFileCapture_Win32( const char* filename );
111 CvCapture* cvCreateCameraCapture_VFW( int index );
112 CvCapture* cvCreateFileCapture_VFW( const char* filename );
113 CvVideoWriter* cvCreateVideoWriter_Win32( const char* filename, int fourcc,
114                                           double fps, CvSize frameSize, int is_color );
115 CvVideoWriter* cvCreateVideoWriter_VFW( const char* filename, int fourcc,
116                                         double fps, CvSize frameSize, int is_color );
117 CvCapture* cvCreateCameraCapture_DShow( int index );
118 CvCapture* cvCreateCameraCapture_MSMF( int index );
119 CvCapture* cvCreateFileCapture_MSMF (const char* filename);
120 CvVideoWriter* cvCreateVideoWriter_MSMF( const char* filename, int fourcc,
121                                         double fps, CvSize frameSize, int is_color );
122 CvCapture* cvCreateCameraCapture_OpenNI( int index );
123 CvCapture* cvCreateFileCapture_OpenNI( const char* filename );
124 CvCapture* cvCreateCameraCapture_Android( int index );
125 CvCapture* cvCreateCameraCapture_XIMEA( int index );
126 CvCapture* cvCreateCameraCapture_AVFoundation(int index);
127 
128 CvCapture* cvCreateFileCapture_Images(const char* filename);
129 CvVideoWriter* cvCreateVideoWriter_Images(const char* filename);
130 
131 CvCapture* cvCreateFileCapture_XINE (const char* filename);
132 
133 
134 #define CV_CAP_GSTREAMER_1394		0
135 #define CV_CAP_GSTREAMER_V4L		1
136 #define CV_CAP_GSTREAMER_V4L2		2
137 #define CV_CAP_GSTREAMER_FILE		3
138 
139 CvCapture* cvCreateCapture_GStreamer(int type, const char *filename);
140 CvCapture* cvCreateFileCapture_FFMPEG_proxy(const char* filename);
141 
142 
143 CvVideoWriter* cvCreateVideoWriter_FFMPEG_proxy( const char* filename, int fourcc,
144                                             double fps, CvSize frameSize, int is_color );
145 
146 CvCapture * cvCreateFileCapture_QT (const char  * filename);
147 CvCapture * cvCreateCameraCapture_QT  (const int     index);
148 
149 CvVideoWriter* cvCreateVideoWriter_QT ( const char* filename, int fourcc,
150                                         double fps, CvSize frameSize, int is_color );
151 
152 CvCapture* cvCreateFileCapture_AVFoundation (const char * filename);
153 CvVideoWriter* cvCreateVideoWriter_AVFoundation( const char* filename, int fourcc,
154                                                 double fps, CvSize frameSize, int is_color );
155 
156 
157 CvCapture * cvCreateCameraCapture_Unicap  (const int     index);
158 CvCapture * cvCreateCameraCapture_PvAPI  (const int     index);
159 CvVideoWriter* cvCreateVideoWriter_GStreamer( const char* filename, int fourcc,
160                                             double fps, CvSize frameSize, int is_color );
161 
162 namespace cv
163 {
164     class IVideoCapture
165     {
166     public:
~IVideoCapture()167         virtual ~IVideoCapture() {}
getProperty(int) const168         virtual double getProperty(int) const { return 0; }
setProperty(int,double)169         virtual bool setProperty(int, double) { return false; }
170         virtual bool grabFrame() = 0;
171         virtual bool retrieveFrame(int, OutputArray) = 0;
172         virtual bool isOpened() const = 0;
getCaptureDomain()173         virtual int getCaptureDomain() { return CAP_ANY; } // Return the type of the capture object: CAP_VFW, etc...
174     };
175 
176     class IVideoWriter
177     {
178     public:
~IVideoWriter()179         virtual ~IVideoWriter() {}
getProperty(int) const180         virtual double getProperty(int) const { return 0; }
setProperty(int,double)181         virtual bool setProperty(int, double) { return false; }
182 
183         virtual bool isOpened() const = 0;
184         virtual void write(InputArray) = 0;
185     };
186 
187     Ptr<IVideoCapture> createMotionJpegCapture(const String& filename);
188     Ptr<IVideoWriter> createMotionJpegWriter( const String& filename, double fps, Size frameSize, bool iscolor );
189 
190     Ptr<IVideoCapture> createGPhoto2Capture(int index);
191     Ptr<IVideoCapture> createGPhoto2Capture(const String& deviceName);
192 };
193 
194 #endif /* __VIDEOIO_H_ */
195