| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "media/capture/video/mac/video_capture_device_decklink_mac.h" | 5 #include "media/capture/video/mac/video_capture_device_decklink_mac.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "base/memory/ref_counted.h" | 8 #include "base/memory/ref_counted.h" |
| 9 #include "base/strings/sys_string_conversions.h" | 9 #include "base/strings/sys_string_conversions.h" |
| 10 #include "base/synchronization/lock.h" | 10 #include "base/synchronization/lock.h" |
| (...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 225 IDeckLinkDisplayMode* new_display_mode, | 225 IDeckLinkDisplayMode* new_display_mode, |
| 226 BMDDetectedVideoInputFormatFlags detected_signal_flags) { | 226 BMDDetectedVideoInputFormatFlags detected_signal_flags) { |
| 227 DCHECK(thread_checker_.CalledOnValidThread()); | 227 DCHECK(thread_checker_.CalledOnValidThread()); |
| 228 return S_OK; | 228 return S_OK; |
| 229 } | 229 } |
| 230 | 230 |
| 231 HRESULT DeckLinkCaptureDelegate::VideoInputFrameArrived( | 231 HRESULT DeckLinkCaptureDelegate::VideoInputFrameArrived( |
| 232 IDeckLinkVideoInputFrame* video_frame, | 232 IDeckLinkVideoInputFrame* video_frame, |
| 233 IDeckLinkAudioInputPacket* /* audio_packet */) { | 233 IDeckLinkAudioInputPacket* /* audio_packet */) { |
| 234 // Capture frames are manipulated as an IDeckLinkVideoFrame. | 234 // Capture frames are manipulated as an IDeckLinkVideoFrame. |
| 235 uint8* video_data = NULL; | 235 uint8_t* video_data = NULL; |
| 236 video_frame->GetBytes(reinterpret_cast<void**>(&video_data)); | 236 video_frame->GetBytes(reinterpret_cast<void**>(&video_data)); |
| 237 | 237 |
| 238 media::VideoPixelFormat pixel_format = | 238 media::VideoPixelFormat pixel_format = |
| 239 media::PIXEL_FORMAT_UNKNOWN; | 239 media::PIXEL_FORMAT_UNKNOWN; |
| 240 switch (video_frame->GetPixelFormat()) { | 240 switch (video_frame->GetPixelFormat()) { |
| 241 case bmdFormat8BitYUV: // A.k.a. '2vuy'; | 241 case bmdFormat8BitYUV: // A.k.a. '2vuy'; |
| 242 pixel_format = media::PIXEL_FORMAT_UYVY; | 242 pixel_format = media::PIXEL_FORMAT_UYVY; |
| 243 break; | 243 break; |
| 244 case bmdFormat8BitARGB: | 244 case bmdFormat8BitARGB: |
| 245 pixel_format = media::PIXEL_FORMAT_ARGB; | 245 pixel_format = media::PIXEL_FORMAT_ARGB; |
| (...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 437 const Name& device_name) | 437 const Name& device_name) |
| 438 : decklink_capture_delegate_( | 438 : decklink_capture_delegate_( |
| 439 new DeckLinkCaptureDelegate(device_name, this)) { | 439 new DeckLinkCaptureDelegate(device_name, this)) { |
| 440 } | 440 } |
| 441 | 441 |
| 442 VideoCaptureDeviceDeckLinkMac::~VideoCaptureDeviceDeckLinkMac() { | 442 VideoCaptureDeviceDeckLinkMac::~VideoCaptureDeviceDeckLinkMac() { |
| 443 decklink_capture_delegate_->ResetVideoCaptureDeviceReference(); | 443 decklink_capture_delegate_->ResetVideoCaptureDeviceReference(); |
| 444 } | 444 } |
| 445 | 445 |
| 446 void VideoCaptureDeviceDeckLinkMac::OnIncomingCapturedData( | 446 void VideoCaptureDeviceDeckLinkMac::OnIncomingCapturedData( |
| 447 const uint8* data, | 447 const uint8_t* data, |
| 448 size_t length, | 448 size_t length, |
| 449 const VideoCaptureFormat& frame_format, | 449 const VideoCaptureFormat& frame_format, |
| 450 int rotation, // Clockwise. | 450 int rotation, // Clockwise. |
| 451 base::TimeTicks timestamp) { | 451 base::TimeTicks timestamp) { |
| 452 base::AutoLock lock(lock_); | 452 base::AutoLock lock(lock_); |
| 453 if (client_) { | 453 if (client_) { |
| 454 client_->OnIncomingCapturedData(data, length, frame_format, rotation, | 454 client_->OnIncomingCapturedData(data, length, frame_format, rotation, |
| 455 timestamp); | 455 timestamp); |
| 456 } | 456 } |
| 457 } | 457 } |
| (...skipping 22 matching lines...) Expand all Loading... |
| 480 if (decklink_capture_delegate_.get()) | 480 if (decklink_capture_delegate_.get()) |
| 481 decklink_capture_delegate_->AllocateAndStart(params); | 481 decklink_capture_delegate_->AllocateAndStart(params); |
| 482 } | 482 } |
| 483 | 483 |
| 484 void VideoCaptureDeviceDeckLinkMac::StopAndDeAllocate() { | 484 void VideoCaptureDeviceDeckLinkMac::StopAndDeAllocate() { |
| 485 if (decklink_capture_delegate_.get()) | 485 if (decklink_capture_delegate_.get()) |
| 486 decklink_capture_delegate_->StopAndDeAllocate(); | 486 decklink_capture_delegate_->StopAndDeAllocate(); |
| 487 } | 487 } |
| 488 | 488 |
| 489 } // namespace media | 489 } // namespace media |
| OLD | NEW |