]> git.sesse.net Git - ffmpeg/commitdiff
yadif: Flush filter on eof.
authorRobert Nagy <ronag89@gmail.com>
Mon, 14 May 2012 12:25:25 +0000 (14:25 +0200)
committerAnton Khirnov <anton@khirnov.net>
Mon, 14 May 2012 19:36:10 +0000 (21:36 +0200)
Signed-off-by: Anton Khirnov <anton@khirnov.net>
libavfilter/vf_yadif.c

index fac0e5b5f35f5b083abdfdb5e921fd1f23fd5169..1cecdd98cb5d40c70dcd9c2b82d3c0d9a7441f2a 100644 (file)
@@ -61,6 +61,7 @@ typedef struct {
                         int w, int prefs, int mrefs, int parity, int mode);
 
     const AVPixFmtDescriptor *csp;
+    int eof;
 } YADIFContext;
 
 #define CHECK(j)\
@@ -304,8 +305,21 @@ static int request_frame(AVFilterLink *link)
     do {
         int ret;
 
-        if ((ret = avfilter_request_frame(link->src->inputs[0])))
+        if (yadif->eof)
+            return AVERROR_EOF;
+
+        ret  = avfilter_request_frame(link->src->inputs[0]);
+
+        if (ret == AVERROR_EOF && yadif->next) {
+            AVFilterBufferRef *next = avfilter_ref_buffer(yadif->next, AV_PERM_READ);
+            next->pts = yadif->next->pts * 2 - yadif->cur->pts;
+
+            start_frame(link->src->inputs[0], next);
+            end_frame(link->src->inputs[0]);
+            yadif->eof = 1;
+        } else if (ret < 0) {
             return ret;
+        }
     } while (!yadif->cur);
 
     return 0;