| 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 #import <QTKit/QTKit.h> | 7 #import <QTKit/QTKit.h> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/location.h" | 10 #include "base/location.h" |
| (...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 120 if (state_ != kIdle) { | 120 if (state_ != kIdle) { |
| 121 return; | 121 return; |
| 122 } | 122 } |
| 123 int width = capture_format.width; | 123 int width = capture_format.width; |
| 124 int height = capture_format.height; | 124 int height = capture_format.height; |
| 125 int frame_rate = capture_format.frame_rate; | 125 int frame_rate = capture_format.frame_rate; |
| 126 | 126 |
| 127 // QTKit can scale captured frame to any size requested, which would lead to | 127 // QTKit can scale captured frame to any size requested, which would lead to |
| 128 // undesired aspect ratio change. Tries to open the camera with a natively | 128 // undesired aspect ratio change. Tries to open the camera with a natively |
| 129 // supported format and let the client to crop/pad the captured frames. | 129 // supported format and let the client to crop/pad the captured frames. |
| 130 GetBestMatchSupportedResolution(&width, | 130 GetBestMatchSupportedResolution(&width, &height); |
| 131 &height); | |
| 132 | 131 |
| 133 observer_ = observer; | 132 observer_ = observer; |
| 134 NSString* deviceId = | 133 NSString* deviceId = |
| 135 [NSString stringWithUTF8String:device_name_.id().c_str()]; | 134 [NSString stringWithUTF8String:device_name_.id().c_str()]; |
| 136 | 135 |
| 137 [capture_device_ setFrameReceiver:this]; | 136 [capture_device_ setFrameReceiver:this]; |
| 138 | 137 |
| 139 if (![capture_device_ setCaptureDevice:deviceId]) { | 138 if (![capture_device_ setCaptureDevice:deviceId]) { |
| 140 SetErrorState("Could not open capture device."); | 139 SetErrorState("Could not open capture device."); |
| 141 return; | 140 return; |
| (...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 301 if (![capture_device_ setCaptureHeight:current_settings_.height | 300 if (![capture_device_ setCaptureHeight:current_settings_.height |
| 302 width:current_settings_.width | 301 width:current_settings_.width |
| 303 frameRate:current_settings_.frame_rate]) { | 302 frameRate:current_settings_.frame_rate]) { |
| 304 ReceiveError("Could not configure capture device."); | 303 ReceiveError("Could not configure capture device."); |
| 305 return false; | 304 return false; |
| 306 } | 305 } |
| 307 return true; | 306 return true; |
| 308 } | 307 } |
| 309 | 308 |
| 310 } // namespace media | 309 } // namespace media |
| OLD | NEW |