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 |
11 #ifndef WEBRTC_VIDEO_FRAME_H_ | 11 #ifndef WEBRTC_VIDEO_FRAME_H_ |
12 #define WEBRTC_VIDEO_FRAME_H_ | 12 #define WEBRTC_VIDEO_FRAME_H_ |
13 | 13 |
14 #include "webrtc/base/scoped_ref_ptr.h" | 14 #include "webrtc/base/scoped_ref_ptr.h" |
15 #include "webrtc/common_types.h" | 15 #include "webrtc/common_types.h" |
16 #include "webrtc/common_video/include/video_frame_buffer.h" | 16 #include "webrtc/common_video/include/video_frame_buffer.h" |
17 #include "webrtc/common_video/rotation.h" | 17 #include "webrtc/common_video/rotation.h" |
18 #include "webrtc/typedefs.h" | 18 #include "webrtc/typedefs.h" |
19 | 19 |
| 20 // TODO(nisse): Temporary hack while running the bots; we can't delete |
| 21 // the method for real just yet, since it's used in one place in |
| 22 // Chrome. |
| 23 |
| 24 #define ENABLE_WEBRTC_VIDEOFRAME_NATIVE_HANDLE 0 |
| 25 |
20 namespace webrtc { | 26 namespace webrtc { |
21 | 27 |
22 class VideoFrame { | 28 class VideoFrame { |
23 public: | 29 public: |
24 VideoFrame(); | 30 VideoFrame(); |
25 VideoFrame(const rtc::scoped_refptr<webrtc::VideoFrameBuffer>& buffer, | 31 VideoFrame(const rtc::scoped_refptr<webrtc::VideoFrameBuffer>& buffer, |
26 uint32_t timestamp, | 32 uint32_t timestamp, |
27 int64_t render_time_ms, | 33 int64_t render_time_ms, |
28 VideoRotation rotation); | 34 VideoRotation rotation); |
29 | 35 |
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
118 void set_render_time_ms(int64_t render_time_ms) { | 124 void set_render_time_ms(int64_t render_time_ms) { |
119 render_time_ms_ = render_time_ms; | 125 render_time_ms_ = render_time_ms; |
120 } | 126 } |
121 | 127 |
122 // Get render time in miliseconds. | 128 // Get render time in miliseconds. |
123 int64_t render_time_ms() const { return render_time_ms_; } | 129 int64_t render_time_ms() const { return render_time_ms_; } |
124 | 130 |
125 // Return true if underlying plane buffers are of zero size, false if not. | 131 // Return true if underlying plane buffers are of zero size, false if not. |
126 bool IsZeroSize() const; | 132 bool IsZeroSize() const; |
127 | 133 |
| 134 #if ENABLE_WEBRTC_VIDEOFRAME_NATIVE_HANDLE |
| 135 // TODO(nisse): Should be deleted, in favor of using the |
| 136 // corresponding method on the underlying VideoFrameBuffer. |
| 137 |
128 // Return the handle of the underlying video frame. This is used when the | 138 // Return the handle of the underlying video frame. This is used when the |
129 // frame is backed by a texture. The object should be destroyed when it is no | 139 // frame is backed by a texture. The object should be destroyed when it is no |
130 // longer in use, so the underlying resource can be freed. | 140 // longer in use, so the underlying resource can be freed. |
131 void* native_handle() const; | 141 void* native_handle() const; |
132 | 142 #endif |
133 // Return the underlying buffer. | 143 // Return the underlying buffer. |
134 rtc::scoped_refptr<webrtc::VideoFrameBuffer> video_frame_buffer() const; | 144 rtc::scoped_refptr<webrtc::VideoFrameBuffer> video_frame_buffer() const; |
135 | 145 |
136 // Set the underlying buffer. | 146 // Set the underlying buffer. |
137 void set_video_frame_buffer( | 147 void set_video_frame_buffer( |
138 const rtc::scoped_refptr<webrtc::VideoFrameBuffer>& buffer); | 148 const rtc::scoped_refptr<webrtc::VideoFrameBuffer>& buffer); |
139 | 149 |
140 // Convert native-handle frame to memory-backed I420 frame. Should not be | 150 // Convert native-handle frame to memory-backed I420 frame. Should not be |
141 // called on a non-native-handle frame. | 151 // called on a non-native-handle frame. |
142 VideoFrame ConvertNativeToI420Frame() const; | 152 VideoFrame ConvertNativeToI420Frame() const; |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
186 uint8_t* _buffer; | 196 uint8_t* _buffer; |
187 size_t _length; | 197 size_t _length; |
188 size_t _size; | 198 size_t _size; |
189 bool _completeFrame = false; | 199 bool _completeFrame = false; |
190 AdaptReason adapt_reason_; | 200 AdaptReason adapt_reason_; |
191 int qp_ = -1; // Quantizer value. | 201 int qp_ = -1; // Quantizer value. |
192 }; | 202 }; |
193 | 203 |
194 } // namespace webrtc | 204 } // namespace webrtc |
195 #endif // WEBRTC_VIDEO_FRAME_H_ | 205 #endif // WEBRTC_VIDEO_FRAME_H_ |
OLD | NEW |