OLD | NEW |
1 /* | 1 /* |
2 * libjingle | 2 * libjingle |
3 * Copyright 2011 Google Inc. | 3 * Copyright 2011 Google Inc. |
4 * | 4 * |
5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
6 * modification, are permitted provided that the following conditions are met: | 6 * modification, are permitted provided that the following conditions are met: |
7 * | 7 * |
8 * 1. Redistributions of source code must retain the above copyright notice, | 8 * 1. Redistributions of source code must retain the above copyright notice, |
9 * this list of conditions and the following disclaimer. | 9 * this list of conditions and the following disclaimer. |
10 * 2. Redistributions in binary form must reproduce the above copyright notice, | 10 * 2. Redistributions in binary form must reproduce the above copyright notice, |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
49 const rtc::scoped_refptr<webrtc::VideoFrameBuffer>& buffer, | 49 const rtc::scoped_refptr<webrtc::VideoFrameBuffer>& buffer, |
50 int64_t time_stamp_ns, | 50 int64_t time_stamp_ns, |
51 webrtc::VideoRotation rotation) | 51 webrtc::VideoRotation rotation) |
52 : video_frame_buffer_(buffer), | 52 : video_frame_buffer_(buffer), |
53 pixel_width_(1), | 53 pixel_width_(1), |
54 pixel_height_(1), | 54 pixel_height_(1), |
55 time_stamp_ns_(time_stamp_ns), | 55 time_stamp_ns_(time_stamp_ns), |
56 rotation_(rotation) { | 56 rotation_(rotation) { |
57 } | 57 } |
58 | 58 |
59 WebRtcVideoFrame::WebRtcVideoFrame( | |
60 const rtc::scoped_refptr<webrtc::VideoFrameBuffer>& buffer, | |
61 int64_t elapsed_time_ns, | |
62 int64_t time_stamp_ns) | |
63 : video_frame_buffer_(buffer), | |
64 pixel_width_(1), | |
65 pixel_height_(1), | |
66 time_stamp_ns_(time_stamp_ns), | |
67 rotation_(webrtc::kVideoRotation_0) { | |
68 } | |
69 | |
70 WebRtcVideoFrame::~WebRtcVideoFrame() {} | 59 WebRtcVideoFrame::~WebRtcVideoFrame() {} |
71 | 60 |
72 bool WebRtcVideoFrame::Init(uint32_t format, | 61 bool WebRtcVideoFrame::Init(uint32_t format, |
73 int w, | 62 int w, |
74 int h, | 63 int h, |
75 int dw, | 64 int dw, |
76 int dh, | 65 int dh, |
77 uint8_t* sample, | 66 uint8_t* sample, |
78 size_t sample_size, | 67 size_t sample_size, |
79 size_t pixel_width, | 68 size_t pixel_width, |
80 size_t pixel_height, | 69 size_t pixel_height, |
81 int64_t time_stamp_ns, | 70 int64_t time_stamp_ns, |
82 webrtc::VideoRotation rotation) { | 71 webrtc::VideoRotation rotation) { |
83 return Reset(format, w, h, dw, dh, sample, sample_size, pixel_width, | 72 return Reset(format, w, h, dw, dh, sample, sample_size, pixel_width, |
84 pixel_height, time_stamp_ns, rotation, | 73 pixel_height, time_stamp_ns, rotation, |
85 true /*apply_rotation*/); | 74 true /*apply_rotation*/); |
86 } | 75 } |
87 | 76 |
88 bool WebRtcVideoFrame::Init(const CapturedFrame* frame, int dw, int dh, | 77 bool WebRtcVideoFrame::Init(const CapturedFrame* frame, int dw, int dh, |
89 bool apply_rotation) { | 78 bool apply_rotation) { |
90 return Reset(frame->fourcc, frame->width, frame->height, dw, dh, | 79 return Reset(frame->fourcc, frame->width, frame->height, dw, dh, |
91 static_cast<uint8_t*>(frame->data), frame->data_size, | 80 static_cast<uint8_t*>(frame->data), frame->data_size, |
92 frame->pixel_width, frame->pixel_height, frame->time_stamp, | 81 frame->pixel_width, frame->pixel_height, frame->time_stamp, |
93 frame->GetRotation(), apply_rotation); | 82 frame->rotation, apply_rotation); |
94 } | 83 } |
95 | 84 |
96 bool WebRtcVideoFrame::InitToBlack(int w, int h, size_t pixel_width, | 85 bool WebRtcVideoFrame::InitToBlack(int w, int h, size_t pixel_width, |
97 size_t pixel_height, int64_t, | |
98 int64_t time_stamp_ns) { | |
99 return InitToBlack(w, h, pixel_width, pixel_height, time_stamp_ns); | |
100 } | |
101 | |
102 bool WebRtcVideoFrame::InitToBlack(int w, int h, size_t pixel_width, | |
103 size_t pixel_height, int64_t time_stamp_ns) { | 86 size_t pixel_height, int64_t time_stamp_ns) { |
104 InitToEmptyBuffer(w, h, pixel_width, pixel_height, time_stamp_ns); | 87 InitToEmptyBuffer(w, h, pixel_width, pixel_height, time_stamp_ns); |
105 return SetToBlack(); | 88 return SetToBlack(); |
106 } | 89 } |
107 | 90 |
108 size_t WebRtcVideoFrame::GetWidth() const { | 91 size_t WebRtcVideoFrame::GetWidth() const { |
109 return video_frame_buffer_ ? video_frame_buffer_->width() : 0; | 92 return video_frame_buffer_ ? video_frame_buffer_->width() : 0; |
110 } | 93 } |
111 | 94 |
112 size_t WebRtcVideoFrame::GetHeight() const { | 95 size_t WebRtcVideoFrame::GetHeight() const { |
(...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
320 rotated_frame_->GetUPlane(), rotated_frame_->GetUPitch(), | 303 rotated_frame_->GetUPlane(), rotated_frame_->GetUPitch(), |
321 rotated_frame_->GetVPlane(), rotated_frame_->GetVPitch(), width, height, | 304 rotated_frame_->GetVPlane(), rotated_frame_->GetVPitch(), width, height, |
322 static_cast<libyuv::RotationMode>(GetVideoRotation())); | 305 static_cast<libyuv::RotationMode>(GetVideoRotation())); |
323 if (ret == 0) { | 306 if (ret == 0) { |
324 return rotated_frame_.get(); | 307 return rotated_frame_.get(); |
325 } | 308 } |
326 return nullptr; | 309 return nullptr; |
327 } | 310 } |
328 | 311 |
329 } // namespace cricket | 312 } // namespace cricket |
OLD | NEW |