libcvd
videobufferwithdata.h
1 #ifndef CVD_VIDEOBUFFERWITHDATA_H
2 #define CVD_VIDEOBUFFERWITHDATA_H
3 
4 #include <cvd/videobuffer.h>
5 #include <memory>
6 
7 namespace CVD
8 {
9 
16 template <class T, class D>
18 {
19  public:
20  VideoBufferWithData(std::unique_ptr<VideoBuffer<T>>& buf_, std::unique_ptr<D>& d)
21  : VideoBuffer<T>(buf_->type())
22  , buf(std::move(buf_))
23  , extra_data(move(d))
24  {
25  }
26 
28  {
29  return buf->size();
30  }
31 
33  {
34  return buf.get();
35  }
36 
38  {
39  return buf->get_frame();
40  }
41 
43  {
44  buf->put_frame(f);
45  }
46 
48  {
49  return buf->frame_pending();
50  }
51 
52  void flush()
53  {
54  return buf->flush();
55  }
56 
57  double frame_rate()
58  {
59  return buf->frame_rate();
60  }
61 
62  void seek_to(double time)
63  {
64  return buf->seek_to(time);
65  }
66 
67  private:
68  std::unique_ptr<VideoBuffer<T>> buf;
69 
70  public:
71  std::unique_ptr<D> extra_data;
72 };
73 
74 }
75 
76 #endif
bool frame_pending()
Is there a frame waiting in the buffer? This function does not block.
Definition: videobufferwithdata.h:47
Base class which provides untyped access to video grabber objects.
Definition: videobuffer.h:39
All classes and functions are within the CVD namespace.
Definition: argb.h:6
Base class for objects which provide a typed video stream.
Definition: videobuffer.h:88
ImageRef size()
The size of the VideoFrames returned by this buffer.
Definition: videobufferwithdata.h:27
virtual RawVideoBuffer * source_buffer()
Which video grabber provides the source images for this video grabber.
Definition: videobufferwithdata.h:32
void seek_to(double time)
Go to a particular point in the video buffer (only implemented in buffers of recorded video) ...
Definition: videobufferwithdata.h:62
Definition: image_ref.h:29
double frame_rate()
What is the (expected) frame rate of this video buffer, in frames per second?
Definition: videobufferwithdata.h:57
A frame from a VideoBuffer.
Definition: videoframe.h:35
void flush()
Flush all old frames out of the video buffer, on a flushable buffer, causing the next get_frame() to ...
Definition: videobufferwithdata.h:52
VideoFrame< T > * get_frame()
Returns the next frame from the buffer. This function blocks until a frame is ready.
Definition: videobufferwithdata.h:37
Certain video buffers, especially the decorator classes, and buffers such as ServerPushJpegBuffer hav...
Definition: videobufferwithdata.h:17
void put_frame(VideoFrame< T > *f)
Tell the buffer that you are finished with this frame.
Definition: videobufferwithdata.h:42