2002-11-02 21:10:18 +01:00
|
|
|
|
2002-02-24 18:38:33 +01:00
|
|
|
#include <inttypes.h>
|
|
|
|
#include <stdlib.h>
|
|
|
|
#include <stdio.h>
|
2002-02-23 16:12:55 +01:00
|
|
|
#include <string.h>
|
2002-11-02 21:10:18 +01:00
|
|
|
#include <sys/types.h>
|
2002-02-21 23:48:47 +01:00
|
|
|
|
2002-11-02 21:10:18 +01:00
|
|
|
#include "wm/ws.h"
|
|
|
|
#include "wm/wsxdnd.h"
|
2002-02-21 23:48:47 +01:00
|
|
|
#include "interface.h"
|
2002-07-02 15:35:04 +02:00
|
|
|
#include "skin/skin.h"
|
2002-02-23 16:12:55 +01:00
|
|
|
|
2002-11-02 21:10:18 +01:00
|
|
|
#include "mplayer/gtk/eq.h"
|
2002-02-23 16:12:55 +01:00
|
|
|
#include "mplayer/widgets.h"
|
|
|
|
#include "mplayer/mplayer.h"
|
2002-11-02 21:10:18 +01:00
|
|
|
|
|
|
|
#include "../mplayer.h"
|
2002-02-23 16:12:55 +01:00
|
|
|
#include "app.h"
|
2002-07-25 22:26:38 +02:00
|
|
|
#include "cfg.h"
|
|
|
|
#include "../help_mp.h"
|
|
|
|
#include "../subreader.h"
|
2002-02-23 16:12:55 +01:00
|
|
|
#include "../libvo/x11_common.h"
|
2002-04-22 23:36:12 +02:00
|
|
|
#include "../libvo/video_out.h"
|
2002-07-25 22:26:38 +02:00
|
|
|
#include "../libvo/font_load.h"
|
2002-08-30 21:11:03 +02:00
|
|
|
#include "../libvo/sub.h"
|
2002-02-25 14:14:27 +01:00
|
|
|
#include "../input/input.h"
|
2002-07-02 15:35:04 +02:00
|
|
|
#include "../libao2/audio_out.h"
|
2002-07-03 20:57:52 +02:00
|
|
|
#include "../mixer.h"
|
|
|
|
#include "../libao2/audio_plugin.h"
|
|
|
|
#include "../libao2/eq.h"
|
2002-04-22 23:36:12 +02:00
|
|
|
|
2002-08-14 14:17:04 +02:00
|
|
|
#ifdef USE_ICONV
|
2002-08-29 01:00:25 +02:00
|
|
|
#include <iconv.h>
|
2002-08-14 14:17:04 +02:00
|
|
|
#endif
|
|
|
|
|
2002-04-17 23:12:12 +02:00
|
|
|
#include "../libmpdemux/stream.h"
|
2002-04-22 23:36:12 +02:00
|
|
|
#include "../libmpdemux/demuxer.h"
|
2002-09-01 13:28:18 +02:00
|
|
|
#include "../libmpdemux/stheader.h"
|
|
|
|
#include "../libmpcodecs/dec_video.h"
|
2002-02-23 16:12:55 +01:00
|
|
|
|
|
|
|
guiInterface_t guiIntfStruct;
|
|
|
|
|
2002-07-03 20:57:52 +02:00
|
|
|
char * gstrcat( char ** dest,char * src )
|
|
|
|
{
|
|
|
|
char * tmp = NULL;
|
|
|
|
|
|
|
|
if ( !src ) return NULL;
|
|
|
|
|
|
|
|
if ( *dest )
|
|
|
|
{
|
|
|
|
tmp=malloc( strlen( *dest ) + strlen( src ) + 1 );
|
|
|
|
strcpy( tmp,*dest ); strcat( tmp,src ); free( *dest );
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{ tmp=malloc( strlen( src ) + 1 ); strcpy( tmp,src ); }
|
|
|
|
*dest=tmp;
|
|
|
|
return tmp;
|
|
|
|
}
|
|
|
|
|
2002-07-25 22:26:38 +02:00
|
|
|
int gstrcmp( char * a,char * b )
|
|
|
|
{
|
|
|
|
if ( !a && !b ) return 0;
|
|
|
|
if ( !a || !b ) return -1;
|
|
|
|
return strcmp( a,b );
|
|
|
|
}
|
|
|
|
|
2002-08-16 00:52:52 +02:00
|
|
|
int gstrncmp( char * a,char * b,int size )
|
|
|
|
{
|
|
|
|
if ( !a && !b ) return 0;
|
|
|
|
if ( !a || !b ) return -1;
|
|
|
|
return strncmp( a,b,size );
|
|
|
|
}
|
|
|
|
|
2002-07-25 22:26:38 +02:00
|
|
|
char * gstrdup( char * str )
|
|
|
|
{
|
|
|
|
if ( !str ) return NULL;
|
|
|
|
return strdup( str );
|
|
|
|
}
|
|
|
|
|
2002-11-25 19:18:45 +01:00
|
|
|
char * gstrchr( char * str,int c )
|
|
|
|
{
|
|
|
|
if ( !str ) return NULL;
|
|
|
|
return strchr( str,c );
|
|
|
|
}
|
|
|
|
|
2002-07-25 22:26:38 +02:00
|
|
|
void gfree( void ** p )
|
|
|
|
{
|
|
|
|
if ( *p == NULL ) return;
|
|
|
|
free( *p ); *p=NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
void gset( char ** str,char * what )
|
|
|
|
{
|
2002-10-24 01:13:26 +02:00
|
|
|
if ( *str ) { if ( !strstr( *str,what ) ) { gstrcat( str,"," ); gstrcat( str,what ); }}
|
2002-07-25 22:26:38 +02:00
|
|
|
else gstrcat( str,what );
|
|
|
|
}
|
|
|
|
|
2002-10-02 15:16:15 +02:00
|
|
|
void gaddlist( char *** list,char * entry )
|
|
|
|
{
|
|
|
|
int i;
|
|
|
|
|
|
|
|
if ( (*list) )
|
|
|
|
{
|
|
|
|
for ( i=0;(*list)[i];i++ ) free( (*list)[i] );
|
|
|
|
free( (*list) );
|
|
|
|
}
|
|
|
|
|
|
|
|
(*list)=malloc( 8 );
|
|
|
|
(*list)[0]=gstrdup( entry );
|
|
|
|
(*list)[1]=NULL;
|
|
|
|
}
|
|
|
|
|
2002-08-14 14:17:04 +02:00
|
|
|
#ifdef USE_ICONV
|
|
|
|
char * gconvert_uri_to_filename( char * str )
|
|
|
|
{
|
|
|
|
iconv_t d;
|
|
|
|
char * out = strdup( str );
|
|
|
|
char * tmp = NULL;
|
|
|
|
char * ize;
|
|
|
|
size_t inb,outb;
|
|
|
|
char * charset = "ISO8859-1";
|
|
|
|
char * cs;
|
|
|
|
|
|
|
|
if ( !strchr( str,'%' ) ) return str;
|
|
|
|
|
|
|
|
{
|
|
|
|
char * t = calloc( 1,strlen( out ) );
|
|
|
|
int i,c = 0;
|
|
|
|
for ( i=0;i < (int)strlen( out );i++ )
|
|
|
|
if ( out[i] != '%' ) t[c++]=out[i];
|
|
|
|
else
|
|
|
|
{
|
|
|
|
char tmp[4] = "0xXX";
|
|
|
|
// if ( out[++i] == '%' ) { t[c++]='%'; continue; };
|
|
|
|
tmp[2]=out[++i]; tmp[3]=out[++i];
|
|
|
|
t[c++]=(char)strtol( tmp,(char **)NULL,0 );
|
|
|
|
}
|
|
|
|
free( out );
|
|
|
|
out=t;
|
|
|
|
}
|
|
|
|
|
|
|
|
if ( (cs=getenv( "CHARSET" )) && *cs ) charset=cs;
|
|
|
|
|
|
|
|
inb=outb=strlen( out );
|
|
|
|
tmp=calloc( 1,outb + 1 );
|
|
|
|
ize=tmp;
|
|
|
|
d=iconv_open( charset,"UTF-8" );
|
|
|
|
if ( (iconv_t)(-1) == d ) return str;
|
|
|
|
iconv( d,&out,&inb,&tmp,&outb );
|
|
|
|
iconv_close( d );
|
|
|
|
free( out );
|
|
|
|
return ize;
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2002-05-28 13:55:17 +02:00
|
|
|
void guiInit( void )
|
2002-02-23 16:12:55 +01:00
|
|
|
{
|
2002-11-02 21:10:18 +01:00
|
|
|
int i;
|
|
|
|
|
2002-02-23 16:12:55 +01:00
|
|
|
memset( &guiIntfStruct,0,sizeof( guiIntfStruct ) );
|
2002-08-04 19:24:00 +02:00
|
|
|
guiIntfStruct.Balance=50.0f;
|
|
|
|
guiIntfStruct.StreamType=-1;
|
|
|
|
|
2002-07-03 20:57:52 +02:00
|
|
|
memset( >kEquChannels,0,sizeof( gtkEquChannels ) );
|
2002-10-10 16:06:49 +02:00
|
|
|
if ( !gtkAOOSSMixer ) gtkAOOSSMixer=strdup( PATH_DEV_MIXER );
|
|
|
|
if ( !gtkAOOSSDevice ) gtkAOOSSDevice=strdup( PATH_DEV_DSP );
|
2002-10-10 16:11:06 +02:00
|
|
|
#ifdef HAVE_DXR3
|
2002-10-10 16:06:49 +02:00
|
|
|
if ( !gtkDXR3Device ) gtkDXR3Device=strdup( "/dev/em8300-0" );
|
2002-10-10 16:11:06 +02:00
|
|
|
#endif
|
2002-11-29 00:17:14 +01:00
|
|
|
fullscreen=gtkLoadFullscreen;
|
|
|
|
if ( stream_cache_size != -1 ) { gtkCacheOn=1; gtkCacheSize=stream_cache_size; }
|
|
|
|
if ( autosync && autosync != gtkAutoSync ) { gtkAutoSyncOn=1; gtkAutoSync=autosync; }
|
2002-08-04 19:24:00 +02:00
|
|
|
|
|
|
|
gtkInit();
|
2002-11-02 17:09:05 +01:00
|
|
|
// --- initialize X
|
2002-08-05 03:14:14 +02:00
|
|
|
wsXInit( (void *)mDisplay );
|
2002-11-02 21:10:18 +01:00
|
|
|
// --- load skin
|
2002-11-02 17:09:05 +01:00
|
|
|
skinDirInHome=get_path("Skin");
|
|
|
|
skinMPlayerDir=DATADIR "/Skin";
|
|
|
|
printf("SKIN dir 1: '%s'\n",skinDirInHome);
|
|
|
|
printf("SKIN dir 2: '%s'\n",skinMPlayerDir);
|
|
|
|
if ( !skinName ) skinName=strdup( "default" );
|
|
|
|
switch ( skinRead( skinName ) )
|
|
|
|
{
|
|
|
|
case -1: mp_msg( MSGT_GPLAYER,MSGL_ERR,MSGTR_SKIN_SKINCFG_SkinNotFound,skinName ); exit( 0 );
|
|
|
|
case -2: mp_msg( MSGT_GPLAYER,MSGL_ERR,MSGTR_SKIN_SKINCFG_SkinCfgReadError,skinName ); exit( 0 );
|
|
|
|
}
|
2002-11-02 21:10:18 +01:00
|
|
|
// --- initialize windows
|
|
|
|
if ( ( mplDrawBuffer = (unsigned char *)calloc( 1,appMPlayer.main.Bitmap.ImageSize ) ) == NULL )
|
|
|
|
{
|
|
|
|
fprintf( stderr,MSGTR_NEMDB );
|
|
|
|
exit( 0 );
|
|
|
|
}
|
|
|
|
|
|
|
|
wsCreateWindow( &appMPlayer.subWindow,
|
|
|
|
appMPlayer.sub.x,appMPlayer.sub.y,appMPlayer.sub.width,appMPlayer.sub.height,
|
|
|
|
wsNoBorder,wsShowMouseCursor|wsHandleMouseButton|wsHandleMouseMove,wsShowFrame|wsHideWindow,"ViDEO" );
|
|
|
|
|
|
|
|
wsDestroyImage( &appMPlayer.subWindow );
|
|
|
|
wsCreateImage( &appMPlayer.subWindow,appMPlayer.sub.Bitmap.Width,appMPlayer.sub.Bitmap.Height );
|
|
|
|
wsXDNDMakeAwareness(&appMPlayer.subWindow);
|
|
|
|
|
|
|
|
vo_setwindow( appMPlayer.subWindow.WindowID, appMPlayer.subWindow.wGC );
|
|
|
|
|
|
|
|
// i=wsHideFrame|wsMaxSize|wsHideWindow;
|
|
|
|
// if ( appMPlayer.mainDecoration ) i=wsShowFrame|wsMaxSize|wsHideWindow;
|
|
|
|
i=wsShowFrame|wsMaxSize|wsHideWindow;
|
|
|
|
wsCreateWindow( &appMPlayer.mainWindow,
|
|
|
|
appMPlayer.main.x,appMPlayer.main.y,appMPlayer.main.width,appMPlayer.main.height,
|
|
|
|
wsNoBorder,wsShowMouseCursor|wsHandleMouseButton|wsHandleMouseMove,i,"MPlayer" ); //wsMinSize|
|
|
|
|
|
|
|
|
wsSetShape( &appMPlayer.mainWindow,appMPlayer.main.Mask.Image );
|
|
|
|
wsXDNDMakeAwareness(&appMPlayer.mainWindow);
|
|
|
|
|
|
|
|
mplMenuInit();
|
|
|
|
|
|
|
|
#ifdef DEBUG
|
|
|
|
mp_msg( MSGT_GPLAYER,MSGL_DBG2,"[main] Depth on screen: %d\n",wsDepthOnScreen );
|
|
|
|
mp_msg( MSGT_GPLAYER,MSGL_DBG2,"[main] parent: 0x%x\n",(int)appMPlayer.mainWindow.WindowID );
|
|
|
|
mp_msg( MSGT_GPLAYER,MSGL_DBG2,"[main] sub: 0x%x\n",(int)appMPlayer.subWindow.WindowID );
|
|
|
|
#endif
|
|
|
|
|
|
|
|
appMPlayer.mainWindow.ReDraw=(void *)mplMainDraw;
|
|
|
|
appMPlayer.mainWindow.MouseHandler=mplMainMouseHandle;
|
|
|
|
appMPlayer.mainWindow.KeyHandler=mplMainKeyHandle;
|
|
|
|
appMPlayer.mainWindow.DandDHandler=mplDandDHandler;
|
|
|
|
|
|
|
|
appMPlayer.subWindow.ReDraw=(void *)mplSubDraw;
|
|
|
|
appMPlayer.subWindow.MouseHandler=mplSubMouseHandle;
|
|
|
|
appMPlayer.subWindow.KeyHandler=mplMainKeyHandle;
|
|
|
|
appMPlayer.subWindow.DandDHandler=mplDandDHandler;
|
|
|
|
|
|
|
|
wsSetBackgroundRGB( &appMPlayer.subWindow,appMPlayer.subR,appMPlayer.subG,appMPlayer.subB );
|
|
|
|
wsClearWindow( appMPlayer.subWindow );
|
|
|
|
if ( appMPlayer.sub.Bitmap.Image ) wsConvert( &appMPlayer.subWindow,appMPlayer.sub.Bitmap.Image,appMPlayer.sub.Bitmap.ImageSize );
|
|
|
|
|
|
|
|
btnModify( evSetVolume,guiIntfStruct.Volume );
|
|
|
|
btnModify( evSetBalance,guiIntfStruct.Balance );
|
|
|
|
btnModify( evSetMoviePosition,guiIntfStruct.Position );
|
|
|
|
|
|
|
|
wsSetIcon( wsDisplay,appMPlayer.mainWindow.WindowID,guiIcon,guiIconMask );
|
|
|
|
wsSetIcon( wsDisplay,appMPlayer.subWindow.WindowID,guiIcon,guiIconMask );
|
|
|
|
|
|
|
|
guiIntfStruct.Playing=0;
|
|
|
|
|
|
|
|
if ( !appMPlayer.mainDecoration ) wsWindowDecoration( &appMPlayer.mainWindow,0 );
|
|
|
|
|
|
|
|
wsVisibleWindow( &appMPlayer.mainWindow,wsShowWindow );
|
|
|
|
#if 1
|
|
|
|
wsVisibleWindow( &appMPlayer.subWindow,wsShowWindow );
|
|
|
|
|
|
|
|
{
|
|
|
|
XEvent xev;
|
|
|
|
do { XNextEvent( wsDisplay,&xev ); } while ( xev.type != MapNotify || xev.xmap.event != appMPlayer.subWindow.WindowID );
|
|
|
|
appMPlayer.subWindow.Mapped=wsMapped;
|
|
|
|
}
|
|
|
|
|
|
|
|
if ( fullscreen )
|
|
|
|
{
|
|
|
|
mplFullScreen();
|
|
|
|
btnModify( evFullScreen,btnPressed );
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
mplSubRender=1;
|
2002-11-02 17:09:05 +01:00
|
|
|
// ---
|
2002-09-28 21:42:10 +02:00
|
|
|
|
2002-08-15 01:02:45 +02:00
|
|
|
if ( plCurrent && !filename ) mplSetFileName( plCurrent->path,plCurrent->name,STREAMTYPE_FILE );
|
2002-08-11 20:07:42 +02:00
|
|
|
if ( sub_name ) guiSetFilename( guiIntfStruct.Subtitlename,sub_name );
|
2002-07-25 23:31:36 +02:00
|
|
|
#if defined( USE_OSD ) || defined( USE_SUB )
|
|
|
|
guiLoadFont();
|
|
|
|
#endif
|
2002-02-23 16:12:55 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
void guiDone( void )
|
|
|
|
{
|
2002-11-02 17:09:05 +01:00
|
|
|
mp_msg( MSGT_GPLAYER,MSGL_V,"[gui] done.\n" );
|
2002-07-25 22:26:38 +02:00
|
|
|
cfg_write();
|
2002-02-23 16:12:55 +01:00
|
|
|
wsXDone();
|
|
|
|
}
|
2002-02-21 23:48:47 +01:00
|
|
|
|
2002-02-25 14:14:27 +01:00
|
|
|
int guiCMDArray[] =
|
|
|
|
{
|
|
|
|
evLoad,
|
|
|
|
evLoadSubtitle,
|
|
|
|
evAbout,
|
|
|
|
evPlay,
|
|
|
|
evStop,
|
|
|
|
evPlayList,
|
|
|
|
evPreferences,
|
|
|
|
evFullScreen,
|
|
|
|
evSkinBrowser
|
|
|
|
};
|
|
|
|
|
2002-07-02 15:35:04 +02:00
|
|
|
extern ao_functions_t * audio_out;
|
2002-07-19 22:51:48 +02:00
|
|
|
extern vo_functions_t * video_out;
|
2002-07-25 22:26:38 +02:00
|
|
|
extern int frame_dropping;
|
|
|
|
extern int stream_dump_type;
|
|
|
|
extern char ** vo_plugin_args;
|
|
|
|
|
|
|
|
#if defined( USE_OSD ) || defined( USE_SUB )
|
|
|
|
void guiLoadFont( void )
|
|
|
|
{
|
2002-08-28 22:52:02 +02:00
|
|
|
#ifdef HAVE_FREETYPE
|
|
|
|
load_font(vo_image_width, vo_image_height);
|
|
|
|
#else
|
2002-07-25 22:26:38 +02:00
|
|
|
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;
|
|
|
|
}
|
2002-08-16 00:52:52 +02:00
|
|
|
if ( font_name )
|
2002-07-25 22:26:38 +02:00
|
|
|
{
|
2002-08-16 00:52:52 +02:00
|
|
|
vo_font=read_font_desc( font_name,font_factor,0 );
|
2002-07-25 22:26:38 +02:00
|
|
|
if ( !vo_font ) mp_msg( MSGT_CPLAYER,MSGL_ERR,MSGTR_CantLoadFont,font_name );
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2002-08-16 00:52:52 +02:00
|
|
|
font_name=gstrdup( get_path( "font/font.desc" ) );
|
|
|
|
vo_font=read_font_desc( font_name,font_factor,0 );
|
2002-07-25 22:26:38 +02:00
|
|
|
if ( !vo_font )
|
|
|
|
{
|
2002-08-16 00:52:52 +02:00
|
|
|
gfree( (void **)&font_name ); font_name=gstrdup( DATADIR"/font/font.desc" );
|
|
|
|
vo_font=read_font_desc( font_name,font_factor,0 );
|
2002-07-25 22:26:38 +02:00
|
|
|
}
|
|
|
|
}
|
2002-08-28 22:52:02 +02:00
|
|
|
#endif
|
2002-07-25 22:26:38 +02:00
|
|
|
}
|
|
|
|
#endif
|
2002-07-02 15:35:04 +02:00
|
|
|
|
2002-08-30 00:24:49 +02:00
|
|
|
#ifdef USE_SUB
|
2002-08-30 21:11:03 +02:00
|
|
|
extern mp_osd_obj_t* vo_osd_list;
|
|
|
|
|
2002-08-30 00:24:49 +02:00
|
|
|
void guiLoadSubtitle( char * name )
|
|
|
|
{
|
|
|
|
if ( guiIntfStruct.Playing == 0 )
|
|
|
|
{
|
|
|
|
guiIntfStruct.SubtitleChanged=1;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
if ( subtitles )
|
|
|
|
{
|
2002-08-30 21:11:03 +02:00
|
|
|
mp_msg( MSGT_GPLAYER,MSGL_INFO,"[gui] Delete subtitles.\n" );
|
2002-08-30 00:24:49 +02:00
|
|
|
sub_free( subtitles );
|
2002-08-30 21:11:03 +02:00
|
|
|
subtitles=NULL;
|
2002-08-30 21:32:43 +02:00
|
|
|
gfree( (void **)&sub_name );
|
2002-08-30 00:24:49 +02:00
|
|
|
vo_sub=NULL;
|
2002-08-30 21:11:03 +02:00
|
|
|
if ( vo_osd_list )
|
|
|
|
{
|
|
|
|
int len;
|
|
|
|
mp_osd_obj_t * osd = vo_osd_list;
|
|
|
|
while ( osd )
|
|
|
|
{
|
|
|
|
if ( osd->type == OSDTYPE_SUBTITLE ) break;
|
|
|
|
osd=osd->next;
|
|
|
|
}
|
|
|
|
if ( osd && osd->flags&OSDFLAG_VISIBLE )
|
|
|
|
{
|
|
|
|
len=osd->stride * ( osd->bbox.y2 - osd->bbox.y1 );
|
|
|
|
memset( osd->bitmap_buffer,0,len );
|
|
|
|
memset( osd->alpha_buffer,0,len );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if ( name )
|
|
|
|
{
|
|
|
|
mp_msg( MSGT_GPLAYER,MSGL_INFO,"[gui] Delete Load subtitle: %s\n",name );
|
|
|
|
sub_name=gstrdup( name );
|
|
|
|
subtitles=sub_read_file( sub_name,guiIntfStruct.FPS );
|
2002-08-30 00:24:49 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2002-08-15 01:02:45 +02:00
|
|
|
static void add_vop( char * str )
|
|
|
|
{
|
|
|
|
mp_msg( MSGT_GPLAYER,MSGL_STATUS,"[gui] add video filter: %s\n",str );
|
|
|
|
if ( vo_plugin_args )
|
|
|
|
{
|
|
|
|
int i = 0;
|
|
|
|
while ( vo_plugin_args[i] ) if ( !gstrcmp( vo_plugin_args[i++],str ) ) { i=-1; break; }
|
|
|
|
if ( i != -1 )
|
|
|
|
{ vo_plugin_args=realloc( vo_plugin_args,( i + 2 ) * sizeof( char * ) ); vo_plugin_args[i]=strdup( str ); vo_plugin_args[i+1]=NULL; }
|
|
|
|
} else { vo_plugin_args=malloc( 2 * sizeof( char * ) ); vo_plugin_args[0]=strdup( str ); vo_plugin_args[1]=NULL; }
|
|
|
|
}
|
|
|
|
|
|
|
|
static void remove_vop( char * str )
|
|
|
|
{
|
|
|
|
int n = 0;
|
|
|
|
|
|
|
|
if ( !vo_plugin_args ) return;
|
|
|
|
|
|
|
|
mp_msg( MSGT_GPLAYER,MSGL_STATUS,"[gui] remove video filter: %s\n",str );
|
|
|
|
|
|
|
|
while ( vo_plugin_args[n++] ); n--;
|
|
|
|
if ( n > -1 )
|
|
|
|
{
|
|
|
|
int i = 0,m = -1;
|
|
|
|
while ( vo_plugin_args[i] ) if ( !gstrcmp( vo_plugin_args[i++],str ) ) { m=i - 1; break; }
|
|
|
|
i--;
|
|
|
|
if ( m > -1 )
|
|
|
|
{
|
|
|
|
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 * ) );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
int guiGetEvent( int type,char * arg )
|
2002-02-21 23:48:47 +01:00
|
|
|
{
|
2002-06-03 17:06:32 +02:00
|
|
|
stream_t * stream = (stream_t *) arg;
|
2002-04-18 16:03:50 +02:00
|
|
|
#ifdef USE_DVDREAD
|
2002-04-17 23:12:12 +02:00
|
|
|
dvd_priv_t * dvdp = (dvd_priv_t *) arg;
|
2002-04-18 16:03:50 +02:00
|
|
|
#endif
|
2002-07-02 15:35:04 +02:00
|
|
|
|
2002-02-21 23:48:47 +01:00
|
|
|
switch ( type )
|
|
|
|
{
|
|
|
|
case guiXEvent:
|
2002-11-28 01:44:24 +01:00
|
|
|
guiIntfStruct.event_struct=(void *)arg;
|
2002-02-21 23:48:47 +01:00
|
|
|
wsEvents( wsDisplay,(XEvent *)arg,NULL );
|
2002-02-23 16:12:55 +01:00
|
|
|
gtkEventHandling();
|
|
|
|
break;
|
2002-02-21 23:48:47 +01:00
|
|
|
case guiCEvent:
|
2002-03-07 00:54:20 +01:00
|
|
|
switch ( (int)arg )
|
|
|
|
{
|
|
|
|
case guiSetPlay: guiIntfStruct.Playing=1; mplState(); break;
|
|
|
|
case guiSetStop: guiIntfStruct.Playing=0; mplState(); break;
|
|
|
|
case guiSetPause: guiIntfStruct.Playing=2; mplState(); break;
|
|
|
|
}
|
2002-02-23 16:12:55 +01:00
|
|
|
break;
|
2002-04-17 23:12:12 +02:00
|
|
|
case guiSetState:
|
|
|
|
mplState();
|
|
|
|
break;
|
|
|
|
case guiSetFileName:
|
|
|
|
if ( arg ) guiSetFilename( guiIntfStruct.Filename,arg );
|
|
|
|
break;
|
2002-04-22 23:36:12 +02:00
|
|
|
case guiSetAudioOnly:
|
|
|
|
guiIntfStruct.AudioOnly=(int)arg;
|
2002-08-15 01:02:45 +02:00
|
|
|
if ( (int)arg ) { guiIntfStruct.NoWindow=True; wsVisibleWindow( &appMPlayer.subWindow,wsHideWindow ); }
|
2002-04-22 23:36:12 +02:00
|
|
|
else wsVisibleWindow( &appMPlayer.subWindow,wsShowWindow );
|
|
|
|
break;
|
|
|
|
case guiReDrawSubWindow:
|
|
|
|
wsPostRedisplay( &appMPlayer.subWindow );
|
|
|
|
break;
|
|
|
|
case guiSetShVideo:
|
|
|
|
{
|
2002-05-05 20:46:42 +02:00
|
|
|
if ( !appMPlayer.subWindow.isFullScreen )
|
|
|
|
{
|
|
|
|
wsResizeWindow( &appMPlayer.subWindow,vo_dwidth,vo_dheight );
|
|
|
|
wsMoveWindow( &appMPlayer.subWindow,True,appMPlayer.sub.x,appMPlayer.sub.y );
|
|
|
|
}
|
2002-05-03 22:57:13 +02:00
|
|
|
guiIntfStruct.MovieWidth=vo_dwidth;
|
2002-05-06 17:05:07 +02:00
|
|
|
guiIntfStruct.MovieHeight=vo_dheight;
|
2002-04-22 23:36:12 +02:00
|
|
|
}
|
|
|
|
break;
|
2002-04-17 23:12:12 +02:00
|
|
|
#ifdef USE_DVDREAD
|
|
|
|
case guiSetDVD:
|
|
|
|
guiIntfStruct.DVD.titles=dvdp->vmg_file->tt_srpt->nr_of_srpts;
|
|
|
|
guiIntfStruct.DVD.chapters=dvdp->vmg_file->tt_srpt->title[dvd_title].nr_of_ptts;
|
|
|
|
guiIntfStruct.DVD.angles=dvdp->vmg_file->tt_srpt->title[dvd_title].nr_of_angles;
|
|
|
|
guiIntfStruct.DVD.nr_of_audio_channels=dvdp->nr_of_channels;
|
|
|
|
memcpy( guiIntfStruct.DVD.audio_streams,dvdp->audio_streams,sizeof( dvdp->audio_streams ) );
|
|
|
|
guiIntfStruct.DVD.nr_of_subtitles=dvdp->nr_of_subtitles;
|
|
|
|
memcpy( guiIntfStruct.DVD.subtitles,dvdp->subtitles,sizeof( dvdp->subtitles ) );
|
|
|
|
guiIntfStruct.DVD.current_title=dvd_title + 1;
|
|
|
|
guiIntfStruct.DVD.current_chapter=dvd_chapter + 1;
|
|
|
|
guiIntfStruct.DVD.current_angle=dvd_angle + 1;
|
|
|
|
guiIntfStruct.Track=dvd_title + 1;
|
|
|
|
break;
|
|
|
|
#endif
|
2002-06-03 17:06:32 +02:00
|
|
|
case guiSetStream:
|
|
|
|
guiIntfStruct.StreamType=stream->type;
|
|
|
|
switch( stream->type )
|
|
|
|
{
|
2002-08-30 00:24:49 +02:00
|
|
|
#ifdef USE_DVDREAD
|
2002-06-03 17:06:32 +02:00
|
|
|
case STREAMTYPE_DVD:
|
|
|
|
guiGetEvent( guiSetDVD,(char *)stream->priv );
|
|
|
|
break;
|
2002-08-30 00:24:49 +02:00
|
|
|
#endif
|
2002-06-03 17:06:32 +02:00
|
|
|
#ifdef HAVE_VCD
|
|
|
|
case STREAMTYPE_VCD:
|
|
|
|
{
|
|
|
|
int i;
|
|
|
|
for ( i=1;i < 100;i++ )
|
|
|
|
if ( vcd_seek_to_track( stream->fd,i ) < 0 ) break;
|
|
|
|
vcd_seek_to_track( stream->fd,vcd_track );
|
|
|
|
guiIntfStruct.VCDTracks=--i;
|
2002-11-02 17:09:05 +01:00
|
|
|
mp_msg( MSGT_GPLAYER,MSGL_INFO,"[gui] vcd tracks: %d\n",guiIntfStruct.VCDTracks );
|
2002-06-03 17:06:32 +02:00
|
|
|
guiIntfStruct.Track=vcd_track;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
#endif
|
2002-08-30 00:24:49 +02:00
|
|
|
default: break;
|
2002-06-03 17:06:32 +02:00
|
|
|
}
|
|
|
|
break;
|
2002-02-25 14:14:27 +01:00
|
|
|
case guiIEvent:
|
|
|
|
printf( "cmd: %d\n",(int)arg );
|
|
|
|
switch( (int)arg )
|
|
|
|
{
|
|
|
|
case MP_CMD_QUIT:
|
|
|
|
mplEventHandling( evExit,0 );
|
|
|
|
break;
|
|
|
|
case MP_CMD_VO_FULLSCREEN:
|
|
|
|
mplEventHandling( evFullScreen,0 );
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
mplEventHandling( guiCMDArray[ (int)arg - MP_CMD_GUI_EVENTS - 1 ],0 );
|
|
|
|
}
|
|
|
|
break;
|
2002-07-02 15:35:04 +02:00
|
|
|
case guiReDraw:
|
|
|
|
mplEventHandling( evRedraw,0 );
|
|
|
|
break;
|
|
|
|
case guiSetVolume:
|
2002-08-04 21:23:58 +02:00
|
|
|
if ( audio_out )
|
|
|
|
{
|
|
|
|
float l,r;
|
|
|
|
mixer_getvolume( &l,&r );
|
|
|
|
guiIntfStruct.Volume=(r>l?r:l);
|
|
|
|
if ( r != l ) guiIntfStruct.Balance=( ( r - l ) + 100 ) * 0.5f;
|
|
|
|
else guiIntfStruct.Balance=50.0f;
|
|
|
|
btnModify( evSetVolume,guiIntfStruct.Volume );
|
|
|
|
btnModify( evSetBalance,guiIntfStruct.Balance );
|
|
|
|
}
|
|
|
|
break;
|
2002-08-15 01:02:45 +02:00
|
|
|
case guiSetFileFormat:
|
|
|
|
guiIntfStruct.FileFormat=(int)arg;
|
|
|
|
break;
|
2002-08-04 21:23:58 +02:00
|
|
|
case guiSetValues:
|
2002-08-05 03:14:14 +02:00
|
|
|
// -- video
|
2002-09-01 13:28:18 +02:00
|
|
|
guiIntfStruct.sh_video=arg;
|
2002-08-05 03:14:14 +02:00
|
|
|
if ( arg )
|
|
|
|
{
|
2002-09-01 13:28:18 +02:00
|
|
|
sh_video_t * sh = (sh_video_t *)arg;
|
2002-08-30 00:24:49 +02:00
|
|
|
guiIntfStruct.FPS=sh->fps;
|
2002-08-05 03:14:14 +02:00
|
|
|
}
|
2002-08-15 01:02:45 +02:00
|
|
|
|
|
|
|
if ( guiIntfStruct.NoWindow ) wsVisibleWindow( &appMPlayer.subWindow,wsHideWindow );
|
2002-11-25 18:33:30 +01:00
|
|
|
|
2002-11-28 00:11:49 +01:00
|
|
|
if ( guiIntfStruct.StreamType == STREAMTYPE_STREAM ) btnSet( evSetMoviePosition,btnDisabled );
|
|
|
|
else btnSet( evSetMoviePosition,btnReleased );
|
2002-11-25 19:18:45 +01:00
|
|
|
|
|
|
|
if ( gtkCacheOn ) stream_cache_size=gtkCacheSize;
|
|
|
|
else stream_cache_size=-1;
|
2002-08-15 01:02:45 +02:00
|
|
|
|
2002-11-29 00:17:14 +01:00
|
|
|
if ( gtkAutoSyncOn ) autosync=gtkAutoSync;
|
|
|
|
else autosync=0;
|
|
|
|
|
2002-07-25 22:26:38 +02:00
|
|
|
// -- audio
|
2002-07-02 15:35:04 +02:00
|
|
|
if ( audio_out )
|
|
|
|
{
|
|
|
|
float l,r;
|
|
|
|
mixer_getvolume( &l,&r );
|
|
|
|
guiIntfStruct.Volume=(r>l?r:l);
|
|
|
|
if ( r != l ) guiIntfStruct.Balance=( ( r - l ) + 100 ) * 0.5f;
|
2002-07-03 20:57:52 +02:00
|
|
|
else guiIntfStruct.Balance=50.0f;
|
2002-07-02 15:35:04 +02:00
|
|
|
btnModify( evSetVolume,guiIntfStruct.Volume );
|
|
|
|
btnModify( evSetBalance,guiIntfStruct.Balance );
|
|
|
|
}
|
2002-07-03 20:57:52 +02:00
|
|
|
|
2002-07-25 22:26:38 +02:00
|
|
|
if ( gtkAONoSound ) { if ( !muted ) mixer_mute(); }
|
|
|
|
else if ( muted ) mixer_mute();
|
|
|
|
|
2002-07-03 20:57:52 +02:00
|
|
|
if ( gtkEnableAudioEqualizer )
|
|
|
|
{
|
|
|
|
equalizer_t eq;
|
|
|
|
int i,j;
|
|
|
|
for ( i=0;i<6;i++ )
|
|
|
|
for ( j=0;j<10;j++ )
|
|
|
|
{
|
|
|
|
eq.channel=i; eq.band=j; eq.gain=gtkEquChannels[i][j];
|
|
|
|
gtkSet( gtkSetEqualizer,0,&eq );
|
|
|
|
}
|
|
|
|
}
|
2002-07-25 22:26:38 +02:00
|
|
|
// -- subtitle
|
2002-08-15 01:02:45 +02:00
|
|
|
#ifdef HAVE_DXR3
|
2002-11-02 17:09:05 +01:00
|
|
|
if ( video_driver_list && !gstrcmp( video_driver_list[0],"dxr3" ) && guiIntfStruct.FileFormat != DEMUXER_TYPE_MPEG_PS
|
|
|
|
#ifdef USE_LIBAVCODEC
|
|
|
|
&& !gtkVopLAVC
|
|
|
|
#endif
|
|
|
|
#ifdef USE_LIBFAME
|
|
|
|
&& !gtkVopFAME
|
|
|
|
#endif
|
|
|
|
)
|
2002-08-15 01:02:45 +02:00
|
|
|
{
|
|
|
|
gtkMessageBox( GTK_MB_FATAL,MSGTR_NEEDLAVCFAME );
|
|
|
|
guiIntfStruct.Playing=0;
|
|
|
|
return True;
|
|
|
|
}
|
2002-07-25 22:26:38 +02:00
|
|
|
#endif
|
2002-07-03 20:57:52 +02:00
|
|
|
break;
|
|
|
|
case guiSetDefaults:
|
2002-07-31 15:26:46 +02:00
|
|
|
if ( filename && !guiIntfStruct.Filename )
|
2002-07-25 22:26:38 +02:00
|
|
|
{
|
|
|
|
gtkSet( gtkDelPl,0,NULL ); guiIntfStruct.StreamType=STREAMTYPE_FILE;
|
|
|
|
guiSetFilename( guiIntfStruct.Filename,filename );
|
|
|
|
}
|
2002-07-03 20:57:52 +02:00
|
|
|
|
2002-07-25 22:26:38 +02:00
|
|
|
guiIntfStruct.DiskChanged=0;
|
|
|
|
|
2002-08-15 01:02:45 +02:00
|
|
|
// --- video opts
|
2002-08-16 00:52:52 +02:00
|
|
|
|
2002-10-02 15:16:15 +02:00
|
|
|
if ( !video_driver_list )
|
2002-07-25 22:26:38 +02:00
|
|
|
{
|
2002-07-25 23:31:36 +02:00
|
|
|
int i = 0;
|
2002-08-04 21:23:58 +02:00
|
|
|
while ( video_out_drivers[i++] )
|
|
|
|
if ( video_out_drivers[i - 1]->control( VOCTRL_GUISUPPORT,NULL ) == VO_TRUE )
|
|
|
|
{
|
2002-11-11 17:57:09 +01:00
|
|
|
gaddlist( &video_driver_list,(char *)video_out_drivers[i - 1]->info->short_name );
|
2002-08-04 21:23:58 +02:00
|
|
|
break;
|
|
|
|
}
|
2002-07-03 20:57:52 +02:00
|
|
|
}
|
2002-07-25 22:26:38 +02:00
|
|
|
|
2002-10-02 15:16:15 +02:00
|
|
|
if ( !video_driver_list && !video_driver_list[0] ) { gtkMessageBox( GTK_MB_FATAL,MSGTR_IDFGCVD ); exit_player( "gui init" ); }
|
2002-08-15 01:02:45 +02:00
|
|
|
|
|
|
|
{
|
|
|
|
int i = 0;
|
|
|
|
guiIntfStruct.NoWindow=False;
|
|
|
|
while ( video_out_drivers[i++] )
|
|
|
|
if ( video_out_drivers[i - 1]->control( VOCTRL_GUISUPPORT,NULL ) == VO_TRUE )
|
2002-07-25 22:26:38 +02:00
|
|
|
{
|
2002-11-11 17:57:09 +01:00
|
|
|
if ( ( video_driver_list && !gstrcmp( video_driver_list[0],(char *)video_out_drivers[i - 1]->info->short_name ) )&&( video_out_drivers[i - 1]->control( VOCTRL_GUI_NOWINDOW,NULL ) == VO_TRUE ) )
|
2002-08-15 01:02:45 +02:00
|
|
|
{ guiIntfStruct.NoWindow=True; break; }
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
#ifdef HAVE_DXR3
|
2002-11-02 17:09:05 +01:00
|
|
|
#ifdef USE_LIBAVCODEC
|
2002-08-15 01:02:45 +02:00
|
|
|
remove_vop( "lavc" );
|
2002-11-02 17:09:05 +01:00
|
|
|
#endif
|
|
|
|
#ifdef USE_LIBFAME
|
2002-08-15 01:02:45 +02:00
|
|
|
remove_vop( "fame" );
|
2002-11-02 17:09:05 +01:00
|
|
|
#endif
|
2002-10-02 15:16:15 +02:00
|
|
|
if ( video_driver_list && !gstrcmp( video_driver_list[0],"dxr3" ) )
|
2002-08-15 01:02:45 +02:00
|
|
|
{
|
|
|
|
if ( ( guiIntfStruct.StreamType != STREAMTYPE_DVD)&&( guiIntfStruct.StreamType != STREAMTYPE_VCD ) )
|
2002-07-25 22:26:38 +02:00
|
|
|
{
|
2002-11-02 17:09:05 +01:00
|
|
|
#ifdef USE_LIBAVCODEC
|
2002-08-15 01:02:45 +02:00
|
|
|
if ( gtkVopLAVC ) add_vop( "lavc" );
|
2002-11-02 17:09:05 +01:00
|
|
|
#endif
|
|
|
|
#ifdef USE_LIBFAME
|
2002-08-15 01:02:45 +02:00
|
|
|
if ( gtkVopFAME ) add_vop( "fame" );
|
2002-11-02 17:09:05 +01:00
|
|
|
#endif
|
2002-07-25 22:26:38 +02:00
|
|
|
}
|
2002-08-15 01:02:45 +02:00
|
|
|
}
|
|
|
|
#endif
|
|
|
|
// ---
|
2002-08-16 00:52:52 +02:00
|
|
|
if ( gtkVopPP ) add_vop( "pp" );
|
|
|
|
else remove_vop( "pp" );
|
2002-07-25 22:26:38 +02:00
|
|
|
|
|
|
|
// --- audio opts
|
2002-10-24 01:13:26 +02:00
|
|
|
// if ( ao_plugin_cfg.plugin_list ) { free( ao_plugin_cfg.plugin_list ); ao_plugin_cfg.plugin_list=NULL; }
|
2002-07-25 22:26:38 +02:00
|
|
|
if ( gtkAONorm ) gset( &ao_plugin_cfg.plugin_list,"volnorm" );
|
2002-07-30 13:50:20 +02:00
|
|
|
if ( gtkEnableAudioEqualizer ) gset( &ao_plugin_cfg.plugin_list,"eq" );
|
2002-07-25 22:26:38 +02:00
|
|
|
if ( gtkAOExtraStereo )
|
|
|
|
{
|
|
|
|
gset( &ao_plugin_cfg.plugin_list,"extrastereo" );
|
|
|
|
ao_plugin_cfg.pl_extrastereo_mul=gtkAOExtraStereoMul;
|
|
|
|
}
|
|
|
|
mixer_device=gtkAOOSSMixer;
|
2002-10-02 15:16:15 +02:00
|
|
|
if ( audio_driver_list && !gstrncmp( audio_driver_list[0],"oss",3 ) && gtkAOOSSDevice )
|
2002-07-25 22:26:38 +02:00
|
|
|
{
|
2002-08-16 00:52:52 +02:00
|
|
|
char * tmp = calloc( 1,strlen( gtkAOOSSDevice ) + 5 );
|
|
|
|
sprintf( tmp,"oss:%s",gtkAOOSSDevice );
|
2002-10-02 15:16:15 +02:00
|
|
|
gaddlist( &audio_driver_list,tmp );
|
2002-08-16 00:52:52 +02:00
|
|
|
}
|
2002-07-25 22:26:38 +02:00
|
|
|
|
|
|
|
// -- subtitle
|
|
|
|
#ifdef USE_SUB
|
2002-08-30 21:32:43 +02:00
|
|
|
sub_name=gstrdup( guiIntfStruct.Subtitlename );
|
2002-07-25 22:26:38 +02:00
|
|
|
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();
|
2002-07-03 20:57:52 +02:00
|
|
|
#endif
|
2002-07-25 22:26:38 +02:00
|
|
|
|
|
|
|
// --- misc
|
2002-07-03 20:57:52 +02:00
|
|
|
if ( guiIntfStruct.AudioFile ) audio_stream=guiIntfStruct.AudioFile;
|
|
|
|
else if ( guiIntfStruct.FilenameChanged ) audio_stream=NULL;
|
|
|
|
|
|
|
|
break;
|
2002-02-21 23:48:47 +01:00
|
|
|
}
|
2002-08-15 01:02:45 +02:00
|
|
|
return False;
|
2002-02-21 23:48:47 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
void guiEventHandling( void )
|
|
|
|
{
|
2002-08-15 01:02:45 +02:00
|
|
|
if ( !guiIntfStruct.Playing || guiIntfStruct.NoWindow ) wsHandleEvents();
|
2002-02-23 16:12:55 +01:00
|
|
|
gtkEventHandling();
|
2002-02-21 23:48:47 +01:00
|
|
|
}
|
2002-07-03 20:57:52 +02:00
|
|
|
|
|
|
|
// ---
|
|
|
|
|
|
|
|
float gtkEquChannels[6][10];
|
|
|
|
|
2002-07-12 02:53:26 +02:00
|
|
|
plItem * plCurrent = NULL;
|
|
|
|
plItem * plList = NULL;
|
|
|
|
plItem * plLastPlayed = NULL;
|
|
|
|
|
2002-08-27 00:20:58 +02:00
|
|
|
URLItem *URLList = NULL;
|
|
|
|
|
2002-07-12 02:53:26 +02:00
|
|
|
#if defined( MP_DEBUG ) && 0
|
|
|
|
void list( void )
|
|
|
|
{
|
|
|
|
plItem * next = plList;
|
|
|
|
printf( "--- list ---\n" );
|
|
|
|
while( next || next->next )
|
|
|
|
{
|
|
|
|
printf( "item: %s/%s\n",next->path,next->name );
|
|
|
|
if ( next->next ) next=next->next; else break;
|
|
|
|
}
|
|
|
|
printf( "--- end of list ---\n" );
|
|
|
|
}
|
|
|
|
#else
|
|
|
|
#define list();
|
|
|
|
#endif
|
|
|
|
|
|
|
|
void * gtkSet( int cmd,float fparam, void * vparam )
|
2002-07-03 20:57:52 +02:00
|
|
|
{
|
|
|
|
equalizer_t * eq = (equalizer_t *)vparam;
|
2002-07-12 02:53:26 +02:00
|
|
|
plItem * item = (plItem *)vparam;
|
2002-07-03 20:57:52 +02:00
|
|
|
|
2002-08-27 00:20:58 +02:00
|
|
|
URLItem * url_item = (URLItem *)vparam;
|
|
|
|
int is_added = True;
|
|
|
|
|
2002-07-03 20:57:52 +02:00
|
|
|
switch ( cmd )
|
|
|
|
{
|
2002-07-12 02:53:26 +02:00
|
|
|
// --- handle playlist
|
2002-07-19 22:51:48 +02:00
|
|
|
case gtkAddPlItem: // add item to playlist
|
2002-07-12 02:53:26 +02:00
|
|
|
if ( plList )
|
|
|
|
{
|
|
|
|
plItem * next = plList;
|
|
|
|
while ( next->next ) { /*printf( "%s\n",next->name );*/ next=next->next; }
|
|
|
|
next->next=item; item->prev=next;
|
2002-08-27 00:20:58 +02:00
|
|
|
} else { item->prev=item->next=NULL; plCurrent=plList=item; }
|
2002-07-12 02:53:26 +02:00
|
|
|
list();
|
|
|
|
return NULL;
|
|
|
|
case gtkGetNextPlItem: // get current item from playlist
|
|
|
|
if ( plCurrent )
|
|
|
|
{
|
|
|
|
plCurrent=plCurrent->next;
|
|
|
|
if ( !plCurrent && plList )
|
|
|
|
{
|
|
|
|
plItem * next = plList;
|
|
|
|
while ( next->next ) { if ( !next->next ) break; next=next->next; }
|
|
|
|
plCurrent=next;
|
|
|
|
}
|
|
|
|
return plCurrent;
|
|
|
|
}
|
|
|
|
return NULL;
|
|
|
|
case gtkGetPrevPlItem:
|
|
|
|
if ( plCurrent )
|
|
|
|
{
|
|
|
|
plCurrent=plCurrent->prev;
|
|
|
|
if ( !plCurrent && plList ) plCurrent=plList;
|
|
|
|
return plCurrent;
|
|
|
|
}
|
2002-07-25 22:26:38 +02:00
|
|
|
return NULL;
|
2002-07-12 02:53:26 +02:00
|
|
|
case gtkGetCurrPlItem: // get current item
|
|
|
|
return plCurrent;
|
|
|
|
case gtkDelPl: // delete list
|
|
|
|
{
|
|
|
|
plItem * curr = plList;
|
|
|
|
plItem * next;
|
|
|
|
if ( !plList ) return NULL;
|
|
|
|
if ( !curr->next )
|
|
|
|
{
|
|
|
|
if ( curr->path ) free( curr->path );
|
|
|
|
if ( curr->name ) free( curr->name );
|
|
|
|
free( curr );
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
while ( curr->next )
|
|
|
|
{
|
|
|
|
next=curr->next;
|
|
|
|
if ( curr->path ) free( curr->path );
|
|
|
|
if ( curr->name ) free( curr->name );
|
|
|
|
free( curr );
|
|
|
|
curr=next;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
plList=NULL; plCurrent=NULL;
|
|
|
|
}
|
|
|
|
return NULL;
|
2002-08-27 00:20:58 +02:00
|
|
|
// ----- Handle url
|
|
|
|
case gtkAddURLItem:
|
|
|
|
if ( URLList )
|
|
|
|
{
|
|
|
|
URLItem * next_url = URLList;
|
|
|
|
is_added = False;
|
|
|
|
while ( next_url->next )
|
|
|
|
{
|
|
|
|
if ( !gstrcmp( next_url->url,url_item->url ) )
|
|
|
|
{
|
|
|
|
is_added=True;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
next_url=next_url->next;
|
|
|
|
}
|
|
|
|
if ( ( !is_added )&&( gstrcmp( next_url->url,url_item->url ) ) ) next_url->next=url_item;
|
|
|
|
} else { url_item->next=NULL; URLList=url_item; }
|
|
|
|
return NULL;
|
2002-07-25 22:26:38 +02:00
|
|
|
// --- subtitle
|
|
|
|
#if defined( USE_OSD ) || defined( USE_SUB )
|
2002-08-29 19:16:34 +02:00
|
|
|
#ifndef HAVE_FREETYPE
|
2002-07-25 22:26:38 +02:00
|
|
|
case gtkSetFontFactor:
|
2002-08-16 00:52:52 +02:00
|
|
|
font_factor=fparam;
|
2002-07-25 22:26:38 +02:00
|
|
|
guiLoadFont();
|
|
|
|
return NULL;
|
2002-08-29 19:16:34 +02:00
|
|
|
#else
|
|
|
|
case gtkSetFontOutLine:
|
|
|
|
subtitle_font_thickness=( 8.0f / 100.0f ) * fparam;
|
|
|
|
guiLoadFont();
|
|
|
|
return NULL;
|
|
|
|
case gtkSetFontBlur:
|
|
|
|
subtitle_font_radius=( 8.0f / 100.0f ) * fparam;
|
|
|
|
guiLoadFont();
|
|
|
|
return NULL;
|
|
|
|
case gtkSetFontTextScale:
|
|
|
|
text_font_scale_factor=fparam;
|
|
|
|
guiLoadFont();
|
|
|
|
return NULL;
|
|
|
|
case gtkSetFontOSDScale:
|
|
|
|
osd_font_scale_factor=fparam;
|
|
|
|
guiLoadFont();
|
|
|
|
return NULL;
|
|
|
|
case gtkSetFontEncoding:
|
|
|
|
if ( subtitle_font_encoding ) free( subtitle_font_encoding );
|
|
|
|
subtitle_font_encoding=gstrdup( (char *)vparam );
|
|
|
|
guiLoadFont();
|
|
|
|
return NULL;
|
|
|
|
case gtkSetFontAutoScale:
|
|
|
|
subtitle_autoscale=(int)fparam;
|
|
|
|
guiLoadFont();
|
|
|
|
return NULL;
|
|
|
|
#endif
|
2002-07-25 22:26:38 +02:00
|
|
|
#endif
|
|
|
|
// --- misc
|
|
|
|
case gtkClearStruct:
|
2002-08-15 01:02:45 +02:00
|
|
|
if ( (unsigned int)vparam & guiFilenames )
|
2002-07-25 22:26:38 +02:00
|
|
|
{
|
|
|
|
gfree( (void **)&guiIntfStruct.Filename );
|
|
|
|
gfree( (void **)&guiIntfStruct.Subtitlename );
|
|
|
|
gfree( (void **)&guiIntfStruct.AudioFile );
|
2002-08-15 01:02:45 +02:00
|
|
|
gtkSet( gtkDelPl,0,NULL );
|
2002-07-25 22:26:38 +02:00
|
|
|
}
|
|
|
|
#ifdef USE_DVDREAD
|
2002-08-15 01:02:45 +02:00
|
|
|
if ( (unsigned int)vparam & guiDVD ) memset( &guiIntfStruct.DVD,0,sizeof( guiDVDStruct ) );
|
2002-07-25 22:26:38 +02:00
|
|
|
#endif
|
|
|
|
#ifdef HAVE_VCD
|
2002-08-15 01:02:45 +02:00
|
|
|
if ( (unsigned int)vparam & guiVCD ) guiIntfStruct.VCDTracks=0;
|
2002-07-25 22:26:38 +02:00
|
|
|
#endif
|
|
|
|
return NULL;
|
|
|
|
case gtkSetExtraStereo:
|
|
|
|
gtkAOExtraStereoMul=fparam;
|
|
|
|
audio_plugin_extrastereo.control( AOCONTROL_PLUGIN_ES_SET,(int)>kAOExtraStereoMul );
|
|
|
|
return NULL;
|
|
|
|
case gtkSetPanscan:
|
2002-09-01 13:28:18 +02:00
|
|
|
{
|
|
|
|
mp_cmd_t * mp_cmd;
|
|
|
|
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 );
|
|
|
|
}
|
2002-07-25 22:26:38 +02:00
|
|
|
return NULL;
|
|
|
|
case gtkSetAutoq:
|
2002-08-16 00:52:52 +02:00
|
|
|
auto_quality=(int)fparam;
|
2002-07-25 22:26:38 +02:00
|
|
|
return NULL;
|
2002-07-12 02:53:26 +02:00
|
|
|
// --- set equalizers
|
2002-07-03 20:57:52 +02:00
|
|
|
case gtkSetContrast:
|
2002-09-01 13:28:18 +02:00
|
|
|
if ( guiIntfStruct.sh_video ) set_video_colors( guiIntfStruct.sh_video,"contrast",(int)fparam );
|
|
|
|
return NULL;
|
2002-07-03 20:57:52 +02:00
|
|
|
case gtkSetBrightness:
|
2002-09-01 13:28:18 +02:00
|
|
|
if ( guiIntfStruct.sh_video ) set_video_colors( guiIntfStruct.sh_video,"brightness",(int)fparam );
|
|
|
|
return NULL;
|
2002-07-03 20:57:52 +02:00
|
|
|
case gtkSetHue:
|
2002-09-01 13:28:18 +02:00
|
|
|
if ( guiIntfStruct.sh_video ) set_video_colors( guiIntfStruct.sh_video,"hue",(int)fparam );
|
|
|
|
return NULL;
|
2002-07-03 20:57:52 +02:00
|
|
|
case gtkSetSaturation:
|
2002-09-01 13:28:18 +02:00
|
|
|
if ( guiIntfStruct.sh_video ) set_video_colors( guiIntfStruct.sh_video,"saturation",(int)fparam );
|
|
|
|
return NULL;
|
2002-07-03 20:57:52 +02:00
|
|
|
case gtkSetEqualizer:
|
|
|
|
if ( eq )
|
|
|
|
{
|
|
|
|
gtkEquChannels[eq->channel][eq->band]=eq->gain;
|
|
|
|
audio_plugin_eq.control( AOCONTROL_PLUGIN_EQ_SET_GAIN,(int)eq );
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
int i,j; equalizer_t tmp; tmp.gain=0.0f;
|
|
|
|
memset( gtkEquChannels,0,sizeof( gtkEquChannels ) );
|
|
|
|
for ( i=0;i<6;i++ )
|
|
|
|
for ( j=0;j<10;j++ )
|
|
|
|
{ tmp.channel=i; tmp.band=j; audio_plugin_eq.control( AOCONTROL_PLUGIN_EQ_SET_GAIN,(int)&tmp ); }
|
|
|
|
}
|
2002-07-12 02:53:26 +02:00
|
|
|
return NULL;
|
2002-07-03 20:57:52 +02:00
|
|
|
}
|
2002-07-12 02:53:26 +02:00
|
|
|
return NULL;
|
2002-07-03 20:57:52 +02:00
|
|
|
}
|