changeset 32419:8f35fc25523f

Add experimental af_cmdline slave command to allow changing filter options at runtime. Patch by Adrian Stutz [adrian sttz ch]
author reimar
date Sun, 17 Oct 2010 15:54:55 +0000
parents 71a04d45357c
children feaa8f78ed3c
files DOCS/tech/slave.txt command.c input/input.c input/input.h
diffstat 4 files changed, 18 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/DOCS/tech/slave.txt	Sun Oct 17 15:52:18 2010 +0000
+++ b/DOCS/tech/slave.txt	Sun Oct 17 15:54:55 2010 +0000
@@ -53,6 +53,9 @@
 af_clr
     (experimental) Unload all loaded audio filters.
 
+af_cmdline <filter_name> <filter_arguments>
+    (experimental) Send new command-line options to a filter with the given name.
+
 af_del <filter_name_list> (comma separated list of audio filter's names)
     (experimental) Unload the first occurrence of the filters, if loaded.
 
--- a/command.c	Sun Oct 17 15:52:18 2010 +0000
+++ b/command.c	Sun Oct 17 15:54:55 2010 +0000
@@ -3432,6 +3432,19 @@
         af_init(mpctx->mixer.afilter);
         build_afilter_chain(sh_audio, &ao_data);
         break;
+    case MP_CMD_AF_CMDLINE:
+        if (sh_audio) {
+            af_instance_t *af = af_get(sh_audio->afilter, cmd->args[0].v.s);
+            if (!af) {
+                mp_msg(MSGT_CPLAYER, MSGL_WARN,
+                       "Filter '%s' not found in chain.\n", cmd->args[0].v.s);
+                break;
+            }
+            af->control(af, AF_CONTROL_COMMAND_LINE, cmd->args[1].v.s);
+            af_reinit(sh_audio->afilter, af);
+        }
+        break;
+
         default:
                 mp_msg(MSGT_CPLAYER, MSGL_V,
                        "Received unknown cmd %s\n", cmd->name);
--- a/input/input.c	Sun Oct 17 15:52:18 2010 +0000
+++ b/input/input.c	Sun Oct 17 15:54:55 2010 +0000
@@ -205,6 +205,7 @@
   { MP_CMD_AF_ADD, "af_add", 1,  { {MP_CMD_ARG_STRING, {0}}, {-1,{0}} } },
   { MP_CMD_AF_DEL, "af_del", 1,  { {MP_CMD_ARG_STRING, {0}}, {-1,{0}} } },
   { MP_CMD_AF_CLR, "af_clr", 0, { {-1,{0}} } },
+  { MP_CMD_AF_CMDLINE, "af_cmdline", 2, { {MP_CMD_ARG_STRING, {0}}, {MP_CMD_ARG_STRING, {0}}, {-1,{0}} } },
 
   { 0, NULL, 0, {} }
 };
--- a/input/input.h	Sun Oct 17 15:52:18 2010 +0000
+++ b/input/input.h	Sun Oct 17 15:54:55 2010 +0000
@@ -159,6 +159,7 @@
   MP_CMD_AF_ADD,
   MP_CMD_AF_DEL,
   MP_CMD_AF_CLR,
+  MP_CMD_AF_CMDLINE,
 
 } mp_command_type;