| 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 <memory> | |
| 12 | |
| 13 #include "webrtc/base/arraysize.h" | |
| 14 #include "webrtc/media/devices/devicemanager.h" | |
| 15 #include "webrtc/modules/video_capture/video_capture_factory.h" | |
| 16 | |
| 17 namespace cricket { | |
| 18 | |
| 19 class MobileDeviceManager : public DeviceManager { | |
| 20 public: | |
| 21 MobileDeviceManager(); | |
| 22 virtual ~MobileDeviceManager(); | |
| 23 virtual bool GetVideoCaptureDevices(std::vector<Device>* devs); | |
| 24 }; | |
| 25 | |
| 26 MobileDeviceManager::MobileDeviceManager() { | |
| 27 // We don't expect available devices to change on Android/iOS, so use a | |
| 28 // do-nothing watcher. | |
| 29 set_watcher(new DeviceWatcher(this)); | |
| 30 } | |
| 31 | |
| 32 MobileDeviceManager::~MobileDeviceManager() {} | |
| 33 | |
| 34 bool MobileDeviceManager::GetVideoCaptureDevices(std::vector<Device>* devs) { | |
| 35 devs->clear(); | |
| 36 std::unique_ptr<webrtc::VideoCaptureModule::DeviceInfo> info( | |
| 37 webrtc::VideoCaptureFactory::CreateDeviceInfo(0)); | |
| 38 if (!info) | |
| 39 return false; | |
| 40 | |
| 41 uint32_t num_cams = info->NumberOfDevices(); | |
| 42 char id[256]; | |
| 43 char name[256]; | |
| 44 for (uint32_t i = 0; i < num_cams; ++i) { | |
| 45 if (info->GetDeviceName(i, name, arraysize(name), id, arraysize(id))) | |
| 46 continue; | |
| 47 devs->push_back(Device(name, id)); | |
| 48 } | |
| 49 return true; | |
| 50 } | |
| 51 | |
| 52 DeviceManagerInterface* DeviceManagerFactory::Create() { | |
| 53 return new MobileDeviceManager(); | |
| 54 } | |
| 55 | |
| 56 bool GetUsbId(const Device& device, std::string* usb_id) { return false; } | |
| 57 | |
| 58 bool GetUsbVersion(const Device& device, std::string* usb_version) { | |
| 59 return false; | |
| 60 } | |
| 61 | |
| 62 } // namespace cricket | |
| OLD | NEW |