Mercurial > mplayer.hg
comparison 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 |
comparison
equal
deleted
inserted
replaced
20901:b875b84a511e | 20902:bfb6eacd9c4a |
---|---|
313 return 1; // success | 313 return 1; // success |
314 } | 314 } |
315 | 315 |
316 extern int vo_directrendering; | 316 extern int vo_directrendering; |
317 | 317 |
318 int decode_video(sh_video_t *sh_video,unsigned char *start,int in_size,int drop_frame, double pts){ | 318 void *decode_video(sh_video_t *sh_video,unsigned char *start,int in_size,int drop_frame, double pts){ |
319 vf_instance_t* vf; | |
320 mp_image_t *mpi=NULL; | 319 mp_image_t *mpi=NULL; |
321 unsigned int t=GetTimer(); | 320 unsigned int t=GetTimer(); |
322 unsigned int t2; | 321 unsigned int t2; |
323 double tt; | 322 double tt; |
324 int ret; | |
325 | 323 |
326 if (correct_pts) { | 324 if (correct_pts) { |
327 int delay = get_current_video_decoder_lag(sh_video); | 325 int delay = get_current_video_decoder_lag(sh_video); |
328 if (delay >= 0) { | 326 if (delay >= 0) { |
329 if (delay > sh_video->num_buffered_pts) | 327 if (delay > sh_video->num_buffered_pts) |
371 | 369 |
372 t2=GetTimer();t=t2-t; | 370 t2=GetTimer();t=t2-t; |
373 tt = t*0.000001f; | 371 tt = t*0.000001f; |
374 video_time_usage+=tt; | 372 video_time_usage+=tt; |
375 | 373 |
376 if(!mpi || drop_frame) return 0; // error / skipped frame | 374 if(!mpi || drop_frame) return NULL; // error / skipped frame |
377 | 375 |
378 if (correct_pts) { | 376 if (correct_pts) { |
379 sh_video->num_buffered_pts--; | 377 sh_video->num_buffered_pts--; |
380 pts = sh_video->buffered_pts[sh_video->num_buffered_pts]; | 378 sh_video->pts = sh_video->buffered_pts[sh_video->num_buffered_pts]; |
381 } | 379 } |
382 | 380 return mpi; |
383 //vo_draw_image(video_out,mpi); | 381 } |
384 vf=sh_video->vfilter; | 382 |
385 ret = vf->put_image(vf,mpi, pts); // apply video filters and call the leaf vo/ve | 383 int filter_video(sh_video_t *sh_video, void *frame, double pts) { |
384 mp_image_t *mpi = frame; | |
385 unsigned int t2 = GetTimer(); | |
386 vf_instance_t *vf = sh_video->vfilter; | |
387 // apply video filters and call the leaf vo/ve | |
388 int ret = vf->put_image(vf,mpi, pts); | |
386 if(ret>0) { | 389 if(ret>0) { |
387 vf->control(vf,VFCTRL_DRAW_OSD,NULL); | 390 vf->control(vf,VFCTRL_DRAW_OSD,NULL); |
388 #ifdef USE_ASS | 391 #ifdef USE_ASS |
389 vf->control(vf,VFCTRL_DRAW_EOSD,NULL); | 392 vf->control(vf,VFCTRL_DRAW_EOSD,NULL); |
390 #endif | 393 #endif |
391 } | 394 } |
392 | 395 |
393 t2=GetTimer()-t2; | 396 t2=GetTimer()-t2; |
394 tt=t2*0.000001f; | 397 vout_time_usage += t2*0.000001; |
395 vout_time_usage+=tt; | |
396 | 398 |
397 return ret; | 399 return ret; |
398 } | 400 } |