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

Side by Side Diff: content/browser/renderer_host/media/video_capture_controller.cc

Issue 10075001: add more color formats NV21 and YV12 in video capture (mainly from Android). (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 8 years, 8 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | media/base/yuv_convert.h » ('j') | media/base/yuv_convert.h » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "content/browser/renderer_host/media/video_capture_controller.h" 5 #include "content/browser/renderer_host/media/video_capture_controller.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/memory/scoped_ptr.h" 8 #include "base/memory/scoped_ptr.h"
9 #include "base/stl_util.h" 9 #include "base/stl_util.h"
10 #include "content/browser/renderer_host/media/media_stream_manager.h" 10 #include "content/browser/renderer_host/media/media_stream_manager.h"
(...skipping 276 matching lines...) Expand 10 before | Expand all | Expand 10 after
287 uint8* vplane = uplane + (frame_info_.width * frame_info_.height) / 4; 287 uint8* vplane = uplane + (frame_info_.width * frame_info_.height) / 4;
288 288
289 // Do color conversion from the camera format to I420. 289 // Do color conversion from the camera format to I420.
290 switch (frame_info_.color) { 290 switch (frame_info_.color) {
291 case media::VideoCaptureDevice::kColorUnknown: // Color format not set. 291 case media::VideoCaptureDevice::kColorUnknown: // Color format not set.
292 break; 292 break;
293 case media::VideoCaptureDevice::kI420: { 293 case media::VideoCaptureDevice::kI420: {
294 memcpy(target, data, (frame_info_.width * frame_info_.height * 3) / 2); 294 memcpy(target, data, (frame_info_.width * frame_info_.height * 3) / 2);
295 break; 295 break;
296 } 296 }
297 case media::VideoCaptureDevice::kYV12: {
298 const uint8* ptr = data;
299 memcpy(yplane, ptr, (frame_info_.width * frame_info_.height));
300 ptr += frame_info_.width * frame_info_.height;
301 memcpy(vplane, ptr, (frame_info_.width * frame_info_.height) >> 2);
302 ptr += (frame_info_.width * frame_info_.height) >> 2;
303 memcpy(uplane, ptr, (frame_info_.width * frame_info_.height) >> 2);
304 break;
305 }
306 case media::VideoCaptureDevice::kNV21: {
307 media::ConvertNV21ToYUV(data, yplane, uplane, vplane, frame_info_.width,
308 frame_info_.height);
309 break;
310 }
297 case media::VideoCaptureDevice::kYUY2: { 311 case media::VideoCaptureDevice::kYUY2: {
298 media::ConvertYUY2ToYUV(data, yplane, uplane, vplane, frame_info_.width, 312 media::ConvertYUY2ToYUV(data, yplane, uplane, vplane, frame_info_.width,
299 frame_info_.height); 313 frame_info_.height);
300 break; 314 break;
301 } 315 }
302 case media::VideoCaptureDevice::kRGB24: { 316 case media::VideoCaptureDevice::kRGB24: {
303 int ystride = frame_info_.width; 317 int ystride = frame_info_.width;
304 int uvstride = frame_info_.width / 2; 318 int uvstride = frame_info_.width / 2;
305 #if defined(OS_WIN) // RGB on Windows start at the bottom line. 319 #if defined(OS_WIN) // RGB on Windows start at the bottom line.
306 int rgb_stride = -3 * frame_info_.width; 320 int rgb_stride = -3 * frame_info_.width;
(...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after
524 } 538 }
525 539
526 void VideoCaptureController::DoDeviceStoppedOnIOThread() { 540 void VideoCaptureController::DoDeviceStoppedOnIOThread() {
527 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); 541 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
528 device_in_use_ = false; 542 device_in_use_ = false;
529 if (state_ == video_capture::kStopping) { 543 if (state_ == video_capture::kStopping) {
530 PostStopping(); 544 PostStopping();
531 } 545 }
532 } 546 }
533 547
OLDNEW
« no previous file with comments | « no previous file | media/base/yuv_convert.h » ('j') | media/base/yuv_convert.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698