2001-08-25 21:04:29 +00:00
|
|
|
|
|
|
|
#include <stdlib.h>
|
|
|
|
#include <stdio.h>
|
|
|
|
|
|
|
|
#include <unistd.h>
|
|
|
|
#include <signal.h>
|
|
|
|
|
|
|
|
int mplParent = 1;
|
|
|
|
|
2001-08-30 10:55:17 +00:00
|
|
|
int moviex,moviey,moviewidth,movieheight;
|
2001-08-28 15:55:02 +00:00
|
|
|
|
2001-08-25 21:04:29 +00:00
|
|
|
#include "../app.h"
|
|
|
|
|
|
|
|
#include "../wm/ws.h"
|
|
|
|
#include "../wm/wskeys.h"
|
|
|
|
#include "../wm/widget.h"
|
|
|
|
|
|
|
|
#include "../../config.h"
|
2001-08-27 23:56:44 +00:00
|
|
|
#include "../../libvo/x11_common.h"
|
2001-08-25 21:04:29 +00:00
|
|
|
|
|
|
|
#include "widgets.h"
|
|
|
|
#include "./mplayer.h"
|
|
|
|
#include "psignal.h"
|
|
|
|
#include "play.h"
|
|
|
|
|
2001-08-31 12:59:04 +00:00
|
|
|
#include "../skin/skin.h"
|
|
|
|
#include "../config.h"
|
|
|
|
#include "../error.h"
|
|
|
|
#include "../language.h"
|
|
|
|
|
2001-08-25 21:04:29 +00:00
|
|
|
mplCommStruct * mplShMem;
|
|
|
|
char * Filename = NULL;
|
|
|
|
|
2001-08-27 23:56:44 +00:00
|
|
|
extern float rel_seek_secs;
|
|
|
|
extern int abs_seek_pos;
|
|
|
|
|
2001-08-25 21:04:29 +00:00
|
|
|
void mplFullScreen( void )
|
|
|
|
{
|
2001-08-30 10:55:17 +00:00
|
|
|
// if ( appMPlayer.subWindow.isFullScreen )
|
|
|
|
// {
|
|
|
|
// }
|
|
|
|
wsFullScreen( &appMPlayer.subWindow );
|
2001-08-29 17:48:06 +00:00
|
|
|
mplResize( 0,0,appMPlayer.subWindow.Width,appMPlayer.subWindow.Height );
|
2001-08-25 21:04:29 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
extern int mplSubRender;
|
|
|
|
|
|
|
|
void mplStop()
|
|
|
|
{
|
|
|
|
if ( !mplShMem->Playing ) return;
|
|
|
|
mplShMem->Playing=0;
|
2001-08-31 21:19:52 +00:00
|
|
|
mplShMem->TimeSec=0;
|
2001-08-31 10:30:57 +00:00
|
|
|
if ( !appMPlayer.subWindow.isFullScreen )
|
|
|
|
{
|
|
|
|
wsMoveWindow( &appMPlayer.subWindow,appMPlayer.sub.x,appMPlayer.sub.y );
|
|
|
|
wsResizeWindow( &appMPlayer.subWindow,appMPlayer.sub.width,appMPlayer.sub.height );
|
|
|
|
}
|
2001-08-31 11:26:14 +00:00
|
|
|
mplSubRender=1;
|
|
|
|
wsPostRedisplay( &appMPlayer.subWindow );
|
2001-08-25 21:04:29 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void mplPlay( void )
|
|
|
|
{
|
2001-08-31 21:19:52 +00:00
|
|
|
if ( ( mplShMem->Filename[0] == 0 )||
|
2001-08-31 18:46:45 +00:00
|
|
|
( mplShMem->Playing == 1 ) ) return;
|
|
|
|
if ( mplShMem->Playing == 2 ) { mplPause(); return; }
|
2001-08-25 21:04:29 +00:00
|
|
|
mplShMem->Playing=1;
|
2001-08-31 22:07:53 +00:00
|
|
|
wsClearWindow( appMPlayer.subWindow );
|
2001-08-30 22:07:19 +00:00
|
|
|
mplSubRender=0;
|
2001-08-25 21:04:29 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void mplPause( void )
|
|
|
|
{
|
2001-08-31 18:46:45 +00:00
|
|
|
switch( mplShMem->Playing )
|
|
|
|
{
|
|
|
|
case 1: // playing
|
|
|
|
mplShMem->Playing=2;
|
|
|
|
btnModify( evPlaySwitchToPause,btnReleased );
|
|
|
|
btnModify( evPauseSwitchToPlay,btnDisabled );
|
|
|
|
break;
|
|
|
|
case 2: // paused
|
|
|
|
mplShMem->Playing=1;
|
|
|
|
btnModify( evPlaySwitchToPause,btnDisabled );
|
|
|
|
btnModify( evPauseSwitchToPlay,btnReleased );
|
|
|
|
break;
|
|
|
|
}
|
2001-08-31 22:07:53 +00:00
|
|
|
mplSubRender=0;
|
2001-08-25 21:04:29 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void mplResize( unsigned int X,unsigned int Y,unsigned int width,unsigned int height )
|
|
|
|
{
|
2001-08-31 21:19:52 +00:00
|
|
|
printf( "----resize---> %dx%d --- \n",width,height );
|
2001-08-30 12:17:12 +00:00
|
|
|
vo_setwindowsize( width,height );
|
|
|
|
vo_resize=1;
|
2001-08-25 21:04:29 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void mplMPlayerInit( int argc,char* argv[], char *envp[] )
|
|
|
|
{
|
2001-08-28 15:55:02 +00:00
|
|
|
#if 0
|
2001-08-25 21:04:29 +00:00
|
|
|
mplShMem=shmem_alloc( ShMemSize );
|
2001-08-28 15:55:02 +00:00
|
|
|
#else
|
|
|
|
mplShMem=calloc( 1,ShMemSize );
|
|
|
|
#endif
|
2001-08-25 21:04:29 +00:00
|
|
|
signal( SIGTYPE,mplMainSigHandler );
|
|
|
|
|
2001-08-31 21:19:52 +00:00
|
|
|
memset( mplShMem,0,ShMemSize );
|
2001-08-25 21:04:29 +00:00
|
|
|
mplShMem->Balance=50.0f;
|
|
|
|
}
|
|
|
|
|
|
|
|
float mplGetPosition( void )
|
|
|
|
{ // return 0.0 ... 100.0
|
2001-08-28 15:55:02 +00:00
|
|
|
return mplShMem->Position;
|
2001-08-25 21:04:29 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void mplRelSeek( float s )
|
|
|
|
{ // -+s
|
2001-08-27 23:56:44 +00:00
|
|
|
rel_seek_secs=s; abs_seek_pos=0;
|
2001-08-25 21:04:29 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void mplAbsSeek( float s )
|
|
|
|
{ // 0.0 ... 100.0
|
2001-08-27 23:56:44 +00:00
|
|
|
rel_seek_secs=0.01*s; abs_seek_pos=3;
|
2001-08-25 21:04:29 +00:00
|
|
|
}
|
|
|
|
|
2001-08-31 12:59:04 +00:00
|
|
|
listItems tmpList;
|
|
|
|
|
|
|
|
void ChangeSkin( void )
|
|
|
|
{
|
|
|
|
if ( strcmp( cfgSkin,gtkShMem->sb.name ) )
|
|
|
|
{
|
|
|
|
int ret;
|
|
|
|
#ifdef DEBUG
|
|
|
|
dbprintf( 1,"[psignal] skin: %s\n",gtkShMem->sb.name );
|
|
|
|
#endif
|
|
|
|
|
|
|
|
mainVisible=0;
|
|
|
|
|
|
|
|
appInitStruct( &tmpList );
|
|
|
|
skinAppMPlayer=&tmpList;
|
|
|
|
ret=skinRead( gtkShMem->sb.name );
|
|
|
|
|
|
|
|
appInitStruct( &tmpList );
|
|
|
|
skinAppMPlayer=&appMPlayer;
|
|
|
|
appInitStruct( &appMPlayer );
|
|
|
|
if ( !ret ) strcpy( cfgSkin,gtkShMem->sb.name );
|
|
|
|
skinRead( cfgSkin );
|
|
|
|
|
|
|
|
if ( ret )
|
|
|
|
{
|
|
|
|
mainVisible=1;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
// appCopy( &appMPlayer,&tmpList );
|
|
|
|
// appInitStruct( &tmpList );
|
|
|
|
// skinAppMPlayer=&appMPlayer;
|
|
|
|
// strcpy( cfgSkin,gtkShMem->sb.name );
|
|
|
|
|
|
|
|
if ( mplDrawBuffer ) free( mplDrawBuffer );
|
|
|
|
if ( ( mplDrawBuffer = (unsigned char *)calloc( 1,appMPlayer.main.Bitmap.ImageSize ) ) == NULL )
|
|
|
|
{ message( False,langNEMDB ); return; }
|
|
|
|
wsResizeWindow( &appMPlayer.mainWindow,appMPlayer.main.width,appMPlayer.main.height );
|
|
|
|
wsMoveWindow( &appMPlayer.mainWindow,appMPlayer.main.x,appMPlayer.main.y );
|
|
|
|
wsResizeImage( &appMPlayer.mainWindow );
|
|
|
|
wsSetShape( &appMPlayer.mainWindow,appMPlayer.main.Mask.Image );
|
|
|
|
mainVisible=1; mplMainRender=1; wsPostRedisplay( &appMPlayer.mainWindow );
|
|
|
|
btnModify( evSetVolume,mplShMem->Volume );
|
|
|
|
btnModify( evSetBalance,mplShMem->Balance );
|
|
|
|
btnModify( evSetMoviePosition,mplShMem->Position );
|
|
|
|
|
|
|
|
if ( appMPlayer.menuBase.Bitmap.Image )
|
|
|
|
{
|
|
|
|
if ( mplMenuDrawBuffer ) free( mplMenuDrawBuffer );
|
|
|
|
if ( ( mplMenuDrawBuffer = (unsigned char *)calloc( 1,appMPlayer.menuBase.Bitmap.ImageSize ) ) == NULL )
|
|
|
|
{ message( False,langNEMDB ); return; }
|
|
|
|
wsResizeWindow( &appMPlayer.menuWindow,appMPlayer.menuBase.width,appMPlayer.menuBase.height );
|
|
|
|
wsResizeImage( &appMPlayer.menuWindow );
|
|
|
|
}
|
|
|
|
|
|
|
|
mplSkinChanged=1;
|
|
|
|
if ( !mplShMem->Playing )
|
|
|
|
{
|
|
|
|
mplSkinChanged=0;
|
|
|
|
if ( appMPlayer.subWindow.isFullScreen ) wsFullScreen( &appMPlayer.subWindow );
|
|
|
|
wsResizeWindow( &appMPlayer.subWindow,appMPlayer.sub.width,appMPlayer.sub.height );
|
|
|
|
wsMoveWindow( &appMPlayer.subWindow,appMPlayer.sub.x,appMPlayer.sub.y );
|
|
|
|
if ( appMPlayer.sub.Bitmap.Image ) wsResizeImage( &appMPlayer.subWindow );
|
|
|
|
mplSubRender=1; wsPostRedisplay( &appMPlayer.subWindow );
|
|
|
|
}
|
|
|
|
}
|
2001-08-31 14:16:28 +00:00
|
|
|
mplShMem->SkinChange=0;
|
|
|
|
}
|
|
|
|
|
|
|
|
void EventHandling( void )
|
|
|
|
{
|
|
|
|
wsHandleEvents();mplTimerHandler(0); // handle GUI timer events
|
|
|
|
if ( mplShMem->SkinChange ) ChangeSkin();
|
2001-08-31 12:59:04 +00:00
|
|
|
}
|