Chromium Code Reviews| 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 16 matching lines...) Expand all Loading... | |
| 27 // not contain any frame metadata such as rotation, timestamp, pixel_width, etc. | 27 // not contain any frame metadata such as rotation, timestamp, pixel_width, etc. |
| 28 class VideoFrameBuffer : public rtc::RefCountInterface { | 28 class VideoFrameBuffer : public rtc::RefCountInterface { |
| 29 public: | 29 public: |
| 30 // The resolution of the frame in pixels. For formats where some planes are | 30 // The resolution of the frame in pixels. For formats where some planes are |
| 31 // subsampled, this is the highest-resolution plane. | 31 // subsampled, this is the highest-resolution plane. |
| 32 virtual int width() const = 0; | 32 virtual int width() const = 0; |
| 33 virtual int height() const = 0; | 33 virtual int height() const = 0; |
| 34 | 34 |
| 35 // Returns pointer to the pixel data for a given plane. The memory is owned by | 35 // Returns pointer to the pixel data for a given plane. The memory is owned by |
| 36 // the VideoFrameBuffer object and must not be freed by the caller. | 36 // the VideoFrameBuffer object and must not be freed by the caller. |
| 37 virtual const uint8_t* DataY() const = 0; | 37 virtual const uint8_t* DataY() const = 0; |
|
magjed_webrtc
2016/11/29 13:43:07
This is unrelated to this CL, but before we move I
nisse-webrtc
2016/11/29 14:04:05
Makes some sense (provided we also find a better n
| |
| 38 virtual const uint8_t* DataU() const = 0; | 38 virtual const uint8_t* DataU() const = 0; |
| 39 virtual const uint8_t* DataV() const = 0; | 39 virtual const uint8_t* DataV() const = 0; |
| 40 | 40 |
| 41 // Returns the number of bytes between successive rows for a given plane. | 41 // Returns the number of bytes between successive rows for a given plane. |
| 42 virtual int StrideY() const = 0; | 42 virtual int StrideY() const = 0; |
| 43 virtual int StrideU() const = 0; | 43 virtual int StrideU() const = 0; |
| 44 virtual int StrideV() const = 0; | 44 virtual int StrideV() const = 0; |
| 45 | 45 |
| 46 // Return the handle of the underlying video frame. This is used when the | 46 // Return the handle of the underlying video frame. This is used when the |
| 47 // frame is backed by a texture. | 47 // frame is backed by a texture. |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 118 int crop_width, | 118 int crop_width, |
| 119 int crop_height); | 119 int crop_height); |
| 120 | 120 |
| 121 // The common case of a center crop, when needed to adjust the | 121 // The common case of a center crop, when needed to adjust the |
| 122 // aspect ratio without distorting the image. | 122 // aspect ratio without distorting the image. |
| 123 void CropAndScaleFrom(const VideoFrameBuffer& src); | 123 void CropAndScaleFrom(const VideoFrameBuffer& src); |
| 124 | 124 |
| 125 // Scale all of |src| to the size of |this| buffer, with no cropping. | 125 // Scale all of |src| to the size of |this| buffer, with no cropping. |
| 126 void ScaleFrom(const VideoFrameBuffer& src); | 126 void ScaleFrom(const VideoFrameBuffer& src); |
| 127 | 127 |
| 128 // Deprecated methods, using smart pointer references. | |
| 129 // TODO(nisse): Delete once downstream applications are updated. | |
| 130 static rtc::scoped_refptr<I420Buffer> Copy( | |
| 131 const rtc::scoped_refptr<VideoFrameBuffer>& buffer) { | |
| 132 return Copy(*buffer); | |
| 133 } | |
| 134 void CropAndScaleFrom(const rtc::scoped_refptr<VideoFrameBuffer>& src, | |
| 135 int offset_x, | |
| 136 int offset_y, | |
| 137 int crop_width, | |
| 138 int crop_height) { | |
| 139 CropAndScaleFrom(*src, offset_x, offset_y, crop_width, crop_height); | |
| 140 } | |
| 141 void CropAndScaleFrom(const rtc::scoped_refptr<VideoFrameBuffer>& src) { | |
| 142 CropAndScaleFrom(*src); | |
| 143 } | |
| 144 void ScaleFrom(const rtc::scoped_refptr<VideoFrameBuffer>& src) { | |
| 145 ScaleFrom(*src); | |
| 146 } | |
| 147 | |
| 148 protected: | 128 protected: |
| 149 I420Buffer(int width, int height); | 129 I420Buffer(int width, int height); |
| 150 I420Buffer(int width, int height, int stride_y, int stride_u, int stride_v); | 130 I420Buffer(int width, int height, int stride_y, int stride_u, int stride_v); |
| 151 | 131 |
| 152 ~I420Buffer() override; | 132 ~I420Buffer() override; |
| 153 | 133 |
| 154 private: | 134 private: |
| 155 const int width_; | 135 const int width_; |
| 156 const int height_; | 136 const int height_; |
| 157 const int stride_y_; | 137 const int stride_y_; |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 221 const uint8_t* const v_plane_; | 201 const uint8_t* const v_plane_; |
| 222 const int y_stride_; | 202 const int y_stride_; |
| 223 const int u_stride_; | 203 const int u_stride_; |
| 224 const int v_stride_; | 204 const int v_stride_; |
| 225 rtc::Callback0<void> no_longer_used_cb_; | 205 rtc::Callback0<void> no_longer_used_cb_; |
| 226 }; | 206 }; |
| 227 | 207 |
| 228 } // namespace webrtc | 208 } // namespace webrtc |
| 229 | 209 |
| 230 #endif // WEBRTC_COMMON_VIDEO_INCLUDE_VIDEO_FRAME_BUFFER_H_ | 210 #endif // WEBRTC_COMMON_VIDEO_INCLUDE_VIDEO_FRAME_BUFFER_H_ |
| OLD | NEW |