changeset 7582:4a233f3b09a7

add [video||audio]_driver_list
author pontscho
date Wed, 02 Oct 2002 13:16:15 +0000
parents 31d0ea35c66b
children b86106f3b272
files Gui/cfg.c Gui/interface.c Gui/interface.h Gui/mplayer/gtk/opts.c mplayer.c mplayer.h
diffstat 6 files changed, 38 insertions(+), 43 deletions(-) [+]
line wrap: on
line diff
--- a/Gui/cfg.c	Wed Oct 02 11:00:37 2002 +0000
+++ b/Gui/cfg.c	Wed Oct 02 13:16:15 2002 +0000
@@ -52,7 +52,7 @@
 {
  { "enable_audio_equ",&gtkEnableAudioEqualizer,CONF_TYPE_FLAG,0,0,1,NULL },
  
- { "vo_driver",&video_driver,CONF_TYPE_STRING,0,0,0,NULL },
+ { "vo_driver",&video_driver_list,CONF_TYPE_STRING_LIST,0,0,0,NULL },
  { "vo_panscan",&vo_panscan,CONF_TYPE_FLOAT,CONF_RANGE,0.0,1.0,NULL },
  { "vo_doublebuffering",&vo_doublebuffering,CONF_TYPE_FLAG,0,0,1,NULL },
  { "vo_direct_render",&vo_directrendering,CONF_TYPE_FLAG,0,0,1,NULL },
@@ -69,7 +69,7 @@
  { "vf_lavc",&gtkVopLAVC,CONF_TYPE_FLAG,0,0,1,NULL },
  { "vf_fame",&gtkVopFAME,CONF_TYPE_FLAG,0,0,1,NULL },
 
- { "ao_driver",&audio_driver,CONF_TYPE_STRING,0,0,0,NULL },
+ { "ao_driver",&audio_driver_list,CONF_TYPE_STRING_LIST,0,0,0,NULL },
  { "ao_nosound",&gtkAONoSound,CONF_TYPE_FLAG,0,0,1,NULL },
  { "ao_volnorm",&gtkAONorm,CONF_TYPE_FLAG,0,0,1,NULL },
  { "ao_surround",&gtkAOSurround,CONF_TYPE_FLAG,0,0,1,NULL },
--- a/Gui/interface.c	Wed Oct 02 11:00:37 2002 +0000
+++ b/Gui/interface.c	Wed Oct 02 13:16:15 2002 +0000
@@ -90,6 +90,21 @@
    else gstrcat( str,what );
 }
 
+void gaddlist( char *** list,char * entry )
+{
+ int i;
+
+ if ( (*list) )
+  {
+   for ( i=0;(*list)[i];i++ ) free( (*list)[i] );
+   free( (*list) );
+  }
+
+ (*list)=malloc( 8 );
+ (*list)[0]=gstrdup( entry );
+ (*list)[1]=NULL;
+}
+
 #ifdef USE_ICONV
 char * gconvert_uri_to_filename( char * str )
 {
@@ -462,7 +477,7 @@
 	 }
 // -- subtitle
 #ifdef HAVE_DXR3
-	if ( !gstrcmp( video_driver,"dxr3" ) && guiIntfStruct.FileFormat != DEMUXER_TYPE_MPEG_PS && !gtkVopLAVC && !gtkVopFAME )
+	if ( video_driver_list && !gstrcmp( video_driver_list[0],"dxr3" ) && guiIntfStruct.FileFormat != DEMUXER_TYPE_MPEG_PS && !gtkVopLAVC && !gtkVopFAME )
 	 {
 	  gtkMessageBox( GTK_MB_FATAL,MSGTR_NEEDLAVCFAME );
 	  guiIntfStruct.Playing=0;
@@ -481,19 +496,19 @@
 
 // --- video opts
        
-       if ( !video_driver )
+       if ( !video_driver_list )
 	{
          int i = 0;
            while ( video_out_drivers[i++] )
 	    if ( video_out_drivers[i - 1]->control( VOCTRL_GUISUPPORT,NULL ) == VO_TRUE ) 
 	     {
 	      const vo_info_t *info = video_out_drivers[i - 1]->get_info();
-	      video_driver=gstrdup( (char *)info->short_name );
+	      gaddlist( &video_driver_list,(char *)info->short_name );
 	      break;
 	     }
 	 }
 	
-	if ( !video_driver ) { gtkMessageBox( GTK_MB_FATAL,MSGTR_IDFGCVD ); exit_player( "gui init" ); }
+	if ( !video_driver_list && !video_driver_list[0] ) { gtkMessageBox( GTK_MB_FATAL,MSGTR_IDFGCVD ); exit_player( "gui init" ); }
 
 	{
 	 int i = 0;
@@ -502,7 +517,7 @@
 	  if ( video_out_drivers[i - 1]->control( VOCTRL_GUISUPPORT,NULL ) == VO_TRUE ) 
 	   {
 	    const vo_info_t *info = video_out_drivers[i - 1]->get_info();
-	    if  ( ( !gstrcmp( video_driver,(char *)info->short_name ) )&&( video_out_drivers[i - 1]->control( VOCTRL_GUI_NOWINDOW,NULL ) == VO_TRUE ) ) 
+	    if  ( ( video_driver_list && !gstrcmp( video_driver_list[0],(char *)info->short_name ) )&&( video_out_drivers[i - 1]->control( VOCTRL_GUI_NOWINDOW,NULL ) == VO_TRUE ) ) 
 	      { guiIntfStruct.NoWindow=True; break; }
 	   }
 	}
@@ -510,7 +525,7 @@
 #ifdef HAVE_DXR3
 	remove_vop( "lavc" );
 	remove_vop( "fame" );
-	if ( !gstrcmp( video_driver,"dxr3" ) )
+	if ( video_driver_list && !gstrcmp( video_driver_list[0],"dxr3" ) )
 	 {
 	  if ( ( guiIntfStruct.StreamType != STREAMTYPE_DVD)&&( guiIntfStruct.StreamType != STREAMTYPE_VCD ) )
 	   {
@@ -534,12 +549,11 @@
 	  ao_plugin_cfg.pl_extrastereo_mul=gtkAOExtraStereoMul;
 	 }
 	mixer_device=gtkAOOSSMixer;
-	if ( !gstrncmp( audio_driver,"oss",3 ) && gtkAOOSSDevice )
+	if ( audio_driver_list && !gstrncmp( audio_driver_list[0],"oss",3 ) && gtkAOOSSDevice )
 	 {
 	  char * tmp = calloc( 1,strlen( gtkAOOSSDevice ) + 5 );
 	  sprintf( tmp,"oss:%s",gtkAOOSSDevice );
-	  gfree( (void *)&audio_driver );
-	  audio_driver=tmp;
+	  gaddlist( &audio_driver_list,tmp );
 	 }
 
 // -- subtitle
--- a/Gui/interface.h	Wed Oct 02 11:00:37 2002 +0000
+++ b/Gui/interface.h	Wed Oct 02 13:16:15 2002 +0000
@@ -197,6 +197,7 @@
 extern char * gstrdup( char * str );
 extern int    gstrcmp( char * a,char * b );
 extern void   gfree( void ** p );
+extern void   gaddlist( char *** list,char * entry );
 
 #define guiSetFilename( s,n ) { gfree( (void **)&s ); s=gstrdup( n ); }
 
--- a/Gui/mplayer/gtk/opts.c	Wed Oct 02 11:00:37 2002 +0000
+++ b/Gui/mplayer/gtk/opts.c	Wed Oct 02 13:16:15 2002 +0000
@@ -173,7 +173,7 @@
    {
     const ao_info_t *info = audio_out_drivers[i++]->info;
     if ( !strcmp( info->short_name,"plugin" ) ) continue;
-    if ( !gstrcmp( audio_driver,(char *)info->short_name ) ) old_audio_driver=i - 1;
+    if ( audio_driver_list && !gstrcmp( audio_driver_list[0],(char *)info->short_name ) ) old_audio_driver=i - 1;
     tmp[0]=(char *)info->short_name; tmp[1]=(char *)info->name; gtk_clist_append( GTK_CLIST( CLADrivers ),tmp );
    }
   gtk_clist_select_row( GTK_CLIST( CLADrivers ),old_audio_driver,0 );
@@ -199,6 +199,7 @@
  if (flip != -1)
     gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( CBFlip ),flip );
  gtk_adjustment_set_value( HSPanscanadj,vo_panscan );
+
  {
   int i = 0, c = 0;
   char * tmp[3]; tmp[2]="";
@@ -207,7 +208,7 @@
    if ( video_out_drivers[i++]->control( VOCTRL_GUISUPPORT,NULL ) == VO_TRUE )
     { 
      const vo_info_t *info = video_out_drivers[i - 1]->get_info();
-     if ( !gstrcmp( video_driver,(char *)info->short_name ) ) old_video_driver=c; c++;
+     if ( video_driver_list && !gstrcmp( video_driver_list[0],(char *)info->short_name ) ) old_video_driver=c; c++;
      tmp[0]=(char *)info->short_name; tmp[1]=(char *)info->name; gtk_clist_append( GTK_CLIST( CLVDrivers ),tmp );
     }
   gtk_clist_select_row( GTK_CLIST( CLVDrivers ),old_video_driver,0 );
@@ -418,10 +419,9 @@
 	gtkAONoSound=gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON( CBNoSound ) );
 	gtkSet( gtkSetExtraStereo,HSExtraStereoMuladj->value,NULL );
 	gtkSet( gtkSetAudioDelay,HSAudioDelayadj->value,NULL );
-        gfree( (void **)&audio_driver );
-	audio_driver=gstrdup( ao_driver[0] );
-	gfree( (void **)&video_driver );
-	video_driver=gstrdup( vo_driver[0] );
+
+	gaddlist( &audio_driver_list,ao_driver[0] );
+	gaddlist( &video_driver_list,vo_driver[0] );
 
 	// -- 2. page
 	vo_doublebuffering=gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON( CBDoubleBuffer ) );
@@ -473,37 +473,17 @@
 	{
 	 int i;
 	 char * tmp = gtk_entry_get_text( GTK_ENTRY( EVFM ) );
-	 if ( video_fm_list )
-	  {
-	   for ( i=0;video_fm_list[i];i++ ) gfree( (void **)&video_fm_list[i] );
-	   gfree( (void **)&video_fm_list );
-	  }
          for( i=0;mpcodecs_vd_drivers[i];i++ )
-           if ( !gstrcmp( tmp,(char *)mpcodecs_vd_drivers[i]->info->name ) ) 
-	    {
-	     video_fm_list=malloc( 8 );
-	     video_fm_list[0]=gstrdup( (char *)mpcodecs_vd_drivers[i]->info->short_name ); 
-	     video_fm_list[1]=NULL;
-	     break;
-	    }
+          if ( !gstrcmp( tmp,(char *)mpcodecs_vd_drivers[i]->info->name ) ) 
+	   { gaddlist( &video_fm_list,(char *)mpcodecs_vd_drivers[i]->info->short_name ); break; }
 	}
 
 	{
 	 int i;
 	 char * tmp = gtk_entry_get_text( GTK_ENTRY( EAFM ) );
-	 if ( audio_fm_list )
-	  {
-	   for ( i=0;audio_fm_list[i];i++ ) gfree( (void **)&audio_fm_list[i] );
-	   gfree( (void **)&audio_fm_list );
-	  }
          for( i=0;mpcodecs_ad_drivers[i];i++ )
-           if ( !gstrcmp( tmp,(char *)mpcodecs_ad_drivers[i]->info->name ) )
-	    {
-	     audio_fm_list=malloc( 8 );
-	     audio_fm_list[0]=gstrdup( (char *)mpcodecs_ad_drivers[i]->info->short_name );
-	     audio_fm_list[1]=NULL;
-	     break;
-	    }
+          if ( !gstrcmp( tmp,(char *)mpcodecs_ad_drivers[i]->info->name ) )
+	   { gaddlist( &audio_fm_list,(char *)mpcodecs_ad_drivers[i]->info->short_name ); break; }
 	}
 
    case bCancel:
--- a/mplayer.c	Wed Oct 02 11:00:37 2002 +0000
+++ b/mplayer.c	Wed Oct 02 13:16:15 2002 +0000
@@ -215,8 +215,6 @@
 static int play_n_frames_mf=-1;
 
 // screen info:
-char* video_driver=NULL; // OBSOLETE, FIXME gui
-char* audio_driver=NULL; // OBSOLETE, FIXME gui
 char** video_driver_list=NULL;
 char** audio_driver_list=NULL;
 
--- a/mplayer.h	Wed Oct 02 11:00:37 2002 +0000
+++ b/mplayer.h	Wed Oct 02 13:16:15 2002 +0000
@@ -11,6 +11,8 @@
 
 extern char ** audio_fm_list;
 extern char ** video_fm_list;
+extern char ** video_driver_list;
+extern char ** audio_driver_list;
 extern char * video_driver;
 extern char * audio_driver;
 extern float  audio_delay;