Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(546)

Unified Diff: webrtc/media/devices/mobiledevicemanager.cc

Issue 1587193006: Move talk/media to webrtc/media (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Disable sign-compare warning on Win Clang Created 4 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: webrtc/media/devices/mobiledevicemanager.cc
diff --git a/webrtc/media/devices/mobiledevicemanager.cc b/webrtc/media/devices/mobiledevicemanager.cc
new file mode 100644
index 0000000000000000000000000000000000000000..ec3981e607cfb26a2b5abef7dde12c2f7efadef9
--- /dev/null
+++ b/webrtc/media/devices/mobiledevicemanager.cc
@@ -0,0 +1,60 @@
+/*
+ * Copyright 2013 The WebRTC Project Authors. All rights reserved.
+ *
+ * Use of this source code is governed by a BSD-style license
+ * that can be found in the LICENSE file in the root of the source
+ * tree. An additional intellectual property rights grant can be found
+ * in the file PATENTS. All contributing project authors may
+ * be found in the AUTHORS file in the root of the source tree.
+ */
+
+#include "webrtc/base/arraysize.h"
+#include "webrtc/media/devices/devicemanager.h"
+#include "webrtc/modules/video_capture/video_capture_factory.h"
+
+namespace cricket {
+
+class MobileDeviceManager : public DeviceManager {
+ public:
+ MobileDeviceManager();
+ virtual ~MobileDeviceManager();
+ virtual bool GetVideoCaptureDevices(std::vector<Device>* devs);
+};
+
+MobileDeviceManager::MobileDeviceManager() {
+ // We don't expect available devices to change on Android/iOS, so use a
+ // do-nothing watcher.
+ set_watcher(new DeviceWatcher(this));
+}
+
+MobileDeviceManager::~MobileDeviceManager() {}
+
+bool MobileDeviceManager::GetVideoCaptureDevices(std::vector<Device>* devs) {
+ devs->clear();
+ rtc::scoped_ptr<webrtc::VideoCaptureModule::DeviceInfo> info(
+ webrtc::VideoCaptureFactory::CreateDeviceInfo(0));
+ if (!info)
+ return false;
+
+ uint32_t num_cams = info->NumberOfDevices();
+ char id[256];
+ char name[256];
+ for (uint32_t i = 0; i < num_cams; ++i) {
+ if (info->GetDeviceName(i, name, arraysize(name), id, arraysize(id)))
+ continue;
+ devs->push_back(Device(name, id));
+ }
+ return true;
+}
+
+DeviceManagerInterface* DeviceManagerFactory::Create() {
+ return new MobileDeviceManager();
+}
+
+bool GetUsbId(const Device& device, std::string* usb_id) { return false; }
+
+bool GetUsbVersion(const Device& device, std::string* usb_version) {
+ return false;
+}
+
+} // namespace cricket

Powered by Google App Engine
This is Rietveld 408576698