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 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
58 VideoRotation rotation); | 58 VideoRotation rotation); |
59 | 59 |
60 // Deep copy frame: If required size is bigger than allocated one, new | 60 // Deep copy frame: If required size is bigger than allocated one, new |
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 // Get pointer to buffer per plane. | |
69 uint8_t* buffer(PlaneType type); | |
70 // Overloading with const. | |
71 const uint8_t* buffer(PlaneType type) const; | |
72 | |
73 // Get allocated size per plane. | 68 // Get allocated size per plane. |
74 int allocated_size(PlaneType type) const; | 69 int allocated_size(PlaneType type) const; |
75 | 70 |
76 // Get allocated stride per plane. | |
77 int stride(PlaneType type) const; | |
78 | |
79 // Get frame width. | 71 // Get frame width. |
80 int width() const; | 72 int width() const; |
81 | 73 |
82 // Get frame height. | 74 // Get frame height. |
83 int height() const; | 75 int height() const; |
84 | 76 |
85 // Set frame timestamp (90kHz). | 77 // Set frame timestamp (90kHz). |
86 void set_timestamp(uint32_t timestamp) { timestamp_ = timestamp; } | 78 void set_timestamp(uint32_t timestamp) { timestamp_ = timestamp; } |
87 | 79 |
88 // Get frame timestamp (90kHz). | 80 // Get frame timestamp (90kHz). |
(...skipping 28 matching lines...) Expand all Loading... |
117 } | 109 } |
118 | 110 |
119 // Get render time in miliseconds. | 111 // Get render time in miliseconds. |
120 int64_t render_time_ms() const { return render_time_ms_; } | 112 int64_t render_time_ms() const { return render_time_ms_; } |
121 | 113 |
122 // Return true if underlying plane buffers are of zero size, false if not. | 114 // Return true if underlying plane buffers are of zero size, false if not. |
123 bool IsZeroSize() const; | 115 bool IsZeroSize() const; |
124 | 116 |
125 // Return the underlying buffer. Never nullptr for a properly | 117 // Return the underlying buffer. Never nullptr for a properly |
126 // initialized VideoFrame. | 118 // initialized VideoFrame. |
127 rtc::scoped_refptr<webrtc::VideoFrameBuffer> video_frame_buffer() const; | 119 // Creating a new reference breaks the HasOneRef and IsMutable |
| 120 // logic. So return a const ref to our reference. |
| 121 const rtc::scoped_refptr<webrtc::VideoFrameBuffer>& video_frame_buffer() |
| 122 const; |
128 | 123 |
129 // Set the underlying buffer. | 124 // Set the underlying buffer. |
130 void set_video_frame_buffer( | 125 void set_video_frame_buffer( |
131 const rtc::scoped_refptr<webrtc::VideoFrameBuffer>& buffer); | 126 const rtc::scoped_refptr<webrtc::VideoFrameBuffer>& buffer); |
132 | 127 |
133 // Convert native-handle frame to memory-backed I420 frame. Should not be | 128 // Convert native-handle frame to memory-backed I420 frame. Should not be |
134 // called on a non-native-handle frame. | 129 // called on a non-native-handle frame. |
135 VideoFrame ConvertNativeToI420Frame() const; | 130 VideoFrame ConvertNativeToI420Frame() const; |
136 | 131 |
137 private: | 132 private: |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
181 size_t _length; | 176 size_t _length; |
182 size_t _size; | 177 size_t _size; |
183 VideoRotation rotation_ = kVideoRotation_0; | 178 VideoRotation rotation_ = kVideoRotation_0; |
184 bool _completeFrame = false; | 179 bool _completeFrame = false; |
185 AdaptReason adapt_reason_; | 180 AdaptReason adapt_reason_; |
186 int qp_ = -1; // Quantizer value. | 181 int qp_ = -1; // Quantizer value. |
187 }; | 182 }; |
188 | 183 |
189 } // namespace webrtc | 184 } // namespace webrtc |
190 #endif // WEBRTC_VIDEO_FRAME_H_ | 185 #endif // WEBRTC_VIDEO_FRAME_H_ |
OLD | NEW |