summaryrefslogtreecommitdiff
path: root/libavfilter/vf_yadif.c
diff options
context:
space:
mode:
authorRobert Nagy <ronag89@gmail.com>2012-05-14 14:25:25 +0200
committerAnton Khirnov <anton@khirnov.net>2012-05-14 21:36:10 +0200
commit394a0267abd6a292932f858949449b5cd6f8efda (patch)
tree6c7c164b5bc0fd3fb3fa6ce4191ed71f5fb38c28 /libavfilter/vf_yadif.c
parent7dd56d411e1e5afbf0c0d42b40256a59e1d2f217 (diff)
yadif: Flush filter on eof.
Signed-off-by: Anton Khirnov <anton@khirnov.net>
Diffstat (limited to 'libavfilter/vf_yadif.c')
-rw-r--r--libavfilter/vf_yadif.c16
1 files changed, 15 insertions, 1 deletions
diff --git a/libavfilter/vf_yadif.c b/libavfilter/vf_yadif.c
index fac0e5b5f3..1cecdd98cb 100644
--- a/libavfilter/vf_yadif.c
+++ b/libavfilter/vf_yadif.c
@@ -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;