2002-11-02 20:10:18 +00:00
|
|
|
|
2002-02-24 17:38:33 +00:00
|
|
|
#include <inttypes.h>
|
|
|
|
#include <stdlib.h>
|
|
|
|
#include <stdio.h>
|
2002-02-23 15:12:55 +00:00
|
|
|
#include <string.h>
|
2002-11-02 20:10:18 +00:00
|
|
|
#include <sys/types.h>
|
2002-02-21 22:48:47 +00:00
|
|
|
|
2002-11-02 20:10:18 +00:00
|
|
|
#include "wm/ws.h"
|
|
|
|
#include "wm/wsxdnd.h"
|
2002-02-21 22:48:47 +00:00
|
|
|
#include "interface.h"
|
2002-07-02 13:35:04 +00:00
|
|
|
#include "skin/skin.h"
|
2002-02-23 15:12:55 +00:00
|
|
|
|
2002-11-02 20:10:18 +00:00
|
|
|
#include "mplayer/gtk/eq.h"
|
2002-02-23 15:12:55 +00:00
|
|
|
#include "mplayer/widgets.h"
|
|
|
|
#include "mplayer/mplayer.h"
|
2002-12-11 01:21:12 +00:00
|
|
|
#include "mplayer/play.h"
|
2002-11-02 20:10:18 +00:00
|
|
|
|
|
|
|
#include "../mplayer.h"
|
2002-02-23 15:12:55 +00:00
|
|
|
#include "app.h"
|
2002-07-25 20:26:38 +00:00
|
|
|
#include "cfg.h"
|
|
|
|
#include "../help_mp.h"
|
|
|
|
#include "../subreader.h"
|
2002-02-23 15:12:55 +00:00
|
|
|
#include "../libvo/x11_common.h"
|
2002-04-22 21:36:12 +00:00
|
|
|
#include "../libvo/video_out.h"
|
2002-07-25 20:26:38 +00:00
|
|
|
#include "../libvo/font_load.h"
|
2002-08-30 19:11:03 +00:00
|
|
|
#include "../libvo/sub.h"
|
2002-02-25 13:14:27 +00:00
|
|
|
#include "../input/input.h"
|
2002-07-02 13:35:04 +00:00
|
|
|
#include "../libao2/audio_out.h"
|
2002-07-03 18:57:52 +00:00
|
|
|
#include "../mixer.h"
|
2004-12-27 19:34:42 +00:00
|
|
|
#include "../libaf/af.h"
|
2005-01-06 18:10:36 +00:00
|
|
|
#include "../libaf/equalizer.h"
|
2002-04-22 21:36:12 +00:00
|
|
|
|
2004-12-27 19:34:42 +00:00
|
|
|
extern af_cfg_t af_cfg;
|
|
|
|
|
2002-08-14 12:17:04 +00:00
|
|
|
#ifdef USE_ICONV
|
2002-08-28 23:00:25 +00:00
|
|
|
#include <iconv.h>
|
2002-08-14 12:17:04 +00:00
|
|
|
#endif
|
|
|
|
|
2002-04-17 21:12:12 +00:00
|
|
|
#include "../libmpdemux/stream.h"
|
2002-04-22 21:36:12 +00:00
|
|
|
#include "../libmpdemux/demuxer.h"
|
2002-09-01 11:28:18 +00:00
|
|
|
#include "../libmpdemux/stheader.h"
|
|
|
|
#include "../libmpcodecs/dec_video.h"
|
2002-02-23 15:12:55 +00:00
|
|
|
|
2003-08-13 16:29:32 +00:00
|
|
|
#include "../m_config.h"
|
|
|
|
#include "../m_option.h"
|
2003-03-20 07:51:03 +00:00
|
|
|
|
2004-06-26 13:26:11 +00:00
|
|
|
extern mixer_t mixer; // mixer from mplayer.c
|
|
|
|
|
2002-02-23 15:12:55 +00:00
|
|
|
guiInterface_t guiIntfStruct;
|
2003-02-07 18:06:16 +00:00
|
|
|
int guiWinID=-1;
|
2002-02-23 15:12:55 +00:00
|
|
|
|
2002-07-03 18:57:52 +00:00
|
|
|
char * gstrcat( char ** dest,char * src )
|
|
|
|
{
|
|
|
|
char * tmp = NULL;
|
|
|
|
|
|
|
|
if ( !src ) return NULL;
|
|
|
|
|
|
|
|
if ( *dest )
|
|
|
|
{
|
|
|
|
tmp=malloc( strlen( *dest ) + strlen( src ) + 1 );
|
2004-06-25 16:49:53 +00:00
|
|
|
|
|
|
|
if ( tmp ) /* TODO: advanced error handling */
|
|
|
|
{
|
|
|
|
strcpy( tmp,*dest ); strcat( tmp,src ); free( *dest );
|
|
|
|
}
|
|
|
|
}
|
2002-07-03 18:57:52 +00:00
|
|
|
else
|
|
|
|
{ tmp=malloc( strlen( src ) + 1 ); strcpy( tmp,src ); }
|
|
|
|
*dest=tmp;
|
|
|
|
return tmp;
|
|
|
|
}
|
|
|
|
|
2002-07-25 20:26:38 +00:00
|
|
|
int gstrcmp( char * a,char * b )
|
|
|
|
{
|
|
|
|
if ( !a && !b ) return 0;
|
|
|
|
if ( !a || !b ) return -1;
|
|
|
|
return strcmp( a,b );
|
|
|
|
}
|
|
|
|
|
2002-08-15 22:52:52 +00: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 20:26:38 +00:00
|
|
|
char * gstrdup( char * str )
|
|
|
|
{
|
|
|
|
if ( !str ) return NULL;
|
|
|
|
return strdup( str );
|
|
|
|
}
|
|
|
|
|
2002-11-25 18:18:45 +00:00
|
|
|
char * gstrchr( char * str,int c )
|
|
|
|
{
|
|
|
|
if ( !str ) return NULL;
|
|
|
|
return strchr( str,c );
|
|
|
|
}
|
|
|
|
|
2002-07-25 20:26:38 +00:00
|
|
|
void gfree( void ** p )
|
|
|
|
{
|
|
|
|
if ( *p == NULL ) return;
|
|
|
|
free( *p ); *p=NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
void gset( char ** str,char * what )
|
|
|
|
{
|
2002-10-23 23:13:26 +00:00
|
|
|
if ( *str ) { if ( !strstr( *str,what ) ) { gstrcat( str,"," ); gstrcat( str,what ); }}
|
2002-07-25 20:26:38 +00:00
|
|
|
else gstrcat( str,what );
|
|
|
|
}
|
|
|
|
|
2004-12-27 19:34:42 +00:00
|
|
|
/**
|
|
|
|
* \brief this actually creates a new list containing only one element...
|
|
|
|
*/
|
2002-10-02 13:16:15 +00:00
|
|
|
void gaddlist( char *** list,char * entry )
|
|
|
|
{
|
|
|
|
int i;
|
|
|
|
|
|
|
|
if ( (*list) )
|
|
|
|
{
|
|
|
|
for ( i=0;(*list)[i];i++ ) free( (*list)[i] );
|
|
|
|
free( (*list) );
|
|
|
|
}
|
|
|
|
|
2004-12-17 20:32:46 +00:00
|
|
|
(*list)=malloc( 2 * sizeof(char **) );
|
2002-10-02 13:16:15 +00:00
|
|
|
(*list)[0]=gstrdup( entry );
|
|
|
|
(*list)[1]=NULL;
|
|
|
|
}
|
|
|
|
|
2004-12-27 19:34:42 +00:00
|
|
|
/**
|
|
|
|
* \brief this replaces a string starting with search by replace.
|
|
|
|
* If not found, replace is appended.
|
|
|
|
*/
|
|
|
|
void greplace(char ***list, char *search, char *replace)
|
|
|
|
{
|
|
|
|
int i = 0;
|
|
|
|
int len = (search) ? strlen(search) : 0;
|
|
|
|
|
|
|
|
if (*list) {
|
|
|
|
for (i = 0; (*list)[i]; i++) {
|
|
|
|
if (search && (strncmp((*list)[i], search, len) == 0)) {
|
|
|
|
free((*list)[i]);
|
|
|
|
(*list)[i] = gstrdup(replace);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
*list = realloc(*list, (i + 2) * sizeof(char *));
|
|
|
|
}
|
|
|
|
else
|
|
|
|
*list = malloc(2 * sizeof(char *));
|
|
|
|
|
|
|
|
(*list)[i] = gstrdup(replace);
|
|
|
|
(*list)[i + 1] = NULL;
|
|
|
|
}
|
|
|
|
|
2002-08-14 12:17:04 +00: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
|
|
|
|
{
|
2004-03-25 21:49:48 +00:00
|
|
|
char tmp[5] = "0xXX";
|
2002-08-14 12:17:04 +00:00
|
|
|
// 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 11:55:17 +00:00
|
|
|
void guiInit( void )
|
2002-02-23 15:12:55 +00:00
|
|
|
{
|
2002-11-02 20:10:18 +00:00
|
|
|
int i;
|
|
|
|
|
2002-02-23 15:12:55 +00:00
|
|
|
memset( &guiIntfStruct,0,sizeof( guiIntfStruct ) );
|
2002-08-04 17:24:00 +00:00
|
|
|
guiIntfStruct.Balance=50.0f;
|
|
|
|
guiIntfStruct.StreamType=-1;
|
|
|
|
|
2002-07-03 18:57:52 +00:00
|
|
|
memset( >kEquChannels,0,sizeof( gtkEquChannels ) );
|
2002-10-10 14:11:06 +00:00
|
|
|
#ifdef HAVE_DXR3
|
2002-10-10 14:06:49 +00:00
|
|
|
if ( !gtkDXR3Device ) gtkDXR3Device=strdup( "/dev/em8300-0" );
|
2002-10-10 14:11:06 +00:00
|
|
|
#endif
|
2004-12-18 10:30:17 +00:00
|
|
|
if ( stream_cache_size > 0 ) { gtkCacheOn=1; gtkCacheSize=stream_cache_size; }
|
|
|
|
else gtkCacheOn = 0;
|
2002-11-28 23:17:14 +00:00
|
|
|
if ( autosync && autosync != gtkAutoSync ) { gtkAutoSyncOn=1; gtkAutoSync=autosync; }
|
2002-08-04 17:24:00 +00:00
|
|
|
|
|
|
|
gtkInit();
|
2002-11-02 16:09:05 +00:00
|
|
|
// --- initialize X
|
2002-08-05 01:14:14 +00:00
|
|
|
wsXInit( (void *)mDisplay );
|
2002-11-02 20:10:18 +00:00
|
|
|
// --- load skin
|
2002-11-02 16:09:05 +00:00
|
|
|
skinDirInHome=get_path("Skin");
|
2003-06-09 12:15:48 +00:00
|
|
|
skinMPlayerDir=MPLAYER_DATADIR "/Skin";
|
2004-12-15 01:22:24 +00:00
|
|
|
mp_msg( MSGT_GPLAYER,MSGL_V,"SKIN dir 1: '%s'\n",skinDirInHome);
|
|
|
|
mp_msg( MSGT_GPLAYER,MSGL_V,"SKIN dir 2: '%s'\n",skinMPlayerDir);
|
2002-11-02 16:09:05 +00:00
|
|
|
if ( !skinName ) skinName=strdup( "default" );
|
2003-08-14 01:54:27 +00:00
|
|
|
i = skinRead( skinName );
|
|
|
|
if ((i == -1) && strcmp(skinName,"default"))
|
|
|
|
{
|
2004-12-15 01:22:24 +00:00
|
|
|
mp_msg( MSGT_GPLAYER,MSGL_WARN,MSGTR_SKIN_SKINCFG_SelectedSkinNotFound, skinName);
|
2003-08-14 01:54:27 +00:00
|
|
|
skinName=strdup( "default" );
|
|
|
|
i = skinRead( skinName );
|
|
|
|
}
|
|
|
|
switch (i) {
|
2002-11-02 16:09:05 +00:00
|
|
|
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 20:10:18 +00:00
|
|
|
// --- initialize windows
|
2003-01-25 10:04:05 +00:00
|
|
|
if ( ( mplDrawBuffer = (unsigned char *)malloc( appMPlayer.main.Bitmap.ImageSize ) ) == NULL )
|
2002-11-02 20:10:18 +00:00
|
|
|
{
|
|
|
|
fprintf( stderr,MSGTR_NEMDB );
|
|
|
|
exit( 0 );
|
|
|
|
}
|
2003-02-06 23:12:37 +00:00
|
|
|
|
2003-03-20 12:42:16 +00:00
|
|
|
if ( gui_save_pos )
|
|
|
|
{
|
|
|
|
appMPlayer.main.x = gui_main_pos_x;
|
|
|
|
appMPlayer.main.y = gui_main_pos_y;
|
|
|
|
appMPlayer.sub.x = gui_sub_pos_x;
|
|
|
|
appMPlayer.sub.y = gui_sub_pos_y;
|
|
|
|
}
|
|
|
|
|
2003-02-06 23:12:37 +00:00
|
|
|
if (WinID>0)
|
2003-03-20 12:42:16 +00:00
|
|
|
{
|
2003-02-06 23:12:37 +00:00
|
|
|
appMPlayer.subWindow.Parent=WinID;
|
|
|
|
appMPlayer.sub.x=0;
|
|
|
|
appMPlayer.sub.y=0;
|
2003-03-20 12:42:16 +00:00
|
|
|
}
|
|
|
|
if (guiWinID>=0) appMPlayer.mainWindow.Parent=guiWinID;
|
2003-02-01 16:42:02 +00:00
|
|
|
|
2002-11-02 20:10:18 +00:00
|
|
|
wsCreateWindow( &appMPlayer.subWindow,
|
|
|
|
appMPlayer.sub.x,appMPlayer.sub.y,appMPlayer.sub.width,appMPlayer.sub.height,
|
2003-02-01 16:42:02 +00:00
|
|
|
wsNoBorder,wsShowMouseCursor|wsHandleMouseButton|wsHandleMouseMove,wsShowFrame|wsHideWindow,"MPlayer - Video" );
|
2002-11-02 20:10:18 +00:00
|
|
|
|
|
|
|
wsDestroyImage( &appMPlayer.subWindow );
|
|
|
|
wsCreateImage( &appMPlayer.subWindow,appMPlayer.sub.Bitmap.Width,appMPlayer.sub.Bitmap.Height );
|
|
|
|
wsXDNDMakeAwareness(&appMPlayer.subWindow);
|
|
|
|
|
2003-01-17 22:39:43 +00:00
|
|
|
mplMenuInit();
|
|
|
|
mplPBInit();
|
|
|
|
|
2002-11-02 20:10:18 +00:00
|
|
|
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,
|
2003-01-13 23:38:49 +00:00
|
|
|
wsNoBorder,wsShowMouseCursor|wsHandleMouseButton|wsHandleMouseMove,i,"MPlayer" );
|
2002-11-02 20:10:18 +00:00
|
|
|
|
|
|
|
wsSetShape( &appMPlayer.mainWindow,appMPlayer.main.Mask.Image );
|
|
|
|
wsXDNDMakeAwareness(&appMPlayer.mainWindow);
|
|
|
|
|
|
|
|
#ifdef DEBUG
|
2004-12-15 01:22:24 +00:00
|
|
|
mp_msg( MSGT_GPLAYER,MSGL_DBG2,"[main] depth on screen: %d\n",wsDepthOnScreen );
|
2002-11-02 20:10:18 +00:00
|
|
|
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;
|
|
|
|
|
2003-01-17 22:39:43 +00:00
|
|
|
wsSetBackgroundRGB( &appMPlayer.subWindow,appMPlayer.sub.R,appMPlayer.sub.G,appMPlayer.sub.B );
|
2002-11-02 20:10:18 +00:00
|
|
|
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 );
|
2003-02-01 16:42:02 +00:00
|
|
|
#if 0
|
2002-11-02 20:10:18 +00:00
|
|
|
wsVisibleWindow( &appMPlayer.subWindow,wsShowWindow );
|
|
|
|
|
|
|
|
{
|
|
|
|
XEvent xev;
|
|
|
|
do { XNextEvent( wsDisplay,&xev ); } while ( xev.type != MapNotify || xev.xmap.event != appMPlayer.subWindow.WindowID );
|
|
|
|
appMPlayer.subWindow.Mapped=wsMapped;
|
|
|
|
}
|
|
|
|
|
2003-01-25 10:04:05 +00:00
|
|
|
if ( !fullscreen ) fullscreen=gtkLoadFullscreen;
|
2002-11-02 20:10:18 +00:00
|
|
|
if ( fullscreen )
|
|
|
|
{
|
|
|
|
mplFullScreen();
|
|
|
|
btnModify( evFullScreen,btnPressed );
|
|
|
|
}
|
2003-02-01 16:42:02 +00:00
|
|
|
#else
|
2004-01-29 11:04:35 +00:00
|
|
|
if ( !fullscreen ) fullscreen=gtkLoadFullscreen;
|
2003-02-01 16:42:02 +00:00
|
|
|
if ( gtkShowVideoWindow )
|
|
|
|
{
|
|
|
|
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 );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if ( fullscreen )
|
|
|
|
{
|
|
|
|
wsVisibleWindow( &appMPlayer.subWindow,wsShowWindow );
|
|
|
|
{
|
|
|
|
XEvent xev;
|
|
|
|
do { XNextEvent( wsDisplay,&xev ); } while ( xev.type != MapNotify || xev.xmap.event != appMPlayer.subWindow.WindowID );
|
|
|
|
appMPlayer.subWindow.Mapped=wsMapped;
|
|
|
|
}
|
|
|
|
wsVisibleWindow( &appMPlayer.subWindow, wsShowWindow );
|
|
|
|
|
|
|
|
mplFullScreen();
|
|
|
|
btnModify( evFullScreen,btnPressed );
|
|
|
|
}
|
|
|
|
}
|
2002-11-02 20:10:18 +00:00
|
|
|
#endif
|
|
|
|
mplSubRender=1;
|
2002-11-02 16:09:05 +00:00
|
|
|
// ---
|
2002-09-28 19:42:10 +00:00
|
|
|
|
2002-12-11 01:21:12 +00:00
|
|
|
if ( filename ) mplSetFileName( NULL,filename,STREAMTYPE_FILE );
|
2002-08-14 23:02:45 +00:00
|
|
|
if ( plCurrent && !filename ) mplSetFileName( plCurrent->path,plCurrent->name,STREAMTYPE_FILE );
|
2003-04-07 16:04:02 +00:00
|
|
|
if ( subdata ) guiSetFilename( guiIntfStruct.Subtitlename, subdata->filename );
|
2002-07-25 21:31:36 +00:00
|
|
|
#if defined( USE_OSD ) || defined( USE_SUB )
|
|
|
|
guiLoadFont();
|
|
|
|
#endif
|
2002-02-23 15:12:55 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void guiDone( void )
|
|
|
|
{
|
2003-01-11 01:30:07 +00:00
|
|
|
mplMainRender=0;
|
2004-12-15 01:22:24 +00:00
|
|
|
mp_msg( MSGT_GPLAYER,MSGL_V,"[GUI] done.\n" );
|
2003-03-20 12:42:16 +00:00
|
|
|
|
|
|
|
if ( gui_save_pos )
|
|
|
|
{
|
|
|
|
gui_main_pos_x=appMPlayer.mainWindow.X; gui_main_pos_y=appMPlayer.mainWindow.Y;
|
|
|
|
gui_sub_pos_x=appMPlayer.subWindow.X; gui_sub_pos_y=appMPlayer.subWindow.Y;
|
|
|
|
}
|
|
|
|
|
2002-07-25 20:26:38 +00:00
|
|
|
cfg_write();
|
2002-02-23 15:12:55 +00:00
|
|
|
wsXDone();
|
|
|
|
}
|
2002-02-21 22:48:47 +00:00
|
|
|
|
2002-02-25 13:14:27 +00:00
|
|
|
int guiCMDArray[] =
|
|
|
|
{
|
2003-01-11 01:30:07 +00:00
|
|
|
evLoadPlay,
|
2002-02-25 13:14:27 +00:00
|
|
|
evLoadSubtitle,
|
|
|
|
evAbout,
|
|
|
|
evPlay,
|
|
|
|
evStop,
|
|
|
|
evPlayList,
|
|
|
|
evPreferences,
|
|
|
|
evFullScreen,
|
|
|
|
evSkinBrowser
|
|
|
|
};
|
|
|
|
|
2002-07-02 13:35:04 +00:00
|
|
|
extern ao_functions_t * audio_out;
|
2002-07-19 20:51:48 +00:00
|
|
|
extern vo_functions_t * video_out;
|
2002-07-25 20:26:38 +00:00
|
|
|
extern int frame_dropping;
|
|
|
|
extern int stream_dump_type;
|
2003-04-03 12:09:44 +00:00
|
|
|
extern int vcd_track;
|
2003-03-20 07:51:03 +00:00
|
|
|
extern m_obj_settings_t*vo_plugin_args;
|
2002-07-25 20:26:38 +00:00
|
|
|
|
|
|
|
#if defined( USE_OSD ) || defined( USE_SUB )
|
|
|
|
void guiLoadFont( void )
|
|
|
|
{
|
2002-08-28 20:52:02 +00:00
|
|
|
#ifdef HAVE_FREETYPE
|
2002-12-29 14:59:23 +00:00
|
|
|
load_font_ft(vo_image_width, vo_image_height);
|
2002-08-28 20:52:02 +00:00
|
|
|
#else
|
2002-07-25 20:26:38 +00: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-15 22:52:52 +00:00
|
|
|
if ( font_name )
|
2002-07-25 20:26:38 +00:00
|
|
|
{
|
2002-08-15 22:52:52 +00:00
|
|
|
vo_font=read_font_desc( font_name,font_factor,0 );
|
2002-07-25 20:26:38 +00:00
|
|
|
if ( !vo_font ) mp_msg( MSGT_CPLAYER,MSGL_ERR,MSGTR_CantLoadFont,font_name );
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2002-08-15 22:52:52 +00:00
|
|
|
font_name=gstrdup( get_path( "font/font.desc" ) );
|
|
|
|
vo_font=read_font_desc( font_name,font_factor,0 );
|
2002-07-25 20:26:38 +00:00
|
|
|
if ( !vo_font )
|
|
|
|
{
|
2003-06-09 12:15:48 +00:00
|
|
|
gfree( (void **)&font_name ); font_name=gstrdup(MPLAYER_DATADIR "/font/font.desc" );
|
2002-08-15 22:52:52 +00:00
|
|
|
vo_font=read_font_desc( font_name,font_factor,0 );
|
2002-07-25 20:26:38 +00:00
|
|
|
}
|
|
|
|
}
|
2002-08-28 20:52:02 +00:00
|
|
|
#endif
|
2002-07-25 20:26:38 +00:00
|
|
|
}
|
|
|
|
#endif
|
2002-07-02 13:35:04 +00:00
|
|
|
|
2002-08-29 22:24:49 +00:00
|
|
|
#ifdef USE_SUB
|
2002-08-30 19:11:03 +00:00
|
|
|
extern mp_osd_obj_t* vo_osd_list;
|
|
|
|
|
2003-04-07 16:04:02 +00:00
|
|
|
extern char **sub_name;
|
|
|
|
|
2002-08-29 22:24:49 +00:00
|
|
|
void guiLoadSubtitle( char * name )
|
|
|
|
{
|
|
|
|
if ( guiIntfStruct.Playing == 0 )
|
|
|
|
{
|
2003-04-07 16:04:02 +00:00
|
|
|
guiIntfStruct.SubtitleChanged=1; //what is this for? (mw)
|
2002-08-29 22:24:49 +00:00
|
|
|
return;
|
|
|
|
}
|
2003-04-07 16:04:02 +00:00
|
|
|
if ( subdata )
|
2002-08-29 22:24:49 +00:00
|
|
|
{
|
2004-12-15 01:22:24 +00:00
|
|
|
mp_msg( MSGT_GPLAYER,MSGL_INFO,MSGTR_DeletingSubtitles );
|
2003-04-07 16:04:02 +00:00
|
|
|
sub_free( subdata );
|
|
|
|
subdata=NULL;
|
2002-08-29 22:24:49 +00:00
|
|
|
vo_sub=NULL;
|
2002-08-30 19:11:03 +00: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 )
|
|
|
|
{
|
2004-12-15 01:22:24 +00:00
|
|
|
mp_msg( MSGT_GPLAYER,MSGL_INFO,MSGTR_LoadingSubtitles,name );
|
2005-06-01 09:01:41 +00:00
|
|
|
subdata=sub_read_file( name, guiIntfStruct.FPS );
|
2003-04-07 16:04:02 +00:00
|
|
|
if ( !subdata ) mp_msg( MSGT_GPLAYER,MSGL_ERR,MSGTR_CantLoadSub,name );
|
|
|
|
sub_name = (malloc(2 * sizeof(char*))); //when mplayer will be restarted
|
|
|
|
sub_name[0] = strdup(name); //sub_name[0] will be read
|
|
|
|
sub_name[1] = NULL;
|
2002-08-29 22:24:49 +00:00
|
|
|
}
|
2003-04-07 16:04:02 +00:00
|
|
|
update_set_of_subtitles();
|
|
|
|
|
2002-08-29 22:24:49 +00:00
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2002-08-14 23:02:45 +00:00
|
|
|
static void add_vop( char * str )
|
|
|
|
{
|
2004-12-15 01:22:24 +00:00
|
|
|
mp_msg( MSGT_GPLAYER,MSGL_STATUS,MSGTR_AddingVideoFilter,str );
|
2002-08-14 23:02:45 +00:00
|
|
|
if ( vo_plugin_args )
|
|
|
|
{
|
|
|
|
int i = 0;
|
2003-03-20 07:51:03 +00:00
|
|
|
while ( vo_plugin_args[i].name ) if ( !gstrcmp( vo_plugin_args[i++].name,str ) ) { i=-1; break; }
|
2002-08-14 23:02:45 +00:00
|
|
|
if ( i != -1 )
|
2003-03-20 07:51:03 +00:00
|
|
|
{ vo_plugin_args=realloc( vo_plugin_args,( i + 2 ) * sizeof( m_obj_settings_t ) ); vo_plugin_args[i].name=strdup( str );vo_plugin_args[i].attribs = NULL; vo_plugin_args[i+1].name=NULL; }
|
|
|
|
} else { vo_plugin_args=malloc( 2 * sizeof( m_obj_settings_t ) ); vo_plugin_args[0].name=strdup( str );vo_plugin_args[0].attribs = NULL; vo_plugin_args[1].name=NULL; }
|
2002-08-14 23:02:45 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void remove_vop( char * str )
|
|
|
|
{
|
|
|
|
int n = 0;
|
|
|
|
|
|
|
|
if ( !vo_plugin_args ) return;
|
|
|
|
|
2004-12-15 01:22:24 +00:00
|
|
|
mp_msg( MSGT_GPLAYER,MSGL_STATUS,MSGTR_RemovingVideoFilter,str );
|
2002-08-14 23:02:45 +00:00
|
|
|
|
2003-03-20 07:51:03 +00:00
|
|
|
while ( vo_plugin_args[n++].name ); n--;
|
2002-08-14 23:02:45 +00:00
|
|
|
if ( n > -1 )
|
|
|
|
{
|
|
|
|
int i = 0,m = -1;
|
2003-03-20 07:51:03 +00:00
|
|
|
while ( vo_plugin_args[i].name ) if ( !gstrcmp( vo_plugin_args[i++].name,str ) ) { m=i - 1; break; }
|
2002-08-14 23:02:45 +00:00
|
|
|
i--;
|
|
|
|
if ( m > -1 )
|
|
|
|
{
|
2003-03-20 07:51:03 +00:00
|
|
|
if ( n == 1 ) { free( vo_plugin_args[0].name );free( vo_plugin_args[0].attribs ); free( vo_plugin_args ); vo_plugin_args=NULL; }
|
|
|
|
else { free( vo_plugin_args[i].name );free( vo_plugin_args[i].attribs ); memcpy( &vo_plugin_args[i],&vo_plugin_args[i + 1],( n - i ) * sizeof( m_obj_settings_t ) ); }
|
2002-08-14 23:02:45 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
int guiGetEvent( int type,char * arg )
|
2002-02-21 22:48:47 +00:00
|
|
|
{
|
2002-06-03 15:06:32 +00:00
|
|
|
stream_t * stream = (stream_t *) arg;
|
2002-04-18 14:03:50 +00:00
|
|
|
#ifdef USE_DVDREAD
|
2002-04-17 21:12:12 +00:00
|
|
|
dvd_priv_t * dvdp = (dvd_priv_t *) arg;
|
2002-04-18 14:03:50 +00:00
|
|
|
#endif
|
2002-07-02 13:35:04 +00:00
|
|
|
|
2002-02-21 22:48:47 +00:00
|
|
|
switch ( type )
|
|
|
|
{
|
|
|
|
case guiXEvent:
|
2003-01-17 22:39:43 +00:00
|
|
|
guiIntfStruct.event_struct=(void *)arg;
|
2002-02-21 22:48:47 +00:00
|
|
|
wsEvents( wsDisplay,(XEvent *)arg,NULL );
|
2002-02-23 15:12:55 +00:00
|
|
|
gtkEventHandling();
|
|
|
|
break;
|
2002-02-21 22:48:47 +00:00
|
|
|
case guiCEvent:
|
2002-03-06 23:54:20 +00:00
|
|
|
switch ( (int)arg )
|
|
|
|
{
|
2003-02-01 16:42:02 +00:00
|
|
|
case guiSetPlay:
|
|
|
|
guiIntfStruct.Playing=1;
|
2004-02-03 19:02:45 +00:00
|
|
|
// if ( !gtkShowVideoWindow ) wsVisibleWindow( &appMPlayer.subWindow,wsHideWindow );
|
2003-02-01 16:42:02 +00:00
|
|
|
break;
|
|
|
|
case guiSetStop:
|
|
|
|
guiIntfStruct.Playing=0;
|
2004-03-25 21:49:48 +00:00
|
|
|
// if ( !gtkShowVideoWindow ) wsVisibleWindow( &appMPlayer.subWindow,wsHideWindow );
|
2003-02-01 16:42:02 +00:00
|
|
|
break;
|
2002-12-11 01:21:12 +00:00
|
|
|
case guiSetPause: guiIntfStruct.Playing=2; break;
|
2002-03-06 23:54:20 +00:00
|
|
|
}
|
2002-12-11 01:21:12 +00:00
|
|
|
mplState();
|
2002-02-23 15:12:55 +00:00
|
|
|
break;
|
2002-04-17 21:12:12 +00:00
|
|
|
case guiSetState:
|
|
|
|
mplState();
|
|
|
|
break;
|
|
|
|
case guiSetFileName:
|
|
|
|
if ( arg ) guiSetFilename( guiIntfStruct.Filename,arg );
|
|
|
|
break;
|
2002-04-22 21:36:12 +00:00
|
|
|
case guiSetAudioOnly:
|
|
|
|
guiIntfStruct.AudioOnly=(int)arg;
|
2002-08-14 23:02:45 +00:00
|
|
|
if ( (int)arg ) { guiIntfStruct.NoWindow=True; wsVisibleWindow( &appMPlayer.subWindow,wsHideWindow ); }
|
2002-04-22 21:36:12 +00:00
|
|
|
else wsVisibleWindow( &appMPlayer.subWindow,wsShowWindow );
|
|
|
|
break;
|
2002-11-29 00:58:25 +00:00
|
|
|
case guiSetDemuxer:
|
|
|
|
guiIntfStruct.demuxer=(void *)arg;
|
|
|
|
break;
|
2004-12-27 19:34:42 +00:00
|
|
|
case guiSetAfilter:
|
|
|
|
guiIntfStruct.afilter=(void *)arg;
|
|
|
|
break;
|
2002-04-22 21:36:12 +00:00
|
|
|
case guiSetShVideo:
|
|
|
|
{
|
2002-05-05 18:46:42 +00: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 20:57:13 +00:00
|
|
|
guiIntfStruct.MovieWidth=vo_dwidth;
|
2002-05-06 15:05:07 +00:00
|
|
|
guiIntfStruct.MovieHeight=vo_dheight;
|
2003-02-07 18:06:16 +00:00
|
|
|
if (guiWinID>=0)
|
2003-02-06 23:12:37 +00:00
|
|
|
wsMoveWindow( &appMPlayer.mainWindow,0,0, vo_dheight);
|
2002-04-22 21:36:12 +00:00
|
|
|
}
|
|
|
|
break;
|
2002-04-17 21:12:12 +00: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 15:06:32 +00:00
|
|
|
case guiSetStream:
|
|
|
|
guiIntfStruct.StreamType=stream->type;
|
|
|
|
switch( stream->type )
|
|
|
|
{
|
2002-08-29 22:24:49 +00:00
|
|
|
#ifdef USE_DVDREAD
|
2002-06-03 15:06:32 +00:00
|
|
|
case STREAMTYPE_DVD:
|
|
|
|
guiGetEvent( guiSetDVD,(char *)stream->priv );
|
|
|
|
break;
|
2002-08-29 22:24:49 +00:00
|
|
|
#endif
|
2002-06-03 15:06:32 +00:00
|
|
|
#ifdef HAVE_VCD
|
|
|
|
case STREAMTYPE_VCD:
|
|
|
|
{
|
|
|
|
int i;
|
2003-08-25 21:33:39 +00:00
|
|
|
|
|
|
|
if (!stream->priv)
|
|
|
|
{
|
|
|
|
guiIntfStruct.VCDTracks=0;
|
|
|
|
break;
|
|
|
|
}
|
2002-06-03 15:06:32 +00:00
|
|
|
for ( i=1;i < 100;i++ )
|
2003-08-25 21:33:39 +00:00
|
|
|
if ( vcd_seek_to_track( stream->priv,i ) < 0 ) break;
|
|
|
|
vcd_seek_to_track( stream->priv,vcd_track );
|
2002-06-03 15:06:32 +00:00
|
|
|
guiIntfStruct.VCDTracks=--i;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
#endif
|
2002-08-29 22:24:49 +00:00
|
|
|
default: break;
|
2002-06-03 15:06:32 +00:00
|
|
|
}
|
|
|
|
break;
|
2002-02-25 13:14:27 +00:00
|
|
|
case guiIEvent:
|
2004-12-12 22:24:32 +00:00
|
|
|
mp_msg( MSGT_GPLAYER,MSGL_V,"cmd: %d\n",(int)arg );
|
2002-02-25 13:14:27 +00:00
|
|
|
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 13:35:04 +00:00
|
|
|
case guiReDraw:
|
|
|
|
mplEventHandling( evRedraw,0 );
|
|
|
|
break;
|
|
|
|
case guiSetVolume:
|
2002-08-04 19:23:58 +00:00
|
|
|
if ( audio_out )
|
|
|
|
{
|
|
|
|
float l,r;
|
2004-06-26 13:26:11 +00:00
|
|
|
mixer_getvolume( &mixer,&l,&r );
|
2002-08-04 19:23:58 +00:00
|
|
|
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-14 23:02:45 +00:00
|
|
|
case guiSetFileFormat:
|
|
|
|
guiIntfStruct.FileFormat=(int)arg;
|
|
|
|
break;
|
2002-08-04 19:23:58 +00:00
|
|
|
case guiSetValues:
|
2002-08-05 01:14:14 +00:00
|
|
|
// -- video
|
2002-09-01 11:28:18 +00:00
|
|
|
guiIntfStruct.sh_video=arg;
|
2002-08-05 01:14:14 +00:00
|
|
|
if ( arg )
|
|
|
|
{
|
2002-09-01 11:28:18 +00:00
|
|
|
sh_video_t * sh = (sh_video_t *)arg;
|
2002-08-29 22:24:49 +00:00
|
|
|
guiIntfStruct.FPS=sh->fps;
|
2002-08-05 01:14:14 +00:00
|
|
|
}
|
2002-08-14 23:02:45 +00:00
|
|
|
|
|
|
|
if ( guiIntfStruct.NoWindow ) wsVisibleWindow( &appMPlayer.subWindow,wsHideWindow );
|
2002-11-25 17:33:30 +00:00
|
|
|
|
2002-11-27 23:11:49 +00:00
|
|
|
if ( guiIntfStruct.StreamType == STREAMTYPE_STREAM ) btnSet( evSetMoviePosition,btnDisabled );
|
|
|
|
else btnSet( evSetMoviePosition,btnReleased );
|
2002-11-25 18:18:45 +00:00
|
|
|
|
2002-07-25 20:26:38 +00:00
|
|
|
// -- audio
|
2002-07-02 13:35:04 +00:00
|
|
|
if ( audio_out )
|
|
|
|
{
|
|
|
|
float l,r;
|
2004-06-26 13:26:11 +00:00
|
|
|
mixer_getvolume( &mixer,&l,&r );
|
2002-07-02 13:35:04 +00:00
|
|
|
guiIntfStruct.Volume=(r>l?r:l);
|
|
|
|
if ( r != l ) guiIntfStruct.Balance=( ( r - l ) + 100 ) * 0.5f;
|
2002-07-03 18:57:52 +00:00
|
|
|
else guiIntfStruct.Balance=50.0f;
|
2002-07-02 13:35:04 +00:00
|
|
|
btnModify( evSetVolume,guiIntfStruct.Volume );
|
|
|
|
btnModify( evSetBalance,guiIntfStruct.Balance );
|
|
|
|
}
|
2002-07-03 18:57:52 +00: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 20:26:38 +00:00
|
|
|
// -- subtitle
|
2002-08-14 23:02:45 +00:00
|
|
|
#ifdef HAVE_DXR3
|
2002-11-02 16:09:05 +00: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-14 23:02:45 +00:00
|
|
|
{
|
|
|
|
gtkMessageBox( GTK_MB_FATAL,MSGTR_NEEDLAVCFAME );
|
|
|
|
guiIntfStruct.Playing=0;
|
|
|
|
return True;
|
|
|
|
}
|
2002-07-25 20:26:38 +00:00
|
|
|
#endif
|
2002-07-03 18:57:52 +00:00
|
|
|
break;
|
|
|
|
case guiSetDefaults:
|
2003-01-21 13:33:40 +00:00
|
|
|
// if ( guiIntfStruct.Playing == 1 && guiIntfStruct.FilenameChanged )
|
|
|
|
if ( guiIntfStruct.FilenameChanged )
|
2002-12-11 01:21:12 +00:00
|
|
|
{
|
|
|
|
audio_id=-1;
|
|
|
|
video_id=-1;
|
|
|
|
dvdsub_id=-1;
|
|
|
|
vobsub_id=-1;
|
|
|
|
stream_cache_size=-1;
|
|
|
|
autosync=0;
|
|
|
|
vcd_track=0;
|
|
|
|
dvd_title=0;
|
2003-01-21 13:33:40 +00:00
|
|
|
force_fps=0;
|
2002-12-11 01:21:12 +00:00
|
|
|
}
|
|
|
|
wsPostRedisplay( &appMPlayer.subWindow );
|
|
|
|
break;
|
|
|
|
case guiSetParameters:
|
2003-01-21 13:33:40 +00:00
|
|
|
guiGetEvent( guiSetDefaults,NULL );
|
2002-12-11 01:21:12 +00:00
|
|
|
switch ( guiIntfStruct.StreamType )
|
|
|
|
{
|
|
|
|
case STREAMTYPE_PLAYLIST:
|
|
|
|
break;
|
|
|
|
#ifdef HAVE_VCD
|
|
|
|
case STREAMTYPE_VCD:
|
2003-04-03 12:09:44 +00:00
|
|
|
{
|
|
|
|
char tmp[512];
|
|
|
|
sprintf( tmp,"vcd://%d",guiIntfStruct.Track + 1 );
|
|
|
|
guiSetFilename( guiIntfStruct.Filename,tmp );
|
|
|
|
}
|
2002-12-11 01:21:12 +00:00
|
|
|
break;
|
|
|
|
#endif
|
|
|
|
#ifdef USE_DVDREAD
|
|
|
|
case STREAMTYPE_DVD:
|
2003-04-03 12:09:44 +00:00
|
|
|
{
|
|
|
|
char tmp[512];
|
|
|
|
sprintf( tmp,"dvd://%d",guiIntfStruct.Title );
|
|
|
|
guiSetFilename( guiIntfStruct.Filename,tmp );
|
|
|
|
}
|
2002-12-11 01:21:12 +00:00
|
|
|
dvd_chapter=guiIntfStruct.Chapter;
|
|
|
|
dvd_angle=guiIntfStruct.Angle;
|
|
|
|
break;
|
|
|
|
#endif
|
|
|
|
}
|
2003-02-05 23:02:35 +00:00
|
|
|
//if ( guiIntfStruct.StreamType != STREAMTYPE_PLAYLIST ) // Does not make problems anymore!
|
2002-12-11 01:21:12 +00:00
|
|
|
{
|
|
|
|
if ( guiIntfStruct.Filename ) filename=gstrdup( guiIntfStruct.Filename );
|
|
|
|
else if ( filename ) guiSetFilename( guiIntfStruct.Filename,filename );
|
2002-07-25 20:26:38 +00:00
|
|
|
}
|
2002-08-14 23:02:45 +00:00
|
|
|
// --- video opts
|
2002-08-15 22:52:52 +00:00
|
|
|
|
2002-10-02 13:16:15 +00:00
|
|
|
if ( !video_driver_list )
|
2002-07-25 20:26:38 +00:00
|
|
|
{
|
2002-07-25 21:31:36 +00:00
|
|
|
int i = 0;
|
2002-08-04 19:23:58 +00:00
|
|
|
while ( video_out_drivers[i++] )
|
|
|
|
if ( video_out_drivers[i - 1]->control( VOCTRL_GUISUPPORT,NULL ) == VO_TRUE )
|
|
|
|
{
|
2002-11-11 16:57:09 +00:00
|
|
|
gaddlist( &video_driver_list,(char *)video_out_drivers[i - 1]->info->short_name );
|
2002-08-04 19:23:58 +00:00
|
|
|
break;
|
|
|
|
}
|
2002-07-03 18:57:52 +00:00
|
|
|
}
|
2002-07-25 20:26:38 +00:00
|
|
|
|
2002-10-02 13:16:15 +00:00
|
|
|
if ( !video_driver_list && !video_driver_list[0] ) { gtkMessageBox( GTK_MB_FATAL,MSGTR_IDFGCVD ); exit_player( "gui init" ); }
|
2002-08-14 23:02:45 +00: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 20:26:38 +00:00
|
|
|
{
|
2002-11-11 16:57:09 +00: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-14 23:02:45 +00:00
|
|
|
{ guiIntfStruct.NoWindow=True; break; }
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
#ifdef HAVE_DXR3
|
2002-11-02 16:09:05 +00:00
|
|
|
#ifdef USE_LIBAVCODEC
|
2002-08-14 23:02:45 +00:00
|
|
|
remove_vop( "lavc" );
|
2002-11-02 16:09:05 +00:00
|
|
|
#endif
|
|
|
|
#ifdef USE_LIBFAME
|
2002-08-14 23:02:45 +00:00
|
|
|
remove_vop( "fame" );
|
2002-11-02 16:09:05 +00:00
|
|
|
#endif
|
2002-10-02 13:16:15 +00:00
|
|
|
if ( video_driver_list && !gstrcmp( video_driver_list[0],"dxr3" ) )
|
2002-08-14 23:02:45 +00:00
|
|
|
{
|
|
|
|
if ( ( guiIntfStruct.StreamType != STREAMTYPE_DVD)&&( guiIntfStruct.StreamType != STREAMTYPE_VCD ) )
|
2002-07-25 20:26:38 +00:00
|
|
|
{
|
2002-11-02 16:09:05 +00:00
|
|
|
#ifdef USE_LIBAVCODEC
|
2002-08-14 23:02:45 +00:00
|
|
|
if ( gtkVopLAVC ) add_vop( "lavc" );
|
2002-11-02 16:09:05 +00:00
|
|
|
#endif
|
|
|
|
#ifdef USE_LIBFAME
|
2002-08-14 23:02:45 +00:00
|
|
|
if ( gtkVopFAME ) add_vop( "fame" );
|
2002-11-02 16:09:05 +00:00
|
|
|
#endif
|
2002-07-25 20:26:38 +00:00
|
|
|
}
|
2002-08-14 23:02:45 +00:00
|
|
|
}
|
|
|
|
#endif
|
|
|
|
// ---
|
2002-08-15 22:52:52 +00:00
|
|
|
if ( gtkVopPP ) add_vop( "pp" );
|
|
|
|
else remove_vop( "pp" );
|
2002-07-25 20:26:38 +00:00
|
|
|
|
|
|
|
// --- audio opts
|
2002-10-23 23:13:26 +00:00
|
|
|
// if ( ao_plugin_cfg.plugin_list ) { free( ao_plugin_cfg.plugin_list ); ao_plugin_cfg.plugin_list=NULL; }
|
2004-12-27 19:34:42 +00:00
|
|
|
if (gtkAONorm)
|
|
|
|
greplace(&af_cfg.list, "volnorm", "volnorm");
|
|
|
|
if (gtkEnableAudioEqualizer)
|
|
|
|
greplace(&af_cfg.list, "equalizer", "equalizer");
|
2002-07-25 20:26:38 +00:00
|
|
|
if ( gtkAOExtraStereo )
|
|
|
|
{
|
2004-12-27 19:34:42 +00:00
|
|
|
char *name = malloc(12 + 20 + 1);
|
|
|
|
snprintf(name, 12 + 20, "extrastereo=%f", gtkAOExtraStereoMul);
|
|
|
|
name[12 + 20] = 0;
|
|
|
|
greplace(&af_cfg.list, "extrastereo", name);
|
|
|
|
free(name);
|
2002-07-25 20:26:38 +00:00
|
|
|
}
|
2002-12-28 13:39:51 +00:00
|
|
|
#ifdef USE_OSS_AUDIO
|
2004-07-30 15:58:36 +00:00
|
|
|
if ( audio_driver_list && !gstrncmp( audio_driver_list[0],"oss",3 ) )
|
2002-07-25 20:26:38 +00:00
|
|
|
{
|
2004-07-30 15:58:36 +00:00
|
|
|
char *tmp;
|
|
|
|
mixer_device = gtkAOOSSMixer;
|
|
|
|
mixer_channel = gtkAOOSSMixerChannel;
|
|
|
|
if (gtkAOOSSDevice) {
|
|
|
|
tmp = calloc( 1,strlen( gtkAOOSSDevice ) + 7 );
|
2002-08-15 22:52:52 +00:00
|
|
|
sprintf( tmp,"oss:%s",gtkAOOSSDevice );
|
2004-07-30 15:58:36 +00:00
|
|
|
} else
|
2005-01-31 18:16:39 +00:00
|
|
|
tmp = strdup("oss");
|
2004-07-30 15:58:36 +00:00
|
|
|
gaddlist( &audio_driver_list,tmp );
|
2005-01-31 18:16:39 +00:00
|
|
|
free(tmp);
|
2004-07-30 15:58:36 +00:00
|
|
|
}
|
|
|
|
#endif
|
|
|
|
#if defined(HAVE_ALSA9) || defined (HAVE_ALSA1X)
|
|
|
|
if ( audio_driver_list && !gstrncmp( audio_driver_list[0],"alsa",4 ) )
|
|
|
|
{
|
|
|
|
char *tmp;
|
|
|
|
mixer_device = gtkAOALSAMixer;
|
|
|
|
mixer_channel = gtkAOALSAMixerChannel;
|
|
|
|
if (gtkAOALSADevice) {
|
|
|
|
tmp = calloc( 1,strlen( gtkAOALSADevice ) + 14 );
|
|
|
|
sprintf( tmp,"alsa:device=%s",gtkAOALSADevice );
|
|
|
|
} else
|
2005-01-31 18:16:39 +00:00
|
|
|
tmp = strdup("alsa");
|
2002-10-02 13:16:15 +00:00
|
|
|
gaddlist( &audio_driver_list,tmp );
|
2005-01-31 18:16:39 +00:00
|
|
|
free(tmp);
|
2002-08-15 22:52:52 +00:00
|
|
|
}
|
2002-12-28 14:36:03 +00:00
|
|
|
#endif
|
2003-01-02 12:42:32 +00:00
|
|
|
#ifdef HAVE_SDL
|
2004-07-30 15:58:36 +00:00
|
|
|
if ( audio_driver_list && !gstrncmp( audio_driver_list[0],"sdl",3 ) )
|
2003-01-02 12:42:32 +00:00
|
|
|
{
|
2004-07-30 15:58:36 +00:00
|
|
|
char *tmp;
|
|
|
|
if (gtkAOSDLDriver) {
|
|
|
|
tmp = calloc( 1,strlen( gtkAOSDLDriver ) + 10 );
|
2003-01-02 12:42:32 +00:00
|
|
|
sprintf( tmp,"sdl:%s",gtkAOSDLDriver );
|
2004-07-30 15:58:36 +00:00
|
|
|
} else
|
2005-01-31 18:16:39 +00:00
|
|
|
tmp = strdup("sdl");
|
2003-01-02 12:42:32 +00:00
|
|
|
gaddlist( &audio_driver_list,tmp );
|
2005-01-31 18:16:39 +00:00
|
|
|
free(tmp);
|
2003-01-02 12:42:32 +00:00
|
|
|
}
|
|
|
|
#endif
|
2005-02-12 16:05:11 +00:00
|
|
|
#ifdef USE_ESD
|
|
|
|
if ( audio_driver_list && !gstrncmp( audio_driver_list[0],"esd",3 ) )
|
|
|
|
{
|
|
|
|
char *tmp;
|
|
|
|
if (gtkAOESDDevice) {
|
|
|
|
tmp = calloc( 1,strlen( gtkAOESDDevice ) + 10 );
|
|
|
|
sprintf( tmp,"esd:%s",gtkAOESDDevice );
|
|
|
|
} else
|
|
|
|
tmp = strdup("esd");
|
|
|
|
gaddlist( &audio_driver_list,tmp );
|
|
|
|
free(tmp);
|
|
|
|
}
|
|
|
|
#endif
|
2002-07-25 20:26:38 +00:00
|
|
|
// -- subtitle
|
|
|
|
#ifdef USE_SUB
|
2003-04-07 16:04:02 +00:00
|
|
|
//subdata->filename=gstrdup( guiIntfStruct.Subtitlename );
|
2002-07-25 20:26:38 +00: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 18:57:52 +00:00
|
|
|
#endif
|
2002-07-25 20:26:38 +00:00
|
|
|
|
|
|
|
// --- misc
|
2002-12-11 01:21:12 +00:00
|
|
|
if ( gtkCacheOn ) stream_cache_size=gtkCacheSize;
|
|
|
|
if ( gtkAutoSyncOn ) autosync=gtkAutoSync;
|
|
|
|
|
2002-12-16 22:25:17 +00:00
|
|
|
if ( guiIntfStruct.AudioFile ) audio_stream=gstrdup( guiIntfStruct.AudioFile );
|
|
|
|
else if ( guiIntfStruct.FilenameChanged ) gfree( (void**)&audio_stream );
|
|
|
|
//audio_stream=NULL;
|
2002-07-03 18:57:52 +00:00
|
|
|
|
2002-12-11 01:21:12 +00:00
|
|
|
guiIntfStruct.DiskChanged=0;
|
|
|
|
guiIntfStruct.FilenameChanged=0;
|
|
|
|
guiIntfStruct.NewPlay=0;
|
|
|
|
|
2002-07-03 18:57:52 +00:00
|
|
|
break;
|
2002-02-21 22:48:47 +00:00
|
|
|
}
|
2002-08-14 23:02:45 +00:00
|
|
|
return False;
|
2002-02-21 22:48:47 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void guiEventHandling( void )
|
|
|
|
{
|
2002-08-14 23:02:45 +00:00
|
|
|
if ( !guiIntfStruct.Playing || guiIntfStruct.NoWindow ) wsHandleEvents();
|
2002-02-23 15:12:55 +00:00
|
|
|
gtkEventHandling();
|
2002-02-21 22:48:47 +00:00
|
|
|
}
|
2002-07-03 18:57:52 +00:00
|
|
|
|
|
|
|
// ---
|
|
|
|
|
|
|
|
float gtkEquChannels[6][10];
|
|
|
|
|
2002-07-12 00:53:26 +00:00
|
|
|
plItem * plCurrent = NULL;
|
|
|
|
plItem * plList = NULL;
|
|
|
|
plItem * plLastPlayed = NULL;
|
|
|
|
|
2002-08-26 22:20:58 +00:00
|
|
|
URLItem *URLList = NULL;
|
|
|
|
|
2003-01-21 13:33:40 +00:00
|
|
|
char *fsHistory[fsPersistant_MaxPos] = { NULL,NULL,NULL,NULL,NULL };
|
|
|
|
|
2002-07-12 00:53:26 +00: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 18:57:52 +00:00
|
|
|
{
|
|
|
|
equalizer_t * eq = (equalizer_t *)vparam;
|
2002-07-12 00:53:26 +00:00
|
|
|
plItem * item = (plItem *)vparam;
|
2002-07-03 18:57:52 +00:00
|
|
|
|
2002-08-26 22:20:58 +00:00
|
|
|
URLItem * url_item = (URLItem *)vparam;
|
|
|
|
int is_added = True;
|
|
|
|
|
2002-07-03 18:57:52 +00:00
|
|
|
switch ( cmd )
|
|
|
|
{
|
2002-07-12 00:53:26 +00:00
|
|
|
// --- handle playlist
|
2002-07-19 20:51:48 +00:00
|
|
|
case gtkAddPlItem: // add item to playlist
|
2002-07-12 00:53:26 +00: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-26 22:20:58 +00:00
|
|
|
} else { item->prev=item->next=NULL; plCurrent=plList=item; }
|
2002-07-12 00:53:26 +00:00
|
|
|
list();
|
|
|
|
return NULL;
|
2003-02-05 23:02:35 +00:00
|
|
|
case gtkInsertPlItem: // add item into playlist after current
|
2002-07-12 00:53:26 +00:00
|
|
|
if ( plCurrent )
|
2003-02-05 23:02:35 +00:00
|
|
|
{
|
|
|
|
plItem * curr = plCurrent;
|
|
|
|
item->next=curr->next;
|
|
|
|
if (item->next)
|
|
|
|
item->next->prev=item;
|
|
|
|
item->prev=curr;
|
|
|
|
curr->next=item;
|
|
|
|
plCurrent=plCurrent->next;
|
|
|
|
return plCurrent;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
return gtkSet(gtkAddPlItem,0,(void*)item);
|
|
|
|
return NULL;
|
|
|
|
case gtkGetNextPlItem: // get current item from playlist
|
|
|
|
if ( plCurrent && plCurrent->next)
|
2002-07-12 00:53:26 +00:00
|
|
|
{
|
|
|
|
plCurrent=plCurrent->next;
|
2003-02-05 23:02:35 +00:00
|
|
|
/*if ( !plCurrent && plList )
|
2002-07-12 00:53:26 +00:00
|
|
|
{
|
|
|
|
plItem * next = plList;
|
|
|
|
while ( next->next ) { if ( !next->next ) break; next=next->next; }
|
|
|
|
plCurrent=next;
|
2003-02-05 23:02:35 +00:00
|
|
|
}*/
|
2002-07-12 00:53:26 +00:00
|
|
|
return plCurrent;
|
|
|
|
}
|
|
|
|
return NULL;
|
|
|
|
case gtkGetPrevPlItem:
|
2003-02-05 23:02:35 +00:00
|
|
|
if ( plCurrent && plCurrent->prev)
|
2002-07-12 00:53:26 +00:00
|
|
|
{
|
|
|
|
plCurrent=plCurrent->prev;
|
2003-02-05 23:02:35 +00:00
|
|
|
//if ( !plCurrent && plList ) plCurrent=plList;
|
2002-07-12 00:53:26 +00:00
|
|
|
return plCurrent;
|
|
|
|
}
|
2002-07-25 20:26:38 +00:00
|
|
|
return NULL;
|
2003-02-05 23:02:35 +00:00
|
|
|
case gtkSetCurrPlItem: // set current item
|
|
|
|
plCurrent=item;
|
|
|
|
return plCurrent;
|
2002-07-12 00:53:26 +00:00
|
|
|
case gtkGetCurrPlItem: // get current item
|
|
|
|
return plCurrent;
|
2003-02-05 23:02:35 +00:00
|
|
|
case gtkDelCurrPlItem: // delete current item
|
|
|
|
{
|
|
|
|
plItem * curr = plCurrent;
|
|
|
|
|
|
|
|
if (!curr)
|
|
|
|
return NULL;
|
|
|
|
if (curr->prev)
|
|
|
|
curr->prev->next=curr->next;
|
|
|
|
if (curr->next)
|
|
|
|
curr->next->prev=curr->prev;
|
|
|
|
if (curr==plList)
|
|
|
|
plList=curr->next;
|
|
|
|
plCurrent=curr->next;
|
|
|
|
// Free it
|
|
|
|
if ( curr->path ) free( curr->path );
|
|
|
|
if ( curr->name ) free( curr->name );
|
|
|
|
free( curr );
|
|
|
|
}
|
|
|
|
mplCurr(); // Instead of using mplNext && mplPrev
|
|
|
|
|
|
|
|
return plCurrent;
|
2002-07-12 00:53:26 +00:00
|
|
|
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-26 22:20:58 +00: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 20:26:38 +00:00
|
|
|
// --- subtitle
|
2002-08-29 17:16:34 +00:00
|
|
|
#ifndef HAVE_FREETYPE
|
2002-07-25 20:26:38 +00:00
|
|
|
case gtkSetFontFactor:
|
2002-08-15 22:52:52 +00:00
|
|
|
font_factor=fparam;
|
2002-07-25 20:26:38 +00:00
|
|
|
guiLoadFont();
|
|
|
|
return NULL;
|
2002-08-29 17:16:34 +00: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:
|
2003-01-21 19:12:46 +00:00
|
|
|
gfree( (void **)&subtitle_font_encoding );
|
2002-08-29 17:16:34 +00:00
|
|
|
subtitle_font_encoding=gstrdup( (char *)vparam );
|
|
|
|
guiLoadFont();
|
|
|
|
return NULL;
|
|
|
|
case gtkSetFontAutoScale:
|
|
|
|
subtitle_autoscale=(int)fparam;
|
|
|
|
guiLoadFont();
|
|
|
|
return NULL;
|
|
|
|
#endif
|
2003-01-21 19:12:46 +00:00
|
|
|
#ifdef USE_ICONV
|
|
|
|
case gtkSetSubEncoding:
|
|
|
|
gfree( (void **)&sub_cp );
|
|
|
|
sub_cp=gstrdup( (char *)vparam );
|
|
|
|
break;
|
2002-07-25 20:26:38 +00:00
|
|
|
#endif
|
|
|
|
// --- misc
|
|
|
|
case gtkClearStruct:
|
2002-08-14 23:02:45 +00:00
|
|
|
if ( (unsigned int)vparam & guiFilenames )
|
2002-07-25 20:26:38 +00:00
|
|
|
{
|
|
|
|
gfree( (void **)&guiIntfStruct.Filename );
|
|
|
|
gfree( (void **)&guiIntfStruct.Subtitlename );
|
|
|
|
gfree( (void **)&guiIntfStruct.AudioFile );
|
2002-08-14 23:02:45 +00:00
|
|
|
gtkSet( gtkDelPl,0,NULL );
|
2002-07-25 20:26:38 +00:00
|
|
|
}
|
|
|
|
#ifdef USE_DVDREAD
|
2002-08-14 23:02:45 +00:00
|
|
|
if ( (unsigned int)vparam & guiDVD ) memset( &guiIntfStruct.DVD,0,sizeof( guiDVDStruct ) );
|
2002-07-25 20:26:38 +00:00
|
|
|
#endif
|
|
|
|
#ifdef HAVE_VCD
|
2002-08-14 23:02:45 +00:00
|
|
|
if ( (unsigned int)vparam & guiVCD ) guiIntfStruct.VCDTracks=0;
|
2002-07-25 20:26:38 +00:00
|
|
|
#endif
|
|
|
|
return NULL;
|
|
|
|
case gtkSetExtraStereo:
|
|
|
|
gtkAOExtraStereoMul=fparam;
|
2004-12-27 19:34:42 +00:00
|
|
|
if (guiIntfStruct.afilter)
|
|
|
|
af_control_any_rev(guiIntfStruct.afilter,
|
|
|
|
AF_CONTROL_ES_MUL | AF_CONTROL_SET, >kAOExtraStereoMul);
|
2002-07-25 20:26:38 +00:00
|
|
|
return NULL;
|
|
|
|
case gtkSetPanscan:
|
2002-09-01 11:28:18 +00: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 20:26:38 +00:00
|
|
|
return NULL;
|
|
|
|
case gtkSetAutoq:
|
2002-08-15 22:52:52 +00:00
|
|
|
auto_quality=(int)fparam;
|
2002-07-25 20:26:38 +00:00
|
|
|
return NULL;
|
2002-07-12 00:53:26 +00:00
|
|
|
// --- set equalizers
|
2002-07-03 18:57:52 +00:00
|
|
|
case gtkSetContrast:
|
2002-09-01 11:28:18 +00:00
|
|
|
if ( guiIntfStruct.sh_video ) set_video_colors( guiIntfStruct.sh_video,"contrast",(int)fparam );
|
|
|
|
return NULL;
|
2002-07-03 18:57:52 +00:00
|
|
|
case gtkSetBrightness:
|
2002-09-01 11:28:18 +00:00
|
|
|
if ( guiIntfStruct.sh_video ) set_video_colors( guiIntfStruct.sh_video,"brightness",(int)fparam );
|
|
|
|
return NULL;
|
2002-07-03 18:57:52 +00:00
|
|
|
case gtkSetHue:
|
2002-09-01 11:28:18 +00:00
|
|
|
if ( guiIntfStruct.sh_video ) set_video_colors( guiIntfStruct.sh_video,"hue",(int)fparam );
|
|
|
|
return NULL;
|
2002-07-03 18:57:52 +00:00
|
|
|
case gtkSetSaturation:
|
2002-09-01 11:28:18 +00:00
|
|
|
if ( guiIntfStruct.sh_video ) set_video_colors( guiIntfStruct.sh_video,"saturation",(int)fparam );
|
|
|
|
return NULL;
|
2002-07-03 18:57:52 +00:00
|
|
|
case gtkSetEqualizer:
|
2004-12-27 19:34:42 +00:00
|
|
|
{
|
|
|
|
af_control_ext_t tmp;
|
2002-07-03 18:57:52 +00:00
|
|
|
if ( eq )
|
|
|
|
{
|
|
|
|
gtkEquChannels[eq->channel][eq->band]=eq->gain;
|
2004-12-27 19:34:42 +00:00
|
|
|
tmp.ch = eq->channel;
|
|
|
|
tmp.arg = gtkEquChannels[eq->channel];
|
|
|
|
if (guiIntfStruct.afilter)
|
|
|
|
af_control_any_rev(guiIntfStruct.afilter,
|
|
|
|
AF_CONTROL_EQUALIZER_GAIN | AF_CONTROL_SET, &tmp);
|
2002-07-03 18:57:52 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2004-12-27 19:34:42 +00:00
|
|
|
int i;
|
2002-07-03 18:57:52 +00:00
|
|
|
memset( gtkEquChannels,0,sizeof( gtkEquChannels ) );
|
2004-12-27 19:34:42 +00:00
|
|
|
if (guiIntfStruct.afilter)
|
2002-07-03 18:57:52 +00:00
|
|
|
for ( i=0;i<6;i++ )
|
2004-12-27 19:34:42 +00:00
|
|
|
{
|
|
|
|
tmp.ch = i;
|
|
|
|
tmp.arg = gtkEquChannels[i];
|
|
|
|
af_control_any_rev(guiIntfStruct.afilter,
|
|
|
|
AF_CONTROL_EQUALIZER_GAIN | AF_CONTROL_SET, &tmp);
|
|
|
|
}
|
2002-07-03 18:57:52 +00:00
|
|
|
}
|
2002-07-12 00:53:26 +00:00
|
|
|
return NULL;
|
2004-12-27 19:34:42 +00:00
|
|
|
}
|
2002-07-03 18:57:52 +00:00
|
|
|
}
|
2002-07-12 00:53:26 +00:00
|
|
|
return NULL;
|
2002-07-03 18:57:52 +00:00
|
|
|
}
|
2003-02-05 23:02:35 +00:00
|
|
|
|
|
|
|
#define mp_basename(s) (strrchr(s,'/')==NULL?(char*)s:(strrchr(s,'/')+1))
|
|
|
|
|
|
|
|
#include "../playtree.h"
|
|
|
|
|
|
|
|
//This function adds/inserts one file into the gui playlist
|
|
|
|
|
|
|
|
int import_file_into_gui(char* temp, int insert)
|
|
|
|
{
|
|
|
|
char *filename, *pathname;
|
|
|
|
plItem * item;
|
|
|
|
|
|
|
|
filename = strdup(mp_basename(temp));
|
|
|
|
pathname = strdup(temp);
|
|
|
|
if (strlen(pathname)-strlen(filename)>0)
|
|
|
|
pathname[strlen(pathname)-strlen(filename)-1]='\0'; // We have some path so remove / at end
|
|
|
|
else
|
|
|
|
pathname[strlen(pathname)-strlen(filename)]='\0';
|
|
|
|
mp_msg(MSGT_PLAYTREE,MSGL_V, "Adding filename %s && pathname %s\n",filename,pathname); //FIXME: Change to MSGL_DBG2 ?
|
|
|
|
item=calloc( 1,sizeof( plItem ) );
|
|
|
|
if (!item)
|
|
|
|
return 0;
|
|
|
|
item->name=filename;
|
|
|
|
item->path=pathname;
|
|
|
|
if (insert)
|
|
|
|
gtkSet( gtkInsertPlItem,0,(void*)item ); // Inserts the item after current, and makes current=item
|
|
|
|
else
|
|
|
|
gtkSet( gtkAddPlItem,0,(void*)item );
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// This function imports the initial playtree (based on cmd-line files) into the gui playlist
|
|
|
|
// by either:
|
|
|
|
// - overwriting gui pl (enqueue=0)
|
|
|
|
// - appending it to gui pl (enqueue=1)
|
|
|
|
|
|
|
|
int import_initial_playtree_into_gui(play_tree_t* my_playtree, m_config_t* config, int enqueue)
|
|
|
|
{
|
|
|
|
play_tree_iter_t* my_pt_iter=NULL;
|
|
|
|
int result=0;
|
|
|
|
|
|
|
|
if (!enqueue) // Delete playlist before "appending"
|
|
|
|
gtkSet(gtkDelPl,0,0);
|
|
|
|
|
|
|
|
if((my_pt_iter=pt_iter_create(&my_playtree,config)))
|
|
|
|
{
|
|
|
|
while ((filename=pt_iter_get_next_file(my_pt_iter))!=NULL)
|
|
|
|
{
|
|
|
|
if (import_file_into_gui(filename, 0)) // Add it to end of list
|
|
|
|
result=1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
mplCurr(); // Update filename
|
2003-05-26 08:34:17 +00:00
|
|
|
mplGotoTheNext=1;
|
2003-02-05 23:02:35 +00:00
|
|
|
|
|
|
|
if (!enqueue)
|
|
|
|
filename=guiIntfStruct.Filename; // Backward compatibility; if file is specified on commandline,
|
|
|
|
// gmplayer does directly start in Play-Mode.
|
|
|
|
else
|
|
|
|
filename=NULL;
|
|
|
|
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
|
|
|
|
// This function imports and inserts an playtree, that is created "on the fly", for example by
|
|
|
|
// parsing some MOV-Reference-File; or by loading an playlist with "File Open"
|
|
|
|
//
|
|
|
|
// The file which contained the playlist is thereby replaced with it's contents.
|
|
|
|
|
|
|
|
int import_playtree_playlist_into_gui(play_tree_t* my_playtree, m_config_t* config)
|
|
|
|
{
|
|
|
|
play_tree_iter_t* my_pt_iter=NULL;
|
|
|
|
int result=0;
|
|
|
|
plItem * save=(plItem*)gtkSet( gtkGetCurrPlItem, 0, 0); // Save current item
|
|
|
|
|
|
|
|
if((my_pt_iter=pt_iter_create(&my_playtree,config)))
|
|
|
|
{
|
|
|
|
while ((filename=pt_iter_get_next_file(my_pt_iter))!=NULL)
|
|
|
|
{
|
|
|
|
if (import_file_into_gui(filename, 1)) // insert it into the list and set plCurrent=new item
|
|
|
|
result=1;
|
|
|
|
}
|
|
|
|
pt_iter_destroy(&my_pt_iter);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (save)
|
|
|
|
gtkSet(gtkSetCurrPlItem, 0, (void*)save);
|
|
|
|
else
|
|
|
|
gtkSet(gtkSetCurrPlItem, 0, (void*)plList); // go to head, if plList was empty before
|
|
|
|
|
|
|
|
if (save && result)
|
|
|
|
gtkSet(gtkDelCurrPlItem, 0, 0);
|
|
|
|
|
|
|
|
mplCurr(); // Update filename
|
|
|
|
filename=NULL;
|
|
|
|
|
|
|
|
return result;
|
|
|
|
}
|
2005-09-03 15:19:52 +00:00
|
|
|
|
|
|
|
// wrapper function for mp_msg to display a message box for errors and warnings.
|
|
|
|
|
|
|
|
void guiMessageBox(int level, char * str) {
|
|
|
|
switch(level) {
|
|
|
|
case MSGL_FATAL:
|
|
|
|
gtkMessageBox(GTK_MB_FATAL|GTK_MB_SIMPLE, str);
|
|
|
|
break;
|
|
|
|
case MSGL_ERR:
|
|
|
|
gtkMessageBox(GTK_MB_ERROR|GTK_MB_SIMPLE, str);
|
|
|
|
break;
|
|
|
|
#if 0
|
|
|
|
// WARNING! Do NOT enable this! There are too many non-critical messages with
|
|
|
|
// MSGL_WARN, for example: broken SPU packets, codec's bit error messages,
|
|
|
|
// etc etc, they should not raise up a new window every time.
|
|
|
|
case MSGL_WARN:
|
|
|
|
gtkMessageBox(GTK_MB_WARNING|GTK_MB_SIMPLE, str);
|
|
|
|
break;
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
}
|