[MPlayer-cvslog] r31030 - in trunk: AUTHORS DOCS/tech/slave.txt command.c input/input.c input/input.h

cehoyos subversion at mplayerhq.hu
Sun Apr 11 20:59:19 CEST 2010


Author: cehoyos
Date: Sun Apr 11 20:59:19 2010
New Revision: 31030

Log:
Add slave commands for loading and unloading audio filters at runtime.

Patch by Jehan Hysseo, hysseo zemarmot net

Modified:
   trunk/AUTHORS
   trunk/DOCS/tech/slave.txt
   trunk/command.c
   trunk/input/input.c
   trunk/input/input.h

Modified: trunk/AUTHORS
==============================================================================
--- trunk/AUTHORS	Sun Apr 11 15:47:13 2010	(r31029)
+++ trunk/AUTHORS	Sun Apr 11 20:59:19 2010	(r31030)
@@ -385,6 +385,9 @@ Hůrka, Tomáš <tom at hukatronic.cz>
     * Darwin DVD support (mpdvdkit2)
     * various fixes
 
+Hysseo, Jehan <hysseo at zemarmot.net>
+    * af_add, af_switch, af_del, af_clr commands.
+
 Isani, Sidik <lksi at cfht.hawaii.edu>
     * get_delay() smoothing code (-autosync)
     * RTC initialization fixes

Modified: trunk/DOCS/tech/slave.txt
==============================================================================
--- trunk/DOCS/tech/slave.txt	Sun Apr 11 15:47:13 2010	(r31029)
+++ trunk/DOCS/tech/slave.txt	Sun Apr 11 20:59:19 2010	(r31030)
@@ -45,6 +45,17 @@ Various tips and tricks (please help exp
 
 Available commands ('mplayer -input cmdlist' will print a list):
 
+af_add <filter_arguments_list>  (comma separated list of audio filters with parameters)
+    (experimental) Load the given list of audio filters.
+
+af_clr
+    (experimental) Unload all loaded audio filters.
+
+af_del <filter_name_list> (comma separated list of audio filter's names)
+    (experimental) Unload the first occurrence of the filters, if loaded.
+
+af_switch <filter_arguments_list> (comma separated list of audio filters with parameters)
+    (experimental) Remove all the audio filters and replace them with the given list.
 
 alt_src_step <value> (ASX playlist only)
     When more than one source is available it selects the next/previous one.

Modified: trunk/command.c
==============================================================================
--- trunk/command.c	Sun Apr 11 15:47:13 2010	(r31029)
+++ trunk/command.c	Sun Apr 11 20:59:19 2010	(r31030)
@@ -3242,6 +3242,43 @@ int run_command(MPContext * mpctx, mp_cm
 
 #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))

Modified: trunk/input/input.c
==============================================================================
--- trunk/input/input.c	Sun Apr 11 15:47:13 2010	(r31029)
+++ trunk/input/input.c	Sun Apr 11 20:59:19 2010	(r31030)
@@ -209,6 +209,11 @@ static const mp_cmd_t mp_cmds[] = {
   { MP_CMD_SEEK_CHAPTER, "seek_chapter", 1, { {MP_CMD_ARG_INT,{0}}, {MP_CMD_ARG_INT,{0}}, {-1,{0}} } },
   { MP_CMD_SET_MOUSE_POS, "set_mouse_pos", 2, { {MP_CMD_ARG_INT,{0}}, {MP_CMD_ARG_INT,{0}}, {-1,{0}} } },
 
+  { MP_CMD_AF_SWITCH, "af_switch", 1,  { {MP_CMD_ARG_STRING, {0}}, {-1,{0}} } },
+  { 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}} } },
+
   { 0, NULL, 0, {} }
 };
 

Modified: trunk/input/input.h
==============================================================================
--- trunk/input/input.h	Sun Apr 11 15:47:13 2010	(r31029)
+++ trunk/input/input.h	Sun Apr 11 20:59:19 2010	(r31030)
@@ -162,6 +162,13 @@ typedef enum {
   MP_CMD_CHELP = 7000,
   MP_CMD_CEXIT,
   MP_CMD_CHIDE,
+
+  /// Audio Filter commands
+  MP_CMD_AF_SWITCH,
+  MP_CMD_AF_ADD,
+  MP_CMD_AF_DEL,
+  MP_CMD_AF_CLR,
+
 } mp_command_type;
 
 // The arg types


More information about the MPlayer-cvslog mailing list