| 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/capture/video/mac/video_capture_device_mac.h" | 5 #include "media/capture/video/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 #include <stddef.h> | 10 #include <stddef.h> |
| (...skipping 395 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 406 capture_format_.frame_size.height(), capture_format_.frame_size.height(), | 406 capture_format_.frame_size.height(), capture_format_.frame_size.height(), |
| 407 capture_format_.frame_size.height(), 0 /* step */); | 407 capture_format_.frame_size.height(), 0 /* step */); |
| 408 photo_capabilities->width = mojom::Range::New( | 408 photo_capabilities->width = mojom::Range::New( |
| 409 capture_format_.frame_size.width(), capture_format_.frame_size.width(), | 409 capture_format_.frame_size.width(), capture_format_.frame_size.width(), |
| 410 capture_format_.frame_size.width(), 0 /* step */); | 410 capture_format_.frame_size.width(), 0 /* step */); |
| 411 photo_capabilities->torch = false; | 411 photo_capabilities->torch = false; |
| 412 | 412 |
| 413 callback.Run(std::move(photo_capabilities)); | 413 callback.Run(std::move(photo_capabilities)); |
| 414 } | 414 } |
| 415 | 415 |
| 416 void VideoCaptureDeviceMac::SetPhotoOptions(mojom::PhotoSettingsPtr settings, |
| 417 SetPhotoOptionsCallback callback) { |
| 418 DCHECK(task_runner_->BelongsToCurrentThread()); |
| 419 // Drop |callback| and return if there are any unsupported |settings|. |
| 420 // TODO(mcasas): centralise checks elsewhere, https://crbug.com/724285. |
| 421 if ((settings->has_width && |
| 422 settings->width != capture_format_.frame_size.width()) || |
| 423 (settings->has_height && |
| 424 settings->height != capture_format_.frame_size.height()) || |
| 425 settings->has_fill_light_mode || settings->has_red_eye_reduction) { |
| 426 return; |
| 427 } |
| 428 callback.Run(true); |
| 429 } |
| 430 |
| 416 bool VideoCaptureDeviceMac::Init(VideoCaptureApi capture_api_type) { | 431 bool VideoCaptureDeviceMac::Init(VideoCaptureApi capture_api_type) { |
| 417 DCHECK(task_runner_->BelongsToCurrentThread()); | 432 DCHECK(task_runner_->BelongsToCurrentThread()); |
| 418 DCHECK_EQ(state_, kNotInitialized); | 433 DCHECK_EQ(state_, kNotInitialized); |
| 419 | 434 |
| 420 if (capture_api_type != VideoCaptureApi::MACOSX_AVFOUNDATION) | 435 if (capture_api_type != VideoCaptureApi::MACOSX_AVFOUNDATION) |
| 421 return false; | 436 return false; |
| 422 | 437 |
| 423 capture_device_.reset( | 438 capture_device_.reset( |
| 424 [[VideoCaptureDeviceAVFoundation alloc] initWithFrameReceiver:this]); | 439 [[VideoCaptureDeviceAVFoundation alloc] initWithFrameReceiver:this]); |
| 425 | 440 |
| (...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 518 if (![capture_device_ setCaptureHeight:capture_format_.frame_size.height() | 533 if (![capture_device_ setCaptureHeight:capture_format_.frame_size.height() |
| 519 width:capture_format_.frame_size.width() | 534 width:capture_format_.frame_size.width() |
| 520 frameRate:capture_format_.frame_rate]) { | 535 frameRate:capture_format_.frame_rate]) { |
| 521 ReceiveError(FROM_HERE, "Could not configure capture device."); | 536 ReceiveError(FROM_HERE, "Could not configure capture device."); |
| 522 return false; | 537 return false; |
| 523 } | 538 } |
| 524 return true; | 539 return true; |
| 525 } | 540 } |
| 526 | 541 |
| 527 } // namespace media | 542 } // namespace media |
| OLD | NEW |