| 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 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/location.h" | 8 #include "base/location.h" |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/message_loop/message_loop_proxy.h" | 10 #include "base/message_loop/message_loop_proxy.h" |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 80 std::string device_vid; | 80 std::string device_vid; |
| 81 // Enumerate all devices found by AVFoundation, translate the info for each | 81 // Enumerate all devices found by AVFoundation, translate the info for each |
| 82 // to class Name and add it to |device_names|. | 82 // to class Name and add it to |device_names|. |
| 83 for (NSString* key in capture_devices) { | 83 for (NSString* key in capture_devices) { |
| 84 Name name([[capture_devices valueForKey:key] UTF8String], | 84 Name name([[capture_devices valueForKey:key] UTF8String], |
| 85 [key UTF8String], Name::AVFOUNDATION); | 85 [key UTF8String], Name::AVFOUNDATION); |
| 86 device_names->push_back(name); | 86 device_names->push_back(name); |
| 87 // Extract the device's Vendor ID and compare to all blacklisted ones. | 87 // Extract the device's Vendor ID and compare to all blacklisted ones. |
| 88 device_vid = name.GetModel().substr(0, kVidPidSize); | 88 device_vid = name.GetModel().substr(0, kVidPidSize); |
| 89 for (size_t i = 0; i < arraysize(kBlacklistedCameras); ++i) { | 89 for (size_t i = 0; i < arraysize(kBlacklistedCameras); ++i) { |
| 90 is_any_device_blacklisted |= (device_vid == kBlacklistedCameras[i].vid); | 90 is_any_device_blacklisted |= |
| 91 !strcasecmp(device_vid.c_str(), kBlacklistedCameras[i].vid); |
| 91 if (is_any_device_blacklisted) | 92 if (is_any_device_blacklisted) |
| 92 break; | 93 break; |
| 93 } | 94 } |
| 94 } | 95 } |
| 95 // If there is any device blacklisted in the system, walk the QTKit device | 96 // If there is any device blacklisted in the system, walk the QTKit device |
| 96 // list and add those devices with a blacklisted name to the |device_names|. | 97 // list and add those devices with a blacklisted name to the |device_names|. |
| 97 // AVFoundation and QTKit device lists partially overlap, so add a "QTKit" | 98 // AVFoundation and QTKit device lists partially overlap, so add a "QTKit" |
| 98 // prefix to the latter ones to distinguish them from the AVFoundation ones. | 99 // prefix to the latter ones to distinguish them from the AVFoundation ones. |
| 99 if (is_any_device_blacklisted) { | 100 if (is_any_device_blacklisted) { |
| 100 capture_devices = [VideoCaptureDeviceQTKit deviceNames]; | 101 capture_devices = [VideoCaptureDeviceQTKit deviceNames]; |
| (...skipping 274 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 375 if (![capture_device_ setCaptureHeight:capture_format_.frame_size.height() | 376 if (![capture_device_ setCaptureHeight:capture_format_.frame_size.height() |
| 376 width:capture_format_.frame_size.width() | 377 width:capture_format_.frame_size.width() |
| 377 frameRate:capture_format_.frame_rate]) { | 378 frameRate:capture_format_.frame_rate]) { |
| 378 ReceiveError("Could not configure capture device."); | 379 ReceiveError("Could not configure capture device."); |
| 379 return false; | 380 return false; |
| 380 } | 381 } |
| 381 return true; | 382 return true; |
| 382 } | 383 } |
| 383 | 384 |
| 384 } // namespace media | 385 } // namespace media |
| OLD | NEW |