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 |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
89 uint8_t* MutableDataU(); | 89 uint8_t* MutableDataU(); |
90 uint8_t* MutableDataV(); | 90 uint8_t* MutableDataV(); |
91 int StrideY() const override; | 91 int StrideY() const override; |
92 int StrideU() const override; | 92 int StrideU() const override; |
93 int StrideV() const override; | 93 int StrideV() const override; |
94 | 94 |
95 void* native_handle() const override; | 95 void* native_handle() const override; |
96 rtc::scoped_refptr<VideoFrameBuffer> NativeToI420Buffer() override; | 96 rtc::scoped_refptr<VideoFrameBuffer> NativeToI420Buffer() override; |
97 | 97 |
98 // Create a new buffer and copy the pixel data. | 98 // Create a new buffer and copy the pixel data. |
99 static rtc::scoped_refptr<I420Buffer> Copy( | 99 static rtc::scoped_refptr<I420Buffer> Copy(const VideoFrameBuffer& buffer); |
100 const rtc::scoped_refptr<VideoFrameBuffer>& buffer); | |
101 | 100 |
102 // Scale the cropped area of |src| to the size of |this| buffer, and | 101 // Scale the cropped area of |src| to the size of |this| buffer, and |
103 // write the result into |this|. | 102 // write the result into |this|. |
104 void CropAndScaleFrom(const rtc::scoped_refptr<VideoFrameBuffer>& src, | 103 void CropAndScaleFrom(const VideoFrameBuffer& src, |
105 int offset_x, | 104 int offset_x, |
106 int offset_y, | 105 int offset_y, |
107 int crop_width, | 106 int crop_width, |
108 int crop_height); | 107 int crop_height); |
109 | 108 |
110 // The common case of a center crop, when needed to adjust the | 109 // The common case of a center crop, when needed to adjust the |
111 // aspect ratio without distorting the image. | 110 // aspect ratio without distorting the image. |
112 void CropAndScaleFrom(const rtc::scoped_refptr<VideoFrameBuffer>& src); | 111 void CropAndScaleFrom(const VideoFrameBuffer& src); |
113 | 112 |
114 // Scale all of |src| to the size of |this| buffer, with no cropping. | 113 // Scale all of |src| to the size of |this| buffer, with no cropping. |
115 void ScaleFrom(const rtc::scoped_refptr<VideoFrameBuffer>& src); | 114 void ScaleFrom(const VideoFrameBuffer& src); |
| 115 |
| 116 // Deprecated methods, using smart pointer references. |
| 117 // TODO(nisse): Delete once downstream applications are updated. |
| 118 static rtc::scoped_refptr<I420Buffer> Copy( |
| 119 const rtc::scoped_refptr<VideoFrameBuffer>& buffer) { |
| 120 return Copy(*buffer); |
| 121 } |
| 122 void CropAndScaleFrom(const rtc::scoped_refptr<VideoFrameBuffer>& src, |
| 123 int offset_x, |
| 124 int offset_y, |
| 125 int crop_width, |
| 126 int crop_height) { |
| 127 CropAndScaleFrom(*src, offset_x, offset_y, crop_width, crop_height); |
| 128 } |
| 129 void CropAndScaleFrom(const rtc::scoped_refptr<VideoFrameBuffer>& src) { |
| 130 CropAndScaleFrom(*src); |
| 131 } |
| 132 void ScaleFrom(const rtc::scoped_refptr<VideoFrameBuffer>& src) { |
| 133 ScaleFrom(*src); |
| 134 } |
116 | 135 |
117 // Returns a rotated versions of |src|. Native buffers are not | 136 // Returns a rotated versions of |src|. Native buffers are not |
118 // supported. The reason this function doesn't return an I420Buffer, | 137 // supported. The reason this function doesn't return an I420Buffer, |
119 // is that it returns |src| unchanged in case |rotation| is zero. | 138 // is that it returns |src| unchanged in case |rotation| is zero. |
120 static rtc::scoped_refptr<VideoFrameBuffer> Rotate( | 139 static rtc::scoped_refptr<VideoFrameBuffer> Rotate( |
121 const rtc::scoped_refptr<VideoFrameBuffer>& src, | 140 rtc::scoped_refptr<VideoFrameBuffer> src, |
122 VideoRotation rotation); | 141 VideoRotation rotation); |
123 | 142 |
124 protected: | 143 protected: |
125 ~I420Buffer() override; | 144 ~I420Buffer() override; |
126 | 145 |
127 private: | 146 private: |
128 const int width_; | 147 const int width_; |
129 const int height_; | 148 const int height_; |
130 const int stride_y_; | 149 const int stride_y_; |
131 const int stride_u_; | 150 const int stride_u_; |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
194 const uint8_t* const v_plane_; | 213 const uint8_t* const v_plane_; |
195 const int y_stride_; | 214 const int y_stride_; |
196 const int u_stride_; | 215 const int u_stride_; |
197 const int v_stride_; | 216 const int v_stride_; |
198 rtc::Callback0<void> no_longer_used_cb_; | 217 rtc::Callback0<void> no_longer_used_cb_; |
199 }; | 218 }; |
200 | 219 |
201 } // namespace webrtc | 220 } // namespace webrtc |
202 | 221 |
203 #endif // WEBRTC_COMMON_VIDEO_INCLUDE_VIDEO_FRAME_BUFFER_H_ | 222 #endif // WEBRTC_COMMON_VIDEO_INCLUDE_VIDEO_FRAME_BUFFER_H_ |
OLD | NEW |