diff options
-rw-r--r-- | Gui/app.c | 4 | ||||
-rw-r--r-- | Gui/app.h | 2 | ||||
-rw-r--r-- | Gui/mplayer/mplayer.c | 9 | ||||
-rw-r--r-- | Gui/mplayer/mplayer.h | 2 | ||||
-rw-r--r-- | Gui/mplayer/mw.h | 17 | ||||
-rw-r--r-- | Gui/mplayer/play.c | 15 | ||||
-rw-r--r-- | Gui/mplayer/psignal.c | 14 | ||||
-rw-r--r-- | Gui/mplayer/sw.h | 2 | ||||
-rw-r--r-- | Gui/wm/ws.c | 8 | ||||
-rw-r--r-- | Gui/wm/ws.h | 2 | ||||
-rw-r--r-- | libvo/vo_xmga.c | 18 | ||||
-rw-r--r-- | libvo/x11_common.c | 12 | ||||
-rw-r--r-- | libvo/x11_common.h | 9 | ||||
-rw-r--r-- | mplayer.c | 81 |
14 files changed, 124 insertions, 71 deletions
@@ -96,7 +96,7 @@ int appFindMessage( unsigned char * str ) return -1; } -void appInit( int argc,char* argv[], char *envp[] ) +void appInit( int argc,char* argv[], char *envp[], void* disp ) { skinDirInHome=get_path("Skin"); skinMPlayerDir=DATADIR "/Skin"; @@ -124,6 +124,6 @@ void appInit( int argc,char* argv[], char *envp[] ) case -1: dbprintf( 0,"[app] skin configfile not found.\n" ); exit( 0 ); case -2: dbprintf( 0,"[app] skin configfile read error.\n" ); exit( 0 ); } - mplInit( argc,argv,envp ); // does gtk & ws initialization, create windows + mplInit( argc,argv,envp,disp ); // does gtk & ws initialization, create windows // } } @@ -79,7 +79,7 @@ extern listItems appRadio; extern char * skinDirInHome; extern char * skinMPlayerDir; -extern void appInit( int argc,char* argv[], char *envp[] ); +extern void appInit( int argc,char* argv[], char *envp[], void* disp ); extern void appInitStruct( listItems * item ); extern void appClearItem( wItem * item ); extern void appCopy( listItems * item1,listItems * item2 ); diff --git a/Gui/mplayer/mplayer.c b/Gui/mplayer/mplayer.c index 52d04ea665..f6e67e5dd0 100644 --- a/Gui/mplayer/mplayer.c +++ b/Gui/mplayer/mplayer.c @@ -48,7 +48,7 @@ void mplTimerHandler( int signum ) if ( mplGeneralTimer == 0 ) mplMsgHandle( evGeneralTimer,0 ); } -void mplInit( int argc,char* argv[], char *envp[] ) +void mplInit( int argc,char* argv[], char *envp[], void* disp ) { // parse_cfgfiles( argc,argv,envp ); @@ -63,7 +63,7 @@ void mplInit( int argc,char* argv[], char *envp[] ) message=mplErrorHandler; // error messagebox drawing function // opens X display, checks for extensions (XShape, DGA etc) - wsXInit(); + wsXInit(disp); if ( ( mplDrawBuffer = (unsigned char *)calloc( 1,appMPlayer.main.Bitmap.ImageSize ) ) == NULL ) { @@ -75,6 +75,9 @@ void mplInit( int argc,char* argv[], char *envp[] ) appMPlayer.sub.x,appMPlayer.sub.y,appMPlayer.sub.width,appMPlayer.sub.height, wsNoBorder,wsShowMouseCursor|wsHandleMouseButton|wsHandleMouseMove,wsShowFrame|wsShowWindow,"ViDEO" ); + vo_setwindow(appMPlayer.subWindow.WindowID, appMPlayer.subWindow.wGC); + mplSubRender=0; + wsCreateWindow( &appMPlayer.mainWindow, appMPlayer.main.x,appMPlayer.main.y,appMPlayer.main.width,appMPlayer.main.height, wsNoBorder,wsShowMouseCursor|wsHandleMouseButton|wsHandleMouseMove,wsHideFrame|wsMaxSize|wsMinSize|wsShowWindow,"MPlayer" ); @@ -105,6 +108,8 @@ void mplInit( int argc,char* argv[], char *envp[] ) btnModify( evSetBalance,mplShMem->Balance ); btnModify( evSetMoviePosition,mplShMem->Position ); + mplShMem->Playing=0; + // timerSetHandler( mplTimerHandler ); // various timer hacks // timerInit(); diff --git a/Gui/mplayer/mplayer.h b/Gui/mplayer/mplayer.h index dc751d1f6c..65744629d3 100644 --- a/Gui/mplayer/mplayer.h +++ b/Gui/mplayer/mplayer.h @@ -13,7 +13,7 @@ extern int mainVisible; extern int mplMainAutoPlay; -extern void mplInit( int argc,char* argv[], char *envp[] ); +extern void mplInit( int argc,char* argv[], char *envp[], void* disp ); extern void mplMsgHandle( int msg,float param ); #endif diff --git a/Gui/mplayer/mw.h b/Gui/mplayer/mw.h index 92a7292c2d..9ee7270a73 100644 --- a/Gui/mplayer/mw.h +++ b/Gui/mplayer/mw.h @@ -178,6 +178,8 @@ drawrenderedtext: XFlush( wsDisplay ); } +#define IZE(x) printf("@@@ " x " @@@\n"); + void mplMsgHandle( int msg,float param ) { int j; @@ -186,12 +188,15 @@ void mplMsgHandle( int msg,float param ) { // --- user events case evExit: - wsDoExit(); + IZE("evExit"); + wsDoExit(); // sets wsTrue=False; break; case evIconify: + IZE("evIcon"); wsIconify( appMPlayer.mainWindow ); break; case evFullScreen: + IZE("evFullS"); for ( j=0;j<appMPlayer.NumberOfItems + 1;j++ ) { if ( appMPlayer.Items[j].msg == evFullScreen ) @@ -205,6 +210,7 @@ void mplMsgHandle( int msg,float param ) break; case evPlaySwitchToPause: + IZE("evPlay->Pause"); if ( Filename ) { btnModify( evPlaySwitchToPause,btnDisabled ); @@ -212,20 +218,24 @@ void mplMsgHandle( int msg,float param ) } if ( mplShMem->Playing == 1 ) goto NoPause; case evPlay: + IZE("evPlay"); mplMainRender=1; mplPlay(); break; case evPauseSwitchToPlay: + IZE("evPause->Play"); btnModify( evPlaySwitchToPause,btnReleased ); btnModify( evPauseSwitchToPlay,btnDisabled ); case evPause: NoPause: + IZE("evPause"); mplMainRender=1; mplPause(); break; case evStop: + IZE("evStop"); btnModify( evPlaySwitchToPause,btnReleased ); btnModify( evPauseSwitchToPlay,btnDisabled ); mplMainRender=1; @@ -233,18 +243,22 @@ NoPause: break; case evLoadPlay: + IZE("evLoadPlay"); mplMainAutoPlay=1; case evLoad: + IZE("evLoad"); mplMainRender=1; gtkSendMessage( evLoad ); break; case evPrev: + IZE("evPrev"); mplMainRender=1; #ifdef DEBUG dbprintf( 1,"[mw.h] previous stream ...\n" ); #endif break; case evNext: + IZE("evNext"); mplMainRender=1; #ifdef DEBUG dbprintf( 1,"[mw.h] next stream ...\n" ); @@ -252,6 +266,7 @@ NoPause: break; case evPlayList: + IZE("evPlayList"); mplMainRender=1; if ( gtkVisiblePlayList ) { diff --git a/Gui/mplayer/play.c b/Gui/mplayer/play.c index 340bda2fbd..15724e2997 100644 --- a/Gui/mplayer/play.c +++ b/Gui/mplayer/play.c @@ -9,6 +9,8 @@ int mplParent = 1; int mplx,mply,mplwidth,mplheight; +float gui_position=-1; + #include "../app.h" #include "../wm/ws.h" @@ -16,6 +18,7 @@ int mplx,mply,mplwidth,mplheight; #include "../wm/widget.h" #include "../../config.h" +#include "../../libvo/x11_common.h" #include "widgets.h" #include "./mplayer.h" @@ -25,6 +28,10 @@ int mplx,mply,mplwidth,mplheight; mplCommStruct * mplShMem; char * Filename = NULL; +extern float rel_seek_secs; +extern int abs_seek_pos; + + void mplPlayerThread( void ) { // mplayer( 0,NULL,NULL ); @@ -85,6 +92,10 @@ printf("%%%%%% PAUSE \n"); void mplResize( unsigned int X,unsigned int Y,unsigned int width,unsigned int height ) { + +printf("mplResize(%d,%d,%d,%d) \n",X,Y,width,height); + vo_resize=1; + } void mplMPlayerInit( int argc,char* argv[], char *envp[] ) @@ -109,7 +120,7 @@ void mplMPlayerInit( int argc,char* argv[], char *envp[] ) float mplGetPosition( void ) { // return 0.0 ... 100.0 - return mplShMem->Position; + return (gui_position<0)?(mplShMem->Position):(gui_position*100.0); } void mplRelSeek( float s ) @@ -118,12 +129,14 @@ void mplRelSeek( float s ) printf("%%%%%% RelSEEK=%5.3f \n",s); // --- mplShMem->Position=mplGetPosition() + s; + rel_seek_secs=s; abs_seek_pos=0; } void mplAbsSeek( float s ) { // 0.0 ... 100.0 // --- printf("%%%%%% AbsSEEK=%5.3f \n",s); + rel_seek_secs=0.01*s; abs_seek_pos=3; // --- mplShMem->Position=s; mplShMem->TimeSec=s; diff --git a/Gui/mplayer/psignal.c b/Gui/mplayer/psignal.c index 6053d40dd7..263ba0d016 100644 --- a/Gui/mplayer/psignal.c +++ b/Gui/mplayer/psignal.c @@ -18,6 +18,9 @@ #include "../../config.h" +#include "../../libvo/x11_common.h" +//#include "../../libvo/sub.h" + #include "./mplayer.h" #define gtkShow( w ) gtkShMem->vs.window=w; gtkSendMessage( evShowWindow ); @@ -55,20 +58,21 @@ void mplPlayerSigHandler( int s ) switch ( mplShMem->message ) { case mplQuit: -// exit_player( "Quit" ); + exit_player( "GUI close" ); break; case mplPauseEvent: // if ( osd_function != OSD_PAUSE ) osd_function=OSD_PAUSE; // else osd_function=OSD_PLAY; break; case mplResizeEvent: -// vo_resize=1; -// vo_expose=1; -// dbprintf( 2,"[psignal] resize.\n" ); + vo_resize=1; + vo_expose=1; + printf( "[psignal] resize.\n" ); // if (video_out != NULL ) video_out->check_events(); break; case mplExposeEvent: -// vo_expose=1; + vo_expose=1; + printf( "[psignal] expose.\n" ); // if (video_out != NULL ) video_out->check_events(); break; case mplSeekEvent: diff --git a/Gui/mplayer/sw.h b/Gui/mplayer/sw.h index 8d77c4625f..da28cd457e 100644 --- a/Gui/mplayer/sw.h +++ b/Gui/mplayer/sw.h @@ -18,8 +18,8 @@ void mplSubDraw( wsParamDisplay ) wsClearWindow( appMPlayer.subWindow ); if ( appMPlayer.sub.Bitmap.Image ) wsConvert( &appMPlayer.subWindow,appMPlayer.sub.Bitmap.Image,appMPlayer.sub.Bitmap.ImageSize ); mplSubRender=0; + if ( appMPlayer.sub.Bitmap.Image ) wsPutImage( &appMPlayer.subWindow ); } - if ( appMPlayer.sub.Bitmap.Image ) wsPutImage( &appMPlayer.subWindow ); XFlush( wsDisplay ); XSync( wsDisplay,False ); } diff --git a/Gui/wm/ws.c b/Gui/wm/ws.c index 4922d8998a..b3c86a4b7b 100644 --- a/Gui/wm/ws.c +++ b/Gui/wm/ws.c @@ -130,12 +130,15 @@ int wsErrorHandler( Display * dpy,XErrorEvent * Event ) exit( 0 ); } -void wsXInit( void ) +void wsXInit( void* mDisplay ) { - char * DisplayName = ":0.0"; int eventbase; int errorbase; +if(mDisplay){ + wsDisplay=mDisplay; +} else { + char * DisplayName = ":0.0"; if ( getenv( "DISPLAY" ) ) DisplayName=getenv( "DISPLAY" ); wsDisplay=XOpenDisplay( DisplayName ); if ( !wsDisplay ) @@ -143,6 +146,7 @@ void wsXInit( void ) fprintf( stderr,"[ws] couldn't open the display !\n" ); exit( 0 ); } +} if ( !XShmQueryExtension( wsDisplay ) ) { diff --git a/Gui/wm/ws.h b/Gui/wm/ws.h index be10ff0b0d..9436dd0866 100644 --- a/Gui/wm/ws.h +++ b/Gui/wm/ws.h @@ -180,7 +180,7 @@ extern int wsUseDGA; extern unsigned long wsKeyTable[512]; extern void wsXDone( void ); -extern void wsXInit( void ); +extern void wsXInit( void* disp ); extern int wsGetDepthOnScreen( void ); diff --git a/libvo/vo_xmga.c b/libvo/vo_xmga.c index 35d7f7911c..4089d26fad 100644 --- a/libvo/vo_xmga.c +++ b/libvo/vo_xmga.c @@ -108,7 +108,7 @@ static void set_window(){ XGetGeometry( mDisplay,mWindow,&mRoot,&drwX,&drwY,&drwWidth,&drwHeight,&drwBorderWidth,&drwDepth ); drwX=0; drwY=0; // drwWidth=wndWidth; drwHeight=wndHeight; XTranslateCoordinates( mDisplay,mWindow,mRoot,0,0,&drwcX,&drwcY,&mRoot ); - //fprintf( stderr,"[xmga] dcx: %d dcy: %d dx: %d dy: %d dw: %d dh: %d\n",drwcX,drwcY,drwX,drwY,drwWidth,drwHeight ); + fprintf( stderr,"[xmga] dcx: %d dcy: %d dx: %d dy: %d dw: %d dh: %d\n",drwcX,drwcY,drwX,drwY,drwWidth,drwHeight ); #ifdef HAVE_GUI if ( vo_window != None ) @@ -249,7 +249,7 @@ static uint32_t init( uint32_t width, uint32_t height, uint32_t d_width, uint32_ default: printf( "Sorry, this (%d) color depth not supported.\n",vo_depthonscreen ); return -1; } -#ifdef HAVE_GUI +#ifdef HAVE_NEW_GUI if ( vo_window == None ) { #endif @@ -289,7 +289,8 @@ static uint32_t init( uint32_t width, uint32_t height, uint32_t d_width, uint32_ XSetNormalHints( mDisplay,mWindow,&hint ); XStoreName( mDisplay,mWindow,mTitle ); XMapWindow( mDisplay,mWindow ); -#ifdef HAVE_GUI + mGC=XCreateGC( mDisplay,mWindow,GCForeground,&wGCV ); +#ifdef HAVE_NEW_GUI } else { @@ -301,9 +302,9 @@ static uint32_t init( uint32_t width, uint32_t height, uint32_t d_width, uint32_ XResizeWindow( mDisplay,mWindow,d_width,d_height ); } else mFullscreen=1; + mGC=vo_gc; //XCreateGC( mDisplay,mWindow,GCForeground,&wGCV ); } #endif - mGC=XCreateGC( mDisplay,mWindow,GCForeground,&wGCV ); set_window(); @@ -317,16 +318,13 @@ static uint32_t init( uint32_t width, uint32_t height, uint32_t d_width, uint32_ if(mga_init()) return -1; -#ifdef HAVE_GUI +#ifdef HAVE_NEW_GUI if ( vo_window == None ) - { #endif + { XFlush( mDisplay ); XSync( mDisplay,False ); -#ifdef HAVE_GUI - } -#endif - + } saver_off(mDisplay); return 0; diff --git a/libvo/x11_common.c b/libvo/x11_common.c index 2f0b6ab52a..c2a16037fe 100644 --- a/libvo/x11_common.c +++ b/libvo/x11_common.c @@ -227,15 +227,17 @@ void vo_x11_classhint( Display * display,Window window,char *name ){ XSetClassHint(display,window,&wmClass); } -#ifdef HAVE_GUI +#ifdef HAVE_NEW_GUI Window vo_window = None; GC vo_gc; int vo_xeventhandling = 1; int vo_resize = 0; int vo_expose = 0; - void vo_setwindow( Window w,GC g ) - { vo_window=w; vo_gc=g; } + void vo_setwindow( Window w,GC g ) { + vo_window=w; vo_gc=g; + vo_xeventhandling=0; + } #endif int vo_x11_check_events(Display *mydisplay){ @@ -246,7 +248,7 @@ int vo_x11_check_events(Display *mydisplay){ static XComposeStatus stat; // unsigned long vo_KeyTable[512]; -#ifdef HAVE_GUI +#ifdef HAVE_NEW_GUI if ( vo_xeventhandling ) { #endif @@ -270,7 +272,7 @@ int vo_x11_check_events(Display *mydisplay){ break; } } -#ifdef HAVE_GUI +#ifdef HAVE_NEW_GUI } else { diff --git a/libvo/x11_common.h b/libvo/x11_common.h index 575b06d627..cd4f11508e 100644 --- a/libvo/x11_common.h +++ b/libvo/x11_common.h @@ -20,15 +20,16 @@ void vo_x11_classhint( Display * display,Window window,char *name ); int vo_x11_check_events(Display *mydisplay); #endif -#ifdef HAVE_GUI +#ifdef HAVE_NEW_GUI extern Window vo_window; - extern Display * vo_display; extern GC vo_gc; + extern void vo_setwindow( Window w,GC g ); extern int vo_xeventhandling; extern int vo_expose; extern int vo_resize; - - extern void vo_setwindow( Window w,GC g ); +#endif +#ifdef HAVE_GUI + extern Display * vo_display; #endif void saver_off( Display * ); @@ -37,6 +37,7 @@ #include "libvo2/libvo2.h" #else #include "libvo/video_out.h" +void* mDisplay; // Display* mDisplay; #endif //#ifdef USE_OSD @@ -185,6 +186,8 @@ static int benchmark=0; static int play_in_bg=0; +extern float gui_position; + extern void avi_fixate(); #ifdef HAVE_GUI @@ -274,44 +277,17 @@ float sub_fps=0; int sub_auto = 1; /*DSP!!char *dsp=NULL;*/ -//float rel_seek_secs=0; //float initial_pts_delay=0; +float rel_seek_secs=0; +int abs_seek_pos=0; + extern char *vo_subdevice; extern char *ao_subdevice; void exit_player(char* how){ total_time_usage_start=GetTimer()-total_time_usage_start; -#ifdef HAVE_GUI - if ( !nogui ) - { - if ( how != NULL ) - { - if ( !strcmp( how,"Quit" ) ) mplSendMessage( mplEndOfFile ); - if ( !strcmp( how,"End of file" ) ) mplSendMessage( mplEndOfFile ); - if ( !strcmp( how,"audio_init" ) ) mplSendMessage( mplAudioError ); - } - else mplSendMessage( mplUnknowError ); - } -#endif - - if(how) mp_msg(MSGT_CPLAYER,MSGL_INFO,MSGTR_Exiting,how); - mp_msg(MSGT_CPLAYER,MSGL_V,"max framesize was %d bytes\n",max_framesize); - if(benchmark){ - double tot=video_time_usage+vout_time_usage+audio_time_usage; - double total_time_usage=(float)total_time_usage_start*0.000001; - mp_msg(MSGT_CPLAYER,MSGL_INFO,"BENCHMARKs: V:%8.3fs VO:%8.3fs A:%8.3fs Sys:%8.3fs = %8.3fs\n", - video_time_usage,vout_time_usage,audio_time_usage, - total_time_usage-tot,total_time_usage); - if(total_time_usage>0.0) - mp_msg(MSGT_CPLAYER,MSGL_INFO,"BENCHMARK%%: V:%8.4f%% VO:%8.4f%% A:%8.4f%% Sys:%8.4f%% = %8.4f%%\n", - 100.0*video_time_usage/total_time_usage, - 100.0*vout_time_usage/total_time_usage, - 100.0*audio_time_usage/total_time_usage, - 100.0*(total_time_usage-tot)/total_time_usage, - 100.0); - } // restore terminal: #ifdef HAVE_GUI if ( nogui ) @@ -323,7 +299,13 @@ void exit_player(char* how){ #else if(video_out) video_out->uninit(); #endif + +#ifdef HAVE_NEW_GUI + if(use_gui) mplDone(); +#endif + if(audio_out) audio_out->uninit(); + if(encode_name) avi_fixate(); #ifdef HAVE_LIRC #ifdef HAVE_GUI @@ -332,6 +314,23 @@ void exit_player(char* how){ lirc_mp_cleanup(); #endif + if(how) mp_msg(MSGT_CPLAYER,MSGL_INFO,MSGTR_Exiting,how); + mp_msg(MSGT_CPLAYER,MSGL_V,"max framesize was %d bytes\n",max_framesize); + if(benchmark){ + double tot=video_time_usage+vout_time_usage+audio_time_usage; + double total_time_usage=(float)total_time_usage_start*0.000001; + mp_msg(MSGT_CPLAYER,MSGL_INFO,"BENCHMARKs: V:%8.3fs VO:%8.3fs A:%8.3fs Sys:%8.3fs = %8.3fs\n", + video_time_usage,vout_time_usage,audio_time_usage, + total_time_usage-tot,total_time_usage); + if(total_time_usage>0.0) + mp_msg(MSGT_CPLAYER,MSGL_INFO,"BENCHMARK%%: V:%8.4f%% VO:%8.4f%% A:%8.4f%% Sys:%8.4f%% = %8.4f%%\n", + 100.0*video_time_usage/total_time_usage, + 100.0*vout_time_usage/total_time_usage, + 100.0*audio_time_usage/total_time_usage, + 100.0*(total_time_usage-tot)/total_time_usage, + 100.0); + } + exit(1); } @@ -454,9 +453,6 @@ int v_saturation=50; //float a_frame=0; // Audio -float rel_seek_secs=0; -int abs_seek_pos=0; - int i; int use_stdin=0; //int f; // filedes @@ -480,9 +476,13 @@ int use_stdin=0; //int f; // filedes mp_msg(MSGT_CPLAYER,MSGL_WARN,"MPlayer was compiled WITHOUT GUI support!\n"); use_gui=0; } +#else + if(use_gui && !vo_init()){ + mp_msg(MSGT_CPLAYER,MSGL_WARN,"MPlayer GUI requires X11!\n"); + use_gui=0; + } #endif - #ifndef USE_LIBVO2 if(video_driver && strcmp(video_driver,"help")==0){ printf("Available video output drivers:\n"); @@ -560,7 +560,7 @@ if(!parse_codec_cfg(get_path("codecs.conf"))){ // It's time to init the GUI code: (and fork() the GTK process) #ifdef HAVE_NEW_GUI if(use_gui){ - appInit( argc,argv,envp ); + appInit( argc,argv,envp,(void*)mDisplay ); } #endif @@ -1779,6 +1779,17 @@ if(rel_seek_secs || abs_seek_pos){ current_module=NULL; } +#ifdef HAVE_NEW_GUI + if(use_gui){ + int len=((demuxer->movi_end-demuxer->movi_start)>>8); + if(len>0) + gui_position=(demuxer->filepos-demuxer->movi_start)/len; + else + gui_position=-1; + } +#endif + + //================= Update OSD ==================== #ifdef USE_OSD if(osd_level>=2){ |