From dced2aa81b5b44e9952c7be8834da441f58187e8 Mon Sep 17 00:00:00 2001 From: wm4 Date: Mon, 27 Oct 2014 12:16:32 +0100 Subject: command: add audio-device property Meant for changing the --audio-device at runtime. --- player/command.c | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'player/command.c') diff --git a/player/command.c b/player/command.c index a4ef70082c..b28103a954 100644 --- a/player/command.c +++ b/player/command.c @@ -1466,6 +1466,16 @@ static void reload_audio_output(struct MPContext *mpctx) reinit_audio_chain(mpctx); } +static int mp_property_audio_device(void *ctx, struct m_property *prop, + int action, void *arg) +{ + struct MPContext *mpctx = ctx; + int r = mp_property_generic_option(mpctx, prop, action, arg); + if (action == M_PROPERTY_SET) + reload_audio_output(mpctx); + return r; +} + static int mp_property_audio_devices(void *ctx, struct m_property *prop, int action, void *arg) { @@ -3049,6 +3059,7 @@ static const struct m_property mp_properties[] = { {"aid", mp_property_audio}, {"balance", mp_property_balance}, {"volume-restore-data", mp_property_volrestore}, + {"audio-device", mp_property_audio_device}, {"audio-device-list", mp_property_audio_devices}, // Video -- cgit v1.2.3