changeset 7526:e3ca9e707857

- fix new afm/vfm support - fix fullscreen with xv - add cache support
author pontscho
date Sat, 28 Sep 2002 18:03:34 +0000
parents 33788b00b0e8
children 20d408e7e346
files Gui/cfg.c Gui/interface.c Gui/interface.h Gui/mplayer/gtk/opts.c help/help_mp-en.h libvo/vo_xv.c mencoder.c mplayer.c mplayer.h
diffstat 9 files changed, 126 insertions(+), 19 deletions(-) [+]
line wrap: on
line diff
--- a/Gui/cfg.c	Sat Sep 28 16:18:32 2002 +0000
+++ b/Gui/cfg.c	Sat Sep 28 18:03:34 2002 +0000
@@ -59,8 +59,8 @@
  { "v_flip",&flip,CONF_TYPE_INT,CONF_RANGE,-1,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_fm,CONF_TYPE_STRING,0,0,0,NULL },
- { "a_afm",&audio_fm,CONF_TYPE_STRING,0,0,0,NULL },
+ { "v_vfm",&video_fm_list,CONF_TYPE_STRING_LIST,0,0,0,NULL },
+ { "a_afm",&audio_fm_list,CONF_TYPE_STRING_LIST,0,0,0,NULL },
 
  { "vf_pp",&gtkVopPP,CONF_TYPE_FLAG,0,0,1,NULL },
  { "vf_autoq",&auto_quality,CONF_TYPE_INT,CONF_RANGE,0,100,NULL },
@@ -87,10 +87,12 @@
  { "font_encoding",&subtitle_font_encoding,CONF_TYPE_STRING,0,0,0,NULL },
  { "font_text_scale",&text_font_scale_factor,CONF_TYPE_FLOAT,CONF_RANGE,0,100,NULL },
  { "font_osd_scale",&osd_font_scale_factor,CONF_TYPE_FLOAT,CONF_RANGE,0,100,NULL },
- { "font_blur",&subtitle_font_thickness,CONF_TYPE_FLOAT,CONF_RANGE,0,8,NULL },
+ { "font_blur",&subtitle_font_radius,CONF_TYPE_FLOAT,CONF_RANGE,0,8,NULL },
  { "font_outline",&subtitle_font_thickness,CONF_TYPE_FLOAT,CONF_RANGE,0,8,NULL },
  { "font_autoscale",&subtitle_autoscale,CONF_TYPE_INT,CONF_RANGE,0,3,NULL },
 #endif
+
+ { "cache",&stream_cache_size,CONF_TYPE_INT,CONF_RANGE,4,65535,NULL },
  
  { "gui_skin",&skinName,CONF_TYPE_STRING,0,0,0,NULL },
 
@@ -214,6 +216,12 @@
 	     if ( tmp && tmp[0] ) fprintf( f,"%s = \"%s\"\n",gui_opts[i].name,tmp );
 	     break;
 	    }
+       case CONF_TYPE_STRING_LIST:
+            {
+	     char ** tmp = *( (char **)gui_opts[i].p );
+	     if ( tmp && tmp[0] && tmp[0][0] ) fprintf( f,"%s = \"%s\"\n",gui_opts[i].name,tmp[0] );
+	     break;
+	    }
       }
     }
    fclose( f );
--- a/Gui/interface.c	Sat Sep 28 16:18:32 2002 +0000
+++ b/Gui/interface.c	Sat Sep 28 18:03:34 2002 +0000
@@ -747,6 +747,9 @@
 	if ( (unsigned int)vparam & guiVCD ) guiIntfStruct.VCDTracks=0;
 #endif
 	return NULL;
+   case gtkSetCacheSize:
+        stream_cache_size=(int)fparam;
+	return NULL;
    case gtkSetExtraStereo:
         gtkAOExtraStereoMul=fparam;
 	audio_plugin_extrastereo.control( AOCONTROL_PLUGIN_ES_SET,(int)&gtkAOExtraStereoMul );
--- a/Gui/interface.h	Sat Sep 28 16:18:32 2002 +0000
+++ b/Gui/interface.h	Sat Sep 28 18:03:34 2002 +0000
@@ -187,6 +187,7 @@
 #define gtkSetFontOSDScale  24
 #define gtkSetFontEncoding  25
 #define gtkSetFontAutoScale 26
+#define gtkSetCacheSize     27
 
 extern float gtkEquChannels[6][10];
 
--- a/Gui/mplayer/gtk/opts.c	Sat Sep 28 16:18:32 2002 +0000
+++ b/Gui/mplayer/gtk/opts.c	Sat Sep 28 18:03:34 2002 +0000
@@ -62,6 +62,10 @@
 static GtkWidget * CBDumpMPSub;
 static GtkWidget * CBDumpSrt;
 static GtkWidget * CBPostprocess;
+static GtkWidget * CBCache;
+
+static GtkWidget * SBCache;
+static GtkAdjustment * SBCacheadj;
 
 static GtkWidget * RBOSDNone;
 static GtkWidget * RBOSDTandP;
@@ -235,8 +239,8 @@
 #ifndef HAVE_FREETYPE
  gtk_adjustment_set_value( HSFontFactoradj,font_factor );
 #else
- gtk_adjustment_set_value( HSFontBluradj,subtitle_font_radius );
- gtk_adjustment_set_value( HSFontOutLineadj,subtitle_font_thickness );
+ gtk_adjustment_set_value( HSFontBluradj,( subtitle_font_radius / 8.0f ) * 100.0f );
+ gtk_adjustment_set_value( HSFontOutLineadj,( subtitle_font_thickness / 8.0f ) * 100.0f );
  gtk_adjustment_set_value( HSFontTextScaleadj,text_font_scale_factor );
  gtk_adjustment_set_value( HSFontOSDScaleadj,osd_font_scale_factor );
  if ( subtitle_font_encoding )
@@ -270,12 +274,13 @@
   for( i=0;mpcodecs_vd_drivers[i];i++ )
    {
     Items=g_list_append( Items,(char *)mpcodecs_vd_drivers[i]->info->name );
-    if ( !gstrcmp( video_fm,(char *)mpcodecs_vd_drivers[i]->info->short_name ) ) name=(char *)mpcodecs_vd_drivers[i]->info->name;
+    if ( video_fm_list && !gstrcmp( video_fm_list[0],(char *)mpcodecs_vd_drivers[i]->info->short_name ) ) name=(char *)mpcodecs_vd_drivers[i]->info->name;
    }
   gtk_combo_set_popdown_strings( GTK_COMBO( CBVFM ),Items );
   g_list_free( Items );
   if ( name ) gtk_entry_set_text( GTK_ENTRY( EVFM ),name );
  }
+
  {
   int     i;
   GList * Items = NULL;
@@ -285,13 +290,20 @@
   for( i=0;mpcodecs_ad_drivers[i];i++ )
    {
     Items=g_list_append( Items,(char *)mpcodecs_ad_drivers[i]->info->name );
-    if ( !gstrcmp( audio_fm,(char *)mpcodecs_ad_drivers[i]->info->short_name ) ) name=(char *)mpcodecs_ad_drivers[i]->info->name;
+    if ( audio_fm_list && !gstrcmp( audio_fm_list[0],(char *)mpcodecs_ad_drivers[i]->info->short_name ) ) name=(char *)mpcodecs_ad_drivers[i]->info->name;
    }
   gtk_combo_set_popdown_strings( GTK_COMBO( CBAFM ),Items );
   g_list_free( Items );
   if ( name ) gtk_entry_set_text( GTK_ENTRY( EAFM ),name );
  }
 
+ gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( CBCache ),0 );
+ if ( stream_cache_size )
+  {
+   gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( CBCache ),1 );
+   gtk_adjustment_set_value( SBCacheadj,stream_cache_size );
+  } else gtk_widget_set_sensitive( SBCache,FALSE );
+
 // -- disables
 #ifndef USE_SUB
  gtk_widget_set_sensitive( AConfig,FALSE );
@@ -327,6 +339,7 @@
  gtk_signal_connect( GTK_OBJECT( RBFontAutoScaleHeight ),"toggled",GTK_SIGNAL_FUNC( prToggled ),(void*)6 );
  gtk_signal_connect( GTK_OBJECT( RBFontAutoScaleDiagonal ),"toggled",GTK_SIGNAL_FUNC( prToggled ),(void*)7 );
 #endif
+ gtk_signal_connect( GTK_OBJECT( CBCache ),"toggled",GTK_SIGNAL_FUNC( prToggled ),(void*)8);
 
  gtk_signal_connect( GTK_OBJECT( HSExtraStereoMul ),"motion_notify_event",GTK_SIGNAL_FUNC( prHScaler ),(void*)0 );
  gtk_signal_connect( GTK_OBJECT( HSAudioDelay ),"motion_notify_event",GTK_SIGNAL_FUNC( prHScaler ),(void*)1 );
@@ -450,19 +463,44 @@
 	index_mode=gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON( CBIndex ) );
 	gtkVopPP=gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON( CBPostprocess ) ); 
 	gtkSet( gtkSetAutoq,HSPPQualityadj->value,NULL );
+
+	if ( gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON( CBCache ) ) ) gtkSet( gtkSetCacheSize,SBCacheadj->value,NULL );
+	 else gtkSet( gtkSetCacheSize,0,NULL );
+
 	{
 	 int i;
 	 char * tmp = gtk_entry_get_text( GTK_ENTRY( EVFM ) );
-	 gfree( (void **)&video_fm );
+	 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=gstrdup( (char *)mpcodecs_vd_drivers[i]->info->short_name ); break; }
+           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;
+	    }
 	}
+
 	{
 	 int i;
 	 char * tmp = gtk_entry_get_text( GTK_ENTRY( EAFM ) );
-	 gfree( (void **)&audio_fm );
+	 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=gstrdup( (char *)mpcodecs_ad_drivers[i]->info->short_name ); break; }
+           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;
+	    }
 	}
 
    case bCancel:
@@ -554,6 +592,10 @@
    case 7:
 	gtkSet( gtkSetFontAutoScale,(float)((int)user_data - 4 ),NULL );
 	break;
+   case 8:
+	if ( gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON( CBCache ) ) ) gtk_widget_set_sensitive( SBCache,TRUE );
+	 else gtk_widget_set_sensitive( SBCache,FALSE );
+	break;
   }
 }
 
@@ -1712,6 +1754,60 @@
   gtk_object_set_data_full( GTK_OBJECT( Preferences ),"EAFM",EAFM,(GtkDestroyNotify)gtk_widget_unref );
   gtk_widget_show( EAFM );
 
+  frame11=gtk_frame_new( MSGTR_PREFERENCES_FRAME_Cache );
+  gtk_widget_set_name( frame11,"frame11" );
+  gtk_widget_ref( frame11 );
+  gtk_object_set_data_full( GTK_OBJECT( Preferences ),"frame11",frame11,(GtkDestroyNotify)gtk_widget_unref );
+  gtk_widget_show( frame11 );
+  gtk_box_pack_start( GTK_BOX( vbox601 ),frame11,FALSE,FALSE,0 );
+  gtk_frame_set_shadow_type( GTK_FRAME( frame11 ),GTK_SHADOW_ETCHED_OUT );
+
+  frame=gtk_frame_new( NULL );
+  gtk_widget_set_name( frame,"frame" );
+  gtk_widget_ref( frame );
+  gtk_object_set_data_full( GTK_OBJECT( Preferences ),"frame",frame,(GtkDestroyNotify)gtk_widget_unref );
+  gtk_widget_show( frame );
+  gtk_container_add( GTK_CONTAINER( frame11 ),frame );
+  gtk_container_set_border_width( GTK_CONTAINER( frame ),0 );
+  gtk_frame_set_shadow_type( GTK_FRAME( frame ),GTK_SHADOW_NONE );
+
+  vbox602=gtk_vbox_new( FALSE,0 );
+  gtk_widget_set_name( vbox602,"vbox602" );
+  gtk_widget_ref( vbox602 );
+  gtk_object_set_data_full( GTK_OBJECT( Preferences ),"vbox602",vbox602,(GtkDestroyNotify)gtk_widget_unref );
+  gtk_widget_show( vbox602 );
+  gtk_container_add( GTK_CONTAINER( frame ),vbox602 );
+
+  CBCache=gtk_check_button_new_with_label( MSGTR_PREFERENCES_Cache );
+  gtk_widget_set_name( CBCache,"CBCache" );
+  gtk_widget_ref( CBCache );
+  gtk_object_set_data_full( GTK_OBJECT( Preferences ),"CBCache",CBCache,(GtkDestroyNotify)gtk_widget_unref );
+  gtk_widget_show( CBCache );
+  gtk_box_pack_start( GTK_BOX( vbox602 ),CBCache,FALSE,FALSE,0 );
+  
+  hbox5=gtk_hbox_new( FALSE,0 );
+  gtk_widget_set_name( hbox5,"hbox5" );
+  gtk_widget_ref( hbox5 );
+  gtk_object_set_data_full( GTK_OBJECT( Preferences ),"hbox5",hbox5,(GtkDestroyNotify)gtk_widget_unref );
+  gtk_widget_show( hbox5 );
+  gtk_box_pack_start( GTK_BOX( vbox602 ),hbox5,FALSE,FALSE,0 );
+
+  label4=gtk_label_new( "Cache size: " );
+  gtk_widget_set_name( label4,"label4" );
+  gtk_widget_ref( label4 );
+  gtk_object_set_data_full( GTK_OBJECT( Preferences ),"label4",label4,(GtkDestroyNotify)gtk_widget_unref );
+  gtk_widget_show( label4 );
+  gtk_box_pack_start( GTK_BOX( hbox5 ),label4,FALSE,FALSE,0 );
+  gtk_misc_set_alignment( GTK_MISC( label4 ),7.45058e-09,0.5 );
+  gtk_misc_set_padding( GTK_MISC( label4 ),4,0 );
+
+  SBCacheadj=GTK_ADJUSTMENT( gtk_adjustment_new( 2048,4,65535,1,10,10 ) );
+  SBCache=gtk_spin_button_new( GTK_ADJUSTMENT( SBCacheadj ),1,0 );
+  gtk_widget_ref( SBCache );
+  gtk_object_set_data_full( GTK_OBJECT( Preferences ),"SBCache",SBCache,(GtkDestroyNotify)gtk_widget_unref );
+  gtk_widget_show( SBCache );
+  gtk_box_pack_start( GTK_BOX( hbox5 ),SBCache,TRUE,TRUE,0 );
+
   label4=gtk_label_new( "Misc" );
   gtk_widget_set_name( label4,"label4" );
   gtk_widget_ref( label4 );
--- a/help/help_mp-en.h	Sat Sep 28 16:18:32 2002 +0000
+++ b/help/help_mp-en.h	Sat Sep 28 18:03:34 2002 +0000
@@ -438,6 +438,7 @@
 #define MSGTR_PREFERENCES_FRAME_Font "Font"
 #define MSGTR_PREFERENCES_FRAME_PostProcess "Postprocessing"
 #define MSGTR_PREFERENCES_FRAME_CodecDemuxer "Codec & demuxer"
+#define MSGTR_PREFERENCES_FRAME_Cache "Cache"
 #define MSGTR_PREFERENCES_OSS_Device "Device:"
 #define MSGTR_PREFERENCES_OSS_Mixer "Mixer:"
 #define MSGTR_PREFERENCES_Message "Please remember that you need to restart playback for some options to take effect!"
@@ -475,6 +476,7 @@
 #define MSGTR_PREFERENCES_FontTextScale "Text scale:"
 #define MSGTR_PREFERENCES_FontOSDScale "OSD scale:"
 #define MSGTR_PREFERENCES_SubtitleOSD "Subtitle & OSD"
+#define MSGTR_PREFERENCES_Cache "Cache on/off"
 
 // --- messagebox
 #define MSGTR_MSGBOX_LABEL_FatalError "Fatal error!"
--- a/libvo/vo_xv.c	Sat Sep 28 16:18:32 2002 +0000
+++ b/libvo/vo_xv.c	Sat Sep 28 18:03:34 2002 +0000
@@ -435,7 +435,7 @@
 #endif
 
      aspect(&vo_dwidth,&vo_dheight,A_NOZOOM);
-     if ( ( flags&1 )&&( !WinID ) )
+     if ( ( flags&1 )&&( WinID <= 0 ) )
       {
        aspect(&vo_dwidth,&vo_dheight,A_ZOOM);
        drwX=( vo_screenwidth - (vo_dwidth > vo_screenwidth?vo_screenwidth:vo_dwidth) ) / 2;
--- a/mencoder.c	Sat Sep 28 16:18:32 2002 +0000
+++ b/mencoder.c	Sat Sep 28 18:03:34 2002 +0000
@@ -96,8 +96,6 @@
 char *video_codec=NULL; // override video codec
 char **audio_codec_list=NULL; // override video codec
 char **video_codec_list=NULL; // override video codec
-char* audio_fm=NULL;     // override audio codec family 
-char* video_fm=NULL;     // override video codec family 
 char** audio_fm_list=NULL;     // override video codec family 
 char** video_fm_list=NULL;     // override video codec family 
 
--- a/mplayer.c	Sat Sep 28 16:18:32 2002 +0000
+++ b/mplayer.c	Sat Sep 28 18:03:34 2002 +0000
@@ -180,8 +180,6 @@
 char *video_codec=NULL; // override video codec
 char **audio_codec_list=NULL; // override video codec
 char **video_codec_list=NULL; // override video codec
-char *audio_fm=NULL;    // override audio codec family 
-char *video_fm=NULL;    // override video codec family 
 char **audio_fm_list=NULL;    // override video codec family 
 char **video_fm_list=NULL;    // override video codec family 
 
@@ -197,7 +195,7 @@
 char* filename=NULL; //"MI2-Trailer.avi";
 
 // cache2:
-static int stream_cache_size=0;
+       int stream_cache_size=0;
 #ifdef USE_STREAM_CACHE
 extern int cache_fill_status;
 #else
--- a/mplayer.h	Sat Sep 28 16:18:32 2002 +0000
+++ b/mplayer.h	Sat Sep 28 18:03:34 2002 +0000
@@ -10,8 +10,8 @@
 extern int fullscreen;
 extern int vcd_track;
 
-extern char * audio_fm;
-extern char * video_fm;
+extern char ** audio_fm_list;
+extern char ** video_fm_list;
 extern char * video_driver;
 extern char * audio_driver;
 extern int    has_audio;
@@ -34,6 +34,7 @@
 
 extern char * filename;
 
+extern int stream_cache_size;
 extern int flip;
 extern int force_ni;
 extern int index_mode;