libcvd
videoframe.h
1 // //
3 // VideoFrame - An image with a timestamp, like from a video //
4 // source //
5 // //
6 // Tom Drummond 3 April 2002 //
7 // //
9 
10 #ifndef CVD_VIDEOFRAME_H
11 #define CVD_VIDEOFRAME_H
12 
13 #include <cvd/image.h>
14 
15 namespace CVD
16 {
17 
18 namespace VideoFrameFlags
19 {
21  enum FieldType
22  {
23  Top,
24  Bottom,
25  Both,
26  Progressive,
27  Unknown
28  };
29 }
30 
34 template <class T>
35 class VideoFrame : public BasicImage<T>
36 {
37  public:
43  VideoFrame(double t, T* data, const ImageRef& size, VideoFrameFlags::FieldType f = VideoFrameFlags::Unknown)
44  : BasicImage<T>(data, size)
45  , my_field(f)
46  , my_timestamp(t)
47  {
48  }
49 
54  VideoFrame(double t, const BasicImage<T>& im, VideoFrameFlags::FieldType f = VideoFrameFlags::Unknown)
55  : BasicImage<T>(im)
56  , my_field(f)
57  , my_timestamp(t)
58  {
59  }
60 
62  double timestamp() const
63  {
64  return my_timestamp;
65  }
66 
67  VideoFrameFlags::FieldType field() const
68  {
69  return my_field;
70  }
71 
72  protected:
74  virtual ~VideoFrame()
75  {
76  }
77 
78  VideoFrameFlags::FieldType my_field;
79  double my_timestamp;
80 };
81 
82 }
83 
84 #endif
double my_timestamp
Type of field in this frame.
Definition: videoframe.h:79
virtual ~VideoFrame()
We don&#39;t usually delete video frames. Some special destruction is usually needed. ...
Definition: videoframe.h:74
All classes and functions are within the CVD namespace.
Definition: argb.h:6
double timestamp() const
What is the time (since boot) of this frame?
Definition: videoframe.h:62
Definition: image_ref.h:29
A generic image class to manage a block of arbitrarily padded data as an image.
Definition: image.h:273
A frame from a VideoBuffer.
Definition: videoframe.h:35
Unknown image type (can be returned by string_to_image_type.
Definition: image_io.h:40
VideoFrame(double t, const BasicImage< T > &im, VideoFrameFlags::FieldType f=VideoFrameFlags::Unknown)
(Used internally) Construct a VideoFrame from a BasicImage
Definition: videoframe.h:54
VideoFrame(double t, T *data, const ImageRef &size, VideoFrameFlags::FieldType f=VideoFrameFlags::Unknown)
(Used internally) Construct a VideoFrame around a block of memory.
Definition: videoframe.h:43