| 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 426 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 437 | 437 |
| 438 void VideoCaptureDeviceMac::OnPhotoTaken(const uint8_t* image_data, | 438 void VideoCaptureDeviceMac::OnPhotoTaken(const uint8_t* image_data, |
| 439 size_t image_length, | 439 size_t image_length, |
| 440 const std::string& mime_type) { | 440 const std::string& mime_type) { |
| 441 DCHECK(photo_callback_); | 441 DCHECK(photo_callback_); |
| 442 if (!image_data || !image_length) { | 442 if (!image_data || !image_length) { |
| 443 OnPhotoError(); | 443 OnPhotoError(); |
| 444 return; | 444 return; |
| 445 } | 445 } |
| 446 | 446 |
| 447 photo_callback_->Run(mojo::String::From(mime_type), | 447 photo_callback_->Run( |
| 448 mojo::Array<uint8_t>(std::vector<uint8_t>( | 448 mime_type, std::vector<uint8_t>(image_data, image_data + image_length)); |
| 449 image_data, image_data + image_length))); | |
| 450 photo_callback_.reset(); | 449 photo_callback_.reset(); |
| 451 } | 450 } |
| 452 | 451 |
| 453 void VideoCaptureDeviceMac::OnPhotoError() { | 452 void VideoCaptureDeviceMac::OnPhotoError() { |
| 454 DLOG(ERROR) << __FUNCTION__ << " error taking picture"; | 453 DLOG(ERROR) << __FUNCTION__ << " error taking picture"; |
| 455 photo_callback_.reset(); | 454 photo_callback_.reset(); |
| 456 } | 455 } |
| 457 | 456 |
| 458 void VideoCaptureDeviceMac::ReceiveError( | 457 void VideoCaptureDeviceMac::ReceiveError( |
| 459 const tracked_objects::Location& from_here, | 458 const tracked_objects::Location& from_here, |
| (...skipping 21 matching lines...) Expand all Loading... |
| 481 if (![capture_device_ setCaptureHeight:capture_format_.frame_size.height() | 480 if (![capture_device_ setCaptureHeight:capture_format_.frame_size.height() |
| 482 width:capture_format_.frame_size.width() | 481 width:capture_format_.frame_size.width() |
| 483 frameRate:capture_format_.frame_rate]) { | 482 frameRate:capture_format_.frame_rate]) { |
| 484 ReceiveError(FROM_HERE, "Could not configure capture device."); | 483 ReceiveError(FROM_HERE, "Could not configure capture device."); |
| 485 return false; | 484 return false; |
| 486 } | 485 } |
| 487 return true; | 486 return true; |
| 488 } | 487 } |
| 489 | 488 |
| 490 } // namespace media | 489 } // namespace media |
| OLD | NEW |