OpenVideo Documentation

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

v4l.h

Go to the documentation of this file.
00001 //---------------------------------------------------------------------------------
00002 // v4l.h - V4L library definitions
00003 //
00004 // Author:  Ben Bridgwater
00005 // History:
00006 // 03/07/99 Initial version
00007 // 03/14/99 Added V4LBuildRGB8Palette().
00008 // 03/18/99 Added complete set of V4LRGBMasks.
00009 // 03/18/99 Added RGB to/from Y'CrCb conversions.
00010 // 03/20/99 Added remaining planar YUV formats. Fixed FOURCC correspondence.
00011 // 09/10/00 Renamed V4LYCbCrToRGB(), V4LRGBToYCbCr().
00012 // 09/10/00 Fixed Y',Cb,Cr plane order documentaion of planar "YUV" formats.
00013 // 09/16/00 Moved RGB<->YCbCr conversion to rgb2yuv module.
00014 // 09/16/00 Moved V4LBuildRGB8Palette to hi240 module.
00015 //---------------------------------------------------------------------------------
00016 #ifndef _V4L_H
00017 #define _V4L_H
00018 //---------------------------------------------------------------------------------
00019 
00020 #include <sys/types.h> /* ulong for videodev.h */
00021 #include <linux/videodev.h>
00022 
00023 //---------------------------------------------------------------------------------
00024 
00025 // Alternate capture format specifiers ("Y" = Y', "U" = Cb, "V" = Cr). P = Planar.
00026 #ifdef __cplusplus
00027 extern "C" {
00028 #endif
00029 
00030 enum {
00031   V4L_FORMAT_RGB32    = VIDEO_PALETTE_RGB32,   // B G R Alpha
00032   V4L_FORMAT_RGB24    = VIDEO_PALETTE_RGB24,   // B G R
00033   V4L_FORMAT_RGB16    = VIDEO_PALETTE_RGB565,  // r5 g6 b5 15-0 (lo byte, hi byte)
00034   V4L_FORMAT_RGB15    = VIDEO_PALETTE_RGB555,  // r5 g5 b5 14-0 (lo byte, hi byte)
00035 
00036   V4L_FORMAT_HI240    = VIDEO_PALETTE_HI240,   // Hi240 color cube index
00037 
00038   V4L_FORMAT_Y8       = VIDEO_PALETTE_GREY,    // Y'
00039 
00040   V4L_FORMAT_YUV422   = VIDEO_PALETTE_YUV422,  // (YUY2 bttv.c) } Packed YUV format names
00041   V4L_FORMAT_YUYV     = VIDEO_PALETTE_YUYV,    // (Y41P bttv.c) } are ambigous.
00042   V4L_FORMAT_UYVY     = VIDEO_PALETTE_UYVY,    // ( n/a bttv.c) }
00043   V4L_FORMAT_YUV420   = VIDEO_PALETTE_YUV420,  // ( n/a bttv.c) } bttv.c YUY2, Y41P mappings
00044   V4L_FORMAT_YUV411   = VIDEO_PALETTE_YUV411,  // ( n/a bttv.c) } may be driver specific.
00045 
00046   V4L_FORMAT_YUV422P  = VIDEO_PALETTE_YUV422P, // Y W*H, U W/2*H/1, V W/2*H/1 (16 bpp)
00047   V4L_FORMAT_YUV411P  = VIDEO_PALETTE_YUV411P, // Y W*H, U W/4*H/1, V W/4*H/1 (12 bpp)
00048   V4L_FORMAT_YUV420P  = VIDEO_PALETTE_YUV420P, // Y W*H, U W/2*H/2, V W/2*H/2 (12 bpp)
00049   V4L_FORMAT_YUV410P  = VIDEO_PALETTE_YUV410P, // Y W*H, U W/4*H/4, V W/4*H/4 ( 9 bpp)
00050 
00051   // Aliases
00052 
00053   V4L_FORMAT_YUY2     = VIDEO_PALETTE_YUV422,  // 422 YUYV 16 bpp
00054   V4L_FORMAT_Y41P     = VIDEO_PALETTE_YUYV,    // 411 UYVY 12 bpp (aka BtYUV)
00055 
00056   V4L_FORMAT_YUV9     = VIDEO_PALETTE_YUV410P, // U, V reversed from AVI YVU9
00057   V4L_FORMAT_YUV12    = VIDEO_PALETTE_YUV420P  // U, V reversed from AVI YV12
00058 };
00059 
00060 //---------------------------------------------------------------------------------
00061 
00062 // R/G/B masks
00063 
00064 typedef struct {
00065   u_int32_t redMask;
00066   u_int32_t greenMask;
00067   u_int32_t blueMask;
00068 } V4LRGBMasks;
00069 
00070 extern  const V4LRGBMasks v4lRGB15Masks;
00071 extern  const V4LRGBMasks v4lRGB16Masks;
00072 extern  const V4LRGBMasks v4lRGB24Masks;
00073 extern  const V4LRGBMasks v4lRGB32Masks;
00074 
00075 //---------------------------------------------------------------------------------
00076 
00077 // Mask and type to name conversion
00078 
00079 typedef struct {
00080   int  mask; // 0 terminates list
00081   char *name;
00082 } V4LMaskName;
00083 
00084  extern V4LMaskName V4LVideoTypeMaskList[];        // V4LCaps.type
00085 extern  V4LMaskName V4LTunerCapabilityMaskList[];  // V4LTuner.flags
00086 
00087   char *V4LChannelTypeName(int channelType); // V4LChannel.type
00088   char *V4LTunerModeName(int tunerMode);     // V4LTuner.mode
00089   char *V4LFormatName(int format);           // V4LFormat.format, V4LPicture.palette
00090 
00091 //---------------------------------------------------------------------------------
00092 
00093 typedef struct video_capability  V4LCaps;
00094 
00095 typedef struct video_channel     V4LChannel;     // input, NTSC/PAL
00096 typedef struct video_picture     V4LPicture;     //
00097 
00098 typedef struct video_buffer      V4LFramebuffer; // depth => format
00099 typedef struct video_window      V4LWindow;      // x, y, width, height, clipping
00100 typedef struct video_clip        V4LClip;        //
00101 
00102 typedef struct video_mbuf        V4LMMInfo;
00103 
00104 typedef struct video_tuner       V4LTuner;
00105 typedef struct video_audio       V4LAudio;
00106 
00107 typedef struct {
00108   int width;
00109   int height;
00110   int format; // V4L_FORMAT_XXX
00111 } V4LFormat;
00112 
00113 //---------------------------------------------------------------------------------
00114 
00115   int V4LGetCaps(int fd, V4LCaps *v4lCaps);
00116 
00117   int V4LSetSource(int fd, int channel, int norm);
00118   int V4LGetSource(int fd, int channel, V4LChannel *v4lChannel);
00119 
00120   int _V4LSetPicture(int fd, V4LPicture *v4lPicture);
00121   int _V4LGetPicture(int fd, V4LPicture *v4lPicture);
00122 
00123   int V4LSetBrightness(int fd, int brightness); // 0-65535 -> +/-50% luma offset
00124   int V4LSetContrast(int fd, int contrast);     // 0-65535 -> 0-200% luma gain
00125   int V4LSetSaturation(int fd, int saturation); // 0-65535 -> 0-200% chroma gain
00126   int V4LSetHue(int fd, int hue);               // 0-65535 -> +/-90o hue phase
00127 
00128 // Overlay
00129   int V4LOSetFramebuffer(int fd, V4LFramebuffer *v4lFramebuffer); // depth => format
00130   int V4LOGetFramebuffer(int fd, V4LFramebuffer *v4lFramebuffer);
00131   int V4LOSetWindow(int fd, V4LWindow *v4lWindow);
00132   int V4LOGetWindow(int fd, V4LWindow *v4lWindow);
00133   int V4LOCapture(int fd, int on); // 0=off, 1=on
00134 
00135 // Memory
00136   int V4LMGetMMInfo(int fd, V4LMMInfo *v4lMMInfo);
00137   void V4LMSetFormat(V4LFormat *v4lFormat);
00138   void V4LMGetFormat(V4LFormat *v4lFormat);
00139   int V4LMCapture(int fd, int frame);
00140   int V4LMSync(int fd, int frame);
00141 
00142 // TV
00143   int V4LSetTuner(int fd, V4LTuner *v4lTuner);
00144   int V4LGetTuner(int fd, V4LTuner *v4lTuner);
00145   int V4LSetTunerFreq(int fd, ulong tunerFreq);
00146   int V4LGetTunerFreq(int fd, ulong *tunerFreq);
00147   int V4LSetAudio(int fd, V4LAudio *v4lAudio);
00148   int V4LGetAudio(int fd, V4LAudio *v4lAudio);
00149 
00150 #ifdef __cplusplus
00151 }
00152 #endif
00153 
00154 //---------------------------------------------------------------------------------
00155 #endif
00156 //---------------------------------------------------------------------------------
 This page was generated at Wed May 31 13:04:16 2006 for OpenVideo by Doxygen.
 If you have any comments, please send a message to schmalstieg@icg.tu-graz.ac.at.
www.studierstube.org