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 28 matching lines...) Expand all Loading... | |
39 RTC_NOTREACHED(); | 39 RTC_NOTREACHED(); |
40 return nullptr; | 40 return nullptr; |
41 } | 41 } |
42 uint8_t* VideoFrameBuffer::MutableDataV() { | 42 uint8_t* VideoFrameBuffer::MutableDataV() { |
43 RTC_NOTREACHED(); | 43 RTC_NOTREACHED(); |
44 return nullptr; | 44 return nullptr; |
45 } | 45 } |
46 | 46 |
47 VideoFrameBuffer::~VideoFrameBuffer() {} | 47 VideoFrameBuffer::~VideoFrameBuffer() {} |
48 | 48 |
49 // static | |
50 rtc::scoped_refptr<VideoFrameBuffer> VideoFrameBuffer::Rotate( | |
51 const rtc::scoped_refptr<VideoFrameBuffer>& src, | |
52 VideoRotation rotation) { | |
53 if (rotation == webrtc::kVideoRotation_0) { | |
54 return src; | |
55 } | |
56 | |
57 int current_width = src->width(); | |
magjed_webrtc
2016/08/26 12:04:15
I would prefer if you removed current_width and us
nisse-webrtc
2016/08/26 12:31:40
Done.
| |
58 int current_height = src->height(); | |
59 | |
60 int rotated_width = current_width; | |
61 int rotated_height = current_height; | |
62 if (rotation == webrtc::kVideoRotation_90 || | |
63 rotation == webrtc::kVideoRotation_270) { | |
64 std::swap(rotated_width, rotated_height); | |
65 } | |
66 | |
67 rtc::scoped_refptr<webrtc::I420Buffer> buffer = | |
68 I420Buffer::Create(rotated_width, rotated_height); | |
69 | |
70 // TODO(guoweis): Add a function in webrtc_libyuv.cc to convert from | |
magjed_webrtc
2016/08/26 12:04:15
Remove this TODO. I think guoweis has moved on fro
nisse-webrtc
2016/08/26 12:31:40
Done.
| |
71 // VideoRotation to libyuv::RotationMode. | |
72 int res = libyuv::I420Rotate( | |
73 src->DataY(), src->StrideY(), | |
74 src->DataU(), src->StrideU(), | |
75 src->DataV(), src->StrideV(), | |
76 buffer->MutableDataY(), buffer->StrideY(), buffer->MutableDataU(), | |
77 buffer->StrideU(), buffer->MutableDataV(), buffer->StrideV(), | |
78 current_width, current_height, | |
79 static_cast<libyuv::RotationMode>(rotation)); | |
80 RTC_DCHECK_EQ(res, 0); | |
81 | |
82 return buffer; | |
83 } | |
84 | |
49 I420Buffer::I420Buffer(int width, int height) | 85 I420Buffer::I420Buffer(int width, int height) |
50 : I420Buffer(width, height, width, (width + 1) / 2, (width + 1) / 2) { | 86 : I420Buffer(width, height, width, (width + 1) / 2, (width + 1) / 2) { |
51 } | 87 } |
52 | 88 |
53 I420Buffer::I420Buffer(int width, | 89 I420Buffer::I420Buffer(int width, |
54 int height, | 90 int height, |
55 int stride_y, | 91 int stride_y, |
56 int stride_u, | 92 int stride_u, |
57 int stride_v) | 93 int stride_v) |
58 : width_(width), | 94 : width_(width), |
(...skipping 279 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
338 void* WrappedI420Buffer::native_handle() const { | 374 void* WrappedI420Buffer::native_handle() const { |
339 return nullptr; | 375 return nullptr; |
340 } | 376 } |
341 | 377 |
342 rtc::scoped_refptr<VideoFrameBuffer> WrappedI420Buffer::NativeToI420Buffer() { | 378 rtc::scoped_refptr<VideoFrameBuffer> WrappedI420Buffer::NativeToI420Buffer() { |
343 RTC_NOTREACHED(); | 379 RTC_NOTREACHED(); |
344 return nullptr; | 380 return nullptr; |
345 } | 381 } |
346 | 382 |
347 } // namespace webrtc | 383 } // namespace webrtc |
OLD | NEW |