[Mplayer-cvslog] CVS: main/Gui cfg.c,1.7,1.8 cfg.h,1.3,1.4 interface.c,1.37,1.38 interface.h,1.20,1.21

Zoltan Ponekker pontscho at mplayerhq.hu
Fri Aug 16 00:52:54 CEST 2002


Update of /cvsroot/mplayer/main/Gui
In directory mail:/var/tmp.root/cvs-serv7836/Gui

Modified Files:
	cfg.c cfg.h interface.c interface.h 
Log Message:
fix (?) cmd line handling

Index: cfg.c
===================================================================
RCS file: /cvsroot/mplayer/main/Gui/cfg.c,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- cfg.c	14 Aug 2002 23:02:42 -0000	1.7
+++ cfg.c	15 Aug 2002 22:52:51 -0000	1.8
@@ -8,6 +8,10 @@
 #include "../mplayer.h"
 #include "../cfgparser.h"
 
+#ifdef USE_SETLOCALE
+#include <locale.h>
+#endif
+
 #include "../../libvo/video_out.h"
 
 #include "cfg.h"
@@ -19,22 +23,10 @@
 
 int    gtkEnableAudioEqualizer = 0;
 
-char * gtkVODriver = NULL;
-int    gtkVODoubleBuffer = 1;
-int    gtkVODirectRendering = 0;
-int    gtkVFrameDrop = 1;
-int    gtkVHardFrameDrop = 0;
-int    gtkVNIAVI = 0;
-int    gtkVFlip = 0;
-int    gtkVIndex = 1;
-int    gtkVVFM = -1;
-int    gtkVAutoq = 0;
-
 int    gtkVopPP = 0;
 int    gtkVopLAVC = 0;
 int    gtkVopFAME = 0;
 
-char * gtkAODriver = NULL;
 int    gtkAONoSound = 0;
 float  gtkAODelay = 0.0f;
 int    gtkAONorm = 0;
@@ -44,14 +36,8 @@
 char * gtkAOOSSMixer;
 char * gtkAOOSSDevice;
 
-int    gtkSubAuto = 1; //
-int    gtkSubUnicode = 0; //
 int    gtkSubDumpMPSub = 0;
 int    gtkSubDumpSrt = 0;
-float  gtkSubDelay = 0.0f;
-float  gtkSubFPS = 0.0f;
-int    gtkSubPos = 100; //
-float  gtkSubFFactor = 0.75;
 
 // ---
 
@@ -64,24 +50,23 @@
 {
  { "enable_audio_equ",&gtkEnableAudioEqualizer,CONF_TYPE_FLAG,0,0,1,NULL },
  
- { "vo_driver",&gtkVODriver,CONF_TYPE_STRING,0,0,0,NULL },
+ { "vo_driver",&video_driver,CONF_TYPE_STRING,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",&gtkVODirectRendering,CONF_TYPE_FLAG,0,0,1,NULL },
+ { "vo_direct_render",&vo_directrendering,CONF_TYPE_FLAG,0,0,1,NULL },
 
- { "v_framedrop",&gtkVFrameDrop,CONF_TYPE_FLAG,0,0,1,NULL },
- { "v_hard_framedrop",&gtkVHardFrameDrop,CONF_TYPE_FLAG,0,0,1,NULL },
- { "v_flip",&gtkVFlip,CONF_TYPE_FLAG,0,0,1,NULL },
- { "v_ni",&gtkVNIAVI,CONF_TYPE_FLAG,0,0,1,NULL },
- { "v_idx",&gtkVIndex,CONF_TYPE_FLAG,0,0,1,NULL },
- { "v_vfm",&gtkVVFM,CONF_TYPE_INT,CONF_RANGE,-1,10,NULL },
+ { "v_framedrop",&frame_dropping,CONF_TYPE_INT,CONF_RANGE,0,2,NULL },
+ { "v_flip",&flip,CONF_TYPE_FLAG,0,0,1,NULL },
+ { "v_ni",&force_ni,CONF_TYPE_FLAG,0,0,1,NULL },
+ { "v_idx",&index_mode,CONF_TYPE_INT,CONF_RANGE,-1,2,NULL },
+ { "v_vfm",&video_family,CONF_TYPE_INT,CONF_RANGE,-1,10,NULL },
 
  { "vf_pp",&gtkVopPP,CONF_TYPE_FLAG,0,0,1,NULL },
- { "vf_autoq",&gtkVAutoq,CONF_TYPE_INT,CONF_RANGE,0,100,NULL },
+ { "vf_autoq",&auto_quality,CONF_TYPE_INT,CONF_RANGE,0,100,NULL },
  { "vf_lavc",&gtkVopLAVC,CONF_TYPE_FLAG,0,0,1,NULL },
  { "vf_fame",&gtkVopFAME,CONF_TYPE_FLAG,0,0,1,NULL },
 
- { "ao_driver",&gtkAODriver,CONF_TYPE_STRING,0,0,0,NULL },
+ { "ao_driver",&audio_driver,CONF_TYPE_STRING,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 },
@@ -92,11 +77,11 @@
  { "ao_oss_device",&gtkAOOSSDevice,CONF_TYPE_STRING,0,0,0,NULL },
  
  { "osd_level",&osd_level,CONF_TYPE_INT,CONF_RANGE,0,2,NULL },
- { "sub_auto_load",&gtkSubAuto,CONF_TYPE_FLAG,0,0,1,NULL },
- { "sub_unicode",&gtkSubUnicode,CONF_TYPE_FLAG,0,0,1,NULL },
- { "sub_pos",&gtkSubPos,CONF_TYPE_INT,CONF_RANGE,0,200,NULL },
- { "font_factor",&gtkSubFFactor,CONF_TYPE_FLOAT,CONF_RANGE,0.0,10.0,NULL },
- { "font_name",&guiIntfStruct.Fontname,CONF_TYPE_STRING,0,0,0,NULL },
+ { "sub_auto_load",&sub_auto,CONF_TYPE_FLAG,0,0,1,NULL },
+ { "sub_unicode",&sub_unicode,CONF_TYPE_FLAG,0,0,1,NULL },
+ { "sub_pos",&sub_pos,CONF_TYPE_INT,CONF_RANGE,0,200,NULL },
+ { "font_factor",&font_factor,CONF_TYPE_FLOAT,CONF_RANGE,0.0,10.0,NULL },
+ { "font_name",&font_name,CONF_TYPE_STRING,0,0,0,NULL },
  
  { "gui_skin",&skinName,CONF_TYPE_STRING,0,0,0,NULL },
 
@@ -165,6 +150,10 @@
  char * cfg = get_path( "gui.conf" );
  FILE * f;
  int    i;
+
+#ifdef USE_SETLOCALE
+ setlocale( LC_ALL,"" );
+#endif
 
 // -- save configuration 
  if ( (f=fopen( cfg,"wt+" )) )

Index: cfg.h
===================================================================
RCS file: /cvsroot/mplayer/main/Gui/cfg.h,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- cfg.h	14 Aug 2002 23:02:42 -0000	1.3
+++ cfg.h	15 Aug 2002 22:52:51 -0000	1.4
@@ -4,23 +4,10 @@
 
 extern int gtkEnableAudioEqualizer;
 
-extern char * gtkVODriver;
-extern int    gtkVODoubleBuffer;
-extern int    gtkVODirectRendering;
-
-extern int    gtkVFrameDrop;
-extern int    gtkVHardFrameDrop;
-extern int    gtkVNIAVI;
-extern int    gtkVFlip;
-extern int    gtkVIndex;
-extern int    gtkVVFM;
-extern int    gtkVAutoq;
-
 extern int    gtkVopPP;
 extern int    gtkVopLAVC;
 extern int    gtkVopFAME;
 
-extern char * gtkAODriver;
 extern int    gtkAONoSound;
 extern float  gtkAODelay;
 extern int    gtkAONorm;
@@ -30,14 +17,8 @@
 extern char * gtkAOOSSMixer;
 extern char * gtkAOOSSDevice;
 
-extern int    gtkSubAuto; 
-extern int    gtkSubUnicode; 
 extern int    gtkSubDumpMPSub;
 extern int    gtkSubDumpSrt;
-extern float  gtkSubDelay;
-extern float  gtkSubFPS;
-extern int    gtkSubPos;
-extern float  gtkSubFFactor;
 
 extern char * gtkEquChannel1;
 extern char * gtkEquChannel2;

Index: interface.c
===================================================================
RCS file: /cvsroot/mplayer/main/Gui/interface.c,v
retrieving revision 1.37
retrieving revision 1.38
diff -u -r1.37 -r1.38
--- interface.c	14 Aug 2002 23:02:42 -0000	1.37
+++ interface.c	15 Aug 2002 22:52:51 -0000	1.38
@@ -66,6 +66,13 @@
  return strcmp( a,b );
 }
 
+int gstrncmp( char * a,char * b,int size )
+{
+ if ( !a && !b ) return 0;
+ if ( !a || !b ) return -1;
+ return strncmp( a,b,size );
+}
+
 char * gstrdup( char * str )
 {
  if ( !str ) return NULL;
@@ -140,11 +147,10 @@
  gtkInit();
  wsXInit( (void *)mDisplay );
      
- cfg_read(); 
+// cfg_read(); 
  appInit( (void*)mDisplay );
        
  if ( plCurrent && !filename ) mplSetFileName( plCurrent->path,plCurrent->name,STREAMTYPE_FILE );
- if ( sub_delay != 0.0f ) gtkSubDelay=sub_delay;
  if ( sub_name ) guiSetFilename( guiIntfStruct.Subtitlename,sub_name );
 #if defined( USE_OSD ) || defined( USE_SUB )
  guiLoadFont();
@@ -188,18 +194,13 @@
 
 extern ao_functions_t * audio_out;
 extern vo_functions_t * video_out;
-extern int    		flip;
 extern int    		frame_dropping;
-extern int    		sub_pos;
-extern int    		sub_unicode;
 extern int              stream_dump_type;
 extern char **          vo_plugin_args;
-extern int              auto_quality;
 
 #if defined( USE_OSD ) || defined( USE_SUB )
 void guiLoadFont( void )
 {
- font_factor=gtkSubFFactor;
  if ( vo_font )
   {
    int i;
@@ -219,19 +220,19 @@
      }
    free( vo_font ); vo_font=NULL;
   }
- if ( guiIntfStruct.Fontname )
+ if ( font_name )
   {
-   vo_font=read_font_desc( guiIntfStruct.Fontname,font_factor,0 );
+   vo_font=read_font_desc( font_name,font_factor,0 );
    if ( !vo_font ) mp_msg( MSGT_CPLAYER,MSGL_ERR,MSGTR_CantLoadFont,font_name );
   } 
   else
    {
-    guiIntfStruct.Fontname=gstrdup( get_path( "font/font.desc" ) );
-    vo_font=read_font_desc( guiIntfStruct.Fontname,font_factor,0 );
+    font_name=gstrdup( get_path( "font/font.desc" ) );
+    vo_font=read_font_desc( font_name,font_factor,0 );
     if ( !vo_font )
      {
-      gfree( (void **)&guiIntfStruct.Fontname ); guiIntfStruct.Fontname=gstrdup( DATADIR"/font/font.desc" );
-      vo_font=read_font_desc( guiIntfStruct.Fontname,font_factor,0 );
+      gfree( (void **)&font_name ); font_name=gstrdup( DATADIR"/font/font.desc" );
+      vo_font=read_font_desc( font_name,font_factor,0 );
      }
    }
 }
@@ -431,15 +432,8 @@
 	     }
 	 }
 // -- subtitle
-        gtkSubUnicode=sub_unicode;
-        gtkSubDelay=sub_delay;
-        gtkSubFPS=sub_fps;
-        gtkSubPos=sub_pos;
-#ifdef USE_OSD
-	gtkSubFFactor=font_factor;
-#endif
 #ifdef HAVE_DXR3
-	if ( !gstrcmp( gtkVODriver,"dxr3" ) && guiIntfStruct.FileFormat != DEMUXER_TYPE_MPEG_PS && !gtkVopLAVC && !gtkVopFAME )
+	if ( !gstrcmp( video_driver,"dxr3" ) && guiIntfStruct.FileFormat != DEMUXER_TYPE_MPEG_PS && !gtkVopLAVC && !gtkVopFAME )
 	 {
 	  gtkMessageBox( GTK_MB_FATAL,MSGTR_NEEDLAVCFAME );
 	  guiIntfStruct.Playing=0;
@@ -457,30 +451,20 @@
        guiIntfStruct.DiskChanged=0;
 
 // --- video opts
-       if ( !gtkVODriver )
+       
+       if ( !video_driver )
 	{
          int i = 0;
-	 if ( video_driver && !gtkVODriver )
-	  {
-	   while ( video_out_drivers[i] )
-	    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 ) ) gtkVODriver=gstrdup( video_driver );
-	     }
-	  }
-	  else
            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();
-	      gtkVODriver=gstrdup( (char *)info->short_name );
+	      video_driver=gstrdup( (char *)info->short_name );
 	      break;
 	     }
 	 }
 	
-	if ( gtkVODriver ) { gfree( (void **)&video_driver ); video_driver=gstrdup( gtkVODriver ); }
-	  else { gtkMessageBox( GTK_MB_FATAL,MSGTR_IDFGCVD ); exit_player( "gui init" ); }
+	if ( !video_driver ) { gtkMessageBox( GTK_MB_FATAL,MSGTR_IDFGCVD ); exit_player( "gui init" ); }
 
 	{
 	 int i = 0;
@@ -489,7 +473,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( gtkVODriver,(char *)info->short_name ) )&&( video_out_drivers[i - 1]->control( VOCTRL_GUI_NOWINDOW,NULL ) == VO_TRUE ) ) 
+	    if  ( ( !gstrcmp( video_driver,(char *)info->short_name ) )&&( video_out_drivers[i - 1]->control( VOCTRL_GUI_NOWINDOW,NULL ) == VO_TRUE ) ) 
 	      { guiIntfStruct.NoWindow=True; break; }
 	   }
 	}
@@ -497,7 +481,7 @@
 #ifdef HAVE_DXR3
 	remove_vop( "lavc" );
 	remove_vop( "fame" );
-	if ( !gstrcmp( gtkVODriver,"dxr3" ) )
+	if ( !gstrcmp( video_driver,"dxr3" ) )
 	 {
 	  #warning workaround for this moment.
 	  osd_level=0;
@@ -510,16 +494,8 @@
 	 }
 #endif
 // ---	 
-	if ( gtkVopPP ) { add_vop( "pp" ); auto_quality=gtkVAutoq; } 
-	 else { remove_vop( "pp" ); auto_quality=0; }
-
-        vo_doublebuffering=gtkVODoubleBuffer;
-        vo_directrendering=gtkVODirectRendering;
-	frame_dropping=gtkVFrameDrop;
-	if ( gtkVHardFrameDrop ) frame_dropping=gtkVHardFrameDrop;
-	flip=gtkVFlip;
-	force_ni=gtkVNIAVI;
-	video_family=gtkVVFM;
+	if ( gtkVopPP ) add_vop( "pp" );
+	 else remove_vop( "pp" );
 		 
 // --- audio opts
 	audio_delay=gtkAODelay;
@@ -532,25 +508,17 @@
 	  ao_plugin_cfg.pl_extrastereo_mul=gtkAOExtraStereoMul;
 	 }
 	mixer_device=gtkAOOSSMixer;
-	if ( audio_driver && !gtkAODriver ) gtkAODriver=gstrdup( audio_driver );
-	gfree( (void **)&audio_driver );
-	if ( !gstrcmp( gtkAODriver,"oss" ) && gtkAOOSSDevice )
+	if ( !gstrncmp( audio_driver,"oss",3 ) && gtkAOOSSDevice )
 	 {
-	  char * tmp = calloc( 1,strlen( gtkAODriver ) + strlen( gtkAOOSSDevice ) + 2 );
-	  sprintf( tmp,"%s:%s",gtkAODriver,gtkAOOSSDevice ); 
+	  char * tmp = calloc( 1,strlen( gtkAOOSSDevice ) + 5 );
+	  sprintf( tmp,"oss:%s",gtkAOOSSDevice );
+	  gfree( (void *)&audio_driver );
 	  audio_driver=tmp;
-	 } else audio_driver=gstrdup( gtkAODriver );
+	 }
 
 // -- subtitle
 #ifdef USE_SUB
-	sub_auto=0;
-	if ( gtkSubAuto && guiIntfStruct.StreamType == STREAMTYPE_FILE && !guiIntfStruct.Subtitlename )
-	 guiSetFilename( guiIntfStruct.Subtitlename,( guiIntfStruct.Filename ? sub_filename( get_path("sub/"),guiIntfStruct.Filename ): "default.sub" ) );
 	sub_name=guiIntfStruct.Subtitlename;
-        sub_unicode=gtkSubUnicode;
-        sub_delay=gtkSubDelay;
-        sub_fps=gtkSubFPS;
-        sub_pos=gtkSubPos;
 	stream_dump_type=0;
 	if ( gtkSubDumpMPSub ) stream_dump_type=4;
 	if ( gtkSubDumpSrt ) stream_dump_type=6;
@@ -563,7 +531,6 @@
 // --- misc		    
         if ( guiIntfStruct.AudioFile ) audio_stream=guiIntfStruct.AudioFile;
 	  else if ( guiIntfStruct.FilenameChanged ) audio_stream=NULL;
-	index_mode=gtkVIndex;
 	
 	break;
   }
@@ -673,24 +640,20 @@
         return NULL;
 // --- subtitle
    case gtkSetSubAuto:
-        gtkSubAuto=(int)fparam;
+        sub_auto=(int)fparam;
 	return NULL;
    case gtkSetSubDelay:
-//        mp_cmd=(mp_cmd_t *)calloc( 1,sizeof( *mp_cmd ) );
-//        mp_cmd->id=MP_CMD_SUB_DELAY;    mp_cmd->name=strdup( "sub_delay" );
-//	mp_cmd->args[0].v.f=fparam;   mp_cmd->args[1].v.i=1;
-//	mp_input_queue_cmd( mp_cmd );
-        gtkSubDelay=sub_delay=fparam;
+        sub_delay=fparam;
         return NULL;   
    case gtkSetSubFPS:
-        gtkSubFPS=sub_fps=(int)fparam;
+        sub_fps=(int)fparam;
         return NULL;   
    case gtkSetSubPos:
-        gtkSubPos=sub_pos=(int)fparam;
+        sub_pos=(int)fparam;
         return NULL;   
 #if defined( USE_OSD ) || defined( USE_SUB )
    case gtkSetFontFactor:
-        gtkSubFFactor=fparam;
+        font_factor=fparam;
 	guiLoadFont();
 	return NULL;
 #endif
@@ -724,7 +687,7 @@
 	mp_input_queue_cmd( mp_cmd );
         return NULL;
    case gtkSetAutoq:
-	auto_quality=gtkVAutoq=(int)fparam;
+	auto_quality=(int)fparam;
 	return NULL;
 // --- set equalizers
    case gtkSetContrast:

Index: interface.h
===================================================================
RCS file: /cvsroot/mplayer/main/Gui/interface.h,v
retrieving revision 1.20
retrieving revision 1.21
diff -u -r1.20 -r1.21
--- interface.h	14 Aug 2002 23:02:42 -0000	1.20
+++ interface.h	15 Aug 2002 22:52:51 -0000	1.21
@@ -5,6 +5,7 @@
 #include "../config.h"
 #include "mplayer/play.h"
 #include "../mplayer.h"
+#include "cfg.h"
 
 #ifdef USE_DVDREAD
  #include "../libmpdemux/stream.h"
@@ -91,8 +92,6 @@
    char * Subtitlename;
    int    SubtitleChanged;
    
-   char * Fontname;
-
    char * Othername;
    int    OtherChanged;
    




More information about the MPlayer-cvslog mailing list