summaryrefslogtreecommitdiffstats
path: root/command.c
diff options
context:
space:
mode:
authorcehoyos <cehoyos@b3059339-0415-0410-9bf9-f77b7e298cf2>2010-04-11 18:59:19 +0000
committercehoyos <cehoyos@b3059339-0415-0410-9bf9-f77b7e298cf2>2010-04-11 18:59:19 +0000
commit40ac0d3109c4baeb10a04b503c6e6213c75d7779 (patch)
tree7e13b80aa22a6b8ecb11f616ac48efdcd079f596 /command.c
parente3ed371d519ff0267882632658d9cd94f0dee008 (diff)
downloadmpv-40ac0d3109c4baeb10a04b503c6e6213c75d7779.tar.bz2
mpv-40ac0d3109c4baeb10a04b503c6e6213c75d7779.tar.xz
Add slave commands for loading and unloading audio filters at runtime.
Patch by Jehan Hysseo, hysseo zemarmot net git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@31030 b3059339-0415-0410-9bf9-f77b7e298cf2
Diffstat (limited to 'command.c')
-rw-r--r--command.c37
1 files changed, 37 insertions, 0 deletions
diff --git a/command.c b/command.c
index 76c2e7a767..8095b6b00b 100644
--- a/command.c
+++ b/command.c
@@ -3242,6 +3242,43 @@ int run_command(MPContext * mpctx, mp_cmd_t * cmd)
#endif
+ case MP_CMD_AF_SWITCH:
+ if (sh_audio)
+ {
+ af_uninit(mpctx->mixer.afilter);
+ af_init(mpctx->mixer.afilter);
+ }
+ case MP_CMD_AF_ADD:
+ case MP_CMD_AF_DEL:
+ if (!sh_audio)
+ break;
+ {
+ char* af_args = strdup(cmd->args[0].v.s);
+ char* af_commands = af_args;
+ char* af_command;
+ af_instance_t* af;
+ while ((af_command = strsep(&af_commands, ",")) != NULL)
+ {
+ if (cmd->id == MP_CMD_AF_DEL)
+ {
+ af = af_get(mpctx->mixer.afilter, af_command);
+ if (af != NULL)
+ af_remove(mpctx->mixer.afilter, af);
+ }
+ else
+ af_add(mpctx->mixer.afilter, af_command);
+ }
+ build_afilter_chain(sh_audio, &ao_data);
+ free(af_args);
+ }
+ break;
+ case MP_CMD_AF_CLR:
+ if (!sh_audio)
+ break;
+ af_uninit(mpctx->mixer.afilter);
+ af_init(mpctx->mixer.afilter);
+ build_afilter_chain(sh_audio, &ao_data);
+ break;
default:
#ifdef CONFIG_GUI
if ((use_gui) && (cmd->id > MP_CMD_GUI_EVENTS))