Main Page   Class Hierarchy   Compound List   File List   Compound Members   File Members   Related Pages  

Video4LinuxSource.h

Go to the documentation of this file.
00001 /*************************************************************************
00008  *
00009  * Source code for Real Time Image Library (libRTImage) 
00010  *
00011  * Leeds Vision Group give permission for this code to be copied, modified 
00012  * and distributed within the University of Leeds subject to the following
00013  * conditions:-
00014  *
00015  * - The code is not to be used for commercial gain.
00016  * - The code and use thereof will be attributed to the authors where
00017  *   appropriate (including demonstrations which rely on it's use).
00018  * - All modified, distributions of the source files will retain this header.
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 /* Protected Members */
00045         
00046         int             fd;             
00047         
00048         // internal temporary buffer
00049         
00050         unsigned char*  buff;           
00051         unsigned int    buffsize;       
00052         int             currentBuffer;  
00053         int             numBuffers;     
00054         
00055         // source attributes
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 /* Public Methods */
00073         
00075         Video4LinuxSource(char* device, bool sup_memory_map);
00076 
00077         virtual ~Video4LinuxSource();
00078 
00079         /* Extraction operators */
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 /* Protected Methods */
00109 
00110         // wrappers for ioctl set calls
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         // wrappers for ioctl get calls
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         // methods to display device information
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         // conversion function pointers
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

Generated at Fri Aug 13 17:29:21 2004 for libRTImage by doxygen1.2.8.1 written by Dimitri van Heesch, © 1997-2001