| 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 "media/video/capture/mac/video_capture_device_mac.h" | 5 #include "media/video/capture/mac/video_capture_device_mac.h" |
| 6 | 6 |
| 7 #include <IOKit/IOCFPlugIn.h> | 7 #include <IOKit/IOCFPlugIn.h> |
| 8 #include <IOKit/usb/IOUSBLib.h> | 8 #include <IOKit/usb/IOUSBLib.h> |
| 9 #include <IOKit/usb/USBSpec.h> | 9 #include <IOKit/usb/USBSpec.h> |
| 10 | 10 |
| (...skipping 419 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 430 SetErrorState("Could not start capture device."); | 430 SetErrorState("Could not start capture device."); |
| 431 return; | 431 return; |
| 432 } | 432 } |
| 433 | 433 |
| 434 state_ = kCapturing; | 434 state_ = kCapturing; |
| 435 } | 435 } |
| 436 | 436 |
| 437 void VideoCaptureDeviceMac::StopAndDeAllocate() { | 437 void VideoCaptureDeviceMac::StopAndDeAllocate() { |
| 438 DCHECK(task_runner_->BelongsToCurrentThread()); | 438 DCHECK(task_runner_->BelongsToCurrentThread()); |
| 439 DCHECK(state_ == kCapturing || state_ == kError) << state_; | 439 DCHECK(state_ == kCapturing || state_ == kError) << state_; |
| 440 [capture_device_ stopCapture]; | |
| 441 | 440 |
| 442 [capture_device_ setCaptureDevice:nil]; | 441 [capture_device_ setCaptureDevice:nil]; |
| 443 [capture_device_ setFrameReceiver:nil]; | 442 [capture_device_ setFrameReceiver:nil]; |
| 444 client_.reset(); | 443 client_.reset(); |
| 445 state_ = kIdle; | 444 state_ = kIdle; |
| 446 tried_to_square_pixels_ = false; | 445 tried_to_square_pixels_ = false; |
| 447 } | 446 } |
| 448 | 447 |
| 449 bool VideoCaptureDeviceMac::Init( | 448 bool VideoCaptureDeviceMac::Init( |
| 450 VideoCaptureDevice::Name::CaptureApiType capture_api_type) { | 449 VideoCaptureDevice::Name::CaptureApiType capture_api_type) { |
| (...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 572 if (![capture_device_ setCaptureHeight:capture_format_.frame_size.height() | 571 if (![capture_device_ setCaptureHeight:capture_format_.frame_size.height() |
| 573 width:capture_format_.frame_size.width() | 572 width:capture_format_.frame_size.width() |
| 574 frameRate:capture_format_.frame_rate]) { | 573 frameRate:capture_format_.frame_rate]) { |
| 575 ReceiveError("Could not configure capture device."); | 574 ReceiveError("Could not configure capture device."); |
| 576 return false; | 575 return false; |
| 577 } | 576 } |
| 578 return true; | 577 return true; |
| 579 } | 578 } |
| 580 | 579 |
| 581 } // namespace media | 580 } // namespace media |
| OLD | NEW |