[vlc-devel] [PATCH] lib: add libvlc_audio_output_device_get()
Mark Lee
mark.lee at capricasoftware.co.uk
Mon Jan 26 20:34:20 CET 2015
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().
---
include/vlc/libvlc_media_player.h | 13 +++++++++++++
lib/audio.c | 13 +++++++++++++
lib/libvlc.sym | 1 +
3 files changed, 27 insertions(+)
diff --git a/include/vlc/libvlc_media_player.h b/include/vlc/libvlc_media_player.h
index 1c73cf2..aee56cc 100644
--- a/include/vlc/libvlc_media_player.h
+++ b/include/vlc/libvlc_media_player.h
@@ -1571,6 +1571,19 @@ LIBVLC_API void libvlc_audio_output_device_set( libvlc_media_player_t *mp,
const char *device_id );
/**
+ * Get the current audio output device identifier.
+ *
+ * This is the complement to libvlc_audio_output_device_set().
+ *
+ * \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.
* \return always -1.
*/
diff --git a/lib/audio.c b/lib/audio.c
index c919eb2..6860224 100644
--- a/lib/audio.c
+++ b/lib/audio.c
@@ -277,6 +277,19 @@ void libvlc_audio_output_device_set( libvlc_media_player_t *mp,
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;
+
+ char *devid = aout_DeviceGet( aout );
+
+ vlc_object_release( aout );
+
+ return devid;
+}
+
int libvlc_audio_output_get_device_type( libvlc_media_player_t *mp )
{
(void) mp;
diff --git a/lib/libvlc.sym b/lib/libvlc.sym
index 551e3b2..4fd2378 100644
--- a/lib/libvlc.sym
+++ b/lib/libvlc.sym
@@ -15,6 +15,7 @@ libvlc_audio_equalizer_release
libvlc_audio_equalizer_set_amp_at_index
libvlc_audio_equalizer_set_preamp
libvlc_audio_output_device_count
+libvlc_audio_output_device_get
libvlc_audio_output_device_enum
libvlc_audio_output_device_id
libvlc_audio_output_device_list_get
--
2.1.0
More information about the vlc-devel
mailing list