Mercurial > mplayer.hg
changeset 4818:3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
author | pontscho |
---|---|
date | Sat, 23 Feb 2002 15:12:55 +0000 |
parents | 1e46f40dcd0e |
children | d8ab591ecf84 |
files | Gui/app.c Gui/bitmap.c Gui/bitmap.h Gui/bitmap/bitmap.c Gui/bitmap/bitmap.h Gui/bitmap/bmp/bmp.c Gui/bitmap/png/png.c Gui/bitmap/tga/tga.c Gui/error.c Gui/error.h Gui/events.h Gui/gui.mak Gui/interface.c Gui/interface.h Gui/language.c Gui/language.h Gui/mplayer/gtk/about.c Gui/mplayer/gtk/fs.c Gui/mplayer/gtk/mb.c Gui/mplayer/gtk/menu.c Gui/mplayer/gtk/opts.c Gui/mplayer/gtk/pl.c Gui/mplayer/gtk/sb.c Gui/mplayer/menu.h Gui/mplayer/mplayer.c Gui/mplayer/mplayer.h Gui/mplayer/mw.h Gui/mplayer/play.c Gui/mplayer/play.h Gui/mplayer/psignal.c Gui/mplayer/psignal.h Gui/mplayer/sw.h Gui/mplayer/widgets.c Gui/mplayer/widgets.h Gui/skin/font.c Gui/skin/skin.c Gui/timer.c Gui/timer.h Gui/wm/ws.c Gui/wm/ws.h Gui/wm/wsconv.c Gui/wm/wsconv.h mp_msg.h mplayer.c mplayer.h |
diffstat | 45 files changed, 737 insertions(+), 1420 deletions(-) [+] |
line wrap: on
line diff
--- a/Gui/app.c Sat Feb 23 07:40:25 2002 +0000 +++ b/Gui/app.c Sat Feb 23 15:12:55 2002 +0000 @@ -8,7 +8,6 @@ #include "../help_mp.h" #include "app.h" -#include "error.h" #include "wm/wskeys.h" #include "skin/skin.h" #include "mplayer/mplayer.h" @@ -106,10 +105,9 @@ printf("SKIN dir 2: '%s'\n",skinMPlayerDir); if ( !skinName ) { - if ( ( skinName=(char *)calloc( 1,7 ) ) == NULL ) { dbprintf( 0,"[config] Not enough memory.\n" ); exit( 1 ); } + if ( ( skinName=(char *)calloc( 1,7 ) ) == NULL ) { mp_msg( MSGT_GPLAYER,MSGL_STATUS,"[config] Not enough memory.\n" ); exit( 1 ); } strcpy( skinName,"default" ); } - initDebug(NULL); // write messages to stderr switch ( skinRead( skinName ) ) { case -1: mp_msg( MSGT_GPLAYER,MSGL_ERR,MSGTR_SKIN_SKINCFG_SkinNotFound,skinName ); exit( 0 );
--- a/Gui/bitmap.c Sat Feb 23 07:40:25 2002 +0000 +++ b/Gui/bitmap.c Sat Feb 23 15:12:55 2002 +0000 @@ -4,7 +4,6 @@ #include <string.h> #include "bitmap.h" -#include "../error.h" #define BMP 1 #define TGA 2 @@ -25,13 +24,11 @@ bf->BPP=32; if ( ( bf->Image=malloc( bf->ImageSize ) ) == NULL ) { - #ifdef DEBUG - dbprintf( 4,"[bitmap] Not enough memory for image.\n" ); - #endif + mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"[bitmap] Not enough memory for image.\n" ); return 1; } memset( bf->Image,0,bf->ImageSize ); - for ( c=0,i=0;i < bf->Width * bf->Height * 3; ) + for ( c=0,i=0;i < (int)(bf->Width * bf->Height * 3); ) { bf->Image[c++]=tmpImage[i++]; bf->Image[c++]=tmpImage[i++]; @@ -47,7 +44,7 @@ unsigned char c; int i; - for ( i=0;i < bf->ImageSize;i+=4 ) + for ( i=0;i < (int)bf->ImageSize;i+=4 ) { c=bf->Image[i]; bf->Image[i]=bf->Image[i+2]; @@ -58,8 +55,7 @@ void Normalize( txSample * bf ) { int i; - - for ( i=0;i < bf->ImageSize;i+=4 ) bf->Image[i+3]=0; + for ( i=0;i < (int)bf->ImageSize;i+=4 ) bf->Image[i+3]=0; } unsigned char tmp[512]; @@ -149,23 +145,17 @@ bgr=1; break; case TGAPACKED: - #ifdef DEBUG - dbprintf( 4,"[bitmap] sorry, packed TGA not supported.\n" ); - #endif + mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"[bitmap] sorry, packed TGA not supported.\n" ); return -6; default: { - #ifdef DEBUG - dbprintf( 4,"[bitmap] Unknown file type ( %s ).\n",fname ); - #endif + mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"[bitmap] Unknown file type ( %s ).\n",fname ); return -7; } } if ( bf->BPP < 24 ) { - #ifdef DEBUG - dbprintf( 4,"[bitmap] sorry, 16 or less bitmaps not supported.\n" ); - #endif + mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"[bitmap] sorry, 16 or less bitmaps not supported.\n" ); return -1; } if ( conv24to32( bf ) ) return -8; @@ -180,15 +170,15 @@ out->Height=in->Height; out->BPP=1; out->ImageSize=out->Width * out->Height / 8; - dbprintf( 4,"[c1to32] imagesize: %d\n",out->ImageSize ); + mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"[c1to32] imagesize: %d\n",out->ImageSize ); out->Image=(char *)calloc( 1,out->ImageSize ); - if ( out->Image == NULL ) dbprintf( 4,"nem van ram baze\n" ); + if ( out->Image == NULL ) mp_msg( MSGT_GPLAYER,MSGL_STATUS,"nem van ram baze\n" ); { int i,b,c=0; unsigned long * buf = NULL; unsigned char tmp = 0; int nothaveshape = 1; buf=(unsigned long *)in->Image; - for ( b=0,i=0;i < out->Width * out->Height;i++ ) + for ( b=0,i=0;i < (int)(out->Width * out->Height);i++ ) { - if ( buf[i] != adaptivlimit ) tmp=( tmp >> 1 )|128; + if ( (int)buf[i] != adaptivlimit ) tmp=( tmp >> 1 )|128; else { tmp=tmp >> 1; buf[i]=nothaveshape=0; } if ( b++ == 7 ) { out->Image[c++]=tmp; tmp=b=0; } } @@ -205,12 +195,12 @@ out->BPP=32; out->ImageSize=out->Width * out->Height * 4; out->Image=(char *)calloc( 1,out->ImageSize ); - dbprintf( 4,"[c32to1] imagesize: %d\n",out->ImageSize ); - if ( out->Image == NULL ) dbprintf( 4,"nem van ram baze\n" ); + mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"[c32to1] imagesize: %d\n",out->ImageSize ); + if ( (int)out->Image == NULL ) mp_msg( MSGT_GPLAYER,MSGL_STATUS,"nem van ram baze\n" ); { int i,b,c=0; unsigned long * buf = NULL; unsigned char tmp = 0; buf=(unsigned long *)out->Image; - for ( c=0,i=0;i < in->Width * in->Height / 8;i++ ) + for ( c=0,i=0;i < (int)(in->Width * in->Height / 8);i++ ) { tmp=in->Image[i]; for ( b=0;b<8;b++ )
--- a/Gui/bitmap.h Sat Feb 23 07:40:25 2002 +0000 +++ b/Gui/bitmap.h Sat Feb 23 15:12:55 2002 +0000 @@ -14,6 +14,7 @@ #include "tga/tga.h" #include "bmp/bmp.h" #include "png/png.h" +#include "../../mp_msg.h" extern int bpRead( char * fname, txSample * bf ); extern int conv24to32( txSample * bf );
--- a/Gui/bitmap/bitmap.c Sat Feb 23 07:40:25 2002 +0000 +++ b/Gui/bitmap/bitmap.c Sat Feb 23 15:12:55 2002 +0000 @@ -4,7 +4,6 @@ #include <string.h> #include "bitmap.h" -#include "../error.h" #define BMP 1 #define TGA 2 @@ -25,13 +24,11 @@ bf->BPP=32; if ( ( bf->Image=malloc( bf->ImageSize ) ) == NULL ) { - #ifdef DEBUG - dbprintf( 4,"[bitmap] Not enough memory for image.\n" ); - #endif + mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"[bitmap] Not enough memory for image.\n" ); return 1; } memset( bf->Image,0,bf->ImageSize ); - for ( c=0,i=0;i < bf->Width * bf->Height * 3; ) + for ( c=0,i=0;i < (int)(bf->Width * bf->Height * 3); ) { bf->Image[c++]=tmpImage[i++]; bf->Image[c++]=tmpImage[i++]; @@ -47,7 +44,7 @@ unsigned char c; int i; - for ( i=0;i < bf->ImageSize;i+=4 ) + for ( i=0;i < (int)bf->ImageSize;i+=4 ) { c=bf->Image[i]; bf->Image[i]=bf->Image[i+2]; @@ -58,8 +55,7 @@ void Normalize( txSample * bf ) { int i; - - for ( i=0;i < bf->ImageSize;i+=4 ) bf->Image[i+3]=0; + for ( i=0;i < (int)bf->ImageSize;i+=4 ) bf->Image[i+3]=0; } unsigned char tmp[512]; @@ -149,23 +145,17 @@ bgr=1; break; case TGAPACKED: - #ifdef DEBUG - dbprintf( 4,"[bitmap] sorry, packed TGA not supported.\n" ); - #endif + mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"[bitmap] sorry, packed TGA not supported.\n" ); return -6; default: { - #ifdef DEBUG - dbprintf( 4,"[bitmap] Unknown file type ( %s ).\n",fname ); - #endif + mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"[bitmap] Unknown file type ( %s ).\n",fname ); return -7; } } if ( bf->BPP < 24 ) { - #ifdef DEBUG - dbprintf( 4,"[bitmap] sorry, 16 or less bitmaps not supported.\n" ); - #endif + mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"[bitmap] sorry, 16 or less bitmaps not supported.\n" ); return -1; } if ( conv24to32( bf ) ) return -8; @@ -180,15 +170,15 @@ out->Height=in->Height; out->BPP=1; out->ImageSize=out->Width * out->Height / 8; - dbprintf( 4,"[c1to32] imagesize: %d\n",out->ImageSize ); + mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"[c1to32] imagesize: %d\n",out->ImageSize ); out->Image=(char *)calloc( 1,out->ImageSize ); - if ( out->Image == NULL ) dbprintf( 4,"nem van ram baze\n" ); + if ( out->Image == NULL ) mp_msg( MSGT_GPLAYER,MSGL_STATUS,"nem van ram baze\n" ); { int i,b,c=0; unsigned long * buf = NULL; unsigned char tmp = 0; int nothaveshape = 1; buf=(unsigned long *)in->Image; - for ( b=0,i=0;i < out->Width * out->Height;i++ ) + for ( b=0,i=0;i < (int)(out->Width * out->Height);i++ ) { - if ( buf[i] != adaptivlimit ) tmp=( tmp >> 1 )|128; + if ( (int)buf[i] != adaptivlimit ) tmp=( tmp >> 1 )|128; else { tmp=tmp >> 1; buf[i]=nothaveshape=0; } if ( b++ == 7 ) { out->Image[c++]=tmp; tmp=b=0; } } @@ -205,12 +195,12 @@ out->BPP=32; out->ImageSize=out->Width * out->Height * 4; out->Image=(char *)calloc( 1,out->ImageSize ); - dbprintf( 4,"[c32to1] imagesize: %d\n",out->ImageSize ); - if ( out->Image == NULL ) dbprintf( 4,"nem van ram baze\n" ); + mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"[c32to1] imagesize: %d\n",out->ImageSize ); + if ( (int)out->Image == NULL ) mp_msg( MSGT_GPLAYER,MSGL_STATUS,"nem van ram baze\n" ); { int i,b,c=0; unsigned long * buf = NULL; unsigned char tmp = 0; buf=(unsigned long *)out->Image; - for ( c=0,i=0;i < in->Width * in->Height / 8;i++ ) + for ( c=0,i=0;i < (int)(in->Width * in->Height / 8);i++ ) { tmp=in->Image[i]; for ( b=0;b<8;b++ )
--- a/Gui/bitmap/bitmap.h Sat Feb 23 07:40:25 2002 +0000 +++ b/Gui/bitmap/bitmap.h Sat Feb 23 15:12:55 2002 +0000 @@ -14,6 +14,7 @@ #include "tga/tga.h" #include "bmp/bmp.h" #include "png/png.h" +#include "../../mp_msg.h" extern int bpRead( char * fname, txSample * bf ); extern int conv24to32( txSample * bf );
--- a/Gui/bitmap/bmp/bmp.c Sat Feb 23 07:40:25 2002 +0000 +++ b/Gui/bitmap/bmp/bmp.c Sat Feb 23 15:12:55 2002 +0000 @@ -27,7 +27,6 @@ #include "bmp.h" #include "../bitmap.h" -#include "../../error.h" int bmpRead( unsigned char * fname,txSample * bF ) { @@ -40,16 +39,12 @@ if ( (BMP=fopen( fname,"rt" )) == NULL ) { -#ifdef DEBUG - dbprintf( 4,"[bmp] File not found ( %s ).\n",fname ); -#endif + mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"[bmp] File not found ( %s ).\n",fname ); return 1; } if ( (i=fread( bmpHeader,54,1,BMP )) != 1 ) { -#ifdef DEBUG - dbprintf( 4,"[bmp] Header read error ( %s ).\n",fname ); -#endif + mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"[bmp] Header read error ( %s ).\n",fname ); return 2; } // memcpy( &bF->Size,&bmpHeader[2],4 ); @@ -61,31 +56,23 @@ if ( bF->BPP < 24 ) { - #ifdef DEBUG - dbprintf( 4,"[bmp] Sorry, this loader not supported 16 bit or less ...\n" ); - #endif + mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"[bmp] Sorry, this loader not supported 16 bit or less ...\n" ); return 3; } -#ifdef DEBUG - dbprintf( 4,"[bmp] filename: %s\n",fname ); - dbprintf( 4,"[bmp] size: %dx%d bits: %d\n",bF->Width,bF->Height,bF->BPP ); - dbprintf( 4,"[bmp] imagesize: %lu\n",bF->ImageSize ); -#endif + mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"[bmp] filename: %s\n",fname ); + mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"[bmp] size: %dx%d bits: %d\n",bF->Width,bF->Height,bF->BPP ); + mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"[bmp] imagesize: %lu\n",bF->ImageSize ); if ( ( bF->Image=malloc( bF->ImageSize ) ) == NULL ) { - #ifdef DEBUG - dbprintf( 4,"[bmp] Not enough memory for image buffer.\n" ); - #endif + mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"[bmp] Not enough memory for image buffer.\n" ); return 4; } if ( (i=fread( bF->Image,bF->ImageSize,1,BMP )) != 1 ) { - #ifdef DEBUG - dbprintf( 4,"[bmp] Image read error.\n" ); - #endif + mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"[bmp] Image read error.\n" ); return 5; } @@ -94,9 +81,7 @@ linesize=bF->Width * ( bF->BPP / 8 ); if ( (line=malloc( linesize )) == NULL ) { - #ifdef DEBUG - dbprintf( 4,"[bmp] Not enough memory for flipping.\n" ); - #endif + mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"[bmp] Not enough memory for flipping.\n" ); return 6; }
--- a/Gui/bitmap/png/png.c Sat Feb 23 07:40:25 2002 +0000 +++ b/Gui/bitmap/png/png.c Sat Feb 23 15:12:55 2002 +0000 @@ -2,7 +2,6 @@ #include <stdlib.h> #include "./png.h" -#include "../../error.h" #include <png.h> typedef struct @@ -106,9 +105,7 @@ if ( pngLoadRaw( fname,&raw ) ) { - #ifdef DEBUG - dbprintf( 4,"[png] file read error ( %s ).\n",fname ); - #endif + mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"[png] file read error ( %s ).\n",fname ); return 1; } bf->Width=raw.Width; @@ -117,17 +114,13 @@ bf->ImageSize=bf->Width * bf->Height * ( bf->BPP / 8 ); if ( ( bf->Image=malloc( bf->ImageSize ) ) == NULL ) { - #ifdef DEBUG - dbprintf( 4,"[png] Not enough memory for image buffer.\n" ); - #endif + mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"[png] Not enough memory for image buffer.\n" ); return 2; } memcpy( bf->Image,raw.Data,bf->ImageSize ); free( raw.Data ); - #ifdef DEBUG - dbprintf( 4,"[png] filename: %s.\n",fname ); - dbprintf( 4,"[png] size: %dx%d bits: %d\n",bf->Width,bf->Height,bf->BPP ); - dbprintf( 4,"[png] imagesize: %lu\n",bf->ImageSize ); - #endif + mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"[png] filename: %s.\n",fname ); + mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"[png] size: %dx%d bits: %d\n",bf->Width,bf->Height,bf->BPP ); + mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"[png] imagesize: %lu\n",bf->ImageSize ); return 0; }
--- a/Gui/bitmap/tga/tga.c Sat Feb 23 07:40:25 2002 +0000 +++ b/Gui/bitmap/tga/tga.c Sat Feb 23 15:12:55 2002 +0000 @@ -4,7 +4,6 @@ #include <stdlib.h> #include "tga.h" -#include "../../error.h" int tgaRead( char * filename,txSample * bf ) { @@ -20,23 +19,17 @@ if ( !strstr( tmp,".tga" ) ) strcat( tmp,".tga" ); if ( (BMP=fopen( tmp,"rb" )) == NULL ) { - #ifdef DEBUG - dbprintf( 4,"[tga] File not found ( %s ).\n",tmp ); - #endif + mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"[tga] File not found ( %s ).\n",tmp ); return 1; } if ( (i=fread( &tgaHeader,sizeof( tgaHeader ),1,BMP )) != 1 ) { - #ifdef DEBUG - dbprintf( 4,"[tga] Header read error ( %s ).\n",tmp ); - #endif + mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"[tga] Header read error ( %s ).\n",tmp ); return 2; } if ( tgaHeader.depth < 24 ) { - #ifdef DEBUG - dbprintf( 4,"[tga] Sorry, this loader not supported 16 bit or less ...\n" ); - #endif + mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"[tga] Sorry, this loader not supported 16 bit or less ...\n" ); return 3; } bf->Width=tgaHeader.sx; @@ -46,9 +39,7 @@ if ( ( bf->Image=malloc( bf->ImageSize ) ) == NULL ) { - #ifdef DEBUG - dbprintf( 4,"[tga] Not enough memory for image buffer.\n" ); - #endif + mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"[tga] Not enough memory for image buffer.\n" ); return 4; } @@ -57,35 +48,29 @@ { if ( ( comment=malloc( tgaHeader.tmp[0] + 1 ) ) == NULL ) { - #ifdef DEBUG - dbprintf( 4,"[tga] Not enough memory for comment string.\n" ); - #endif + mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"[tga] Not enough memory for comment string.\n" ); return 5; } memset( comment,0,tgaHeader.tmp[0] + 1 ); if ( fread( comment,tgaHeader.tmp[0],1,BMP ) != 1 ) { - #ifdef DEBUG - dbprintf( 4,"[tga] Comment read error.\n" ); - #endif - return 6; + mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"[tga] Comment read error.\n" ); + return 6; } } - #ifdef DEBUG - dbprintf( 4,"[tga] filename ( read ): %s\n",tmp ); - dbprintf( 4,"[tga] size: %dx%d bits: %d\n",bf->Width,bf->Height,bf->BPP ); - dbprintf( 4,"[tga] imagesize: %lu\n",bf->ImageSize ); - if ( comment ) dbprintf( 4,"[tga] comment: %s\n",comment ); + mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"[tga] filename ( read ): %s\n",tmp ); + mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"[tga] size: %dx%d bits: %d\n",bf->Width,bf->Height,bf->BPP ); + mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"[tga] imagesize: %lu\n",bf->ImageSize ); + #ifdef MP_DEBUG + if ( comment ) mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"[tga] comment: %s\n",comment ); #endif if ( comment ) free( comment ); if ( fread( bf->Image,bf->ImageSize,1,BMP ) != 1 ) { - #ifdef DEBUG - dbprintf( 4,"[tga] Image read error.\n" ); - #endif + mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"[tga] Image read error.\n" ); return 7; } @@ -96,9 +81,7 @@ linesize=bf->Width * ( bf->BPP / 8 ); if ( (line=malloc( linesize )) == NULL ) { - #ifdef DEBUG - dbprintf( 4,"[tga] Not enough memory for flipping.\n" ); - #endif + mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"[tga] Not enough memory for flipping.\n" ); return 8; } @@ -129,7 +112,7 @@ if ( !strstr( tmp,".tga" ) ) strcat( tmp,".tga" ); if ( ( BMP=fopen( tmp,"wb+" ) ) == NULL ) { - dbprintf( 0,"[tga] File not open ( %s ).\n",tmp ); + mp_msg( MSGT_GPLAYER,MSGL_STATUS,"[tga] File not open ( %s ).\n",tmp ); exit( 0 ); } memset( &tgaHeader,0,sizeof( tgaHeader ) ); @@ -141,21 +124,19 @@ if ( bf->BPP != 8 ) tgaHeader.tmp[2]=2; else tgaHeader.tmp[2]=3; - #ifdef DEBUG - dbprintf( 4,"\n[tga] filename ( write ): %s\n",tmp ); - dbprintf( 4,"[tga] size: %dx%d\n",bf->Width,bf->Height ); - dbprintf( 4,"[tga] bits: %d\n",bf->BPP ); - dbprintf( 4,"[tga] imagesize: %lu\n",bf->ImageSize ); - dbprintf( 4,"[tga] comment: %s\n",comment ); - dbprintf( 4,"\n" ); - #endif + mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"\n[tga] filename ( write ): %s\n",tmp ); + mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"[tga] size: %dx%d\n",bf->Width,bf->Height ); + mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"[tga] bits: %d\n",bf->BPP ); + mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"[tga] imagesize: %lu\n",bf->ImageSize ); + mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"[tga] comment: %s\n",comment ); + mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"\n" ); if ( tgaHeader.ctmp == 0 ) { linesize=bf->Width * ( bf->BPP / 8 ); if ( (line=malloc( linesize )) == NULL ) { - dbprintf( 0,"[tga] Not enough memory for flipping.\n" ); + mp_msg( MSGT_GPLAYER,MSGL_STATUS,"[tga] Not enough memory for flipping.\n" ); exit( 0 ); }
--- a/Gui/error.c Sat Feb 23 07:40:25 2002 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,61 +0,0 @@ - -#include <stdlib.h> -#include <stdio.h> -#include <stdarg.h> - -#include "error.h" - -int debug_level = 2; -FILE * debug_file; -int debug_stderr = 0; - -void defaultErrorHandler( int critical,const char * format, ... ) -{ - char * p; - va_list ap; - - if ( (p=(char *)malloc( 512 ) ) == NULL ) return; - va_start( ap,format ); - vsnprintf( p,512,format,ap ); - va_end( ap ); - fprintf( stderr,"%s",p ); - free( p ); - if ( critical ) exit( 1 ); -} - -void defaultDebugHandler( int critical,const char * format, ... ) -{ - char * p; - va_list ap; - - if ( critical >= debug_level ) return; - if ( (p=(char *)malloc( 512 ) ) == NULL ) return; - va_start( ap,format ); - vsnprintf( p,512,format,ap ); - va_end( ap ); - fprintf( debug_file,"%s",p ); - free( p ); -} - -errorTHandler message = defaultErrorHandler; -errorTHandler dbprintf = defaultDebugHandler; - -void initDebug( char * name ) -{ - if ( name ) - { - if ( ( debug_file=fopen( name,"wt+" ) ) != NULL ) - { - debug_stderr=0; - return; - } - } - debug_file=stderr; - debug_stderr=1; -} -void doneDebug( void ) -{ - if ( !debug_stderr ) fclose( debug_file ); - debug_file=stderr; - debug_stderr=1; -}
--- a/Gui/error.h Sat Feb 23 07:40:25 2002 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,22 +0,0 @@ - -#ifndef _MPLAYER_ERROR_HANDLER -#define _MPLAYER_ERROR_HANDLER - -#define True 1 -#define False 0 - -// 0 - standard message -// 1 - detto -// 2 - events -// 3 - skin reader messages -// 4 - bitmap reader messages -// 5 - signal handling messages -// 6 - gtk messages - -typedef void (*errorTHandler)( int critical,const char * format, ... ); - -extern errorTHandler message; -extern errorTHandler dbprintf; - -#endif -
--- a/Gui/events.h Sat Feb 23 07:40:25 2002 +0000 +++ b/Gui/events.h Sat Feb 23 15:12:55 2002 +0000 @@ -47,7 +47,7 @@ #define evHelp 37 #define evLoadSubtitle 38 -#define evPlayDVD 39 +#define evPlayDVD 39 #define evExit 1000
--- a/Gui/gui.mak Sat Feb 23 07:40:25 2002 +0000 +++ b/Gui/gui.mak Sat Feb 23 15:12:55 2002 +0000 @@ -7,9 +7,9 @@ $(MPLAYERDIR)gtk/opts.c MPLAYERSRCS = $(MPLAYERDIR)mplayer.c $(MPLAYERDIR)widgets.c $(MPLAYERDIR)play.c \ - $(MPLAYERDIR)psignal.c $(GTKSRCS) + $(GTKSRCS) MPLAYEROBJS = $(MPLAYERSRCS:.c=.o) -SRCS = $(SKINSRC) $(BITMAPSRCS) wm/ws.c wm/wsconv.c app.c events.c timer.c error.c interface.c +SRCS = $(SKINSRC) $(BITMAPSRCS) wm/ws.c wm/wsconv.c app.c events.c interface.c OBJS = $(SRCS:.c=.o)
--- a/Gui/interface.c Sat Feb 23 07:40:25 2002 +0000 +++ b/Gui/interface.c Sat Feb 23 15:12:55 2002 +0000 @@ -1,9 +1,31 @@ +#include <string.h> #include "ws.h" #include "mplayer/play.h" #include "interface.h" + #include "../mplayer.h" +#include "mplayer/widgets.h" +#include "mplayer/mplayer.h" +#include "app.h" +#include "../libvo/x11_common.h" + +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(); +} void guiGetEvent( int type,char * arg ) { @@ -11,15 +33,16 @@ { case guiXEvent: wsEvents( wsDisplay,(XEvent *)arg,NULL ); - break; + gtkEventHandling(); + break; case guiCEvent: - break; + break; } } void guiEventHandling( void ) { - if ( use_gui && !mplShMem->Playing ) wsHandleEvents(); - mplTimerHandler(0); // handle GUI timer events - if ( mplShMem->SkinChange ) { ChangeSkin(); mplShMem->SkinChange=0; } + if ( use_gui && !guiIntfStruct.Playing ) wsHandleEvents(); + gtkEventHandling(); + mplTimerHandler(); // handle GUI timer events }
--- a/Gui/interface.h Sat Feb 23 07:40:25 2002 +0000 +++ b/Gui/interface.h Sat Feb 23 15:12:55 2002 +0000 @@ -2,13 +2,112 @@ #ifndef _INTERFACE_H #define _INTERFACE_H +#include "../config.h" #include "mplayer/play.h" #include "../mplayer.h" +#ifdef USE_DVDREAD + #include "../libmpdemux/stream.h" +#endif + + +typedef struct +{ + int x; + int y; + int width; + int height; +} guiResizeStruct; + +typedef struct +{ + int signal; + char module[512]; +} guiUnknowErrorStruct; + +typedef struct +{ + int seek; + int format; + int width; + int height; + char codecdll[128]; +} guiVideoStruct; + +#ifdef USE_DVDREAD +typedef struct +{ + int titles; + int chapters; + int angles; + int current_chapter; + int current_title; + int current_angle; + int nr_of_audio_channels; + stream_language_t audio_streams[32]; + int nr_of_subtitles; + stream_language_t subtitles[32]; +} guiDVDStruct; +#endif + +typedef struct +{ + int message; + guiResizeStruct resize; + guiVideoStruct videodata; + guiUnknowErrorStruct error; +#ifdef USE_DVDREAD + guiDVDStruct DVD; + int DVDChanged; +#endif + + int Playing; + float Position; + + int MovieWidth; + int MovieHeight; + + float Volume; + int VolumeChanged; + float Balance; + int Mute; + + int Track; + int AudioType; + int StreamType; + int TimeSec; + int LengthInSec; + int FrameDrop; + + char * Filename; + int FilenameChanged; + + char * Subtitlename; + int SubtitleChanged; + + char * Othername; + int OtherChanged; + + int SkinChange; +} guiInterface_t; + +extern guiInterface_t guiIntfStruct; + #define guiXEvent 0 #define guiCEvent 1 +extern void guiInit( int argc,char* argv[], char *envp[] ); extern void guiGetEvent( int type,char * arg ); extern void guiEventHandling( void ); +#define guiSetFilename( s,n ) \ + { if ( s ) free( s ); s=NULL; s=strdup( n ); } + +#define guiSetDF( s,d,n ) \ + { \ + if ( s ) free( s ); s=NULL; \ + s=malloc( strlen( d ) + strlen( n ) + 5 ); \ + sprintf( s,"%s/%s",d,n ); \ + } + #endif \ No newline at end of file
--- a/Gui/language.c Sat Feb 23 07:40:25 2002 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,45 +0,0 @@ - -// --- labels --- -char * langAbout = "About"; -char * langFileSelect = "Select file ..."; -char * langMessageBox = "MessageBox"; -char * langPlayList = "PlayList"; -char * langSkinBrowser = "Skin Browser"; - -// --- buttons --- -char * langOk = "Ok"; -char * langCancel = "Cancel"; -char * langAdd = "Add"; -char * langRemove = "Remove"; - -// --- error messages --- -char * langNEMDB = "Sorry, not enough memory for draw buffer."; -char * langNEMFMR = "Sorry, not enough memory for menu rendering."; -char * langNEMFMM = "Sorry, not enough memory for main window shape mask."; - -#if 0 -char * langLIRCSNW = "LIRC support not working. Disabled."; -char * langAudioDriverSelectNotSupported = "Your audio driver DOES NOT support select(). Recompile mplayer with #undef HAVE_AUDIO_SELECT in config.h !"; -char * langNotSupportedFileFormat = "Sorry, this file format not recognized/supported. If this file is an AVI, ASF or MPEG stream, please contact the author!"; -char * langCodecConfNotFound = "The codecs.conf config file not found. Please copy/link DOCS/codecs.conf to ~/.mplayer/codecs.conf."; -char * langErrorProcessingDVDKey = "Error processing DVD KEY."; -char * langErrorInDVDAuth = "Error in DVD authentication."; -char * langAVIMissing = "AVI_NI: missing video stream!? contact the author, it may be a bug. :("; -char * langAVIMissingVideoStream = "AVI: missing video stream!? contact the author, it may be a bug. :("; -char * langASFMissingVideoStream = "ASF: missing video stream!? contact the author, it may be a bug. :("; -char * langMPEGEOFNotFound = "MPEG: FATAL: EOF while searching for sequence header."; -char * langCannotAllocateSharedMem = "Cannot allocate shared memory. ( Not enough memory ? )"; -char * langMPEGCannotReadSeqHeader = "MPEG: FATAL: Cannot read sequence header!"; -char * langMPEGBadSeqHeader = "MPEG: Bad sequence header!"; -char * langMPEGCannotReadSeqHeaderExt = "MPEG: FATAL: Cannot read sequence header extension!"; -char * langMPEGBadSeqHeaderExt = "MPEG: Bad sequence header extension!"; -char * langCantFindCodec = "Can't find codec for video format"; -char * langSelectedVideoOutIncompTheCodec = "Sorry, selected video_out device is incompatible with this codec."; -char * langMPCompWithoutDSSupport = "MPlayer was compiled WITHOUT directshow support!"; -char * langDSCodecNotFound = "ERROR: Couldn't open required DirectShow codec: %s. " \ - "Maybe you forget to upgrade your win32 codecs?? It's time to download the new " \ - "package from: ftp://thot.banki.hu/esp-team/linux/MPlayer/w32codec.zip! " \ - "Or you should disable DShow support."; -char * langCantInitVideoDriver = "FATAL: Cannot initialize video driver!"; -char * langUnknowError = "Unknow error. Please contact the developer team."; -#endif
--- a/Gui/language.h Sat Feb 23 07:40:25 2002 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,7 +0,0 @@ - -#ifndef __MPLAYER_LANG -#define __MPLAYER_LANG - -#include "../help_mp.h" - -#endif \ No newline at end of file
--- a/Gui/mplayer/gtk/about.c Sat Feb 23 07:40:25 2002 +0000 +++ b/Gui/mplayer/gtk/about.c Sat Feb 23 15:12:55 2002 +0000 @@ -10,7 +10,6 @@ void ab_Ok_released( GtkButton * button,gpointer user_data ) { gtk_widget_hide( AboutBox ); - gtkVisibleAboutBox=0; } GtkWidget * create_About( void ) @@ -157,7 +156,7 @@ "Homepage:\n" \ " Design: Chass\n" \ " Contents: Gabucino\n" \ - " LGB\n\n" \ + " LGB\n\n" \ "English documentation:\n" \ " tech-*.txt: A'rpi\n" \ " all the others: Gabucino\n\n" \
--- a/Gui/mplayer/gtk/fs.c Sat Feb 23 07:40:25 2002 +0000 +++ b/Gui/mplayer/gtk/fs.c Sat Feb 23 15:12:55 2002 +0000 @@ -7,14 +7,13 @@ #include <unistd.h> #include "./mplayer.h" -#include "psignal.h" -#include "../error.h" #include "pixmaps/up.xpm" #include "pixmaps/dir.xpm" #include "pixmaps/file.xpm" #include "../../events.h" +#include "../../interface.h" #include "../../../config.h" #include "../../../help_mp.h" @@ -35,30 +34,30 @@ gchar fsFilter[8] = "*"; int fsPressed = 0; -int fsMessage = -1; -int fsType = 0; +int fsMessage = -1; +int fsType = 0; #define fsNumberOfVideoFilterNames 6 -char * fsVideoFilterNames[fsNumberOfVideoFilterNames+1][2] = +char * fsVideoFilterNames[fsNumberOfVideoFilterNames+1][2] = { { "MPEG files ( *.mpg )", "*.mpg" }, - { "VOB files ( *.vob )", "*.vob" }, + { "VOB files ( *.vob )", "*.vob" }, { "AVI files ( *.avi )", "*.avi" }, - { "QT files ( *.mov )", "*.mov" }, - { "ASF files ( *.asf )", "*.asf" }, - { "VIVO files ( *.viv )", "*.viv" }, + { "QT files ( *.mov )", "*.mov" }, + { "ASF files ( *.asf )", "*.asf" }, + { "VIVO files ( *.viv )", "*.viv" }, { "All files ( * )", "*" } }; - + #define fsNumberOfSubtitleFilterNames 8 char * fsSubtitleFilterNames[fsNumberOfSubtitleFilterNames+1][2] = { { "UTF ( *.utf )", "*.utf" }, - { "SUB ( *.sub )", "*.sub" }, - { "SRT ( *.srt )", "*.str" }, + { "SUB ( *.sub )", "*.sub" }, + { "SRT ( *.srt )", "*.str" }, { "SMI ( *.smi )", "*.smi" }, { "RT ( *.rt )", "*.rt" }, { "TXT ( *.txt )", "*.txt" }, { "SSA ( *.ssa )", "*.ssa" }, { "AQT ( *.aqt )", "*.aqt" }, - { "All files ( * )", "*" } }; + { "All files ( * )", "*" } }; #define fsNumberOfOtherFilterNames 0 char * fsOtherFilterNames[fsNumberOfOtherFilterNames+1][2] = @@ -99,7 +98,7 @@ gtk_widget_hide( list ); gtk_clist_clear( GTK_CLIST( list ) ); str[0][0]=NULL; - + pixmap=dpixmap; mask=dmask; str[0][0]=NULL; str[0][1]=(gchar *)malloc( 3 ); strcpy( str[0][1],"." ); gtk_clist_append( GTK_CLIST( list ),str[0] ); gtk_clist_set_pixmap( GTK_CLIST( list ),0,0,pixmap,mask ); @@ -121,9 +120,9 @@ free( str[0][1] ); } globfree( &gg ); - + glob( fsFilter,0,NULL,&gg ); - + #if 0 if ( !strcmp( fsFilter,"*" ) ) { @@ -132,7 +131,7 @@ for( i=0;i<strlen( f );i++ ) if ( ( f[i] >= 'A' )&&( f[i] <= 'Z' ) ) f[i]+=32; glob( f,GLOB_APPEND,NULL,&gg ); - + for( i=0;i<strlen( f );i++ ) if ( ( f[i] >= 'a' )&&( f[i] <= 'z' ) ) f[i]-=32; glob( f,GLOB_APPEND,NULL,&gg ); @@ -163,13 +162,13 @@ void ShowFileSelect( int type ) { int i; - if ( gtkVisibleFileSelect ) gtk_widget_hide( FileSelect ); + gtk_widget_hide( FileSelect ); fsType=type; switch ( type ) { case fsVideoSelector: fsMessage=evFileLoaded; - gtk_window_set_title( GTK_WINDOW( fsFileSelect ),MSGTR_FileSelect ); + gtk_window_set_title( GTK_WINDOW( fsFileSelect ),MSGTR_FileSelect ); fsList_items=NULL; for( i=0;i<fsNumberOfVideoFilterNames + 1;i++ ) fsList_items=g_list_append( fsList_items,fsVideoFilterNames[i][0] ); @@ -178,7 +177,7 @@ gtk_entry_set_text( GTK_ENTRY( fsFilterCombo ),fsVideoFilterNames[fsNumberOfVideoFilterNames][0] ); break; case fsSubtitleSelector: - gtk_window_set_title( GTK_WINDOW( fsFileSelect ),MSGTR_SubtitleSelect ); + gtk_window_set_title( GTK_WINDOW( fsFileSelect ),MSGTR_SubtitleSelect ); fsList_items=NULL; for( i=0;i<fsNumberOfSubtitleFilterNames + 1;i++ ) fsList_items=g_list_append( fsList_items,fsSubtitleFilterNames[i][0] ); @@ -187,7 +186,7 @@ gtk_entry_set_text( GTK_ENTRY( fsFilterCombo ),fsSubtitleFilterNames[fsNumberOfSubtitleFilterNames][0] ); break; case fsOtherSelector: - gtk_window_set_title( GTK_WINDOW( fsFileSelect ),MSGTR_OtherSelect ); + gtk_window_set_title( GTK_WINDOW( fsFileSelect ),MSGTR_OtherSelect ); fsList_items=NULL; for( i=0;i<fsNumberOfSubtitleFilterNames + 1;i++ ) fsList_items=g_list_append( fsList_items,fsOtherFilterNames[i][0] ); @@ -197,15 +196,11 @@ break; } gtk_widget_show( FileSelect ); - gtkVisibleFileSelect=1; } void HideFileSelect( void ) { gtk_widget_hide( fsFileSelect ); - gtkVisibleFileSelect=0; - gtkShMem->vs.window=evLoad; - gtkSendMessage( evHideWindow ); } void fs_fsFileSelect_destroy( GtkObject * object,gpointer user_data ) @@ -223,35 +218,35 @@ int i; str=gtk_entry_get_text( GTK_ENTRY(user_data ) ); - + switch ( fsType ) { case fsVideoSelector: for( i=0;i<fsNumberOfVideoFilterNames+1;i++ ) - if( !strcmp( str,fsVideoFilterNames[i][0] ) ) + if( !strcmp( str,fsVideoFilterNames[i][0] ) ) { - strcpy( fsFilter,fsVideoFilterNames[i][1] ); - CheckDir( fsFNameList,get_current_dir_name() ); - break; - } - break; + strcpy( fsFilter,fsVideoFilterNames[i][1] ); + CheckDir( fsFNameList,get_current_dir_name() ); + break; + } + break; case fsSubtitleSelector: for( i=0;i<fsNumberOfSubtitleFilterNames+1;i++ ) - if( !strcmp( str,fsSubtitleFilterNames[i][0] ) ) + if( !strcmp( str,fsSubtitleFilterNames[i][0] ) ) { - strcpy( fsFilter,fsSubtitleFilterNames[i][1] ); - CheckDir( fsFNameList,get_current_dir_name() ); - break; - } + strcpy( fsFilter,fsSubtitleFilterNames[i][1] ); + CheckDir( fsFNameList,get_current_dir_name() ); + break; + } break; case fsOtherSelector: for( i=0;i<fsNumberOfOtherFilterNames+1;i++ ) - if( !strcmp( str,fsOtherFilterNames[i][0] ) ) + if( !strcmp( str,fsOtherFilterNames[i][0] ) ) { - strcpy( fsFilter,fsOtherFilterNames[i][1] ); - CheckDir( fsFNameList,get_current_dir_name() ); - break; - } + strcpy( fsFilter,fsOtherFilterNames[i][1] ); + CheckDir( fsFNameList,get_current_dir_name() ); + break; + } break; } } @@ -313,18 +308,10 @@ { case 1: fsSelectedDirectory=(unsigned char *)get_current_dir_name(); -// printf("[gtk-fs] 1-fsSelectedFile: %s\n",fsSelectedFile); -// #ifdef DEBUG -// dbprintf( 1,"[gtk-fs] fsSelectedFile: %s\n",fsSelectedFile ); -// #endif break; case 2: str=gtk_entry_get_text( GTK_ENTRY( fsPathCombo ) ); fsSelectedFile=str; -// printf("[gtk-fs] 2-fsSelectedFile: '%s' \n",fsSelectedFile); -// #ifdef DEBUG -// dbprintf( 1,"[gtk-fs] fsSelectedFile: %s\n",fsSelectedFile ); -// #endif if ( !fsFileExist( fsSelectedFile ) ) return; fsSelectedDirectory=fsSelectedFile; size=strlen( fsSelectedDirectory ); @@ -337,31 +324,21 @@ break; } } -// printf("[gtk-fs-xxx] fsSelectedFile: '%s' \n",fsSelectedFile); -// printf("[gtk-fs-xxx] fsSelectedDirectory: '%s' \n",fsSelectedDirectory); break; } -// printf( "----gtk---> directory: %s\n",fsSelectedDirectory ); -// printf( "----gtk---> filename: %s\n",fsSelectedFile ); switch ( fsType ) { case fsVideoSelector: - strcpy( gtkShMem->fs.dir,fsSelectedDirectory ); - strcpy( gtkShMem->fs.filename,fsSelectedFile ); -// printf( "----gtksm-> directory: %s\n",gtkShMem->fs.dir ); -// printf( "----gtksm-> filename: %s\n",gtkShMem->fs.filename ); - gtkSendMessage( evFileLoaded ); - break; + guiSetDF( guiIntfStruct.Filename,fsSelectedDirectory,fsSelectedFile ); + guiIntfStruct.StreamType=STREAMTYPE_FILE; + guiIntfStruct.FilenameChanged=1; + break; case fsSubtitleSelector: - strcpy( gtkShMem->fs.subtitlename,fsSelectedDirectory ); - strcat( gtkShMem->fs.subtitlename,"/" ); - strcat( gtkShMem->fs.subtitlename,fsSelectedFile ); - gtkSendMessage( evSubtitleLoaded ); + guiSetDF( guiIntfStruct.Subtitlename,fsSelectedDirectory,fsSelectedFile ); + guiIntfStruct.SubtitleChanged=1; break; case fsOtherSelector: - strcpy( gtkShMem->fs.otherfilename,fsSelectedDirectory ); - strcat( gtkShMem->fs.subtitlename,"/" ); - strcat( gtkShMem->fs.otherfilename,fsSelectedFile ); + guiSetDF( guiIntfStruct.Othername,fsSelectedDirectory,fsSelectedFile ); break; } item=fsTopList_items; @@ -375,6 +352,7 @@ fsTopList_items=g_list_prepend( fsTopList_items,(gchar *)get_current_dir_name() ); gtk_combo_set_popdown_strings( GTK_COMBO( user_data ),fsTopList_items ); } + if ( mplMainAutoPlay ) mplEventHandling( evPlay,0 ); } void fs_Cancel_released( GtkButton * button,gpointer user_data ) @@ -382,7 +360,7 @@ void fs_fsFNameList_select_row( GtkWidget * widget,gint row,gint column,GdkEventButton *bevent,gpointer user_data ) { - gtk_clist_get_text( GTK_CLIST(widget ),row,1,&fsSelectedFile ); + gtk_clist_get_text( GTK_CLIST(widget ),row,1,&fsSelectedFile ); fsPressed=1; if( !bevent ) return; if( bevent->type == GDK_2BUTTON_PRESS ) gtk_button_released( GTK_BUTTON( fsOk ) );
--- a/Gui/mplayer/gtk/mb.c Sat Feb 23 07:40:25 2002 +0000 +++ b/Gui/mplayer/gtk/mb.c Sat Feb 23 15:12:55 2002 +0000 @@ -21,14 +21,11 @@ } */ gtk_widget_hide( MessageBox ); - gtkVisibleMessageBox=0; } void on_Ok_released( GtkButton * button,gpointer user_data ) { gtk_widget_hide( MessageBox ); - gtkVisibleMessageBox=0; - gtkSendMessage( evMessageBox ); } GtkWidget * create_MessageBox( int type )
--- a/Gui/mplayer/gtk/menu.c Sat Feb 23 07:40:25 2002 +0000 +++ b/Gui/mplayer/gtk/menu.c Sat Feb 23 15:12:55 2002 +0000 @@ -14,10 +14,9 @@ void ActivateMenuItem( int Item ) { // fprintf( stderr,"[menu] item: %d.%d\n",Item&0xffff,Item>>16 ); - gtkShMem->popupmenu=Item & 0x0000ffff; - gtkShMem->popupmenuparam=Item >> 16; - gtkShMem->visiblepopupmenu=0; - gtkSendMessage( evShowPopUpMenu ); + gtkPopupMenu=Item & 0x0000ffff; + gtkPopupMenuParam=Item >> 16; + mplEventHandling( Item & 0x0000ffff,Item >> 16 ); } GtkWidget * AddMenuItem( GtkWidget * Menu,char * label,int Number ) @@ -246,6 +245,7 @@ int i; for ( i=0;i<sizeof( Languages ) / sizeof( Languages_t );i++ ) if ( Languages[i].id == language ) return Languages[i].name; + return NULL; } GtkWidget * DVDSubMenu; @@ -293,61 +293,61 @@ AddMenuItem( DVDSubMenu,MSGTR_MENU_ShowDVDMenu, evNone ); AddSeparator( DVDSubMenu ); DVDTitleMenu=AddSubMenu( DVDSubMenu,MSGTR_MENU_Titles ); - if ( gtkShMem->DVD.titles ) + if ( guiIntfStruct.DVD.titles ) { char tmp[32]; int i; - for ( i=0;i<gtkShMem->DVD.titles;i++ ) + for ( i=0;i < guiIntfStruct.DVD.titles;i++ ) { sprintf( tmp,MSGTR_MENU_Title,i+1 ); AddMenuItem( DVDTitleMenu,tmp,( (i+1) << 16 ) + evSetDVDTitle ); } } - else + else { MenuItem=AddMenuItem( DVDTitleMenu,MSGTR_MENU_None,evNone ); gtk_widget_set_sensitive( MenuItem,FALSE ); } DVDChapterMenu=AddSubMenu( DVDSubMenu,MSGTR_MENU_Chapters ); - if ( gtkShMem->DVD.chapters ) + if ( guiIntfStruct.DVD.chapters ) { char tmp[32]; int i; - for ( i=0;i<gtkShMem->DVD.chapters;i++ ) + for ( i=0;i < guiIntfStruct.DVD.chapters;i++ ) { sprintf( tmp,MSGTR_MENU_Chapter,i+1 ); AddMenuItem( DVDChapterMenu,tmp,( (i+1) << 16 ) + evSetDVDChapter ); } } - else + else { MenuItem=AddMenuItem( DVDChapterMenu,MSGTR_MENU_None,evNone ); gtk_widget_set_sensitive( MenuItem,FALSE ); } DVDAudioLanguageMenu=AddSubMenu( DVDSubMenu,MSGTR_MENU_AudioLanguages ); - if ( gtkShMem->DVD.nr_of_audio_channels ) + if ( guiIntfStruct.DVD.nr_of_audio_channels ) { char tmp[64]; int i; - for ( i=0;i<gtkShMem->DVD.nr_of_audio_channels;i++ ) + for ( i=0;i < guiIntfStruct.DVD.nr_of_audio_channels;i++ ) { - strcpy( tmp,GetLanguage( gtkShMem->DVD.audio_streams[i].language ) ); - AddMenuItem( DVDAudioLanguageMenu,tmp,( gtkShMem->DVD.audio_streams[i].id << 16 ) + evSetDVDAudio ); + strcpy( tmp,GetLanguage( guiIntfStruct.DVD.audio_streams[i].language ) ); + AddMenuItem( DVDAudioLanguageMenu,tmp,( guiIntfStruct.DVD.audio_streams[i].id << 16 ) + evSetDVDAudio ); } } - else + else { MenuItem=AddMenuItem( DVDAudioLanguageMenu,MSGTR_MENU_None,evNone ); gtk_widget_set_sensitive( MenuItem,FALSE ); } DVDSubtitleLanguageMenu=AddSubMenu( DVDSubMenu,MSGTR_MENU_SubtitleLanguages ); - if ( gtkShMem->DVD.nr_of_subtitles ) + if ( guiIntfStruct.DVD.nr_of_subtitles ) { char tmp[64]; int i; - for ( i=0;i<gtkShMem->DVD.nr_of_subtitles;i++ ) + for ( i=0;i < guiIntfStruct.DVD.nr_of_subtitles;i++ ) { - strcpy( tmp,GetLanguage( gtkShMem->DVD.subtitles[i].language ) ); - AddMenuItem( DVDSubtitleLanguageMenu,tmp,( gtkShMem->DVD.subtitles[i].id << 16 ) + evSetDVDSubtitle ); + strcpy( tmp,GetLanguage( guiIntfStruct.DVD.subtitles[i].language ) ); + AddMenuItem( DVDSubtitleLanguageMenu,tmp,( guiIntfStruct.DVD.subtitles[i].id << 16 ) + evSetDVDSubtitle ); } } - else + else { MenuItem=AddMenuItem( DVDSubtitleLanguageMenu,MSGTR_MENU_None,evNone ); gtk_widget_set_sensitive( MenuItem,FALSE );
--- a/Gui/mplayer/gtk/opts.c Sat Feb 23 07:40:25 2002 +0000 +++ b/Gui/mplayer/gtk/opts.c Sat Feb 23 15:12:55 2002 +0000 @@ -1,7 +1,8 @@ + +#include <stdlib.h> +#include <stdio.h> #include "./mplayer.h" -#include "psignal.h" -#include "../error.h" #include "../../events.h" #include "../../../config.h" @@ -27,14 +28,11 @@ GtkWidget * opOk; GtkWidget * opCancel; -int opShift = False; +int opShift = 0; void HideOptions( void ) { gtk_widget_hide( Options ); - gtkVisibleOptions=0; - gtkShMem->vs.window=evPreferences; - gtkSendMessage( evHideWindow ); } gboolean on_window2_key_press_event( GtkWidget * widget,GdkEventKey * event,gpointer user_data ) @@ -43,10 +41,10 @@ { case GDK_Shift_L: case GDK_Shift_R: - opShift=True; + opShift=1; break; } - return FALSE; + return 0; } gboolean on_window2_key_release_event( GtkWidget * widget,GdkEventKey * event,gpointer user_data ) @@ -66,7 +64,7 @@ break; case GDK_Shift_L: case GDK_Shift_R: - opShift=False; + opShift=0; break; } return FALSE;
--- a/Gui/mplayer/gtk/pl.c Sat Feb 23 07:40:25 2002 +0000 +++ b/Gui/mplayer/gtk/pl.c Sat Feb 23 15:12:55 2002 +0000 @@ -9,9 +9,6 @@ void HidePlayList( void ) { gtk_widget_hide( PlayList ); - gtkVisiblePlayList=0; - gtkShMem->vs.window=evPlayList; - gtkSendMessage( evHideWindow ); } void pl_PlayList_destroy( GtkObject * object,gpointer user_data )
--- a/Gui/mplayer/gtk/sb.c Sat Feb 23 07:40:25 2002 +0000 +++ b/Gui/mplayer/gtk/sb.c Sat Feb 23 15:12:55 2002 +0000 @@ -4,6 +4,7 @@ #include <unistd.h> #include <string.h> #include <stdlib.h> +#include <stdio.h> #include "sb.h" #include "../../events.h" @@ -18,16 +19,7 @@ char * sbMPlayerDirInHome=NULL; char * sbMPlayerPrefixDir=NULL; -void HideSkinBrowser( void ) -{ - gtk_widget_hide( SkinBrowser ); - gtkVisibleSkinBrowser=0; - gtkShMem->vs.window=evSkinBrowser; - gtkSendMessage( evHideWindow ); - gtkSendMessage( evSkinBrowser ); -} - -char gtkOldSkin[128]; +char * gtkOldSkin; int gtkFillSkinList( gchar * mdir ) { @@ -37,7 +29,7 @@ glob_t gg; struct stat fs; - strcpy( gtkOldSkin,gtkShMem->sb.name ); + gtkOldSkin=strdup( skinName ); if ( ( str[0]=(char *)calloc( 1,7 ) ) == NULL ) { gtkMessageBox( GTK_MB_FATAL,MSGTR_SKINBROWSER_NotEnoughMemory ); @@ -68,21 +60,28 @@ } void on_SkinBrowser_destroy( GtkObject * object,gpointer user_data ) -{ HideSkinBrowser(); } +{ gtk_widget_hide( SkinBrowser ); } void on_SkinBrowser_Cancel( GtkObject * object,gpointer user_data ) { - strcpy( gtkShMem->sb.name,gtkOldSkin ); - HideSkinBrowser(); + ChangeSkin( skinName ); + gtk_widget_hide( SkinBrowser ); +} + +void on_SkinBrowser_Ok( GtkObject * object,gpointer user_data ) +{ + ChangeSkin( sbSelectedSkin ); + if ( skinName ) free( skinName ); + skinName=strdup( sbSelectedSkin ); + gtk_widget_hide( SkinBrowser ); } void on_SkinList_select_row( GtkCList * clist,gint row,gint column,GdkEvent * bevent,gpointer user_data ) { gtk_clist_get_text( clist,row,0,&sbSelectedSkin ); - strcpy( gtkShMem->sb.name,sbSelectedSkin ); - gtkSendMessage( evSkinBrowser ); + ChangeSkin( sbSelectedSkin ); if( !bevent ) return; - if( bevent->type == GDK_2BUTTON_PRESS ) HideSkinBrowser(); + if( bevent->type == GDK_2BUTTON_PRESS ) gtk_widget_hide( SkinBrowser ); } GtkWidget * create_SkinBrowser( void ) @@ -248,7 +247,7 @@ gtk_signal_connect( GTK_OBJECT( SkinBrowser ),"destroy",GTK_SIGNAL_FUNC( on_SkinBrowser_destroy ),NULL ); gtk_signal_connect( GTK_OBJECT( SkinList ),"select_row",GTK_SIGNAL_FUNC( on_SkinList_select_row ),NULL ); - gtk_signal_connect( GTK_OBJECT( Ok ),"released",GTK_SIGNAL_FUNC( on_SkinBrowser_destroy ),NULL ); + gtk_signal_connect( GTK_OBJECT( Ok ),"released",GTK_SIGNAL_FUNC( on_SkinBrowser_Ok ),NULL ); gtk_signal_connect( GTK_OBJECT( Cancel ),"released",GTK_SIGNAL_FUNC( on_SkinBrowser_Cancel ),NULL ); if ( ( sbMPlayerDirInHome=(char *)calloc( 1,strlen( skinDirInHome ) + 4 ) ) != NULL )
--- a/Gui/mplayer/menu.h Sat Feb 23 07:40:25 2002 +0000 +++ b/Gui/mplayer/menu.h Sat Feb 23 15:12:55 2002 +0000 @@ -100,14 +100,14 @@ if ( ( x < 0 ) || ( y < 0 ) ) return; -// printf( "---------> %d %d,%d\n",i,x,y ); +// printf( "---------> %d %d,%d\n",i,x,y ); // printf( "--------> mi: %d,%d %dx%d\n",appMPlayer.MenuItems[i].x,appMPlayer.MenuItems[i].y,appMPlayer.MenuItems[i].width,appMPlayer.MenuItems[i].height ); if ( wgIsRect( x,y, appMPlayer.MenuItems[i].x,appMPlayer.MenuItems[i].y, appMPlayer.MenuItems[i].x+appMPlayer.MenuItems[i].width, appMPlayer.MenuItems[i].y+appMPlayer.MenuItems[i].height ) ) { - mplMsgHandle( appMPlayer.MenuItems[i].msg,0 ); + mplEventHandling( appMPlayer.MenuItems[i].msg,0 ); } } @@ -122,7 +122,7 @@ if ( ( mplMenuDrawBuffer = calloc( 1,appMPlayer.menuBase.Bitmap.ImageSize ) ) == NULL ) { #ifdef DEBUG - dbprintf( 1,MSGTR_NEMFMR ); + mp_msg( MSGT_GPLAYER,MSGL_DBG2,"[menu.h] %s",MSGTR_NEMFMR ); #endif gtkMessageBox( GTK_MB_FATAL,MSGTR_NEMFMR ); return; @@ -133,7 +133,7 @@ wsNoBorder,wsShowMouseCursor|wsHandleMouseButton|wsHandleMouseMove,wsOverredirect|wsHideFrame|wsMaxSize|wsMinSize|wsHideWindow,"MPlayer menu" ); #ifdef DEBUG - dbprintf( 1,"[menu.h] menu: 0x%x\n",(int)appMPlayer.menuWindow.WindowID ); + mp_msg( MSGT_GPLAYER,MSGL_DBG2,"[menu.h] menu: 0x%x\n",(int)appMPlayer.menuWindow.WindowID ); #endif appMPlayer.menuWindow.ReDraw=mplMenuDraw;
--- a/Gui/mplayer/mplayer.c Sat Feb 23 07:40:25 2002 +0000 +++ b/Gui/mplayer/mplayer.c Sat Feb 23 15:12:55 2002 +0000 @@ -7,29 +7,28 @@ #include "./mplayer.h" #include "../events.h" #include "../app.h" +#include "../interface.h" #include "../skin/skin.h" #include "../skin/font.h" #include "../wm/ws.h" #include "../wm/wskeys.h" #include "../wm/widget.h" #include "../bitmap/bitmap.h" -#include "../timer.h" -#include "../error.h" #include "../../config.h" #include "../../help_mp.h" #include "../../libvo/x11_common.h" #include "../../libmpdemux/stream.h" +#include "../../mp_msg.h" #define mplMouseTimerConst 10 #define mplRedrawTimerConst 5 int mplMouseTimer = mplMouseTimerConst; int mplRedrawTimer = mplRedrawTimerConst; -int mplGeneralTimer = -1; int mplTimer = 0; -void mplMsgHandle( int msg,float param ); +void mplEventHandling( int msg,float param ); #include "widgets.h" #include "play.h" @@ -38,31 +37,24 @@ #include "sw.h" #include "widgets.h" -void mplTimerHandler( int signum ) +void mplTimerHandler( void ) { mplTimer++; mplMouseTimer--; mplRedrawTimer--; - mplGeneralTimer--; - if ( mplMouseTimer == 0 ) mplMsgHandle( evHideMouseCursor,0 ); - if ( mplRedrawTimer == 0 ) mplMsgHandle( evRedraw,0 ); - if ( mplGeneralTimer == 0 ) mplMsgHandle( evGeneralTimer,0 ); + if ( mplMouseTimer == 0 ) mplEventHandling( evHideMouseCursor,0 ); + if ( mplRedrawTimer == 0 ) mplEventHandling( evRedraw,0 ); } void mplInit( int argc,char* argv[], char *envp[], void* disp ) { int i; - // allocates shmem to mplShMem // init fields of this struct to default values mplMPlayerInit( argc,argv,envp ); - // allocates shmem to gtkShMem // fork() a process which runs gtkThreadProc() [gtkPID] gtkInit( argc,argv,envp ); - strcpy( gtkShMem->sb.name,skinName ); - - message=mplErrorHandler; // error messagebox drawing function // opens X display, checks for extensions (XShape, DGA etc) wsXInit(disp); @@ -81,7 +73,7 @@ wsCreateImage( &appMPlayer.subWindow,appMPlayer.sub.Bitmap.Width,appMPlayer.sub.Bitmap.Height ); vo_setwindow( appMPlayer.subWindow.WindowID, appMPlayer.subWindow.wGC ); - + i=wsHideFrame|wsMaxSize|wsHideWindow; if ( appMPlayer.mainDecoration ) i=wsShowFrame|wsMaxSize|wsHideWindow; wsCreateWindow( &appMPlayer.mainWindow, @@ -89,13 +81,13 @@ wsNoBorder,wsShowMouseCursor|wsHandleMouseButton|wsHandleMouseMove,i,"MPlayer" ); //wsMinSize| wsSetShape( &appMPlayer.mainWindow,appMPlayer.main.Mask.Image ); - + mplMenuInit(); #ifdef DEBUG - dbprintf( 1,"[main] Depth on screen: %d\n",wsDepthOnScreen ); - dbprintf( 1,"[main] parent: 0x%x\n",(int)appMPlayer.mainWindow.WindowID ); - dbprintf( 1,"[main] sub: 0x%x\n",(int)appMPlayer.subWindow.WindowID ); + 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=mplMainDraw; @@ -114,24 +106,13 @@ wsPostRedisplay( &appMPlayer.mainWindow ); wsPostRedisplay( &appMPlayer.subWindow ); - btnModify( evSetVolume,mplShMem->Volume ); - btnModify( evSetBalance,mplShMem->Balance ); - btnModify( evSetMoviePosition,mplShMem->Position ); + btnModify( evSetVolume,guiIntfStruct.Volume ); + btnModify( evSetBalance,guiIntfStruct.Balance ); + btnModify( evSetMoviePosition,guiIntfStruct.Position ); - mplShMem->Playing=0; + guiIntfStruct.Playing=0; wsVisibleWindow( &appMPlayer.mainWindow,wsShowWindow ); wsVisibleWindow( &appMPlayer.subWindow,wsShowWindow ); } -void mplDone(){ - - dbprintf( 1,"[mplayer] exit.\n" ); - - mplStop(); -// timerDone(); - gtkDone(); // kills the gtkThreadProc() process - wsXDone(); - -} -
--- a/Gui/mplayer/mplayer.h Sat Feb 23 07:40:25 2002 +0000 +++ b/Gui/mplayer/mplayer.h Sat Feb 23 15:12:55 2002 +0000 @@ -4,16 +4,16 @@ extern int mplSubRender; extern int mplMainRender; -extern int mplGeneralTimer; extern unsigned char * mplDrawBuffer; extern unsigned char * mplMenuDrawBuffer; extern int mainVisible; extern int mplMainAutoPlay; -extern int mplMiddleMenu; +extern int mplMiddleMenu; extern void mplInit( int argc,char* argv[], char *envp[], void* disp ); -extern void mplMsgHandle( int msg,float param ); +extern void mplEventHandling( int msg,float param ); +extern void mplTimerHandler( void ); #endif
--- a/Gui/mplayer/mw.h Sat Feb 23 07:40:25 2002 +0000 +++ b/Gui/mplayer/mw.h Sat Feb 23 15:12:55 2002 +0000 @@ -7,7 +7,7 @@ int mplMainRender = 1; int mplMainAutoPlay = 0; -int mplMiddleMenu = 0; +int mplMiddleMenu = 0; int mainVisible = 1; @@ -18,19 +18,19 @@ inline void TranslateFilename( int c,char * tmp ) { int i; - switch ( mplShMem->StreamType ) + switch ( guiIntfStruct.StreamType ) { case STREAMTYPE_FILE: - if ( gtkShMem->fs.filename[0] ) + if ( ( guiIntfStruct.Filename )&&( guiIntfStruct.Filename[0] ) ) { - strcpy( tmp,gtkShMem->fs.filename ); + strcpy( tmp,guiIntfStruct.Filename ); if ( tmp[strlen( tmp ) - 4] == '.' ) tmp[strlen( tmp ) - 4]=0; if ( tmp[strlen( tmp ) - 5] == '.' ) tmp[strlen( tmp ) - 5]=0; } else strcpy( tmp,"no file loaded" ); break; -#ifdef USE_DVDREAD +#ifdef USE_DVDREAD case STREAMTYPE_DVD: - if ( mplShMem->DVD.current_chapter ) sprintf( tmp,"chapter %d",mplShMem->DVD.current_chapter ); + if ( guiIntfStruct.DVD.current_chapter ) sprintf( tmp,"chapter %d",guiIntfStruct.DVD.current_chapter ); else strcat( tmp,"no chapter" ); break; #endif @@ -38,7 +38,7 @@ } if ( c ) { - for ( i=0;i < strlen( tmp );i++ ) + for ( i=0;i < (int)strlen( tmp );i++ ) { int t=0; if ( c == 1 ) { if ( ( tmp[i] >= 'A' )&&( tmp[i] <= 'Z' ) ) t=32; } @@ -51,46 +51,46 @@ char * Translate( char * str ) { static char trbuf[512]; - char tmp[128]; + char tmp[512]; int i,c; int t; memset( trbuf,0,512 ); memset( tmp,0,128 ); - for ( c=0,i=0;i < strlen( str );i++ ) + for ( c=0,i=0;i < (int)strlen( str );i++ ) { if ( str[i] != '$' ) { trbuf[c++]=str[i]; trbuf[c]=0; } else { switch ( str[++i] ) { - case 't': sprintf( tmp,"%02d",mplShMem->Track ); strcat( trbuf,tmp ); break; + case 't': sprintf( tmp,"%02d",guiIntfStruct.Track ); strcat( trbuf,tmp ); break; case 'o': TranslateFilename( 0,tmp ); strcat( trbuf,tmp ); break; case 'f': TranslateFilename( 1,tmp ); strcat( trbuf,tmp ); break; case 'F': TranslateFilename( 2,tmp ); strcat( trbuf,tmp ); break; - case '6': t=mplShMem->LengthInSec; goto calclengthhhmmss; - case '1': t=mplShMem->TimeSec; + case '6': t=guiIntfStruct.LengthInSec; goto calclengthhhmmss; + case '1': t=guiIntfStruct.TimeSec; calclengthhhmmss: sprintf( tmp,"%02d:%02d:%02d",t/3600,t/60%60,t%60 ); strcat( trbuf,tmp ); break; - case '7': t=mplShMem->LengthInSec; goto calclengthmmmmss; - case '2': t=mplShMem->TimeSec; + case '7': t=guiIntfStruct.LengthInSec; goto calclengthmmmmss; + case '2': t=guiIntfStruct.TimeSec; calclengthmmmmss: sprintf( tmp,"%04d:%02d",t/60,t%60 ); strcat( trbuf,tmp ); break; - case '3': sprintf( tmp,"%02d",mplShMem->TimeSec / 3600 ); strcat( trbuf,tmp ); break; - case '4': sprintf( tmp,"%02d",( ( mplShMem->TimeSec / 60 ) % 60 ) ); strcat( trbuf,tmp ); break; - case '5': sprintf( tmp,"%02d",mplShMem->TimeSec % 60 ); strcat( trbuf,tmp ); break; - case '8': sprintf( tmp,"%01d:%02d:%02d",mplShMem->TimeSec / 3600,( mplShMem->TimeSec / 60 ) % 60,mplShMem->TimeSec % 60 ); strcat( trbuf,tmp ); break; - case 'v': sprintf( tmp,"%3.2f%%",mplShMem->Volume ); strcat( trbuf,tmp ); break; - case 'V': sprintf( tmp,"%3.1f",mplShMem->Volume ); strcat( trbuf,tmp ); break; - case 'b': sprintf( tmp,"%3.2f%%",mplShMem->Balance ); strcat( trbuf,tmp ); break; - case 'B': sprintf( tmp,"%3.1f",mplShMem->Balance ); strcat( trbuf,tmp ); break; - case 'd': sprintf( tmp,"%d",mplShMem->FrameDrop ); strcat( trbuf,tmp ); break; - case 's': if ( mplShMem->Playing == 0 ) strcat( trbuf,"s" ); break; - case 'l': if ( mplShMem->Playing == 1 ) strcat( trbuf,"p" ); break; - case 'e': if ( mplShMem->Playing == 2 ) strcat( trbuf,"e" ); break; + case '3': sprintf( tmp,"%02d",guiIntfStruct.TimeSec / 3600 ); strcat( trbuf,tmp ); break; + case '4': sprintf( tmp,"%02d",( ( guiIntfStruct.TimeSec / 60 ) % 60 ) ); strcat( trbuf,tmp ); break; + case '5': sprintf( tmp,"%02d",guiIntfStruct.TimeSec % 60 ); strcat( trbuf,tmp ); break; + case '8': sprintf( tmp,"%01d:%02d:%02d",guiIntfStruct.TimeSec / 3600,( guiIntfStruct.TimeSec / 60 ) % 60,guiIntfStruct.TimeSec % 60 ); strcat( trbuf,tmp ); break; + case 'v': sprintf( tmp,"%3.2f%%",guiIntfStruct.Volume ); strcat( trbuf,tmp ); break; + case 'V': sprintf( tmp,"%3.1f",guiIntfStruct.Volume ); strcat( trbuf,tmp ); break; + case 'b': sprintf( tmp,"%3.2f%%",guiIntfStruct.Balance ); strcat( trbuf,tmp ); break; + case 'B': sprintf( tmp,"%3.1f",guiIntfStruct.Balance ); strcat( trbuf,tmp ); break; + case 'd': sprintf( tmp,"%d",guiIntfStruct.FrameDrop ); strcat( trbuf,tmp ); break; + case 's': if ( guiIntfStruct.Playing == 0 ) strcat( trbuf,"s" ); break; + case 'l': if ( guiIntfStruct.Playing == 1 ) strcat( trbuf,"p" ); break; + case 'e': if ( guiIntfStruct.Playing == 2 ) strcat( trbuf,"e" ); break; case 'a': - switch ( mplShMem->AudioType ) + switch ( guiIntfStruct.AudioType ) { case 0: strcat( trbuf,"n" ); break; case 1: strcat( trbuf,"m" ); break; @@ -98,12 +98,12 @@ } break; case 'T': - switch ( mplShMem->StreamType ) + switch ( guiIntfStruct.StreamType ) { case STREAMTYPE_FILE: strcat( trbuf,"f" ); break; case STREAMTYPE_VCD: strcat( trbuf,"v" ); break; case STREAMTYPE_STREAM: strcat( trbuf,"u" ); break; -#ifdef USE_DVDREAD +#ifdef USE_DVDREAD case STREAMTYPE_DVD: strcat( trbuf,"d" ); break; #endif default: strcat( trbuf," " ); break; @@ -131,8 +131,8 @@ buf=(unsigned long *)mplDrawBuffer; drw=(unsigned long *)bf->Image; - for ( iy=y;iy < y+bf->Height / max;iy++ ) - for ( ix=x;ix < x+bf->Width;ix++ ) + for ( iy=y;iy < (int)(y+bf->Height / max);iy++ ) + for ( ix=x;ix < (int)(x+bf->Width);ix++ ) { tmp=drw[i++]; if ( tmp != 0x00ff00ff ) @@ -150,8 +150,8 @@ !mainVisible ) return; // !appMPlayer.mainWindow.Mapped ) return; - btnModify( evSetMoviePosition,mplShMem->Position ); - btnModify( evSetVolume,mplShMem->Volume ); + btnModify( evSetMoviePosition,guiIntfStruct.Position ); + btnModify( evSetVolume,guiIntfStruct.Volume ); if ( mplMainRender ) { @@ -176,7 +176,7 @@ goto drawrenderedtext; case itDLabel: image=fntRender( item->fontid,mplTimer%item->width,item->width,"%s",Translate( item->label ) ); -// image=fntRender( item->fontid,( mplRedrawTimer / 10 )%item->width,item->width,"%s",Translate( item->label ) ); +//// image=fntRender( item->fontid,( mplRedrawTimer / 10 )%item->width,item->width,"%s",Translate( item->label ) ); drawrenderedtext: PutImage( image,item->x,item->y,1,0 ); if ( image ) @@ -200,7 +200,7 @@ extern int audio_id; extern int dvdsub_id; -void mplMsgHandle( int msg,float param ) +void mplEventHandling( int msg,float param ) { int j; @@ -218,69 +218,64 @@ dvd_chapter=1; dvd_angle=1; play_dvd_2: - mplShMem->StreamType=STREAMTYPE_DVD; + guiIntfStruct.StreamType=STREAMTYPE_DVD; #endif case evPlay: case evPlaySwitchToPause: // btnModify( evPlaySwitchToPause,btnDisabled ); // btnModify( evPauseSwitchToPlay,btnReleased ); - if ( ( msg == evPlaySwitchToPause )&( mplShMem->Playing == 1 ) ) goto NoPause; + mplMainAutoPlay=0; + if ( ( msg == evPlaySwitchToPause )&( guiIntfStruct.Playing == 1 ) ) goto NoPause; mplMainRender=1; - switch ( mplShMem->StreamType ) + switch ( guiIntfStruct.StreamType ) { - case STREAMTYPE_STREAM: + case STREAMTYPE_STREAM: case STREAMTYPE_VCD: - case STREAMTYPE_FILE: - dvd_title=0; - break; + case STREAMTYPE_FILE: + dvd_title=0; + break; #ifdef USE_DVDREAD - case STREAMTYPE_DVD: - strcpy( mplShMem->Filename,"/dev/dvd" ); - break; + case STREAMTYPE_DVD: + guiSetFilename( guiIntfStruct.Filename,"/dev/dvd" ); + break; #endif } mplPlay(); - mplState(); + mplState(); break; +#ifdef USE_DVDREAD case evSetDVDSubtitle: -#ifdef USE_DVDREAD dvdsub_id=(int)param; - dvd_title=mplShMem->DVD.current_title; - dvd_angle=mplShMem->DVD.current_angle; - dvd_chapter=mplShMem->DVD.current_chapter; - mplShMem->DVDChanged=1; - goto play_dvd_2; -#endif + dvd_title=guiIntfStruct.DVD.current_title; + dvd_angle=guiIntfStruct.DVD.current_angle; + dvd_chapter=guiIntfStruct.DVD.current_chapter; + guiIntfStruct.DVDChanged=1; + goto play_dvd_2; break; case evSetDVDAudio: -#ifdef USE_DVDREAD audio_id=(int)param; - dvd_title=mplShMem->DVD.current_title; - dvd_angle=mplShMem->DVD.current_angle; - dvd_chapter=mplShMem->DVD.current_chapter; - mplShMem->DVDChanged=1; - goto play_dvd_2; -#endif + dvd_title=guiIntfStruct.DVD.current_title; + dvd_angle=guiIntfStruct.DVD.current_angle; + dvd_chapter=guiIntfStruct.DVD.current_chapter; + guiIntfStruct.DVDChanged=1; + goto play_dvd_2; break; case evSetDVDChapter: -#ifdef USE_DVDREAD - dvd_title=mplShMem->DVD.current_title; - dvd_angle=mplShMem->DVD.current_angle; + dvd_title=guiIntfStruct.DVD.current_title; + dvd_angle=guiIntfStruct.DVD.current_angle; dvd_chapter=(int)param; - mplShMem->DVDChanged=1; - goto play_dvd_2; -#endif + guiIntfStruct.DVDChanged=1; + goto play_dvd_2; break; case evSetDVDTitle: -#ifdef USE_DVDREAD dvd_title=(int)param; - dvd_chapter=1; - dvd_angle=1; - mplShMem->DVDChanged=1; - goto play_dvd_2; + dvd_chapter=1; + dvd_angle=1; + guiIntfStruct.DVDChanged=1; + goto play_dvd_2; + break; #endif - break; case evPause: case evPauseSwitchToPlay: @@ -292,42 +287,38 @@ break; case evStop: - IZE("evStop"); // btnModify( evPlaySwitchToPause,btnReleased ); // btnModify( evPauseSwitchToPlay,btnDisabled ); mplMainRender=1; mplStop(); - mplState(); + mplState(); break; case evLoadPlay: mplMainAutoPlay=1; case evLoad: mplMainRender=1; - gtkSendMessage( evLoad ); + gtkShow( evLoad,NULL ); break; case evLoadSubtitle: mplMainRender=1; - gtkSendMessage( evLoadSubtitle ); + gtkShow( evLoadSubtitle,NULL ); break; case evPrev: - IZE("evPrev"); mplMainRender=1; - #ifdef DEBUG - dbprintf( 1,"[mw.h] previous stream ...\n" ); - #endif + mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"[mw.h] previous stream ...\n" ); break; case evNext: - IZE("evNext"); mplMainRender=1; - #ifdef DEBUG - dbprintf( 1,"[mw.h] next stream ...\n" ); - #endif + mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"[mw.h] next stream ...\n" ); break; case evPlayList: IZE("evPlayList"); mplMainRender=1; + gtkShow( evPlayList,NULL ); +#warning disabled old gtk code +#if 0 if ( gtkVisiblePlayList ) { btnModify( evPlayList,btnReleased ); @@ -341,11 +332,12 @@ btnModify( evPlayList,btnPressed ); gtkVisiblePlayList=1; } +#endif break; - case evSkinBrowser: gtkSendMessage( evSkinBrowser ); break; - case evAbout: gtkSendMessage( evAbout ); break; - case evPreferences: gtkSendMessage( evPreferences ); break; + case evSkinBrowser: gtkShow( evSkinBrowser,skinName ); break; + case evAbout: gtkShow( evAbout,NULL ); break; + case evPreferences: gtkShow( evPreferences,NULL ); break; case evForward1min: mplRelSeek( 60 ); break; case evBackward1min: mplRelSeek( -60 ); break; @@ -355,9 +347,9 @@ case evIncVolume: vo_x11_putkey( wsGrayMul ); break; case evDecVolume: vo_x11_putkey( wsGrayDiv ); break; - case evMute: mplShMem->Mute=1; break; + case evMute: guiIntfStruct.Mute=1; break; case evSetVolume: - case evSetBalance: mplShMem->VolumeChanged=1; break; + case evSetBalance: guiIntfStruct.VolumeChanged=1; break; case evIconify: @@ -368,25 +360,25 @@ } break; case evNormalSize: - if ( mplShMem->Playing ) + if ( guiIntfStruct.Playing ) { appMPlayer.subWindow.isFullScreen=True; - appMPlayer.subWindow.OldX=( wsMaxX - moviewidth ) / 2; - appMPlayer.subWindow.OldY=( wsMaxY - movieheight ) / 2; - appMPlayer.subWindow.OldWidth=moviewidth; appMPlayer.subWindow.OldHeight=movieheight; + appMPlayer.subWindow.OldX=( wsMaxX - guiIntfStruct.MovieWidth ) / 2; + appMPlayer.subWindow.OldY=( wsMaxY - guiIntfStruct.MovieHeight ) / 2; + appMPlayer.subWindow.OldWidth=guiIntfStruct.MovieWidth; appMPlayer.subWindow.OldHeight=guiIntfStruct.MovieHeight; wsFullScreen( &appMPlayer.subWindow ); - mplResize( appMPlayer.subWindow.X,appMPlayer.subWindow.Y,moviewidth,movieheight ); + mplResize( appMPlayer.subWindow.X,appMPlayer.subWindow.Y,guiIntfStruct.MovieWidth,guiIntfStruct.MovieHeight ); } break; case evDoubleSize: - if ( mplShMem->Playing ) + if ( guiIntfStruct.Playing ) { appMPlayer.subWindow.isFullScreen=True; - appMPlayer.subWindow.OldX=( wsMaxX - moviewidth * 2 ) / 2; - appMPlayer.subWindow.OldY=( wsMaxY - movieheight * 2 ) / 2; - appMPlayer.subWindow.OldWidth=moviewidth * 2; appMPlayer.subWindow.OldHeight=movieheight * 2; + appMPlayer.subWindow.OldX=( wsMaxX - guiIntfStruct.MovieWidth * 2 ) / 2; + appMPlayer.subWindow.OldY=( wsMaxY - guiIntfStruct.MovieHeight * 2 ) / 2; + appMPlayer.subWindow.OldWidth=guiIntfStruct.MovieWidth * 2; appMPlayer.subWindow.OldHeight=guiIntfStruct.MovieHeight * 2; wsFullScreen( &appMPlayer.subWindow ); - mplResize( appMPlayer.subWindow.X,appMPlayer.subWindow.Y,moviewidth,movieheight ); + mplResize( appMPlayer.subWindow.X,appMPlayer.subWindow.Y,guiIntfStruct.MovieWidth,guiIntfStruct.MovieHeight ); } break; case evFullScreen: @@ -410,30 +402,15 @@ case evRedraw: mplMainRender=1; wsPostRedisplay( &appMPlayer.mainWindow ); -// if ( !mplShMem->Playing ) -// wsPostRedisplay( &appMPlayer.subWindow ); XFlush( wsDisplay ); mplRedrawTimer=mplRedrawTimerConst; break; - case evGeneralTimer: - if ( mplMainAutoPlay ) - { - mplMainRender=1; - mplMainAutoPlay=0; - mplPlay(); - } - if ( mplMiddleMenu ) - { - mplMiddleMenu=0; - mplMsgHandle( gtkShMem->popupmenu,gtkShMem->popupmenuparam ); - } - break; // --- system events case evNone: - dbprintf( 1,"[mw] event none received.\n" ); + mp_msg( MSGT_GPLAYER,MSGL_STATUS,"[mw] event none received.\n" ); break; default: - dbprintf( 1,"[mw] unknown event received ( %d,%.2f ).\n",msg,param ); + mp_msg( MSGT_GPLAYER,MSGL_STATUS,"[mw] unknown event received ( %d,%.2f ).\n",msg,param ); break; } } @@ -503,24 +480,21 @@ switch ( item->msg ) { case evSetVolume: - mplShMem->VolumeChanged=1; - mplShMem->Volume=item->value; + guiIntfStruct.VolumeChanged=1; + guiIntfStruct.Volume=item->value; break; } value=item->value; break; } - mplMsgHandle( item->msg,value ); + mplEventHandling( item->msg,value ); mplMainRender=1; itemtype=0; break; - + case wsPMMouseButton: -#ifdef USE_DVDREAD - memcpy( >kShMem->DVD,&mplShMem->DVD,sizeof( mplDVDStruct ) ); -#endif - gtkSendMessage( evShowPopUpMenu ); - break; + gtkShow( evShowPopUpMenu,NULL ); + break; // --- rolled mouse ... de szar :))) case wsP5MouseButton: value=-2.5f; goto rollerhandled; @@ -535,11 +509,11 @@ switch ( item->msg ) { case evSetVolume: - mplShMem->VolumeChanged=1; - mplShMem->Volume=item->value; + guiIntfStruct.VolumeChanged=1; + guiIntfStruct.Volume=item->value; break; } - mplMsgHandle( item->msg,item->value ); + mplEventHandling( item->msg,item->value ); mplMainRender=1; } break; @@ -567,11 +541,11 @@ switch ( item->msg ) { case evSetVolume: - mplShMem->VolumeChanged=1; - mplShMem->Volume=item->value; + guiIntfStruct.VolumeChanged=1; + guiIntfStruct.Volume=item->value; break; } - mplMsgHandle( item->msg,item->value ); + mplEventHandling( item->msg,item->value ); mplMainRender=1; wsPostRedisplay( &appMPlayer.mainWindow ); break; } @@ -615,7 +589,7 @@ case wsS: msg=evStop; break; case wsp: case wsP: msg=evPlayList; break; - + case wsXF86LowerVolume: msg=evDecVolume; break; case wsXF86RaiseVolume: msg=evIncVolume; break; case wsXF86Mute: msg=evMute; break; @@ -629,7 +603,7 @@ } if ( msg != evNone ) { - mplMsgHandle( msg,0 ); + mplEventHandling( msg,0 ); // mplMainRender=1; // wsPostRedisplay( &appMPlayer.mainWindow ); }
--- a/Gui/mplayer/play.c Sat Feb 23 07:40:25 2002 +0000 +++ b/Gui/mplayer/play.c Sat Feb 23 15:12:55 2002 +0000 @@ -5,30 +5,23 @@ #include <unistd.h> #include <signal.h> -int mplParent = 1; - -int moviex,moviey,moviewidth,movieheight; - -#include "../app.h" - #include "../wm/ws.h" -#include "../wm/wskeys.h" -#include "../wm/widget.h" - #include "../../config.h" #include "../../help_mp.h" #include "../../libvo/x11_common.h" +#include "../app.h" + +#include "../wm/wskeys.h" +#include "../wm/widget.h" +#include "../interface.h" + #include "widgets.h" #include "./mplayer.h" -#include "psignal.h" #include "play.h" #include "../skin/skin.h" -#include "../error.h" - -mplCommStruct * mplShMem; -char * Filename = NULL; +#include "../skin/font.h" extern float rel_seek_secs; extern int abs_seek_pos; @@ -53,7 +46,7 @@ wsWindowDecoration( &appMPlayer.subWindow,0 ); appMPlayer.subWindow.isFullScreen=1; } - if ( mplShMem->Playing ) wsSetBackgroundRGB( &appMPlayer.subWindow,0,0,0 ); + if ( guiIntfStruct.Playing ) wsSetBackgroundRGB( &appMPlayer.subWindow,0,0,0 ); else wsSetBackgroundRGB( &appMPlayer.subWindow,appMPlayer.subR,appMPlayer.subG,appMPlayer.subB ); wsVisibleWindow( &appMPlayer.subWindow,wsShowWindow ); mplResize( 0,0,appMPlayer.subWindow.Width,appMPlayer.subWindow.Height ); @@ -63,11 +56,11 @@ void mplStop() { - mplShMem->Playing=0; - mplShMem->TimeSec=0; - mplShMem->Position=0; - mplShMem->AudioType=0; -// if ( !mplShMem->Playing ) return; + guiIntfStruct.Playing=0; + guiIntfStruct.TimeSec=0; + guiIntfStruct.Position=0; + guiIntfStruct.AudioType=0; +// if ( !guiIntfStruct.Playing ) return; if ( !appMPlayer.subWindow.isFullScreen ) { wsResizeWindow( &appMPlayer.subWindow,appMPlayer.sub.width,appMPlayer.sub.height ); @@ -81,30 +74,31 @@ void mplPlay( void ) { - if ( ( mplShMem->Filename[0] == 0 )|| - ( mplShMem->Playing == 1 ) ) return; - if ( mplShMem->Playing == 2 ) { mplPause(); return; } - mplShMem->Playing=1; + if ( ( !guiIntfStruct.Filename )|| + ( guiIntfStruct.Filename[0] == 0 )|| + ( guiIntfStruct.Playing == 1 ) ) return; + if ( guiIntfStruct.Playing == 2 ) { mplPause(); return; } + guiIntfStruct.Playing=1; mplSubRender=0; wsSetBackgroundRGB( &appMPlayer.subWindow,0,0,0 ); - wsClearWindow( appMPlayer.subWindow ); + wsClearWindow( appMPlayer.subWindow ); wsPostRedisplay( &appMPlayer.subWindow ); } void mplPause( void ) { - switch( mplShMem->Playing ) + switch( guiIntfStruct.Playing ) { case 1: // playing - mplShMem->Playing=2; -// btnModify( evPlaySwitchToPause,btnReleased ); -// btnModify( evPauseSwitchToPlay,btnDisabled ); - break; + guiIntfStruct.Playing=2; +// btnModify( evPlaySwitchToPause,btnReleased ); +// btnModify( evPauseSwitchToPlay,btnDisabled ); + break; case 2: // paused - mplShMem->Playing=1; -// btnModify( evPlaySwitchToPause,btnDisabled ); -// btnModify( evPauseSwitchToPlay,btnReleased ); - break; + guiIntfStruct.Playing=1; +// btnModify( evPlaySwitchToPause,btnDisabled ); +// btnModify( evPauseSwitchToPlay,btnReleased ); + break; } mplState(); mplSubRender=0; @@ -112,12 +106,12 @@ void mplState( void ) { - if ( ( mplShMem->Playing == 0 )||( mplShMem->Playing == 2 ) ) + if ( ( guiIntfStruct.Playing == 0 )||( guiIntfStruct.Playing == 2 ) ) { btnModify( evPlaySwitchToPause,btnReleased ); btnModify( evPauseSwitchToPlay,btnDisabled ); } - else + else { btnModify( evPlaySwitchToPause,btnDisabled ); btnModify( evPauseSwitchToPlay,btnReleased ); @@ -130,19 +124,13 @@ void mplMPlayerInit( int argc,char* argv[], char *envp[] ) { - struct sigaction sa; - - mplShMem=calloc( 1,sizeof( mplCommStruct ) ); - mplShMem->Balance=50.0f; - mplShMem->StreamType=-1; - memset(&sa, 0, sizeof(sa)); - sa.sa_handler = mplMainSigHandler; - sigaction( SIGTYPE,&sa,NULL ); + guiIntfStruct.Balance=50.0f; + guiIntfStruct.StreamType=-1; } float mplGetPosition( void ) { // return 0.0 ... 100.0 - return mplShMem->Position; + return guiIntfStruct.Position; } void mplRelSeek( float s ) @@ -157,27 +145,22 @@ listItems tmpList; -void ChangeSkin( void ) +void ChangeSkin( char * name ) { int ret; - if ( !strcmp( skinName,gtkShMem->sb.name ) ) return; -#ifdef DEBUG - dbprintf( 1,"[psignal] skin: %s\n",gtkShMem->sb.name ); -#endif - +// if ( !strcmp( skinName,name ) ) return; mainVisible=0; appInitStruct( &tmpList ); skinAppMPlayer=&tmpList; fntFreeFont(); - ret=skinRead( gtkShMem->sb.name ); + ret=skinRead( name ); appInitStruct( &tmpList ); skinAppMPlayer=&appMPlayer; appInitStruct( &appMPlayer ); - if ( !ret ) strcpy( skinName,gtkShMem->sb.name ); - skinRead( skinName ); - if ( ret ) + if ( ret ) name=skinName; + if ( skinRead( name ) ) { mainVisible=1; return; @@ -187,21 +170,21 @@ { if ( mplMenuDrawBuffer ) free( mplMenuDrawBuffer ); if ( ( mplMenuDrawBuffer = (unsigned char *)calloc( 1,appMPlayer.menuBase.Bitmap.ImageSize ) ) == NULL ) - { message( False,MSGTR_NEMDB ); return; } + { mp_msg( MSGT_GPLAYER,MSGL_STATUS,MSGTR_NEMDB ); return; } wsResizeWindow( &appMPlayer.menuWindow,appMPlayer.menuBase.width,appMPlayer.menuBase.height ); wsResizeImage( &appMPlayer.menuWindow,appMPlayer.menuBase.width,appMPlayer.menuBase.height ); } if ( appMPlayer.sub.Bitmap.Image ) wsResizeImage( &appMPlayer.subWindow,appMPlayer.sub.Bitmap.Width,appMPlayer.sub.Bitmap.Height ); - if ( ( !appMPlayer.subWindow.isFullScreen )&&( !mplShMem->Playing ) ) + if ( ( !appMPlayer.subWindow.isFullScreen )&&( !guiIntfStruct.Playing ) ) { wsResizeWindow( &appMPlayer.subWindow,appMPlayer.sub.width,appMPlayer.sub.height ); wsMoveWindow( &appMPlayer.subWindow,True,appMPlayer.sub.x,appMPlayer.sub.y ); - } + } if ( appMPlayer.sub.Bitmap.Image ) wsConvert( &appMPlayer.subWindow,appMPlayer.sub.Bitmap.Image,appMPlayer.sub.Bitmap.ImageSize ); - if ( !mplShMem->Playing ) + if ( !guiIntfStruct.Playing ) { - mplSubRender=1; + mplSubRender=1; wsSetBackgroundRGB( &appMPlayer.subWindow,appMPlayer.subR,appMPlayer.subG,appMPlayer.subB ); wsClearWindow( appMPlayer.subWindow ); wsPostRedisplay( &appMPlayer.subWindow ); @@ -209,7 +192,7 @@ if ( mplDrawBuffer ) free( mplDrawBuffer ); if ( ( mplDrawBuffer = (unsigned char *)calloc( 1,appMPlayer.main.Bitmap.ImageSize ) ) == NULL ) - { message( False,MSGTR_NEMDB ); return; } + { mp_msg( MSGT_GPLAYER,MSGL_STATUS,MSGTR_NEMDB ); return; } wsVisibleWindow( &appMPlayer.mainWindow,wsHideWindow ); wsResizeWindow( &appMPlayer.mainWindow,appMPlayer.main.width,appMPlayer.main.height ); wsMoveWindow( &appMPlayer.mainWindow,True,appMPlayer.main.x,appMPlayer.main.y ); @@ -218,10 +201,10 @@ wsWindowDecoration( &appMPlayer.mainWindow,appMPlayer.mainDecoration ); mainVisible=1; mplMainRender=1; wsPostRedisplay( &appMPlayer.mainWindow ); wsVisibleWindow( &appMPlayer.mainWindow,wsShowWindow ); - - btnModify( evSetVolume,mplShMem->Volume ); - btnModify( evSetBalance,mplShMem->Balance ); - btnModify( evSetMoviePosition,mplShMem->Position ); + + btnModify( evSetVolume,guiIntfStruct.Volume ); + btnModify( evSetBalance,guiIntfStruct.Balance ); + btnModify( evSetMoviePosition,guiIntfStruct.Position ); btnModify( evFullScreen,!appMPlayer.subWindow.isFullScreen ); } @@ -231,10 +214,12 @@ { wsResizeWindow( &appMPlayer.subWindow,width,height ); wsMoveWindow( &appMPlayer.subWindow,True,appMPlayer.sub.x,appMPlayer.sub.y ); - } + } } void mplSetFileName( char * fname ) { - if ( ( fname )&&( gtkShMem ) ) strcpy( gtkShMem->fs.filename,fname ); + if ( !fname ) return; + if ( guiIntfStruct.Filename ) free( guiIntfStruct.Filename ); + guiIntfStruct.Filename=strdup( fname ); }
--- a/Gui/mplayer/play.h Sat Feb 23 07:40:25 2002 +0000 +++ b/Gui/mplayer/play.h Sat Feb 23 15:12:55 2002 +0000 @@ -4,99 +4,8 @@ #include "../../config.h" -#include "./psignal.h" #include "./mplayer.h" -#ifdef USE_DVDREAD - #include "../../libmpdemux/stream.h" -#endif - -typedef struct -{ - int x; - int y; - int width; - int height; -} mplResizeStruct; - -typedef struct -{ - int signal; - char module[512]; -} mplUnknowErrorStruct; - -typedef struct -{ - int seek; - int format; - int width; - int height; - char codecdll[128]; -} mplVideoStruct; - -#ifdef USE_DVDREAD -typedef struct -{ - int titles; - int chapters; - int angles; - int current_chapter; - int current_title; - int current_angle; - int nr_of_audio_channels; - stream_language_t audio_streams[32]; - int nr_of_subtitles; - stream_language_t subtitles[32]; -} mplDVDStruct; -#endif - -typedef struct -{ - int message; - mplResizeStruct resize; - mplVideoStruct videodata; - mplUnknowErrorStruct error; -#ifdef USE_DVDREAD - mplDVDStruct DVD; - int DVDChanged; -#endif - - int Playing; - float Position; - - float Volume; - int VolumeChanged; - float Balance; - int Mute; - - int Track; - int AudioType; - int StreamType; - int TimeSec; - int LengthInSec; - int FrameDrop; - - char Filename[4096]; - int FilenameChanged; - - char Subtitlename[4096]; - int SubtitleChanged; - - int SkinChange; -} mplCommStruct; - -extern mplCommStruct * mplShMem; -extern char * Filename; - -extern int mplParent; - -extern int moviex; -extern int moviey; -extern int moviewidth; -extern int movieheight; - -extern mplCommStruct * mplShMem; - extern void mplMPlayerInit( int argc,char* argv[], char *envp[] ); extern void mplStop(); @@ -118,7 +27,7 @@ extern void mplSigHandler( int s ); extern void mplPlayerThread( void ); -extern void ChangeSkin( void ); +extern void ChangeSkin( char * name ); extern void EventHandling( void ); extern void mplSetFileName( char * fname );
--- a/Gui/mplayer/psignal.c Sat Feb 23 07:40:25 2002 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,234 +0,0 @@ - -#include <stdlib.h> -#include <stdio.h> -#include <string.h> -#include <signal.h> -#include <unistd.h> -#include <inttypes.h> - -#include "widgets.h" -#include "gtk/menu.h" -#include "play.h" -#include "gtk/fs.h" - -#include "../app.h" - -#include "../../config.h" -#include "../../help_mp.h" -#include "../../libvo/x11_common.h" -#include "../../libmpdemux/stream.h" - -#include "../skin/skin.h" -#include "../wm/ws.h" -#include "../error.h" - -#include "./mplayer.h" - -#define gtkShow( w ) gtkShMem->vs.window=w; gtkSendMessage( evShowWindow ); - -pid_t mplMPlayerPID = 0; -pid_t mplParentPID = 0; - -pid_t gtkPID = 0; - -int mplCriticalError = 0; -int gtkIsOk = 0; - -void mplErrorHandler( int critical,const char * format, ... ) -{ - char * p; - va_list ap; - int n; - - if ( (p=(char *)malloc( 512 ) ) == NULL ) return; - va_start( ap,format ); - n=vsnprintf( p,512,format,ap ); - va_end( ap ); - mplCriticalError=critical; - gtkMessageBox( GTK_MB_ERROR,p ); -} - -void gtkSigHandler( int s ) -{ - if ( s != SIGTYPE ) return; - #ifdef DEBUG - dbprintf( 5,"[psignal] gtk sig handler msg: %d\n",gtkShMem->message ); - #endif - switch ( gtkShMem->message ) - { - case evHideWindow: - switch ( gtkShMem->vs.window ) - { - case evPlayList: gtk_widget_hide( PlayList ); gtkVisiblePlayList=0; break; - case evSkinBrowser: gtk_widget_hide( SkinBrowser ); gtkVisibleSkinBrowser=0; break; - case evLoad: gtk_widget_hide( FileSelect ); gtkVisibleFileSelect=0; break; - } - break; - case evSkinBrowser: - if ( gtkVisibleSkinBrowser ) gtk_widget_hide( SkinBrowser ); - gtkClearList( SkinList ); - if ( gtkFillSkinList( sbMPlayerPrefixDir )&>kFillSkinList( sbMPlayerDirInHome ) ) - { - gtkSetDefaultToCList( SkinList,skinName ); - gtk_widget_show( SkinBrowser ); - gtkVisibleSkinBrowser=1; - gtkShow( evSkinBrowser ); - } - break; - case evPreferences: - if ( gtkVisibleOptions ) gtk_widget_hide( Options ); - gtk_widget_show( Options ); - gtkVisibleOptions=1; - break; - case evPlayList: - if ( gtkVisiblePlayList ) gtk_widget_hide( PlayList ); - gtk_widget_show( PlayList ); - gtkVisiblePlayList=1; - gtkShow( evPlayList ); - break; - case evLoad: - ShowFileSelect( fsVideoSelector ); -#if 0 - if ( gtkVisibleFileSelect ) gtk_widget_hide( FileSelect ); - gtk_widget_show( FileSelect ); - gtkVisibleFileSelect=1; - gtkShow( evPlay ); -#endif - break; - case evFirstLoad: - ShowFileSelect( fsVideoSelector ); -#if 0 - if ( gtkVisibleFileSelect ) gtk_widget_hide( FileSelect ); - gtk_widget_show( FileSelect ); - gtkVisibleFileSelect=1; - gtkShow( evFirstLoad ); -#endif - break; - case evLoadSubtitle: - ShowFileSelect( fsSubtitleSelector ); -// gtkShow( evPlay ); - break; - case evMessageBox: - gtk_label_set_text( GTK_LABEL( gtkMessageBoxText ),gtkShMem->mb.str ); - if( gtkVisibleMessageBox ) gtk_widget_hide( MessageBox ); - switch( gtkShMem->mb.type) - { - case GTK_MB_FATAL: - gtk_window_set_title( GTK_WINDOW( MessageBox ),MSGTR_MSGBOX_LABEL_FatalError ); - gtk_widget_hide( WarningPixmap ); - gtk_widget_show( ErrorPixmap ); - break; - case GTK_MB_ERROR: - gtk_window_set_title( GTK_WINDOW( MessageBox ),MSGTR_MSGBOX_LABEL_Error ); - gtk_widget_hide( WarningPixmap ); - gtk_widget_show( ErrorPixmap ); - break; - case GTK_MB_WARNING: - gtk_window_set_title( GTK_WINDOW( MessageBox ),MSGTR_MSGBOX_LABEL_Warning ); - gtk_widget_show( WarningPixmap ); - gtk_widget_hide( ErrorPixmap ); - break; - } - gtk_widget_show( MessageBox ); - gtkVisibleMessageBox=1; - break; - case evAbout: - if ( gtkVisibleAboutBox ) gtk_widget_hide( AboutBox ); - gtk_widget_show( AboutBox ); - gtkVisibleAboutBox=1; - break; - case evExit: - gtk_main_quit(); - break; - case evShowPopUpMenu: - gtkShMem->popupmenu=evNone; gtkShMem->popupmenuparam=0; - if ( gtkShMem->visiblepopupmenu ) gtk_widget_hide_on_delete( PopUpMenu ); - PopUpMenu=create_PopUpMenu(); - gtk_menu_popup( GTK_MENU( PopUpMenu ),NULL,NULL,NULL,NULL,0,0 ); - gtkShMem->visiblepopupmenu=1; - break; - case evHidePopUpMenu: - if ( gtkShMem->visiblepopupmenu ) gtk_widget_hide_on_delete( PopUpMenu ); - gtkShMem->visiblepopupmenu=0; - break; - } - gtkShMem->message=0; -} - -void mplMainSigHandler( int s ) -{ - if ( s != SIGTYPE ) return; - -// #ifdef DEBUG -// if ( gtkShMem->message ) dbprintf( 5,"[psignal] main sig handler gtk msg: %d\n",gtkShMem->message ); -// if ( mplShMem->message ) dbprintf( 5,"[psignal] main sig handler mpl msg: %d\n",mplShMem->message ); -// #endif - - switch ( gtkShMem->message ) - { - case evGtkIsOk: - #ifdef DEBUG - dbprintf( 5,"[psignal] gtk is ok.\n" ); - #endif - gtkIsOk=True; - break; - case evShowWindow: - switch ( gtkShMem->vs.window ) - { - case evPlayList: gtkVisiblePlayList=1; break; - case evLoad: gtkVisibleFileSelect=1; break; - case evSkinBrowser: gtkVisibleSkinBrowser=1; break; - } - break; - case evHideWindow: - switch ( gtkShMem->vs.window ) - { - case evPlayList: - btnModify( evPlayList,btnReleased ); gtkVisiblePlayList=0; - mplMainRender=1; wsPostRedisplay( &appMPlayer.mainWindow ); - break; - case evSkinBrowser: gtkVisibleSkinBrowser=0; break; - case evLoad: gtkVisibleFileSelect=0; break; - } - break; - case evSkinBrowser: mplShMem->SkinChange=1; break; - case evFileLoaded: - printf("*** gtkShMem->fs.dir == '%s' \n",gtkShMem->fs.dir); - printf("*** gtkShMem->fs.filename == '%s' \n",gtkShMem->fs.filename); - strcpy( mplShMem->Filename,gtkShMem->fs.dir ); - strcat( mplShMem->Filename,"/" ); - strcat( mplShMem->Filename,gtkShMem->fs.filename ); - printf( "%%%%%%%% Playing file: %s\n",mplShMem->Filename ); - mplShMem->FilenameChanged=1; - mplShMem->StreamType=STREAMTYPE_FILE; - if ( mplMainAutoPlay ) mplGeneralTimer=1; - break; - case evSubtitleLoaded: - printf("*** gtkShMem->fs.subtitlename == '%s' \n",gtkShMem->fs.subtitlename ); - strcpy( mplShMem->Subtitlename,gtkShMem->fs.subtitlename ); - mplShMem->SubtitleChanged=1; - break; - case evShowPopUpMenu: - fprintf( stderr,"[psignal] PopUpMenu: %d param: %d\n",gtkShMem->popupmenu,gtkShMem->popupmenuparam ); - mplMiddleMenu=1; mplGeneralTimer=1; - break; - case evMessageBox: - if ( mplCriticalError ) - { gtkSendMessage( evExit ); exit( 1 ); } - mplCriticalError=0; - break; - } - -// switch( mplShMem->message ) -// { -// } - gtkShMem->message=0; -// mplShMem->message=0; -} - -void gtkSendMessage( int msg ) -{ - if ( !gtkIsOk ) return; - gtkShMem->message=msg; - kill( gtkPID,SIGTYPE ); -}
--- a/Gui/mplayer/psignal.h Sat Feb 23 07:40:25 2002 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,69 +0,0 @@ - -#ifndef __GUI_SIGNAL -#define __GUI_SIGNAL - -#include <stdlib.h> -#include <stdio.h> -#include <string.h> -#include <unistd.h> -#include <signal.h> - -#define mplNoneEvent 0 -#define mplResizeEvent 1 -#define mplQuit 2 -#define mplPauseEvent 3 -#define mplEndOfFile 4 -#define mplExposeEvent 5 -#define mplSetVideoData 6 -#define mplAudioError 7 -#define mplUnknowError 8 -#define mplSeekEvent 9 -#define mplUnknowFileType 10 -#define mplCodecConfNotFound 11 -#define mplErrorDVDKeyProcess 12 -#define mplErrorDVDAuth 13 -#define mplErrorAVINI 14 -#define mplAVIErrorMissingVideoStream 15 -#define mplASFErrorMissingVideoStream 16 -#define mplMPEGErrorSeqHeaderSearch 17 -#define mplErrorShMemAlloc 18 -#define mplMPEGErrorCannotReadSeqHeader 19 -#define mplMPEGErrorBadSeqHeader 20 -#define mplMPEGErrorCannotReadSeqHeaderExt 21 -#define mplMPEGErrorBadSeqHeaderExt 22 -#define mplCantFindCodecForVideoFormat 23 -#define mplIncompatibleVideoOutDevice 24 -#define mplCompileWithoutDSSupport 25 -#define mplDSCodecNotFound 26 -#define mplCantInitVideoDriver 27 -#define mplIncAudioBufferDelay 28 -#define mplDecAudioBufferDelay 29 - -#ifndef SIGTYPE -#ifdef SIGUSR2 -#define SIGTYPE SIGUSR2 -//#warning should we use SIGUSR1 or SIGUSR2 on linux, bsd, ... too? -#else -#ifdef __bsdi__ -#define _NSIG NSIG -#endif -#define SIGTYPE _NSIG - 1 -#endif -#endif - -extern int gtkIsOk; - -extern pid_t mplMPlayerPID; -extern pid_t mplParentPID; - -extern pid_t gtkPID; - -extern void gtkSigHandler( int s ); -extern void mplPlayerSigHandler( int s ); -extern void mplMainSigHandler( int s ); - -extern void gtkSendMessage( int msg ); - -extern void mplErrorHandler( int critical,const char * format, ... ); - -#endif
--- a/Gui/mplayer/sw.h Sat Feb 23 07:40:25 2002 +0000 +++ b/Gui/mplayer/sw.h Sat Feb 23 15:12:55 2002 +0000 @@ -11,7 +11,7 @@ if ( !appMPlayer.subWindow.Mapped || appMPlayer.subWindow.Visible == wsWindowNotVisible ) return; - if ( mplShMem->Playing ) mplSubRender=0; + if ( guiIntfStruct.Playing ) mplSubRender=0; if ( mplSubRender ) { @@ -28,18 +28,15 @@ mplMouseTimer=mplMouseTimerConst; wsVisibleMouse( &appMPlayer.subWindow,wsShowMouseCursor ); - + switch( Button ) { case wsPMMouseButton: -#ifdef USE_DVDREAD - memcpy( >kShMem->DVD,&mplShMem->DVD,sizeof( mplDVDStruct ) ); -#endif - gtkSendMessage( evShowPopUpMenu ); + gtkShow( evShowPopUpMenu,NULL ); break; case wsPRMouseButton: - if ( gtkShMem->visiblepopupmenu ) gtkSendMessage( evHidePopUpMenu ); + gtkShow( evHidePopUpMenu,NULL ); mplShowMenu( RX,RY ); msButton=wsPRMouseButton; break; @@ -50,13 +47,13 @@ // --- case wsPLMouseButton: if ( appMPlayer.subWindow.isFullScreen ) - { + { if( ++SubVisible%2 ) wsMoveTopWindow( &appMPlayer.mainWindow ); else wsMoveTopWindow( &appMPlayer.subWindow ); mplSubMoved=1; - break; - } - if ( gtkShMem->visiblepopupmenu ) gtkSendMessage( evHidePopUpMenu ); + break; + } + gtkShow( evHidePopUpMenu,NULL ); sx=X; sy=Y; msButton=wsPLMouseButton; mplSubMoved=0;
--- a/Gui/mplayer/widgets.c Sat Feb 23 07:40:25 2002 +0000 +++ b/Gui/mplayer/widgets.c Sat Feb 23 15:12:55 2002 +0000 @@ -17,12 +17,14 @@ #include "widgets.h" #include "./mplayer.h" -#include "psignal.h" #include "../events.h" +#include "gtk/menu.h" +#include "play.h" +#include "gtk/fs.h" + #include "../../config.h" #include "../../help_mp.h" -#include "../error.h" GtkWidget * SkinBrowser; GtkWidget * PlayList; @@ -36,14 +38,8 @@ GtkWidget * WarningPixmap; GtkWidget * ErrorPixmap; -int gtkVisibleSkinBrowser = 0; -int gtkVisiblePlayList = 0; -int gtkVisibleFileSelect = 0; -int gtkVisibleMessageBox = 0; -int gtkVisibleAboutBox = 0; -int gtkVisibleOptions = 0; - -gtkCommStruct * gtkShMem; +int gtkPopupMenu = 0; +int gtkPopupMenuParam = 0; #include "gtk/sb.h" #include "gtk/pl.h" @@ -64,65 +60,18 @@ // PopUpMenu=create_PopUpMenu(); } -// --- forked function - -extern char *mDisplayName; - -static void gtkThreadProc( int argc,char * argv[] ) -{ - struct sigaction sa; - - #ifdef HAVE_RTC - setuid( getuid() ); // strongly test, please check this. - #endif - - gtk_set_locale(); - { - char tmp[128]; - sprintf( tmp,"--display=%s",mDisplayName ); - argv[argc++]=strdup( tmp ); - gtk_init( &argc,&argv ); - } - gdk_set_use_xshm( TRUE ); - printf( "[gtk] display: %s\n",gdk_get_display() ); - - widgetsCreate(); - - gtkPID=getppid(); - - memset(&sa, 0, sizeof(sa)); - sa.sa_handler = gtkSigHandler; - sigaction( SIGTYPE, &sa, NULL ); - - gtkIsOk=True; - gtkSendMessage( evGtkIsOk ); - - gtk_main(); - printf( "[gtk] exit.\n" ); - exit( 0 ); -} - // --- init & close gtk void gtkInit( int argc,char* argv[], char *envp[] ) { - gtkShMem=shmem_alloc( sizeof( gtkCommStruct ) ); - if ( ( gtkPID = fork() ) == 0 ) gtkThreadProc( argc,argv ); + gtk_set_locale(); + gtk_init( &argc,&argv ); + gdk_set_use_xshm( TRUE ); + widgetsCreate(); } -void gtkDone( void ){ - gtkSendMessage(evExit); - usleep(50000); // 50ms should be enough! - printf("gtk killed...\n"); - kill( gtkPID,SIGKILL ); -} - -void gtkMessageBox( int type,gchar * str ) +void gtkDone( void ) { - if ( !gtkIsOk ) return; - gtkShMem->mb.type=type; - strcpy( gtkShMem->mb.str,str ); - gtkSendMessage( evMessageBox ); } void gtkClearList( GtkWidget * list ) @@ -146,3 +95,82 @@ if ( ( i=gtkFindCList( list,item ) ) > -1 ) gtk_clist_select_row( GTK_CLIST( list ),i,0 ); } +void gtkEventHandling( void ) +{ + int i; + for( i=0;i < 25;i++ ) gtk_main_iteration_do( 0 ); +} + +// --- funcs + +void gtkMessageBox( int type,gchar * str ) +{ + gtk_label_set_text( GTK_LABEL( gtkMessageBoxText ),str ); + gtk_widget_hide( MessageBox ); + switch( type) + { + case GTK_MB_FATAL: + gtk_window_set_title( GTK_WINDOW( MessageBox ),MSGTR_MSGBOX_LABEL_FatalError ); + gtk_widget_hide( WarningPixmap ); + gtk_widget_show( ErrorPixmap ); + break; + case GTK_MB_ERROR: + gtk_window_set_title( GTK_WINDOW( MessageBox ),MSGTR_MSGBOX_LABEL_Error ); + gtk_widget_hide( WarningPixmap ); + gtk_widget_show( ErrorPixmap ); + break; + case GTK_MB_WARNING: + gtk_window_set_title( GTK_WINDOW( MessageBox ),MSGTR_MSGBOX_LABEL_Warning ); + gtk_widget_show( WarningPixmap ); + gtk_widget_hide( ErrorPixmap ); + break; + } + gtk_widget_show( MessageBox ); +} + +void gtkShow( int type,char * param ) +{ + switch( type ) + { + case evSkinBrowser: + gtk_widget_hide( SkinBrowser ); + gtkClearList( SkinList ); + if ( gtkFillSkinList( sbMPlayerPrefixDir )&>kFillSkinList( sbMPlayerDirInHome ) ) + { + gtkSetDefaultToCList( SkinList,param ); + gtk_widget_show( SkinBrowser ); + } + break; + case evPreferences: + gtk_widget_hide( Options ); + gtk_widget_show( Options ); + break; + case evPlayList: + gtk_widget_hide( PlayList ); + gtk_widget_show( PlayList ); + break; + case evLoad: + ShowFileSelect( fsVideoSelector ); + break; + case evFirstLoad: + ShowFileSelect( fsVideoSelector ); + break; + case evLoadSubtitle: + ShowFileSelect( fsSubtitleSelector ); + break; + case evAbout: + gtk_widget_hide( AboutBox ); + gtk_widget_show( AboutBox ); + break; + case evShowPopUpMenu: + gtkPopupMenu=evNone; + gtkPopupMenuParam=0; + gtk_widget_hide_on_delete( PopUpMenu ); + PopUpMenu=create_PopUpMenu(); + gtk_menu_popup( GTK_MENU( PopUpMenu ),NULL,NULL,NULL,NULL,0,0 ); + break; + case evHidePopUpMenu: + gtk_widget_hide_on_delete( PopUpMenu ); + break; + } +}
--- a/Gui/mplayer/widgets.h Sat Feb 23 07:40:25 2002 +0000 +++ b/Gui/mplayer/widgets.h Sat Feb 23 15:12:55 2002 +0000 @@ -2,12 +2,16 @@ #ifndef __MY_WIDGET #define __MY_WIDGET +#include <stdio.h> +#include <stdlib.h> #include <gdk/gdkkeysyms.h> #include <gtk/gtk.h> #include "../../config.h" #include "../../linux/shmem.h" #include "play.h" +#include "mplayer.h" +#include "../interface.h" #define GTK_MB_SIMPLE 0 #define GTK_MB_MODAL 1 @@ -15,59 +19,6 @@ #define GTK_MB_ERROR 4 #define GTK_MB_WARNING 8 -typedef struct -{ - char dir[ 2048 ]; - char filename[ 2048 ]; - char subtitlename[ 4096 ]; - char otherfilename[ 4096 ]; -} gtkFileSelectorStruct; - -typedef struct -{ - int sx; - int sy; - int tsx; - int tsy; - int type; - char str[512]; -} gtkMessageBoxStruct; - -typedef struct -{ - char name[128]; -} gtkSkinStruct; - -typedef struct -{ - int window; -} gtkVisibleStruct; - -typedef struct -{ - int i; -} gtkOptionsStruct; - -typedef struct -{ - int message; - gtkFileSelectorStruct fs; - gtkMessageBoxStruct mb; - gtkSkinStruct sb; - gtkVisibleStruct vs; - gtkOptionsStruct op; - -#ifdef USE_DVDREAD - mplDVDStruct DVD; -#endif - - int popupmenu; - int popupmenuparam; - int visiblepopupmenu; -} gtkCommStruct; - -extern gtkCommStruct * gtkShMem; - extern GtkWidget * SkinBrowser; extern GtkWidget * PlayList; extern GtkWidget * FileSelect; @@ -83,12 +34,8 @@ extern GtkWidget * SkinList; extern GtkWidget * gtkMessageBoxText; -extern int gtkVisibleSkinBrowser; -extern int gtkVisiblePlayList; -extern int gtkVisibleFileSelect; -extern int gtkVisibleMessageBox; -extern int gtkVisibleAboutBox; -extern int gtkVisibleOptions; +extern int gtkPopupMenu; +extern int gtkPopupMenuParam; extern char * sbMPlayerDirInHome; extern char * sbMPlayerPrefixDir; @@ -97,10 +44,15 @@ extern void gtkInit( int argc,char* argv[], char *envp[] ); extern void gtkDone( void ); -extern void gtkMessageBox( int type,gchar * str ); + extern int gtkFillSkinList( gchar * dir ); extern void gtkClearList( GtkWidget * list ); extern void gtkSetDefaultToCList( GtkWidget * list,char * item ); extern int gtkFindCList( GtkWidget * list,char * item ); +extern void gtkEventHandling( void ); + +extern void gtkShow( int type,char * param ); +extern void gtkMessageBox( int type,gchar * str ); + #endif
--- a/Gui/skin/font.c Sat Feb 23 07:40:25 2002 +0000 +++ b/Gui/skin/font.c Sat Feb 23 15:12:55 2002 +0000 @@ -7,7 +7,7 @@ #include "skin.h" #include "font.h" #include "cut.h" -#include "../error.h" +#include "../../mp_msg.h" int items; @@ -44,8 +44,7 @@ unsigned char * ptmp; unsigned char command[32]; unsigned char param[256]; - int c,i; - int linenumber = 0; + int c,linenumber = 0; strcpy( tmp,path ); strcat( tmp,fname ); strcat( tmp,".fnt" ); if ( ( f=fopen( tmp,"rt" ) ) == NULL ) return -1; @@ -55,7 +54,7 @@ c=tmp[ strlen( tmp ) - 1 ]; if ( ( c == '\n' )||( c == '\r' ) ) tmp[ strlen( tmp ) - 1 ]=0; c=tmp[ strlen( tmp ) - 1 ]; if ( ( c == '\n' )||( c == '\r' ) ) tmp[ strlen( tmp ) - 1 ]=0; - for ( c=0;c < strlen( tmp );c++ ) + for ( c=0;c < (int)strlen( tmp );c++ ) if ( tmp[c] == ';' ) { tmp[c]=0; @@ -76,18 +75,14 @@ cutItem( param,tmp,',',1 ); Fonts[id]->Fnt[i].y=atoi( tmp ); cutItem( param,tmp,',',2 ); Fonts[id]->Fnt[i].sx=atoi( tmp ); cutItem( param,tmp,',',3 ); Fonts[id]->Fnt[i].sy=atoi( tmp ); - #ifdef DEBUG - dbprintf( 3,"[font] char: '%s' params: %d,%d %dx%d\n",command,Fonts[id]->Fnt[i].x,Fonts[id]->Fnt[i].y,Fonts[id]->Fnt[i].sx,Fonts[id]->Fnt[i].sy ); - #endif + mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"[font] char: '%s' params: %d,%d %dx%d\n",command,Fonts[id]->Fnt[i].x,Fonts[id]->Fnt[i].y,Fonts[id]->Fnt[i].sx,Fonts[id]->Fnt[i].sy ); } else { if ( !strcmp( command,"image" ) ) { strcpy( tmp,path ); strcat( tmp,param ); - #ifdef DEBUG - dbprintf( 3,"[font] font imagefile: %s\n",tmp ); - #endif + mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"[font] font imagefile: %s\n",tmp ); if ( skinBPRead( tmp,&Fonts[id]->Bitmap ) ) return -2; } } @@ -109,7 +104,7 @@ int size = 0; int i; if ( !Fonts[id] ) return 0; - for ( i=0;i < strlen( str );i++ ) + for ( i=0;i < (int)strlen( str );i++ ) if ( Fonts[id]->Fnt[ (int)str[i] ].sx != -1 ) size+=Fonts[id]->Fnt[ (int)str[i] ].sx; return size; } @@ -118,7 +113,7 @@ { int max = 0,i; if ( !Fonts[id] ) return 0; - for ( i=0;i < strlen( str );i++ ) + for ( i=0;i < (int)strlen( str );i++ ) if ( Fonts[id]->Fnt[ (int)str[i] ].sy > max ) max=Fonts[id]->Fnt[ (int)str[i] ].sy; return max; } @@ -150,7 +145,7 @@ obuf=(unsigned long *)tmp->Image; ibuf=(unsigned long *)Fonts[id]->Bitmap.Image; - for ( i=0;i < strlen( p );i++ ) + for ( i=0;i < (int)strlen( p );i++ ) { int c = (int)p[i]; if ( Fonts[id]->Fnt[c].x == -1 ) c=32;
--- a/Gui/skin/skin.c Sat Feb 23 07:40:25 2002 +0000 +++ b/Gui/skin/skin.c Sat Feb 23 15:12:55 2002 +0000 @@ -1,10 +1,9 @@ - + #include <stdio.h> #include <stdlib.h> #include <string.h> #include "cut.h" -#include "error.h" #include "font.h" #include "../app.h" @@ -31,14 +30,15 @@ vsnprintf( p,512,format,ap ); va_end( ap ); // message( False,"[skin] error in skin config file on line %d: %s",linenumber,p ); - message( False,MSGTR_SKIN_ERRORMESSAGE,linenumber,p ); +// message( False,MSGTR_SKIN_ERRORMESSAGE,linenumber,p ); + mp_msg( MSGT_GPLAYER,MSGL_STATUS,MSGTR_SKIN_ERRORMESSAGE,linenumber,p ); } #define CHECKDEFLIST( str ) \ { \ if ( defList == NULL ) \ { \ - message( False,MSGTR_SKIN_WARNING1,linenumber,str ); \ + mp_msg( MSGT_GPLAYER,MSGL_STATUS,MSGTR_SKIN_WARNING1,linenumber,str ); \ return 1; \ } \ } @@ -47,7 +47,7 @@ { \ if ( !strlen( winList ) ) \ { \ - message( False,MSGTR_SKIN_WARNING2,linenumber,str ); \ + mp_msg( MSGT_GPLAYER,MSGL_STATUS,MSGTR_SKIN_WARNING2,linenumber,str ); \ return 1; \ } \ } @@ -55,7 +55,7 @@ char * strlower( char * in ) { int i; - for( i=0;i<strlen( in );i++ ) in[i]=( in[i] >= 'A' ? ( in[i] <= 'Z' ? in[i]+='A' : in[i] ) : in[i] ); + for( i=0;i<(int)strlen( in );i++ ) in[i]=( in[i] >= 'A' ? ( in[i] <= 'Z' ? in[i]+='A' : in[i] ) : in[i] ); return in; } @@ -81,9 +81,7 @@ strlower( in ); defList=NULL; if ( !strcmp( in,"movieplayer" ) ) defList=skinAppMPlayer; - #ifdef DEBUG - dbprintf( 3,"\n[skin] sectionname: %s\n",in ); - #endif + mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"\n[skin] sectionname: %s\n",in ); return 0; } @@ -91,9 +89,7 @@ { if ( strlen( winList ) ) winList[0]=0; else defList=NULL; - #ifdef DEBUG - dbprintf( 3,"\n[skin] end section\n" ); - #endif + mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"\n[skin] end section\n" ); return 0; } @@ -103,9 +99,7 @@ strlower( in ); strcpy( winList,in ); - #ifdef DEBUG - dbprintf( 3,"\n[skin] window: %s\n",winList ); - #endif + mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"\n[skin] window: %s\n",winList ); return 0; } @@ -114,7 +108,7 @@ unsigned char fname[512]; unsigned char tmp[512]; int x,y; - int sx=0,sy=0; + int sx=0,sy=0; CHECKDEFLIST( "base" ); CHECKWINLIST( "base" ); @@ -124,9 +118,7 @@ y=cutItemToInt( in,',',2 ); sx=cutItemToInt( in,',',3 ); sy=cutItemToInt( in,',',4 ); - #ifdef DEBUG - dbprintf( 3,"\n[skin] base: %s x: %d y: %d ( %dx%d )\n",fname,x,y,sx,sy ); - #endif + mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"\n[skin] base: %s x: %d y: %d ( %dx%d )\n",fname,x,y,sx,sy ); if ( !strcmp( winList,"main" ) ) { defList->main.x=x; @@ -138,7 +130,7 @@ defList->main.height=defList->main.Bitmap.Height; #ifdef HAVE_XSHAPE Convert32to1( &defList->main.Bitmap,&defList->main.Mask,0x00ff00ff ); -#if 0 +#if 0 { if ( defList->main.Mask.Image != NULL ) { @@ -148,15 +140,11 @@ } } #endif - #ifdef DEBUG - dbprintf( 3,"[skin] mask: %dx%d\n",defList->main.Mask.Width,defList->main.Mask.Height ); - #endif + mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"[skin] mask: %dx%d\n",defList->main.Mask.Width,defList->main.Mask.Height ); #else defList->main.Mask.Image=NULL; #endif - #ifdef DEBUG - dbprintf( 3,"[skin] width: %d height: %d\n",defList->main.width,defList->main.height ); - #endif + mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"[skin] width: %d height: %d\n",defList->main.width,defList->main.height ); } if ( !strcmp( winList,"sub" ) ) { @@ -172,9 +160,7 @@ defList->sub.width=sx; defList->sub.height=sy; } - #ifdef DEBUG - dbprintf( 3,"[skin] %d,%d %dx%d\n",defList->sub.x,defList->sub.y,defList->sub.width,defList->sub.height ); - #endif + mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"[skin] %d,%d %dx%d\n",defList->sub.x,defList->sub.y,defList->sub.width,defList->sub.height ); } /* if ( !strcmp( winList,"eq" ) ) @@ -186,9 +172,7 @@ if ( skinBPRead( tmp,&defList->eq.Bitmap ) ) return 1; defList->eq.width=defList->eq.Bitmap.Width; defList->eq.height=defList->eq.Bitmap.Height; - #ifdef DEBUG - dbprintf( 3,"[skin] width: %d height: %d\n",defList->eq.width,defList->eq.height ); - #endif + mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"[skin] width: %d height: %d\n",defList->eq.width,defList->eq.height ); } */ if ( !strcmp( winList,"menu" ) ) @@ -198,9 +182,7 @@ if ( skinBPRead( tmp,&defList->menuBase.Bitmap ) ) return 1; defList->menuBase.width=defList->menuBase.Bitmap.Width; defList->menuBase.height=defList->menuBase.Bitmap.Height; - #ifdef DEBUG - dbprintf( 3,"[skin] width: %d height: %d\n",defList->menuBase.width,defList->menuBase.height ); - #endif + mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"[skin] width: %d height: %d\n",defList->menuBase.width,defList->menuBase.height ); } return 0; } @@ -212,12 +194,10 @@ if ( !strcmp( winList,"sub" ) ) { - defList->subR=cutItemToInt( in,',',0 ); + defList->subR=cutItemToInt( in,',',0 ); defList->subG=cutItemToInt( in,',',1 ); - defList->subB=cutItemToInt( in,',',2 ); - #ifdef DEBUG - dbprintf( 3,"\n[skin] subwindow background color is #%x%x%x.\n",defList->subR,defList->subG,defList->subB ); - #endif + defList->subB=cutItemToInt( in,',',2 ); + mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"\n[skin] subwindow background color is #%x%x%x.\n",defList->subR,defList->subG,defList->subB ); } return 0; } @@ -227,7 +207,7 @@ unsigned char fname[512]; unsigned char tmp[512]; int x,y,sx,sy; - unsigned char msg[32]; + char msg[32]; CHECKDEFLIST( "button" ); CHECKWINLIST( "button" ); @@ -245,10 +225,8 @@ defList->Items[ defList->NumberOfItems ].y=y; defList->Items[ defList->NumberOfItems ].width=sx; defList->Items[ defList->NumberOfItems ].height=sy; - #ifdef DEBUG - dbprintf( 3,"\n[skin] button: fname: %s\n",fname ); - dbprintf( 3,"[skin] x: %d y: %d sx: %d sy: %d\n",x,y,sx,sy ); - #endif + mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"\n[skin] button: fname: %s\n",fname ); + mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"[skin] x: %d y: %d sx: %d sy: %d\n",x,y,sx,sy ); if ( ( defList->Items[ defList->NumberOfItems ].msg=appFindMessage( msg ) ) == -1 ) { ERRORMESSAGE( MSGTR_SKIN_BITMAP_UnknownMessage,msg ); return 1; } @@ -256,10 +234,7 @@ if ( defList->Items[ defList->NumberOfItems ].msg == evPauseSwitchToPlay ) defList->Items[ defList->NumberOfItems ].pressed=btnDisabled; defList->Items[ defList->NumberOfItems ].tmp=1; - #ifdef DEBUG - dbprintf( 3,"[skin] message: %d\n", - defList->Items[ defList->NumberOfItems ].msg ); - #endif + mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"[skin] message: %d\n",defList->Items[ defList->NumberOfItems ].msg ); defList->Items[ defList->NumberOfItems ].Bitmap.Image=NULL; if ( strcmp( fname,"NULL" ) ) @@ -281,15 +256,11 @@ cutItem( in,fname,',',0 ); defList->menuSelected.type=itBase; strcpy( tmp,path ); strcat( tmp,fname ); - #ifdef DEBUG - dbprintf( 3,"\n[skin] selected: %s\n",fname ); - #endif + mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"\n[skin] selected: %s\n",fname ); if ( skinBPRead( tmp,&defList->menuSelected.Bitmap ) ) return 1; defList->menuSelected.width=defList->menuSelected.Bitmap.Width; defList->menuSelected.height=defList->menuSelected.Bitmap.Height; - #ifdef DEBUG - dbprintf( 3,"[skin] width: %d height: %d\n",defList->menuSelected.width,defList->menuSelected.height ); - #endif + mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"[skin] width: %d height: %d\n",defList->menuSelected.width,defList->menuSelected.height ); return 0; } @@ -313,17 +284,13 @@ defList->MenuItems[ defList->NumberOfMenuItems ].width=sx; defList->MenuItems[ defList->NumberOfMenuItems ].height=sy; - #ifdef DEBUG - dbprintf( 3,"\n[skin] menuitem: %d\n",defList->NumberOfMenuItems ); - dbprintf( 3,"[skin] x: %d y: %d sx: %d sy: %d\n",x,y,sx,sy ); - #endif + mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"\n[skin] menuitem: %d\n",defList->NumberOfMenuItems ); + mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"[skin] x: %d y: %d sx: %d sy: %d\n",x,y,sx,sy ); if ( ( defList->MenuItems[ defList->NumberOfMenuItems ].msg=msg ) == -1 ) ERRORMESSAGE( MSGTR_SKIN_BITMAP_UnknownMessage,tmp ); - #ifdef DEBUG - dbprintf( 3,"[skin] message: %d\n",defList->Items[ defList->NumberOfItems ].msg ); - #endif + mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"[skin] message: %d\n",defList->Items[ defList->NumberOfItems ].msg ); defList->MenuItems[ defList->NumberOfMenuItems ].Bitmap.Image=NULL; return 0; @@ -352,14 +319,12 @@ sy=cutItemToInt( in,',',9 ); cutItem( in,tmp,',',10 ); msg=appFindMessage( tmp ); - #ifdef DEBUG - dbprintf( 3,"\n[skin] hpotmeter: pointer filename: '%s'\n",pfname ); - dbprintf( 3, "[skin] pointer size is %dx%d\n",psx,psy ); - dbprintf( 3, "[skin] phasebitmaps filename: '%s'\n",phfname ); - dbprintf( 3, "[skin] position: %d,%d %dx%d\n",x,y,sx,sy ); - dbprintf( 3, "[skin] default value: %d\n",d ); - dbprintf( 3, "[skin] message: %d\n",msg ); - #endif + mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"\n[skin] hpotmeter: pointer filename: '%s'\n",pfname ); + mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"[skin] pointer size is %dx%d\n",psx,psy ); + mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"[skin] phasebitmaps filename: '%s'\n",phfname ); + mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"[skin] position: %d,%d %dx%d\n",x,y,sx,sy ); + mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"[skin] default value: %d\n",d ); + mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"[skin] message: %d\n",msg ); defList->NumberOfItems++; item=&defList->Items[ defList->NumberOfItems ]; @@ -407,13 +372,11 @@ sy=cutItemToInt( in,',',6 ); cutItem( in,tmp,',',7 ); msg=appFindMessage( tmp ); - #ifdef DEBUG - dbprintf( 3,"\n[skin] potmeter: phases filename: '%s'\n",phfname ); - dbprintf( 3, "[skin] position: %d,%d %dx%d\n",x,y,sx,sy ); - dbprintf( 3, "[skin] phases: %d\n",ph ); - dbprintf( 3, "[skin] default value: %d\n",d ); - dbprintf( 3, "[skin] message: %d\n",msg ); - #endif + mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"\n[skin] potmeter: phases filename: '%s'\n",phfname ); + mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"[skin] position: %d,%d %dx%d\n",x,y,sx,sy ); + mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"[skin] phases: %d\n",ph ); + mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"[skin] default value: %d\n",d ); + mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"[skin] message: %d\n",msg ); defList->NumberOfItems++; item=&defList->Items[ defList->NumberOfItems ]; @@ -445,10 +408,8 @@ cutItem( in,name,',',0 ); cutItem( in,id,',',1 ); - #ifdef DEBUG - dbprintf( 3,"\n[skin] font\n" ); - dbprintf( 3, "[skin] name: %s\n",name ); - #endif + mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"\n[skin] font\n" ); + mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"[skin] name: %s\n",name ); defList->NumberOfItems++; item=&defList->Items[ defList->NumberOfItems ]; @@ -460,9 +421,7 @@ case -2: ERRORMESSAGE( MSGTR_SKIN_FONT_TooManyFontsDeclared ); return 1; } - #ifdef DEBUG - dbprintf( 3, "[skin] id: %s ( %d )\n",id,item->fontid ); - #endif + mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"[skin] id: %s ( %d )\n",id,item->fontid ); switch ( fntRead( path,name,item->fontid ) ) { @@ -483,9 +442,7 @@ CHECKDEFLIST( "slabel" ); CHECKWINLIST( "slabel" ); - #ifdef DEBUG - dbprintf( 3,"\n[skin] slabel\n" ); - #endif + mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"\n[skin] slabel\n" ); x=cutItemToInt( in,',',0 ); y=cutItemToInt( in,',',1 ); @@ -493,11 +450,9 @@ if ( id < 0 ) { ERRORMESSAGE( MSGTR_SKIN_FONT_NonExistentFontID,sid ); return 1; } cutItem( in,tmp,',',3 ); cutItem( tmp,tmp,'"',1 ); - #ifdef DEBUG - dbprintf( 3, "[skin] pos: %d,%d\n",x,y ); - dbprintf( 3, "[skin] id: %s ( %d )\n",sid,id ); - dbprintf( 3, "[skin] str: '%s'\n",tmp ); - #endif + mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"[skin] pos: %d,%d\n",x,y ); + mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"[skin] id: %s ( %d )\n",sid,id ); + mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"[skin] str: '%s'\n",tmp ); defList->NumberOfItems++; item=&defList->Items[ defList->NumberOfItems ]; @@ -521,23 +476,19 @@ CHECKDEFLIST( "dlabel" ); CHECKWINLIST( "dlabel" ); - #ifdef DEBUG - dbprintf( 3,"\n[skin] dlabel\n" ); - #endif + mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"\n[skin] dlabel\n" ); x=cutItemToInt( in,',',0 ); y=cutItemToInt( in,',',1 ); sx=cutItemToInt( in,',',2 ); - a=cutItemToInt( in,',',3 ); + a=cutItemToInt( in,',',3 ); cutItem( in,sid,',',4 ); id=fntFindID( sid ); if ( id < 0 ) { ERRORMESSAGE( MSGTR_SKIN_FONT_NonExistentFontID,sid ); return 1; } cutItem( in,tmp,',',5 ); cutItem( tmp,tmp,'"',1 ); - #ifdef DEBUG - dbprintf( 3,"[skin] pos: %d,%d width: %d align: %d\n",x,y,sx,a ); - dbprintf( 3,"[skin] id: %s ( %d )\n",sid,id ); - dbprintf( 3,"[skin] str: '%s'\n",tmp ); - #endif + mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"[skin] pos: %d,%d width: %d align: %d\n",x,y,sx,a ); + mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"[skin] id: %s ( %d )\n",sid,id ); + mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"[skin] str: '%s'\n",tmp ); defList->NumberOfItems++; item=&defList->Items[ defList->NumberOfItems ]; @@ -558,17 +509,13 @@ CHECKDEFLIST( "decoration" ); CHECKWINLIST( "decoration" ); - #ifdef DEBUG - dbprintf( 0,"\n[skin] window decoration is %s\n",in ); - #endif + mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"\n[skin] window decoration is %s\n",in ); cutItem( in,tmp,',',0 ); if ( strcmp( tmp,"enable" )&&strcmp( tmp,"disable" ) ) { ERRORMESSAGE( MSGTR_SKIN_UnknownParameter,tmp ); return 1; } if ( strcmp( tmp,"enable" ) ) defList->mainDecoration=0; else defList->mainDecoration=1; - #ifdef DEBUG - dbprintf( 3,"\n[skin] window decoration is %s\n",(defList->mainDecoration?"enabled":"disabled") ); - #endif + mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"\n[skin] window decoration is %s\n",(defList->mainDecoration?"enabled":"disabled") ); return 0; } @@ -596,7 +543,7 @@ { "menu", __menu } }; -#define ITEMS ( sizeof( skinItem )/sizeof( _item ) ) +#define ITEMS (int)( sizeof( skinItem )/sizeof( _item ) ) char * strdelspacesbeforecommand( char * in ) { @@ -617,7 +564,7 @@ { int i; if ( strlen( in ) == 0 ) return NULL; - for ( i=0;i<strlen( in );i++ ) + for ( i=0;i<(int)strlen( in );i++ ) if ( in[i] == what ) in[i]=whereof; return in; } @@ -626,12 +573,12 @@ { int c = 0,i = 0,id = 0; if ( strlen( in ) == 0 ) return NULL; - while ( c != strlen( in ) ) + while ( c != (int)strlen( in ) ) { if ( in[c] == '"' ) id=!id; if ( ( in[c] == ' ' )&&( !id ) ) { - for ( i=0;i<strlen( in ) - c; i++ ) in[c+i]=in[c+i+1]; + for ( i=0;i<(int)strlen( in ) - c; i++ ) in[c+i]=in[c+i+1]; continue; } c++; @@ -658,14 +605,12 @@ setname( skinDirInHome,dname ); if ( ( skinFile = fopen( fn,"rt" ) ) == NULL ) { - dbprintf( 3,"[skin] file ( %s ) not found.\n",fn ); + mp_msg( MSGT_GPLAYER,MSGL_STATUS,"[skin] file ( %s ) not found.\n",fn ); return -1; } } - #ifdef DEBUG - dbprintf( 3,"[skin] file: %s\n",fn ); - #endif + mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"[skin] file: %s\n",fn ); appInitStruct( &appMPlayer ); @@ -676,7 +621,7 @@ c=tmp[ strlen( tmp ) - 1 ]; if ( c == '\n' || c == '\r' ) tmp[ strlen( tmp ) - 1 ]=0; c=tmp[ strlen( tmp ) - 1 ]; if ( c == '\n' || c == '\r' ) tmp[ strlen( tmp ) - 1 ]=0; - for ( c=0;c<strlen( tmp );c++ ) + for ( c=0;c<(int)strlen( tmp );c++ ) if ( tmp[c] == ';' ) { tmp[c]=0;
--- a/Gui/timer.c Sat Feb 23 07:40:25 2002 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,37 +0,0 @@ - -#include <signal.h> -#include <time.h> -#include <sys/time.h> - -#include "timer.h" - -static struct itimerval it; -static struct sigaction sa; - -timerTSigHandler timerSigHandler; - -void timerSetHandler( timerTSigHandler handler ) -{ timerSigHandler=handler; } - -void timerInit( void ) -{ - sa.sa_handler=timerSigHandler; - sa.sa_flags=SA_RESTART; - sigemptyset( &sa.sa_mask ); - sigaction( SIGALRM,&sa,NULL ); - it.it_interval.tv_sec=0; - it.it_interval.tv_usec=20000; - it.it_value.tv_sec=0; - it.it_value.tv_usec=50000; - setitimer( ITIMER_REAL,&it,NULL ); -} - -void timerDone( void ) -{ - it.it_interval.tv_sec=0; - it.it_interval.tv_usec=0; - it.it_value.tv_sec=0; - it.it_value.tv_usec=0; - setitimer( ITIMER_REAL,&it,NULL ); -} -
--- a/Gui/timer.h Sat Feb 23 07:40:25 2002 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,12 +0,0 @@ - -#ifndef __MYTIMER -#define __MYTIMER - -typedef void (* timerTSigHandler)( int signum ); -extern timerTSigHandler timerSigHandler; - -extern void timerSetHandler( timerTSigHandler handler ); -extern void timerInit( void ); -extern void timerDone( void ); - -#endif
--- a/Gui/wm/ws.c Sat Feb 23 07:40:25 2002 +0000 +++ b/Gui/wm/ws.c Sat Feb 23 15:12:55 2002 +0000 @@ -18,9 +18,9 @@ #include <inttypes.h> +#include "../../config.h" #include "ws.h" #include "wsconv.h" -#include "../../config.h" #include "../../postproc/rgb2rgb.h" #include <X11/extensions/XShm.h> @@ -381,9 +381,9 @@ { char buf[32]; int i; sprintf( buf,"_%s_REMOTE",label ); - for( i=0;i<strlen( buf );i++ ) + for( i=0;i < (int)strlen( buf );i++ ) if ( ( buf[i] >= 'a' )&&( buf[i] <= 'z' ) ) buf[i]=buf[i] - 32; - for( i=0;i<strlen( buf );i++ ) + for( i=0;i < (int)strlen( buf );i++ ) if ( buf[i] == ' ' ) buf[i]='_'; fprintf( stderr,"[ws] atomname: %s\n",buf ); win->AtomRemote=XInternAtom( wsDisplay,buf,False ); @@ -681,11 +681,11 @@ wsWindowList[l]->MouseHandler( i,Event->xbutton.x,Event->xbutton.y,Event->xmotion.x_root,Event->xmotion.y_root ); break; - case GravityNotify: +// case GravityNotify: // #ifdef DEBUG - fprintf( stderr,"[ws] window ( 0x%x ) gravity: %d,%d\n",wsWindowList[l]->WindowID,Event->xgravity.x,Event->xgravity.y ); +// fprintf( stderr,"[ws] window ( 0x%x ) gravity: %d,%d\n",wsWindowList[l]->WindowID,Event->xgravity.x,Event->xgravity.y ); // #endif - break; +// break; case PropertyNotify: // break; @@ -730,8 +730,7 @@ Bool wsDummyEvents( Display * display,XEvent * Event,XPointer arg ) { return True; } -// mplTimerHandler(0); // handle timer event -void wsHandleEvents(){ +void wsHandleEvents( void ){ // handle pending events while ( XPending(wsDisplay) ){ XNextEvent( wsDisplay,&wsEvent ); @@ -740,6 +739,8 @@ } } +extern void mplTimerHandler( void ); + void wsMainLoop( void ) { int delay=20; @@ -758,7 +759,7 @@ wsEvents( wsDisplay,&wsEvent,NULL ); delay=0; } - mplTimerHandler(0); // handle timer event + mplTimerHandler(); // handle timer event usleep(delay*1000); // FIXME! if(delay<10*20) delay+=20; // pump up delay up to 0.2 sec (low activity) }
--- a/Gui/wm/ws.h Sat Feb 23 07:40:25 2002 +0000 +++ b/Gui/wm/ws.h Sat Feb 23 15:12:55 2002 +0000 @@ -194,6 +194,8 @@ extern void wsDoExit( void ); extern void wsMainLoop( void ); +extern Bool wsEvents( Display * display,XEvent * Event,XPointer arg ); +extern void wsHandleEvents( void ); // ---------------------------------------------------------------------------------------------- // wsCrateWindow: create a new window on the screen.
--- a/Gui/wm/wsconv.c Sat Feb 23 07:40:25 2002 +0000 +++ b/Gui/wm/wsconv.c Sat Feb 23 15:12:55 2002 +0000 @@ -18,7 +18,7 @@ #define SWAP_RGB_24(src,dst) dst[1]=src[0];dst[1]=src[1];dst[2]=src[0] -void BGR8880_to_RGB555_c( const unsigned char * in_pixels, unsigned char * out_pixels, unsigned num_pixels) +void BGR8880_to_RGB555_c( const unsigned char * in_pixels, unsigned char * out_pixels, int num_pixels) { unsigned short pixel; int i; @@ -31,7 +31,7 @@ } } -void BGR8880_to_BGR555_c( const unsigned char * in_pixels, unsigned char * out_pixels, unsigned num_pixels) +void BGR8880_to_BGR555_c( const unsigned char * in_pixels, unsigned char * out_pixels, int num_pixels) { unsigned short pixel; int i; @@ -44,7 +44,7 @@ } } -void BGR8880_to_RGB565_c( const unsigned char * in_pixels, unsigned char * out_pixels, unsigned num_pixels) +void BGR8880_to_RGB565_c( const unsigned char * in_pixels, unsigned char * out_pixels, int num_pixels) { unsigned short pixel; int i; @@ -57,7 +57,7 @@ } } -void BGR8880_to_BGR565_c( const unsigned char * in_pixels, unsigned char * out_pixels, unsigned num_pixels) +void BGR8880_to_BGR565_c( const unsigned char * in_pixels, unsigned char * out_pixels, int num_pixels) { unsigned short pixel; int i; @@ -70,7 +70,7 @@ } } -void BGR8880_to_RGB888_c( const unsigned char * in_pixels, unsigned char * out_pixels,unsigned num_pixels ) +void BGR8880_to_RGB888_c( const unsigned char * in_pixels, unsigned char * out_pixels,int num_pixels ) { int i; for(i = 0; i < num_pixels / 4; i++) @@ -81,7 +81,7 @@ } } -void BGR8880_to_BGR888_c( const unsigned char * in_pixels, unsigned char * out_pixels,unsigned num_pixels ) +void BGR8880_to_BGR888_c( const unsigned char * in_pixels, unsigned char * out_pixels,int num_pixels ) { int i; for(i = 0; i < num_pixels / 4; i++) @@ -92,7 +92,7 @@ } } -void BGR8880_to_BGR8880_c( const unsigned char * in_pixels, unsigned char * out_pixels,unsigned num_pixels ) +void BGR8880_to_BGR8880_c( const unsigned char * in_pixels, unsigned char * out_pixels,int num_pixels ) { int i; for(i = 0; i < num_pixels / 4; i++) @@ -103,7 +103,7 @@ } } -void BGR8880_to_RGB8880_c( const unsigned char * in_pixels, unsigned char * out_pixels,unsigned num_pixels ) +void BGR8880_to_RGB8880_c( const unsigned char * in_pixels, unsigned char * out_pixels,int num_pixels ) { memcpy( out_pixels,in_pixels,num_pixels ); } /* @@ -119,7 +119,7 @@ #define RGB16_MIDDLE_MASK 0x07e0 #define RGB16_UPPER_MASK 0xf800 -void RGB565_to_RGB888_c( const unsigned char * in_pixels, unsigned char * out_pixels,unsigned num_pixels) +void RGB565_to_RGB888_c( const unsigned char * in_pixels, unsigned char * out_pixels,int num_pixels) { unsigned short in_pixel; int i;
--- a/Gui/wm/wsconv.h Sat Feb 23 07:40:25 2002 +0000 +++ b/Gui/wm/wsconv.h Sat Feb 23 15:12:55 2002 +0000 @@ -19,14 +19,14 @@ typedef void(*wsTConvFunc)( const unsigned char * in_pixels, unsigned char * out_pixels, unsigned num_pixels ); extern wsTConvFunc wsConvFunc; -extern void BGR8880_to_RGB555_c( const unsigned char * in_pixels, unsigned char * out_pixels, unsigned num_pixels ); -extern void BGR8880_to_BGR555_c( const unsigned char * in_pixels, unsigned char * out_pixels, unsigned num_pixels ); -extern void BGR8880_to_RGB565_c( const unsigned char * in_pixels, unsigned char * out_pixels, unsigned num_pixels ); -extern void BGR8880_to_BGR565_c( const unsigned char * in_pixels, unsigned char * out_pixels, unsigned num_pixels ); -extern void BGR8880_to_RGB888_c( const unsigned char * in_pixels, unsigned char * out_pixels, unsigned num_pixels ); -extern void BGR8880_to_BGR888_c( const unsigned char * in_pixels, unsigned char * out_pixels, unsigned num_pixels ); -extern void BGR8880_to_BGR8880_c( const unsigned char * in_pixels, unsigned char * out_pixels,unsigned num_pixels ); -extern void BGR8880_to_RGB8880_c( const unsigned char * in_pixels, unsigned char * out_pixels,unsigned num_pixels ); +extern void BGR8880_to_RGB555_c( const unsigned char * in_pixels, unsigned char * out_pixels, int num_pixels ); +extern void BGR8880_to_BGR555_c( const unsigned char * in_pixels, unsigned char * out_pixels, int num_pixels ); +extern void BGR8880_to_RGB565_c( const unsigned char * in_pixels, unsigned char * out_pixels, int num_pixels ); +extern void BGR8880_to_BGR565_c( const unsigned char * in_pixels, unsigned char * out_pixels, int num_pixels ); +extern void BGR8880_to_RGB888_c( const unsigned char * in_pixels, unsigned char * out_pixels, int num_pixels ); +extern void BGR8880_to_BGR888_c( const unsigned char * in_pixels, unsigned char * out_pixels, int num_pixels ); +extern void BGR8880_to_BGR8880_c( const unsigned char * in_pixels, unsigned char * out_pixels,int num_pixels ); +extern void BGR8880_to_RGB8880_c( const unsigned char * in_pixels, unsigned char * out_pixels,int num_pixels ); #ifdef xHAVE_MMX extern void BGR8880_to_RGB888_mmx( const unsigned char * in_pixels,unsigned char * out_pixels,unsigned num_pixels);
--- a/mp_msg.h Sat Feb 23 07:40:25 2002 +0000 +++ b/mp_msg.h Sat Feb 23 15:12:55 2002 +0000 @@ -1,3 +1,6 @@ + +#ifndef _MP_MSG_H +#define _MP_MSG_H extern int verbose; // defined in mplayer.c @@ -86,3 +89,5 @@ #define mp_dbg(mod,lev, ... ) #endif #endif + +#endif
--- a/mplayer.c Sat Feb 23 07:40:25 2002 +0000 +++ b/mplayer.c Sat Feb 23 15:12:55 2002 +0000 @@ -283,7 +283,7 @@ static stream_t* stream=NULL; -static char* current_module=NULL; // for debugging +char* current_module=NULL; // for debugging static unsigned int inited_flags=0; #define INITED_VO 1 @@ -332,7 +332,7 @@ if(mask&INITED_GUI){ inited_flags&=~INITED_GUI; current_module="uninit_gui"; - mplDone(); + guiDone(); } #endif @@ -643,9 +643,9 @@ // It's time to init the GUI code: (and fork() the GTK process) #ifdef HAVE_NEW_GUI if(use_gui){ - appInit( argc,argv,envp,(void*)mDisplay ); + guiInit( argc,argv,envp ); inited_flags|=INITED_GUI; - mplShMem->Playing= (gui_no_filename) ? 0 : 1; + guiIntfStruct.Playing= (gui_no_filename) ? 0 : 1; mplState(); } #endif @@ -728,18 +728,18 @@ if ( use_gui ) { #ifdef USE_DVDREAD - if ( mplShMem->DVDChanged ) + if ( guiIntfStruct.DVDChanged ) { - mplShMem->DVDChanged=0; - mplShMem->Playing=1; + guiIntfStruct.DVDChanged=0; + guiIntfStruct.Playing=1; filename="/dev/dvd"; goto play_dvd; } #endif - - if(filename && !mplShMem->FilenameChanged) strcpy( mplShMem->Filename,filename ); -// mplShMem->Playing= (gui_no_filename) ? 0 : 1; - while(mplShMem->Playing!=1){ + + if(filename && !guiIntfStruct.FilenameChanged) guiSetFilename( guiIntfStruct.Filename,filename ); +// guiIntfStruct.Playing= (gui_no_filename) ? 0 : 1; + while(guiIntfStruct.Playing!=1){ usleep(20000); guiEventHandling(); } @@ -747,17 +747,17 @@ play_dvd: #ifdef USE_SUB - if ( mplShMem->SubtitleChanged || !mplShMem->FilenameChanged ) + if ( guiIntfStruct.SubtitleChanged || !guiIntfStruct.FilenameChanged ) { - if ( mplShMem->Subtitlename[0] != 0 ) sub_name=mplShMem->Subtitlename; - mplShMem->SubtitleChanged=0; + if ( ( guiIntfStruct.Subtitlename )&&( guiIntfStruct.Subtitlename[0] != 0 ) ) sub_name=guiIntfStruct.Subtitlename; + guiIntfStruct.SubtitleChanged=0; } #endif - if ( mplShMem->FilenameChanged || !filename ) + if ( guiIntfStruct.FilenameChanged || !filename ) { - filename=mplShMem->Filename; - mplShMem->FilenameChanged=0; + filename=strdup( guiIntfStruct.Filename ); + guiIntfStruct.FilenameChanged=0; } } #endif @@ -1049,17 +1049,17 @@ if ( use_gui && stream->type == STREAMTYPE_DVD ) { dvd_priv_t * dvdp = stream->priv; - mplShMem->DVD.titles=dvdp->vmg_file->tt_srpt->nr_of_srpts; - mplShMem->DVD.chapters=dvdp->vmg_file->tt_srpt->title[dvd_title].nr_of_ptts; - mplShMem->DVD.angles=dvdp->vmg_file->tt_srpt->title[dvd_title].nr_of_angles; - mplShMem->DVD.nr_of_audio_channels=dvdp->nr_of_channels; - memcpy( mplShMem->DVD.audio_streams,dvdp->audio_streams,sizeof( dvdp->audio_streams ) ); - mplShMem->DVD.nr_of_subtitles=dvdp->nr_of_subtitles; - memcpy( mplShMem->DVD.subtitles,dvdp->subtitles,sizeof( dvdp->subtitles ) ); - mplShMem->DVD.current_title=dvd_title + 1; - mplShMem->DVD.current_chapter=dvd_chapter + 1; - mplShMem->DVD.current_angle=dvd_angle + 1; - mplShMem->Track=dvd_title + 1; + 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; } #endif #endif @@ -1179,13 +1179,13 @@ mp_msg(MSGT_CPLAYER,MSGL_ERR,MSGTR_CouldntInitAudioCodec); sh_audio=d_audio->sh=NULL; #ifdef HAVE_NEW_GUI - if ( use_gui ) mplShMem->AudioType=0; + if ( use_gui ) guiIntfStruct.AudioType=0; #endif } else { mp_msg(MSGT_CPLAYER,MSGL_INFO,"AUDIO: srate=%d chans=%d bps=%d sfmt=0x%X ratio: %d->%d\n",sh_audio->samplerate,sh_audio->channels,sh_audio->samplesize, sh_audio->sample_format,sh_audio->i_bps,sh_audio->o_bps); #ifdef HAVE_NEW_GUI - if ( use_gui ) mplShMem->AudioType=sh_audio->channels; + if ( use_gui ) guiIntfStruct.AudioType=sh_audio->channels; #endif } } @@ -1359,10 +1359,10 @@ if ( use_gui ) { mplResizeToMovieSize( sh_video->disp_w,sh_video->disp_h ); - moviewidth=sh_video->disp_w; - movieheight=sh_video->disp_h; - mplShMem->StreamType=stream->type; - mplSetFileName( filename ); + guiIntfStruct.MovieWidth=sh_video->disp_w; + guiIntfStruct.MovieHeight=sh_video->disp_h; + guiIntfStruct.StreamType=stream->type; + guiIntfStruct.Filename=filename; } #endif @@ -1964,7 +1964,7 @@ fflush(stdout); } #ifdef HAVE_NEW_GUI - if(use_gui) mplShMem->Playing=2; + if(use_gui) guiIntfStruct.Playing=2; #endif if (video_out && sh_video) video_out->control(VOCTRL_PAUSE, NULL); @@ -2002,7 +2002,7 @@ #ifdef HAVE_NEW_GUI if(use_gui){ guiEventHandling(); - if(mplShMem->Playing!=2 || (rel_seek_secs || abs_seek_pos)) + if(guiIntfStruct.Playing!=2 || (rel_seek_secs || abs_seek_pos)) { gui_pause_flag=1; break; } // end of pause or seek } #endif @@ -2021,7 +2021,7 @@ video_out->control(VOCTRL_RESUME, NULL); // resume video (void)GetRelativeTime(); // keep TF around FT in next cycle #ifdef HAVE_NEW_GUI - if(use_gui && !gui_pause_flag) mplShMem->Playing=1; // play from keyboard + if(use_gui && !gui_pause_flag) guiIntfStruct.Playing=1; // play from keyboard #endif } @@ -2660,36 +2660,36 @@ if(use_gui){ if(demuxer->file_format==DEMUXER_TYPE_AVI && sh_video->video.dwLength>2){ // get pos from frame number / total frames - mplShMem->Position=(float)d_video->pack_no*100.0f/sh_video->video.dwLength; + guiIntfStruct.Position=(float)d_video->pack_no*100.0f/sh_video->video.dwLength; } else { // get pos from file position / filesize int len=((demuxer->movi_end-demuxer->movi_start)); int pos=(demuxer->file_format==DEMUXER_TYPE_AVI)?demuxer->filepos:d_video->pos; - mplShMem->Position=(len<=0)?0:((float)(pos-demuxer->movi_start) / len * 100.0f); + guiIntfStruct.Position=(len<=0)?0:((float)(pos-demuxer->movi_start) / len * 100.0f); } - mplShMem->TimeSec=d_video->pts; - if(mplShMem->Playing==0) break; // STOP - if(mplShMem->Playing==2) osd_function=OSD_PAUSE; - if ( mplShMem->VolumeChanged ) + guiIntfStruct.TimeSec=d_video->pts; + if(guiIntfStruct.Playing==0) break; // STOP + if(guiIntfStruct.Playing==2) osd_function=OSD_PAUSE; + if ( guiIntfStruct.VolumeChanged ) { - mixer_setvolume( mplShMem->Volume,mplShMem->Volume ); - mplShMem->VolumeChanged=0; + mixer_setvolume( guiIntfStruct.Volume,guiIntfStruct.Volume ); + guiIntfStruct.VolumeChanged=0; #ifdef USE_OSD if ( osd_level ) { osd_visible=sh_video->fps; // 1 sec vo_osd_progbar_type=OSD_VOLUME; - vo_osd_progbar_value=( ( mplShMem->Volume ) * 256.0 ) / 100.0; + vo_osd_progbar_value=( ( guiIntfStruct.Volume ) * 256.0 ) / 100.0; } #endif } - mplShMem->Volume=(float)mixer_getbothvolume(); + guiIntfStruct.Volume=(float)mixer_getbothvolume(); #ifdef USE_DVDREAD - if ( mplShMem->DVDChanged ) goto goto_next_file; + if ( guiIntfStruct.DVDChanged ) goto goto_next_file; if ( stream->type == STREAMTYPE_DVD ) { dvd_priv_t * dvdp = stream->priv; - mplShMem->DVD.current_chapter=dvdp->cur_cell + 1; + guiIntfStruct.DVD.current_chapter=dvdp->cur_cell + 1; } #endif } @@ -2787,7 +2787,6 @@ goto_next_file: // don't jump here after ao/vo/getch initialization! - if(benchmark){ double tot=video_time_usage+vout_time_usage+audio_time_usage; double total_time_usage; @@ -2836,7 +2835,7 @@ if(use_gui) { #ifdef USE_DVDREAD - if ( !mplShMem->DVDChanged ) + if ( !guiIntfStruct.DVDChanged ) #endif mplStop(); } @@ -2855,7 +2854,7 @@ if(use_gui || playtree_iter != NULL #if defined( HAVE_NEW_GUI ) && defined( USE_DVDREAD ) - || (mplShMem && mplShMem->DVDChanged) + || guiIntfStruct.DVDChanged #endif ){ @@ -2874,8 +2873,9 @@ sub_free( subtitles ); sub_name=NULL; vo_sub=NULL; + subtitles=NULL; } - + video_out=NULL; audio_out=NULL; eof = 0;