core/vidl/vidl_v4l_params.h
Go to the documentation of this file.
00001 // This is core/vidl/vidl_v4l_params.h
00002 #ifndef vidl_v4l_params_h_
00003 #define vidl_v4l_params_h_
00004 #ifdef VCL_NEEDS_PRAGMA_INTERFACE
00005 #pragma interface
00006 #endif
00007 //:
00008 // \file
00009 // \brief A parameters struct for v4l1 camera streams
00010 //
00011 // \author Brendan McCane
00012 // \date 15 Mar 2006
00013 //
00014 // These parameters are described by the v4l1 API specification
00015 // http://www.linuxtv.org/downloads/video4linux/API/V4L1_API.html
00016 
00017 
00018 #include "vidl_pixel_format.h"
00019 #include <linux/videodev.h>
00020 
00021 //: A parameters struct for v4l1 camera streams
00022 
00023 struct vidl_v4l_params
00024 {
00025     //: convert from vidl pixel format to v4l pixel format
00026     static int vidlpf_to_v4lpf(vidl_pixel_format vid_pf);
00027 
00028     //: convert from v4l pixel format to vidl pixel format
00029     static vidl_pixel_format v4lpf_to_vidlpf(int v4l_pf);
00030 
00031     //: construct with default params
00032     vidl_v4l_params(): ni_(320), nj_(240), brightness_(31744), hue_(65535),
00033                         colour_(32768), contrast_(32768), whiteness_(49152),
00034                         depth_(24), pixel_format_(VIDL_PIXEL_FORMAT_YUV_420P)
00035     {}
00036 
00037     //: get the current resolution
00038     vidl_v4l_params& resolution(unsigned int ni, unsigned int nj) {
00039         ni_=ni;nj_=nj;
00040         return *this;
00041     }
00042 
00043     //: brightness
00044     vidl_v4l_params& brightness(int brghtness) {
00045         brightness_=brghtness;
00046         return *this;
00047     }
00048 
00049     //: hue
00050     vidl_v4l_params& hue(int hu) {
00051         hue_=hu;
00052         return *this;
00053     }
00054 
00055     //: colour
00056     vidl_v4l_params& colour(int color) {
00057         colour_=color;
00058         return *this;
00059     }
00060 
00061     //: contrast
00062     vidl_v4l_params& contrast(int contrst) {
00063         contrast_=contrst;
00064         return *this;
00065     }
00066 
00067     //: whiteness
00068     vidl_v4l_params& whiteness(int whitenss) {
00069         whiteness_=whitenss;
00070         return *this;
00071     }
00072 
00073     //: depth
00074     vidl_v4l_params& depth(int dpth) {
00075         depth_=dpth;
00076         return *this;
00077     }
00078 
00079     //: palette
00080     vidl_v4l_params& pixel_format(vidl_pixel_format pf) {
00081         pixel_format_=pf;
00082         return *this;
00083     }
00084 
00085     unsigned int ni_, nj_;
00086     int brightness_;
00087     int hue_;
00088     int colour_;
00089     int contrast_;
00090     int whiteness_;
00091     int depth_;
00092     vidl_pixel_format pixel_format_;
00093 };
00094 
00095 #endif