summaryrefslogtreecommitdiffstats
path: root/libmpcodecs
diff options
context:
space:
mode:
authoruau <uau@b3059339-0415-0410-9bf9-f77b7e298cf2>2006-11-14 12:29:20 +0000
committeruau <uau@b3059339-0415-0410-9bf9-f77b7e298cf2>2006-11-14 12:29:20 +0000
commita703241aa9774c0a4024ab8fd7384088f8874f91 (patch)
tree00c35f263a7c5f3925e983ab8f081141d008fbf8 /libmpcodecs
parent2d8010498de3bb9209223ba7ebcebd01f92865b0 (diff)
downloadmpv-a703241aa9774c0a4024ab8fd7384088f8874f91.tar.bz2
mpv-a703241aa9774c0a4024ab8fd7384088f8874f91.tar.xz
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). git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@20918 b3059339-0415-0410-9bf9-f77b7e298cf2
Diffstat (limited to 'libmpcodecs')
-rw-r--r--libmpcodecs/dec_video.c22
-rw-r--r--libmpcodecs/dec_video.h3
2 files changed, 14 insertions, 11 deletions
diff --git a/libmpcodecs/dec_video.c b/libmpcodecs/dec_video.c
index be152f85fc..c5da036aef 100644
--- a/libmpcodecs/dec_video.c
+++ b/libmpcodecs/dec_video.c
@@ -315,13 +315,11 @@ return 1; // success
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 @@ t2=GetTimer();t=t2-t;
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 @@ if(ret>0) {
}
t2=GetTimer()-t2;
- tt=t2*0.000001f;
- vout_time_usage+=tt;
+ vout_time_usage += t2*0.000001;
return ret;
}
diff --git a/libmpcodecs/dec_video.h b/libmpcodecs/dec_video.h
index 08b861ccaa..c2eb34b8db 100644
--- a/libmpcodecs/dec_video.h
+++ b/libmpcodecs/dec_video.h
@@ -10,7 +10,8 @@ extern int init_best_video_codec(sh_video_t *sh_video,char** video_codec_list,ch
extern int init_video(sh_video_t *sh_video,char* codecname,char* vfm,int status);
extern void uninit_video(sh_video_t *sh_video);
-extern int decode_video(sh_video_t *sh_video,unsigned char *start,int in_size,int drop_frame, double pts);
+extern void *decode_video(sh_video_t *sh_video,unsigned char *start,int in_size,int drop_frame, double pts);
+extern int filter_video(sh_video_t *sh_video, void *frame, double pts);
extern int get_video_quality_max(sh_video_t *sh_video);
extern void set_video_quality(sh_video_t *sh_video,int quality);