00001
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022 #ifndef V4L_SOURCE_H
00023 #define V4L_SOURCE_H
00024
00025 #include <linux/videodev.h>
00026
00027 #include "ImageSource.h"
00028 #include "Image.h"
00029
00030
00031 class Video4LinuxSource : public ImageSource
00042 {
00043 protected:
00044
00045
00046 int fd;
00047
00048
00049
00050 unsigned char* buff;
00051 unsigned int buffsize;
00052 int currentBuffer;
00053 int numBuffers;
00054
00055
00056
00057 unsigned int width;
00058 unsigned int height;
00059 unsigned int size;
00060
00061 video_mbuf mbuf;
00062 video_mmap vmmap;
00063 int palette;
00064
00065 bool capture;
00071 public:
00072
00073
00075 Video4LinuxSource(char* device, bool sup_memory_map);
00076
00077 virtual ~Video4LinuxSource();
00078
00079
00080
00081 virtual ImageSource& operator >> (ImageRGB&);
00082 virtual ImageSource& operator >> (ImageGrey&);
00083 virtual ImageSource& operator >> (Image&);
00084
00086 void set_size(unsigned int, unsigned int);
00087
00089 void set_framerate(unsigned int);
00090
00092 void set_palette(int);
00093
00095 void set_channel(int);
00096
00097
00099 virtual void get_size(unsigned int&, unsigned int&);
00100
00102 void get_framerate(unsigned int&);
00103
00105 void get_palette(int&);
00106
00107 protected:
00108
00109
00110
00111
00112 inline int set_capability(video_capability&);
00113 inline int set_frameBuffer(video_buffer&);
00114 inline int set_captureWindows(video_window&);
00115 inline int set_videoSource(int);
00116 inline int set_imageProperties(video_picture&);
00117 inline int set_tuning(video_tuner&);
00118 inline int set_memoryBuffer(video_mbuf&);
00119
00120
00121
00122 inline int get_capability(video_capability&);
00123 inline int get_frameBuffer(video_buffer&);
00124 inline int get_captureWindows(video_window&);
00125 inline int get_videoSource(video_channel&);
00126 inline int get_imageProperties(video_picture&);
00127 inline int get_tuning(video_tuner&);
00128 inline int get_memoryBuffer(video_mbuf&);
00129
00130
00131
00132 void print_capability(video_capability&);
00133 void print_frameBuffer(video_buffer&);
00134 void print_captureWindows(video_window&);
00135 void print_videoSource(video_channel&);
00136 void print_imageProperties(video_picture&);
00137 void print_tuning(video_tuner&);
00138 void print_memoryBuffer(video_mbuf&);
00139
00140
00141
00143 void (*convert_rgb) (int width, int height, void*, void*);
00144
00146 void (*convert_grey) (int width, int height, void*, void*);
00147
00148 };
00149
00150 #define DEBUG_V4L_SOURCE
00151 #endif // V4L_SOURCE_H