summaryrefslogtreecommitdiff
path: root/libavfilter/buffersrc.c
diff options
context:
space:
mode:
authorNicolas George <george@nsup.org>2017-07-16 17:03:50 +0200
committerNicolas George <george@nsup.org>2017-07-30 12:22:41 +0200
commit1daacba91f7c8a29858fb2de58f8695f33308fa7 (patch)
treedd44f08ef55925d2e55d9ca532b70b05e28ec002 /libavfilter/buffersrc.c
parent70eb77b34e9f08cd5e431921a2792f31e4b5265c (diff)
downloadffmpeg-1daacba91f7c8a29858fb2de58f8695f33308fa7.tar.gz
Revert "Revert "lavfi/buffersrc: push the frame deeper if requested.""
This reverts commit 04aa09c4bcf2d5a634a35da3a3ae3fc1abe30ef8 and reintroduces 0ff5567a30be6d7c804e95997ae282d6bacd76c3 that was temporarily reverted due to minor regressions. It also reverts e5bce8b4ce7b1f3a83998febdfa86a3771df96ce that fixed FATE refs. The fate-ffm change is caused by field_order now being set on the output format because the first frame arrives earlier. The fate-mxf change is assumed to be the same.
Diffstat (limited to 'libavfilter/buffersrc.c')
-rw-r--r--libavfilter/buffersrc.c25
1 files changed, 25 insertions, 0 deletions
diff --git a/libavfilter/buffersrc.c b/libavfilter/buffersrc.c
index 587b29b91a..e8f59c2de7 100644
--- a/libavfilter/buffersrc.c
+++ b/libavfilter/buffersrc.c
@@ -173,6 +173,20 @@ int attribute_align_arg av_buffersrc_add_frame_flags(AVFilterContext *ctx, AVFra
return ret;
}
+static int push_frame(AVFilterGraph *graph)
+{
+ int ret;
+
+ while (1) {
+ ret = ff_filter_graph_run_once(graph);
+ if (ret == AVERROR(EAGAIN))
+ break;
+ if (ret < 0)
+ return ret;
+ }
+ return 0;
+}
+
static int av_buffersrc_add_frame_internal(AVFilterContext *ctx,
AVFrame *frame, int flags)
{
@@ -185,6 +199,11 @@ static int av_buffersrc_add_frame_internal(AVFilterContext *ctx,
if (!frame) {
s->eof = 1;
ff_avfilter_link_set_in_status(ctx->outputs[0], AVERROR_EOF, AV_NOPTS_VALUE);
+ if ((flags & AV_BUFFERSRC_FLAG_PUSH)) {
+ ret = push_frame(ctx->graph);
+ if (ret < 0)
+ return ret;
+ }
return 0;
} else if (s->eof)
return AVERROR(EINVAL);
@@ -239,6 +258,12 @@ static int av_buffersrc_add_frame_internal(AVFilterContext *ctx,
if ((ret = ctx->output_pads[0].request_frame(ctx->outputs[0])) < 0)
return ret;
+ if ((flags & AV_BUFFERSRC_FLAG_PUSH)) {
+ ret = push_frame(ctx->graph);
+ if (ret < 0)
+ return ret;
+ }
+
return 0;
}