summaryrefslogtreecommitdiffstats
path: root/video/filter/vf_lavfi.c
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2014-04-28 19:44:35 +0200
committerwm4 <wm4@nowhere>2014-04-28 22:23:31 +0200
commit42f65ce1083ca38605a8c775ee339cf0cc669cb8 (patch)
treef10e5c7b5e8646eb8b8c507f09866a76b68fd9d1 /video/filter/vf_lavfi.c
parenta6dafb061fb4be0f02070acd92f8c6a0fde31823 (diff)
downloadmpv-42f65ce1083ca38605a8c775ee339cf0cc669cb8.tar.bz2
mpv-42f65ce1083ca38605a8c775ee339cf0cc669cb8.tar.xz
video: don't drop last frame when deinterlacing with yadif
Or in other words, add support for properly draining remaining frames from video filters. vf_yadif is buffering at least one frame, and the buffered frame was not retrieved on EOF. For most filters, ignore this for now, and just adjust them to the changed semantics of filter_ext. But for vf_lavfi (used by vf_yadif), real support is implemented. libavfilter handles this simply by passing a NULL frame to av_buffersrc_add_frame(), so we just have to make mp_to_av() handle NULL arguments. In load_next_vo_frame(), we first try to output a frame buffered in the VO, then the filter, and then (if EOF is reached and there's still no new frame) the VO again, with draining enabled. I guess this was implemented slightly incorrectly before, because the filter chain still could have had remaining output frames.
Diffstat (limited to 'video/filter/vf_lavfi.c')
-rw-r--r--video/filter/vf_lavfi.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/video/filter/vf_lavfi.c b/video/filter/vf_lavfi.c
index b100763e05..8e446cec1d 100644
--- a/video/filter/vf_lavfi.c
+++ b/video/filter/vf_lavfi.c
@@ -251,6 +251,8 @@ static int query_format(struct vf_instance *vf, unsigned int fmt)
static AVFrame *mp_to_av(struct vf_instance *vf, struct mp_image *img)
{
struct vf_priv_s *p = vf->priv;
+ if (!img)
+ return NULL;
uint64_t pts = img->pts == MP_NOPTS_VALUE ?
AV_NOPTS_VALUE : img->pts * av_q2d(av_inv_q(p->timebase_in));
AVFrame *frame = mp_image_to_av_frame_and_unref(img);