]> git.sesse.net Git - vlc/commitdiff
aout: external functions for devices selection
authorRémi Denis-Courmont <remi@remlab.net>
Sun, 16 Dec 2012 09:46:18 +0000 (11:46 +0200)
committerRémi Denis-Courmont <remi@remlab.net>
Sun, 16 Dec 2012 09:46:18 +0000 (11:46 +0200)
include/vlc_aout.h
src/audio_output/output.c
src/libvlccore.sym

index ed118b35e648a417d8a1fe8b940a85c0f13687d2..d6ea8be631282f7ba59852e18dbda2065d50a3fa 100644 (file)
@@ -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.
index cf104d160faf92bd687d028811339ef8e21bbef9..2f0c99cf755a82e4e5b8cd49887671cdfa0b903a 100644 (file)
@@ -361,6 +361,55 @@ int aout_MuteSet (audio_output_t *aout, bool mute)
     return ret;
 }
 
+/**
+ * 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]
index 346dad14ec9b98a75ca752f7d8fab375c07ef621..b4c03a6028cc0d6d1eb2dc893a2ec29cec688c9e 100644 (file)
@@ -14,6 +14,9 @@ aout_VolumeGet
 aout_VolumeSet
 aout_MuteSet
 aout_MuteGet
+aout_DeviceGet
+aout_DeviceSet
+aout_DevicesList
 block_Alloc
 block_FifoCount
 block_FifoEmpty