Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(78)

Side by Side Diff: talk/media/webrtc/webrtcvideoframe.cc

Issue 1362503003: Use suffixed {uint,int}{8,16,32,64}_t types. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: google::int32 Created 5 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
66 : video_frame_buffer_(buffer), 66 : video_frame_buffer_(buffer),
67 pixel_width_(1), 67 pixel_width_(1),
68 pixel_height_(1), 68 pixel_height_(1),
69 elapsed_time_ns_(elapsed_time_ns), 69 elapsed_time_ns_(elapsed_time_ns),
70 time_stamp_ns_(time_stamp_ns), 70 time_stamp_ns_(time_stamp_ns),
71 rotation_(webrtc::kVideoRotation_0) { 71 rotation_(webrtc::kVideoRotation_0) {
72 } 72 }
73 73
74 WebRtcVideoFrame::~WebRtcVideoFrame() {} 74 WebRtcVideoFrame::~WebRtcVideoFrame() {}
75 75
76 bool WebRtcVideoFrame::Init(uint32 format, 76 bool WebRtcVideoFrame::Init(uint32_t format,
77 int w, 77 int w,
78 int h, 78 int h,
79 int dw, 79 int dw,
80 int dh, 80 int dh,
81 uint8* sample, 81 uint8_t* sample,
82 size_t sample_size, 82 size_t sample_size,
83 size_t pixel_width, 83 size_t pixel_width,
84 size_t pixel_height, 84 size_t pixel_height,
85 int64_t elapsed_time_ns, 85 int64_t elapsed_time_ns,
86 int64_t time_stamp_ns, 86 int64_t time_stamp_ns,
87 webrtc::VideoRotation rotation) { 87 webrtc::VideoRotation rotation) {
88 return Reset(format, w, h, dw, dh, sample, sample_size, pixel_width, 88 return Reset(format, w, h, dw, dh, sample, sample_size, pixel_width,
89 pixel_height, elapsed_time_ns, time_stamp_ns, rotation, 89 pixel_height, elapsed_time_ns, time_stamp_ns, rotation,
90 true /*apply_rotation*/); 90 true /*apply_rotation*/);
91 } 91 }
92 92
93 bool WebRtcVideoFrame::Init(const CapturedFrame* frame, int dw, int dh, 93 bool WebRtcVideoFrame::Init(const CapturedFrame* frame, int dw, int dh,
94 bool apply_rotation) { 94 bool apply_rotation) {
95 return Reset(frame->fourcc, frame->width, frame->height, dw, dh, 95 return Reset(frame->fourcc, frame->width, frame->height, dw, dh,
96 static_cast<uint8*>(frame->data), frame->data_size, 96 static_cast<uint8_t*>(frame->data), frame->data_size,
97 frame->pixel_width, frame->pixel_height, frame->elapsed_time, 97 frame->pixel_width, frame->pixel_height, frame->elapsed_time,
98 frame->time_stamp, 98 frame->time_stamp, frame->GetRotation(), apply_rotation);
99 frame->GetRotation(),
100 apply_rotation);
101 } 99 }
102 100
103 bool WebRtcVideoFrame::InitToBlack(int w, int h, size_t pixel_width, 101 bool WebRtcVideoFrame::InitToBlack(int w, int h, size_t pixel_width,
104 size_t pixel_height, int64_t elapsed_time_ns, 102 size_t pixel_height, int64_t elapsed_time_ns,
105 int64_t time_stamp_ns) { 103 int64_t time_stamp_ns) {
106 InitToEmptyBuffer(w, h, pixel_width, pixel_height, elapsed_time_ns, 104 InitToEmptyBuffer(w, h, pixel_width, pixel_height, elapsed_time_ns,
107 time_stamp_ns); 105 time_stamp_ns);
108 return SetToBlack(); 106 return SetToBlack();
109 } 107 }
110 108
111 size_t WebRtcVideoFrame::GetWidth() const { 109 size_t WebRtcVideoFrame::GetWidth() const {
112 return video_frame_buffer_ ? video_frame_buffer_->width() : 0; 110 return video_frame_buffer_ ? video_frame_buffer_->width() : 0;
113 } 111 }
114 112
115 size_t WebRtcVideoFrame::GetHeight() const { 113 size_t WebRtcVideoFrame::GetHeight() const {
116 return video_frame_buffer_ ? video_frame_buffer_->height() : 0; 114 return video_frame_buffer_ ? video_frame_buffer_->height() : 0;
117 } 115 }
118 116
119 const uint8* WebRtcVideoFrame::GetYPlane() const { 117 const uint8_t* WebRtcVideoFrame::GetYPlane() const {
120 return video_frame_buffer_ ? video_frame_buffer_->data(kYPlane) : nullptr; 118 return video_frame_buffer_ ? video_frame_buffer_->data(kYPlane) : nullptr;
121 } 119 }
122 120
123 const uint8* WebRtcVideoFrame::GetUPlane() const { 121 const uint8_t* WebRtcVideoFrame::GetUPlane() const {
124 return video_frame_buffer_ ? video_frame_buffer_->data(kUPlane) : nullptr; 122 return video_frame_buffer_ ? video_frame_buffer_->data(kUPlane) : nullptr;
125 } 123 }
126 124
127 const uint8* WebRtcVideoFrame::GetVPlane() const { 125 const uint8_t* WebRtcVideoFrame::GetVPlane() const {
128 return video_frame_buffer_ ? video_frame_buffer_->data(kVPlane) : nullptr; 126 return video_frame_buffer_ ? video_frame_buffer_->data(kVPlane) : nullptr;
129 } 127 }
130 128
131 uint8* WebRtcVideoFrame::GetYPlane() { 129 uint8_t* WebRtcVideoFrame::GetYPlane() {
132 return video_frame_buffer_ ? video_frame_buffer_->MutableData(kYPlane) 130 return video_frame_buffer_ ? video_frame_buffer_->MutableData(kYPlane)
133 : nullptr; 131 : nullptr;
134 } 132 }
135 133
136 uint8* WebRtcVideoFrame::GetUPlane() { 134 uint8_t* WebRtcVideoFrame::GetUPlane() {
137 return video_frame_buffer_ ? video_frame_buffer_->MutableData(kUPlane) 135 return video_frame_buffer_ ? video_frame_buffer_->MutableData(kUPlane)
138 : nullptr; 136 : nullptr;
139 } 137 }
140 138
141 uint8* WebRtcVideoFrame::GetVPlane() { 139 uint8_t* WebRtcVideoFrame::GetVPlane() {
142 return video_frame_buffer_ ? video_frame_buffer_->MutableData(kVPlane) 140 return video_frame_buffer_ ? video_frame_buffer_->MutableData(kVPlane)
143 : nullptr; 141 : nullptr;
144 } 142 }
145 143
146 int32 WebRtcVideoFrame::GetYPitch() const { 144 int32_t WebRtcVideoFrame::GetYPitch() const {
147 return video_frame_buffer_ ? video_frame_buffer_->stride(kYPlane) : 0; 145 return video_frame_buffer_ ? video_frame_buffer_->stride(kYPlane) : 0;
148 } 146 }
149 147
150 int32 WebRtcVideoFrame::GetUPitch() const { 148 int32_t WebRtcVideoFrame::GetUPitch() const {
151 return video_frame_buffer_ ? video_frame_buffer_->stride(kUPlane) : 0; 149 return video_frame_buffer_ ? video_frame_buffer_->stride(kUPlane) : 0;
152 } 150 }
153 151
154 int32 WebRtcVideoFrame::GetVPitch() const { 152 int32_t WebRtcVideoFrame::GetVPitch() const {
155 return video_frame_buffer_ ? video_frame_buffer_->stride(kVPlane) : 0; 153 return video_frame_buffer_ ? video_frame_buffer_->stride(kVPlane) : 0;
156 } 154 }
157 155
158 bool WebRtcVideoFrame::IsExclusive() const { 156 bool WebRtcVideoFrame::IsExclusive() const {
159 return video_frame_buffer_->HasOneRef(); 157 return video_frame_buffer_->HasOneRef();
160 } 158 }
161 159
162 void* WebRtcVideoFrame::GetNativeHandle() const { 160 void* WebRtcVideoFrame::GetNativeHandle() const {
163 return video_frame_buffer_ ? video_frame_buffer_->native_handle() : nullptr; 161 return video_frame_buffer_ ? video_frame_buffer_->native_handle() : nullptr;
164 } 162 }
(...skipping 28 matching lines...) Expand all
193 new_buffer->MutableData(kYPlane), new_buffer->MutableData(kUPlane), 191 new_buffer->MutableData(kYPlane), new_buffer->MutableData(kUPlane),
194 new_buffer->MutableData(kVPlane), new_buffer->stride(kYPlane), 192 new_buffer->MutableData(kVPlane), new_buffer->stride(kYPlane),
195 new_buffer->stride(kUPlane), new_buffer->stride(kVPlane))) { 193 new_buffer->stride(kUPlane), new_buffer->stride(kVPlane))) {
196 return false; 194 return false;
197 } 195 }
198 196
199 video_frame_buffer_ = new_buffer; 197 video_frame_buffer_ = new_buffer;
200 return true; 198 return true;
201 } 199 }
202 200
203 size_t WebRtcVideoFrame::ConvertToRgbBuffer(uint32 to_fourcc, uint8* buffer, 201 size_t WebRtcVideoFrame::ConvertToRgbBuffer(uint32_t to_fourcc,
204 size_t size, int stride_rgb) const { 202 uint8_t* buffer,
203 size_t size,
204 int stride_rgb) const {
205 RTC_CHECK(video_frame_buffer_); 205 RTC_CHECK(video_frame_buffer_);
206 RTC_CHECK(video_frame_buffer_->native_handle() == nullptr); 206 RTC_CHECK(video_frame_buffer_->native_handle() == nullptr);
207 return VideoFrame::ConvertToRgbBuffer(to_fourcc, buffer, size, stride_rgb); 207 return VideoFrame::ConvertToRgbBuffer(to_fourcc, buffer, size, stride_rgb);
208 } 208 }
209 209
210 bool WebRtcVideoFrame::Reset(uint32 format, 210 bool WebRtcVideoFrame::Reset(uint32_t format,
211 int w, 211 int w,
212 int h, 212 int h,
213 int dw, 213 int dw,
214 int dh, 214 int dh,
215 uint8* sample, 215 uint8_t* sample,
216 size_t sample_size, 216 size_t sample_size,
217 size_t pixel_width, 217 size_t pixel_width,
218 size_t pixel_height, 218 size_t pixel_height,
219 int64_t elapsed_time_ns, 219 int64_t elapsed_time_ns,
220 int64_t time_stamp_ns, 220 int64_t time_stamp_ns,
221 webrtc::VideoRotation rotation, 221 webrtc::VideoRotation rotation,
222 bool apply_rotation) { 222 bool apply_rotation) {
223 if (!Validate(format, w, h, sample, sample_size)) { 223 if (!Validate(format, w, h, sample, sample_size)) {
224 return false; 224 return false;
225 } 225 }
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
325 rotated_frame_->GetUPlane(), rotated_frame_->GetUPitch(), 325 rotated_frame_->GetUPlane(), rotated_frame_->GetUPitch(),
326 rotated_frame_->GetVPlane(), rotated_frame_->GetVPitch(), width, height, 326 rotated_frame_->GetVPlane(), rotated_frame_->GetVPitch(), width, height,
327 static_cast<libyuv::RotationMode>(GetVideoRotation())); 327 static_cast<libyuv::RotationMode>(GetVideoRotation()));
328 if (ret == 0) { 328 if (ret == 0) {
329 return rotated_frame_.get(); 329 return rotated_frame_.get();
330 } 330 }
331 return nullptr; 331 return nullptr;
332 } 332 }
333 333
334 } // namespace cricket 334 } // namespace cricket
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698