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 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
59 int dh, | 59 int dh, |
60 uint8_t* sample, | 60 uint8_t* sample, |
61 size_t sample_size, | 61 size_t sample_size, |
62 int64_t time_stamp_ns, | 62 int64_t time_stamp_ns, |
63 webrtc::VideoRotation rotation) { | 63 webrtc::VideoRotation rotation) { |
64 return Reset(format, w, h, dw, dh, sample, sample_size, | 64 return Reset(format, w, h, dw, dh, sample, sample_size, |
65 time_stamp_ns / rtc::kNumNanosecsPerMicrosec, rotation, | 65 time_stamp_ns / rtc::kNumNanosecsPerMicrosec, rotation, |
66 true /*apply_rotation*/); | 66 true /*apply_rotation*/); |
67 } | 67 } |
68 | 68 |
| 69 bool WebRtcVideoFrame::Init(const CapturedFrame* frame, int dw, int dh, |
| 70 bool apply_rotation) { |
| 71 return Reset(frame->fourcc, frame->width, frame->height, dw, dh, |
| 72 static_cast<uint8_t*>(frame->data), frame->data_size, |
| 73 frame->time_stamp / rtc::kNumNanosecsPerMicrosec, |
| 74 frame->rotation, apply_rotation); |
| 75 } |
| 76 |
69 int WebRtcVideoFrame::width() const { | 77 int WebRtcVideoFrame::width() const { |
70 return video_frame_buffer_ ? video_frame_buffer_->width() : 0; | 78 return video_frame_buffer_ ? video_frame_buffer_->width() : 0; |
71 } | 79 } |
72 | 80 |
73 int WebRtcVideoFrame::height() const { | 81 int WebRtcVideoFrame::height() const { |
74 return video_frame_buffer_ ? video_frame_buffer_->height() : 0; | 82 return video_frame_buffer_ ? video_frame_buffer_->height() : 0; |
75 } | 83 } |
76 | 84 |
77 const rtc::scoped_refptr<webrtc::VideoFrameBuffer>& | 85 const rtc::scoped_refptr<webrtc::VideoFrameBuffer>& |
78 WebRtcVideoFrame::video_frame_buffer() const { | 86 WebRtcVideoFrame::video_frame_buffer() const { |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
152 timestamp_us_ = timestamp_us; | 160 timestamp_us_ = timestamp_us; |
153 return true; | 161 return true; |
154 } | 162 } |
155 | 163 |
156 void WebRtcVideoFrame::InitToEmptyBuffer(int w, int h) { | 164 void WebRtcVideoFrame::InitToEmptyBuffer(int w, int h) { |
157 video_frame_buffer_ = new rtc::RefCountedObject<webrtc::I420Buffer>(w, h); | 165 video_frame_buffer_ = new rtc::RefCountedObject<webrtc::I420Buffer>(w, h); |
158 rotation_ = webrtc::kVideoRotation_0; | 166 rotation_ = webrtc::kVideoRotation_0; |
159 } | 167 } |
160 | 168 |
161 } // namespace cricket | 169 } // namespace cricket |
OLD | NEW |