Commit e553d8c4 authored by Felix Paul Kühne's avatar Felix Paul Kühne Committed by David Fuhrmann

auhal: use kAudioObjectPropertyName instead of kAudioDevicePropertyDeviceName...

auhal: use kAudioObjectPropertyName instead of kAudioDevicePropertyDeviceName to retrieve the (potentially localized) device name

This is the endorsed API and behaves correctly with regard to string lengths
(cherry picked from commit 14250ccc4fab3f18b0270465e2d3a4fe78c0ebfb)
(cherry picked from commit dd4d8155806afb07d6095924030b8c78e85fca61)

Conflicts:
	configure.ac
	modules/audio_output/auhal.c
Signed-off-by: default avatarDavid Fuhrmann <david.fuhrmann@googlemail.com>
parent 5c205a30
......@@ -3550,7 +3550,7 @@ if test "x${enable_macosx_audio}" != "xno" &&
then
AC_CHECK_HEADERS(CoreAudio/CoreAudio.h,
[ VLC_ADD_PLUGIN([auhal])
VLC_ADD_LIBS([auhal],[-Wl,-framework,CoreAudio,-framework,AudioUnit,-framework,AudioToolbox,-framework,Carbon])
VLC_ADD_LIBS([auhal],[-Wl,-framework,CoreAudio,-framework,AudioUnit,-framework,AudioToolbox,-framework,Carbon,-framework,CoreServices])
], [ AC_MSG_ERROR([cannot find CoreAudio headers]) ])
fi
......
......@@ -1005,21 +1005,30 @@ static void Probe( audio_output_t * p_aout )
text.psz_string = (char*)_("Audio Device");
var_Change( p_aout, "audio-device", VLC_VAR_SETTEXT, &text, NULL );
AudioObjectPropertyAddress deviceNameAddress = { kAudioDevicePropertyDeviceName, kAudioDevicePropertyScopeOutput, kAudioObjectPropertyElementMaster };
AudioObjectPropertyAddress deviceNameAddress = { kAudioObjectPropertyName, kAudioObjectPropertyScopeGlobal, kAudioObjectPropertyElementMaster };
for( unsigned int i = 0; i < p_sys->i_devices; i++ )
{
CFStringRef device_name_ref;
char *psz_name;
i_param_size = 0;
CFIndex length;
/* Retrieve the length of the device name */
err = AudioObjectGetPropertyDataSize( p_devices[i], &deviceNameAddress, 0, NULL, &i_param_size );
if( err ) goto error;
if (err != noErr) {
goto error;
}
/* Retrieve the name of the device */
psz_name = (char *)malloc( i_param_size );
err = AudioObjectGetPropertyData( p_devices[i], &deviceNameAddress, 0, NULL, &i_param_size, psz_name );
if( err ) goto error;
err = AudioObjectGetPropertyData( p_devices[i], &deviceNameAddress, 0, NULL, &i_param_size, &device_name_ref );
if (err != noErr) {
goto error;
}
length = CFStringGetLength(device_name_ref);
length++;
psz_name = (char *)malloc(length);
CFStringGetCString(device_name_ref, psz_name, length, kCFStringEncodingUTF8);
msg_Dbg( p_aout, "DevID: %u DevName: %s", (unsigned)p_devices[i], psz_name );
......@@ -1060,7 +1069,8 @@ static void Probe( audio_output_t * p_aout )
}
}
free( psz_name);
CFRelease(device_name_ref);
free(psz_name);
}
/* If a device is already "preselected", then use this device */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment