From 42f65ce1083ca38605a8c775ee339cf0cc669cb8 Mon Sep 17 00:00:00 2001 From: wm4 Date: Mon, 28 Apr 2014 19:44:35 +0200 Subject: 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. --- video/filter/vf_lavfi.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'video/filter/vf_lavfi.c') 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); -- cgit v1.2.3