2002-01-31 08:39:21 +00:00
|
|
|
#include <inttypes.h>
|
2001-08-25 21:04:29 +00:00
|
|
|
#include <stdlib.h>
|
|
|
|
#include <stdio.h>
|
|
|
|
|
|
|
|
#include <unistd.h>
|
|
|
|
#include <signal.h>
|
|
|
|
|
2002-02-23 15:12:55 +00:00
|
|
|
#include "../wm/ws.h"
|
|
|
|
#include "../../config.h"
|
|
|
|
#include "../../help_mp.h"
|
|
|
|
#include "../../libvo/x11_common.h"
|
2001-08-28 15:55:02 +00:00
|
|
|
|
2001-08-25 21:04:29 +00:00
|
|
|
#include "../app.h"
|
|
|
|
|
|
|
|
#include "../wm/wskeys.h"
|
|
|
|
#include "../wm/widget.h"
|
2002-02-23 15:12:55 +00:00
|
|
|
#include "../interface.h"
|
2001-08-25 21:04:29 +00:00
|
|
|
|
|
|
|
#include "widgets.h"
|
|
|
|
#include "./mplayer.h"
|
|
|
|
#include "play.h"
|
|
|
|
|
2001-08-31 12:59:04 +00:00
|
|
|
#include "../skin/skin.h"
|
2002-02-23 15:12:55 +00:00
|
|
|
#include "../skin/font.h"
|
2001-08-25 21:04:29 +00:00
|
|
|
|
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-10-01 12:28:39 +00:00
|
|
|
static int sx,sy;
|
2001-11-18 19:19:57 +00:00
|
|
|
|
2002-03-10 23:20:01 +00:00
|
|
|
// if ( !guiIntfStruct.Playing )
|
2001-10-01 12:28:39 +00:00
|
|
|
{
|
2002-03-07 17:50:25 +00:00
|
|
|
wsVisibleWindow( &appMPlayer.subWindow,wsHideWindow );
|
|
|
|
if ( appMPlayer.subWindow.isFullScreen )
|
|
|
|
{
|
|
|
|
wsResizeWindow( &appMPlayer.subWindow,sx,sy );
|
|
|
|
wsMoveWindow( &appMPlayer.subWindow,True,appMPlayer.sub.x,appMPlayer.sub.y );
|
|
|
|
wsWindowDecoration( &appMPlayer.subWindow,appMPlayer.subWindow.Decorations );
|
|
|
|
appMPlayer.subWindow.isFullScreen=0;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
sx=appMPlayer.subWindow.Width; sy=appMPlayer.subWindow.Height;
|
|
|
|
wsResizeWindow( &appMPlayer.subWindow,wsMaxX,wsMaxY );
|
|
|
|
wsMoveWindow( &appMPlayer.subWindow,True,0,0 );
|
|
|
|
wsWindowDecoration( &appMPlayer.subWindow,0 );
|
|
|
|
appMPlayer.subWindow.isFullScreen=1;
|
|
|
|
}
|
2002-03-10 23:20:01 +00:00
|
|
|
vo_fs=appMPlayer.subWindow.isFullScreen;
|
2002-03-07 17:50:25 +00:00
|
|
|
wsVisibleWindow( &appMPlayer.subWindow,wsShowWindow );
|
2002-03-10 23:20:01 +00:00
|
|
|
}// else { vo_x11_fullscreen(); appMPlayer.subWindow.isFullScreen=vo_fs; }
|
2002-03-07 17:50:25 +00:00
|
|
|
|
|
|
|
fullscreen=appMPlayer.subWindow.isFullScreen;
|
2002-02-23 15:12:55 +00:00
|
|
|
if ( guiIntfStruct.Playing ) wsSetBackgroundRGB( &appMPlayer.subWindow,0,0,0 );
|
2001-10-02 15:01:56 +00:00
|
|
|
else wsSetBackgroundRGB( &appMPlayer.subWindow,appMPlayer.subR,appMPlayer.subG,appMPlayer.subB );
|
2001-08-25 21:04:29 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
extern int mplSubRender;
|
|
|
|
|
|
|
|
void mplStop()
|
|
|
|
{
|
2002-02-23 15:12:55 +00:00
|
|
|
guiIntfStruct.Playing=0;
|
|
|
|
guiIntfStruct.TimeSec=0;
|
|
|
|
guiIntfStruct.Position=0;
|
|
|
|
guiIntfStruct.AudioType=0;
|
|
|
|
// if ( !guiIntfStruct.Playing ) return;
|
2001-08-31 10:30:57 +00:00
|
|
|
if ( !appMPlayer.subWindow.isFullScreen )
|
|
|
|
{
|
|
|
|
wsResizeWindow( &appMPlayer.subWindow,appMPlayer.sub.width,appMPlayer.sub.height );
|
2001-11-12 15:16:13 +00:00
|
|
|
wsMoveWindow( &appMPlayer.subWindow,True,appMPlayer.sub.x,appMPlayer.sub.y );
|
2001-08-31 10:30:57 +00:00
|
|
|
}
|
2002-03-06 23:54:20 +00:00
|
|
|
guiGetEvent( guiCEvent,guiSetStop );
|
2001-08-31 11:26:14 +00:00
|
|
|
mplSubRender=1;
|
2001-09-25 15:13:58 +00:00
|
|
|
wsSetBackgroundRGB( &appMPlayer.subWindow,appMPlayer.subR,appMPlayer.subG,appMPlayer.subB );
|
2001-10-02 15:01:56 +00:00
|
|
|
wsClearWindow( appMPlayer.subWindow );
|
2001-08-31 11:26:14 +00:00
|
|
|
wsPostRedisplay( &appMPlayer.subWindow );
|
2001-08-25 21:04:29 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void mplPlay( void )
|
|
|
|
{
|
2002-02-23 15:12:55 +00:00
|
|
|
if ( ( !guiIntfStruct.Filename )||
|
|
|
|
( guiIntfStruct.Filename[0] == 0 )||
|
|
|
|
( guiIntfStruct.Playing == 1 ) ) return;
|
|
|
|
if ( guiIntfStruct.Playing == 2 ) { mplPause(); return; }
|
2002-03-06 23:54:20 +00:00
|
|
|
guiGetEvent( guiCEvent,guiSetPlay );
|
2001-08-30 22:07:19 +00:00
|
|
|
mplSubRender=0;
|
2001-09-05 18:17:22 +00:00
|
|
|
wsSetBackgroundRGB( &appMPlayer.subWindow,0,0,0 );
|
2002-02-23 15:12:55 +00:00
|
|
|
wsClearWindow( appMPlayer.subWindow );
|
2002-03-06 23:54:20 +00:00
|
|
|
// wsPostRedisplay( &appMPlayer.subWindow );
|
2001-08-25 21:04:29 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void mplPause( void )
|
|
|
|
{
|
2002-02-23 15:12:55 +00:00
|
|
|
switch( guiIntfStruct.Playing )
|
2001-08-31 18:46:45 +00:00
|
|
|
{
|
|
|
|
case 1: // playing
|
2002-02-23 15:12:55 +00:00
|
|
|
guiIntfStruct.Playing=2;
|
|
|
|
break;
|
2002-02-01 16:34:22 +00:00
|
|
|
case 2: // paused
|
2002-02-23 15:12:55 +00:00
|
|
|
guiIntfStruct.Playing=1;
|
|
|
|
break;
|
2001-08-31 18:46:45 +00:00
|
|
|
}
|
2002-02-01 16:34:22 +00:00
|
|
|
mplState();
|
2001-08-31 22:07:53 +00:00
|
|
|
mplSubRender=0;
|
2001-08-25 21:04:29 +00:00
|
|
|
}
|
|
|
|
|
2002-02-01 16:34:22 +00:00
|
|
|
void mplState( void )
|
|
|
|
{
|
2002-02-23 15:12:55 +00:00
|
|
|
if ( ( guiIntfStruct.Playing == 0 )||( guiIntfStruct.Playing == 2 ) )
|
2002-02-01 16:34:22 +00:00
|
|
|
{
|
|
|
|
btnModify( evPlaySwitchToPause,btnReleased );
|
|
|
|
btnModify( evPauseSwitchToPlay,btnDisabled );
|
|
|
|
}
|
2002-02-23 15:12:55 +00:00
|
|
|
else
|
2002-02-01 16:34:22 +00:00
|
|
|
{
|
|
|
|
btnModify( evPlaySwitchToPause,btnDisabled );
|
|
|
|
btnModify( evPauseSwitchToPlay,btnReleased );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2001-08-25 21:04:29 +00:00
|
|
|
void mplMPlayerInit( int argc,char* argv[], char *envp[] )
|
|
|
|
{
|
2002-02-23 15:12:55 +00:00
|
|
|
guiIntfStruct.Balance=50.0f;
|
|
|
|
guiIntfStruct.StreamType=-1;
|
2001-08-25 21:04:29 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
float mplGetPosition( void )
|
|
|
|
{ // return 0.0 ... 100.0
|
2002-02-23 15:12:55 +00:00
|
|
|
return guiIntfStruct.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;
|
|
|
|
|
2002-02-23 15:12:55 +00:00
|
|
|
void ChangeSkin( char * name )
|
2001-08-31 12:59:04 +00:00
|
|
|
{
|
2001-09-17 21:16:00 +00:00
|
|
|
int ret;
|
2002-02-23 15:12:55 +00:00
|
|
|
// if ( !strcmp( skinName,name ) ) return;
|
2001-09-17 21:16:00 +00:00
|
|
|
mainVisible=0;
|
2001-08-31 12:59:04 +00:00
|
|
|
|
2001-09-17 21:16:00 +00:00
|
|
|
appInitStruct( &tmpList );
|
|
|
|
skinAppMPlayer=&tmpList;
|
|
|
|
fntFreeFont();
|
2002-02-23 15:12:55 +00:00
|
|
|
ret=skinRead( name );
|
2001-08-31 12:59:04 +00:00
|
|
|
|
2001-09-17 21:16:00 +00:00
|
|
|
appInitStruct( &tmpList );
|
|
|
|
skinAppMPlayer=&appMPlayer;
|
|
|
|
appInitStruct( &appMPlayer );
|
2002-02-23 15:12:55 +00:00
|
|
|
if ( ret ) name=skinName;
|
|
|
|
if ( skinRead( name ) )
|
2001-09-17 21:16:00 +00:00
|
|
|
{
|
|
|
|
mainVisible=1;
|
|
|
|
return;
|
|
|
|
}
|
2001-09-01 19:57:44 +00:00
|
|
|
|
2001-09-17 21:16:00 +00:00
|
|
|
if ( appMPlayer.menuBase.Bitmap.Image )
|
|
|
|
{
|
|
|
|
if ( mplMenuDrawBuffer ) free( mplMenuDrawBuffer );
|
|
|
|
if ( ( mplMenuDrawBuffer = (unsigned char *)calloc( 1,appMPlayer.menuBase.Bitmap.ImageSize ) ) == NULL )
|
2002-02-23 15:12:55 +00:00
|
|
|
{ mp_msg( MSGT_GPLAYER,MSGL_STATUS,MSGTR_NEMDB ); return; }
|
2001-09-17 21:16:00 +00:00
|
|
|
wsResizeWindow( &appMPlayer.menuWindow,appMPlayer.menuBase.width,appMPlayer.menuBase.height );
|
|
|
|
wsResizeImage( &appMPlayer.menuWindow,appMPlayer.menuBase.width,appMPlayer.menuBase.height );
|
|
|
|
}
|
2001-08-31 12:59:04 +00:00
|
|
|
|
2001-10-16 21:23:59 +00:00
|
|
|
if ( appMPlayer.sub.Bitmap.Image ) wsResizeImage( &appMPlayer.subWindow,appMPlayer.sub.Bitmap.Width,appMPlayer.sub.Bitmap.Height );
|
2002-02-23 15:12:55 +00:00
|
|
|
if ( ( !appMPlayer.subWindow.isFullScreen )&&( !guiIntfStruct.Playing ) )
|
2001-10-16 21:23:59 +00:00
|
|
|
{
|
|
|
|
wsResizeWindow( &appMPlayer.subWindow,appMPlayer.sub.width,appMPlayer.sub.height );
|
2001-11-12 15:16:13 +00:00
|
|
|
wsMoveWindow( &appMPlayer.subWindow,True,appMPlayer.sub.x,appMPlayer.sub.y );
|
2002-02-23 15:12:55 +00:00
|
|
|
}
|
2001-10-16 21:23:59 +00:00
|
|
|
if ( appMPlayer.sub.Bitmap.Image ) wsConvert( &appMPlayer.subWindow,appMPlayer.sub.Bitmap.Image,appMPlayer.sub.Bitmap.ImageSize );
|
2002-02-23 15:12:55 +00:00
|
|
|
if ( !guiIntfStruct.Playing )
|
2001-10-16 21:23:59 +00:00
|
|
|
{
|
2002-02-23 15:12:55 +00:00
|
|
|
mplSubRender=1;
|
2001-11-14 23:47:08 +00:00
|
|
|
wsSetBackgroundRGB( &appMPlayer.subWindow,appMPlayer.subR,appMPlayer.subG,appMPlayer.subB );
|
2001-10-16 21:23:59 +00:00
|
|
|
wsClearWindow( appMPlayer.subWindow );
|
|
|
|
wsPostRedisplay( &appMPlayer.subWindow );
|
|
|
|
}
|
2001-08-31 12:59:04 +00:00
|
|
|
|
2001-09-17 21:16:00 +00:00
|
|
|
if ( mplDrawBuffer ) free( mplDrawBuffer );
|
|
|
|
if ( ( mplDrawBuffer = (unsigned char *)calloc( 1,appMPlayer.main.Bitmap.ImageSize ) ) == NULL )
|
2002-02-23 15:12:55 +00:00
|
|
|
{ mp_msg( MSGT_GPLAYER,MSGL_STATUS,MSGTR_NEMDB ); return; }
|
2001-09-17 21:16:00 +00:00
|
|
|
wsVisibleWindow( &appMPlayer.mainWindow,wsHideWindow );
|
|
|
|
wsResizeWindow( &appMPlayer.mainWindow,appMPlayer.main.width,appMPlayer.main.height );
|
2001-11-12 15:16:13 +00:00
|
|
|
wsMoveWindow( &appMPlayer.mainWindow,True,appMPlayer.main.x,appMPlayer.main.y );
|
2001-09-17 21:16:00 +00:00
|
|
|
wsResizeImage( &appMPlayer.mainWindow,appMPlayer.main.width,appMPlayer.main.height );
|
|
|
|
wsSetShape( &appMPlayer.mainWindow,appMPlayer.main.Mask.Image );
|
|
|
|
wsWindowDecoration( &appMPlayer.mainWindow,appMPlayer.mainDecoration );
|
2001-11-18 19:19:57 +00:00
|
|
|
mainVisible=1; mplMainRender=1; wsPostRedisplay( &appMPlayer.mainWindow );
|
2001-09-17 21:16:00 +00:00
|
|
|
wsVisibleWindow( &appMPlayer.mainWindow,wsShowWindow );
|
2002-02-23 15:12:55 +00:00
|
|
|
|
|
|
|
btnModify( evSetVolume,guiIntfStruct.Volume );
|
|
|
|
btnModify( evSetBalance,guiIntfStruct.Balance );
|
|
|
|
btnModify( evSetMoviePosition,guiIntfStruct.Position );
|
2001-12-13 00:25:08 +00:00
|
|
|
btnModify( evFullScreen,!appMPlayer.subWindow.isFullScreen );
|
2001-08-31 14:16:28 +00:00
|
|
|
}
|
|
|
|
|
2001-09-25 14:00:19 +00:00
|
|
|
void mplResizeToMovieSize( unsigned int width,unsigned int height )
|
|
|
|
{
|
|
|
|
if ( !appMPlayer.subWindow.isFullScreen )
|
2001-10-01 09:30:46 +00:00
|
|
|
{
|
2001-09-25 14:00:19 +00:00
|
|
|
wsResizeWindow( &appMPlayer.subWindow,width,height );
|
2001-11-12 15:16:13 +00:00
|
|
|
wsMoveWindow( &appMPlayer.subWindow,True,appMPlayer.sub.x,appMPlayer.sub.y );
|
2002-02-23 15:12:55 +00:00
|
|
|
}
|
2001-09-25 14:00:19 +00:00
|
|
|
}
|
2001-11-12 15:16:13 +00:00
|
|
|
|
|
|
|
void mplSetFileName( char * fname )
|
|
|
|
{
|
2002-02-23 15:12:55 +00:00
|
|
|
if ( !fname ) return;
|
|
|
|
if ( guiIntfStruct.Filename ) free( guiIntfStruct.Filename );
|
|
|
|
guiIntfStruct.Filename=strdup( fname );
|
2001-11-12 15:16:13 +00:00
|
|
|
}
|