libcvd
localvideoframe.h
1 /*******************************************************************************
2 
3  LocalVideoFrame - A video frame for when the data is local snd should be
4  managed by the program instead of the system. Uses Image
5  to manage the memory. Programs which will only ever use
6  these can be optimized by using the image() methos. These
7  can be deleted sensibly, but it is not currently allowed,
8  to make the interface more consistent.
9 
10  E. Rosten - 18 March 2005
11 
12  *******************************************************************************/
13 
14 #ifndef CVD_LOCALVIDEOFRAME_FRAME_H
15 #define CVD_LOCALVIDEOFRAME_FRAME_H
16 
17 #include <cvd/videoframe.h>
18 #include <string>
19 
20 namespace CVD
21 {
29 template <class T>
30 class LocalVideoFrame : public VideoFrame<T>
31 {
32 
33  public:
34  virtual ~LocalVideoFrame()
35  {
36  }
37 
43  LocalVideoFrame(double time, CVD::Image<T>&& local)
44  : VideoFrame<T>(time, nullptr, local.size())
45  , im(std::move(local))
46  {
47  this->my_data = im.data();
48  }
49 
53  {
54  return im;
55  }
56  const Image<T>& image() const
57  {
58  return im;
59  }
60 
61  double& timestamp()
62  {
63  return this->my_timestamp;
64  }
65 
66  private:
67  CVD::Image<T> im;
68 };
69 }
70 
71 #endif
double my_timestamp
Type of field in this frame.
Definition: videoframe.h:79
LocalVideoFrame(double time, CVD::Image< T > &&local)
Construct a video frame from an Image and a timestamp.
Definition: localvideoframe.h:43
All classes and functions are within the CVD namespace.
Definition: argb.h:6
ImageRef size() const
What is the size of this image?
Definition: image.h:557
Image< T > & image()
Returns the image.
Definition: localvideoframe.h:52
A frame from a VideoBuffer.
Definition: videoframe.h:35
A full image which manages its own data.
Definition: image.h:623
A frame from a LocalVideoBuffer, which manages its own data rather than wrapping data owned by the sy...
Definition: localvideoframe.h:30