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/video/capture/mac/video_capture_device_factory_mac.h" | 5 #include "media/video/capture/mac/video_capture_device_factory_mac.h" |
6 | 6 |
7 #import "media/video/capture/mac/avfoundation_glue.h" | 7 #import "media/video/capture/mac/avfoundation_glue.h" |
8 #include "media/video/capture/mac/video_capture_device_mac.h" | 8 #include "media/video/capture/mac/video_capture_device_mac.h" |
9 #import "media/video/capture/mac/video_capture_device_avfoundation_mac.h" | 9 #import "media/video/capture/mac/video_capture_device_avfoundation_mac.h" |
10 #import "media/video/capture/mac/video_capture_device_qtkit_mac.h" | 10 #import "media/video/capture/mac/video_capture_device_qtkit_mac.h" |
11 | 11 |
12 namespace media { | 12 namespace media { |
13 | 13 |
14 // Some devices are not correctly supported in AVFoundation, f.i. Blackmagic, | 14 // Some devices are not correctly supported in AVFoundation, f.i. Blackmagic, |
15 // see http://crbug.com/347371. The devices are identified by USB Vendor ID and | 15 // see http://crbug.com/347371. The devices are identified by USB Vendor ID and |
16 // by a characteristic substring of the name, usually the vendor's name. | 16 // by a characteristic substring of the name, usually the vendor's name. |
17 const struct NameAndVid { | 17 const struct NameAndVid { |
18 const char* vid; | 18 const char* vid; |
19 const char* name; | 19 const char* name; |
20 } kBlacklistedCameras[] = { { "a82c", "Blackmagic" } }; | 20 } kBlacklistedCameras[] = { { "a82c", "Blackmagic" } }; |
21 | 21 |
22 // In device identifiers, the USB VID and PID are stored in 4 bytes each. | 22 // In device identifiers, the USB VID and PID are stored in 4 bytes each. |
23 const size_t kVidPidSize = 4; | 23 const size_t kVidPidSize = 4; |
24 | 24 |
25 VideoCaptureDeviceFactoryMac::VideoCaptureDeviceFactoryMac() { | 25 VideoCaptureDeviceFactoryMac::VideoCaptureDeviceFactoryMac() { |
26 thread_checker_.DetachFromThread(); | 26 thread_checker_.DetachFromThread(); |
27 } | 27 } |
28 | 28 |
29 scoped_ptr<VideoCaptureDevice> VideoCaptureDeviceFactoryMac::Create( | 29 scoped_ptr<VideoCaptureDevice> VideoCaptureDeviceFactoryMac::Create( |
| 30 scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner, |
30 const VideoCaptureDevice::Name& device_name) { | 31 const VideoCaptureDevice::Name& device_name) { |
31 DCHECK(thread_checker_.CalledOnValidThread()); | 32 DCHECK(thread_checker_.CalledOnValidThread()); |
32 DCHECK_NE(device_name.capture_api_type(), | 33 DCHECK_NE(device_name.capture_api_type(), |
33 VideoCaptureDevice::Name::API_TYPE_UNKNOWN); | 34 VideoCaptureDevice::Name::API_TYPE_UNKNOWN); |
34 | 35 |
35 VideoCaptureDevice::Names device_names; | 36 VideoCaptureDevice::Names device_names; |
36 GetDeviceNames(&device_names); | 37 GetDeviceNames(&device_names); |
37 VideoCaptureDevice::Names::iterator it = device_names.begin(); | 38 VideoCaptureDevice::Names::iterator it = device_names.begin(); |
38 for (; it != device_names.end(); ++it) { | 39 for (; it != device_names.end(); ++it) { |
39 if (it->id() == device_name.id()) | 40 if (it->id() == device_name.id()) |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
116 if (device.capture_api_type() == VideoCaptureDevice::Name::AVFOUNDATION) { | 117 if (device.capture_api_type() == VideoCaptureDevice::Name::AVFOUNDATION) { |
117 DVLOG(1) << "Enumerating video capture capabilities, AVFoundation"; | 118 DVLOG(1) << "Enumerating video capture capabilities, AVFoundation"; |
118 [VideoCaptureDeviceAVFoundation getDevice:device | 119 [VideoCaptureDeviceAVFoundation getDevice:device |
119 supportedFormats:supported_formats]; | 120 supportedFormats:supported_formats]; |
120 } else { | 121 } else { |
121 NOTIMPLEMENTED(); | 122 NOTIMPLEMENTED(); |
122 } | 123 } |
123 } | 124 } |
124 | 125 |
125 } // namespace media | 126 } // namespace media |
OLD | NEW |