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 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
102 void* native_handle() const override; | 102 void* native_handle() const override; |
103 | 103 |
104 protected: | 104 protected: |
105 void* native_handle_; | 105 void* native_handle_; |
106 const int width_; | 106 const int width_; |
107 const int height_; | 107 const int height_; |
108 }; | 108 }; |
109 | 109 |
110 class WrappedI420Buffer : public webrtc::VideoFrameBuffer { | 110 class WrappedI420Buffer : public webrtc::VideoFrameBuffer { |
111 public: | 111 public: |
112 WrappedI420Buffer(int desired_width, | 112 WrappedI420Buffer(int width, |
113 int desired_height, | |
114 int width, | |
115 int height, | 113 int height, |
116 const uint8_t* y_plane, | 114 const uint8_t* y_plane, |
117 int y_stride, | 115 int y_stride, |
118 const uint8_t* u_plane, | 116 const uint8_t* u_plane, |
119 int u_stride, | 117 int u_stride, |
120 const uint8_t* v_plane, | 118 const uint8_t* v_plane, |
121 int v_stride, | 119 int v_stride, |
122 const rtc::Callback0<void>& no_longer_used); | 120 const rtc::Callback0<void>& no_longer_used); |
123 int width() const override; | 121 int width() const override; |
124 int height() const override; | 122 int height() const override; |
125 | 123 |
126 const uint8_t* data(PlaneType type) const override; | 124 const uint8_t* data(PlaneType type) const override; |
127 uint8_t* data(PlaneType type) override; | 125 uint8_t* data(PlaneType type) override; |
128 | 126 |
129 int stride(PlaneType type) const override; | 127 int stride(PlaneType type) const override; |
130 void* native_handle() const override; | 128 void* native_handle() const override; |
131 | 129 |
132 rtc::scoped_refptr<VideoFrameBuffer> NativeToI420Buffer() override; | 130 rtc::scoped_refptr<VideoFrameBuffer> NativeToI420Buffer() override; |
133 | 131 |
134 private: | 132 private: |
135 friend class rtc::RefCountedObject<WrappedI420Buffer>; | 133 friend class rtc::RefCountedObject<WrappedI420Buffer>; |
136 ~WrappedI420Buffer() override; | 134 ~WrappedI420Buffer() override; |
137 | 135 |
138 int width_; | 136 const int width_; |
139 int height_; | 137 const int height_; |
140 const uint8_t* y_plane_; | 138 const uint8_t* const y_plane_; |
141 const uint8_t* u_plane_; | 139 const uint8_t* const u_plane_; |
142 const uint8_t* v_plane_; | 140 const uint8_t* const v_plane_; |
143 const int y_stride_; | 141 const int y_stride_; |
144 const int u_stride_; | 142 const int u_stride_; |
145 const int v_stride_; | 143 const int v_stride_; |
146 rtc::Callback0<void> no_longer_used_cb_; | 144 rtc::Callback0<void> no_longer_used_cb_; |
147 }; | 145 }; |
148 | 146 |
| 147 // Helper function to crop |buffer| without making a deep copy. May only be used |
| 148 // for non-native frames. |
| 149 rtc::scoped_refptr<VideoFrameBuffer> ShallowCenterCrop( |
| 150 const rtc::scoped_refptr<VideoFrameBuffer>& buffer, |
| 151 int cropped_width, |
| 152 int cropped_height); |
| 153 |
149 } // namespace webrtc | 154 } // namespace webrtc |
150 | 155 |
151 #endif // WEBRTC_VIDEO_FRAME_BUFFER_H_ | 156 #endif // WEBRTC_VIDEO_FRAME_BUFFER_H_ |
OLD | NEW |