TcrSdk-Windows V1.0
video_frame_observer.h
Go to the documentation of this file.
1#ifndef VIDEO_FRAME_OBSERVER_H_
2#define VIDEO_FRAME_OBSERVER_H_
3
4#include <memory>
5#include <stdint.h>
6
12};
13
21public:
34 I420Buffer(const uint8_t* data_y, const uint8_t* data_u, const uint8_t* data_v,
35 int32_t stride_y, int32_t stride_u, int32_t stride_v, int32_t width, int32_t height);
36
41
47 const uint8_t* DataY();
48
54 const uint8_t* DataU();
55
61 const uint8_t* DataV();
62
68 int32_t StrideY();
69
75 int32_t StrideU();
76
82 int32_t StrideV();
83
89 int32_t width();
90
96 int32_t height();
97
98private:
99 const uint8_t* data_y_;
100 const uint8_t* data_u_;
101 const uint8_t* data_v_;
102 int32_t stride_y_;
103 int32_t stride_u_;
104 int32_t stride_v_;
105 int32_t width_;
106 int32_t height_;
107};
108
113public:
114 VideoFrame(const std::shared_ptr<I420Buffer> buffer,
115 int64_t timestamp_us,
116 uint32_t timestamp_rtp,
117 int64_t ntp_time_ms,
119
121
125 int32_t width() const;
129 int32_t height() const;
133 uint32_t size() const;
137 int64_t timestamp_us() const;
141 uint32_t timestamp() const;
145 int64_t ntp_time_ms() const;
153 std::shared_ptr<I420Buffer> i420_buffer() const;
154
155private:
156 std::shared_ptr<I420Buffer> i420_buffer_;
157 int32_t width_;
158 int32_t height_;
159 uint32_t size_;
160 int64_t timestamp_us_;
161 uint32_t timestamp_;
162 int64_t ntp_time_ms_;
163 VideoRotation rotation_;
164};
165
170{
171public:
175 virtual void OnFrame(const VideoFrame& videoFrame) = 0;
176};
177
178#endif // !VIDEO_FRAME_OBSERVER_H_
179
180
The I420Buffer class represents a buffer in I420 format.
Definition video_frame_observer.h:20
I420Buffer(const uint8_t *data_y, const uint8_t *data_u, const uint8_t *data_v, int32_t stride_y, int32_t stride_u, int32_t stride_v, int32_t width, int32_t height)
Constructs an I420Buffer object with the specified parameters.
const uint8_t * DataU()
Returns a pointer to the U plane data.
int32_t StrideV()
Returns the stride (number of bytes between consecutive rows) of the V plane.
int32_t height()
Returns the height of the buffer in pixels.
const uint8_t * DataY()
Returns a pointer to the Y plane data.
int32_t StrideY()
Returns the stride (number of bytes between consecutive rows) of the Y plane.
~I420Buffer()
Destructs the I420Buffer object.
const uint8_t * DataV()
Returns a pointer to the V plane data.
int32_t width()
Returns the width of the buffer in pixels.
int32_t StrideU()
Returns the stride (number of bytes between consecutive rows) of the U plane.
This class encapsulates video frame data.
Definition video_frame_observer.h:112
VideoRotation rotation() const
Get frame rotation.
int32_t width() const
Get frame width.
uint32_t size() const
Get frame size in pixels.
int64_t ntp_time_ms() const
Get capture ntp time in milliseconds.
int64_t timestamp_us() const
System monotonic clock, same timebase as rtc::TimeMicros().
VideoFrame(const std::shared_ptr< I420Buffer > buffer, int64_t timestamp_us, uint32_t timestamp_rtp, int64_t ntp_time_ms, VideoRotation rotation)
std::shared_ptr< I420Buffer > i420_buffer() const
Get I420Buffer.
int32_t height() const
Get frame height.
uint32_t timestamp() const
Get frame timestamp (90kHz).
This class is used to observe whether there is a callback for video frames.
Definition video_frame_observer.h:170
virtual void OnFrame(const VideoFrame &videoFrame)=0
The video frame will be called back through this function.
VideoRotation
Definition video_frame_observer.h:7
@ kVideoRotation_270
Definition video_frame_observer.h:11
@ kVideoRotation_0
Definition video_frame_observer.h:8
@ kVideoRotation_90
Definition video_frame_observer.h:9
@ kVideoRotation_180
Definition video_frame_observer.h:10