OLD | NEW |
---|---|
1 /* | 1 /* |
2 * Copyright (c) 2014 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2014 The WebRTC project authors. All Rights Reserved. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license | 4 * Use of this source code is governed by a BSD-style license |
5 * that can be found in the LICENSE file in the root of the source | 5 * that can be found in the LICENSE file in the root of the source |
6 * tree. An additional intellectual property rights grant can be found | 6 * tree. An additional intellectual property rights grant can be found |
7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
9 */ | 9 */ |
10 | 10 |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
61 // buffers of adequate size will be allocated. | 61 // buffers of adequate size will be allocated. |
62 void CopyFrame(const VideoFrame& videoFrame); | 62 void CopyFrame(const VideoFrame& videoFrame); |
63 | 63 |
64 // Creates a shallow copy of |videoFrame|, i.e, the this object will retain a | 64 // Creates a shallow copy of |videoFrame|, i.e, the this object will retain a |
65 // reference to the video buffer also retained by |videoFrame|. | 65 // reference to the video buffer also retained by |videoFrame|. |
66 void ShallowCopy(const VideoFrame& videoFrame); | 66 void ShallowCopy(const VideoFrame& videoFrame); |
67 | 67 |
68 // Release frame buffer and reset time stamps. | 68 // Release frame buffer and reset time stamps. |
69 void Reset(); | 69 void Reset(); |
70 | 70 |
71 // Get pointer to buffer per plane. | |
72 uint8_t* buffer(PlaneType type); | |
73 // Overloading with const. | |
74 const uint8_t* buffer(PlaneType type) const; | |
75 | |
76 // Get allocated size per plane. | 71 // Get allocated size per plane. |
77 int allocated_size(PlaneType type) const; | 72 int allocated_size(PlaneType type) const; |
78 | 73 |
79 // Get allocated stride per plane. | |
80 int stride(PlaneType type) const; | |
81 | |
82 // Get frame width. | 74 // Get frame width. |
83 int width() const; | 75 int width() const; |
84 | 76 |
85 // Get frame height. | 77 // Get frame height. |
86 int height() const; | 78 int height() const; |
87 | 79 |
88 // Set frame timestamp (90kHz). | 80 // Set frame timestamp (90kHz). |
89 void set_timestamp(uint32_t timestamp) { timestamp_ = timestamp; } | 81 void set_timestamp(uint32_t timestamp) { timestamp_ = timestamp; } |
90 | 82 |
91 // Get frame timestamp (90kHz). | 83 // Get frame timestamp (90kHz). |
(...skipping 28 matching lines...) Expand all Loading... | |
120 } | 112 } |
121 | 113 |
122 // Get render time in miliseconds. | 114 // Get render time in miliseconds. |
123 int64_t render_time_ms() const { return render_time_ms_; } | 115 int64_t render_time_ms() const { return render_time_ms_; } |
124 | 116 |
125 // Return true if underlying plane buffers are of zero size, false if not. | 117 // Return true if underlying plane buffers are of zero size, false if not. |
126 bool IsZeroSize() const; | 118 bool IsZeroSize() const; |
127 | 119 |
128 // Return the underlying buffer. Never nullptr for a properly | 120 // Return the underlying buffer. Never nullptr for a properly |
129 // initialized VideoFrame. | 121 // initialized VideoFrame. |
130 rtc::scoped_refptr<webrtc::VideoFrameBuffer> video_frame_buffer() const; | 122 // Creating a new reference breaks the (admittedly brittle) |
pbos-webrtc
2016/04/19 11:28:47
Don't think the "admittedly brittle" part is neces
nisse-webrtc
2016/04/19 13:55:39
Ok, dropped it.
| |
123 // HasOneRef and IsMutable logic. So return a const ref to our | |
124 // reference. | |
125 const rtc::scoped_refptr<webrtc::VideoFrameBuffer>& video_frame_buffer() | |
126 const; | |
131 | 127 |
132 // Set the underlying buffer. | 128 // Set the underlying buffer. |
133 void set_video_frame_buffer( | 129 void set_video_frame_buffer( |
134 const rtc::scoped_refptr<webrtc::VideoFrameBuffer>& buffer); | 130 const rtc::scoped_refptr<webrtc::VideoFrameBuffer>& buffer); |
135 | 131 |
136 // Convert native-handle frame to memory-backed I420 frame. Should not be | 132 // Convert native-handle frame to memory-backed I420 frame. Should not be |
137 // called on a non-native-handle frame. | 133 // called on a non-native-handle frame. |
138 VideoFrame ConvertNativeToI420Frame() const; | 134 VideoFrame ConvertNativeToI420Frame() const; |
139 | 135 |
140 private: | 136 private: |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
182 uint8_t* _buffer; | 178 uint8_t* _buffer; |
183 size_t _length; | 179 size_t _length; |
184 size_t _size; | 180 size_t _size; |
185 bool _completeFrame = false; | 181 bool _completeFrame = false; |
186 AdaptReason adapt_reason_; | 182 AdaptReason adapt_reason_; |
187 int qp_ = -1; // Quantizer value. | 183 int qp_ = -1; // Quantizer value. |
188 }; | 184 }; |
189 | 185 |
190 } // namespace webrtc | 186 } // namespace webrtc |
191 #endif // WEBRTC_VIDEO_FRAME_H_ | 187 #endif // WEBRTC_VIDEO_FRAME_H_ |
OLD | NEW |