OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2011 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2011 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 28 matching lines...) Expand all Loading... |
39 int32_t src_height = static_cast<int>(GetHeight()); | 39 int32_t src_height = static_cast<int>(GetHeight()); |
40 return libyuv::I420Copy(GetYPlane(), GetYPitch(), | 40 return libyuv::I420Copy(GetYPlane(), GetYPitch(), |
41 GetUPlane(), GetUPitch(), | 41 GetUPlane(), GetUPitch(), |
42 GetVPlane(), GetVPitch(), | 42 GetVPlane(), GetVPitch(), |
43 dst_y, dst_pitch_y, | 43 dst_y, dst_pitch_y, |
44 dst_u, dst_pitch_u, | 44 dst_u, dst_pitch_u, |
45 dst_v, dst_pitch_v, | 45 dst_v, dst_pitch_v, |
46 src_width, src_height) == 0; | 46 src_width, src_height) == 0; |
47 } | 47 } |
48 | 48 |
49 void VideoFrame::CopyToFrame(VideoFrame* dst) const { | |
50 if (!dst) { | |
51 LOG(LS_ERROR) << "NULL dst pointer."; | |
52 return; | |
53 } | |
54 | |
55 CopyToPlanes(dst->GetYPlane(), dst->GetUPlane(), dst->GetVPlane(), | |
56 dst->GetYPitch(), dst->GetUPitch(), dst->GetVPitch()); | |
57 } | |
58 | |
59 size_t VideoFrame::ConvertToRgbBuffer(uint32_t to_fourcc, | 49 size_t VideoFrame::ConvertToRgbBuffer(uint32_t to_fourcc, |
60 uint8_t* buffer, | 50 uint8_t* buffer, |
61 size_t size, | 51 size_t size, |
62 int stride_rgb) const { | 52 int stride_rgb) const { |
63 const size_t needed = std::abs(stride_rgb) * GetHeight(); | 53 const size_t needed = std::abs(stride_rgb) * GetHeight(); |
64 if (size < needed) { | 54 if (size < needed) { |
65 LOG(LS_WARNING) << "RGB buffer is not large enough"; | 55 LOG(LS_WARNING) << "RGB buffer is not large enough"; |
66 return needed; | 56 return needed; |
67 } | 57 } |
68 | 58 |
(...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
311 << " expected: " << expected_size | 301 << " expected: " << expected_size |
312 << " sample[0..3]: " << static_cast<int>(four_samples[0]) | 302 << " sample[0..3]: " << static_cast<int>(four_samples[0]) |
313 << ", " << static_cast<int>(four_samples[1]) | 303 << ", " << static_cast<int>(four_samples[1]) |
314 << ", " << static_cast<int>(four_samples[2]) | 304 << ", " << static_cast<int>(four_samples[2]) |
315 << ", " << static_cast<int>(four_samples[3]); | 305 << ", " << static_cast<int>(four_samples[3]); |
316 } | 306 } |
317 return true; | 307 return true; |
318 } | 308 } |
319 | 309 |
320 } // namespace cricket | 310 } // namespace cricket |
OLD | NEW |