OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2017 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2017 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 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
42 } | 42 } |
43 | 43 |
44 int I420BufferInterface::ChromaWidth() const { | 44 int I420BufferInterface::ChromaWidth() const { |
45 return (width() + 1) / 2; | 45 return (width() + 1) / 2; |
46 } | 46 } |
47 | 47 |
48 int I420BufferInterface::ChromaHeight() const { | 48 int I420BufferInterface::ChromaHeight() const { |
49 return (height() + 1) / 2; | 49 return (height() + 1) / 2; |
50 } | 50 } |
51 | 51 |
| 52 bool I420BufferInterface::HasAlpha() const { |
| 53 return DataA() != nullptr && StrideA() != 0; |
| 54 } |
| 55 |
| 56 const uint8_t* I420BufferInterface::DataA() const { |
| 57 return nullptr; |
| 58 } |
| 59 |
| 60 int I420BufferInterface::StrideA() const { |
| 61 return 0; |
| 62 } |
| 63 |
52 rtc::scoped_refptr<I420BufferInterface> I420BufferInterface::ToI420() { | 64 rtc::scoped_refptr<I420BufferInterface> I420BufferInterface::ToI420() { |
53 return this; | 65 return this; |
54 } | 66 } |
55 | 67 |
56 VideoFrameBuffer::Type I444BufferInterface::type() const { | 68 VideoFrameBuffer::Type I444BufferInterface::type() const { |
57 return Type::kI444; | 69 return Type::kI444; |
58 } | 70 } |
59 | 71 |
60 int I444BufferInterface::ChromaWidth() const { | 72 int I444BufferInterface::ChromaWidth() const { |
61 return width(); | 73 return width(); |
62 } | 74 } |
63 | 75 |
64 int I444BufferInterface::ChromaHeight() const { | 76 int I444BufferInterface::ChromaHeight() const { |
65 return height(); | 77 return height(); |
66 } | 78 } |
67 | 79 |
68 rtc::scoped_refptr<I420BufferInterface> I444BufferInterface::ToI420() { | 80 rtc::scoped_refptr<I420BufferInterface> I444BufferInterface::ToI420() { |
69 rtc::scoped_refptr<I420Buffer> i420_buffer = | 81 rtc::scoped_refptr<I420Buffer> i420_buffer = |
70 I420Buffer::Create(width(), height()); | 82 I420Buffer::Create(width(), height()); |
71 libyuv::I444ToI420(DataY(), StrideY(), DataU(), StrideU(), DataV(), StrideV(), | 83 libyuv::I444ToI420(DataY(), StrideY(), DataU(), StrideU(), DataV(), StrideV(), |
72 i420_buffer->MutableDataY(), i420_buffer->StrideY(), | 84 i420_buffer->MutableDataY(), i420_buffer->StrideY(), |
73 i420_buffer->MutableDataU(), i420_buffer->StrideU(), | 85 i420_buffer->MutableDataU(), i420_buffer->StrideU(), |
74 i420_buffer->MutableDataV(), i420_buffer->StrideV(), | 86 i420_buffer->MutableDataV(), i420_buffer->StrideV(), |
75 width(), height()); | 87 width(), height()); |
76 return i420_buffer; | 88 return i420_buffer; |
77 } | 89 } |
78 | 90 |
79 } // namespace webrtc | 91 } // namespace webrtc |
OLD | NEW |