summaryrefslogtreecommitdiffstats
path: root/Gui
diff options
context:
space:
mode:
authorpontscho <pontscho@b3059339-0415-0410-9bf9-f77b7e298cf2>2002-07-25 20:26:38 +0000
committerpontscho <pontscho@b3059339-0415-0410-9bf9-f77b7e298cf2>2002-07-25 20:26:38 +0000
commitb1be9a6a39d94fc1cbe00eaaa7c7425c081d0721 (patch)
tree67e25086b99bac66ff938b93dfffb24d0de693c9 /Gui
parent9ba7dabbab413d4eab2c262589276538b1193a09 (diff)
downloadmpv-b1be9a6a39d94fc1cbe00eaaa7c7425c081d0721.tar.bz2
mpv-b1be9a6a39d94fc1cbe00eaaa7c7425c081d0721.tar.xz
- add preferences support (first try)
- fix some playlist bug - fix some equ bug - fix some redraw bug - fix dvd playing - fix file open dialog box - etc. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@6795 b3059339-0415-0410-9bf9-f77b7e298cf2
Diffstat (limited to 'Gui')
-rw-r--r--Gui/Makefile2
-rw-r--r--Gui/cfg.c11
-rw-r--r--Gui/interface.c292
-rw-r--r--Gui/interface.h49
-rw-r--r--Gui/mplayer/gtk/about.c2
-rw-r--r--Gui/mplayer/gtk/eq.c34
-rw-r--r--Gui/mplayer/gtk/eq.h3
-rw-r--r--Gui/mplayer/gtk/fs.c82
-rw-r--r--Gui/mplayer/gtk/fs.h3
-rw-r--r--Gui/mplayer/gtk/mb.c3
-rw-r--r--Gui/mplayer/gtk/mb.h1
-rw-r--r--Gui/mplayer/gtk/menu.c2
-rw-r--r--Gui/mplayer/gtk/opts.c2318
-rw-r--r--Gui/mplayer/gtk/opts.h16
-rw-r--r--Gui/mplayer/gtk/sb.c2
-rw-r--r--Gui/mplayer/mplayer.c24
-rw-r--r--Gui/mplayer/mw.h53
-rw-r--r--Gui/mplayer/play.c91
-rw-r--r--Gui/mplayer/play.h3
-rw-r--r--Gui/mplayer/sw.h4
-rw-r--r--Gui/mplayer/widgets.c12
-rw-r--r--Gui/wm/ws.c9
-rw-r--r--Gui/wm/ws.h2
23 files changed, 2067 insertions, 951 deletions
diff --git a/Gui/Makefile b/Gui/Makefile
index 6a3309fd8e..e165d63edf 100644
--- a/Gui/Makefile
+++ b/Gui/Makefile
@@ -14,7 +14,7 @@ endif
CFLAGS = $(OPTIMIZE) $(INCDIR) $(DEBUG)
-SRCS = wm/ws.c wm/wsconv.c app.c events.c interface.c \
+SRCS = wm/ws.c wm/wsconv.c app.c events.c interface.c cfg.c \
bitmap/bitmap.c bitmap/tga/tga.c bitmap/bmp/bmp.c bitmap/png/png.c \
skin/skin.c skin/font.c skin/cut.c \
mplayer/mplayer.c mplayer/widgets.c mplayer/play.c \
diff --git a/Gui/cfg.c b/Gui/cfg.c
index cf958b7a00..f59cefb969 100644
--- a/Gui/cfg.c
+++ b/Gui/cfg.c
@@ -46,7 +46,7 @@ int gtkSubUnicode = 0; //
int gtkSubDumpMPSub = 0;
int gtkSubDumpSrt = 0;
float gtkSubDelay = 0.0f;
-float gtkSubFPS = -1.0f;
+float gtkSubFPS = 0.0f;
int gtkSubPos = 100; //
float gtkSubFFactor = 0.75;
@@ -72,7 +72,7 @@ static config_t gui_opts[] =
{ "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,0,10,NULL },
+ { "v_vfm",&gtkVVFM,CONF_TYPE_INT,CONF_RANGE,-1,10,NULL },
{ "vf_pp",&gtkVPP,CONF_TYPE_FLAG,0,0,1,NULL },
{ "vf_autoq",&gtkVAutoq,CONF_TYPE_INT,CONF_RANGE,0,100,NULL },
@@ -169,7 +169,12 @@ int cfg_write( void )
case CONF_TYPE_INT:
case CONF_TYPE_FLAG: fprintf( f,"%s = %d\n",gui_opts[i].name,*( (int *)gui_opts[i].p ) ); break;
case CONF_TYPE_FLOAT: fprintf( f,"%s = %f\n",gui_opts[i].name,*( (float *)gui_opts[i].p ) ); break;
- case CONF_TYPE_STRING: if ( *( (char **)gui_opts[i].p ) ) fprintf( f,"%s = \"%s\"\n",gui_opts[i].name,*( (char **)gui_opts[i].p ) ); break;
+ case CONF_TYPE_STRING:
+ {
+ char * tmp = *( (char **)gui_opts[i].p );
+ if ( tmp && tmp[0] ) fprintf( f,"%s = \"%s\"\n",gui_opts[i].name,tmp );
+ break;
+ }
}
}
fclose( f );
diff --git a/Gui/interface.c b/Gui/interface.c
index ad579f10a9..96dc7f121f 100644
--- a/Gui/interface.c
+++ b/Gui/interface.c
@@ -14,8 +14,12 @@
#include "mplayer/widgets.h"
#include "mplayer/mplayer.h"
#include "app.h"
+#include "cfg.h"
+#include "../help_mp.h"
+#include "../subreader.h"
#include "../libvo/x11_common.h"
#include "../libvo/video_out.h"
+#include "../libvo/font_load.h"
#include "../input/input.h"
#include "../libao2/audio_out.h"
#include "../mixer.h"
@@ -47,17 +51,46 @@ char * gstrcat( char ** dest,char * src )
return tmp;
}
+int gstrcmp( char * a,char * b )
+{
+ if ( !a && !b ) return 0;
+ if ( !a || !b ) return -1;
+ return strcmp( a,b );
+}
+
+char * gstrdup( char * str )
+{
+ if ( !str ) return NULL;
+ return strdup( str );
+}
+
+void gfree( void ** p )
+{
+ if ( *p == NULL ) return;
+ free( *p ); *p=NULL;
+}
+
+void gset( char ** str,char * what )
+{
+ if ( *str ) { if ( !strstr( *str,what ) ) gstrcat( str,"," ); gstrcat( str,what ); }
+ else gstrcat( str,what );
+}
+
void guiInit( void )
{
memset( &guiIntfStruct,0,sizeof( guiIntfStruct ) );
memset( &gtkEquChannels,0,sizeof( gtkEquChannels ) );
+ gtkAOOSSMixer=strdup( PATH_DEV_MIXER );
+ gtkAOOSSDevice=strdup( PATH_DEV_DSP );
+ cfg_read();
appInit( (void*)mDisplay );
+ if ( plCurrent ) mplSetFileName( plCurrent->path,plCurrent->name );
}
void guiDone( void )
{
mp_msg( MSGT_GPLAYER,MSGL_V,"[mplayer] exit.\n" );
- mplStop();
+ cfg_write();
gtkDone();
wsXDone();
}
@@ -91,6 +124,54 @@ typedef struct
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;
+ if ( vo_font->name ) free( vo_font->name );
+ if ( vo_font->fpath ) free( vo_font->fpath );
+ for ( i=0;i<16;i++ )
+ if ( vo_font->pic_a[i] )
+ {
+ if ( vo_font->pic_a[i]->bmp ) free( vo_font->pic_a[i]->bmp );
+ if ( vo_font->pic_a[i]->pal ) free( vo_font->pic_a[i]->pal );
+ }
+ for ( i=0;i<16;i++ )
+ if ( vo_font->pic_b[i] )
+ {
+ if ( vo_font->pic_b[i]->bmp ) free( vo_font->pic_b[i]->bmp );
+ if ( vo_font->pic_b[i]->pal ) free( vo_font->pic_b[i]->pal );
+ }
+ free( vo_font ); vo_font=NULL;
+ }
+ if ( guiIntfStruct.Fontname )
+ {
+ vo_font=read_font_desc( guiIntfStruct.Fontname,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 );
+ if ( !vo_font )
+ {
+ gfree( (void **)&guiIntfStruct.Fontname ); guiIntfStruct.Fontname=gstrdup( DATADIR"/font/font.desc" );
+ vo_font=read_font_desc( guiIntfStruct.Fontname,font_factor,0 );
+ }
+ }
+}
+#endif
void guiGetEvent( int type,char * arg )
{
@@ -126,7 +207,6 @@ void guiGetEvent( int type,char * arg )
break;
case guiReDrawSubWindow:
wsPostRedisplay( &appMPlayer.subWindow );
- if ( guiIntfStruct.Playing == 1 ) wsSetBackgroundRGB( &appMPlayer.subWindow,0,0,0 );
break;
case guiSetShVideo:
{
@@ -192,18 +272,11 @@ void guiGetEvent( int type,char * arg )
}
break;
#endif
- case guiClearStruct:
-#ifdef USE_DVDREAD
- if ( (unsigned int)arg & guiDVD ) memset( &guiIntfStruct.DVD,0,sizeof( guiDVDStruct ) );
-#endif
-#ifdef HAVE_VCD
- if ( (unsigned int)arg & guiVCD ) guiIntfStruct.VCDTracks=0;
-#endif
- break;
case guiReDraw:
mplEventHandling( evRedraw,0 );
break;
case guiSetVolume:
+// -- audio
if ( audio_out )
{
float l,r;
@@ -215,6 +288,9 @@ void guiGetEvent( int type,char * arg )
btnModify( evSetBalance,guiIntfStruct.Balance );
}
+ if ( gtkAONoSound ) { if ( !muted ) mixer_mute(); }
+ else if ( muted ) mixer_mute();
+
if ( gtkEnableAudioEqualizer )
{
equalizer_t eq;
@@ -226,40 +302,118 @@ void guiGetEvent( int type,char * arg )
gtkSet( gtkSetEqualizer,0,&eq );
}
}
+// -- subtitle
+ gtkSubUnicode=sub_unicode;
+ gtkSubDelay=sub_delay;
+ gtkSubFPS=sub_fps;
+ gtkSubPos=sub_pos;
+#ifdef USE_OSD
+ gtkSubFFactor=font_factor;
+#endif
break;
case guiSetDefaults:
-#if defined( HAVE_VCD ) || defined( USE_DVDREAD )
- if ( guiIntfStruct.DiskChanged )
- {
-/*
-#ifdef USE_DVDREAD
- switch ( guiIntfStruct.StreamType )
- {
- case STREAMTYPE_DVD: filename=DEFAULT_DVD_DEVICE; break;
- }
-#endif
-*/
- guiIntfStruct.DiskChanged=0;
- guiGetEvent( guiCEvent,(char *)guiSetPlay );
- }
-#endif
+ if ( filename && gstrcmp( filename,guiIntfStruct.Filename ) )
+ {
+ gtkSet( gtkDelPl,0,NULL ); guiIntfStruct.StreamType=STREAMTYPE_FILE;
+ guiSetFilename( guiIntfStruct.Filename,filename );
+ }
-#ifdef USE_SUB
- if ( guiIntfStruct.SubtitleChanged || !guiIntfStruct.FilenameChanged )
- {
- if ( ( guiIntfStruct.Subtitlename )&&( guiIntfStruct.Subtitlename[0] != 0 ) ) sub_name=guiIntfStruct.Subtitlename;
- guiIntfStruct.SubtitleChanged=0;
+ guiIntfStruct.DiskChanged=0;
+ guiIntfStruct.FilenameChanged=0;
+
+// --- video opts
+ if ( !gtkVODriver )
+ {
+ int i = 0, c = 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();
+ { gtkVODriver=gstrdup( (char *)info->short_name ); break; }
+ }
}
+
+ if ( gtkVODriver ) { if ( video_driver ) free( video_driver ); video_driver=strdup( gtkVODriver ); }
+ else { gtkMessageBox( GTK_MB_FATAL,MSGTR_IDFGCVD ); exit_player( "gui init" ); }
+
+ if ( gtkVPP )
+ {
+ if ( vo_plugin_args )
+ {
+ int i = 0;
+ while ( vo_plugin_args[i] ) if ( !gstrcmp( vo_plugin_args[i++],"pp" ) ) { i=-1; break; }
+ if ( i != -1 )
+ { vo_plugin_args=realloc( vo_plugin_args,( i + 2 ) * sizeof( char * ) ); vo_plugin_args[i]=strdup( "pp" ); vo_plugin_args[i+1]=NULL; }
+ } else { vo_plugin_args=malloc( 2 * sizeof( char * ) ); vo_plugin_args[0]=strdup( "pp" ); vo_plugin_args[1]=NULL; }
+ auto_quality=gtkVAutoq;
+ }
+ else
+ if ( vo_plugin_args )
+ {
+ int n = 0;
+ while ( vo_plugin_args[n++] ); n--;
+ if ( n > -1 )
+ {
+ int i = 0;
+ while ( vo_plugin_args[i] ) if ( !gstrcmp( vo_plugin_args[i++],"pp" ) ) break; i--;
+ if ( n == i )
+ {
+ if ( n == 1 ) { free( vo_plugin_args[0] ); free( vo_plugin_args ); vo_plugin_args=NULL; }
+ else memcpy( &vo_plugin_args[i],&vo_plugin_args[i+1],( n - i ) * sizeof( char * ) );
+ }
+ }
+ 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;
+
+// --- audio opts
+ audio_delay=gtkAODelay;
+ if ( ao_plugin_cfg.plugin_list ) { free( ao_plugin_cfg.plugin_list ); ao_plugin_cfg.plugin_list=NULL; }
+ if ( gtkEnableAudioEqualizer ) gset( &ao_plugin_cfg.plugin_list,"eq" );
+ if ( gtkAONorm ) gset( &ao_plugin_cfg.plugin_list,"volnorm" );
+ if ( gtkAOExtraStereo )
+ {
+ gset( &ao_plugin_cfg.plugin_list,"extrastereo" );
+ ao_plugin_cfg.pl_extrastereo_mul=gtkAOExtraStereoMul;
+ }
+ mixer_device=gtkAOOSSMixer;
+ if ( audio_driver ) free( audio_driver );
+ if ( !gstrcmp( gtkAODriver,"oss" ) && gtkAOOSSDevice )
+ {
+ char * tmp = calloc( 1,strlen( gtkAODriver ) + strlen( gtkAOOSSDevice ) + 2 );
+ sprintf( tmp,"%s:%s",gtkAODriver,gtkAOOSSDevice );
+ 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;
+ gtkSubDumpMPSub=gtkSubDumpSrt=0;
+#endif
+#if defined( USE_OSD ) || defined( USE_SUB )
+ guiLoadFont();
#endif
-
+
+// --- misc
if ( guiIntfStruct.AudioFile ) audio_stream=guiIntfStruct.AudioFile;
else if ( guiIntfStruct.FilenameChanged ) audio_stream=NULL;
-
- if ( gtkEnableAudioEqualizer )
- {
- if ( ao_plugin_cfg.plugin_list ) { if ( !strstr( ao_plugin_cfg.plugin_list,"eq" ) ) gstrcat( &ao_plugin_cfg.plugin_list,",eq" ); }
- else gstrcat( &ao_plugin_cfg.plugin_list,"eq" );
- }
+ index_mode=gtkVIndex;
break;
}
@@ -301,7 +455,7 @@ void list( void )
void * gtkSet( int cmd,float fparam, void * vparam )
{
- mp_cmd_t * mp_cmd = (mp_cmd_t *)calloc( 1,sizeof( *mp_cmd ) );
+ mp_cmd_t * mp_cmd;
equalizer_t * eq = (equalizer_t *)vparam;
plItem * item = (plItem *)vparam;
@@ -338,7 +492,7 @@ void * gtkSet( int cmd,float fparam, void * vparam )
if ( !plCurrent && plList ) plCurrent=plList;
return plCurrent;
}
- break;
+ return NULL;
case gtkGetCurrPlItem: // get current item
return plCurrent;
case gtkDelPl: // delete list
@@ -366,17 +520,75 @@ void * gtkSet( int cmd,float fparam, void * vparam )
plList=NULL; plCurrent=NULL;
}
return NULL;
+// --- subtitle
+ case gtkSetSubAuto:
+ gtkSubAuto=(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;
+ return NULL;
+ case gtkSetSubFPS:
+ gtkSubFPS=sub_fps=(int)fparam;
+ return NULL;
+ case gtkSetSubPos:
+ gtkSubPos=sub_pos=(int)fparam;
+ return NULL;
+#if defined( USE_OSD ) || defined( USE_SUB )
+ case gtkSetFontFactor:
+ gtkSubFFactor=fparam;
+ guiLoadFont();
+ return NULL;
+#endif
+// --- misc
+ case gtkClearStruct:
+ if ( (unsigned int)fparam & guiFilenames )
+ {
+ gfree( (void **)&guiIntfStruct.Filename );
+ gfree( (void **)&guiIntfStruct.Subtitlename );
+ gfree( (void **)&guiIntfStruct.AudioFile );
+ }
+#ifdef USE_DVDREAD
+ if ( (unsigned int)fparam & guiDVD ) memset( &guiIntfStruct.DVD,0,sizeof( guiDVDStruct ) );
+#endif
+#ifdef HAVE_VCD
+ if ( (unsigned int)fparam & guiVCD ) guiIntfStruct.VCDTracks=0;
+#endif
+ return NULL;
+ case gtkSetExtraStereo:
+ gtkAOExtraStereoMul=fparam;
+ audio_plugin_extrastereo.control( AOCONTROL_PLUGIN_ES_SET,(int)&gtkAOExtraStereoMul );
+ return NULL;
+ case gtkSetAudioDelay:
+ audio_delay=gtkAODelay=fparam;
+ return NULL;
+ case gtkSetPanscan:
+ mp_cmd=(mp_cmd_t *)calloc( 1,sizeof( *mp_cmd ) );
+ mp_cmd->id=MP_CMD_PANSCAN; mp_cmd->name=strdup( "panscan" );
+ mp_cmd->args[0].v.f=fparam; mp_cmd->args[1].v.i=1;
+ mp_input_queue_cmd( mp_cmd );
+ return NULL;
+ case gtkSetAutoq:
+ auto_quality=gtkVAutoq=(int)fparam;
+ return NULL;
// --- set equalizers
case gtkSetContrast:
+ mp_cmd=(mp_cmd_t *)calloc( 1,sizeof( *mp_cmd ) );
mp_cmd->id=MP_CMD_CONTRAST; mp_cmd->name=strdup( "contrast" );
break;
case gtkSetBrightness:
+ mp_cmd=(mp_cmd_t *)calloc( 1,sizeof( *mp_cmd ) );
mp_cmd->id=MP_CMD_BRIGHTNESS; mp_cmd->name=strdup( "brightness" );
break;
case gtkSetHue:
+ mp_cmd=(mp_cmd_t *)calloc( 1,sizeof( *mp_cmd ) );
mp_cmd->id=MP_CMD_HUE; mp_cmd->name=strdup( "hue" );
break;
case gtkSetSaturation:
+ mp_cmd=(mp_cmd_t *)calloc( 1,sizeof( *mp_cmd ) );
mp_cmd->id=MP_CMD_SATURATION; mp_cmd->name=strdup( "saturation" );
break;
case gtkSetEqualizer:
@@ -394,7 +606,7 @@ void * gtkSet( int cmd,float fparam, void * vparam )
{ tmp.channel=i; tmp.band=j; audio_plugin_eq.control( AOCONTROL_PLUGIN_EQ_SET_GAIN,(int)&tmp ); }
}
return NULL;
- default: free( mp_cmd ); return NULL;
+ default: return NULL;
}
mp_cmd->args[0].v.i=(int)fparam;
mp_cmd->args[1].v.i=1;
diff --git a/Gui/interface.h b/Gui/interface.h
index a12b47d47b..29651a498c 100644
--- a/Gui/interface.h
+++ b/Gui/interface.h
@@ -88,6 +88,8 @@ typedef struct
char * Subtitlename;
int SubtitleChanged;
+
+ char * Fontname;
char * Othername;
int OtherChanged;
@@ -110,10 +112,9 @@ extern guiInterface_t guiIntfStruct;
#define guiReDrawSubWindow 7
#define guiSetShVideo 8
#define guiSetStream 9
-#define guiClearStruct 10
-#define guiReDraw 11
-#define guiSetVolume 12
-#define guiSetDefaults 13
+#define guiReDraw 10
+#define guiSetVolume 11
+#define guiSetDefaults 12
#define guiSetStop 0
#define guiSetPlay 1
@@ -121,6 +122,7 @@ extern guiInterface_t guiIntfStruct;
#define guiDVD 1
#define guiVCD 2
+#define guiFilenames 4
#define guiALL 0xffffffff
extern char *get_path(char *filename);
@@ -129,6 +131,7 @@ extern void guiInit( void );
extern void guiDone( void );
extern void guiGetEvent( int type,char * arg );
extern void guiEventHandling( void );
+extern void guiLoadFont( void );
typedef struct _plItem
{
@@ -142,28 +145,40 @@ extern plItem * plList;
extern plItem * plCurrent;
extern plItem * plLastPlayed;
-#define gtkSetContrast 0
-#define gtkSetBrightness 1
-#define gtkSetHue 2
-#define gtkSetSaturation 3
-#define gtkSetEqualizer 4
-#define gtkAddPlItem 5
-#define gtkGetNextPlItem 6
-#define gtkGetPrevPlItem 7
-#define gtkGetCurrPlItem 8
-#define gtkDelPl 9
+#define gtkSetContrast 0
+#define gtkSetBrightness 1
+#define gtkSetHue 2
+#define gtkSetSaturation 3
+#define gtkSetEqualizer 4
+#define gtkAddPlItem 5
+#define gtkGetNextPlItem 6
+#define gtkGetPrevPlItem 7
+#define gtkGetCurrPlItem 8
+#define gtkDelPl 9
+#define gtkSetExtraStereo 10
+#define gtkSetAudioDelay 11
+#define gtkSetPanscan 12
+#define gtkSetSubDelay 13
+#define gtkSetSubFPS 14
+#define gtkSetSubPos 15
+#define gtkSetSubAuto 16
+#define gtkSetFontFactor 17
+#define gtkSetAutoq 18
+#define gtkClearStruct 19
extern float gtkEquChannels[6][10];
extern void * gtkSet( int cmd,float param, void * vparam );
-#define gstrdup( s,ss ) { s=malloc( strlen( ss ) + 3 ); strcpy( s,ss ); }
+extern char * gstrdup( char * str );
+extern int gstrcmp( char * a,char * b );
+extern void gfree( void ** p );
-#define guiSetFilename( s,n ) { if ( s ) free( s ); s=strdup( n ); }
+#define guiSetFilename( s,n ) { gfree( (void **)&s ); s=gstrdup( n ); }
#define guiSetDF( s,d,n ) \
{ \
- if ( s ) free( s ); s=NULL; \
+ gfree( (void **)&s ); \
s=malloc( strlen( d ) + strlen( n ) + 5 ); \
sprintf( s,"%s/%s",d,n ); \
}
diff --git a/Gui/mplayer/gtk/about.c b/Gui/mplayer/gtk/about.c
index 0f2935d7ff..1ea51ac7d7 100644
--- a/Gui/mplayer/gtk/about.c
+++ b/Gui/mplayer/gtk/about.c
@@ -231,7 +231,7 @@ GtkWidget * create_About( void )
gtk_container_add( GTK_CONTAINER( hbuttonbox1 ),Ok );
gtk_signal_connect( GTK_OBJECT( About ),"destroy",GTK_SIGNAL_FUNC( ab_Ok_released ),0 );
- gtk_signal_connect( GTK_OBJECT( About ),"show",GTK_SIGNAL_FUNC( ab_AboutBox_show ),1 );
+ gtk_signal_connect( GTK_OBJECT( About ),"show",GTK_SIGNAL_FUNC( ab_AboutBox_show ),(void *)1 );
gtk_signal_connect( GTK_OBJECT( About ),"hide",GTK_SIGNAL_FUNC( ab_AboutBox_show ),0 );
gtk_signal_connect( GTK_OBJECT( Ok ),"released",GTK_SIGNAL_FUNC( ab_Ok_released ),0 );
diff --git a/Gui/mplayer/gtk/eq.c b/Gui/mplayer/gtk/eq.c
index 9294cf9a91..cc1a6f6a58 100644
--- a/Gui/mplayer/gtk/eq.c
+++ b/Gui/mplayer/gtk/eq.c
@@ -10,6 +10,7 @@
#include <gtk/gtk.h>
#include "../../events.h"
+#include "../../cfg.h"
#include "../../help_mp.h"
#include "../../../config.h"
#include "../../../help_mp.h"
@@ -21,6 +22,8 @@
#include "eq.h"
+#define eqRange 5
+
GtkWidget * Equalizer;
static GtkWidget * Notebook;
@@ -37,9 +40,6 @@ static int gtkVEquConfig = 0;
// ---
-int gtkEnableAudioEqualizer = 1;
-int gtkEnableVideoEqualizer = 1;
-
char * gtkEquChannel1 = NULL;
char * gtkEquChannel2 = NULL;
char * gtkEquChannel3 = NULL;
@@ -116,16 +116,16 @@ void ShowEqualizer( void )
VHueadj->value=(float)vo_gamma_hue;
VSaturationadj->value=(float)vo_gamma_saturation;
- if ( !guiIntfStruct.Playing && gtkEnableVideoEqualizer )
+ if ( !guiIntfStruct.Playing || !gtkEnableVideoEqualizer )
{
gtk_widget_set_sensitive( VContrast,FALSE );
gtk_widget_set_sensitive( VBrightness,FALSE );
gtk_widget_set_sensitive( VHue,FALSE );
gtk_widget_set_sensitive( VSaturation,FALSE );
}
- Channel=0;
+ Channel=-1;
eqSetBands( 0 );
- if ( !guiIntfStruct.Playing && gtkEnableAudioEqualizer )
+ if ( !guiIntfStruct.Playing || !gtkEnableAudioEqualizer )
{
gtk_widget_set_sensitive( ChannelsList,FALSE );
gtk_widget_set_sensitive( A3125,FALSE );
@@ -205,7 +205,7 @@ static void eqButtonReleased( GtkButton * button,gpointer user_data )
case 1:
if ( gtk_notebook_get_current_page( GTK_NOTEBOOK( Notebook ) ) == 0 )
{
- if ( !guiIntfStruct.Playing && !gtkEnableAudioEqualizer ) break;
+ if ( !guiIntfStruct.Playing || !gtkEnableAudioEqualizer ) break;
gtkSet( gtkSetEqualizer,0,NULL );
eqSetBands( Channel );
}
@@ -381,7 +381,7 @@ GtkWidget * create_Equalizer( void )
gtk_table_set_row_spacings( GTK_TABLE( table1 ),4 );
gtk_table_set_col_spacings( GTK_TABLE( table1 ),9 );
- A3125adj=GTK_ADJUSTMENT( gtk_adjustment_new( 0,-3,3,0.5,0,0 ) );
+ A3125adj=GTK_ADJUSTMENT( gtk_adjustment_new( 0,-eqRange,eqRange,0.5,0,0 ) );
A3125=gtk_vscale_new( A3125adj );
gtk_widget_set_name( A3125,"A3125" );
gtk_widget_ref( A3125 );
@@ -390,7 +390,7 @@ GtkWidget * create_Equalizer( void )
gtk_table_attach( GTK_TABLE( table1 ),A3125,0,1,0,1,( GtkAttachOptions )( GTK_FILL ),( GtkAttachOptions )( GTK_EXPAND | GTK_FILL ),0,0 );
gtk_scale_set_draw_value( GTK_SCALE( A3125 ),FALSE );
- A6250adj=GTK_ADJUSTMENT( gtk_adjustment_new( 0,-3,3,0.5,0,0 ) );
+ A6250adj=GTK_ADJUSTMENT( gtk_adjustment_new( 0,-eqRange,eqRange,0.5,0,0 ) );
A6250=gtk_vscale_new( A6250adj );
gtk_widget_set_name( A6250,"A6250" );
gtk_widget_ref( A6250 );
@@ -399,7 +399,7 @@ GtkWidget * create_Equalizer( void )
gtk_table_attach( GTK_TABLE( table1 ),A6250,1,2,0,1,( GtkAttachOptions )( GTK_FILL ),( GtkAttachOptions )( GTK_EXPAND | GTK_FILL ),0,0 );
gtk_scale_set_draw_value( GTK_SCALE( A6250 ),FALSE );
- A125adj=GTK_ADJUSTMENT( gtk_adjustment_new( 0,-3,3,0.5,0,0 ) );
+ A125adj=GTK_ADJUSTMENT( gtk_adjustment_new( 0,-eqRange,eqRange,0.5,0,0 ) );
A125=gtk_vscale_new( A125adj );
gtk_widget_set_name( A125,"A125" );
gtk_widget_ref( A125 );
@@ -408,7 +408,7 @@ GtkWidget * create_Equalizer( void )
gtk_table_attach( GTK_TABLE( table1 ),A125,2,3,0,1,( GtkAttachOptions )( GTK_FILL ),( GtkAttachOptions )( GTK_EXPAND | GTK_FILL ),0,0 );
gtk_scale_set_draw_value( GTK_SCALE( A125 ),FALSE );
- A250adj=GTK_ADJUSTMENT( gtk_adjustment_new( 0,-3,3,0.5,0,0 ) );
+ A250adj=GTK_ADJUSTMENT( gtk_adjustment_new( 0,-eqRange,eqRange,0.5,0,0 ) );
A250=gtk_vscale_new( A250adj );
gtk_widget_set_name( A250,"A250" );
gtk_widget_ref( A250 );
@@ -417,7 +417,7 @@ GtkWidget * create_Equalizer( void )
gtk_table_attach( GTK_TABLE( table1 ),A250,3,4,0,1,( GtkAttachOptions )( GTK_FILL ),( GtkAttachOptions )( GTK_EXPAND | GTK_FILL ),0,0 );
gtk_scale_set_draw_value( GTK_SCALE( A250 ),FALSE );
- A500adj=GTK_ADJUSTMENT( gtk_adjustment_new( 0,-3,3,0.5,0,0 ) );
+ A500adj=GTK_ADJUSTMENT( gtk_adjustment_new( 0,-eqRange,eqRange,0.5,0,0 ) );
A500=gtk_vscale_new( A500adj );
gtk_widget_set_name( A500,"A500" );
gtk_widget_ref( A500 );
@@ -426,7 +426,7 @@ GtkWidget * create_Equalizer( void )
gtk_table_attach( GTK_TABLE( table1 ),A500,4,5,0,1,( GtkAttachOptions )( GTK_FILL ),( GtkAttachOptions )( GTK_EXPAND | GTK_FILL ),0,0 );
gtk_scale_set_draw_value( GTK_SCALE( A500 ),FALSE );
- A1000adj=GTK_ADJUSTMENT( gtk_adjustment_new( 0,-3,3,0.5,0,0 ) );
+ A1000adj=GTK_ADJUSTMENT( gtk_adjustment_new( 0,-eqRange,eqRange,0.5,0,0 ) );
A1000=gtk_vscale_new( A1000adj );
gtk_widget_set_name( A1000,"A1000" );
gtk_widget_ref( A1000 );
@@ -435,7 +435,7 @@ GtkWidget * create_Equalizer( void )
gtk_table_attach( GTK_TABLE( table1 ),A1000,5,6,0,1,( GtkAttachOptions )( GTK_FILL ),( GtkAttachOptions )( GTK_EXPAND | GTK_FILL ),0,0 );
gtk_scale_set_draw_value( GTK_SCALE( A1000 ),FALSE );
- A2000adj=GTK_ADJUSTMENT( gtk_adjustment_new( 0,-3,3,0.5,0,0 ) );
+ A2000adj=GTK_ADJUSTMENT( gtk_adjustment_new( 0,-eqRange,eqRange,0.5,0,0 ) );
A2000=gtk_vscale_new( A2000adj );
gtk_widget_set_name( A2000,"A2000" );
gtk_widget_ref( A2000 );
@@ -444,7 +444,7 @@ GtkWidget * create_Equalizer( void )
gtk_table_attach( GTK_TABLE( table1 ),A2000,6,7,0,1,( GtkAttachOptions )( GTK_FILL ),( GtkAttachOptions )( GTK_EXPAND | GTK_FILL ),0,0 );
gtk_scale_set_draw_value( GTK_SCALE( A2000 ),FALSE );
- A4000adj=GTK_ADJUSTMENT( gtk_adjustment_new( 0,-3,3,0.5,0,0 ) );
+ A4000adj=GTK_ADJUSTMENT( gtk_adjustment_new( 0,-eqRange,eqRange,0.5,0,0 ) );
A4000=gtk_vscale_new( A4000adj );
gtk_widget_set_name( A4000,"A4000" );
gtk_widget_ref( A4000 );
@@ -453,7 +453,7 @@ GtkWidget * create_Equalizer( void )
gtk_table_attach( GTK_TABLE( table1 ),A4000,7,8,0,1,( GtkAttachOptions )( GTK_FILL ),( GtkAttachOptions )( GTK_EXPAND | GTK_FILL ),0,0 );
gtk_scale_set_draw_value( GTK_SCALE( A4000 ),FALSE );
- A8000adj=GTK_ADJUSTMENT( gtk_adjustment_new( 0,-3,3,0.5,0,0 ) );
+ A8000adj=GTK_ADJUSTMENT( gtk_adjustment_new( 0,-eqRange,eqRange,0.5,0,0 ) );
A8000=gtk_vscale_new( A8000adj );
gtk_widget_set_name( A8000,"A8000" );
gtk_widget_ref( A8000 );
@@ -462,7 +462,7 @@ GtkWidget * create_Equalizer( void )
gtk_table_attach( GTK_TABLE( table1 ),A8000,8,9,0,1,( GtkAttachOptions )( GTK_FILL ),( GtkAttachOptions )( GTK_EXPAND | GTK_FILL ),0,0 );
gtk_scale_set_draw_value( GTK_SCALE( A8000 ),FALSE );
- A16000adj=GTK_ADJUSTMENT( gtk_adjustment_new( 0,-3,3,0.5,0,0 ) );
+ A16000adj=GTK_ADJUSTMENT( gtk_adjustment_new( 0,-eqRange,eqRange,0.5,0,0 ) );
A16000=gtk_vscale_new( A16000adj );
gtk_widget_set_name( A16000,"A16000" );
gtk_widget_ref( A16000 );
diff --git a/Gui/mplayer/gtk/eq.h b/Gui/mplayer/gtk/eq.h
index dd7e7aeade..883c4f8135 100644
--- a/Gui/mplayer/gtk/eq.h
+++ b/Gui/mplayer/gtk/eq.h
@@ -6,9 +6,6 @@
extern GtkWidget * Equalizer;
-extern int gtkEnableAudioEqualizer;
-extern int gtkEnableVideoEqualizer;
-
extern GtkWidget * create_Equalizer( void );
extern void ShowEqualizer( void );
diff --git a/Gui/mplayer/gtk/fs.c b/Gui/mplayer/gtk/fs.c
index e01ab5c201..9d6c05188e 100644
--- a/Gui/mplayer/gtk/fs.c
+++ b/Gui/mplayer/gtk/fs.c
@@ -20,6 +20,7 @@
#include "../widgets.h"
#include "fs.h"
+#include "opts.h"
#ifndef __linux__
#define get_current_dir_name() getcwd(NULL, PATH_MAX)
@@ -76,6 +77,11 @@ char * fsAudioFileNames[fsNumberOfAudioFilterNames+1][2] =
{ "Audio files (*.wav,*.mp2,*.mp3)", "*.wav,*.mp2,*.mp3" },
{ "All files ( * )", "*" } };
+#define fsNumberOfFontFilterNames 1
+char * fsFontFileNames[fsNumberOfFontFilterNames+1][2] =
+ { { "font files (*.desc)", "*.desc" },
+ { "All files ( * )", "*" } };
+
GtkWidget * fsFileNamesList;
GtkWidget * fsFNameList;
GtkWidget * fsFileSelect;
@@ -120,7 +126,7 @@ void CheckDir( GtkWidget * list,char * directory )
glob( "*",0,NULL,&gg );
// glob( ".*",GLOB_NOSORT | GLOB_APPEND,NULL,&gg );
- for( i=0;i<gg.gl_pathc;i++ )
+ for( i=0;(unsigned)i<gg.gl_pathc;i++ )
{
stat( gg.gl_pathv[i],&fs );
if( !S_ISDIR( fs.st_mode ) ) continue;
@@ -171,7 +177,7 @@ void CheckDir( GtkWidget * list,char * directory )
// glob( ".*",GLOB_NOSORT | GLOB_APPEND,NULL,&gg );
pixmap=fpixmap; mask=fmask;
- for( i=0;i<gg.gl_pathc;i++ )
+ for( i=0;(unsigned)i<gg.gl_pathc;i++ )
{
stat( gg.gl_pathv[i],&fs );
if( S_ISDIR( fs.st_mode ) ) continue;
@@ -189,26 +195,14 @@ void CheckDir( GtkWidget * list,char * directory )
gtk_widget_show( list );
}
-static int FirstInit = 1;
-
void ShowFileSelect( int type,int modal )
{
int i;
+ char * tmp = NULL;
if ( gtkVFileSelect ) gtkActive( fsFileSelect );
else fsFileSelect=create_FileSelect();
- if ( FirstInit )
- {
- 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" );
- fsTopList_items=g_list_append( fsTopList_items,"/mnt" );
- fsTopList_items=g_list_append( fsTopList_items,"/" );
- FirstInit=0;
- }
- gtk_combo_set_popdown_strings( GTK_COMBO( fsCombo4 ),fsTopList_items );
-
fsType=type;
switch ( type )
{
@@ -220,6 +214,7 @@ void ShowFileSelect( int type,int modal )
gtk_combo_set_popdown_strings( GTK_COMBO( List ),fsList_items );
g_list_free( fsList_items );
gtk_entry_set_text( GTK_ENTRY( fsFilterCombo ),fsVideoFilterNames[fsNumberOfVideoFilterNames - 1][0] );
+ tmp=guiIntfStruct.Filename;
break;
case fsSubtitleSelector:
gtk_window_set_title( GTK_WINDOW( fsFileSelect ),MSGTR_SubtitleSelect );
@@ -229,6 +224,7 @@ void ShowFileSelect( int type,int modal )
gtk_combo_set_popdown_strings( GTK_COMBO( List ),fsList_items );
g_list_free( fsList_items );
gtk_entry_set_text( GTK_ENTRY( fsFilterCombo ),fsSubtitleFilterNames[fsNumberOfSubtitleFilterNames - 1][0] );
+ tmp=guiIntfStruct.Subtitlename;
break;
case fsOtherSelector:
gtk_window_set_title( GTK_WINDOW( fsFileSelect ),MSGTR_OtherSelect );
@@ -238,6 +234,7 @@ void ShowFileSelect( int type,int modal )
gtk_combo_set_popdown_strings( GTK_COMBO( List ),fsList_items );
g_list_free( fsList_items );
gtk_entry_set_text( GTK_ENTRY( fsFilterCombo ),fsOtherFilterNames[fsNumberOfOtherFilterNames][0] );
+ tmp=guiIntfStruct.Othername;
break;
case fsAudioSelector:
gtk_window_set_title( GTK_WINDOW( fsFileSelect ),MSGTR_AudioFileSelect );
@@ -247,9 +244,46 @@ void ShowFileSelect( int t