changeset 8284:f7d0ac887455

cache (buzeralas)
author pontscho
date Mon, 25 Nov 2002 18:18:45 +0000
parents f73469b47ede
children 0e0a43761b49
files Gui/cfg.c Gui/cfg.h Gui/interface.c Gui/interface.h Gui/mplayer/gtk/opts.c
diffstat 5 files changed, 26 insertions(+), 9 deletions(-) [+]
line wrap: on
line diff
--- a/Gui/cfg.c	Mon Nov 25 18:05:56 2002 +0000
+++ b/Gui/cfg.c	Mon Nov 25 18:18:45 2002 +0000
@@ -39,6 +39,9 @@
 char * gtkAOOSSMixer;
 char * gtkAOOSSDevice;
 
+int    gtkCacheOn = 0;
+int    gtkCacheSize = 2048;
+
 #ifdef HAVE_DXR3
  char * gtkDXR3Device;
 #endif
@@ -107,7 +110,9 @@
  { "font_autoscale",&subtitle_autoscale,CONF_TYPE_INT,CONF_RANGE,0,3,NULL },
 #endif
 
- { "cache",&stream_cache_size,CONF_TYPE_INT,CONF_RANGE,-1,65535,NULL },
+ { "cache",&gtkCacheOn,CONF_TYPE_INT,CONF_RANGE,-1,65535,NULL },
+ { "cache_size",&gtkCacheSize,CONF_TYPE_INT,CONF_RANGE,-1,65535,NULL },
+ 
  { "load_fullscreen",&gtkLoadFullscreen,CONF_TYPE_FLAG,0,0,1,NULL },
  
  { "gui_skin",&skinName,CONF_TYPE_STRING,0,0,0,NULL },
--- a/Gui/cfg.h	Mon Nov 25 18:05:56 2002 +0000
+++ b/Gui/cfg.h	Mon Nov 25 18:18:45 2002 +0000
@@ -17,6 +17,9 @@
 extern char * gtkAOOSSDevice;
 extern char * gtkDXR3Device;
 
+extern int    gtkCacheOn;
+extern int    gtkCacheSize;
+
 extern int    gtkSubDumpMPSub;
 extern int    gtkSubDumpSrt;
 
--- a/Gui/interface.c	Mon Nov 25 18:05:56 2002 +0000
+++ b/Gui/interface.c	Mon Nov 25 18:18:45 2002 +0000
@@ -77,6 +77,12 @@
  return strdup( str );
 }
 
+char * gstrchr( char * str,int c )
+{
+ if ( !str ) return NULL;
+ return strchr( str,c );
+}
+
 void gfree( void ** p )
 {
  if ( *p == NULL ) return;
@@ -541,6 +547,9 @@
 	
 	if ( guiIntfStruct.StreamType == STREAMTYPE_STREAM ) btnSet( evSetMoviePosition,1 );
 	 else btnSet( evSetMoviePosition,0 );
+	 
+	if ( gtkCacheOn ) stream_cache_size=gtkCacheSize;
+	 else stream_cache_size=-1;
 
 // -- audio
         if ( audio_out )
--- a/Gui/interface.h	Mon Nov 25 18:05:56 2002 +0000
+++ b/Gui/interface.h	Mon Nov 25 18:18:45 2002 +0000
@@ -193,6 +193,7 @@
 extern int    gstrcmp( char * a,char * b );
 extern void   gfree( void ** p );
 extern void   gaddlist( char *** list,char * entry );
+extern char * gstrchr( char * str,int c );
 
 #define guiSetFilename( s,n ) { gfree( (void **)&s ); s=gstrdup( n ); }
 
--- a/Gui/mplayer/gtk/opts.c	Mon Nov 25 18:05:56 2002 +0000
+++ b/Gui/mplayer/gtk/opts.c	Mon Nov 25 18:18:45 2002 +0000
@@ -177,9 +177,10 @@
     if ( audio_driver_list )
      {
       char * name = gstrdup( audio_driver_list[0] );
-      char * sep = strchr( audio_driver_list[0],':' );
+      char * sep = gstrchr( audio_driver_list[0],':' );
       if ( sep ) *sep=0;
       if ( !gstrcmp( name,(char *)info->short_name ) ) old_audio_driver=i - 1;
+      free( name );
      }
     tmp[0]=(char *)info->short_name; tmp[1]=(char *)info->name; gtk_clist_append( GTK_CLIST( CLADrivers ),tmp );
    }
@@ -311,11 +312,9 @@
  }
 
  gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( CBCache ),0 );
- if ( stream_cache_size > 0 )
-  {
-   gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( CBCache ),1 );
-   gtk_adjustment_set_value( SBCacheadj,(float)stream_cache_size );
-  } else gtk_widget_set_sensitive( SBCache,FALSE );
+ gtk_adjustment_set_value( SBCacheadj,(float)gtkCacheSize );
+ if ( !gtkCacheOn ) gtk_widget_set_sensitive( SBCache,FALSE );
+  else gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( CBCache ),1 );
 
 // -- disables
 #ifndef USE_SUB
@@ -479,8 +478,8 @@
 	gtkLoadFullscreen=gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON( CBLoadFullscreen ) );
 	gtkSet( gtkSetAutoq,HSPPQualityadj->value,NULL );
 
-	if ( gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON( CBCache ) ) ) stream_cache_size=(int)SBCacheadj->value;
-	 else stream_cache_size=-1;
+	if ( gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON( CBCache ) ) ) { gtkCacheSize=(int)SBCacheadj->value; gtkCacheOn=1; }
+	 else gtkCacheOn=0;
 
 	{
 	 int i;