Mercurial > mplayer.hg
changeset 9055:4a42c0604ce1
- rewrite sub_fps
- add fps support
- rewrite history
author | pontscho |
---|---|
date | Tue, 21 Jan 2003 13:33:40 +0000 |
parents | 1a8d13c9b7a5 |
children | 3086611e8213 |
files | Gui/cfg.c Gui/interface.c Gui/interface.h Gui/mplayer/gtk/common.c Gui/mplayer/gtk/fs.c Gui/mplayer/gtk/fs.h Gui/mplayer/gtk/opts.c help/help_mp-en.h mplayer.c mplayer.h |
diffstat | 10 files changed, 91 insertions(+), 79 deletions(-) [+] |
line wrap: on
line diff
--- a/Gui/cfg.c Tue Jan 21 11:29:44 2003 +0000 +++ b/Gui/cfg.c Tue Jan 21 13:33:40 2003 +0000 @@ -230,6 +230,21 @@ } free( cfg ); +// -- reade file loader history + cfg=get_path( "gui.history" ); + if ( (f=fopen( cfg,"rt+" )) ) + { + int i = 0; + while ( !feof( f ) ) + { + char tmp[512]; + if ( gfgets( tmp,512,f ) == NULL ) continue; + fsHistory[i++]=gstrdup( tmp ); + } + fclose( f ); + } + free( cfg ); + #ifdef USE_SETLOCALE setlocale( LC_ALL,"" ); #endif @@ -315,6 +330,18 @@ } free( cfg ); +// -- save file loader history + cfg=get_path( "gui.history" ); + if ( (f=fopen( cfg,"wt+" )) ) + { + int i = 0; +// while ( fsHistory[i] != NULL ) + for ( i=0;i < 5; i++) + if( fsHistory[i] ) fprintf( f,"%s\n",fsHistory[i] ); + fclose( f ); + } + free( cfg ); + #ifdef USE_SETLOCALE setlocale( LC_ALL,"" ); #endif
--- a/Gui/interface.c Tue Jan 21 11:29:44 2003 +0000 +++ b/Gui/interface.c Tue Jan 21 13:33:40 2003 +0000 @@ -597,7 +597,8 @@ #endif break; case guiSetDefaults: - if ( guiIntfStruct.Playing == 1 && guiIntfStruct.FilenameChanged ) +// if ( guiIntfStruct.Playing == 1 && guiIntfStruct.FilenameChanged ) + if ( guiIntfStruct.FilenameChanged ) { audio_id=-1; video_id=-1; @@ -607,10 +608,12 @@ autosync=0; vcd_track=0; dvd_title=0; + force_fps=0; } wsPostRedisplay( &appMPlayer.subWindow ); break; case guiSetParameters: + guiGetEvent( guiSetDefaults,NULL ); switch ( guiIntfStruct.StreamType ) { case STREAMTYPE_PLAYLIST: @@ -754,6 +757,8 @@ URLItem *URLList = NULL; +char *fsHistory[fsPersistant_MaxPos] = { NULL,NULL,NULL,NULL,NULL }; + #if defined( MP_DEBUG ) && 0 void list( void ) {
--- a/Gui/interface.h Tue Jan 21 11:29:44 2003 +0000 +++ b/Gui/interface.h Tue Jan 21 13:33:40 2003 +0000 @@ -169,6 +169,10 @@ extern URLItem * URLList; +#define fsPersistant_MaxPath 512 +#define fsPersistant_MaxPos 5 +extern char * fsHistory[fsPersistant_MaxPos]; + #define gtkSetContrast 0 #define gtkSetBrightness 1 #define gtkSetHue 2
--- a/Gui/mplayer/gtk/common.c Tue Jan 21 11:29:44 2003 +0000 +++ b/Gui/mplayer/gtk/common.c Tue Jan 21 13:33:40 2003 +0000 @@ -29,9 +29,10 @@ frame=gtk_frame_new( title ); gtk_widget_set_name( frame,"frame" ); gtk_widget_show( frame ); + gtk_frame_set_shadow_type( GTK_FRAME( frame ),type ); + if ( !parent ) return frame; if ( add ) gtk_container_add( GTK_CONTAINER( parent ),frame ); else gtk_box_pack_start( GTK_BOX( parent ),frame,FALSE,FALSE,0 ); - gtk_frame_set_shadow_type( GTK_FRAME( frame ),type ); return frame; }
--- a/Gui/mplayer/gtk/fs.c Tue Jan 21 11:29:44 2003 +0000 +++ b/Gui/mplayer/gtk/fs.c Tue Jan 21 13:33:40 2003 +0000 @@ -304,14 +304,12 @@ if ( fsTopList_items ) g_list_free( fsTopList_items ); fsTopList_items=NULL; { - char hist[fsPersistant_MaxPath + 1]; + char * hist; + int i, c = 1; - bzero( hist,fsPersistant_MaxPath + 1 ); - if ( fs_PersistantHistory( 0,hist,0 ) == 0 ) - { - fsTopList_items=g_list_append( fsTopList_items,hist ); - chdir( hist ); - } else fsTopList_items=g_list_append( fsTopList_items,(gchar *)get_current_dir_name() ); + for ( i=0;i < fsPersistant_MaxPos;i++ ) + if ( fsHistory[i] ) { fsTopList_items=g_list_append( fsTopList_items,fsHistory[i] ); c=0; } + if ( c ) fsTopList_items=g_list_append( fsTopList_items,(gchar *)get_current_dir_name() ); } if ( getenv( "HOME" ) ) fsTopList_items=g_list_append( fsTopList_items,getenv( "HOME" ) ); fsTopList_items=g_list_append( fsTopList_items,"/home" ); @@ -332,60 +330,16 @@ fsFileSelect=NULL; } -//---------------------------------------------------- +int fs_PersistantHistory( char * subject ) +{ + int i; -/* - * int fs_PersistantHistory(int rw_command, char *subject) - * - * is used to read/write in the $HOME/.mplayer/persistant_history file - * parameters: rw_command = (0,1) <=> (read,write) - * subject - for i/o - * pos - position in history file (line) - * return: 0 = ok - * - */ - - int fs_PersistantHistory(int rw_command, char *subject, int pos) - { - FILE *pfile; - - char path[fsPersistant_MaxPath+1]; - int fdata,fpos = 0; - char *subpath = NULL; - const char *ph_filename = fsPersistant_FilePath; - - if (!subject) return -1; - if (pos < 0 || pos > fsPersistant_MaxPos) return -2; - bzero(path,fsPersistant_MaxPath+1); - - subpath = getenv("HOME"); - if (!subpath) return -3; - if (strlen(subpath)+strlen(fsPersistant_FilePath) > fsPersistant_MaxPath) return -4; - memcpy(path, subpath, strlen(subpath)); - memcpy(path+strlen(subpath), ph_filename, strlen(ph_filename)); + for ( i=0;i < fsPersistant_MaxPos;i++ ) if ( fsHistory[i] && !strcmp( fsHistory[i],subject ) ) return 0; + gfree( (void **)&fsHistory[fsPersistant_MaxPos - 1] ); + for ( i=fsPersistant_MaxPos - 1;i;i-- ) fsHistory[i]=fsHistory[i - 1]; + fsHistory[0]=gstrdup( subject ); - if (rw_command == 0) - { - pfile = fopen(path,"r"); - if (!pfile) return -5; - while ((fdata = fgetc(pfile)) != EOF) - { - if (fpos > fsPersistant_MaxPath) { fclose(pfile);return -6; } - subject[fpos++] = fdata; - } - fclose(pfile); - return 0; - } - - if (rw_command == 1) - { - pfile = fopen(path,"w+"); - if (!pfile) return -6; - fprintf(pfile,"%s",subject); - fclose(pfile); - return 0; - } - else return -10; + return 0; } //----------------------------------------------- @@ -482,7 +436,6 @@ fsSelectedFile=fsThatDir; CheckDir( fsFNameList,get_current_dir_name() ); gtk_entry_set_text( GTK_ENTRY( fsPathCombo ),(unsigned char *)get_current_dir_name() ); - fs_PersistantHistory(1,get_current_dir_name(),0); //totem, write into history return; } @@ -516,6 +469,7 @@ guiIntfStruct.FilenameChanged=1; gfree( (void **)&guiIntfStruct.AudioFile ); gfree( (void **)&guiIntfStruct.Subtitlename ); + fs_PersistantHistory( fsSelectedDirectory ); //totem, write into history break; #ifdef USE_SUB case fsSubtitleSelector: @@ -553,7 +507,7 @@ void fs_Cancel_released( GtkButton * button,gpointer user_data ) { HideFileSelect(); - fs_PersistantHistory(1,get_current_dir_name(),0); //totem, write into history file + fs_PersistantHistory( get_current_dir_name() ); //totem, write into history file } void fs_fsFNameList_select_row( GtkWidget * widget,gint row,gint column,GdkEventButton *bevent,gpointer user_data )
--- a/Gui/mplayer/gtk/fs.h Tue Jan 21 11:29:44 2003 +0000 +++ b/Gui/mplayer/gtk/fs.h Tue Jan 21 13:33:40 2003 +0000 @@ -9,10 +9,6 @@ #define fsAudioSelector 3 #define fsFontSelector 4 -#define fsPersistant_MaxPath 512 -#define fsPersistant_MaxPos 10 -#define fsPersistant_FilePath "/.mplayer/phistory" - #include <errno.h> extern GtkWidget * fsFileSelect;
--- a/Gui/mplayer/gtk/opts.c Tue Jan 21 11:29:44 2003 +0000 +++ b/Gui/mplayer/gtk/opts.c Tue Jan 21 13:33:40 2003 +0000 @@ -90,9 +90,10 @@ static GtkWidget * HSSubPosition; static GtkWidget * HSSubFPS; static GtkWidget * HSPPQuality; +static GtkWidget * HSFPS; static GtkAdjustment * HSExtraStereoMuladj, * HSAudioDelayadj, * HSPanscanadj, * HSSubDelayadj; -static GtkAdjustment * HSSubPositionadj, * HSSubFPSadj, * HSPPQualityadj; +static GtkAdjustment * HSSubPositionadj, * HSSubFPSadj, * HSPPQualityadj, * HSFPSadj; #ifndef HAVE_FREETYPE static GtkWidget * HSFontFactor; @@ -246,6 +247,8 @@ if ( !gstrcmp( vo_driver[0],"dxr3" ) ) gtk_widget_set_sensitive( VConfig,TRUE ); #endif } + + gtk_adjustment_set_value( HSFPS,force_fps ); // -- 3. page gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( CBSubOverlap ),suboverlap_enabled ); @@ -499,6 +502,7 @@ sub_delay=HSSubDelayadj->value; sub_fps=HSSubFPSadj->value; sub_pos=(int)HSSubPositionadj->value; + force_fps=HSFPSadj->value; if ( gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON( RBOSDNone ) ) ) osd_level=0; if ( gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON( RBOSDIndicator ) ) ) osd_level=1; if ( gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON( RBOSDTandP ) ) ) osd_level=2; @@ -840,12 +844,27 @@ CBHFramedrop=AddCheckButton( MSGTR_PREFERENCES_HFrameDrop,vbox5 ); CBFlip=AddCheckButton( MSGTR_PREFERENCES_Flip,vbox5 ); - hbox3=AddHBox( vbox5,1 ); + table1=gtk_table_new( 3,2,FALSE ); + gtk_widget_set_name( table1,"table1" ); + gtk_widget_show( table1 ); + gtk_box_pack_start( GTK_BOX( vbox5 ),table1,FALSE,FALSE,0 ); - AddLabel( MSGTR_PREFERENCES_Panscan,hbox3 ); + label=AddLabel( MSGTR_PREFERENCES_Panscan,NULL ); + gtk_table_attach( GTK_TABLE( table1 ),label,0,1,0,1,(GtkAttachOptions)( GTK_FILL ),(GtkAttachOptions)( 0 ),0,0 ); + + label=AddLabel( MSGTR_PREFERENCES_FPS,NULL ); + gtk_table_attach( GTK_TABLE( table1 ),label,0,1,1,2,(GtkAttachOptions)( GTK_FILL ),(GtkAttachOptions)( 0 ),0,0 ); HSPanscanadj=GTK_ADJUSTMENT( gtk_adjustment_new( 0,0,1,0.001,0,0 ) ); - HSPanscan=AddHScaler( HSPanscanadj,hbox3,1 ); + HSPanscan=AddHScaler( HSPanscanadj,NULL,1 ); + gtk_table_attach( GTK_TABLE( table1 ),HSPanscan,1,2,0,1,(GtkAttachOptions)( GTK_EXPAND | GTK_FILL ),(GtkAttachOptions)( 0 ),0,0 ); + + HSFPSadj=GTK_ADJUSTMENT( gtk_adjustment_new( 0,0,1000,0.001,0,0 ) ); + HSFPS=gtk_spin_button_new( GTK_ADJUSTMENT( HSFPSadj ),1,3 ); + gtk_widget_set_name( HSFPS,"HSFPS" ); + gtk_widget_show( HSFPS ); + gtk_spin_button_set_numeric( GTK_SPIN_BUTTON( HSFPS ),TRUE ); + gtk_table_attach( GTK_TABLE( table1 ),HSFPS,1,2,1,2,(GtkAttachOptions)( GTK_EXPAND | GTK_FILL ),(GtkAttachOptions)( 0 ),0,0 ); label=AddLabel( MSGTR_PREFERENCES_Video,NULL ); gtk_notebook_set_tab_label( GTK_NOTEBOOK( notebook1 ),gtk_notebook_get_nth_page( GTK_NOTEBOOK( notebook1 ),1 ),label ); @@ -892,23 +911,27 @@ label=AddLabel( MSGTR_PREFERENCES_SUB_Delay,NULL ); gtk_table_attach( GTK_TABLE( table1 ),label,0,1,0,1,(GtkAttachOptions)( GTK_FILL ),(GtkAttachOptions)( 0 ),0,0 ); + label=AddLabel( MSGTR_PREFERENCES_SUB_POS,NULL ); + gtk_table_attach( GTK_TABLE( table1 ),label,0,1,1,2,(GtkAttachOptions)( GTK_FILL ),(GtkAttachOptions)( 0 ),0,0 ); + label=AddLabel( MSGTR_PREFERENCES_SUB_FPS,NULL ); - gtk_table_attach( GTK_TABLE( table1 ),label,0,1,1,2,(GtkAttachOptions)( GTK_FILL ),(GtkAttachOptions)( 0 ),0,0 ); + gtk_table_attach( GTK_TABLE( table1 ),label,0,1,2,3,(GtkAttachOptions)( GTK_FILL ),(GtkAttachOptions)( 0 ),0,0 ); HSSubDelayadj=GTK_ADJUSTMENT( gtk_adjustment_new( 0,-10.0,10,0.01,0,0 ) ); HSSubDelay=AddHScaler( HSSubDelayadj,NULL,1 ); gtk_table_attach( GTK_TABLE( table1 ),HSSubDelay,1,2,0,1,(GtkAttachOptions)( GTK_EXPAND | GTK_FILL ),(GtkAttachOptions)( 0 ),0,0 ); - label=AddLabel( MSGTR_PREFERENCES_SUB_POS,NULL ); - gtk_table_attach( GTK_TABLE( table1 ),label,0,1,2,3,(GtkAttachOptions)( GTK_FILL ),(GtkAttachOptions)( 0 ),0,0 ); - HSSubPositionadj=GTK_ADJUSTMENT( gtk_adjustment_new( 100,0,100,1,0,0 ) ); HSSubPosition=AddHScaler( HSSubPositionadj,NULL,0 ); - gtk_table_attach( GTK_TABLE( table1 ),HSSubPosition,1,2,2,3,(GtkAttachOptions)( GTK_EXPAND | GTK_FILL ),(GtkAttachOptions)( 0 ),0,0 ); + gtk_table_attach( GTK_TABLE( table1 ),HSSubPosition,1,2,1,2,(GtkAttachOptions)( GTK_EXPAND | GTK_FILL ),(GtkAttachOptions)( 0 ),0,0 ); HSSubFPSadj=GTK_ADJUSTMENT( gtk_adjustment_new( 0,0,100,0.01,0,0 ) ); - HSSubFPS=AddHScaler( HSSubFPSadj,NULL,1 ); - gtk_table_attach( GTK_TABLE( table1 ),HSSubFPS,1,2,1,2,(GtkAttachOptions)( GTK_FILL ),(GtkAttachOptions)( 0 ),0,0 ); + HSSubFPS=gtk_spin_button_new( GTK_ADJUSTMENT( HSSubFPSadj ),1,3 ); + gtk_widget_set_name( HSSubFPS,"HSSubFPS" ); + gtk_widget_show( HSSubFPS ); + gtk_widget_set_usize( HSSubFPS,60,-1 ); + gtk_spin_button_set_numeric( GTK_SPIN_BUTTON( HSSubFPS ),TRUE ); + gtk_table_attach( GTK_TABLE( table1 ),HSSubFPS,1,2,2,3,(GtkAttachOptions)( GTK_EXPAND | GTK_FILL ),(GtkAttachOptions)( 0 ),0,0 ); vbox9=AddVBox( vbox8,0 );
--- a/help/help_mp-en.h Tue Jan 21 11:29:44 2003 +0000 +++ b/help/help_mp-en.h Tue Jan 21 13:33:40 2003 +0000 @@ -584,6 +584,7 @@ #define MSGTR_PREFERENCES_AutoSyncValue "Autosync: " #define MSGTR_PREFERENCES_CDROMDevice "CD-ROM device:" #define MSGTR_PREFERENCES_DVDDevice "DVD device:" +#define MSGTR_PREFERENCES_FPS "Movie FPS:" // --- messagebox #define MSGTR_MSGBOX_LABEL_FatalError "Fatal error!"
--- a/mplayer.c Tue Jan 21 11:29:44 2003 +0000 +++ b/mplayer.c Tue Jan 21 13:33:40 2003 +0000 @@ -238,7 +238,7 @@ static int softsleep=0; -static float force_fps=0; + float force_fps=0; static int force_srate=0; static int audio_output_format=0; int frame_dropping=0; // option 0=no drop 1= drop vo 2= drop decode