summaryrefslogtreecommitdiffstats
path: root/libmpcodecs/vf_detc.c
diff options
context:
space:
mode:
authorRudolf Polzer <divverent@alientrap.org>2011-04-23 18:56:47 +0200
committerUoti Urpala <uau@mplayer2.org>2011-04-24 03:55:47 +0300
commit994b21a80a2f37b0d672526739cb742b87f33ad9 (patch)
tree222e014be69723c4772d5045fee35eb98ffc8a63 /libmpcodecs/vf_detc.c
parent28b3cc0efe7a575cb8004d1b109ce5ca2f2953bb (diff)
downloadmpv-994b21a80a2f37b0d672526739cb742b87f33ad9.tar.bz2
mpv-994b21a80a2f37b0d672526739cb742b87f33ad9.tar.xz
vf_*: fix pts values passed to the next filter
Many video filters failed to calculate or even just pass through pts values for their output frames. Fix this, and also make the two remaining filters that called vf_next_put_image() twice for the same input frame (vf_softpulldown, vf_telecine) use vf_queue_frame() so that e.g. framestepping properly sees both frames. Changed filters: vf_bmovl, vf_detc, vf_divtc, vf_filmdint, vf_ivtc, vf_lavc, vf_phase, vf_pullup, vf_softpulldown, vf_telecine, vf_tile, vf_tinterlace.
Diffstat (limited to 'libmpcodecs/vf_detc.c')
-rw-r--r--libmpcodecs/vf_detc.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/libmpcodecs/vf_detc.c b/libmpcodecs/vf_detc.c
index cf294ac7f7..bbc22fca6c 100644
--- a/libmpcodecs/vf_detc.c
+++ b/libmpcodecs/vf_detc.c
@@ -45,6 +45,7 @@ struct vf_priv_s {
int mode;
int (*analyze)(struct vf_priv_s *, mp_image_t *, mp_image_t *);
int needread;
+ struct vf_detc_pts_buf ptsbuf;
};
#define COMPE(a,b,e) (abs((a)-(b)) < (((a)+(b))>>(e)))
@@ -285,7 +286,7 @@ static void copy_image(mp_image_t *dmpi, mp_image_t *mpi, int field)
}
}
-static int do_put_image(struct vf_instance *vf, mp_image_t *dmpi)
+static int do_put_image(struct vf_instance *vf, mp_image_t *dmpi, double pts)
{
struct vf_priv_s *p = vf->priv;
int dropflag;
@@ -306,11 +307,12 @@ static int do_put_image(struct vf_instance *vf, mp_image_t *dmpi)
mp_msg(MSGT_VFILTER, MSGL_V, "drop! [%d/%d=%g]\n",
p->outframes, p->inframes, (float)p->outframes/p->inframes);
p->lastdrop = 0;
+ vf_detc_adjust_pts(&p->ptsbuf, pts, 0, 1);
return 0;
}
p->outframes++;
- return vf_next_put_image(vf, dmpi, MP_NOPTS_VALUE);
+ return vf_next_put_image(vf, dmpi, vf_detc_adjust_pts(&p->ptsbuf, pts, 0, 0));
}
static int put_image(struct vf_instance *vf, mp_image_t *mpi, double pts)
@@ -335,22 +337,24 @@ static int put_image(struct vf_instance *vf, mp_image_t *mpi, double pts)
/* Don't copy anything unless we'll need to read it. */
if (p->needread) copy_image(dmpi, mpi, 2);
p->lastdrop = 0;
+ vf_detc_adjust_pts(&p->ptsbuf, pts, 0, 1);
break;
case TC_PROG:
/* Copy and display the whole frame. */
copy_image(dmpi, mpi, 2);
- ret = do_put_image(vf, dmpi);
+ ret = do_put_image(vf, dmpi, pts);
break;
case TC_IL1:
/* Only copy bottom field unless we need to read. */
if (p->needread) copy_image(dmpi, mpi, 2);
else copy_image(dmpi, mpi, 1);
p->lastdrop = 0;
+ vf_detc_adjust_pts(&p->ptsbuf, pts, 0, 1);
break;
case TC_IL2:
/* Copy top field and show frame, then copy bottom if needed. */
copy_image(dmpi, mpi, 0);
- ret = do_put_image(vf, dmpi);
+ ret = do_put_image(vf, dmpi, pts);
if (p->needread) copy_image(dmpi, mpi, 1);
break;
}
@@ -440,6 +444,7 @@ static int vf_open(vf_instance_t *vf, char *args)
if (args) parse_args(p, args);
p->analyze = anal_funcs[p->mode].func;
p->needread = anal_funcs[p->mode].needread;
+ vf_detc_init_pts_buf(&p->ptsbuf);
return 1;
}