aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar pontscho <pontscho@b3059339-0415-0410-9bf9-f77b7e298cf2>2003-01-02 12:42:32 +0000
committerGravatar pontscho <pontscho@b3059339-0415-0410-9bf9-f77b7e298cf2>2003-01-02 12:42:32 +0000
commit7f19673a84ed6c1a53757aacd4f3a2378fb57e63 (patch)
treeabb3fcf77c4acb07b115fd6ab79c0f7b4cad56d0
parent7c39b3d00693f1d91514fc9ad031d3cf30541f53 (diff)
SDL Audio configure window from Filip Kalinski <filon@pld.org.pl>
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@8715 b3059339-0415-0410-9bf9-f77b7e298cf2
-rw-r--r--Gui/cfg.c6
-rw-r--r--Gui/cfg.h3
-rw-r--r--Gui/interface.c9
-rw-r--r--Gui/mplayer/gtk/opts.c126
-rw-r--r--Gui/mplayer/gtk/opts.h6
-rw-r--r--help/help_mp-en.h2
-rw-r--r--help/help_mp-pl.h2
7 files changed, 153 insertions, 1 deletions
diff --git a/Gui/cfg.c b/Gui/cfg.c
index cf7934ce4f..025f6de107 100644
--- a/Gui/cfg.c
+++ b/Gui/cfg.c
@@ -40,6 +40,9 @@ float gtkAOExtraStereoMul = 1.0;
char * gtkAOOSSMixer;
char * gtkAOOSSDevice;
#endif
+#ifdef HAVE_SDL
+char * gtkAOSDLDriver;
+#endif
int gtkCacheOn = 0;
int gtkCacheSize = 2048;
@@ -102,6 +105,9 @@ static config_t gui_opts[] =
{ "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 },
diff --git a/Gui/cfg.h b/Gui/cfg.h
index 008c87b816..f551dbeca7 100644
--- a/Gui/cfg.h
+++ b/Gui/cfg.h
@@ -17,6 +17,9 @@ extern float gtkAOExtraStereoMul;
extern char * gtkAOOSSMixer;
extern char * gtkAOOSSDevice;
#endif
+#ifdef HAVE_SDL
+extern char * gtkAOSDLDriver;
+#endif
#ifdef HAVE_DXR3
extern char * gtkDXR3Device;
#endif
diff --git a/Gui/interface.c b/Gui/interface.c
index 9c62c28388..e8cb0f939c 100644
--- a/Gui/interface.c
+++ b/Gui/interface.c
@@ -702,7 +702,14 @@ int guiGetEvent( int type,char * arg )
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 );
diff --git a/Gui/mplayer/gtk/opts.c b/Gui/mplayer/gtk/opts.c
index 0a5648258d..e278100edc 100644
--- a/Gui/mplayer/gtk/opts.c
+++ b/Gui/mplayer/gtk/opts.c
@@ -146,6 +146,10 @@ static int old_video_driver = 0;
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 @@ void ShowPreferences( void )
#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 @@ void HidePreferences( void )
#ifdef USE_OSS_AUDIO
HideOSSConfig();
#endif
+#ifdef HAVE_SDL
+ HideSDLConfig();
+#endif
#ifdef HAVE_DXR3
HideDXR3Config();
#endif
@@ -518,6 +528,9 @@ void prButton( GtkButton * button,gpointer user_data )
#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 @@ static void prCListRow( GtkCList * clist,gint row,gint column,GdkEvent * event,g
#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 @@ GtkWidget * create_OSSConfig( void )
#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
diff --git a/Gui/mplayer/gtk/opts.h b/Gui/mplayer/gtk/opts.h
index 3551c83e6f..12c37f73d8 100644
--- a/Gui/mplayer/gtk/opts.h
+++ b/Gui/mplayer/gtk/opts.h
@@ -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 @@ 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 void ShowPreferences( void );
diff --git a/help/help_mp-en.h b/help/help_mp-en.h
index 6e98fb5544..a20d864075 100644
--- a/help/help_mp-en.h
+++ b/help/help_mp-en.h
@@ -302,6 +302,7 @@ static char help_text[]=
#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 @@ static char help_text[]=
#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)"
diff --git a/help/help_mp-pl.h b/help/help_mp-pl.h
index 909befba23..5fd8c6fc09 100644
--- a/help/help_mp-pl.h
+++ b/help/help_mp-pl.h
@@ -301,6 +301,7 @@ static char help_text[]=
#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 @@ static char help_text[]=
#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)"