Commit a249b33b authored by Rémi Denis-Courmont's avatar Rémi Denis-Courmont

aout: external functions for devices selection

parent b2b4c52a
......@@ -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.
......
......@@ -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]
......
......@@ -14,6 +14,9 @@ aout_VolumeGet
aout_VolumeSet
aout_MuteSet
aout_MuteGet
aout_DeviceGet
aout_DeviceSet
aout_DevicesList
block_Alloc
block_FifoCount
block_FifoEmpty
......
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