Merge pull request #1345 from TheMuso/fix-input-output-mac-audio-devices
libobs: Rework code for checking Mac audio device capabilities for mo…
This commit is contained in:
commit
3fd33478f8
@ -25,16 +25,14 @@ static bool obs_enum_audio_monitoring_device(obs_enum_audio_device_cb cb,
|
||||
|
||||
AudioObjectPropertyAddress addr = {
|
||||
kAudioDevicePropertyStreams,
|
||||
kAudioDevicePropertyScopeInput,
|
||||
kAudioDevicePropertyScopeOutput,
|
||||
kAudioObjectPropertyElementMaster
|
||||
};
|
||||
|
||||
/* check to see if it's a mac input device */
|
||||
if (!allow_inputs) {
|
||||
AudioObjectGetPropertyDataSize(id, &addr, 0, NULL, &size);
|
||||
if (size)
|
||||
return true;
|
||||
}
|
||||
/* Check if the device is capable of audio output. */
|
||||
AudioObjectGetPropertyDataSize(id, &addr, 0, NULL, &size);
|
||||
if (!allow_inputs && !size)
|
||||
return true;
|
||||
|
||||
size = sizeof(CFStringRef);
|
||||
|
||||
|
@ -193,14 +193,14 @@ static bool audio_monitor_init(struct audio_monitor *monitor,
|
||||
}
|
||||
|
||||
if (strcmp(uid, "default") != 0) {
|
||||
CFStringRef cf_uid = CFStringCreateWithBytesNoCopy(NULL,
|
||||
CFStringRef cf_uid = CFStringCreateWithBytes(NULL,
|
||||
(const UInt8*)uid, strlen(uid),
|
||||
kCFStringEncodingUTF8,
|
||||
false, NULL);
|
||||
false);
|
||||
|
||||
stat = AudioQueueSetProperty(monitor->queue,
|
||||
kAudioQueueProperty_CurrentDevice,
|
||||
cf_uid, sizeof(cf_uid));
|
||||
&cf_uid, sizeof(cf_uid));
|
||||
CFRelease(cf_uid);
|
||||
|
||||
if (!success(stat, "set current device")) {
|
||||
|
@ -2016,7 +2016,7 @@ bool obs_set_audio_monitoring_device(const char *name, const char *id)
|
||||
if (!obs || !name || !id || !*name || !*id)
|
||||
return false;
|
||||
|
||||
#if defined(_WIN32) || HAVE_PULSEAUDIO
|
||||
#if defined(_WIN32) || HAVE_PULSEAUDIO || defined(__APPLE__)
|
||||
pthread_mutex_lock(&obs->audio.monitoring_mutex);
|
||||
|
||||
if (strcmp(id, obs->audio.monitoring_device_id) == 0) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user