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