diff command.c @ 30988:8d840754a921

Add slave commands for loading and unloading audio filters at runtime. Patch by Jehan Hysseo, hysseo zemarmot net
author cehoyos
date Sun, 11 Apr 2010 18:59:19 +0000
parents 2186c040f9e0
children dd7f15a3fb1b
line wrap: on
line diff
--- a/command.c	Sun Apr 11 13:47:13 2010 +0000
+++ b/command.c	Sun Apr 11 18:59:19 2010 +0000
@@ -3242,6 +3242,43 @@
 
 #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))