[vlc-commits] aout: external functions for devices selection

Rémi Denis-Courmont git at videolan.org
Sun Dec 16 10:52:29 CET 2012


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Sun Dec 16 11:46:18 2012 +0200| [a249b33b589655d71b9a0d6d9d0b0d9c1b5b4466] | committer: Rémi Denis-Courmont

aout: external functions for devices selection

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=a249b33b589655d71b9a0d6d9d0b0d9c1b5b4466
---

 include/vlc_aout.h        |    3 +++
 src/audio_output/output.c |   49 +++++++++++++++++++++++++++++++++++++++++++++
 src/libvlccore.sym        |    3 +++
 3 files changed, 55 insertions(+)

diff --git a/include/vlc_aout.h b/include/vlc_aout.h
index ed118b3..d6ea8be 100644
--- a/include/vlc_aout.h
+++ b/include/vlc_aout.h
@@ -277,6 +277,9 @@ VLC_API float aout_VolumeGet (audio_output_t *);
 VLC_API int aout_VolumeSet (audio_output_t *, float);
 VLC_API int aout_MuteGet (audio_output_t *);
 VLC_API int aout_MuteSet (audio_output_t *, bool);
+VLC_API char *aout_DeviceGet (audio_output_t *);
+VLC_API int aout_DeviceSet (audio_output_t *, const char *);
+VLC_API int aout_DevicesList (audio_output_t *, char ***, char ***);
 
 /**
  * Report change of configured audio volume to the core and UI.
diff --git a/src/audio_output/output.c b/src/audio_output/output.c
index cf104d1..2f0c99c 100644
--- a/src/audio_output/output.c
+++ b/src/audio_output/output.c
@@ -362,6 +362,55 @@ int aout_MuteSet (audio_output_t *aout, bool mute)
 }
 
 /**
+ * Gets the currently selected device.
+ * \return the selected device ID (caller must free() it)
+ *         NULL if no device is selected or in case of error.
+ */
+char *aout_DeviceGet (audio_output_t *aout)
+{
+    return var_GetNonEmptyString (aout, "device");
+}
+
+/**
+ * Selects an audio output device.
+ * \param id device ID to select, or NULL for the default device
+ * \return zero on success, non-zero on error.
+ */
+int aout_DeviceSet (audio_output_t *aout, const char *id)
+{
+    int ret = -1;
+
+    aout_lock (aout);
+    if (aout->device_select != NULL)
+        ret = aout->device_select (aout, id);
+    aout_unlock (aout);
+    return ret;
+}
+
+/**
+ * Enumerates possible audio output devices.
+ *
+ * The function will heap-allocate two tables of heap-allocated strings;
+ * the caller is responsible for freeing all strings and both tables.
+ *
+ * \param ids pointer to a table of device identifiers [OUT]
+ * \param names pointer to a table of device human-readable descriptions [OUT]
+ * \return the number of devices, or negative on error.
+ * \note In case of error, *ids and *names are undefined.
+ */
+int aout_DevicesList (audio_output_t *aout, char ***ids, char ***names)
+{
+    int ret = -1;
+
+    aout_lock (aout);
+    if (aout->device_enum != NULL)
+        ret = aout->device_enum (aout, ids, names);
+    aout_unlock (aout);
+    return ret;
+}
+
+
+/**
  * Starts an audio output stream.
  * \param fmt audio output stream format [IN/OUT]
  * \warning The caller must hold the audio output lock.
diff --git a/src/libvlccore.sym b/src/libvlccore.sym
index 346dad1..b4c03a6 100644
--- a/src/libvlccore.sym
+++ b/src/libvlccore.sym
@@ -14,6 +14,9 @@ aout_VolumeGet
 aout_VolumeSet
 aout_MuteSet
 aout_MuteGet
+aout_DeviceGet
+aout_DeviceSet
+aout_DevicesList
 block_Alloc
 block_FifoCount
 block_FifoEmpty



More information about the vlc-commits mailing list