| 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 12 matching lines...) Expand all Loading... |
| 23 namespace webrtc { | 23 namespace webrtc { |
| 24 | 24 |
| 25 namespace { | 25 namespace { |
| 26 | 26 |
| 27 int I420DataSize(int height, int stride_y, int stride_u, int stride_v) { | 27 int I420DataSize(int height, int stride_y, int stride_u, int stride_v) { |
| 28 return stride_y * height + (stride_u + stride_v) * ((height + 1) / 2); | 28 return stride_y * height + (stride_u + stride_v) * ((height + 1) / 2); |
| 29 } | 29 } |
| 30 | 30 |
| 31 } // namespace | 31 } // namespace |
| 32 | 32 |
| 33 const uint8_t* VideoFrameBuffer::data(PlaneType type) const { | |
| 34 switch (type) { | |
| 35 case kYPlane: | |
| 36 return DataY(); | |
| 37 case kUPlane: | |
| 38 return DataU(); | |
| 39 case kVPlane: | |
| 40 return DataV(); | |
| 41 default: | |
| 42 RTC_NOTREACHED(); | |
| 43 return nullptr; | |
| 44 } | |
| 45 } | |
| 46 | |
| 47 const uint8_t* VideoFrameBuffer::DataY() const { | |
| 48 return data(kYPlane); | |
| 49 } | |
| 50 const uint8_t* VideoFrameBuffer::DataU() const { | |
| 51 return data(kUPlane); | |
| 52 } | |
| 53 const uint8_t* VideoFrameBuffer::DataV() const { | |
| 54 return data(kVPlane); | |
| 55 } | |
| 56 | |
| 57 int VideoFrameBuffer::stride(PlaneType type) const { | |
| 58 switch (type) { | |
| 59 case kYPlane: | |
| 60 return StrideY(); | |
| 61 case kUPlane: | |
| 62 return StrideU(); | |
| 63 case kVPlane: | |
| 64 return StrideV(); | |
| 65 default: | |
| 66 RTC_NOTREACHED(); | |
| 67 return 0; | |
| 68 } | |
| 69 } | |
| 70 | |
| 71 int VideoFrameBuffer::StrideY() const { | |
| 72 return stride(kYPlane); | |
| 73 } | |
| 74 int VideoFrameBuffer::StrideU() const { | |
| 75 return stride(kUPlane); | |
| 76 } | |
| 77 int VideoFrameBuffer::StrideV() const { | |
| 78 return stride(kVPlane); | |
| 79 } | |
| 80 | |
| 81 uint8_t* VideoFrameBuffer::MutableDataY() { | 33 uint8_t* VideoFrameBuffer::MutableDataY() { |
| 82 RTC_NOTREACHED(); | 34 RTC_NOTREACHED(); |
| 83 return nullptr; | 35 return nullptr; |
| 84 } | 36 } |
| 85 uint8_t* VideoFrameBuffer::MutableDataU() { | 37 uint8_t* VideoFrameBuffer::MutableDataU() { |
| 86 RTC_NOTREACHED(); | 38 RTC_NOTREACHED(); |
| 87 return nullptr; | 39 return nullptr; |
| 88 } | 40 } |
| 89 uint8_t* VideoFrameBuffer::MutableDataV() { | 41 uint8_t* VideoFrameBuffer::MutableDataV() { |
| 90 RTC_NOTREACHED(); | 42 RTC_NOTREACHED(); |
| 91 return nullptr; | 43 return nullptr; |
| 92 } | 44 } |
| 93 | 45 |
| 94 uint8_t* VideoFrameBuffer::MutableData(PlaneType type) { | |
| 95 switch (type) { | |
| 96 case kYPlane: | |
| 97 return MutableDataY(); | |
| 98 case kUPlane: | |
| 99 return MutableDataU(); | |
| 100 case kVPlane: | |
| 101 return MutableDataV(); | |
| 102 default: | |
| 103 RTC_NOTREACHED(); | |
| 104 return nullptr; | |
| 105 } | |
| 106 } | |
| 107 | |
| 108 VideoFrameBuffer::~VideoFrameBuffer() {} | 46 VideoFrameBuffer::~VideoFrameBuffer() {} |
| 109 | 47 |
| 110 I420Buffer::I420Buffer(int width, int height) | 48 I420Buffer::I420Buffer(int width, int height) |
| 111 : I420Buffer(width, height, width, (width + 1) / 2, (width + 1) / 2) { | 49 : I420Buffer(width, height, width, (width + 1) / 2, (width + 1) / 2) { |
| 112 } | 50 } |
| 113 | 51 |
| 114 I420Buffer::I420Buffer(int width, | 52 I420Buffer::I420Buffer(int width, |
| 115 int height, | 53 int height, |
| 116 int stride_y, | 54 int stride_y, |
| 117 int stride_u, | 55 int stride_u, |
| (...skipping 249 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 367 void* WrappedI420Buffer::native_handle() const { | 305 void* WrappedI420Buffer::native_handle() const { |
| 368 return nullptr; | 306 return nullptr; |
| 369 } | 307 } |
| 370 | 308 |
| 371 rtc::scoped_refptr<VideoFrameBuffer> WrappedI420Buffer::NativeToI420Buffer() { | 309 rtc::scoped_refptr<VideoFrameBuffer> WrappedI420Buffer::NativeToI420Buffer() { |
| 372 RTC_NOTREACHED(); | 310 RTC_NOTREACHED(); |
| 373 return nullptr; | 311 return nullptr; |
| 374 } | 312 } |
| 375 | 313 |
| 376 } // namespace webrtc | 314 } // namespace webrtc |
| OLD | NEW |