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/capture/video/mac/video_capture_device_factory_mac.h" | 5 #include "media/capture/video/mac/video_capture_device_factory_mac.h" |
6 | 6 |
7 #import <IOKit/audio/IOAudioTypes.h> | 7 #import <IOKit/audio/IOAudioTypes.h> |
8 #include <stddef.h> | 8 #include <stddef.h> |
9 | 9 |
10 #include <utility> | 10 #include <utility> |
11 | 11 |
12 #include "base/bind.h" | 12 #include "base/bind.h" |
13 #include "base/location.h" | 13 #include "base/location.h" |
14 #include "base/macros.h" | 14 #include "base/macros.h" |
15 #include "base/profiler/scoped_tracker.h" | 15 #include "base/profiler/scoped_tracker.h" |
16 #include "base/strings/string_util.h" | 16 #include "base/strings/string_util.h" |
17 #include "base/task_runner_util.h" | 17 #include "base/task_runner_util.h" |
18 #import "media/base/mac/avfoundation_glue.h" | 18 #import "media/base/mac/avfoundation_glue.h" |
19 #import "media/capture/video/mac/video_capture_device_avfoundation_mac.h" | 19 #import "media/capture/video/mac/video_capture_device_avfoundation_mac.h" |
20 #import "media/capture/video/mac/video_capture_device_decklink_mac.h" | 20 #import "media/capture/video/mac/video_capture_device_decklink_mac.h" |
21 #include "media/capture/video/mac/video_capture_device_mac.h" | 21 #include "media/capture/video/mac/video_capture_device_mac.h" |
22 | 22 |
23 namespace media { | 23 namespace media { |
24 | 24 |
25 // Blacklisted devices are identified by a characteristic trailing substring of | 25 // Blacklisted devices are identified by a characteristic trailing substring of |
26 // uniqueId. At the moment these are just Blackmagic devices. | 26 // uniqueId. At the moment these are just Blackmagic devices. |
27 const struct NameAndVid { | 27 const char* kBlacklistedCamerasIdSignature[] = {"-01FDA82C8A9C"}; |
28 const char* unique_id_signature; | |
29 const int capture_width; | |
30 const int capture_height; | |
31 const float capture_frame_rate; | |
32 } kBlacklistedCameras[] = {{"-01FDA82C8A9C", 1280, 720, 60.0f}}; | |
33 | 28 |
34 static bool IsDeviceBlacklisted(const VideoCaptureDevice::Name& name) { | 29 static bool IsDeviceBlacklisted(const VideoCaptureDevice::Name& name) { |
35 bool is_device_blacklisted = false; | 30 bool is_device_blacklisted = false; |
36 for(size_t i = 0; | 31 for (size_t i = 0; |
37 !is_device_blacklisted && i < arraysize(kBlacklistedCameras); ++i) { | 32 !is_device_blacklisted && i < arraysize(kBlacklistedCamerasIdSignature); |
| 33 ++i) { |
38 is_device_blacklisted = | 34 is_device_blacklisted = |
39 base::EndsWith(name.id(), | 35 base::EndsWith(name.id(), kBlacklistedCamerasIdSignature[i], |
40 kBlacklistedCameras[i].unique_id_signature, | |
41 base::CompareCase::INSENSITIVE_ASCII); | 36 base::CompareCase::INSENSITIVE_ASCII); |
42 } | 37 } |
43 DVLOG_IF(2, is_device_blacklisted) << "Blacklisted camera: " << name.name() | 38 DVLOG_IF(2, is_device_blacklisted) << "Blacklisted camera: " << name.name() |
44 << ", id: " << name.id(); | 39 << ", id: " << name.id(); |
45 return is_device_blacklisted; | 40 return is_device_blacklisted; |
46 } | 41 } |
47 | 42 |
48 VideoCaptureDeviceFactoryMac::VideoCaptureDeviceFactoryMac() { | 43 VideoCaptureDeviceFactoryMac::VideoCaptureDeviceFactoryMac() { |
49 thread_checker_.DetachFromThread(); | 44 thread_checker_.DetachFromThread(); |
50 } | 45 } |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
137 } | 132 } |
138 | 133 |
139 // static | 134 // static |
140 VideoCaptureDeviceFactory* | 135 VideoCaptureDeviceFactory* |
141 VideoCaptureDeviceFactory::CreateVideoCaptureDeviceFactory( | 136 VideoCaptureDeviceFactory::CreateVideoCaptureDeviceFactory( |
142 scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner) { | 137 scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner) { |
143 return new VideoCaptureDeviceFactoryMac(); | 138 return new VideoCaptureDeviceFactoryMac(); |
144 } | 139 } |
145 | 140 |
146 } // namespace media | 141 } // namespace media |
OLD | NEW |