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 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
46 static void SetBlack(I420Buffer* buffer); | 46 static void SetBlack(I420Buffer* buffer); |
47 | 47 |
48 // Sets all three planes to all zeros. Used to work around for | 48 // Sets all three planes to all zeros. Used to work around for |
49 // quirks in memory checkers | 49 // quirks in memory checkers |
50 // (https://bugs.chromium.org/p/libyuv/issues/detail?id=377) and | 50 // (https://bugs.chromium.org/p/libyuv/issues/detail?id=377) and |
51 // ffmpeg (http://crbug.com/390941). | 51 // ffmpeg (http://crbug.com/390941). |
52 // TODO(nisse): Deprecated. Should be deleted if/when those issues | 52 // TODO(nisse): Deprecated. Should be deleted if/when those issues |
53 // are resolved in a better way. Or in the mean time, use SetBlack. | 53 // are resolved in a better way. Or in the mean time, use SetBlack. |
54 void InitializeData(); | 54 void InitializeData(); |
55 | 55 |
| 56 // TODO(nisse): Deprecated, use static method instead. |
| 57 void SetToBlack() { SetBlack(this); } |
| 58 |
56 int width() const override; | 59 int width() const override; |
57 int height() const override; | 60 int height() const override; |
58 const uint8_t* DataY() const override; | 61 const uint8_t* DataY() const override; |
59 const uint8_t* DataU() const override; | 62 const uint8_t* DataU() const override; |
60 const uint8_t* DataV() const override; | 63 const uint8_t* DataV() const override; |
61 | 64 |
62 int StrideY() const override; | 65 int StrideY() const override; |
63 int StrideU() const override; | 66 int StrideU() const override; |
64 int StrideV() const override; | 67 int StrideV() const override; |
65 | 68 |
(...skipping 12 matching lines...) Expand all Loading... |
78 int crop_width, | 81 int crop_width, |
79 int crop_height); | 82 int crop_height); |
80 | 83 |
81 // The common case of a center crop, when needed to adjust the | 84 // The common case of a center crop, when needed to adjust the |
82 // aspect ratio without distorting the image. | 85 // aspect ratio without distorting the image. |
83 void CropAndScaleFrom(const VideoFrameBuffer& src); | 86 void CropAndScaleFrom(const VideoFrameBuffer& src); |
84 | 87 |
85 // Scale all of |src| to the size of |this| buffer, with no cropping. | 88 // Scale all of |src| to the size of |this| buffer, with no cropping. |
86 void ScaleFrom(const VideoFrameBuffer& src); | 89 void ScaleFrom(const VideoFrameBuffer& src); |
87 | 90 |
| 91 // TODO(nisse): Deprecated, delete once downstream applications are updated. |
| 92 // Returns a rotated versions of |src|. Native buffers are not |
| 93 // supported. The reason this function doesn't return an I420Buffer, |
| 94 // is that it returns |src| unchanged in case |rotation| is zero. |
| 95 static rtc::scoped_refptr<VideoFrameBuffer> Rotate( |
| 96 rtc::scoped_refptr<VideoFrameBuffer> src, |
| 97 VideoRotation rotation); |
| 98 |
88 protected: | 99 protected: |
89 I420Buffer(int width, int height); | 100 I420Buffer(int width, int height); |
90 I420Buffer(int width, int height, int stride_y, int stride_u, int stride_v); | 101 I420Buffer(int width, int height, int stride_y, int stride_u, int stride_v); |
91 | 102 |
92 ~I420Buffer() override; | 103 ~I420Buffer() override; |
93 | 104 |
94 private: | 105 private: |
95 const int width_; | 106 const int width_; |
96 const int height_; | 107 const int height_; |
97 const int stride_y_; | 108 const int stride_y_; |
98 const int stride_u_; | 109 const int stride_u_; |
99 const int stride_v_; | 110 const int stride_v_; |
100 const std::unique_ptr<uint8_t, AlignedFreeDeleter> data_; | 111 const std::unique_ptr<uint8_t, AlignedFreeDeleter> data_; |
101 }; | 112 }; |
102 | 113 |
103 } // namespace webrtc | 114 } // namespace webrtc |
104 | 115 |
105 #endif // WEBRTC_API_VIDEO_I420_BUFFER_H_ | 116 #endif // WEBRTC_API_VIDEO_I420_BUFFER_H_ |
OLD | NEW |