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 #include "common_video/include/video_frame_buffer.h" | 10 #include "common_video/include/video_frame_buffer.h" |
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
121 const int height_; | 121 const int height_; |
122 const uint8_t* const y_plane_; | 122 const uint8_t* const y_plane_; |
123 const uint8_t* const u_plane_; | 123 const uint8_t* const u_plane_; |
124 const uint8_t* const v_plane_; | 124 const uint8_t* const v_plane_; |
125 const int y_stride_; | 125 const int y_stride_; |
126 const int u_stride_; | 126 const int u_stride_; |
127 const int v_stride_; | 127 const int v_stride_; |
128 rtc::Callback0<void> no_longer_used_cb_; | 128 rtc::Callback0<void> no_longer_used_cb_; |
129 }; | 129 }; |
130 | 130 |
| 131 WrappedI420ABuffer::WrappedI420ABuffer( |
| 132 rtc::scoped_refptr<webrtc::VideoFrameBuffer> buffer, |
| 133 const uint8_t* a_plane, |
| 134 int a_stride, |
| 135 const rtc::Callback0<void>& alpha_no_longer_used_cb) |
| 136 : buffer_(buffer), |
| 137 i420_buffer_(buffer->ToI420()), |
| 138 a_plane_(a_plane), |
| 139 a_stride_(a_stride), |
| 140 alpha_no_longer_used_cb_(alpha_no_longer_used_cb) {} |
| 141 |
| 142 WrappedI420ABuffer::~WrappedI420ABuffer() { |
| 143 alpha_no_longer_used_cb_(); |
| 144 } |
| 145 |
| 146 int WrappedI420ABuffer::width() const { |
| 147 return buffer_->width(); |
| 148 } |
| 149 int WrappedI420ABuffer::height() const { |
| 150 return buffer_->height(); |
| 151 } |
| 152 |
| 153 const uint8_t* WrappedI420ABuffer::DataY() const { |
| 154 return i420_buffer_->DataY(); |
| 155 } |
| 156 const uint8_t* WrappedI420ABuffer::DataU() const { |
| 157 return i420_buffer_->DataU(); |
| 158 } |
| 159 const uint8_t* WrappedI420ABuffer::DataV() const { |
| 160 return i420_buffer_->DataV(); |
| 161 } |
| 162 const uint8_t* WrappedI420ABuffer::DataA() const { |
| 163 return a_plane_; |
| 164 } |
| 165 |
| 166 int WrappedI420ABuffer::StrideY() const { |
| 167 return i420_buffer_->StrideY(); |
| 168 } |
| 169 int WrappedI420ABuffer::StrideU() const { |
| 170 return i420_buffer_->StrideU(); |
| 171 } |
| 172 int WrappedI420ABuffer::StrideV() const { |
| 173 return i420_buffer_->StrideV(); |
| 174 } |
| 175 int WrappedI420ABuffer::StrideA() const { |
| 176 return a_stride_; |
| 177 } |
| 178 |
131 rtc::scoped_refptr<I420BufferInterface> WrapI420Buffer( | 179 rtc::scoped_refptr<I420BufferInterface> WrapI420Buffer( |
132 int width, | 180 int width, |
133 int height, | 181 int height, |
134 const uint8_t* y_plane, | 182 const uint8_t* y_plane, |
135 int y_stride, | 183 int y_stride, |
136 const uint8_t* u_plane, | 184 const uint8_t* u_plane, |
137 int u_stride, | 185 int u_stride, |
138 const uint8_t* v_plane, | 186 const uint8_t* v_plane, |
139 int v_stride, | 187 int v_stride, |
140 const rtc::Callback0<void>& no_longer_used) { | 188 const rtc::Callback0<void>& no_longer_used) { |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
178 case VideoFrameBuffer::Type::kI444: | 226 case VideoFrameBuffer::Type::kI444: |
179 return WrapI444Buffer(width, height, y_plane, y_stride, u_plane, u_stride, | 227 return WrapI444Buffer(width, height, y_plane, y_stride, u_plane, u_stride, |
180 v_plane, v_stride, no_longer_used); | 228 v_plane, v_stride, no_longer_used); |
181 default: | 229 default: |
182 FATAL() << "Unexpected frame buffer type."; | 230 FATAL() << "Unexpected frame buffer type."; |
183 return nullptr; | 231 return nullptr; |
184 } | 232 } |
185 } | 233 } |
186 | 234 |
187 } // namespace webrtc | 235 } // namespace webrtc |
OLD | NEW |