OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2015 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2015 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_COMMON_VIDEO_INCLUDE_VIDEO_FRAME_BUFFER_H_ | 11 #ifndef WEBRTC_COMMON_VIDEO_INCLUDE_VIDEO_FRAME_BUFFER_H_ |
12 #define WEBRTC_COMMON_VIDEO_INCLUDE_VIDEO_FRAME_BUFFER_H_ | 12 #define WEBRTC_COMMON_VIDEO_INCLUDE_VIDEO_FRAME_BUFFER_H_ |
13 | 13 |
14 #include <stdint.h> | 14 #include <stdint.h> |
15 | 15 |
16 #include <memory> | 16 #include <memory> |
17 | 17 |
18 #include "webrtc/base/callback.h" | 18 #include "webrtc/base/callback.h" |
19 #include "webrtc/base/refcount.h" | 19 #include "webrtc/base/refcount.h" |
20 #include "webrtc/base/scoped_ref_ptr.h" | 20 #include "webrtc/base/scoped_ref_ptr.h" |
| 21 #include "webrtc/common_video/rotation.h" |
21 #include "webrtc/system_wrappers/include/aligned_malloc.h" | 22 #include "webrtc/system_wrappers/include/aligned_malloc.h" |
22 | 23 |
23 namespace webrtc { | 24 namespace webrtc { |
24 | 25 |
25 enum PlaneType { | 26 enum PlaneType { |
26 kYPlane = 0, | 27 kYPlane = 0, |
27 kUPlane = 1, | 28 kUPlane = 1, |
28 kVPlane = 2, | 29 kVPlane = 2, |
29 kNumOfPlanes = 3, | 30 kNumOfPlanes = 3, |
30 }; | 31 }; |
(...skipping 92 matching lines...) Loading... |
123 // aspect ratio without distorting the image. | 124 // aspect ratio without distorting the image. |
124 void CropAndScaleFrom(const rtc::scoped_refptr<VideoFrameBuffer>& src); | 125 void CropAndScaleFrom(const rtc::scoped_refptr<VideoFrameBuffer>& src); |
125 | 126 |
126 // Scale all of |src| to the size of |this| buffer, with no cropping. | 127 // Scale all of |src| to the size of |this| buffer, with no cropping. |
127 void ScaleFrom(const rtc::scoped_refptr<VideoFrameBuffer>& src); | 128 void ScaleFrom(const rtc::scoped_refptr<VideoFrameBuffer>& src); |
128 | 129 |
129 // Create a new buffer with identical strides, and copy the pixel data. | 130 // Create a new buffer with identical strides, and copy the pixel data. |
130 static rtc::scoped_refptr<I420Buffer> CopyKeepStride( | 131 static rtc::scoped_refptr<I420Buffer> CopyKeepStride( |
131 const rtc::scoped_refptr<VideoFrameBuffer>& buffer); | 132 const rtc::scoped_refptr<VideoFrameBuffer>& buffer); |
132 | 133 |
| 134 // Returns a rotated versions of |src|. Native buffers are not |
| 135 // supported. The reason this function doesn't return an I420Buffer, |
| 136 // is that it returns |src| unchanged in case |rotation| is zero. |
| 137 static rtc::scoped_refptr<VideoFrameBuffer> Rotate( |
| 138 const rtc::scoped_refptr<VideoFrameBuffer>& src, |
| 139 VideoRotation rotation); |
| 140 |
133 protected: | 141 protected: |
134 ~I420Buffer() override; | 142 ~I420Buffer() override; |
135 | 143 |
136 private: | 144 private: |
137 const int width_; | 145 const int width_; |
138 const int height_; | 146 const int height_; |
139 const int stride_y_; | 147 const int stride_y_; |
140 const int stride_u_; | 148 const int stride_u_; |
141 const int stride_v_; | 149 const int stride_v_; |
142 const std::unique_ptr<uint8_t, AlignedFreeDeleter> data_; | 150 const std::unique_ptr<uint8_t, AlignedFreeDeleter> data_; |
(...skipping 60 matching lines...) Loading... |
203 const uint8_t* const v_plane_; | 211 const uint8_t* const v_plane_; |
204 const int y_stride_; | 212 const int y_stride_; |
205 const int u_stride_; | 213 const int u_stride_; |
206 const int v_stride_; | 214 const int v_stride_; |
207 rtc::Callback0<void> no_longer_used_cb_; | 215 rtc::Callback0<void> no_longer_used_cb_; |
208 }; | 216 }; |
209 | 217 |
210 } // namespace webrtc | 218 } // namespace webrtc |
211 | 219 |
212 #endif // WEBRTC_COMMON_VIDEO_INCLUDE_VIDEO_FRAME_BUFFER_H_ | 220 #endif // WEBRTC_COMMON_VIDEO_INCLUDE_VIDEO_FRAME_BUFFER_H_ |
OLD | NEW |