comparison mplayer.c @ 30175:b7bb4a899a6b

Also reset time_frame and next_frame_time on reset, it makes no sense to process the sleep before playing the frame seeked to and can be annoying when the user tries to escape a series of "stuck" frames with a huge duration.
author reimar
date Mon, 04 Jan 2010 21:27:08 +0000
parents dc1d66a20ec2
children 6fb92182aff3
comparison
equal deleted inserted replaced
30174:84f7e547aaf2 30175:b7bb4a899a6b
2542 if (mpctx->sh_video) { 2542 if (mpctx->sh_video) {
2543 current_module = "seek_video_reset"; 2543 current_module = "seek_video_reset";
2544 resync_video_stream(mpctx->sh_video); 2544 resync_video_stream(mpctx->sh_video);
2545 if (vo_config_count) 2545 if (vo_config_count)
2546 mpctx->video_out->control(VOCTRL_RESET, NULL); 2546 mpctx->video_out->control(VOCTRL_RESET, NULL);
2547 mpctx->sh_video->next_frame_time = 0;
2547 mpctx->sh_video->num_buffered_pts = 0; 2548 mpctx->sh_video->num_buffered_pts = 0;
2548 mpctx->sh_video->last_pts = MP_NOPTS_VALUE; 2549 mpctx->sh_video->last_pts = MP_NOPTS_VALUE;
2549 mpctx->num_buffered_frames = 0; 2550 mpctx->num_buffered_frames = 0;
2550 mpctx->delay = 0; 2551 mpctx->delay = 0;
2552 mpctx->time_frame = 0;
2551 // Not all demuxers set d_video->pts during seek, so this value 2553 // Not all demuxers set d_video->pts during seek, so this value
2552 // (which is used by at least vobsub and edl code below) may 2554 // (which is used by at least vobsub and edl code below) may
2553 // be completely wrong (probably 0). 2555 // be completely wrong (probably 0).
2554 mpctx->sh_video->pts = mpctx->d_video->pts; 2556 mpctx->sh_video->pts = mpctx->d_video->pts;
2555 update_subtitles(mpctx->sh_video, mpctx->sh_video->pts, mpctx->d_sub, 1); 2557 update_subtitles(mpctx->sh_video, mpctx->sh_video->pts, mpctx->d_sub, 1);
3608 if(verbose) term_osd = 0; 3610 if(verbose) term_osd = 0;
3609 3611
3610 { 3612 {
3611 //int frame_corr_num=0; // 3613 //int frame_corr_num=0; //
3612 //float v_frame=0; // Video 3614 //float v_frame=0; // Video
3613 float time_frame=0; // Timer
3614 //float num_frames=0; // number of frames played 3615 //float num_frames=0; // number of frames played
3615 3616
3616 int frame_time_remaining=0; // flag 3617 int frame_time_remaining=0; // flag
3617 int blit_frame=0; 3618 int blit_frame=0;
3618 mpctx->num_buffered_frames=0; 3619 mpctx->num_buffered_frames=0;
3776 if (frame_time < 0) 3777 if (frame_time < 0)
3777 mpctx->eof = 1; 3778 mpctx->eof = 1;
3778 else { 3779 else {
3779 // might return with !eof && !blit_frame if !correct_pts 3780 // might return with !eof && !blit_frame if !correct_pts
3780 mpctx->num_buffered_frames += blit_frame; 3781 mpctx->num_buffered_frames += blit_frame;
3781 time_frame += frame_time / playback_speed; // for nosound 3782 mpctx->time_frame += frame_time / playback_speed; // for nosound
3782 } 3783 }
3783 } 3784 }
3784 3785
3785 // ========================================================================== 3786 // ==========================================================================
3786 3787
3807 last_heartbeat = now; 3808 last_heartbeat = now;
3808 system(heartbeat_cmd); 3809 system(heartbeat_cmd);
3809 } 3810 }
3810 } 3811 }
3811 3812
3812 frame_time_remaining = sleep_until_update(&time_frame, &aq_sleep_time); 3813 frame_time_remaining = sleep_until_update(&mpctx->time_frame, &aq_sleep_time);
3813 3814
3814 //====================== FLIP PAGE (VIDEO BLT): ========================= 3815 //====================== FLIP PAGE (VIDEO BLT): =========================
3815 3816
3816 current_module="flip_page"; 3817 current_module="flip_page";
3817 if (!frame_time_remaining && blit_frame) { 3818 if (!frame_time_remaining && blit_frame) {
3822 3823
3823 vout_time_usage += (GetTimer() - t2) * 0.000001; 3824 vout_time_usage += (GetTimer() - t2) * 0.000001;
3824 } 3825 }
3825 //====================== A-V TIMESTAMP CORRECTION: ========================= 3826 //====================== A-V TIMESTAMP CORRECTION: =========================
3826 3827
3827 adjust_sync_and_print_status(frame_time_remaining, time_frame); 3828 adjust_sync_and_print_status(frame_time_remaining, mpctx->time_frame);
3828 3829
3829 //============================ Auto QUALITY ============================ 3830 //============================ Auto QUALITY ============================
3830 3831
3831 /*Output quality adjustments:*/ 3832 /*Output quality adjustments:*/
3832 if(auto_quality>0){ 3833 if(auto_quality>0){