[MPlayer-cvslog] CVS: main/Gui interface.c, 1.100, 1.101 interface.h, 1.37, 1.38

Reimar Döffinger CVS syncmail at mplayerhq.hu
Mon Dec 27 20:34:44 CET 2004


CVS change done by Reimar Döffinger CVS

Update of /cvsroot/mplayer/main/Gui
In directory mail:/var2/tmp/cvs-serv25604/Gui

Modified Files:
	interface.c interface.h 
Log Message:
Do not use audio plugins anymore


Index: interface.c
===================================================================
RCS file: /cvsroot/mplayer/main/Gui/interface.c,v
retrieving revision 1.100
retrieving revision 1.101
diff -u -r1.100 -r1.101
--- interface.c	18 Dec 2004 10:30:17 -0000	1.100
+++ interface.c	27 Dec 2004 19:34:42 -0000	1.101
@@ -27,9 +27,11 @@
 #include "../input/input.h"
 #include "../libao2/audio_out.h"
 #include "../mixer.h"
-#include "../libao2/audio_plugin.h"
+#include "../libaf/af.h"
 #include "../libao2/eq.h"
 
+extern af_cfg_t af_cfg;
+
 #ifdef USE_ICONV
 #include <iconv.h>
 #endif
@@ -106,6 +108,9 @@
    else gstrcat( str,what );
 }
 
+/**
+ * \brief this actually creates a new list containing only one element...
+ */
 void gaddlist( char *** list,char * entry )
 {
  int i;
@@ -121,6 +126,32 @@
  (*list)[1]=NULL;
 }
 
+/**
+ * \brief this replaces a string starting with search by replace.
+ * If not found, replace is appended.
+ */
+void greplace(char ***list, char *search, char *replace)
+{
+ int i = 0;
+ int len = (search) ? strlen(search) : 0;
+
+ if (*list) {
+   for (i = 0; (*list)[i]; i++) {
+     if (search && (strncmp((*list)[i], search, len) == 0)) {
+       free((*list)[i]);
+       (*list)[i] = gstrdup(replace);
+       return;
+     }
+   }
+   *list = realloc(*list, (i + 2) * sizeof(char *));
+ }
+ else
+   *list = malloc(2 * sizeof(char *));
+
+ (*list)[i] = gstrdup(replace);
+ (*list)[i + 1] = NULL;
+}
+
 #ifdef USE_ICONV
 char * gconvert_uri_to_filename( char * str )
 {
@@ -543,6 +574,9 @@
    case guiSetDemuxer:
 	guiIntfStruct.demuxer=(void *)arg;
 	break;
+   case guiSetAfilter:
+	guiIntfStruct.afilter=(void *)arg;
+	break;
    case guiSetShVideo:
 	 {
 	  if ( !appMPlayer.subWindow.isFullScreen )
@@ -786,12 +820,17 @@
 		 
 // --- audio opts
 //	if ( ao_plugin_cfg.plugin_list ) { free( ao_plugin_cfg.plugin_list ); ao_plugin_cfg.plugin_list=NULL; }
-	if ( gtkAONorm ) 	       gset( &ao_plugin_cfg.plugin_list,"volnorm" );
-	if ( gtkEnableAudioEqualizer ) gset( &ao_plugin_cfg.plugin_list,"eq" );
+	if (gtkAONorm)
+	  greplace(&af_cfg.list, "volnorm", "volnorm");
+	if (gtkEnableAudioEqualizer)
+	  greplace(&af_cfg.list, "equalizer", "equalizer");
 	if ( gtkAOExtraStereo )
 	 {
-	  gset( &ao_plugin_cfg.plugin_list,"extrastereo" );
-	  ao_plugin_cfg.pl_extrastereo_mul=gtkAOExtraStereoMul;
+	  char *name = malloc(12 + 20 + 1);
+	  snprintf(name, 12 + 20, "extrastereo=%f", gtkAOExtraStereoMul);
+	  name[12 + 20] = 0;
+	  greplace(&af_cfg.list, "extrastereo", name);
+	  free(name);
 	 }
 #ifdef USE_OSS_AUDIO
 	if ( audio_driver_list && !gstrncmp( audio_driver_list[0],"oss",3 ) )
@@ -1078,7 +1117,9 @@
 	return NULL;
    case gtkSetExtraStereo:
         gtkAOExtraStereoMul=fparam;
-	audio_plugin_extrastereo.control( AOCONTROL_PLUGIN_ES_SET,(void *)&gtkAOExtraStereoMul );
+        if (guiIntfStruct.afilter)
+          af_control_any_rev(guiIntfStruct.afilter,
+             AF_CONTROL_ES_MUL | AF_CONTROL_SET, &gtkAOExtraStereoMul);
         return NULL;
    case gtkSetPanscan:
         {
@@ -1106,20 +1147,32 @@
         if ( guiIntfStruct.sh_video ) set_video_colors( guiIntfStruct.sh_video,"saturation",(int)fparam );
 	return NULL;
    case gtkSetEqualizer:
+     {
+        af_control_ext_t tmp;
         if ( eq )
 	 {
           gtkEquChannels[eq->channel][eq->band]=eq->gain;
-	  audio_plugin_eq.control( AOCONTROL_PLUGIN_EQ_SET_GAIN,(void *)eq );
+          tmp.ch = eq->channel;
+          tmp.arg = gtkEquChannels[eq->channel];
+          if (guiIntfStruct.afilter)
+            af_control_any_rev(guiIntfStruct.afilter,
+               AF_CONTROL_EQUALIZER_GAIN | AF_CONTROL_SET, &tmp);
 	 }
 	 else
 	  {
-	   int i,j; equalizer_t tmp; tmp.gain=0.0f;
+	   int i;
 	   memset( gtkEquChannels,0,sizeof( gtkEquChannels ) );
+	   if (guiIntfStruct.afilter)
 	   for ( i=0;i<6;i++ )
-	    for ( j=0;j<10;j++ )
-	     { tmp.channel=i; tmp.band=j; audio_plugin_eq.control( AOCONTROL_PLUGIN_EQ_SET_GAIN,(void *)&tmp ); }
+	    {
+	     tmp.ch = i;
+	     tmp.arg = gtkEquChannels[i];
+	     af_control_any_rev(guiIntfStruct.afilter,
+	        AF_CONTROL_EQUALIZER_GAIN | AF_CONTROL_SET, &tmp);
+	    }
 	  }
 	return NULL;
+     }
   }
  return NULL;
 }

Index: interface.h
===================================================================
RCS file: /cvsroot/mplayer/main/Gui/interface.h,v
retrieving revision 1.37
retrieving revision 1.38
diff -u -r1.37 -r1.38
--- interface.h	15 Aug 2003 11:55:21 -0000	1.37
+++ interface.h	27 Dec 2004 19:34:42 -0000	1.38
@@ -59,6 +59,7 @@
    guiUnknownErrorStruct error;
    
    void * sh_video;
+   void * afilter;
    void * demuxer;
    void * event_struct;
 
@@ -130,6 +131,7 @@
 #define guiSetFileFormat    14
 #define guiSetDemuxer       15
 #define guiSetParameters    16
+#define guiSetAfilter       17
 
 #define guiSetStop  0
 #define guiSetPlay  1




More information about the MPlayer-cvslog mailing list