summaryrefslogtreecommitdiffstats
path: root/libmpcodecs/vf_yadif.c
diff options
context:
space:
mode:
authoruau <uau@b3059339-0415-0410-9bf9-f77b7e298cf2>2006-07-06 06:58:17 +0000
committeruau <uau@b3059339-0415-0410-9bf9-f77b7e298cf2>2006-07-06 06:58:17 +0000
commite2727ec797e19fb6d4d2d3338ce17dce976e0b28 (patch)
treed66f39217166121fab9751c1b271eb0734f68999 /libmpcodecs/vf_yadif.c
parent11ade8f86d0d358e90737451983ed37075832e5e (diff)
downloadmpv-e2727ec797e19fb6d4d2d3338ce17dce976e0b28.tar.bz2
mpv-e2727ec797e19fb6d4d2d3338ce17dce976e0b28.tar.xz
Add a new video pts tracking mode, enabled by option -correct-pts.
This mode has the following differences: - Video timing is correct for streams with B frames, at least with some demuxers. - Video filters can modify frame timestamps and insert new frames, and removing frames is handled better than before. - Some things are known to break, it's not usable as the default yet. Things should work as before when the -correct-pts option is not used. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@18922 b3059339-0415-0410-9bf9-f77b7e298cf2
Diffstat (limited to 'libmpcodecs/vf_yadif.c')
-rw-r--r--libmpcodecs/vf_yadif.c38
1 files changed, 33 insertions, 5 deletions
diff --git a/libmpcodecs/vf_yadif.c b/libmpcodecs/vf_yadif.c
index 01060f2892..2c2e387e45 100644
--- a/libmpcodecs/vf_yadif.c
+++ b/libmpcodecs/vf_yadif.c
@@ -47,6 +47,10 @@
struct vf_priv_s {
int mode;
int parity;
+ int buffered_i;
+ int buffered_tff;
+ double buffered_pts;
+ mp_image_t *buffered_mpi;
int stride[3];
uint8_t *ref[4][3];
};
@@ -150,10 +154,11 @@ static int config(struct vf_instance_s* vf,
return vf_next_config(vf,width,height,d_width,d_height,flags,outfmt);
}
+static int continue_buffered_image(struct vf_instance_s *vf);
+extern int correct_pts;
+
static int put_image(struct vf_instance_s* vf, mp_image_t *mpi, double pts){
- mp_image_t *dmpi;
- int ret=0;
- int tff, i;
+ int tff;
if(vf->priv->parity < 0) {
if (mpi->fields & MP_IMGFIELD_ORDERED)
@@ -165,18 +170,41 @@ static int put_image(struct vf_instance_s* vf, mp_image_t *mpi, double pts){
store_ref(vf->priv, mpi->planes, mpi->stride, mpi->w, mpi->h);
- for(i=0; i<=(vf->priv->mode&1); i++){
+ vf->priv->buffered_mpi = mpi;
+ vf->priv->buffered_tff = tff;
+ vf->priv->buffered_i = 0;
+ vf->priv->buffered_pts = pts;
+
+ return continue_buffered_image(vf);
+}
+
+static int continue_buffered_image(struct vf_instance_s *vf)
+{
+ mp_image_t *mpi = vf->priv->buffered_mpi;
+ int tff = vf->priv->buffered_tff;
+ double pts = vf->priv->buffered_pts;
+ int i;
+ int ret=0;
+ mp_image_t *dmpi;
+
+ pts += vf->priv->buffered_i * .02; // XXX not right
+
+ for(i = vf->priv->buffered_i; i<=(vf->priv->mode&1); i++){
dmpi=vf_get_image(vf->next,mpi->imgfmt,
MP_IMGTYPE_TEMP,
MP_IMGFLAG_ACCEPT_STRIDE|MP_IMGFLAG_PREFER_ALIGNED_STRIDE,
mpi->width,mpi->height);
vf_clone_mpi_attributes(dmpi, mpi);
filter(vf->priv, dmpi->planes, dmpi->stride, mpi->w, mpi->h, i ^ tff ^ 1, tff);
+ if (correct_pts && i < (vf->priv->mode & 1))
+ vf_queue_frame(vf, continue_buffered_image);
ret |= vf_next_put_image(vf, dmpi, pts /*FIXME*/);
+ if (correct_pts)
+ break;
if(i<(vf->priv->mode&1))
vf_next_control(vf, VFCTRL_FLIP_PAGE, NULL);
}
-
+ vf->priv->buffered_i = 1;
return ret;
}