OLD | NEW |
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 <set> | 7 #include <set> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
(...skipping 380 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
391 if (!(frame->format() == media::VideoFrame::I420 || | 391 if (!(frame->format() == media::VideoFrame::I420 || |
392 frame->format() == media::VideoFrame::YV12 || | 392 frame->format() == media::VideoFrame::YV12 || |
393 frame->format() == media::VideoFrame::RGB32)) { | 393 frame->format() == media::VideoFrame::RGB32)) { |
394 NOTREACHED() << "Unsupported format passed to OnIncomingCapturedVideoFrame"; | 394 NOTREACHED() << "Unsupported format passed to OnIncomingCapturedVideoFrame"; |
395 return; | 395 return; |
396 } | 396 } |
397 | 397 |
398 const int kYPlane = media::VideoFrame::kYPlane; | 398 const int kYPlane = media::VideoFrame::kYPlane; |
399 const int kUPlane = media::VideoFrame::kUPlane; | 399 const int kUPlane = media::VideoFrame::kUPlane; |
400 const int kVPlane = media::VideoFrame::kVPlane; | 400 const int kVPlane = media::VideoFrame::kVPlane; |
401 const int kAPlane = media::VideoFrame::kAPlane; | |
402 const int kRGBPlane = media::VideoFrame::kRGBPlane; | 401 const int kRGBPlane = media::VideoFrame::kRGBPlane; |
403 | 402 |
404 // Do color conversion from the camera format to I420. | 403 // Do color conversion from the camera format to I420. |
405 switch (frame->format()) { | 404 switch (frame->format()) { |
406 #if defined(GOOGLE_TV) | 405 #if defined(GOOGLE_TV) |
407 case media::VideoFrame::HOLE: | 406 case media::VideoFrame::HOLE: |
408 // Fall-through to NOTREACHED() block. | 407 // Fall-through to NOTREACHED() block. |
409 #endif | 408 #endif |
410 case media::VideoFrame::INVALID: | 409 case media::VideoFrame::INVALID: |
411 case media::VideoFrame::YV16: | 410 case media::VideoFrame::YV16: |
(...skipping 12 matching lines...) Expand all Loading... |
424 media::CopyUPlane(frame->data(kUPlane), | 423 media::CopyUPlane(frame->data(kUPlane), |
425 frame->stride(kUPlane), | 424 frame->stride(kUPlane), |
426 frame->rows(kUPlane), | 425 frame->rows(kUPlane), |
427 target); | 426 target); |
428 media::CopyVPlane(frame->data(kVPlane), | 427 media::CopyVPlane(frame->data(kVPlane), |
429 frame->stride(kVPlane), | 428 frame->stride(kVPlane), |
430 frame->rows(kVPlane), | 429 frame->rows(kVPlane), |
431 target); | 430 target); |
432 break; | 431 break; |
433 } | 432 } |
434 case media::VideoFrame::YV12A: { | |
435 DCHECK(!chopped_width_ && !chopped_height_); | |
436 media::CopyYPlane(frame->data(kYPlane), | |
437 frame->stride(kYPlane), | |
438 frame->rows(kYPlane), | |
439 target); | |
440 media::CopyUPlane(frame->data(kUPlane), | |
441 frame->stride(kUPlane), | |
442 frame->rows(kUPlane), | |
443 target); | |
444 media::CopyVPlane(frame->data(kVPlane), | |
445 frame->stride(kVPlane), | |
446 frame->rows(kVPlane), | |
447 target); | |
448 media::CopyAPlane(frame->data(kAPlane), | |
449 frame->stride(kAPlane), | |
450 frame->rows(kAPlane), | |
451 target); | |
452 break; | |
453 } | |
454 case media::VideoFrame::RGB32: { | 433 case media::VideoFrame::RGB32: { |
455 media::ConvertRGB32ToYUV(frame->data(kRGBPlane), | 434 media::ConvertRGB32ToYUV(frame->data(kRGBPlane), |
456 target->data(kYPlane), | 435 target->data(kYPlane), |
457 target->data(kUPlane), | 436 target->data(kUPlane), |
458 target->data(kVPlane), | 437 target->data(kVPlane), |
459 target->coded_size().width(), | 438 target->coded_size().width(), |
460 target->coded_size().height(), | 439 target->coded_size().height(), |
461 frame->stride(kRGBPlane), | 440 frame->stride(kRGBPlane), |
462 target->stride(kYPlane), | 441 target->stride(kYPlane), |
463 target->stride(kUPlane)); | 442 target->stride(kUPlane)); |
(...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
689 controller_clients_.push_back((*client_it)); | 668 controller_clients_.push_back((*client_it)); |
690 pending_clients_.erase(client_it++); | 669 pending_clients_.erase(client_it++); |
691 } | 670 } |
692 // Request the manager to start the actual capture. | 671 // Request the manager to start the actual capture. |
693 video_capture_manager_->Start(current_params_, this); | 672 video_capture_manager_->Start(current_params_, this); |
694 state_ = VIDEO_CAPTURE_STATE_STARTED; | 673 state_ = VIDEO_CAPTURE_STATE_STARTED; |
695 device_in_use_ = true; | 674 device_in_use_ = true; |
696 } | 675 } |
697 | 676 |
698 } // namespace content | 677 } // namespace content |
OLD | NEW |