changeset 12918:eb0d3c1b6c6d

unified audio options dialog, fixes also bug #40
author reimar
date Fri, 30 Jul 2004 15:58:36 +0000
parents 94cab66a5d07
children aba44b58dea7
files Gui/cfg.c Gui/cfg.h Gui/interface.c Gui/mplayer/gtk/opts.c Gui/mplayer/gtk/opts.h help/help_mp-en.h
diffstat 6 files changed, 346 insertions(+), 302 deletions(-) [+]
line wrap: on
line diff
--- a/Gui/cfg.c	Fri Jul 30 11:17:21 2004 +0000
+++ b/Gui/cfg.c	Fri Jul 30 15:58:36 2004 +0000
@@ -38,8 +38,14 @@
 float  gtkAOExtraStereoMul = 1.0;
 #ifdef USE_OSS_AUDIO
 char * gtkAOOSSMixer;
+char * gtkAOOSSMixerChannel;
 char * gtkAOOSSDevice;
 #endif
+#if defined(HAVE_ALSA9) || defined (HAVE_ALSA1X)
+char * gtkAOALSAMixer;
+char * gtkAOALSAMixerChannel;
+char * gtkAOALSADevice;
+#endif
 #ifdef HAVE_SDL
 char * gtkAOSDLDriver;
 #endif
@@ -110,8 +116,14 @@
  { "ao_extra_stereo_coefficient",&gtkAOExtraStereoMul,CONF_TYPE_FLOAT,CONF_RANGE,-10,10,NULL },
 #ifdef USE_OSS_AUDIO
  { "ao_oss_mixer",&gtkAOOSSMixer,CONF_TYPE_STRING,0,0,0,NULL },
+ { "ao_oss_mixer_channel",&gtkAOOSSMixerChannel,CONF_TYPE_STRING,0,0,0,NULL },
  { "ao_oss_device",&gtkAOOSSDevice,CONF_TYPE_STRING,0,0,0,NULL },
 #endif
+#if defined(HAVE_ALSA9) || defined (HAVE_ALSA1X)
+ { "ao_alsa_mixer",&gtkAOALSAMixer,CONF_TYPE_STRING,0,0,0,NULL },
+ { "ao_alsa_mixer_channel",&gtkAOALSAMixerChannel,CONF_TYPE_STRING,0,0,0,NULL },
+ { "ao_alsa_device",&gtkAOALSADevice,CONF_TYPE_STRING,0,0,0,NULL },
+#endif
 #ifdef HAVE_SDL
  { "ao_sdl_subdriver",&gtkAOSDLDriver,CONF_TYPE_STRING,0,0,0,NULL },
 #endif
--- a/Gui/cfg.h	Fri Jul 30 11:17:21 2004 +0000
+++ b/Gui/cfg.h	Fri Jul 30 15:58:36 2004 +0000
@@ -14,8 +14,14 @@
 extern float  gtkAOExtraStereoMul;
 #ifdef USE_OSS_AUDIO
 extern char * gtkAOOSSMixer;
+extern char * gtkAOOSSMixerChannel;
 extern char * gtkAOOSSDevice;
 #endif
+#if defined(HAVE_ALSA9) || defined (HAVE_ALSA1X)
+extern char * gtkAOALSAMixer;
+extern char * gtkAOALSAMixerChannel;
+extern char * gtkAOALSADevice;
+#endif
 #ifdef HAVE_SDL
 extern char * gtkAOSDLDriver;
 #endif
--- a/Gui/interface.c	Fri Jul 30 11:17:21 2004 +0000
+++ b/Gui/interface.c	Fri Jul 30 15:58:36 2004 +0000
@@ -173,10 +173,6 @@
  guiIntfStruct.StreamType=-1;
 
  memset( &gtkEquChannels,0,sizeof( gtkEquChannels ) );
-#ifdef USE_OSS_AUDIO
- if ( !gtkAOOSSMixer ) gtkAOOSSMixer=strdup( PATH_DEV_MIXER );
- if ( !gtkAOOSSDevice ) gtkAOOSSDevice=strdup( PATH_DEV_DSP );
-#endif
 #ifdef HAVE_DXR3
  if ( !gtkDXR3Device ) gtkDXR3Device=strdup( "/dev/em8300-0" );
 #endif
@@ -797,19 +793,42 @@
 	  ao_plugin_cfg.pl_extrastereo_mul=gtkAOExtraStereoMul;
 	 }
 #ifdef USE_OSS_AUDIO
-	mixer_device=gstrdup( gtkAOOSSMixer );
-	if ( audio_driver_list && !gstrncmp( audio_driver_list[0],"oss",3 ) && gtkAOOSSDevice )
+	if ( audio_driver_list && !gstrncmp( audio_driver_list[0],"oss",3 ) )
 	 {
-	  char * tmp = calloc( 1,strlen( gtkAOOSSDevice ) + 7 );
+	  char *tmp;
+	  mixer_device = gtkAOOSSMixer;
+	  mixer_channel = gtkAOOSSMixerChannel;
+	  if (gtkAOOSSDevice) {
+	  tmp = calloc( 1,strlen( gtkAOOSSDevice ) + 7 );
 	  sprintf( tmp,"oss:%s",gtkAOOSSDevice );
+	  } else
+	    tmp = "oss";
+	  gaddlist( &audio_driver_list,tmp );
+	 }
+#endif
+#if defined(HAVE_ALSA9) || defined (HAVE_ALSA1X)
+	if ( audio_driver_list && !gstrncmp( audio_driver_list[0],"alsa",4 ) )
+	 {
+	  char *tmp;
+	  mixer_device = gtkAOALSAMixer;
+	  mixer_channel = gtkAOALSAMixerChannel;
+	  if (gtkAOALSADevice) {
+	    tmp = calloc( 1,strlen( gtkAOALSADevice ) + 14 );
+	    sprintf( tmp,"alsa:device=%s",gtkAOALSADevice );
+	  } else
+	    tmp = "alsa";
 	  gaddlist( &audio_driver_list,tmp );
 	 }
 #endif
 #ifdef HAVE_SDL
-	if ( audio_driver_list && !gstrncmp( audio_driver_list[0],"sdl",3 ) && gtkAOSDLDriver )
+	if ( audio_driver_list && !gstrncmp( audio_driver_list[0],"sdl",3 ) )
 	 {
-	  char * tmp = calloc( 1,strlen( gtkAOSDLDriver ) + 10 );
+	  char *tmp;
+	  if (gtkAOSDLDriver) {
+	  tmp = calloc( 1,strlen( gtkAOSDLDriver ) + 10 );
 	  sprintf( tmp,"sdl:%s",gtkAOSDLDriver );
+	  } else
+	    tmp = "sdl";
 	  gaddlist( &audio_driver_list,tmp );
 	 }
 #endif
--- a/Gui/mplayer/gtk/opts.c	Fri Jul 30 11:17:21 2004 +0000
+++ b/Gui/mplayer/gtk/opts.c	Fri Jul 30 15:58:36 2004 +0000
@@ -152,18 +152,9 @@
 static char * vo_driver[3];
 static int    old_video_driver = 0;
 
-#ifdef USE_OSS_AUDIO
- void ShowOSSConfig( void );
- void HideOSSConfig( void );
-#endif
-#ifdef HAVE_DXR3
- void ShowDXR3Config( void );
- void HideDXR3Config( void );
-#endif
-#ifdef HAVE_SDL
- void ShowSDLConfig( void );
- void HideSDLConfig( void );
-#endif
+ void ShowAudioConfig();
+ void HideAudioConfig();
+
 static gboolean prHScaler( GtkWidget * widget,GdkEventMotion  * event,gpointer user_data );
 static void prToggled( GtkToggleButton * togglebutton,gpointer user_data );
 static void prCListRow( GtkCList * clist,gint row,gint column,GdkEvent * event,gpointer user_data );
@@ -210,12 +201,10 @@
     gtk_clist_select_row( GTK_CLIST( CLADrivers ),old_audio_driver,0 );
     gtk_clist_get_text( GTK_CLIST( CLADrivers ),old_audio_driver,0,(char **)&ao_driver );
     gtk_widget_set_sensitive( AConfig,FALSE );
-#ifdef USE_OSS_AUDIO
-    if ( !strncmp( ao_driver[0],"oss",3 ) ) gtk_widget_set_sensitive( AConfig,TRUE );
-#endif
-#ifdef HAVE_SDL
-    if ( !strncmp( ao_driver[0],"sdl",3 ) ) gtk_widget_set_sensitive( AConfig,TRUE );
-#endif
+    if ( !strncmp( ao_driver[0],"oss",3 ) ||
+         !strncmp( ao_driver[0],"alsa",4 ) ||
+         !strncmp( ao_driver[0],"sdl",3 ) )
+      gtk_widget_set_sensitive( AConfig,TRUE );
    }
  }
 
@@ -465,12 +454,7 @@
  gtk_widget_hide( Preferences );
  gtk_widget_destroy( Preferences );
  Preferences=NULL;
-#ifdef USE_OSS_AUDIO
- HideOSSConfig();
-#endif
-#ifdef HAVE_SDL
- HideSDLConfig();
-#endif
+ HideAudioConfig();
 #ifdef HAVE_DXR3
  HideDXR3Config();
 #endif
@@ -615,12 +599,12 @@
    case bAConfig:
 	if ( !ao_driver[0] ) break;
         gtk_widget_set_sensitive( AConfig,FALSE );
-#ifdef USE_OSS_AUDIO
-        if ( !strncmp( ao_driver[0],"oss",3 ) ) { ShowOSSConfig(); gtk_widget_set_sensitive( AConfig,TRUE ); }
-#endif
-#ifdef HAVE_SDL
-        if ( !strncmp( ao_driver[0],"sdl",3 ) ) { ShowSDLConfig(); gtk_widget_set_sensitive( AConfig,TRUE ); }
-#endif
+        if ( !strncmp( ao_driver[0],"oss",3 ) ||
+             !strncmp( ao_driver[0],"alsa",4 ) ||
+             !strncmp( ao_driver[0],"sdl",3 ) ) {
+          ShowAudioConfig();
+          gtk_widget_set_sensitive( AConfig,TRUE );
+        }
 	break;
    case bVconfig:
 	if ( !vo_driver[0] ) break;
@@ -737,12 +721,10 @@
    case 0: // audio driver 
 	gtk_clist_get_text( GTK_CLIST( CLADrivers ),row,0,(char **)&ao_driver ); 
 	gtk_widget_set_sensitive( AConfig,FALSE );
-#ifdef USE_OSS_AUDIO
-	if ( !strncmp( ao_driver[0],"oss",3 ) ) gtk_widget_set_sensitive( AConfig,TRUE );
-#endif
-#ifdef HAVE_SDL
-	if ( !strncmp( ao_driver[0],"sdl",3 ) ) gtk_widget_set_sensitive( AConfig,TRUE );
-#endif
+	if ( !strncmp( ao_driver[0],"oss",3 ) ||
+	     !strncmp( ao_driver[0],"alsa",4 ) ||
+	     !strncmp( ao_driver[0],"sdl",3 ) )
+	  gtk_widget_set_sensitive( AConfig,TRUE );
 	break;
    case 1: // video driver 
 	gtk_clist_get_text( GTK_CLIST( CLVDrivers ),row,0,(char **)&vo_driver ); 
@@ -1308,273 +1290,308 @@
 }
 
 #ifdef USE_OSS_AUDIO
-       GtkWidget * OSSConfig;
-static GtkWidget * CEOssDevice;
-static GtkWidget * CEOssMixer;
-static GtkWidget * CBOssMixer;
-static GtkWidget * CBOssDevice;
-static GtkWidget * BOssOk;
-static GtkWidget * BOssCancel;
+GList *appendOSSDevices(GList *l) {
+  // careful! the current implementation allows only string constants!
+  l = g_list_append(l, (gpointer)"/dev/dsp");
+  if (gtkAOOSSDevice && strncmp(gtkAOOSSDevice, "/dev/sound", 10) == 0) {
+    l = g_list_append(l, (gpointer)"/dev/sound/dsp0");
+    l = g_list_append(l, (gpointer)"/dev/sound/dsp1");
+    l = g_list_append(l, (gpointer)"/dev/sound/dsp2");
+    l = g_list_append(l, (gpointer)"/dev/sound/dsp3");
+  } else {
+    l = g_list_append(l, (gpointer)"/dev/dsp0");
+    l = g_list_append(l, (gpointer)"/dev/dsp1");
+    l = g_list_append(l, (gpointer)"/dev/dsp2");
+    l = g_list_append(l, (gpointer)"/dev/dsp3");
+  }
+#ifdef HAVE_DXR3
+  l = g_list_append(l, (gpointer)"/dev/em8300_ma");
+  l = g_list_append(l, (gpointer)"/dev/em8300_ma-0");
+  l = g_list_append(l, (gpointer)"/dev/em8300_ma-1");
+  l = g_list_append(l, (gpointer)"/dev/em8300_ma-2");
+  l = g_list_append(l, (gpointer)"/dev/em8300_ma-3");
+#endif
+  return l;
+}
 
-void ShowOSSConfig( void )
-{
- if ( OSSConfig ) gtkActive( OSSConfig );
-   else OSSConfig=create_OSSConfig();
+GList *appendOSSMixers(GList *l) {
+  // careful! the current implementation allows only string constants!
+  l = g_list_append(l, (gpointer)"/dev/mixer");
+  if (gtkAOOSSMixer && strncmp(gtkAOOSSMixer, "/dev/sound", 10) == 0) {
+    l = g_list_append(l, (gpointer)"/dev/sound/mixer0");
+    l = g_list_append(l, (gpointer)"/dev/sound/mixer1");
+    l = g_list_append(l, (gpointer)"/dev/sound/mixer2");
+    l = g_list_append(l, (gpointer)"/dev/sound/mixer3");
+  } else {
+    l = g_list_append(l, (gpointer)"/dev/mixer0");
+    l = g_list_append(l, (gpointer)"/dev/mixer1");
+    l = g_list_append(l, (gpointer)"/dev/mixer2");
+    l = g_list_append(l, (gpointer)"/dev/mixer3");
+  }
+  return l;
+}
 
- gtk_entry_set_text( GTK_ENTRY( CEOssMixer ),gtkAOOSSMixer );
- gtk_entry_set_text( GTK_ENTRY( CEOssDevice ),gtkAOOSSDevice );
+GList *appendOSSMixerChannels(GList *l) {
+  l = g_list_append(l, (gpointer)"vol");
+  l = g_list_append(l, (gpointer)"pcm");
+  l = g_list_append(l, (gpointer)"line");
+  return l;
+}
+#endif
 
- gtk_widget_show( OSSConfig );
- gtkSetLayer( OSSConfig );
+#if defined(HAVE_ALSA9) || defined (HAVE_ALSA1X)
+GList *appendALSADevices(GList *l) {
+  l = g_list_append(l, (gpointer)"default");
+  l = g_list_append(l, (gpointer)"hw#0.0");
+  l = g_list_append(l, (gpointer)"hw#0.1");
+  l = g_list_append(l, (gpointer)"hw#0.2");
+  l = g_list_append(l, (gpointer)"surround40");
+  l = g_list_append(l, (gpointer)"surround51");
+  l = g_list_append(l, (gpointer)"plug:surround40");
+  l = g_list_append(l, (gpointer)"plug:surround51");
+  return l;
+}
+
+GList *appendALSAMixers(GList *l) {
+  l = g_list_append(l, (gpointer)"default");
+  return l;
 }
 
-void HideOSSConfig( void )
-{
- if ( !OSSConfig ) return;
- gtk_widget_hide( OSSConfig );
- gtk_widget_destroy( OSSConfig ); 
- OSSConfig=NULL;
+GList *appendALSAMixerChannels(GList *l) {
+  l = g_list_append(l, (gpointer)"Master");
+  l = g_list_append(l, (gpointer)"Line");
+  l = g_list_append(l, (gpointer)"PCM");
+  return l;
+}
+#endif
+
+#ifdef HAVE_SDL
+GList *appendSDLDevices(GList *l) {
+  l = g_list_append(l, (gpointer)"alsa");
+  l = g_list_append(l, (gpointer)"arts");
+  l = g_list_append(l, (gpointer)"esd");
+  l = g_list_append(l, (gpointer)"jack");
+  l = g_list_append(l, (gpointer)"oss");
+  l = g_list_append(l, (gpointer)"nas");
+  return l;
+}
+#endif
+
+// Gets text string from a gtk entry, interpreting 
+// MSGTR_PREFERENCES_DriverDefault as null string.
+char *getGtkEntryText(GtkWidget *from) {
+  char *tmp = gtk_entry_get_text(GTK_ENTRY(from));
+  if (strcmp(tmp, MSGTR_PREFERENCES_DriverDefault) == 0) {
+    tmp = NULL;
+  }
+  return tmp;
+}
+
+// Sets text string of a gtk entry, interpreting 
+// null string as MSGTR_PREFERENCES_DriverDefault.
+void setGtkEntryText(GtkWidget *dest, char *to) {
+  if (!to) {
+    to = MSGTR_PREFERENCES_DriverDefault;
+  }
+  gtk_entry_set_text(GTK_ENTRY(dest),to);
 }
 
-static void ossButton( GtkButton * button,gpointer user_data )
-{
- switch( (int)user_data )
-  {
-   case 1:
-        gfree( (void **)&gtkAOOSSMixer );  gtkAOOSSMixer=strdup( gtk_entry_get_text( GTK_ENTRY( CEOssMixer ) ) );
-        gfree( (void **)&gtkAOOSSDevice ); gtkAOOSSDevice=strdup( gtk_entry_get_text( GTK_ENTRY( CEOssDevice ) ) );
+       GtkWidget *AudioConfig;
+static GtkWidget *CEAudioDevice;
+static GtkWidget *CBAudioDevice;
+static GtkWidget *CEAudioMixer;
+static GtkWidget *CBAudioMixer;
+static GtkWidget *CEAudioMixerChannel;
+static GtkWidget *CBAudioMixerChannel;
+static GtkWidget *BAudioOk;
+static GtkWidget *BAudioCancel;
+
+void ShowAudioConfig() {
+  if (AudioConfig) gtkActive(AudioConfig);
+  else AudioConfig = create_AudioConfig();
+
+#ifdef USE_OSS_AUDIO
+  if (strncmp(ao_driver[0], "oss", 3) == 0) {
+    setGtkEntryText(CEAudioDevice, gtkAOOSSDevice);
+    setGtkEntryText(CEAudioMixer, gtkAOOSSMixer);
+    setGtkEntryText(CEAudioMixerChannel, gtkAOOSSMixerChannel);
+  }
+#endif
+#if defined(HAVE_ALSA9) || defined (HAVE_ALSA1X)
+  if (strncmp(ao_driver[0], "alsa", 4) == 0) {
+    setGtkEntryText(CEAudioDevice, gtkAOALSADevice);
+    setGtkEntryText(CEAudioMixer, gtkAOALSAMixer);
+    setGtkEntryText(CEAudioMixerChannel, gtkAOALSAMixerChannel);
+  }
+#endif
+#ifdef HAVE_SDL
+  if (strncmp(ao_driver[0], "sdl", 3) == 0) {
+    setGtkEntryText(CEAudioDevice, gtkAOSDLDriver);
+  }
+#endif
+
+  gtk_widget_show(AudioConfig);
+  gtkSetLayer(AudioConfig);
+}
+
+void HideAudioConfig() {
+  if (!AudioConfig) return;
+  gtk_widget_hide(AudioConfig);
+  gtk_widget_destroy(AudioConfig); 
+  AudioConfig=NULL;
+}
+
+static void audioButton(GtkButton *button, gpointer user_data) {
+  switch( (int)user_data ) {
+    case 1:
+#ifdef USE_OSS_AUDIO
+      if (strncmp(ao_driver[0], "oss", 3) == 0) {
+        gfree(&gtkAOOSSDevice);
+        gtkAOOSSDevice = gstrdup(getGtkEntryText(CEAudioDevice));
+        gfree(&gtkAOOSSMixer);
+        gtkAOOSSMixer = gstrdup(getGtkEntryText(CEAudioMixer));
+        gfree(&gtkAOOSSMixerChannel);
+        gtkAOOSSMixer = gstrdup(getGtkEntryText(CEAudioMixerChannel));
+      }
+#endif
+#if defined(HAVE_ALSA9) || defined (HAVE_ALSA1X)
+      if (strncmp(ao_driver[0], "alsa", 4) == 0) {
+        gfree(&gtkAOALSADevice);
+        gtkAOALSADevice = gstrdup(getGtkEntryText(CEAudioDevice));
+        gfree(&gtkAOALSAMixer);
+        gtkAOALSAMixer = gstrdup(getGtkEntryText(CEAudioMixer));
+        gfree(&gtkAOALSAMixerChannel);
+        gtkAOALSAMixer = gstrdup(getGtkEntryText(CEAudioMixerChannel));
+      }
+#endif
+#ifdef HAVE_SDL
+      if (strncmp(ao_driver[0], "sdl", 3) == 0) {
+        gfree(&gtkAOSDLDriver);
+        gtkAOSDLDriver = gstrdup(getGtkEntryText(CEAudioDevice));
+      }
+#endif
    case 0:
-	HideOSSConfig();
-	break;
+      HideAudioConfig();
+      break;
   }
 }
 
-GtkWidget * create_OSSConfig( void )
-{
-  GList     * CBOssDevice_items=NULL;
-  GList     * CBOssMixer_items=NULL;
-  GtkWidget * vbox604;
-  GtkWidget * table2;
-  GtkWidget * label;
-  GtkWidget * hbuttonbox6;
-  GtkAccelGroup * accel_group;
+GtkWidget *create_AudioConfig() {
+  GList *items = NULL;
+  GtkWidget *vbox;
+  GtkWidget *table;
+  GtkWidget *label;
+  GtkWidget *hbuttonbox;
+  GtkAccelGroup *accel_group;
 
-  accel_group=gtk_accel_group_new();
+  AudioConfig = gtk_window_new(GTK_WINDOW_TOPLEVEL);
+  gtk_widget_set_name(AudioConfig, "AudioConfig");
+  gtk_object_set_data(GTK_OBJECT(AudioConfig), "AudioConfig", AudioConfig);
+  gtk_window_set_title(GTK_WINDOW(AudioConfig), MSGTR_AudioPreferences);
+  gtk_window_set_position(GTK_WINDOW(AudioConfig), GTK_WIN_POS_CENTER);
+  gtk_window_set_policy(GTK_WINDOW(AudioConfig), FALSE, FALSE, FALSE);
+  gtk_window_set_wmclass(GTK_WINDOW(AudioConfig), "Audio Config", "MPlayer");
+
+  gtk_widget_realize(AudioConfig);
+  gtkAddIcon(AudioConfig);
+
+  vbox = AddVBox(AddDialogFrame(AudioConfig), 0);
+
+  table = gtk_table_new(2, 3, FALSE);
+  gtk_widget_set_name(table, "table");
+  gtk_widget_show(table);
+  gtk_box_pack_start(GTK_BOX(vbox), table, TRUE, TRUE, 0);
 
-  OSSConfig=gtk_window_new( GTK_WINDOW_TOPLEVEL );
-  gtk_widget_set_name( OSSConfig,"OSSConfig" );
-  gtk_object_set_data( GTK_OBJECT( OSSConfig ),"OSSConfig",OSSConfig );
-  gtk_widget_set_usize( OSSConfig,270,92 );
-  gtk_window_set_title( GTK_WINDOW( OSSConfig ),MSGTR_OSSPreferences );
-  gtk_window_set_position( GTK_WINDOW( OSSConfig ),GTK_WIN_POS_CENTER );
-  gtk_window_set_policy( GTK_WINDOW( OSSConfig ),FALSE,FALSE,FALSE );
-  gtk_window_set_wmclass( GTK_WINDOW( OSSConfig ),"OSS Config","MPlayer" );
-
-  gtk_widget_realize( OSSConfig );
-  gtkAddIcon( OSSConfig );
-
-  vbox604=AddVBox( AddDialogFrame( OSSConfig ),0 );
+  label = AddLabel(MSGTR_PREFERENCES_Audio_Device, NULL);
+  gtk_table_attach(GTK_TABLE(table), label, 0, 1, 0, 1, (GtkAttachOptions)(GTK_FILL), (GtkAttachOptions)(0), 0, 0);
 
-  table2=gtk_table_new( 2,2,FALSE );
-  gtk_widget_set_name( table2,"table2" );
-  gtk_widget_show( table2 );
-  gtk_box_pack_start( GTK_BOX( vbox604 ),table2,TRUE,TRUE,0 );
+  CBAudioDevice = AddComboBox(NULL);
+  gtk_table_attach(GTK_TABLE(table), CBAudioDevice, 1, 2, 0, 1, (GtkAttachOptions)(GTK_EXPAND | GTK_FILL), (GtkAttachOptions)(0), 0, 0);
+  items = g_list_append(items,(gpointer)MSGTR_PREFERENCES_DriverDefault);
+#ifdef USE_OSS_AUDIO
+  if (strncmp(ao_driver[0], "oss", 3) == 0)
+    items = appendOSSDevices(items);
+#endif
+#if defined(HAVE_ALSA9) || defined (HAVE_ALSA1X)
+  if (strncmp(ao_driver[0], "alsa", 4) == 0)
+    items = appendALSADevices(items);
+#endif
+#ifdef HAVE_SDL
+  if (strncmp(ao_driver[0], "sdl", 3) == 0)
+    items = appendSDLDevices(items);
+#endif
+  gtk_combo_set_popdown_strings(GTK_COMBO(CBAudioDevice), items);
+  g_list_free(items);
+  items = NULL;
 
-  label=AddLabel( MSGTR_PREFERENCES_OSS_Device,NULL );
-    gtk_table_attach( GTK_TABLE( table2 ),label,0,1,0,1,(GtkAttachOptions)( GTK_FILL ),(GtkAttachOptions)( 0 ),0,0 );
+  CEAudioDevice = GTK_COMBO(CBAudioDevice)->entry;
+  gtk_widget_set_name(CEAudioDevice, "CEAudioDevice");
+  gtk_widget_show(CEAudioDevice);
 
-  label=AddLabel( MSGTR_PREFERENCES_OSS_Mixer,NULL );
-    gtk_table_attach( GTK_TABLE( table2 ),label,0,1,1,2,(GtkAttachOptions)( GTK_FILL ),(GtkAttachOptions)( 0 ),0,0 );
-
-  CBOssDevice=AddComboBox( NULL );
-    gtk_table_attach( GTK_TABLE( table2 ),CBOssDevice,1,2,0,1,(GtkAttachOptions)( GTK_EXPAND | GTK_FILL ),(GtkAttachOptions)( 0 ),0,0 );
+  label = AddLabel(MSGTR_PREFERENCES_Audio_Mixer, NULL);
+  gtk_table_attach(GTK_TABLE(table), label, 0, 1, 1, 2, (GtkAttachOptions)(GTK_FILL), (GtkAttachOptions)(0), 0, 0);
 
-  CBOssDevice_items=g_list_append( CBOssDevice_items,(gpointer)"/dev/dsp" );
-  if ( gtkAOOSSDevice && !strncmp( gtkAOOSSDevice,"/dev/sound",10 ) )
-   {
-    CBOssDevice_items=g_list_append( CBOssDevice_items,(gpointer)"/dev/sound/dsp0" );
-    CBOssDevice_items=g_list_append( CBOssDevice_items,(gpointer)"/dev/sound/dsp1" );
-    CBOssDevice_items=g_list_append( CBOssDevice_items,(gpointer)"/dev/sound/dsp2" );
-    CBOssDevice_items=g_list_append( CBOssDevice_items,(gpointer)"/dev/sound/dsp3" );
-   }
-   else
-    {
-     CBOssDevice_items=g_list_append( CBOssDevice_items,(gpointer)"/dev/dsp0" );
-     CBOssDevice_items=g_list_append( CBOssDevice_items,(gpointer)"/dev/dsp1" );
-     CBOssDevice_items=g_list_append( CBOssDevice_items,(gpointer)"/dev/dsp2" );
-     CBOssDevice_items=g_list_append( CBOssDevice_items,(gpointer)"/dev/dsp3" );
-    }
-#ifdef HAVE_DXR3
-  CBOssDevice_items=g_list_append( CBOssDevice_items,(gpointer)"/dev/em8300_ma" );
-  CBOssDevice_items=g_list_append( CBOssDevice_items,(gpointer)"/dev/em8300_ma-0" );
-  CBOssDevice_items=g_list_append( CBOssDevice_items,(gpointer)"/dev/em8300_ma-1" );
-  CBOssDevice_items=g_list_append( CBOssDevice_items,(gpointer)"/dev/em8300_ma-2" );
-  CBOssDevice_items=g_list_append( CBOssDevice_items,(gpointer)"/dev/em8300_ma-3" );
+  CBAudioMixer = AddComboBox(NULL);
+  gtk_table_attach(GTK_TABLE(table), CBAudioMixer, 1, 2, 1, 2, (GtkAttachOptions)(GTK_EXPAND | GTK_FILL), (GtkAttachOptions)(0), 0, 0);
+  items = g_list_append(items, (gpointer)MSGTR_PREFERENCES_DriverDefault);
+#ifdef USE_OSS_AUDIO
+  if (strncmp(ao_driver[0], "oss", 3) == 0)
+    items = appendOSSMixers(items);
+#endif
+#if defined(HAVE_ALSA9) || defined (HAVE_ALSA1X)
+  if (strncmp(ao_driver[0], "alsa", 4) == 0)
+    items = appendALSAMixers(items);
 #endif
-  gtk_combo_set_popdown_strings( GTK_COMBO( CBOssDevice ),CBOssDevice_items );
-  g_list_free( CBOssDevice_items );
+  gtk_combo_set_popdown_strings(GTK_COMBO(CBAudioMixer), items);
+  g_list_free(items);
+  items = NULL;
 
-  CEOssDevice=GTK_COMBO( CBOssDevice )->entry;
-  gtk_widget_set_name( CEOssDevice,"CEOssDevice" );
-  gtk_widget_show( CEOssDevice );
+  CEAudioMixer = GTK_COMBO(CBAudioMixer)->entry;
+  gtk_widget_set_name(CEAudioMixer, "CEAudioMixer");
+  gtk_widget_show(CEAudioMixer);
+
+  label = AddLabel(MSGTR_PREFERENCES_Audio_MixerChannel, NULL);
+  gtk_table_attach(GTK_TABLE(table), label, 0, 1, 2, 3, (GtkAttachOptions)(GTK_FILL), (GtkAttachOptions)(0), 0, 0);
 
-  CBOssMixer=AddComboBox( NULL );
-    gtk_table_attach( GTK_TABLE( table2 ),CBOssMixer,1,2,1,2,(GtkAttachOptions)( GTK_EXPAND | GTK_FILL ),(GtkAttachOptions)( 0 ),0,0 );
-  CBOssMixer_items=g_list_append( CBOssMixer_items,(gpointer)"/dev/mixer" );
-  if ( gtkAOOSSMixer && !strncmp( gtkAOOSSMixer,"/dev/sound",10 ) )
-   {
-    CBOssMixer_items=g_list_append( CBOssMixer_items,(gpointer)"/dev/sound/mixer0" );
-    CBOssMixer_items=g_list_append( CBOssMixer_items,(gpointer)"/dev/sound/mixer1" );
-    CBOssMixer_items=g_list_append( CBOssMixer_items,(gpointer)"/dev/sound/mixer2" );
-    CBOssMixer_items=g_list_append( CBOssMixer_items,(gpointer)"/dev/sound/mixer3" );
-   }
-   else
-    {
-     CBOssMixer_items=g_list_append( CBOssMixer_items,(gpointer)"/dev/mixer0" );
-     CBOssMixer_items=g_list_append( CBOssMixer_items,(gpointer)"/dev/mixer1" );
-     CBOssMixer_items=g_list_append( CBOssMixer_items,(gpointer)"/dev/mixer2" );
-     CBOssMixer_items=g_list_append( CBOssMixer_items,(gpointer)"/dev/mixer3" );
-    }
-  gtk_combo_set_popdown_strings( GTK_COMBO( CBOssMixer ),CBOssMixer_items );
-  g_list_free( CBOssMixer_items );
+  CBAudioMixerChannel = AddComboBox(NULL);
+  gtk_table_attach(GTK_TABLE(table), CBAudioMixerChannel, 1, 2, 2, 3, (GtkAttachOptions)(GTK_EXPAND | GTK_FILL), (GtkAttachOptions)(0), 0, 0);
+  items = g_list_append(items, (gpointer)MSGTR_PREFERENCES_DriverDefault);
+#ifdef USE_OSS_AUDIO
+  if (strncmp(ao_driver[0], "oss", 3) == 0)
+    items = appendOSSMixerChannels(items);
+#endif
+#if defined(HAVE_ALSA9) || defined (HAVE_ALSA1X)
+  if (strncmp(ao_driver[0], "alsa", 4) == 0)
+    items = appendALSAMixerChannels(items);
+#endif
+  gtk_combo_set_popdown_strings(GTK_COMBO(CBAudioMixerChannel), items);
+  g_list_free(items);
+  items = NULL;
+
+  CEAudioMixerChannel = GTK_COMBO(CBAudioMixerChannel)->entry;
+  gtk_widget_set_name(CEAudioMixerChannel, "CEAudioMixerChannel");
+  gtk_widget_show(CEAudioMixerChannel);
 
-  CEOssMixer=GTK_COMBO( CBOssMixer )->entry;
-  gtk_widget_set_name( CEOssMixer,"CEOssMixer" );
-  gtk_widget_show( CEOssMixer );
-
-  AddHSeparator( vbox604 );
+  AddHSeparator(vbox);
 
-  hbuttonbox6=AddHButtonBox( vbox604 );
-    gtk_button_box_set_layout( GTK_BUTTON_BOX( hbuttonbox6 ),GTK_BUTTONBOX_END );
-    gtk_button_box_set_spacing( GTK_BUTTON_BOX( hbuttonbox6 ),10 );
-  BOssOk=AddButton( MSGTR_Ok,hbuttonbox6 );
-  BOssCancel=AddButton( MSGTR_Cancel,hbuttonbox6 );
+  hbuttonbox = AddHButtonBox(vbox);
+  gtk_button_box_set_layout(GTK_BUTTON_BOX(hbuttonbox), GTK_BUTTONBOX_END);
+  gtk_button_box_set_spacing(GTK_BUTTON_BOX(hbuttonbox), 10);
+  BAudioOk = AddButton(MSGTR_Ok, hbuttonbox);
+  BAudioCancel = AddButton(MSGTR_Cancel, hbuttonbox);
 
-  gtk_signal_connect( GTK_OBJECT( OSSConfig ),"destroy",GTK_SIGNAL_FUNC( WidgetDestroy ),&OSSConfig );
-  
-  gtk_signal_connect( GTK_OBJECT( BOssOk ),"clicked",GTK_SIGNAL_FUNC( ossButton ),(void*)1 );
-  gtk_signal_connect( GTK_OBJECT( BOssCancel ),"clicked",GTK_SIGNAL_FUNC( ossButton ),(void*)0 );
+  gtk_signal_connect(GTK_OBJECT(AudioConfig), "destroy", GTK_SIGNAL_FUNC(WidgetDestroy), &AudioConfig);
+  gtk_signal_connect(GTK_OBJECT(BAudioOk), "clicked", GTK_SIGNAL_FUNC(audioButton), (void*)1);
+  gtk_signal_connect(GTK_OBJECT(BAudioCancel), "clicked", GTK_SIGNAL_FUNC(audioButton), (void*)0);
 
-  gtk_widget_add_accelerator( BOssOk,"clicked",accel_group,GDK_Return,0,GTK_ACCEL_VISIBLE );
-  gtk_widget_add_accelerator( BOssCancel,"clicked",accel_group,GDK_Escape,0,GTK_ACCEL_VISIBLE );
+  accel_group = gtk_accel_group_new();
+  gtk_widget_add_accelerator(BAudioOk, "clicked", accel_group, GDK_Return, 0, GTK_ACCEL_VISIBLE);
+  gtk_widget_add_accelerator(BAudioCancel, "clicked", accel_group, GDK_Escape, 0, GTK_ACCEL_VISIBLE);
+  gtk_window_add_accel_group(GTK_WINDOW(AudioConfig), accel_group);
 
-  gtk_window_add_accel_group( GTK_WINDOW( OSSConfig ),accel_group );
-
-  return OSSConfig;
+  return AudioConfig;
 }
 
-#endif
-
-#ifdef HAVE_SDL
-       GtkWidget * SDLConfig;
-static GtkWidget * CESDLDriver;
-static GtkWidget * CBSDLDriver;
-static GtkWidget * BSDLOk;
-static GtkWidget * BSDLCancel;
-
-void ShowSDLConfig( void )
-{
- if ( SDLConfig ) gtkActive( SDLConfig );
-   else SDLConfig=create_SDLConfig();
-
- if ( gtkAOSDLDriver )
-   gtk_entry_set_text( GTK_ENTRY( CESDLDriver ), gtkAOSDLDriver );
-
- gtk_widget_show( SDLConfig );
- gtkSetLayer( SDLConfig );
-}
-
-void HideSDLConfig( void )
-{
- if ( !SDLConfig ) return;
- gtk_widget_hide( SDLConfig );
- gtk_widget_destroy( SDLConfig ); 
- SDLConfig=NULL;
-}
-
-static void sdlButton( GtkButton * button,gpointer user_data )
-{
- switch( (int)user_data )
-  {
-   case 1:
-        gfree( (void **)&gtkAOSDLDriver );  gtkAOSDLDriver=strdup( gtk_entry_get_text( GTK_ENTRY( CESDLDriver ) ) );
-   case 0:
-	HideSDLConfig();
-	break;
-  }
-}
-
-GtkWidget * create_SDLConfig( void )
-{
-  GList     * CBSDLDriver_items=NULL;
-  GtkWidget * vbox604;
-  GtkWidget * table2;
-  GtkWidget * label;
-  GtkWidget * hbuttonbox6;
-  GtkAccelGroup * accel_group;
-
-  accel_group=gtk_accel_group_new();
-
-  SDLConfig=gtk_window_new( GTK_WINDOW_TOPLEVEL );
-  gtk_widget_set_name( SDLConfig,"SDLConfig" );
-  gtk_object_set_data( GTK_OBJECT( SDLConfig ),"SDLConfig",SDLConfig );
-  gtk_widget_set_usize( SDLConfig,270,70 );
-  gtk_window_set_title( GTK_WINDOW( SDLConfig ),MSGTR_SDLPreferences );
-  gtk_window_set_position( GTK_WINDOW( SDLConfig ),GTK_WIN_POS_CENTER );
-  gtk_window_set_policy( GTK_WINDOW( SDLConfig ),FALSE,FALSE,FALSE );
-  gtk_window_set_wmclass( GTK_WINDOW( SDLConfig ),"SDL Config","MPlayer" );
-
-  gtk_widget_realize( SDLConfig );
-  gtkAddIcon( SDLConfig );
-
-  vbox604=AddVBox( AddDialogFrame( SDLConfig ),0 );
-
-  table2=gtk_table_new( 2,2,FALSE );
-  gtk_widget_set_name( table2,"table2" );
-  gtk_widget_show( table2 );
-  gtk_box_pack_start( GTK_BOX( vbox604 ),table2,TRUE,TRUE,0 );
-
-  label=AddLabel( MSGTR_PREFERENCES_SDL_Driver,NULL );
-    gtk_table_attach( GTK_TABLE( table2 ),label,0,1,0,1,(GtkAttachOptions)( GTK_FILL ),(GtkAttachOptions)( 0 ),0,0 );
-
-  CBSDLDriver=AddComboBox( NULL );
-  gtk_table_attach( GTK_TABLE( table2 ),CBSDLDriver,1,2,0,1,(GtkAttachOptions)( GTK_EXPAND | GTK_FILL ),(GtkAttachOptions)( 0 ),0,0 );
-  CBSDLDriver_items=g_list_append( CBSDLDriver_items,(gpointer) NULL );
-  CBSDLDriver_items=g_list_append( CBSDLDriver_items,(gpointer)"alsa" );
-  CBSDLDriver_items=g_list_append( CBSDLDriver_items,(gpointer)"arts" );
-  CBSDLDriver_items=g_list_append( CBSDLDriver_items,(gpointer)"esd" );
-  CBSDLDriver_items=g_list_append( CBSDLDriver_items,(gpointer)"jack" );
-  CBSDLDriver_items=g_list_append( CBSDLDriver_items,(gpointer)"oss" );
-  CBSDLDriver_items=g_list_append( CBSDLDriver_items,(gpointer)"nas" );
-  gtk_combo_set_popdown_strings( GTK_COMBO( CBSDLDriver ),CBSDLDriver_items );
-  g_list_free( CBSDLDriver_items );
-
-  CESDLDriver=GTK_COMBO( CBSDLDriver )->entry;
-  gtk_widget_set_name( CESDLDriver,"CESDLDriver" );
-  gtk_widget_show( CESDLDriver );
-
-  AddHSeparator( vbox604 );
-
-  hbuttonbox6=AddHButtonBox( vbox604 );
-    gtk_button_box_set_layout( GTK_BUTTON_BOX( hbuttonbox6 ),GTK_BUTTONBOX_END );
-    gtk_button_box_set_spacing( GTK_BUTTON_BOX( hbuttonbox6 ),10 );
-  BSDLOk=AddButton( MSGTR_Ok,hbuttonbox6 );
-  BSDLCancel=AddButton( MSGTR_Cancel,hbuttonbox6 );
-
-  gtk_signal_connect( GTK_OBJECT( SDLConfig ),"destroy",GTK_SIGNAL_FUNC( WidgetDestroy ),&SDLConfig );
-  
-  gtk_signal_connect( GTK_OBJECT( BSDLOk ),"clicked",GTK_SIGNAL_FUNC( sdlButton ),(void*)1 );
-  gtk_signal_connect( GTK_OBJECT( BSDLCancel ),"clicked",GTK_SIGNAL_FUNC( sdlButton ),(void*)0 );
-
-  gtk_widget_add_accelerator( BSDLOk,"clicked",accel_group,GDK_Return,0,GTK_ACCEL_VISIBLE );
-  gtk_widget_add_accelerator( BSDLCancel,"clicked",accel_group,GDK_Escape,0,GTK_ACCEL_VISIBLE );
-
-  gtk_window_add_accel_group( GTK_WINDOW( SDLConfig ),accel_group );
-
-  return SDLConfig;
-}
-#endif
-
 #ifdef HAVE_DXR3
 // --- dxr3 config box
 
--- a/Gui/mplayer/gtk/opts.h	Fri Jul 30 11:17:21 2004 +0000
+++ b/Gui/mplayer/gtk/opts.h	Fri Jul 30 15:58:36 2004 +0000
@@ -4,22 +4,12 @@
 
 #include <gtk/gtk.h>
 
-#ifdef USE_OSS_AUDIO
-extern GtkWidget * OSSConfig;
-#endif
-#ifdef HAVE_SDL
-extern GtkWidget * SDLConfig;
-#endif
+extern GtkWidget * AudioConfig;
 extern GtkWidget * Preferences;
 extern GtkWidget * prEFontName;
 
 extern GtkWidget * create_Preferences( void );
-#ifdef USE_OSS_AUDIO
-extern GtkWidget * create_OSSConfig( void );
-#endif
-#ifdef HAVE_SDL
-extern GtkWidget * create_SDLConfig( void );
-#endif
+extern GtkWidget * create_AudioConfig( void );
 
 extern void ShowPreferences( void );
 
--- a/help/help_mp-en.h	Fri Jul 30 11:17:21 2004 +0000
+++ b/help/help_mp-en.h	Fri Jul 30 15:58:36 2004 +0000
@@ -387,8 +387,7 @@
 #define MSGTR_SkinBrowser "Skin Browser"
 #define MSGTR_Network "Network streaming..."
 #define MSGTR_Preferences "Preferences"
-#define MSGTR_OSSPreferences "OSS driver configuration"
-#define MSGTR_SDLPreferences "SDL driver configuration"
+#define MSGTR_AudioPreferences "Audio driver configuration"
 #define MSGTR_NoMediaOpened "No media opened."
 #define MSGTR_VCDTrack "VCD track %d"
 #define MSGTR_NoChapter "No chapter"
@@ -513,6 +512,7 @@
 #define MSGTR_PREFERENCES_Misc "Misc"
 
 #define MSGTR_PREFERENCES_None "None"
+#define MSGTR_PREFERENCES_DriverDefault "driver default"
 #define MSGTR_PREFERENCES_AvailableDrivers "Available drivers:"
 #define MSGTR_PREFERENCES_DoNotPlaySound "Do not play sound"
 #define MSGTR_PREFERENCES_NormalizeSound "Normalize sound"
@@ -553,9 +553,9 @@
 #define MSGTR_PREFERENCES_FRAME_CodecDemuxer "Codec & demuxer"
 #define MSGTR_PREFERENCES_FRAME_Cache "Cache"
 #define MSGTR_PREFERENCES_FRAME_Misc "Misc"
-#define MSGTR_PREFERENCES_OSS_Device "Device:"
-#define MSGTR_PREFERENCES_OSS_Mixer "Mixer:"
-#define MSGTR_PREFERENCES_SDL_Driver "Driver:"
+#define MSGTR_PREFERENCES_Audio_Device "Device:"
+#define MSGTR_PREFERENCES_Audio_Mixer "Mixer:"
+#define MSGTR_PREFERENCES_Audio_MixerChannel "Mixer channel:"
 #define MSGTR_PREFERENCES_Message "Please remember that you need to restart playback for some options to take effect!"
 #define MSGTR_PREFERENCES_DXR3_VENC "Video encoder:"
 #define MSGTR_PREFERENCES_DXR3_LAVC "Use LAVC (FFmpeg)"