summaryrefslogtreecommitdiffstats
path: root/player/command.c
diff options
context:
space:
mode:
Diffstat (limited to 'player/command.c')
-rw-r--r--player/command.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/player/command.c b/player/command.c
index 43da75e156..484b8d7aad 100644
--- a/player/command.c
+++ b/player/command.c
@@ -1549,6 +1549,19 @@ static int mp_property_audio_device(void *ctx, struct m_property *prop,
int action, void *arg)
{
struct MPContext *mpctx = ctx;
+ struct command_ctx *cmd = mpctx->command_ctx;
+ if (action == M_PROPERTY_PRINT) {
+ if (!cmd->hotplug)
+ cmd->hotplug = ao_hotplug_create(mpctx->global, mpctx->input);
+ struct ao_device_list *list = ao_hotplug_get_device_list(cmd->hotplug);
+ for (int n = 0; n < list->num_devices; n++) {
+ struct ao_device_desc *dev = &list->devices[n];
+ if (dev->name && strcmp(dev->name, mpctx->opts->audio_device)) {
+ *(char **)arg = talloc_strdup(NULL, dev->desc ? dev->desc : "?");
+ return M_PROPERTY_OK;
+ }
+ }
+ }
int r = mp_property_generic_option(mpctx, prop, action, arg);
if (action == M_PROPERTY_SET)
reload_audio_output(mpctx);
@@ -3714,6 +3727,7 @@ static const struct property_osd_display {
{ "tv-contrast", "Contrast", .osd_progbar = OSD_CONTRAST },
{ "ab-loop-a", "A-B loop point A"},
{ "ab-loop-b", "A-B loop point B"},
+ { "audio-device", "Audio device"},
// By default, don't display the following properties on OSD
{ "pause", NULL },
{ "fullscreen", NULL },