[MPlayer-dev-eng] [PATCH] set/get equalizer slave mode commands
Reimar Döffinger
Reimar.Doeffinger at stud.uni-karlsruhe.de
Sat Jul 23 20:19:35 CEST 2005
Please ignore me, I'm just a little patch-carrier-email running after
its parent.
-------------- next part --------------
Index: mplayer.c
===================================================================
RCS file: /cvsroot/mplayer/main/mplayer.c,v
retrieving revision 1.856
diff -u -r1.856 mplayer.c
--- mplayer.c 22 Jul 2005 17:11:39 -0000 1.856
+++ mplayer.c 23 Jul 2005 17:16:30 -0000
@@ -2973,6 +2973,33 @@
}
#endif
} break;
+ case MP_CMD_GET_EQ:
+ if (sh_audio && sh_audio->afilter) {
+ af_control_ext_t tmp;
+ float vals[10] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
+ tmp.ch = cmd->args[0].v.i;
+ tmp.arg = vals;
+ af_control_any_rev(sh_audio->afilter,
+ AF_CONTROL_EQUALIZER_GAIN | AF_CONTROL_GET, &tmp);
+ mp_msg(MSGT_GLOBAL, MSGL_INFO,
+ "ANS_GET_EQ=%f %f %f %f %f %f %f %f %f %f\n",
+ vals[0], vals[1], vals[2], vals[3], vals[4],
+ vals[5], vals[6], vals[7], vals[8], vals[9]);
+ }
+ break;
+ case MP_CMD_SET_EQ:
+ if (sh_audio && sh_audio->afilter) {
+ af_control_ext_t tmp;
+ float vals[10];
+ int i;
+ for (i = 0; i < 10; i++)
+ vals[i] = cmd->args[i + 1].v.f;
+ tmp.ch = cmd->args[0].v.i;
+ tmp.arg = vals;
+ af_control_any_rev(sh_audio->afilter,
+ AF_CONTROL_EQUALIZER_GAIN | AF_CONTROL_SET, &tmp);
+ }
+ break;
case MP_CMD_MUTE:
#ifdef USE_EDL
user_muted = !user_muted;
Index: input/input.c
===================================================================
RCS file: /cvsroot/mplayer/main/input/input.c,v
retrieving revision 1.119
diff -u -r1.119 input.c
--- input/input.c 23 Jul 2005 16:54:45 -0000 1.119
+++ input/input.c 23 Jul 2005 17:16:49 -0000
@@ -66,6 +66,8 @@
{ MP_CMD_OSD, "osd",0, { {MP_CMD_ARG_INT,{-1}}, {-1,{0}} } },
{ MP_CMD_OSD_SHOW_TEXT, "osd_show_text", 1, { {MP_CMD_ARG_STRING, {0}}, {-1,{0}} } },
{ MP_CMD_VOLUME, "volume", 1, { { MP_CMD_ARG_INT,{0} }, {MP_CMD_ARG_INT,{0}}, {-1,{0}} } },
+ { MP_CMD_GET_EQ, "get_eq", 1, { { MP_CMD_ARG_INT,{0} }, {-1,{0}} } },
+ { MP_CMD_SET_EQ, "set_eq", 1, { { MP_CMD_ARG_INT,{0} }, {MP_CMD_ARG_FLOAT,{0}}, {MP_CMD_ARG_FLOAT,{0}}, {MP_CMD_ARG_FLOAT,{0}}, {MP_CMD_ARG_FLOAT,{0}}, {MP_CMD_ARG_FLOAT,{0}}, {MP_CMD_ARG_FLOAT,{0}}, {MP_CMD_ARG_FLOAT,{0}}, {MP_CMD_ARG_FLOAT,{0}}, {MP_CMD_ARG_FLOAT,{0}}, {MP_CMD_ARG_FLOAT,{0}}, {-1,{0}} } },
{ MP_CMD_MIXER_USEMASTER, "use_master", 0, { {-1,{0}} } },
{ MP_CMD_MUTE, "mute", 0, { {-1,{0}} } },
{ MP_CMD_CONTRAST, "contrast",1, { {MP_CMD_ARG_INT,{0}}, {MP_CMD_ARG_INT,{0}}, {-1,{0}} } },
Index: input/input.h
===================================================================
RCS file: /cvsroot/mplayer/main/input/input.h,v
retrieving revision 1.57
diff -u -r1.57 input.h
--- input/input.h 27 Jun 2005 08:16:23 -0000 1.57
+++ input/input.h 23 Jul 2005 17:16:51 -0000
@@ -67,6 +67,8 @@
#define MP_CMD_GET_TIME_POS 63
#define MP_CMD_SUB_LOAD 64
#define MP_CMD_SUB_REMOVE 65
+#define MP_CMD_GET_EQ 66
+#define MP_CMD_SET_EQ 67
#define MP_CMD_GUI_EVENTS 5000
#define MP_CMD_GUI_LOADFILE 5001
@@ -104,7 +106,7 @@
#define MP_CMD_ARG_VOID 3
#ifndef MP_CMD_MAX_ARGS
-#define MP_CMD_MAX_ARGS 10
+#define MP_CMD_MAX_ARGS 20
#endif
// Error codes for the drivers
Index: libaf/af_equalizer.c
===================================================================
RCS file: /cvsroot/mplayer/main/libaf/af_equalizer.c,v
retrieving revision 1.5
diff -u -r1.5 af_equalizer.c
--- libaf/af_equalizer.c 27 Dec 2004 17:30:13 -0000 1.5
+++ libaf/af_equalizer.c 23 Jul 2005 17:16:54 -0000
@@ -124,10 +124,16 @@
case AF_CONTROL_EQUALIZER_GAIN | AF_CONTROL_SET:{
float* gain = ((af_control_ext_t*)arg)->arg;
int ch = ((af_control_ext_t*)arg)->ch;
+ int last_ch = ch;
int k;
+ if (ch == -1) {
+ ch = 0;
+ last_ch = AF_NCH - 1;
+ }
if(ch > AF_NCH || ch < 0)
return AF_ERROR;
+ for (; ch <= last_ch; ch++)
for(k = 0 ; k<KM ; k++)
s->g[ch][k] = pow(10.0,clamp(gain[k],G_MIN,G_MAX)/20.0)-1.0;
More information about the MPlayer-dev-eng
mailing list