Debian Codegraph @

cvd/videobufferwithdata.h

raw symbols SCIP
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
10 /// Certain video buffers, especially the decorator classes, and buffers
11 /// such as ServerPushJpegBuffer have additional data
12 /// with the same lifetime as the buffer. This is a tool to allow management of
13 /// this data. This class manages a video buffer and some data concurrently.
14 /// @param T The pixel type of the video frames
15 /// @ingroup gVideoBuffer
16 template <class T, class D>
17 class VideoBufferWithData : public VideoBuffer<T>
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
27 ImageRef size()
28 {
29 return buf->size();
30 }
31
32 virtual RawVideoBuffer* source_buffer()
33 {
34 return buf.get();
35 }
36
37 VideoFrame<T>* get_frame()
38 {
39 return buf->get_frame();
40 }
41
42 void put_frame(VideoFrame<T>* f)
43 {
44 buf->put_frame(f);
45 }
46
47 bool frame_pending()
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