| 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 <IOKit/audio/IOAudioTypes.h> | 7 #import <IOKit/audio/IOAudioTypes.h> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/location.h" | 10 #include "base/location.h" |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 91 | 91 |
| 92 VideoCaptureDevice::Names::iterator it = device_names->begin(); | 92 VideoCaptureDevice::Names::iterator it = device_names->begin(); |
| 93 for (; it != device_names->end(); ++it) { | 93 for (; it != device_names->end(); ++it) { |
| 94 if (it->id() == device_name.id()) | 94 if (it->id() == device_name.id()) |
| 95 break; | 95 break; |
| 96 } | 96 } |
| 97 if (it == device_names->end()) | 97 if (it == device_names->end()) |
| 98 return scoped_ptr<VideoCaptureDevice>(); | 98 return scoped_ptr<VideoCaptureDevice>(); |
| 99 } | 99 } |
| 100 | 100 |
| 101 scoped_ptr<VideoCaptureDeviceMac> capture_device( | 101 scoped_ptr<VideoCaptureDevice> capture_device; |
| 102 new VideoCaptureDeviceMac(device_name)); | 102 if (device_name.capture_api_type() == VideoCaptureDevice::Name::DECKLINK) { |
| 103 if (!capture_device->Init(device_name.capture_api_type())) { | 103 capture_device.reset(new VideoCaptureDeviceDeckLinkMac(device_name)); |
| 104 LOG(ERROR) << "Could not initialize VideoCaptureDevice."; | 104 } else { |
| 105 capture_device.reset(); | 105 VideoCaptureDeviceMac* device = new VideoCaptureDeviceMac(device_name); |
| 106 capture_device.reset(device); |
| 107 if (device->Init(device_name.capture_api_type())) { |
| 108 LOG(ERROR) << "Could not initialize VideoCaptureDevice."; |
| 109 capture_device.reset(); |
| 110 } |
| 106 } | 111 } |
| 107 return scoped_ptr<VideoCaptureDevice>(capture_device.Pass()); | 112 return scoped_ptr<VideoCaptureDevice>(capture_device.Pass()); |
| 108 } | 113 } |
| 109 | 114 |
| 110 void VideoCaptureDeviceFactoryMac::GetDeviceNames( | 115 void VideoCaptureDeviceFactoryMac::GetDeviceNames( |
| 111 VideoCaptureDevice::Names* device_names) { | 116 VideoCaptureDevice::Names* device_names) { |
| 112 DCHECK(thread_checker_.CalledOnValidThread()); | 117 DCHECK(thread_checker_.CalledOnValidThread()); |
| 113 // Loop through all available devices and add to |device_names|. | 118 // Loop through all available devices and add to |device_names|. |
| 114 NSDictionary* capture_devices; | 119 NSDictionary* capture_devices; |
| 115 if (AVFoundationGlue::IsAVFoundationSupported()) { | 120 if (AVFoundationGlue::IsAVFoundationSupported()) { |
| (...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 214 DVLOG(1) << "Enumerating video capture capabilities, Blackmagic"; | 219 DVLOG(1) << "Enumerating video capture capabilities, Blackmagic"; |
| 215 VideoCaptureDeviceDeckLinkMac::EnumerateDeviceCapabilities( | 220 VideoCaptureDeviceDeckLinkMac::EnumerateDeviceCapabilities( |
| 216 device, supported_formats); | 221 device, supported_formats); |
| 217 break; | 222 break; |
| 218 default: | 223 default: |
| 219 NOTREACHED(); | 224 NOTREACHED(); |
| 220 } | 225 } |
| 221 } | 226 } |
| 222 | 227 |
| 223 } // namespace media | 228 } // namespace media |
| OLD | NEW |