CVD 0.8
cvd/Linux/v4l2frame.h
00001 /*                       
00002     This file is part of the CVD Library.
00003 
00004     Copyright (C) 2005 The Authors
00005 
00006     This library is free software; you can redistribute it and/or
00007     modify it under the terms of the GNU Lesser General Public
00008     License as published by the Free Software Foundation; either
00009     version 2.1 of the License, or (at your option) any later version.
00010 
00011     This library is distributed in the hope that it will be useful,
00012     but WITHOUT ANY WARRANTY; without even the implied warranty of
00013     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00014     Lesser General Public License for more details.
00015 
00016     You should have received a copy of the GNU Lesser General Public
00017     License along with this library; if not, write to the Free Software
00018     Foundation, Inc., 
00019     51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
00020 */
00021 //-*- c++ -*-
00022 
00024 //                                                                  //
00025 //   v4l2Frame - An image with a timestamp and an index             //
00026 //                                                                  //
00027 //   C Kemp Nov 2002                                                //
00028 //                                                                  //
00030 
00031 #ifndef CVD_V4L2FRAME_H
00032 #define CVD_V4L2FRAME_H
00033 
00034 #include <cvd/videoframe.h>
00035 #include <cvd/config.h>
00036 
00037 #ifdef CVD_INTERNAL_HAVE_STRANGE_V4L2
00038     #include <videodevx/videodev.h>
00039 #else
00040     #include <linux/videodev2.h>
00041 #endif
00042 
00043 namespace CVD {
00044 
00048 template <class T>  
00049 class V4L2FrameT : public VideoFrame<T>
00050 {
00051     friend class V4L2Buffer_Base;
00052 
00053     protected:
00060       V4L2FrameT(double t, const ImageRef& size, int index, T *data, VideoFrameFlags::FieldType f) 
00061         : VideoFrame<T>(t, data, size, f),my_index(index)
00062         {
00063         }
00064         
00065 
00066         //Only 2.6 needs this, but it does no harm in 2.4
00067         struct v4l2_buffer* m_buf;
00068 
00069 
00070       int my_index;
00071 
00072       ~V4L2FrameT() 
00073       {}
00074 
00075     public:
00076 
00077 };
00078 
00080 typedef V4L2FrameT<unsigned char> V4L2Frame;
00081 
00082 
00083 }
00084 
00085 #endif