changeset 8714:a88f827ec563

SDL Audio configure window from Filip Kalinski <filon@pld.org.pl>
author pontscho
date Thu, 02 Jan 2003 12:42:32 +0000
parents d9639f835ecf
children 165d62ad8155
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 help/help_mp-pl.h
diffstat 7 files changed, 153 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/Gui/cfg.c	Thu Jan 02 12:33:06 2003 +0000
+++ b/Gui/cfg.c	Thu Jan 02 12:42:32 2003 +0000
@@ -40,6 +40,9 @@
 char * gtkAOOSSMixer;
 char * gtkAOOSSDevice;
 #endif
+#ifdef HAVE_SDL
+char * gtkAOSDLDriver;
+#endif
 
 int    gtkCacheOn = 0;
 int    gtkCacheSize = 2048;
@@ -102,6 +105,9 @@
  { "ao_oss_mixer",&gtkAOOSSMixer,CONF_TYPE_STRING,0,0,0,NULL },
  { "ao_oss_device",&gtkAOOSSDevice,CONF_TYPE_STRING,0,0,0,NULL },
 #endif
+#ifdef HAVE_SDL
+ { "ao_sdl_subdriver",&gtkAOSDLDriver,CONF_TYPE_STRING,0,0,0,NULL },
+#endif
  
  { "osd_level",&osd_level,CONF_TYPE_INT,CONF_RANGE,0,2,NULL },
  { "sub_auto_load",&sub_auto,CONF_TYPE_FLAG,0,0,1,NULL },
--- a/Gui/cfg.h	Thu Jan 02 12:33:06 2003 +0000
+++ b/Gui/cfg.h	Thu Jan 02 12:42:32 2003 +0000
@@ -17,6 +17,9 @@
 extern char * gtkAOOSSMixer;
 extern char * gtkAOOSSDevice;
 #endif
+#ifdef HAVE_SDL
+extern char * gtkAOSDLDriver;
+#endif
 #ifdef HAVE_DXR3
 extern char * gtkDXR3Device;
 #endif
--- a/Gui/interface.c	Thu Jan 02 12:33:06 2003 +0000
+++ b/Gui/interface.c	Thu Jan 02 12:42:32 2003 +0000
@@ -702,7 +702,14 @@
 	  gaddlist( &audio_driver_list,tmp );
 	 }
 #endif
-
+#ifdef HAVE_SDL
+	if ( audio_driver_list && !gstrncmp( audio_driver_list[0],"sdl",3 ) && gtkAOSDLDriver )
+	 {
+	  char * tmp = calloc( 1,strlen( gtkAOSDLDriver ) + 10 );
+	  sprintf( tmp,"sdl:%s",gtkAOSDLDriver );
+	  gaddlist( &audio_driver_list,tmp );
+	 }
+#endif
 // -- subtitle
 #ifdef USE_SUB
 	sub_name=gstrdup( guiIntfStruct.Subtitlename );
--- a/Gui/mplayer/gtk/opts.c	Thu Jan 02 12:33:06 2003 +0000
+++ b/Gui/mplayer/gtk/opts.c	Thu Jan 02 12:42:32 2003 +0000
@@ -146,6 +146,10 @@
  void ShowDXR3Config( void );
  void HideDXR3Config( void );
 #endif
+#ifdef HAVE_SDL
+ void ShowSDLConfig( void );
+ void HideSDLConfig( void );
+#endif
 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 );
@@ -198,6 +202,9 @@
 #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
    }
  }
 
@@ -400,6 +407,9 @@
 #ifdef USE_OSS_AUDIO
  HideOSSConfig();
 #endif
+#ifdef HAVE_SDL
+ HideSDLConfig();
+#endif
 #ifdef HAVE_DXR3
  HideDXR3Config();
 #endif
@@ -518,6 +528,9 @@
 #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
 	break;
    case bVconfig:
 	if ( !vo_driver[0] ) break;
@@ -624,6 +637,9 @@
 #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
 	break;
    case 1: // video driver 
 	gtk_clist_get_text( GTK_CLIST( CLVDrivers ),row,0,(char **)&vo_driver ); 
@@ -1232,6 +1248,116 @@
 
 #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( gtk_widget_destroyed ),&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	Thu Jan 02 12:33:06 2003 +0000
+++ b/Gui/mplayer/gtk/opts.h	Thu Jan 02 12:42:32 2003 +0000
@@ -7,6 +7,9 @@
 #ifdef USE_OSS_AUDIO
 extern GtkWidget * OSSConfig;
 #endif
+#ifdef HAVE_SDL
+extern GtkWidget * SDLConfig;
+#endif
 extern GtkWidget * Preferences;
 extern GtkWidget * prEFontName;
 
@@ -14,6 +17,9 @@
 #ifdef USE_OSS_AUDIO
 extern GtkWidget * create_OSSConfig( void );
 #endif
+#ifdef HAVE_SDL
+extern GtkWidget * create_SDLConfig( void );
+#endif
 
 extern void ShowPreferences( void );
 
--- a/help/help_mp-en.h	Thu Jan 02 12:33:06 2003 +0000
+++ b/help/help_mp-en.h	Thu Jan 02 12:42:32 2003 +0000
@@ -302,6 +302,7 @@
 #define MSGTR_Network "Network streaming ..."
 #define MSGTR_Preferences "Preferences"
 #define MSGTR_OSSPreferences "OSS driver configuration"
+#define MSGTR_SDLPreferences "SDL driver configuration"
 #define MSGTR_NoMediaOpened "No media opened."
 #define MSGTR_VCDTrack "VCD track %d"
 #define MSGTR_NoChapter "No chapter"
@@ -458,6 +459,7 @@
 #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_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)"
--- a/help/help_mp-pl.h	Thu Jan 02 12:33:06 2003 +0000
+++ b/help/help_mp-pl.h	Thu Jan 02 12:42:32 2003 +0000
@@ -301,6 +301,7 @@
 #define MSGTR_Network "Strumień sieciowy ..."
 #define MSGTR_Preferences "Preferencje"
 #define MSGTR_OSSPreferences "Konfiguracja sterownika OSS"
+#define MSGTR_SDLPreferences "Konfiguracja sterownika audio SDL"
 #define MSGTR_NoMediaOpened "Nie otwarto nośnika"
 #define MSGTR_VCDTrack "Ścieżka VCD: %d"
 #define MSGTR_NoChapter "Brak rozdziału"
@@ -457,6 +458,7 @@
 #define MSGTR_PREFERENCES_FRAME_Misc "Różne"
 #define MSGTR_PREFERENCES_OSS_Device "Urządzenie:"
 #define MSGTR_PREFERENCES_OSS_Mixer "Mikser:"
+#define MSGTR_PREFERENCES_SDL_Driver "Sterownik:"
 #define MSGTR_PREFERENCES_Message "Proszę pamiętać, że niektóre funkcje wymagaja restartowania odtwarzania."
 #define MSGTR_PREFERENCES_DXR3_VENC "Enkoder Video:"
 #define MSGTR_PREFERENCES_DXR3_LAVC "Użyj LAVC (ffmpeg)"