[MPlayer-dev-eng] [PATCH] SDL audio subdiver GUI configuration
Filip Kalinski
filon at pld.org.pl
Fri Dec 27 23:39:48 CET 2002
Hi,
This patch enables "configure driver" button for sdl audio driver in GUI
preferences.
It is really needed if someone wants to use sdl output, and
doesn't want to set enviornment variables.
It needs previous patch (oss_audio_ifdef.patch) to be applied.
--
Filip Kalinski <filon at pld.org.pl>
-------------- next part --------------
diff -urN main/Gui/cfg.c main.test/Gui/cfg.c
--- main/Gui/cfg.c 2002-12-27 10:32:32.000000000 +0100
+++ main.test/Gui/cfg.c 2002-12-27 10:31:11.000000000 +0100
@@ -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",>kAOOSSMixer,CONF_TYPE_STRING,0,0,0,NULL },
{ "ao_oss_device",>kAOOSSDevice,CONF_TYPE_STRING,0,0,0,NULL },
#endif
+#ifdef HAVE_SDL
+ { "ao_sdl_subdriver",>kAOSDLDriver,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 -urN main/Gui/cfg.h main.test/Gui/cfg.h
--- main/Gui/cfg.h 2002-12-27 10:32:32.000000000 +0100
+++ main.test/Gui/cfg.h 2002-12-27 10:31:11.000000000 +0100
@@ -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
diff -urN main/Gui/interface.c main.test/Gui/interface.c
--- main/Gui/interface.c 2002-12-27 10:32:32.000000000 +0100
+++ main.test/Gui/interface.c 2002-12-27 10:31:11.000000000 +0100
@@ -701,6 +701,15 @@
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 -urN main/Gui/mplayer/gtk/opts.c main.test/Gui/mplayer/gtk/opts.c
--- main/Gui/mplayer/gtk/opts.c 2002-12-19 17:28:00.000000000 +0100
+++ main.test/Gui/mplayer/gtk/opts.c 2002-12-27 10:31:11.000000000 +0100
@@ -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 **)>kAOSDLDriver ); 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 -urN main/Gui/mplayer/gtk/opts.h main.test/Gui/mplayer/gtk/opts.h
--- main/Gui/mplayer/gtk/opts.h 2002-12-27 10:32:32.000000000 +0100
+++ main.test/Gui/mplayer/gtk/opts.h 2002-12-27 10:31:11.000000000 +0100
@@ -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 );
diff -urN main/help/help_mp-en.h main.test/help/help_mp-en.h
--- main/help/help_mp-en.h 2002-12-16 11:19:34.000000000 +0100
+++ main.test/help/help_mp-en.h 2002-12-27 10:31:11.000000000 +0100
@@ -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 "Subdriver:"
#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)"
More information about the MPlayer-dev-eng
mailing list