[Mplayerxp-cvslog] SF.net SVN: mplayerxp:[246] mplayerxp
Brought to you by:
olov
From: <nic...@us...> - 2012-10-29 12:47:10
|
Revision: 246 http://mplayerxp.svn.sourceforge.net/mplayerxp/?rev=246&view=rev Author: nickols_k Date: 2012-10-29 12:47:00 +0000 (Mon, 29 Oct 2012) Log Message: ----------- more accurate placement of eof variable Modified Paths: -------------- mplayerxp/mplayer.c mplayerxp/xmp_core.c mplayerxp/xmp_core.h Modified: mplayerxp/mplayer.c =================================================================== --- mplayerxp/mplayer.c 2012-10-29 12:34:45 UTC (rev 245) +++ mplayerxp/mplayer.c 2012-10-29 12:47:00 UTC (rev 246) @@ -116,7 +116,6 @@ volatile unsigned xp_drop_frame_cnt=0; float xp_screen_pts; -int audio_eof=0; ao_data_t* ao_data=NULL; vo_data_t* vo_data=NULL; @@ -967,7 +966,7 @@ // Update buffer if needed MP_UNIT("mpca_decode"); // Enter AUDIO decoder module t=GetTimer(); - while(sh_audio->a_buffer_len<playsize && !audio_eof){ + while(sh_audio->a_buffer_len<playsize && !xp_core.audio->eof){ if(mp_conf.xp>=XP_VideoAudio) { ret=read_audio_buffer(sh_audio,&sh_audio->a_buffer[sh_audio->a_buffer_len], playsize-sh_audio->a_buffer_len,sh_audio->a_buffer_size-sh_audio->a_buffer_len,&pts); @@ -989,7 +988,7 @@ MP_UNIT("uninit_ao"); ao_uninit(ao_data); } - audio_eof=1; + xp_core.audio->eof=1; break; } } @@ -1109,7 +1108,7 @@ static void show_status_line_no_apts(float v_pts) { priv_t*priv=mp_data->priv; sh_audio_t* sh_audio=priv->demuxer->audio->sh; - if(mp_conf.av_sync_pts && sh_audio && (!audio_eof || ao_get_delay(ao_data))) { + if(mp_conf.av_sync_pts && sh_audio && (!xp_core.audio->eof || ao_get_delay(ao_data))) { float a_pts = sh_audio->timer-ao_get_delay(ao_data); MSG_STATUS("A:%6.1f V:%6.1f A-V:%7.3f ct:%7.3f %3d/%3d %2d%% %2d%% %4.1f%% %d\r" ,a_pts @@ -1168,10 +1167,10 @@ sh_video_t* sh_video=priv->demuxer->video->sh; float sleep_time=0; if(sh_audio) { - /* FIXME!!! need the same technique to detect audio_eof as for video_eof! + /* FIXME!!! need the same technique to detect xp_core.audio->eof as for video_eof! often ao_get_delay() never returns 0 :( */ - if(audio_eof && !get_delay_audio_buffer()) goto nosound_model; - if((!audio_eof || ao_get_delay(ao_data)) && + if(xp_core.audio->eof && !get_delay_audio_buffer()) goto nosound_model; + if((!xp_core.audio->eof || ao_get_delay(ao_data)) && (!mp_data->use_pts_fix2 || (!sh_audio->chapter_change && !sh_video->chapter_change))) sleep_time=xp_screen_pts-(sh_audio->timer-ao_get_delay(ao_data)); else if(mp_data->use_pts_fix2 && sh_audio->chapter_change) @@ -1192,7 +1191,7 @@ #define XP_MIN_TIMESLICE 0.010 /* under Linux on x86 min time_slice = 10 ms */ #define XP_MIN_AUDIOBUFF 0.05 #define XP_MAX_TIMESLICE 0.1 - if(sh_audio && (!audio_eof || ao_get_delay(ao_data)) && sleep_time>XP_MAX_TIMESLICE) { + if(sh_audio && (!xp_core.audio->eof || ao_get_delay(ao_data)) && sleep_time>XP_MAX_TIMESLICE) { float t; if( mp_conf.xp < XP_VAPlay ) { @@ -1241,7 +1240,7 @@ shva_prev=dae_played_fra(xp_core.video); final_frame = shva_prev.eof; - if(xp_core.eof && final_frame) return 1; + if(xp_core.video->eof && final_frame) return 1; can_blit=dae_try_inc_played(xp_core.video); /* <-- TRY SWITCH TO NEXT FRAME */ shva=dae_next_played_fra(xp_core.video); @@ -1250,14 +1249,14 @@ /*------------------------ frame decoded. --------------------*/ /* blit frame */ - if(xp_core.eof) can_blit=1; /* force blitting until end of stream will be reached */ + if(xp_core.video->eof) can_blit=1; /* force blitting until end of stream will be reached */ vplayer_check_chapter_change(&shva_prev,v_pts); #if 0 MSG_INFO("initial_audio_pts=%f a_eof=%i a_pts=%f sh_audio->timer=%f v_pts=%f stream_pts=%f duration=%f\n" ,initial_audio_pts -,audio_eof -,sh_audio && !audio_eof?d_audio->pts+(ds_tell_pts_r(d_audio)-sh_audio->a_in_buffer_len)/(float)sh_audio->i_bps:0 -,sh_audio && !audio_eof?sh_audio->timer-ao_get_delay(ao_data):0 +,xp_core.audio->eof +,sh_audio && !xp_core.audio->eof?d_audio->pts+(ds_tell_pts_r(d_audio)-sh_audio->a_in_buffer_len)/(float)sh_audio->i_bps:0 +,sh_audio && !xp_core.audio->eof?sh_audio->timer-ao_get_delay(ao_data):0 ,shva.v_pts ,shva.stream_pts ,shva.duration); @@ -1320,7 +1319,7 @@ /* FIXME: this block was added to fix A-V resync caused by some strange things like playing 48KHz audio on 44.1KHz soundcard and other. Now we know PTS of every audio frame so don't need to have it */ - if(sh_audio && (!audio_eof || ao_get_delay(ao_data)) && !mp_conf.av_sync_pts) { + if(sh_audio && (!xp_core.audio->eof || ao_get_delay(ao_data)) && !mp_conf.av_sync_pts) { float a_pts=0; // unplayed bytes in our and soundcard/dma buffer: @@ -1374,7 +1373,7 @@ sh_video_t* sh_video=priv->demuxer->video->sh; demux_stream_t *d_dvdsub=priv->demuxer->sub; int seek_rval=1; - audio_eof=0; + xp_core.audio->eof=0; if(seek->secs || seek->flags&DEMUX_SEEK_SET) { seek_rval=demux_seek_r(priv->demuxer,seek); priv->mpxp_after_seek=25; /* 1 sec delay */ @@ -2710,7 +2709,7 @@ if(mp_conf.benchmark && mp_conf.verbose) show_benchmark_status(); else mpxp_print_audio_status(); - if(mp_conf.xp >= XP_VAPlay) { usleep(100000); eof = audio_eof; } + if(mp_conf.xp >= XP_VAPlay) { usleep(100000); eof = xp_core.audio->eof; } goto read_input; } else { int l_eof; @@ -2759,7 +2758,7 @@ if(mp_conf.loop_times==1) mp_conf.loop_times=-1; eof=0; - audio_eof=0; + xp_core.audio->eof=0; seek_args.flags=DEMUX_SEEK_SET|DEMUX_SEEK_PERCENTS; seek_args.secs=0; // seek to start of movie (0%) } @@ -2777,7 +2776,7 @@ mpxp_seek(&osd,&seek_args); - audio_eof=0; + xp_core.audio->eof=0; seek_args.secs=0; seek_args.flags=DEMUX_SEEK_CUR|DEMUX_SEEK_SECONDS; @@ -2844,7 +2843,7 @@ priv->vo_inited=0; priv->ao_inited=0; eof = 0; - audio_eof=0; + xp_core.audio->eof=0; goto play_next_file; } Modified: mplayerxp/xmp_core.c =================================================================== --- mplayerxp/xmp_core.c 2012-10-29 12:34:45 UTC (rev 245) +++ mplayerxp/xmp_core.c 2012-10-29 12:47:00 UTC (rev 246) @@ -222,7 +222,7 @@ free_buf = get_free_audio_buffer(); if( free_buf == -1 ) { /* End of file */ - xp_core.a_eof = 1; + xp_core.audio->eof = 1; return 0; } if( free_buf < (int)sh_audio->audio_out_minsize ) /* full */ @@ -357,8 +357,8 @@ float v_pts,mpeg_timer=HUGE; priv->state=Pth_Run; - xp_core.eof = 0; - xp_core.a_eof=0; + priv->dae->eof = 0; + xp_core.audio->eof=0; MSG_T("\nDEC_AHEAD: entering...\n"); __MP_UNIT(priv->p_idx,"dec_ahead"); priv->pid = getpid(); @@ -373,7 +373,7 @@ d_video->demuxer->file_format == DEMUXER_TYPE_MPEG_TS; else xp_is_bad_pts = mp_conf.av_sync_pts?0:1; -while(!xp_core.eof){ +while(!priv->dae->eof){ unsigned char* start=NULL; int in_size; if(priv->state==Pth_Canceling) break; @@ -400,7 +400,7 @@ in_size=video_read_frame_r(sh_video,&duration,&v_pts,&start,sh_video->fps); if(in_size<0) { xp_core.video->fra[xp_core.video->decoder_idx].eof=1; - xp_core.eof=1; + priv->dae->eof=1; break; } /* in_size==0: it's or broken stream or demuxer's bug */ @@ -484,10 +484,10 @@ usleep(1); } /*------------------------ frame decoded. --------------------*/ -} /* while(!xp_core.eof)*/ +} /* while(!priv->dae->eof)*/ if(xp_core.has_audio && mp_conf.xp<XP_VAFull) { - while(!xp_core.a_eof && priv->state!=Pth_Canceling && priv->state!=Pth_Sleep) { + while(!xp_core.audio->eof && priv->state!=Pth_Canceling && priv->state!=Pth_Sleep) { __MP_UNIT(priv->p_idx,"decode audio"); if(!xp_thread_decode_audio()) usleep(1); __MP_UNIT(priv->p_idx,NULL); @@ -510,8 +510,8 @@ float d; priv->state=Pth_Run; - xp_core.eof = 0; - xp_core.a_eof=0; + xp_core.video->eof=0; + xp_core.audio->eof=0; MSG_T("\nDEC_AHEAD: entering...\n"); priv->pid = getpid(); __MP_UNIT(priv->p_idx,"dec_ahead"); @@ -525,7 +525,7 @@ } __MP_UNIT(priv->p_idx,"decode audio"); while((ret = xp_thread_decode_audio()) == 2) {/* Almost empty buffer */ - if(xp_core.a_eof) break; + if(xp_core.audio->eof) break; } dec_ahead_can_adseek=1; @@ -534,7 +534,7 @@ __MP_UNIT(priv->p_idx,"sleep"); LOCK_AUDIO_DECODE(); if(priv->state!=Pth_Canceling) { - if(xp_core.a_eof) { + if(xp_core.audio->eof) { __MP_UNIT(priv->p_idx,"wait end of work"); pthread_cond_wait( &audio_decode_cond, &audio_decode_mutex ); } else if(ret==0) { /* Full buffer or end of file */ @@ -734,26 +734,6 @@ xp_core.mpxp_threads[i]->state=Pth_Run; while(xp_core.mpxp_threads[i]->state==Pth_ASleep) usleep(0); } -#if 0 - if(mp_conf.xp && !pthread_is_living && !a_pthread_is_living) { - return; - } - if(!xp_core.has_audio) - decore_audio(xp_id); - else - xp_thread_decode_audio(); - - if(xp_core.has_video) { - while(dae_curr_vdecoded() == dae_curr_vplayed() && !xp_core.eof) - usleep(1); /* Wait for thread to decode first frame */ - } - - if(a_pthread_is_living) - __MP_SYNCHRONIZE(audio_decode_mutex,pthread_cond_signal(&audio_decode_cond)); - - if(pthread_audio_is_living) - __MP_SYNCHRONIZE(audio_play_mutex,pthread_cond_signal(&audio_play_cond)); -#endif } #define MIN_AUDIO_TIME 0.05 @@ -828,7 +808,7 @@ samples = 10; min_audio = MAX_AUDIO_TIME; max_audio = 0; - } else if( !xp_core.a_eof && collect_samples) { + } else if( !xp_core.audio->eof && collect_samples) { if( dec_ahead_audio_delay < min_audio ) min_audio = dec_ahead_audio_delay; if( dec_ahead_audio_delay > max_audio ) @@ -925,7 +905,7 @@ MSG_T("sig_dec_ahead_video\n"); mp_msg_flush(); - xp_core.eof = 1; + xp_core.video->eof = 1; xp_core.video->fra[dae_curr_vdecoded()].eof=1; /* Unlock all mutex Modified: mplayerxp/xmp_core.h =================================================================== --- mplayerxp/xmp_core.h 2012-10-29 12:34:45 UTC (rev 245) +++ mplayerxp/xmp_core.h 2012-10-29 12:47:00 UTC (rev 246) @@ -33,6 +33,7 @@ unsigned nframes; /* number of frames in buffer */ frame_attr_t* fra; /* frame related attributes */ any_t* sh; /* corresponded sh_audio_t or sh_video_t */ + int eof; /* EOF for stream */ /* for statistics */ unsigned num_slow_frames;/* number of frames which were delayed due slow computer */ long long int num_played_frames; @@ -65,13 +66,11 @@ dec_ahead_engine_t* audio; volatile int in_pause; volatile int in_resize; - volatile int eof; /* XMP engine */ mpxp_thread_t* mpxp_threads[MAX_MPXP_THREADS]; unsigned num_threads; pthread_t main_pth_id; /* doubtful stuff */ - int a_eof; // audio eof unsigned num_a_buffs; // number of audio buffers unsigned num_v_buffs; // number of video buffers }xp_core_t; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |