00001 #ifndef PWCWRAPPER_H_
00002 #define PWCWRAPPER_H_
00003
00004 #include <linux/videodev.h>
00005 #include <sys/ioctl.h>
00006 #include "pwc-ioctl.h"
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018 typedef void (CV_CDECL* CvCaptureCloseFunc) ( CvCapture* capture );
00019 typedef int (CV_CDECL* CvCaptureGrabFrameFunc) ( CvCapture* capture );
00020 typedef IplImage * (CV_CDECL* CvCaptureRetrieveFrameFunc) ( CvCapture* capture );
00021 typedef double (CV_CDECL* CvCaptureGetPropertyFunc) ( CvCapture* capture, int id );
00022 typedef int (CV_CDECL* CvCaptureSetPropertyFunc) ( CvCapture* capture, int id, double value );
00023 typedef const char * (CV_CDECL* CvCaptureGetDescriptionFunc)( CvCapture* capture );
00024
00034 typedef struct CvCaptureVTable
00035 {
00036 int count;
00037 CvCaptureCloseFunc close;
00038 CvCaptureGrabFrameFunc grab_frame;
00039 CvCaptureRetrieveFrameFunc retrieve_frame;
00040 CvCaptureGetPropertyFunc get_property;
00041 CvCaptureSetPropertyFunc set_property;
00042 CvCaptureGetDescriptionFunc get_description;
00043 }
00044 CvCaptureVTable;
00045
00056 typedef struct CvCaptureCAM_V4L
00057 {
00058 CvCaptureVTable* vtable;
00059 int deviceHandle;
00060 int bufferIndex;
00061 int FirstCapture;
00062 struct video_capability capability;
00063 struct video_window captureWindow;
00064 struct video_picture imageProperties;
00065 struct video_mbuf memoryBuffer;
00066 struct video_mmap *mmaps;
00067 char *memoryMap;
00068 IplImage frame;
00069 #ifdef HAVE_CAMV4L2
00070 buffer buffers[10];
00071 struct v4l2_capability cap;
00072 struct v4l2_input inp;
00073 struct v4l2_format form;
00074 struct v4l2_crop crop;
00075 struct v4l2_cropcap cropcap;
00076 struct v4l2_requestbuffers req;
00077 struct v4l2_jpegcompression compr;
00078 struct v4l2_control control;
00079 enum v4l2_buf_type type;
00080 struct v4l2_queryctrl queryctrl;
00081 struct v4l2_querymenu querymenu;
00082 int v4l2_brightness, v4l2_brightness_min, v4l2_brightness_max;
00083 int v4l2_contrast, v4l2_contrast_min, v4l2_contrast_max;
00084 int v4l2_saturation, v4l2_saturation_min, v4l2_saturation_max;
00085 int v4l2_hue, v4l2_hue_min, v4l2_hue_max;
00086 int v4l2_gain, v4l2_gain_min, v4l2_gain_max;
00087 #endif
00088 }
00089 CvCaptureCAM_V4L;
00090
00101 class PwcWrapper {
00102
00103 public:
00104
00109 PwcWrapper(CvCapture* camera_device){ cam = (CvCaptureCAM_V4L*)camera_device; }
00110
00114 ~PwcWrapper(){}
00115
00119 int GetFrameRate();
00120
00124 void SetFrameRate(int fps);
00125
00132 void SaveUserSettingsToEEPROM();
00133
00137 void RestoreUserSettingsFromEEPROM();
00138
00142 void ResetEEPROM();
00143
00149 int GetCompressionMode();
00150
00156 void SetCompressionMode(int newmode);
00157
00161 int GetAutomaticGainControl();
00162
00172 void SetAutomaticGainControl(int newagc);
00173
00178 void SetShutterSpeed(int speed);
00179
00189 void SetWhitebalance(int mode, int red, int blue);
00190
00196 void SetAutomaticWhiteBalanceSpeed(int speed, int delay);
00197
00202 void SetCameraLED(int on_time, int off_time);
00203
00208 void SetElectronicSharpness(int newvalue);
00209
00214 void SetBacklightCompensationMode(int newmode);
00215
00223 void SetAntiFlickerMode(int newmode);
00224
00229 void SetDynamicNoiseReductionMode(int newmode);
00230
00235 void PrintRealImageSize();
00236
00237 private:
00238
00242 CvCaptureCAM_V4L* cam;
00243 };
00244
00245 #endif