diff options
author | Rudolf Polzer <divverent@alientrap.org> | 2011-04-23 18:56:47 +0200 |
---|---|---|
committer | Uoti Urpala <uau@mplayer2.org> | 2011-04-24 03:55:47 +0300 |
commit | 994b21a80a2f37b0d672526739cb742b87f33ad9 (patch) | |
tree | 222e014be69723c4772d5045fee35eb98ffc8a63 /libmpcodecs/vf_softpulldown.c | |
parent | 28b3cc0efe7a575cb8004d1b109ce5ca2f2953bb (diff) | |
download | mpv-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_softpulldown.c')
-rw-r--r-- | libmpcodecs/vf_softpulldown.c | 31 |
1 files changed, 26 insertions, 5 deletions
diff --git a/libmpcodecs/vf_softpulldown.c b/libmpcodecs/vf_softpulldown.c index ab45c698ce..5bd5e66bfd 100644 --- a/libmpcodecs/vf_softpulldown.c +++ b/libmpcodecs/vf_softpulldown.c @@ -33,8 +33,22 @@ struct vf_priv_s { int state; long long in; long long out; + struct vf_detc_pts_buf ptsbuf; + int last_frame_duration; + double buffered_pts; + mp_image_t *buffered_mpi; + int buffered_last_frame_duration; }; +static int continue_buffered_image(struct vf_instance *vf) +{ + double pts = vf->priv->buffered_pts; + mp_image_t *mpi = vf->priv->buffered_mpi; + vf->priv->out++; + vf->priv->state=0; + return vf_next_put_image(vf, mpi, vf_softpulldown_adjust_pts(&vf->priv->ptsbuf, pts, 0, 0, vf->priv->buffered_last_frame_duration)); +} + static int put_image(struct vf_instance *vf, mp_image_t *mpi, double pts) { mp_image_t *dmpi; @@ -61,7 +75,7 @@ static int put_image(struct vf_instance *vf, mp_image_t *mpi, double pts) } if (state == 0) { - ret = vf_next_put_image(vf, mpi, MP_NOPTS_VALUE); + ret = vf_next_put_image(vf, mpi, vf_softpulldown_adjust_pts(&vf->priv->ptsbuf, pts, 0, 0, vf->priv->last_frame_duration)); vf->priv->out++; if (flags & MP_IMGFIELD_REPEAT_FIRST) { my_memcpy_pic(dmpi->planes[0], @@ -97,12 +111,13 @@ static int put_image(struct vf_instance *vf, mp_image_t *mpi, double pts) mpi->chroma_width, mpi->chroma_height/2, dmpi->stride[2]*2, mpi->stride[2]*2); } - ret = vf_next_put_image(vf, dmpi, MP_NOPTS_VALUE); + ret = vf_next_put_image(vf, dmpi, vf_softpulldown_adjust_pts(&vf->priv->ptsbuf, pts, 0, 0, vf->priv->last_frame_duration)); vf->priv->out++; if (flags & MP_IMGFIELD_REPEAT_FIRST) { - ret |= vf_next_put_image(vf, mpi, MP_NOPTS_VALUE); - vf->priv->out++; - state=0; + vf->priv->buffered_mpi = mpi; + vf->priv->buffered_pts = pts; + vf->priv->buffered_last_frame_duration = vf->priv->last_frame_duration; + vf_queue_frame(vf, continue_buffered_image); } else { my_memcpy_pic(dmpi->planes[0], mpi->planes[0], mpi->w, mpi->h/2, @@ -125,6 +140,10 @@ static int put_image(struct vf_instance *vf, mp_image_t *mpi, double pts) } vf->priv->state = state; + if (flags & MP_IMGFIELD_REPEAT_FIRST) + vf->priv->last_frame_duration = 3; + else + vf->priv->last_frame_duration = 2; return ret; } @@ -151,6 +170,8 @@ static int vf_open(vf_instance_t *vf, char *args) vf->default_reqs = VFCAP_ACCEPT_STRIDE; vf->priv = p = calloc(1, sizeof(struct vf_priv_s)); vf->priv->state = 0; + vf->priv->last_frame_duration = 2; + vf_detc_init_pts_buf(&vf->priv->ptsbuf); return 1; } |