summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2015-06-09 18:14:15 +0200
committerwm4 <wm4@nowhere>2015-06-09 18:25:44 +0200
commit3399b775b7b51ab04a271bef3cae3d43ac0308cc (patch)
treed3eb0f833a2927c053237b39de9d49942f8865d1
parentbd6476307629a9635881dd51de7f671d6e166845 (diff)
downloadmpv-3399b775b7b51ab04a271bef3cae3d43ac0308cc.tar.bz2
mpv-3399b775b7b51ab04a271bef3cae3d43ac0308cc.tar.xz
command: fix audio-out-detected-device property
Used a wrong condition, and I suppose it could crash in some situations. Change it to lazily initialize the hotplug stuff, like the audio-device-list property does.
-rw-r--r--player/command.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/player/command.c b/player/command.c
index 40ecd15916..7adb72902d 100644
--- a/player/command.c
+++ b/player/command.c
@@ -1610,8 +1610,9 @@ static int mp_property_ao_detected_device(void *ctx,struct m_property *prop,
{
struct MPContext *mpctx = ctx;
struct command_ctx *cmd = mpctx->command_ctx;
- if (!mpctx->ao)
- return M_PROPERTY_UNAVAILABLE;
+ if (!cmd->hotplug)
+ cmd->hotplug = ao_hotplug_create(mpctx->global, mpctx->input);
+
const char *d = ao_hotplug_get_detected_device(cmd->hotplug);
return m_property_strdup_ro(action, arg, d);
}