Commit a60b897e authored by Mark Lee's avatar Mark Lee Committed by Jean-Baptiste Kempf

lib: add libvlc_audio_output_device_get()

This function gets the active device identifier for the current
audio output, if there is one, and is the complementary function
to libvlc_audio_output_device_set().
Signed-off-by: default avatarJean-Baptiste Kempf <jb@videolan.org>
parent a4dfd656
...@@ -87,6 +87,8 @@ libVLC: ...@@ -87,6 +87,8 @@ libVLC:
* Add libvlc_media_get_codec_description to get a human readable description of a codec * Add libvlc_media_get_codec_description to get a human readable description of a codec
* Add libvlc_MediaListEndReached Event to get notified when a media list reached the end * Add libvlc_MediaListEndReached Event to get notified when a media list reached the end
* Add libvlc_media_parse_with_options that uses a flag to specify parse options * Add libvlc_media_parse_with_options that uses a flag to specify parse options
* Add libvlc_audio_output_device_get to get the currently selected audio output device
identifier (if there is one available)
Changes between 2.1.x and 2.2.0: Changes between 2.1.x and 2.2.0:
......
...@@ -1570,6 +1570,30 @@ LIBVLC_API void libvlc_audio_output_device_set( libvlc_media_player_t *mp, ...@@ -1570,6 +1570,30 @@ LIBVLC_API void libvlc_audio_output_device_set( libvlc_media_player_t *mp,
const char *module, const char *module,
const char *device_id ); const char *device_id );
/**
* Get the current audio output device identifier.
*
* This complements libvlc_audio_output_device_set().
*
* \warning The initial value for the current audio output device identifier
* may not be set or may be some unknown value. A LibVLC application should
* compare this value against the known device identifiers (e.g. those that
* were previously retrieved by a call to libvlc_audio_output_device_enum or
* libvlc_audio_output_device_list_get) to find the current audio output device.
*
* It is possible that the selected audio output device changes (an external
* change) without a call to libvlc_audio_output_device_set. That may make this
* method unsuitable to use if a LibVLC application is attempting to track
* dynamic audio device changes as they happen.
*
* \param mp media player
* \return the current audio output device identifier
* NULL if no device is selected or in case of error
* (the result must be released with free() or libvlc_free()).
* \version LibVLC 3.0.0 or later.
*/
LIBVLC_API char *libvlc_audio_output_device_get( libvlc_media_player_t *mp );
/** /**
* Stub for backward compatibility. * Stub for backward compatibility.
* \return always -1. * \return always -1.
......
...@@ -277,6 +277,19 @@ void libvlc_audio_output_device_set( libvlc_media_player_t *mp, ...@@ -277,6 +277,19 @@ void libvlc_audio_output_device_set( libvlc_media_player_t *mp,
vlc_object_release( aout ); vlc_object_release( aout );
} }
char *libvlc_audio_output_device_get( libvlc_media_player_t *mp )
{
audio_output_t *aout = GetAOut( mp );
if( aout == NULL )
return NULL;
char *devid = aout_DeviceGet( aout );
vlc_object_release( aout );
return devid;
}
int libvlc_audio_output_get_device_type( libvlc_media_player_t *mp ) int libvlc_audio_output_get_device_type( libvlc_media_player_t *mp )
{ {
(void) mp; (void) mp;
......
...@@ -15,6 +15,7 @@ libvlc_audio_equalizer_release ...@@ -15,6 +15,7 @@ libvlc_audio_equalizer_release
libvlc_audio_equalizer_set_amp_at_index libvlc_audio_equalizer_set_amp_at_index
libvlc_audio_equalizer_set_preamp libvlc_audio_equalizer_set_preamp
libvlc_audio_output_device_count libvlc_audio_output_device_count
libvlc_audio_output_device_get
libvlc_audio_output_device_enum libvlc_audio_output_device_enum
libvlc_audio_output_device_id libvlc_audio_output_device_id
libvlc_audio_output_device_list_get libvlc_audio_output_device_list_get
......
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