Mercurial > mplayer.hg
changeset 4963:13262bd21965
small changes
author | pontscho |
---|---|
date | Wed, 06 Mar 2002 23:54:20 +0000 |
parents | 993f274191ff |
children | 4cceff46d1d8 |
files | Gui/interface.c Gui/interface.h Gui/mplayer/mw.h Gui/mplayer/play.c mplayer.c |
diffstat | 5 files changed, 53 insertions(+), 50 deletions(-) [+] |
line wrap: on
line diff
--- a/Gui/interface.c Wed Mar 06 23:40:31 2002 +0000 +++ b/Gui/interface.c Wed Mar 06 23:54:20 2002 +0000 @@ -53,6 +53,12 @@ gtkEventHandling(); break; case guiCEvent: + switch ( (int)arg ) + { + case guiSetPlay: guiIntfStruct.Playing=1; mplState(); break; + case guiSetStop: guiIntfStruct.Playing=0; mplState(); break; + case guiSetPause: guiIntfStruct.Playing=2; mplState(); break; + } break; case guiIEvent: printf( "cmd: %d\n",(int)arg ); @@ -76,4 +82,5 @@ if ( use_gui && !guiIntfStruct.Playing ) wsHandleEvents(); gtkEventHandling(); mplTimerHandler(); // handle GUI timer events + mplState(); }
--- a/Gui/interface.h Wed Mar 06 23:40:31 2002 +0000 +++ b/Gui/interface.h Wed Mar 06 23:54:20 2002 +0000 @@ -97,6 +97,10 @@ #define guiCEvent 1 #define guiIEvent 2 +#define guiSetStop 0 +#define guiSetPlay 1 +#define guiSetPause 2 + extern void guiInit( int argc,char* argv[], char *envp[] ); extern void guiGetEvent( int type,char * arg ); extern void guiEventHandling( void );
--- a/Gui/mplayer/mw.h Wed Mar 06 23:40:31 2002 +0000 +++ b/Gui/mplayer/mw.h Wed Mar 06 23:54:20 2002 +0000 @@ -222,11 +222,8 @@ #endif case evPlay: case evPlaySwitchToPause: -// btnModify( evPlaySwitchToPause,btnDisabled ); -// btnModify( evPauseSwitchToPlay,btnReleased ); mplMainAutoPlay=0; if ( ( msg == evPlaySwitchToPause )&( guiIntfStruct.Playing == 1 ) ) goto NoPause; - mplMainRender=1; switch ( guiIntfStruct.StreamType ) { @@ -242,7 +239,7 @@ #endif } mplPlay(); - mplState(); + mplMainRender=1; break; #ifdef USE_DVDREAD case evSetDVDSubtitle: @@ -279,19 +276,14 @@ case evPause: case evPauseSwitchToPlay: -// btnModify( evPlaySwitchToPause,btnReleased ); -// btnModify( evPauseSwitchToPlay,btnDisabled ); NoPause: + mplPause(); mplMainRender=1; - mplPause(); break; case evStop: -// btnModify( evPlaySwitchToPause,btnReleased ); -// btnModify( evPauseSwitchToPlay,btnDisabled ); + mplStop(); mplMainRender=1; - mplStop(); - mplState(); break; case evLoadPlay: @@ -563,6 +555,7 @@ if ( Type != wsKeyPressed ) return; switch ( Key ) { + case wsEnter: msg=evPlay; break; #ifndef HAVE_NEW_INPUT case '.': case '>': msg=evNext; break; @@ -571,7 +564,6 @@ case wsEscape: msg=evExit; break; - case wsEnter: msg=evPlay; break; case wsSpace: msg=evPause; break; case wsa: case wsA: msg=evAbout; break;
--- a/Gui/mplayer/play.c Wed Mar 06 23:40:31 2002 +0000 +++ b/Gui/mplayer/play.c Wed Mar 06 23:54:20 2002 +0000 @@ -66,6 +66,7 @@ wsResizeWindow( &appMPlayer.subWindow,appMPlayer.sub.width,appMPlayer.sub.height ); wsMoveWindow( &appMPlayer.subWindow,True,appMPlayer.sub.x,appMPlayer.sub.y ); } + guiGetEvent( guiCEvent,guiSetStop ); mplSubRender=1; wsSetBackgroundRGB( &appMPlayer.subWindow,appMPlayer.subR,appMPlayer.subG,appMPlayer.subB ); wsClearWindow( appMPlayer.subWindow ); @@ -78,11 +79,11 @@ ( guiIntfStruct.Filename[0] == 0 )|| ( guiIntfStruct.Playing == 1 ) ) return; if ( guiIntfStruct.Playing == 2 ) { mplPause(); return; } - guiIntfStruct.Playing=1; + guiGetEvent( guiCEvent,guiSetPlay ); mplSubRender=0; wsSetBackgroundRGB( &appMPlayer.subWindow,0,0,0 ); wsClearWindow( appMPlayer.subWindow ); - wsPostRedisplay( &appMPlayer.subWindow ); +// wsPostRedisplay( &appMPlayer.subWindow ); } void mplPause( void ) @@ -91,13 +92,9 @@ { case 1: // playing guiIntfStruct.Playing=2; -// btnModify( evPlaySwitchToPause,btnReleased ); -// btnModify( evPauseSwitchToPlay,btnDisabled ); break; case 2: // paused guiIntfStruct.Playing=1; -// btnModify( evPlaySwitchToPause,btnDisabled ); -// btnModify( evPauseSwitchToPlay,btnReleased ); break; } mplState();
--- a/mplayer.c Wed Mar 06 23:40:31 2002 +0000 +++ b/mplayer.c Wed Mar 06 23:54:20 2002 +0000 @@ -713,17 +713,6 @@ // ========== Init keyboard FIFO (connection to libvo) ============ make_pipe(&keyb_fifo_get,&keyb_fifo_put); - // It's time to init the GUI code: (and fork() the GTK process) -#ifdef HAVE_NEW_GUI - if(use_gui){ - guiInit( argc,argv,envp ); - inited_flags|=INITED_GUI; - guiIntfStruct.Playing= (gui_no_filename) ? 0 : 1; - mplState(); - } -#endif - - // Init input system #ifdef HAVE_NEW_INPUT current_module = "init_input"; @@ -756,6 +745,14 @@ // ******************* Now, let's see the per-file stuff ******************** +#ifdef HAVE_NEW_GUI + if(use_gui){ + guiInit( argc,argv,envp ); + inited_flags|=INITED_GUI; + guiGetEvent( guiCEvent,(gui_no_filename) ? 0 : 1 ); + } +#endif + play_next_file: // We must enable getch2 here to be able to interrupt network connection @@ -772,14 +769,12 @@ if ( guiIntfStruct.DVDChanged ) { guiIntfStruct.DVDChanged=0; - guiIntfStruct.Playing=1; + guiGetEvent( guiCEvent,guiSetPlay ); filename="/dev/dvd"; goto play_dvd; } #endif -// if(filename && !guiIntfStruct.FilenameChanged) guiSetFilename( guiIntfStruct.Filename,filename ); -// guiIntfStruct.Playing= (gui_no_filename) ? 0 : 1; while(guiIntfStruct.Playing!=1){ mp_cmd_t* cmd; usleep(20000); @@ -1243,15 +1238,9 @@ if(!init_audio(sh_audio)){ mp_msg(MSGT_CPLAYER,MSGL_ERR,MSGTR_CouldntInitAudioCodec); sh_audio=d_audio->sh=NULL; -#ifdef HAVE_NEW_GUI - 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 ) guiIntfStruct.AudioType=sh_audio->channels; -#endif } } @@ -1427,7 +1416,26 @@ guiIntfStruct.MovieWidth=sh_video->disp_w; guiIntfStruct.MovieHeight=sh_video->disp_h; guiIntfStruct.StreamType=stream->type; -// guiSetFilename( guiIntfStruct.Filename,filename ); + guiSetFilename( guiIntfStruct.Filename,filename ); + if ( sh_audio ) guiIntfStruct.AudioType=sh_audio->channels; + else guiIntfStruct.AudioType=0; +#ifdef USE_DVDREAD + if ( stream->type == STREAMTYPE_DVD ) + { + dvd_priv_t * dvdp = stream->priv; + 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 @@ -1820,9 +1828,7 @@ aq_sleep_time+=time_frame; #ifdef HAVE_NEW_GUI - if(use_gui){ - guiEventHandling(); - } + if(use_gui) guiEventHandling(); #endif if(!(vo_flags&256)){ // flag 256 means: libvo driver does its timing (dvb card) @@ -2043,15 +2049,12 @@ #ifdef HAVE_NEW_INPUT mp_cmd_t* cmd; #endif -#ifdef HAVE_NEW_GUI - int gui_pause_flag=0; // gany! -#endif if(!quiet) { mp_msg(MSGT_CPLAYER,MSGL_STATUS,"\n------ PAUSED -------\r"); fflush(stdout); } #ifdef HAVE_NEW_GUI - if(use_gui) guiIntfStruct.Playing=2; + if(use_gui) guiGetEvent( guiCEvent,guiSetPause ); #endif if (video_out && sh_video) video_out->control(VOCTRL_PAUSE, NULL); @@ -2089,13 +2092,13 @@ #ifdef HAVE_NEW_GUI if(use_gui){ guiEventHandling(); - if(guiIntfStruct.Playing!=2 || (rel_seek_secs || abs_seek_pos)) - { gui_pause_flag=1; break; } // end of pause or seek + if(guiIntfStruct.Playing!=2 || (rel_seek_secs || abs_seek_pos)) break; } #endif + usleep(20000); #ifdef HAVE_NEW_INPUT } - mp_cmd_free(cmd); + if ( cmd ) mp_cmd_free(cmd); #else if(use_stdin) usec_sleep(1000); // do not eat the CPU } @@ -2108,7 +2111,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) guiIntfStruct.Playing=1; // play from keyboard + if (use_gui) guiGetEvent( guiCEvent,guiSetPlay ); #endif }