CVD 0.8
cvd/videoframe.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 */
00022 //                                                                  //
00023 //   VideoFrame - An image with a timestamp, like from a video      //
00024 //                source                                            //
00025 //                                                                  //
00026 //   Tom Drummond     3 April 2002                                  //
00027 //                                                                  //
00029 
00030 #ifndef CVD_VIDEOFRAME_H
00031 #define CVD_VIDEOFRAME_H
00032 
00033 #include <cvd/image.h>
00034 
00035 namespace CVD {
00036 
00037   namespace VideoFrameFlags 
00038     {
00040       enum FieldType{
00041     Top,
00042     Bottom,
00043     Both,
00044     Progressive,
00045     Unknown
00046       };
00047     }      
00048 
00052 template <class T>
00053 class VideoFrame : public BasicImage<T> 
00054 {
00055     public:
00061         VideoFrame(double t, T* data, const ImageRef& size, VideoFrameFlags::FieldType f=VideoFrameFlags::Unknown) 
00062           :BasicImage<T>(data, size),my_field(f),my_timestamp(t)
00063         {
00064         }
00065 
00070         VideoFrame(double t, const BasicImage<T>& im, VideoFrameFlags::FieldType f=VideoFrameFlags::Unknown) 
00071           :BasicImage<T>(im),my_field(f),my_timestamp(t)
00072         {
00073         }
00074 
00076         double timestamp() const
00077         {
00078             return my_timestamp;
00079         }
00080 
00081         VideoFrameFlags::FieldType field() const
00082         {
00083             return my_field;
00084         }
00085 
00086     protected:
00088         virtual ~VideoFrame()
00089         {
00090         }
00091 
00092         VideoFrameFlags::FieldType my_field;  
00093         double my_timestamp;  
00094 };
00095 
00096 }
00097 
00098 
00099 #endif