diff options
author | cehoyos <cehoyos@b3059339-0415-0410-9bf9-f77b7e298cf2> | 2010-04-11 18:59:19 +0000 |
---|---|---|
committer | cehoyos <cehoyos@b3059339-0415-0410-9bf9-f77b7e298cf2> | 2010-04-11 18:59:19 +0000 |
commit | 40ac0d3109c4baeb10a04b503c6e6213c75d7779 (patch) | |
tree | 7e13b80aa22a6b8ecb11f616ac48efdcd079f596 /command.c | |
parent | e3ed371d519ff0267882632658d9cd94f0dee008 (diff) | |
download | mpv-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.c | 37 |
1 files changed, 37 insertions, 0 deletions
@@ -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)) |