summaryrefslogtreecommitdiff
path: root/media/devices
diff options
context:
space:
mode:
Diffstat (limited to 'media/devices')
-rw-r--r--media/devices/linuxdevicemanager.cc16
-rw-r--r--media/devices/linuxdevicemanager.h4
-rw-r--r--media/devices/macdevicemanager.cc4
-rw-r--r--media/devices/macdevicemanagermm.mm53
4 files changed, 65 insertions, 12 deletions
diff --git a/media/devices/linuxdevicemanager.cc b/media/devices/linuxdevicemanager.cc
index a79e226..d122169 100644
--- a/media/devices/linuxdevicemanager.cc
+++ b/media/devices/linuxdevicemanager.cc
@@ -31,10 +31,10 @@
#include "talk/media/base/mediacommon.h"
#include "talk/media/devices/libudevsymboltable.h"
#include "talk/media/devices/v4llookup.h"
-#include "talk/sound/platformsoundsystem.h"
-#include "talk/sound/platformsoundsystemfactory.h"
-#include "talk/sound/sounddevicelocator.h"
-#include "talk/sound/soundsysteminterface.h"
+#include "webrtc/sound/platformsoundsystem.h"
+#include "webrtc/sound/platformsoundsystemfactory.h"
+#include "webrtc/sound/sounddevicelocator.h"
+#include "webrtc/sound/soundsysteminterface.h"
#include "webrtc/base/fileutils.h"
#include "webrtc/base/linux.h"
#include "webrtc/base/logging.h"
@@ -89,7 +89,7 @@ static const char* kFilteredVideoDevicesName[] = {
};
LinuxDeviceManager::LinuxDeviceManager()
- : sound_system_(new PlatformSoundSystemFactory()) {
+ : sound_system_(new rtc::PlatformSoundSystemFactory()) {
set_watcher(new LinuxDeviceWatcher(this));
}
@@ -102,7 +102,7 @@ bool LinuxDeviceManager::GetAudioDevices(bool input,
if (!sound_system_.get()) {
return false;
}
- SoundSystemInterface::SoundDeviceLocatorList list;
+ rtc::SoundSystemInterface::SoundDeviceLocatorList list;
bool success;
if (input) {
success = sound_system_->EnumerateCaptureDevices(&list);
@@ -118,12 +118,12 @@ bool LinuxDeviceManager::GetAudioDevices(bool input,
// device at index 0, but Enumerate(Capture|Playback)Devices does not include
// a locator for the default device.
int index = 1;
- for (SoundSystemInterface::SoundDeviceLocatorList::iterator i = list.begin();
+ for (rtc::SoundSystemInterface::SoundDeviceLocatorList::iterator i = list.begin();
i != list.end();
++i, ++index) {
devs->push_back(Device((*i)->name(), index));
}
- SoundSystemInterface::ClearSoundDeviceLocatorList(&list);
+ rtc::SoundSystemInterface::ClearSoundDeviceLocatorList(&list);
sound_system_.release();
return FilterDevices(devs, kFilteredAudioDevicesName);
}
diff --git a/media/devices/linuxdevicemanager.h b/media/devices/linuxdevicemanager.h
index 88aee4e..1eb648f 100644
--- a/media/devices/linuxdevicemanager.h
+++ b/media/devices/linuxdevicemanager.h
@@ -32,7 +32,7 @@
#include <vector>
#include "talk/media/devices/devicemanager.h"
-#include "talk/sound/soundsystemfactory.h"
+#include "webrtc/sound/soundsystemfactory.h"
#include "webrtc/base/sigslot.h"
#include "webrtc/base/stringencode.h"
@@ -47,7 +47,7 @@ class LinuxDeviceManager : public DeviceManager {
private:
virtual bool GetAudioDevices(bool input, std::vector<Device>* devs);
- SoundSystemHandle sound_system_;
+ rtc::SoundSystemHandle sound_system_;
};
} // namespace cricket
diff --git a/media/devices/macdevicemanager.cc b/media/devices/macdevicemanager.cc
index 568ee53..8f777b4 100644
--- a/media/devices/macdevicemanager.cc
+++ b/media/devices/macdevicemanager.cc
@@ -71,7 +71,7 @@ static const UInt32 kAudioDeviceNameLength = 64;
extern DeviceWatcherImpl* CreateDeviceWatcherCallback(
DeviceManagerInterface* dm);
extern void ReleaseDeviceWatcherCallback(DeviceWatcherImpl* impl);
-extern bool GetQTKitVideoDevices(std::vector<Device>* out);
+extern bool GetAVFoundationVideoDevices(std::vector<Device>* out);
static bool GetAudioDeviceIDs(bool inputs, std::vector<AudioDeviceID>* out);
static bool GetAudioDeviceName(AudioDeviceID id, bool input, std::string* out);
@@ -84,7 +84,7 @@ MacDeviceManager::~MacDeviceManager() {
bool MacDeviceManager::GetVideoCaptureDevices(std::vector<Device>* devices) {
devices->clear();
- if (!GetQTKitVideoDevices(devices)) {
+ if (!GetAVFoundationVideoDevices(devices)) {
return false;
}
return FilterDevices(devices, kFilteredVideoDevicesName);
diff --git a/media/devices/macdevicemanagermm.mm b/media/devices/macdevicemanagermm.mm
index 3091ec4..cfcf5a4 100644
--- a/media/devices/macdevicemanagermm.mm
+++ b/media/devices/macdevicemanagermm.mm
@@ -33,6 +33,11 @@
#include "talk/media/devices/devicemanager.h"
#import <assert.h>
+#ifdef __MAC_OS_X_VERSION_MAX_ALLOWED
+#if __MAC_OS_X_VERSION_MAX_ALLOWED >= 1070
+ #import <AVFoundation/AVFoundation.h>
+#endif
+#endif
#import <QTKit/QTKit.h>
#include "webrtc/base/logging.h"
@@ -136,4 +141,52 @@ bool GetQTKitVideoDevices(std::vector<Device>* devices) {
return true;
}
+bool GetAVFoundationVideoDevices(std::vector<Device>* devices) {
+#ifdef __MAC_OS_X_VERSION_MAX_ALLOWED
+#if __MAC_OS_X_VERSION_MAX_ALLOWED >=1070
+ if (![AVCaptureDevice class]) {
+ // Fallback to using QTKit if AVFoundation is not available
+ return GetQTKitVideoDevices(devices);
+ }
+#if !__has_feature(objc_arc)
+ NSAutoreleasePool* pool = [[NSAutoreleasePool alloc] init];
+#else
+ @autoreleasepool
+#endif
+ {
+ NSArray* capture_devices = [AVCaptureDevice devices];
+ LOG(LS_INFO) << [capture_devices count] << " capture device(s) found:";
+ for (AVCaptureDevice* capture_device in capture_devices) {
+ if ([capture_device hasMediaType:AVMediaTypeVideo] ||
+ [capture_device hasMediaType:AVMediaTypeMuxed]) {
+ static NSString* const kFormat = @"localizedName: \"%@\", "
+ @"modelID: \"%@\", uniqueID \"%@\", isConnected: %d, "
+ @"isInUseByAnotherApplication: %d";
+ NSString* info = [NSString
+ stringWithFormat:kFormat,
+ [capture_device localizedName],
+ [capture_device modelID],
+ [capture_device uniqueID],
+ [capture_device isConnected],
+ [capture_device isInUseByAnotherApplication]];
+ LOG(LS_INFO) << [info UTF8String];
+
+ std::string name([[capture_device localizedName] UTF8String]);
+ devices->push_back(
+ Device(name, [[capture_device uniqueID] UTF8String]));
+ }
+ }
+ }
+#if !__has_feature(objc_arc)
+ [pool drain];
+#endif
+ return true;
+#else // __MAC_OS_X_VERSION_MAX_ALLOWED >=1070
+ return GetQTKitVideoDevices(devices);
+#endif // __MAC_OS_X_VERSION_MAX_ALLOWED >=1070
+#else // __MAC_OS_X_VERSION_MAX_ALLOWED
+ return GetQTKitVideoDevices(devices);
+#endif // __MAC_OS_X_VERSION_MAX_ALLOWED
+}
+
} // namespace cricket