2002-02-21 22:48:47 +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-02-21 22:48:47 +00:00
|
|
|
|
|
|
|
#include "ws.h"
|
|
|
|
#include "mplayer/play.h"
|
|
|
|
#include "interface.h"
|
2002-02-23 15:12:55 +00:00
|
|
|
|
2002-02-21 22:48:47 +00:00
|
|
|
#include "../mplayer.h"
|
2002-02-23 15:12:55 +00:00
|
|
|
#include "mplayer/widgets.h"
|
|
|
|
#include "mplayer/mplayer.h"
|
|
|
|
#include "app.h"
|
|
|
|
#include "../libvo/x11_common.h"
|
2002-04-22 21:36:12 +00:00
|
|
|
#include "../libvo/video_out.h"
|
2002-02-25 13:14:27 +00:00
|
|
|
#include "../input/input.h"
|
2002-04-22 21:36:12 +00:00
|
|
|
|
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-02-23 15:12:55 +00:00
|
|
|
|
|
|
|
guiInterface_t guiIntfStruct;
|
|
|
|
|
|
|
|
void guiInit( int argc,char* argv[], char *envp[] )
|
|
|
|
{
|
|
|
|
memset( &guiIntfStruct,0,sizeof( guiIntfStruct ) );
|
|
|
|
appInit( argc,argv,envp,(void*)mDisplay );
|
|
|
|
}
|
|
|
|
|
|
|
|
void guiDone( void )
|
|
|
|
{
|
|
|
|
mp_msg( MSGT_GPLAYER,MSGL_V,"[mplayer] exit.\n" );
|
|
|
|
mplStop();
|
|
|
|
gtkDone();
|
|
|
|
wsXDone();
|
|
|
|
}
|
2002-02-21 22:48:47 +00:00
|
|
|
|
2002-02-25 13:14:27 +00:00
|
|
|
int guiCMDArray[] =
|
|
|
|
{
|
|
|
|
evLoad,
|
|
|
|
evLoadSubtitle,
|
|
|
|
evAbout,
|
|
|
|
evPlay,
|
|
|
|
evStop,
|
|
|
|
evPlayList,
|
|
|
|
evPreferences,
|
|
|
|
evFullScreen,
|
|
|
|
evSkinBrowser
|
|
|
|
};
|
|
|
|
|
2002-04-22 21:36:12 +00:00
|
|
|
typedef struct
|
|
|
|
{
|
|
|
|
demux_stream_t *ds;
|
|
|
|
unsigned int format;
|
|
|
|
struct codecs_st *codec;
|
|
|
|
int inited;
|
|
|
|
// output format:
|
|
|
|
float timer;
|
|
|
|
float fps;
|
|
|
|
float frametime;
|
|
|
|
int i_bps;
|
|
|
|
int disp_w,disp_h;
|
|
|
|
} tmp_sh_video_t;
|
|
|
|
|
2002-02-21 22:48:47 +00:00
|
|
|
void guiGetEvent( int type,char * 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-02-21 22:48:47 +00:00
|
|
|
switch ( type )
|
|
|
|
{
|
|
|
|
case guiXEvent:
|
|
|
|
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 )
|
|
|
|
{
|
|
|
|
case guiSetPlay: guiIntfStruct.Playing=1; mplState(); break;
|
|
|
|
case guiSetStop: guiIntfStruct.Playing=0; mplState(); break;
|
|
|
|
case guiSetPause: guiIntfStruct.Playing=2; mplState(); break;
|
|
|
|
}
|
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;
|
|
|
|
if ( (int)arg ) wsVisibleWindow( &appMPlayer.subWindow,wsHideWindow );
|
|
|
|
else wsVisibleWindow( &appMPlayer.subWindow,wsShowWindow );
|
|
|
|
break;
|
|
|
|
case guiReDrawSubWindow:
|
|
|
|
wsPostRedisplay( &appMPlayer.subWindow );
|
2002-05-03 21:44:11 +00:00
|
|
|
if ( guiIntfStruct.Playing == 1 ) wsSetBackgroundRGB( &appMPlayer.subWindow,0,0,0 );
|
2002-04-22 21:36:12 +00:00
|
|
|
break;
|
|
|
|
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;
|
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-03-15 23:22:36 +00:00
|
|
|
#ifdef HAVE_NEW_INPUT
|
2002-02-25 13:14:27 +00: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-03-15 23:22:36 +00:00
|
|
|
#endif
|
2002-02-21 22:48:47 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void guiEventHandling( void )
|
|
|
|
{
|
2002-04-22 21:36:12 +00:00
|
|
|
if ( ( use_gui && !guiIntfStruct.Playing )||( guiIntfStruct.AudioOnly ) ) wsHandleEvents();
|
2002-02-23 15:12:55 +00:00
|
|
|
gtkEventHandling();
|
|
|
|
mplTimerHandler(); // handle GUI timer events
|
2002-02-21 22:48:47 +00:00
|
|
|
}
|