From fb22bf2317d4704895fca407507972031e932298 Mon Sep 17 00:00:00 2001 From: wm4 Date: Mon, 21 May 2018 15:11:19 +0200 Subject: ao: use a local option struct Instead of accessing MPOpts. --- player/command.c | 9 ++++++++- player/main.c | 4 +++- 2 files changed, 11 insertions(+), 2 deletions(-) (limited to 'player') diff --git a/player/command.c b/player/command.c index e836b3ef21..7d52f2425c 100644 --- a/player/command.c +++ b/player/command.c @@ -2008,14 +2008,21 @@ static int mp_property_audio_device(void *ctx, struct m_property *prop, if (action == M_PROPERTY_PRINT) { create_hotplug(mpctx); + char *name = NULL; + if (mp_property_generic_option(mpctx, prop, M_PROPERTY_GET, &name) < 1) + name = NULL; + 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) == 0) { + if (dev->name && name && strcmp(dev->name, name) == 0) { *(char **)arg = talloc_strdup(NULL, dev->desc ? dev->desc : "?"); + talloc_free(name); return M_PROPERTY_OK; } } + + talloc_free(name); } return mp_property_generic_option(mpctx, prop, action, arg); } diff --git a/player/main.c b/player/main.c index ec5cdd69b1..5870574844 100644 --- a/player/main.c +++ b/player/main.c @@ -222,7 +222,9 @@ static bool handle_help_options(struct MPContext *mpctx) MP_INFO(mpctx, "\n"); return true; } - if (opts->audio_device && strcmp(opts->audio_device, "help") == 0) { + if (opts->ao_opts->audio_device && + strcmp(opts->ao_opts->audio_device, "help") == 0) + { ao_print_devices(mpctx->global, log); return true; } -- cgit v1.2.3