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; |
401 const int kRGBPlane = media::VideoFrame::kRGBPlane; | 402 const int kRGBPlane = media::VideoFrame::kRGBPlane; |
402 | 403 |
403 // Do color conversion from the camera format to I420. | 404 // Do color conversion from the camera format to I420. |
404 switch (frame->format()) { | 405 switch (frame->format()) { |
405 #if defined(GOOGLE_TV) | 406 #if defined(GOOGLE_TV) |
406 case media::VideoFrame::HOLE: | 407 case media::VideoFrame::HOLE: |
407 // Fall-through to NOTREACHED() block. | 408 // Fall-through to NOTREACHED() block. |
408 #endif | 409 #endif |
409 case media::VideoFrame::INVALID: | 410 case media::VideoFrame::INVALID: |
410 case media::VideoFrame::YV16: | 411 case media::VideoFrame::YV16: |
(...skipping 12 matching lines...) Expand all Loading... |
423 media::CopyUPlane(frame->data(kUPlane), | 424 media::CopyUPlane(frame->data(kUPlane), |
424 frame->stride(kUPlane), | 425 frame->stride(kUPlane), |
425 frame->rows(kUPlane), | 426 frame->rows(kUPlane), |
426 target); | 427 target); |
427 media::CopyVPlane(frame->data(kVPlane), | 428 media::CopyVPlane(frame->data(kVPlane), |
428 frame->stride(kVPlane), | 429 frame->stride(kVPlane), |
429 frame->rows(kVPlane), | 430 frame->rows(kVPlane), |
430 target); | 431 target); |
431 break; | 432 break; |
432 } | 433 } |
| 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 } |
433 case media::VideoFrame::RGB32: { | 454 case media::VideoFrame::RGB32: { |
434 media::ConvertRGB32ToYUV(frame->data(kRGBPlane), | 455 media::ConvertRGB32ToYUV(frame->data(kRGBPlane), |
435 target->data(kYPlane), | 456 target->data(kYPlane), |
436 target->data(kUPlane), | 457 target->data(kUPlane), |
437 target->data(kVPlane), | 458 target->data(kVPlane), |
438 target->coded_size().width(), | 459 target->coded_size().width(), |
439 target->coded_size().height(), | 460 target->coded_size().height(), |
440 frame->stride(kRGBPlane), | 461 frame->stride(kRGBPlane), |
441 target->stride(kYPlane), | 462 target->stride(kYPlane), |
442 target->stride(kUPlane)); | 463 target->stride(kUPlane)); |
(...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
668 controller_clients_.push_back((*client_it)); | 689 controller_clients_.push_back((*client_it)); |
669 pending_clients_.erase(client_it++); | 690 pending_clients_.erase(client_it++); |
670 } | 691 } |
671 // Request the manager to start the actual capture. | 692 // Request the manager to start the actual capture. |
672 video_capture_manager_->Start(current_params_, this); | 693 video_capture_manager_->Start(current_params_, this); |
673 state_ = VIDEO_CAPTURE_STATE_STARTED; | 694 state_ = VIDEO_CAPTURE_STATE_STARTED; |
674 device_in_use_ = true; | 695 device_in_use_ = true; |
675 } | 696 } |
676 | 697 |
677 } // namespace content | 698 } // namespace content |
OLD | NEW |