[MPlayer-dev-eng] [PATCH] remove ao plugins

Reimar Döffinger Reimar.Doeffinger at stud.uni-karlsruhe.de
Sat Dec 25 12:52:46 CET 2004


Hi,
this patch removes the ao plugins (except for removing the files
themselves, but that should be done, too).
Please comment.
I intend to apply around next week.

Greetings,
Reimar Döffinger
-------------- next part --------------
Index: cfg-mplayer.h
===================================================================
RCS file: /cvsroot/mplayer/main/cfg-mplayer.h,v
retrieving revision 1.235
diff -u -r1.235 cfg-mplayer.h
--- cfg-mplayer.h	21 Dec 2004 20:33:50 -0000	1.235
+++ cfg-mplayer.h	25 Dec 2004 11:36:55 -0000
@@ -122,18 +122,6 @@
 /* from libvo/aspect.c */
 extern float monitor_aspect;
 
-/* Options related to audio out plugins */
-m_option_t ao_plugin_conf[]={
-	{"list", &ao_plugin_cfg.plugin_list, CONF_TYPE_STRING, 0, 0, 0, NULL},
-	{"delay", &ao_plugin_cfg.pl_delay_len, CONF_TYPE_INT, CONF_MIN, 0, 0, NULL},
-	{"format", &ao_plugin_cfg.pl_format_type, CONF_TYPE_INT, CONF_MIN, 0, 0, NULL},
-	{"fout", &ao_plugin_cfg.pl_resample_fout, CONF_TYPE_INT, CONF_MIN, 0, 0, NULL},
-	{"volume", &ao_plugin_cfg.pl_volume_volume, CONF_TYPE_INT, CONF_RANGE, 0, 255, NULL},
-	{"mul", &ao_plugin_cfg.pl_extrastereo_mul, CONF_TYPE_FLOAT, CONF_RANGE, -10.0, 10.0, NULL},
-	{"softclip", &ao_plugin_cfg.pl_volume_softclip, CONF_TYPE_FLAG, 0, 0, 1, NULL},
-	{NULL, NULL, 0, 0, 0, 0, NULL}
-};
-
 extern int sws_flags;
 extern int readPPOpt(void *conf, char *arg);
 extern void revertPPOpt(void *conf, char* opt);
@@ -166,7 +154,7 @@
 	{"noontop", &vo_ontop, CONF_TYPE_FLAG, 0, 1, 0, NULL},
 	{"rootwin", &vo_rootwin, CONF_TYPE_FLAG, 0, 0, 1, NULL},
 
-	{"aop", ao_plugin_conf, CONF_TYPE_SUBCONFIG, 0, 0, 0, NULL},
+	{"aop", "Use -af\n", CONF_TYPE_PRINT, CONF_NOCFG, 0, 0, NULL},
 	{"dsp", "Use -ao oss:dsp_path.\n", CONF_TYPE_PRINT, CONF_NOCFG, 0, 0, NULL},
         {"mixer", &mixer_device, CONF_TYPE_STRING, 0, 0, 0, NULL},
         {"mixer-channel", &mixer_channel, CONF_TYPE_STRING, 0, 0, 0, NULL},
Index: mplayer.c
===================================================================
RCS file: /cvsroot/mplayer/main/mplayer.c,v
retrieving revision 1.821
diff -u -r1.821 mplayer.c
--- mplayer.c	21 Dec 2004 12:25:58 -0000	1.821
+++ mplayer.c	25 Dec 2004 11:37:25 -0000
@@ -58,7 +58,6 @@
 #endif
 
 #include "libao2/audio_out.h"
-#include "libao2/audio_plugin.h"
 
 #include "codec-cfg.h"
 
@@ -389,6 +388,9 @@
     inited_flags&=~INITED_ACODEC;
     current_module="uninit_acodec";
     if(sh_audio) uninit_audio(sh_audio);
+#ifdef HAVE_NEW_GUI
+    guiGetEvent(guiSetAfilter, (char *)NULL);
+#endif
     sh_audio=NULL;
   }
 
@@ -927,6 +929,9 @@
   int result;
   if (!sh_audio)
   {
+#ifdef HAVE_NEW_GUI
+    guiGetEvent(guiSetAfilter, (char *)NULL);
+#endif
     mixer.afilter = NULL;
     return 0;
   }
@@ -945,6 +950,9 @@
            audio_out_format_bits(ao_data->format) / 8, /* ao_data.bps, */
            ao_data->outburst * 4, ao_data->buffersize);
   mixer.afilter = sh_audio->afilter;
+#ifdef HAVE_NEW_GUI
+  guiGetEvent(guiSetAfilter, (char *)sh_audio->afilter);
+#endif
   return result;
 }
 
@@ -2104,7 +2112,7 @@
 #endif  
   current_module="ao2_init";
   if(!(audio_out=init_best_audio_out(audio_driver_list,
-      (ao_plugin_cfg.plugin_list!=NULL), // plugin flag
+      0, // plugin flag
       force_srate?force_srate:ao_data.samplerate,
       audio_output_channels?audio_output_channels:ao_data.channels,
       audio_output_format?audio_output_format:ao_data.format,0))){
Index: Gui/interface.c
===================================================================
RCS file: /cvsroot/mplayer/main/Gui/interface.c,v
retrieving revision 1.100
diff -u -r1.100 interface.c
--- Gui/interface.c	18 Dec 2004 10:30:17 -0000	1.100
+++ Gui/interface.c	25 Dec 2004 11:37:30 -0000
@@ -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: Gui/interface.h
===================================================================
RCS file: /cvsroot/mplayer/main/Gui/interface.h,v
retrieving revision 1.37
diff -u -r1.37 interface.h
--- Gui/interface.h	15 Aug 2003 11:55:21 -0000	1.37
+++ Gui/interface.h	25 Dec 2004 11:37:30 -0000
@@ -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
Index: libao2/Makefile
===================================================================
RCS file: /cvsroot/mplayer/main/libao2/Makefile,v
retrieving revision 1.31
diff -u -r1.31 Makefile
--- libao2/Makefile	5 Nov 2004 14:02:41 -0000	1.31
+++ libao2/Makefile	25 Dec 2004 11:37:33 -0000
@@ -2,7 +2,7 @@
 
 LIBNAME = libao2.a
 
-SRCS=afmt.c audio_out.c ao_mpegpes.c ao_null.c ao_pcm.c ao_plugin.c pl_delay.c pl_format.c pl_surround.c remez.c pl_resample.c pl_volume.c pl_extrastereo.c pl_volnorm.c pl_eq.c $(OPTIONAL_SRCS)
+SRCS=afmt.c audio_out.c ao_mpegpes.c ao_null.c ao_pcm.c remez.c $(OPTIONAL_SRCS)
 
 OBJS=$(SRCS:.c=.o)
 
Index: libao2/audio_out.c
===================================================================
RCS file: /cvsroot/mplayer/main/libao2/audio_out.c,v
retrieving revision 1.45
diff -u -r1.45 audio_out.c
--- libao2/audio_out.c	7 Dec 2004 02:24:15 -0000	1.45
+++ libao2/audio_out.c	25 Dec 2004 11:37:41 -0000
@@ -65,7 +65,6 @@
 extern ao_functions_t audio_out_mpegpes;
 extern ao_functions_t audio_out_pcm;
 extern ao_functions_t audio_out_pss;
-extern ao_functions_t audio_out_plugin;
 
 ao_functions_t* audio_out_drivers[] =
 {
@@ -124,7 +123,6 @@
         &audio_out_null,
 // should not be auto-selected:
 	&audio_out_pcm,
-	&audio_out_plugin,
 	NULL
 };
 
@@ -164,10 +162,6 @@
 	    ao_functions_t* audio_out=audio_out_drivers[i];
 	    if(!strncmp(audio_out->info->short_name,ao,ao_len)){
 		// name matches, try it
-		if(use_plugin){
-		    audio_out_plugin.control(AOCONTROL_SET_PLUGIN_DRIVER,audio_out);
-		    audio_out=&audio_out_plugin;
-		}
 		if(audio_out->init(rate,channels,format,flags))
 		    return audio_out; // success!
 	    }
@@ -183,10 +177,6 @@
     // now try the rest...
     for(i=0;audio_out_drivers[i];i++){
 	ao_functions_t* audio_out=audio_out_drivers[i];
-	if(use_plugin){
-	    audio_out_plugin.control(AOCONTROL_SET_PLUGIN_DRIVER,audio_out);
-	    audio_out=&audio_out_plugin;
-	}
 	if(audio_out->init(rate,channels,format,flags))
 	    return audio_out; // success!
     }


More information about the MPlayer-dev-eng mailing list