[MPlayer-dev-eng] [PATCH] Remote ESD Support in gmplayer

Paul Wilhelm Elsinghorst paul at uni-bonn.de
Sun Jan 30 11:31:12 CET 2005


Adds remote ESD support and software mixer selection to the gui.
Software mixer is automatically selected when using remote esd.

The indentation is fine on my computer. Maybe evolution is messing it
up. Should i send a compressed copy?

Hope the coding is better now.


Paul
-------------- next part --------------
diff -Naur main/AUTHORS main-esd-remote/AUTHORS
--- main/AUTHORS	2005-01-15 17:08:04.000000000 +0100
+++ main-esd-remote/AUTHORS	2005-01-30 11:14:56.868576256 +0100
@@ -210,6 +210,9 @@
 Egger, Christoph <christoph_egger at gmx.de>
     * vo_ggi updates
 
+Elsinghorst, Paul Wilhelm <paul at uni-bonn.de>
+    * remote ESD support including software mixer
+
 Ernesti, Bernd <mplayer at lists.veego.de>
     * NetBSD support patches
 
diff -Naur main/Gui/cfg.c main-esd-remote/Gui/cfg.c
--- main/Gui/cfg.c	2005-01-20 14:22:52.000000000 +0100
+++ main-esd-remote/Gui/cfg.c	2005-01-30 11:14:56.869576104 +0100
@@ -30,6 +30,7 @@
 #endif
 
 int    gtkAONorm = 0;
+int    gtkSoftVol = 0;
 int    gtkAOSurround = 0;
 int    gtkAOExtraStereo = 0;
 float  gtkAOExtraStereoMul = 1.0;
@@ -46,6 +47,9 @@
 #ifdef HAVE_SDL
 char * gtkAOSDLDriver;
 #endif
+#ifdef USE_ESD
+char * gtkAOESDDevice;
+#endif
 
 int    gtkCacheOn = 0;
 int    gtkCacheSize = 2048;
@@ -108,6 +112,7 @@
 
  { "ao_driver",&audio_driver_list,CONF_TYPE_STRING_LIST,0,0,0,NULL },
  { "ao_volnorm",&gtkAONorm,CONF_TYPE_FLAG,0,0,1,NULL },
+ { "soft_vol",&gtkSoftVol,CONF_TYPE_FLAG,0,0,1,NULL },
  { "ao_surround",&gtkAOSurround,CONF_TYPE_FLAG,0,0,1,NULL },
  { "ao_extra_stereo",&gtkAOExtraStereo,CONF_TYPE_FLAG,0,0,1,NULL },
  { "ao_extra_stereo_coefficient",&gtkAOExtraStereoMul,CONF_TYPE_FLOAT,CONF_RANGE,-10,10,NULL },
@@ -124,6 +129,9 @@
 #ifdef HAVE_SDL
  { "ao_sdl_subdriver",&gtkAOSDLDriver,CONF_TYPE_STRING,0,0,0,NULL },
 #endif
+#ifdef USE_ESD
+ { "ao_esd_device",&gtkAOESDDevice,CONF_TYPE_STRING,0,0,0,NULL },
+#endif
 
  { "dvd_device",&dvd_device,CONF_TYPE_STRING,0,0,0,NULL },
  { "cdrom_device",&cdrom_device,CONF_TYPE_STRING,0,0,0,NULL },
diff -Naur main/Gui/cfg.h main-esd-remote/Gui/cfg.h
--- main/Gui/cfg.h	2004-07-30 17:58:36.000000000 +0200
+++ main-esd-remote/Gui/cfg.h	2005-01-30 11:14:56.869576104 +0100
@@ -9,6 +9,7 @@
 extern int    gtkVopFAME;
 
 extern int    gtkAONorm;
+extern int    gtkSoftVol;
 extern int    gtkAOFakeSurround;
 extern int    gtkAOExtraStereo;
 extern float  gtkAOExtraStereoMul;
@@ -25,6 +26,9 @@
 #ifdef HAVE_SDL
 extern char * gtkAOSDLDriver;
 #endif
+#ifdef USE_ESD
+extern char * gtkAOESDDevice;
+#endif
 #ifdef HAVE_DXR3
 extern char * gtkDXR3Device;
 #endif
diff -Naur main/Gui/interface.c main-esd-remote/Gui/interface.c
--- main/Gui/interface.c	2005-01-06 19:10:36.000000000 +0100
+++ main-esd-remote/Gui/interface.c	2005-01-30 11:14:56.870575952 +0100
@@ -832,6 +832,14 @@
 	  greplace(&af_cfg.list, "extrastereo", name);
 	  free(name);
 	 }
+
+// --- software mixer
+
+	if ( gtkSoftVol ) {
+	soft_vol = 1;
+	} else
+	  soft_vol = 0;
+
 #ifdef USE_OSS_AUDIO
 	if ( audio_driver_list && !gstrncmp( audio_driver_list[0],"oss",3 ) )
 	 {
@@ -872,6 +880,22 @@
 	  gaddlist( &audio_driver_list,tmp );
 	 }
 #endif
+#ifdef USE_ESD
+	if ( audio_driver_list && !gstrncmp( audio_driver_list[0],"esd",3 ) )
+	 {
+	  char *tmp;
+	  if (gtkAOESDDevice) {
+	  tmp = calloc( 1,strlen( gtkAOESDDevice ) + 10 );
+	  sprintf( tmp,"esd:%s",gtkAOESDDevice );
+	  } else
+	    tmp = "esd";
+	  gaddlist( &audio_driver_list,tmp );
+	  if (gtkAOESDDevice) {
+	  soft_vol = 1;
+	  } else
+	    soft_vol = 0;
+	 }
+#endif
 // -- subtitle
 #ifdef USE_SUB
 	//subdata->filename=gstrdup( guiIntfStruct.Subtitlename );
diff -Naur main/Gui/mplayer/gtk/opts.c main-esd-remote/Gui/mplayer/gtk/opts.c
--- main/Gui/mplayer/gtk/opts.c	2004-09-23 12:06:37.000000000 +0200
+++ main-esd-remote/Gui/mplayer/gtk/opts.c	2005-01-30 11:21:52.371410224 +0100
@@ -52,6 +52,7 @@
 //static GtkWidget * CBSurround;
 static GtkWidget * CBExtraStereo;
 static GtkWidget * CBNormalize;
+static GtkWidget * CBSoftwareMixer;
 static GtkWidget * CBDoubleBuffer;
 static GtkWidget * CBDR;
 static GtkWidget * CBFramedrop;
@@ -180,6 +181,7 @@
 #endif
  gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( CBExtraStereo ),gtkAOExtraStereo );
  gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( CBNormalize ),gtkAONorm );
+ gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( CBSoftwareMixer ),gtkSoftVol );
  gtk_adjustment_set_value( HSExtraStereoMuladj,gtkAOExtraStereoMul );
  {
   int    i = 0;
@@ -207,6 +209,7 @@
     gtk_widget_set_sensitive( AConfig,FALSE );
     if ( !strncmp( ao_driver[0],"oss",3 ) ||
          !strncmp( ao_driver[0],"alsa",4 ) ||
+	  !strncmp( ao_driver[0],"esd",3 ) ||
          !strncmp( ao_driver[0],"sdl",3 ) )
       gtk_widget_set_sensitive( AConfig,TRUE );
    }
@@ -407,6 +410,7 @@
 // -- signals
  gtk_signal_connect( GTK_OBJECT( CBExtraStereo ),"toggled",GTK_SIGNAL_FUNC( prToggled ),(void*)0 );
  gtk_signal_connect( GTK_OBJECT( CBNormalize ),"toggled",GTK_SIGNAL_FUNC( prToggled ),(void*)1 );
+ gtk_signal_connect( GTK_OBJECT( CBSoftwareMixer ),"toggled",GTK_SIGNAL_FUNC( prToggled ),(void*)1 );
  gtk_signal_connect( GTK_OBJECT( CBAudioEqualizer ),"toggled",GTK_SIGNAL_FUNC( prToggled ),(void*)2 );
  gtk_signal_connect( GTK_OBJECT( CBShowVideoWindow ),"toggled",GTK_SIGNAL_FUNC( prToggled ), (void*)3 );
 #ifdef HAVE_FREETYPE
@@ -509,6 +513,7 @@
         gtkEnableAudioEqualizer=gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON( CBAudioEqualizer ) );
 	gtkAOExtraStereo=gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON( CBExtraStereo ) );
 	gtkAONorm=gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON( CBNormalize ) );
+	gtkSoftVol=gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON( CBSoftwareMixer ) );
 	gtkSet( gtkSetExtraStereo,HSExtraStereoMuladj->value,NULL );
 	audio_delay=HSAudioDelayadj->value;
 
@@ -605,6 +610,7 @@
         gtk_widget_set_sensitive( AConfig,FALSE );
         if ( !strncmp( ao_driver[0],"oss",3 ) ||
              !strncmp( ao_driver[0],"alsa",4 ) ||
+	      !strncmp( ao_driver[0],"esd",3 ) ||
              !strncmp( ao_driver[0],"sdl",3 ) ) {
           ShowAudioConfig();
           gtk_widget_set_sensitive( AConfig,TRUE );
@@ -727,6 +733,7 @@
 	gtk_widget_set_sensitive( AConfig,FALSE );
 	if ( !strncmp( ao_driver[0],"oss",3 ) ||
 	     !strncmp( ao_driver[0],"alsa",4 ) ||
+	     !strncmp( ao_driver[0],"esd",3 ) ||
 	     !strncmp( ao_driver[0],"sdl",3 ) )
 	  gtk_widget_set_sensitive( AConfig,TRUE );
 	break;
@@ -836,6 +843,7 @@
 
   CBNormalize=AddCheckButton( MSGTR_PREFERENCES_NormalizeSound,vbox3 );
   CBAudioEqualizer=AddCheckButton( MSGTR_PREFERENCES_EnEqualizer,vbox3 );
+  CBSoftwareMixer=AddCheckButton( MSGTR_PREFERENCES_SoftwareMixer,vbox3 );
 #if 0
   CBSurround=AddCheckButton( "Enable surround",vbox3 );
 #endif
@@ -1253,6 +1261,7 @@
 
 #if 0
   gtk_signal_connect( GTK_OBJECT( CBNormalize ),"toggled",GTK_SIGNAL_FUNC( on_CBNormalize_toggled ),NULL );
+  gtk_signal_connect( GTK_OBJECT( CBSoftwareMixer ),"toggled",GTK_SIGNAL_FUNC( on_CBSoftwareMixer_toggled ),NULL );
   gtk_signal_connect( GTK_OBJECT( CBSurround ),"toggled",GTK_SIGNAL_FUNC( on_CBSurround_toggled ),NULL );
   gtk_signal_connect( GTK_OBJECT( CBExtraStereo ),"toggled",GTK_SIGNAL_FUNC( on_CBExtraStereo_toggled ),NULL );
   gtk_signal_connect( GTK_OBJECT( CBDoubleBuffer ),"toggled",GTK_SIGNAL_FUNC( on_CBDoubleBuffer_toggled ),NULL );
@@ -1382,6 +1391,14 @@
 }
 #endif
 
+#ifdef USE_ESD
+GList *appendESDDevices(GList *l) {
+  l = g_list_append(l, (gpointer)"Enter Remote IP");
+  l = g_list_append(l, (gpointer)"Use Software Mixer");
+  return l;
+}
+#endif
+
 // Gets text string from a gtk entry, interpreting 
 // MSGTR_PREFERENCES_DriverDefault as null string.
 char *getGtkEntryText(GtkWidget *from) {
@@ -1434,6 +1451,11 @@
     setGtkEntryText(CEAudioDevice, gtkAOSDLDriver);
   }
 #endif
+#ifdef USE_ESD
+  if (strncmp(ao_driver[0], "esd", 3) == 0) {
+    setGtkEntryText(CEAudioDevice, gtkAOESDDevice);
+  }
+#endif
 
   gtk_widget_show(AudioConfig);
   gtkSetLayer(AudioConfig);
@@ -1475,6 +1497,12 @@
         gtkAOSDLDriver = gstrdup(getGtkEntryText(CEAudioDevice));
       }
 #endif
+#ifdef USE_ESD
+      if (strncmp(ao_driver[0], "esd", 3) == 0) {
+        gfree(&gtkAOESDDevice);
+        gtkAOESDDevice = gstrdup(getGtkEntryText(CEAudioDevice));
+      }
+#endif
    case 0:
       HideAudioConfig();
       break;
@@ -1525,6 +1553,10 @@
   if (strncmp(ao_driver[0], "sdl", 3) == 0)
     items = appendSDLDevices(items);
 #endif
+#ifdef USE_ESD
+  if (strncmp(ao_driver[0], "esd", 3) == 0)
+    items = appendESDDevices(items);
+#endif
   gtk_combo_set_popdown_strings(GTK_COMBO(CBAudioDevice), items);
   g_list_free(items);
   items = NULL;
diff -Naur main/help/help_mp-en.h main-esd-remote/help/help_mp-en.h
--- main/help/help_mp-en.h	2005-01-25 13:44:37.000000000 +0100
+++ main-esd-remote/help/help_mp-en.h	2005-01-30 11:14:56.872575648 +0100
@@ -735,6 +735,7 @@
 #define MSGTR_PREFERENCES_DoNotPlaySound "Do not play sound"
 #define MSGTR_PREFERENCES_NormalizeSound "Normalize sound"
 #define MSGTR_PREFERENCES_EnEqualizer "Enable equalizer"
+#define MSGTR_PREFERENCES_SoftwareMixer "Enable Software Mixer"
 #define MSGTR_PREFERENCES_ExtraStereo "Enable extra stereo"
 #define MSGTR_PREFERENCES_Coefficient "Coefficient:"
 #define MSGTR_PREFERENCES_AudioDelay "Audio delay"


More information about the MPlayer-dev-eng mailing list