OLD | NEW |
| (Empty) |
1 /* | |
2 * Copyright (c) 2013 The WebRTC project authors. All Rights Reserved. | |
3 * | |
4 * Use of this source code is governed by a BSD-style license | |
5 * that can be found in the LICENSE file in the root of the source | |
6 * tree. An additional intellectual property rights grant can be found | |
7 * in the file PATENTS. All contributing project authors may | |
8 * be found in the AUTHORS file in the root of the source tree. | |
9 */ | |
10 | |
11 #include "webrtc/base/arraysize.h" | |
12 #include "webrtc/media/devices/devicemanager.h" | |
13 #include "webrtc/modules/video_capture/video_capture_factory.h" | |
14 | |
15 namespace cricket { | |
16 | |
17 class MobileDeviceManager : public DeviceManager { | |
18 public: | |
19 MobileDeviceManager(); | |
20 virtual ~MobileDeviceManager(); | |
21 virtual bool GetVideoCaptureDevices(std::vector<Device>* devs); | |
22 }; | |
23 | |
24 MobileDeviceManager::MobileDeviceManager() { | |
25 // We don't expect available devices to change on Android/iOS, so use a | |
26 // do-nothing watcher. | |
27 set_watcher(new DeviceWatcher(this)); | |
28 } | |
29 | |
30 MobileDeviceManager::~MobileDeviceManager() {} | |
31 | |
32 bool MobileDeviceManager::GetVideoCaptureDevices(std::vector<Device>* devs) { | |
33 devs->clear(); | |
34 rtc::scoped_ptr<webrtc::VideoCaptureModule::DeviceInfo> info( | |
35 webrtc::VideoCaptureFactory::CreateDeviceInfo(0)); | |
36 if (!info) | |
37 return false; | |
38 | |
39 uint32_t num_cams = info->NumberOfDevices(); | |
40 char id[256]; | |
41 char name[256]; | |
42 for (uint32_t i = 0; i < num_cams; ++i) { | |
43 if (info->GetDeviceName(i, name, arraysize(name), id, arraysize(id))) | |
44 continue; | |
45 devs->push_back(Device(name, id)); | |
46 } | |
47 return true; | |
48 } | |
49 | |
50 DeviceManagerInterface* DeviceManagerFactory::Create() { | |
51 return new MobileDeviceManager(); | |
52 } | |
53 | |
54 bool GetUsbId(const Device& device, std::string* usb_id) { return false; } | |
55 | |
56 bool GetUsbVersion(const Device& device, std::string* usb_version) { | |
57 return false; | |
58 } | |
59 | |
60 } // namespace cricket | |
OLD | NEW |