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 |
33 uint8_t* VideoFrameBuffer::MutableDataY() { | 81 uint8_t* VideoFrameBuffer::MutableDataY() { |
34 RTC_NOTREACHED(); | 82 RTC_NOTREACHED(); |
35 return nullptr; | 83 return nullptr; |
36 } | 84 } |
37 uint8_t* VideoFrameBuffer::MutableDataU() { | 85 uint8_t* VideoFrameBuffer::MutableDataU() { |
38 RTC_NOTREACHED(); | 86 RTC_NOTREACHED(); |
39 return nullptr; | 87 return nullptr; |
40 } | 88 } |
41 uint8_t* VideoFrameBuffer::MutableDataV() { | 89 uint8_t* VideoFrameBuffer::MutableDataV() { |
42 RTC_NOTREACHED(); | 90 RTC_NOTREACHED(); |
43 return nullptr; | 91 return nullptr; |
44 } | 92 } |
45 | 93 |
| 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 |
46 VideoFrameBuffer::~VideoFrameBuffer() {} | 108 VideoFrameBuffer::~VideoFrameBuffer() {} |
47 | 109 |
48 I420Buffer::I420Buffer(int width, int height) | 110 I420Buffer::I420Buffer(int width, int height) |
49 : I420Buffer(width, height, width, (width + 1) / 2, (width + 1) / 2) { | 111 : I420Buffer(width, height, width, (width + 1) / 2, (width + 1) / 2) { |
50 } | 112 } |
51 | 113 |
52 I420Buffer::I420Buffer(int width, | 114 I420Buffer::I420Buffer(int width, |
53 int height, | 115 int height, |
54 int stride_y, | 116 int stride_y, |
55 int stride_u, | 117 int stride_u, |
(...skipping 270 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
326 void* WrappedI420Buffer::native_handle() const { | 388 void* WrappedI420Buffer::native_handle() const { |
327 return nullptr; | 389 return nullptr; |
328 } | 390 } |
329 | 391 |
330 rtc::scoped_refptr<VideoFrameBuffer> WrappedI420Buffer::NativeToI420Buffer() { | 392 rtc::scoped_refptr<VideoFrameBuffer> WrappedI420Buffer::NativeToI420Buffer() { |
331 RTC_NOTREACHED(); | 393 RTC_NOTREACHED(); |
332 return nullptr; | 394 return nullptr; |
333 } | 395 } |
334 | 396 |
335 } // namespace webrtc | 397 } // namespace webrtc |
OLD | NEW |