small changes

git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@4964 b3059339-0415-0410-9bf9-f77b7e298cf2
This commit is contained in:
pontscho 2002-03-06 23:54:20 +00:00
parent e2c91bcfcf
commit 94a0c1f661
5 changed files with 53 additions and 50 deletions

View File

@ -53,6 +53,12 @@ void guiGetEvent( int type,char * arg )
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 @@ void guiEventHandling( void )
if ( use_gui && !guiIntfStruct.Playing ) wsHandleEvents();
gtkEventHandling();
mplTimerHandler(); // handle GUI timer events
mplState();
}

View File

@ -97,6 +97,10 @@ extern guiInterface_t guiIntfStruct;
#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 );

View File

@ -222,11 +222,8 @@ play_dvd_2:
#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 @@ play_dvd_2:
#endif
}
mplPlay();
mplState();
mplMainRender=1;
break;
#ifdef USE_DVDREAD
case evSetDVDSubtitle:
@ -279,19 +276,14 @@ play_dvd_2:
case evPause:
case evPauseSwitchToPlay:
// btnModify( evPlaySwitchToPause,btnReleased );
// btnModify( evPauseSwitchToPlay,btnDisabled );
NoPause:
mplMainRender=1;
mplPause();
mplMainRender=1;
break;
case evStop:
// btnModify( evPlaySwitchToPause,btnReleased );
// btnModify( evPauseSwitchToPlay,btnDisabled );
mplMainRender=1;
mplStop();
mplState();
mplMainRender=1;
break;
case evLoadPlay:
@ -563,6 +555,7 @@ void mplMainKeyHandle( int State,int Type,int Key )
if ( Type != wsKeyPressed ) return;
switch ( Key )
{
case wsEnter: msg=evPlay; break;
#ifndef HAVE_NEW_INPUT
case '.':
case '>': msg=evNext; break;
@ -571,7 +564,6 @@ void mplMainKeyHandle( int State,int Type,int Key )
case wsEscape: msg=evExit; break;
case wsEnter: msg=evPlay; break;
case wsSpace: msg=evPause; break;
case wsa:
case wsA: msg=evAbout; break;

View File

@ -66,6 +66,7 @@ void mplStop()
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 @@ void mplPlay( void )
( 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 @@ void mplPause( void )
{
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();

View File

@ -713,17 +713,6 @@ if(!parse_codec_cfg(get_path("codecs.conf"))){
// ========== 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 @@ current_module = NULL;
// ******************* 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(!use_stdin && !slave_mode){
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(sh_audio){
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 @@ current_module="init_libvo";
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 @@ if(!dapsync){
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)
@ -2042,16 +2048,13 @@ read_input:
if(osd_function==OSD_PAUSE){
#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 @@ read_input:
#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 @@ read_input:
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
}