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 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
74 int width() const override; | 74 int width() const override; |
75 int height() const override; | 75 int height() const override; |
76 const uint8_t* data(PlaneType type) const override; | 76 const uint8_t* data(PlaneType type) const override; |
77 // Non-const data access is only allowed if HasOneRef() is true to protect | 77 // Non-const data access is only allowed if HasOneRef() is true to protect |
78 // against unexpected overwrites. | 78 // against unexpected overwrites. |
79 uint8_t* MutableData(PlaneType type) override; | 79 uint8_t* MutableData(PlaneType type) override; |
80 int stride(PlaneType type) const override; | 80 int stride(PlaneType type) const override; |
81 void* native_handle() const override; | 81 void* native_handle() const override; |
82 rtc::scoped_refptr<VideoFrameBuffer> NativeToI420Buffer() override; | 82 rtc::scoped_refptr<VideoFrameBuffer> NativeToI420Buffer() override; |
83 | 83 |
| 84 // Create a new buffer and copy the pixel data. |
| 85 static rtc::scoped_refptr<I420Buffer> Copy( |
| 86 const rtc::scoped_refptr<VideoFrameBuffer>& buffer); |
| 87 |
84 protected: | 88 protected: |
85 ~I420Buffer() override; | 89 ~I420Buffer() override; |
86 | 90 |
87 private: | 91 private: |
88 const int width_; | 92 const int width_; |
89 const int height_; | 93 const int height_; |
90 const int stride_y_; | 94 const int stride_y_; |
91 const int stride_u_; | 95 const int stride_u_; |
92 const int stride_v_; | 96 const int stride_v_; |
93 const std::unique_ptr<uint8_t, AlignedFreeDeleter> data_; | 97 const std::unique_ptr<uint8_t, AlignedFreeDeleter> data_; |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
152 // Helper function to crop |buffer| without making a deep copy. May only be used | 156 // Helper function to crop |buffer| without making a deep copy. May only be used |
153 // for non-native frames. | 157 // for non-native frames. |
154 rtc::scoped_refptr<VideoFrameBuffer> ShallowCenterCrop( | 158 rtc::scoped_refptr<VideoFrameBuffer> ShallowCenterCrop( |
155 const rtc::scoped_refptr<VideoFrameBuffer>& buffer, | 159 const rtc::scoped_refptr<VideoFrameBuffer>& buffer, |
156 int cropped_width, | 160 int cropped_width, |
157 int cropped_height); | 161 int cropped_height); |
158 | 162 |
159 } // namespace webrtc | 163 } // namespace webrtc |
160 | 164 |
161 #endif // WEBRTC_COMMON_VIDEO_INCLUDE_VIDEO_FRAME_BUFFER_H_ | 165 #endif // WEBRTC_COMMON_VIDEO_INCLUDE_VIDEO_FRAME_BUFFER_H_ |
OLD | NEW |