From 855050e68a778e200aa1a1a6310d5d346e64ec71 Mon Sep 17 00:00:00 2001 From: arpi Date: Mon, 27 Aug 2001 23:56:44 +0000 Subject: GUI stuff. now seeking works, and xmga renders to video window git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@1724 b3059339-0415-0410-9bf9-f77b7e298cf2 --- mplayer.c | 81 ++++++++++++++++++++++++++++++++++++--------------------------- 1 file changed, 46 insertions(+), 35 deletions(-) (limited to 'mplayer.c') diff --git a/mplayer.c b/mplayer.c index 6118eada28..b4472129c5 100644 --- a/mplayer.c +++ b/mplayer.c @@ -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){ -- cgit v1.2.3