Mercurial > mplayer.hg
diff libmpcodecs/dec_video.c @ 20902:bfb6eacd9c4a
Update OSD contents only after the correct values for the frame are known.
The most visible inaccuracy caused by the previous update location was
that the OSD always showed position 0 after seeking with demux_mkv.
Split frame decoding and filtering because with -correct-pts the pts
value that should be displayed for the frame is only known after
decoding but is needed before filtering (during which the OSD is drawn).
author | uau |
---|---|
date | Tue, 14 Nov 2006 12:29:20 +0000 |
parents | 0be2d3583f4f |
children | 213b5c14bba7 |
line wrap: on
line diff
--- a/libmpcodecs/dec_video.c Tue Nov 14 11:14:03 2006 +0000 +++ b/libmpcodecs/dec_video.c Tue Nov 14 12:29:20 2006 +0000 @@ -315,13 +315,11 @@ extern int vo_directrendering; -int decode_video(sh_video_t *sh_video,unsigned char *start,int in_size,int drop_frame, double pts){ -vf_instance_t* vf; +void *decode_video(sh_video_t *sh_video,unsigned char *start,int in_size,int drop_frame, double pts){ mp_image_t *mpi=NULL; unsigned int t=GetTimer(); unsigned int t2; double tt; -int ret; if (correct_pts) { int delay = get_current_video_decoder_lag(sh_video); @@ -373,16 +371,21 @@ tt = t*0.000001f; video_time_usage+=tt; -if(!mpi || drop_frame) return 0; // error / skipped frame +if(!mpi || drop_frame) return NULL; // error / skipped frame if (correct_pts) { sh_video->num_buffered_pts--; - pts = sh_video->buffered_pts[sh_video->num_buffered_pts]; + sh_video->pts = sh_video->buffered_pts[sh_video->num_buffered_pts]; } + return mpi; +} -//vo_draw_image(video_out,mpi); -vf=sh_video->vfilter; -ret = vf->put_image(vf,mpi, pts); // apply video filters and call the leaf vo/ve +int filter_video(sh_video_t *sh_video, void *frame, double pts) { +mp_image_t *mpi = frame; +unsigned int t2 = GetTimer(); +vf_instance_t *vf = sh_video->vfilter; +// apply video filters and call the leaf vo/ve +int ret = vf->put_image(vf,mpi, pts); if(ret>0) { vf->control(vf,VFCTRL_DRAW_OSD,NULL); #ifdef USE_ASS @@ -391,8 +394,7 @@ } t2=GetTimer()-t2; - tt=t2*0.000001f; - vout_time_usage+=tt; + vout_time_usage += t2*0.000001; return ret; }