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 <utility> | 7 #include <utility> |
8 | 8 |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "base/macros.h" | 10 #include "base/macros.h" |
(...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
202 chosen_display_mode->GetDisplayMode(), bmdFormat8BitYUV, | 202 chosen_display_mode->GetDisplayMode(), bmdFormat8BitYUV, |
203 bmdVideoInputFlagDefault) != S_OK) { | 203 bmdVideoInputFlagDefault) != S_OK) { |
204 SendErrorString(FROM_HERE, "Could not select the video format we like."); | 204 SendErrorString(FROM_HERE, "Could not select the video format we like."); |
205 return; | 205 return; |
206 } | 206 } |
207 | 207 |
208 decklink_input_local->SetCallback(this); | 208 decklink_input_local->SetCallback(this); |
209 if (decklink_input_local->StartStreams() != S_OK) | 209 if (decklink_input_local->StartStreams() != S_OK) |
210 SendErrorString(FROM_HERE, "Could not start capturing"); | 210 SendErrorString(FROM_HERE, "Could not start capturing"); |
211 | 211 |
| 212 if (frame_receiver_) |
| 213 frame_receiver_->ReportStarted(); |
| 214 |
212 decklink_.swap(decklink_local); | 215 decklink_.swap(decklink_local); |
213 decklink_input_.swap(decklink_input_local); | 216 decklink_input_.swap(decklink_input_local); |
214 } | 217 } |
215 | 218 |
216 void DeckLinkCaptureDelegate::StopAndDeAllocate() { | 219 void DeckLinkCaptureDelegate::StopAndDeAllocate() { |
217 DCHECK(thread_checker_.CalledOnValidThread()); | 220 DCHECK(thread_checker_.CalledOnValidThread()); |
218 if (!decklink_input_.get()) | 221 if (!decklink_input_.get()) |
219 return; | 222 return; |
220 if (decklink_input_->StopStreams() != S_OK) | 223 if (decklink_input_->StopStreams() != S_OK) |
221 SendLogString("Problem stopping capture."); | 224 SendLogString("Problem stopping capture."); |
(...skipping 265 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
487 client_->OnError(from_here, reason); | 490 client_->OnError(from_here, reason); |
488 } | 491 } |
489 | 492 |
490 void VideoCaptureDeviceDeckLinkMac::SendLogString(const std::string& message) { | 493 void VideoCaptureDeviceDeckLinkMac::SendLogString(const std::string& message) { |
491 DCHECK(thread_checker_.CalledOnValidThread()); | 494 DCHECK(thread_checker_.CalledOnValidThread()); |
492 base::AutoLock lock(lock_); | 495 base::AutoLock lock(lock_); |
493 if (client_) | 496 if (client_) |
494 client_->OnLog(message); | 497 client_->OnLog(message); |
495 } | 498 } |
496 | 499 |
| 500 void VideoCaptureDeviceDeckLinkMac::ReportStarted() { |
| 501 DCHECK(thread_checker_.CalledOnValidThread()); |
| 502 base::AutoLock lock(lock_); |
| 503 if (client_) |
| 504 client_->OnStarted(); |
| 505 } |
| 506 |
497 void VideoCaptureDeviceDeckLinkMac::AllocateAndStart( | 507 void VideoCaptureDeviceDeckLinkMac::AllocateAndStart( |
498 const VideoCaptureParams& params, | 508 const VideoCaptureParams& params, |
499 std::unique_ptr<VideoCaptureDevice::Client> client) { | 509 std::unique_ptr<VideoCaptureDevice::Client> client) { |
500 DCHECK(thread_checker_.CalledOnValidThread()); | 510 DCHECK(thread_checker_.CalledOnValidThread()); |
501 client_ = std::move(client); | 511 client_ = std::move(client); |
502 if (decklink_capture_delegate_.get()) | 512 if (decklink_capture_delegate_.get()) |
503 decklink_capture_delegate_->AllocateAndStart(params); | 513 decklink_capture_delegate_->AllocateAndStart(params); |
504 } | 514 } |
505 | 515 |
506 void VideoCaptureDeviceDeckLinkMac::StopAndDeAllocate() { | 516 void VideoCaptureDeviceDeckLinkMac::StopAndDeAllocate() { |
507 if (decklink_capture_delegate_.get()) | 517 if (decklink_capture_delegate_.get()) |
508 decklink_capture_delegate_->StopAndDeAllocate(); | 518 decklink_capture_delegate_->StopAndDeAllocate(); |
509 } | 519 } |
510 | 520 |
511 } // namespace media | 521 } // namespace media |
OLD | NEW |