Move the sources to trunk
[opencv] / otherlibs / cvcam / include / cvcam.h
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 __CVCAM_H__
43 #define __CVCAM_H__
44
45 #ifdef __cplusplus
46 #define CVCAM_EXTERN_C extern "C" 
47 extern "C" {
48 #else
49 #define CVCAM_EXTERN_C
50 #endif /* __cplusplus */
51
52
53 #ifdef CVCAM_EXPORTS
54 #define CVCAM_API CVCAM_EXTERN_C __declspec(dllexport)
55 #else
56 #define CVCAM_API CVCAM_EXTERN_C
57 #endif /* CVCAM_DLLEXPORT */
58
59 /* Returns the actual number of currently available cameras */
60 CVCAM_API int cvcamGetCamerasCount();
61
62 /* get/set the property of the camera. returns 0 if the property is not supported */
63 CVCAM_API int cvcamGetProperty(int camera, const char* property, void* value);
64 CVCAM_API int cvcamSetProperty(int camera, const char* property, void* value);
65
66 /* gets all property names. the actual number of properties is returned. */
67 CVCAM_API int cvcamGetPropertiesList(int camera, const char** properties, int count);
68
69 CVCAM_API int cvcamBuildStereo(void); 
70
71 /* Prepares the currently enabled cameras for work */
72 CVCAM_API int cvcamInit(void);
73
74 /* Start the video */
75 CVCAM_API int cvcamStart(void);
76
77 /* Stop the video */
78 CVCAM_API int cvcamStop(void);
79
80 /* Pause the video; should be used for preventing data changes during frame reading 
81     using "frame" and other properties */
82 CVCAM_API int cvcamPause(void);
83
84 /* Resume the video */
85 CVCAM_API int cvcamResume(void);
86
87 /* Frees all resources */
88 CVCAM_API int cvcamExit(void);
89
90 /*Pops up a camera(s) selection dialog
91 Return value - number of cameras selected (0,1 or 2);
92 Argument: an array of selected cameras numbers
93 NULL if none selected. Should be released with free() when not needed.
94 if NULL passed, not used.
95 */
96 CVCAM_API int cvcamSelectCamera(int** out);
97
98 /*Plays a specified avi file into a specified window
99 if file is NULL, file browser is opened. if window is 0,
100 it is created. width and height mean output size's 0 means
101 those of avi file are used. __cdecl (*callback)(IplImage*) would be
102 called on every frame. NULL means no callback*/
103 CVCAM_API int cvcamPlayAVI(const char* file, 
104                            void* window, 
105                            int width, 
106                            int height,
107                            void* callback); 
108
109
110 /*Advanced API for dealing with AVI files*/
111
112 typedef unsigned int cvcamAVIFILE;
113
114
115 /*Opens a given file or pops up a dialog if file is NULL
116 returns a handle to the file opened for success or -1 for failure*/
117 CVCAM_API cvcamAVIFILE cvcamAVIOpenFile(char* file);
118
119 /*The next functions just do what they say and return 0
120 for success, anything other for failure*/
121
122 CVCAM_API int cvcamAVICloseFile(cvcamAVIFILE file);
123
124 CVCAM_API int cvcamAVISetWindow(cvcamAVIFILE file, void* window);
125
126 CVCAM_API int cvcamAVISetCallback(cvcamAVIFILE file, void* callback);
127
128 CVCAM_API int cvcamAVISetSize(cvcamAVIFILE file, int width, int height);
129
130 CVCAM_API int cvcamAVIRun(cvcamAVIFILE file);
131
132 CVCAM_API int cvcamAVIStop(cvcamAVIFILE file);
133
134 CVCAM_API int cvcamAVIPause(cvcamAVIFILE file);
135
136 CVCAM_API int cvcamAVIResume(cvcamAVIFILE file);
137
138 CVCAM_API int cvcamAVIWaitCompletion(cvcamAVIFILE file);
139
140 CVCAM_API int cvcamAVIIsRunning(cvcamAVIFILE file);
141
142 static const char CVCAM_PROP_ENABLE[] = "enable";
143 static const char CVCAM_PROP_RENDER[] = "render";
144 static const char CVCAM_PROP_WINDOW[] = "window";
145 static const char CVCAM_PROP_CALLBACK[] = "callback";
146 static const char CVCAM_DESCRIPTION[] = "description";
147 static const char CVCAM_VIDEOFORMAT[] = "video_pp";
148 static const char CVCAM_CAMERAPROPS[] = "camera_pp";
149 static const char CVCAM_RNDWIDTH[] = "rendering_width";
150 static const char CVCAM_RNDHEIGHT[] = "rendering_height";
151 static const char CVCAM_SRCWIDTH[] = "source_width";
152 static const char CVCAM_SRCHEIGHT[] = "source_height";
153 static const char CVCAM_STEREO_CALLBACK[] = "stereo_callback";
154 static const char CVCAM_STEREO3_CALLBACK[] = "stereo3_callback";
155 static const char CVCAM_STEREO4_CALLBACK[] = "stereo4_callback";
156 static const char CVCAM_PROP_SETFORMAT[] = "set_video_format";
157 static const char CVCAM_PROP_RAW[] = "raw_image";
158 static const char CVCAM_PROP_TIME_FORMAT[] = "time_format";
159 static const char CVCAM_PROP_DURATION[] = "duration";
160 static const char CVCAM_PROP_POSITION[] = "current_position";
161
162 extern const int FRAMES_FORMAT ;
163 extern const int TIME_FORMAT ;
164
165 typedef struct
166 {
167     char DeviceDescription[100];
168     char device[100];
169     int  channel;
170     char ChannelDescription[100];
171     int  maxwidth;
172     int  maxheight;
173     int  minwidth;
174     int  minheight;
175 }CameraDescription;
176
177 typedef struct
178 {
179     int width;
180     int height;
181     double framerate;
182 }VidFormat;
183
184
185 #define CVCAMTRUE  (void*)1
186 #define CVCAMFALSE (void*)0
187
188 typedef int cvcamWindow;
189
190
191 #ifdef __cplusplus
192 }
193 #endif /* __cplusplus */
194
195 #endif //__CVCAM_H__
196