summaryrefslogtreecommitdiffstats
path: root/player
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2018-05-21 15:11:19 +0200
committerwm4 <wm4@nowhere>2018-05-24 19:56:35 +0200
commitfb22bf2317d4704895fca407507972031e932298 (patch)
tree8f7432be5ab95b0ea43d6be6b3d4c2866d72d014 /player
parent160e5c8377840ddc5cb80ab28a897c46f46851d2 (diff)
downloadmpv-fb22bf2317d4704895fca407507972031e932298.tar.bz2
mpv-fb22bf2317d4704895fca407507972031e932298.tar.xz
ao: use a local option struct
Instead of accessing MPOpts.
Diffstat (limited to 'player')
-rw-r--r--player/command.c9
-rw-r--r--player/main.c4
2 files changed, 11 insertions, 2 deletions
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;
}