00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00051 #ifndef __V4L2CAPTURE__H_
00052 #define __V4L2CAPTURE__H_
00053
00054
00055 #ifdef __cplusplus
00056 extern "C"
00057 {
00058 #endif
00059
00060
00061 #include <stdio.h>
00062 #include <fcntl.h>
00063 #include <stdlib.h>
00064 #include <unistd.h>
00065
00066 #include <sys/mman.h>
00067 #include <sys/ioctl.h>
00068
00069 #include <linux/fs.h>
00070 #include <linux/kernel.h>
00071 #include <asm/types.h>
00072 #include <linux/videodev.h>
00073
00074
00075
00076
00077
00078
00079
00080 #define FG_DEFAULT_DEVICE "/dev/video0"
00081
00082
00083 #define FG_DEFAULT_WIDTH 640
00084 #define FG_DEFAULT_HEIGHT 480
00085
00086
00087 #define FG_SOURCE_TV 0
00088 #define FG_SOURCE_COMPOSITE 1
00089 #define FG_SOURCE_SVIDEO 2
00090
00091
00096 struct my_buffer
00097 {
00098 int id;
00099 void * start;
00100 size_t length;
00101 struct v4l2_buffer *buf;
00102 };
00103
00104
00108 typedef struct
00109 {
00110 char* device;
00111 int fd;
00112 struct v4l2_capability caps;
00113 unsigned int numOfIn;
00114 struct v4l2_input* sources;
00115 int source;
00116 struct v4l2_format frmt;
00117 struct my_buffer *buffers;
00118 unsigned int n_buffers;
00119
00120 struct v4l2_queryctrl *controls;
00121 unsigned int numOfCtls;
00122
00123 int isCapturing;
00124 unsigned int pix_fmt;
00125 unsigned int width;
00126 unsigned int height;
00127 enum v4l2_field field;
00128 int depth;
00129 enum v4l2_field altField;
00130
00131
00132
00133
00134 struct v4l2_tuner tuner;
00135 int cur_frame;
00136
00137 } FRAMEGRABBER2;
00138
00139
00140
00141
00142
00143
00144
00145
00146
00151 FRAMEGRABBER2* fg2_createFrameGrabber();
00152
00153
00158 void fg2_delete(FRAMEGRABBER2** fg);
00159
00160
00168 int fg2_open( FRAMEGRABBER2* fg, const char *dev);
00169
00170
00171
00172
00173
00174
00180 int fg2_startCapture(FRAMEGRABBER2* fg);
00181
00188 int fg2_stopCapture(FRAMEGRABBER2* fg);
00189
00190
00191
00198 struct my_buffer *getFrameBuffer( FRAMEGRABBER2* fg );
00199
00200
00206 void giveBackFrameBuffer( FRAMEGRABBER2* fg, struct my_buffer *mBuff);
00207
00208
00209
00210
00211
00212
00216 int fg2_get_source_count( FRAMEGRABBER2* fg );
00217
00221 int fg2_get_source_id( FRAMEGRABBER2* fg);
00222
00226 const char* fg2_get_source_name( FRAMEGRABBER2* fg);
00227
00231 const char* fg2_get_id_source_name( FRAMEGRABBER2* fg, int src );
00232
00236 const char * fg2_get_device_name( FRAMEGRABBER2* fg );
00237
00243 int fg2_set_source( FRAMEGRABBER2* fg, int src, const char *strSrc );
00244
00245
00246
00247
00248
00249
00253 int fg2_countControls( FRAMEGRABBER2* fg);
00254
00259 int fg2_setControlValueI( FRAMEGRABBER2* fg, int id, double val);
00264 int fg2_setControlValue( FRAMEGRABBER2* fg, const char *id, double val);
00265
00270 double fg2_getControlValueI( FRAMEGRABBER2* fg, int id);
00275 double fg2_getControlValue( FRAMEGRABBER2* fg, const char *id);
00276
00277
00278 const char *fg2_getControlName( FRAMEGRABBER2* fg, int id);
00279
00280
00281
00282
00283
00284
00288 int fg2_set_source_norm( FRAMEGRABBER2* fg, v4l2_std_id norm );
00289
00290
00294 int fg2_setPixelSettings( FRAMEGRABBER2* fg, int width, int height,
00295 unsigned int fmt, enum v4l2_field fld, int depth );
00296
00297
00298
00299 #ifdef __cplusplus
00300 }
00301 #endif
00302
00303 #endif