summaryrefslogtreecommitdiff
path: root/libavfilter
diff options
context:
space:
mode:
authorMarton Balint <cus@passwd.hu>2017-04-05 01:41:15 +0200
committerMarton Balint <cus@passwd.hu>2017-04-12 20:21:11 +0200
commit51948b9d9e97e9065296db1d04885c1b45a1b250 (patch)
treeee7f96b0ef40859eef1bae1087cfe927a0679b76 /libavfilter
parentf1d80bc6305221506ad96f0ab82088f9229881ab (diff)
avfilter/vf_framerate: always request input if no output is provided in request_frame
Fixes ticket #6285. Signed-off-by: Marton Balint <cus@passwd.hu>
Diffstat (limited to 'libavfilter')
-rw-r--r--libavfilter/vf_framerate.c42
1 files changed, 26 insertions, 16 deletions
diff --git a/libavfilter/vf_framerate.c b/libavfilter/vf_framerate.c
index b4a74f7f7d..dc8b05f40f 100644
--- a/libavfilter/vf_framerate.c
+++ b/libavfilter/vf_framerate.c
@@ -440,7 +440,7 @@ copy_done:
s->pending_end_frame = 0;
s->last_dest_frame_pts = s->work->pts;
- return ff_filter_frame(ctx->outputs[0], s->work);
+ return 1;
}
static void set_srce_frame_dest_pts(AVFilterContext *ctx)
@@ -586,6 +586,7 @@ static int config_input(AVFilterLink *inlink)
static int filter_frame(AVFilterLink *inlink, AVFrame *inpicref)
{
+ int ret;
AVFilterContext *ctx = inlink->dst;
FrameRateContext *s = ctx->priv;
@@ -606,7 +607,10 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *inpicref)
set_srce_frame_dest_pts(ctx);
}
- return process_work_frame(ctx, 1);
+ ret = process_work_frame(ctx, 1);
+ if (ret < 0)
+ return ret;
+ return ret ? ff_filter_frame(ctx->outputs[0], s->work) : 0;
}
static int config_output(AVFilterLink *outlink)
@@ -658,23 +662,13 @@ static int request_frame(AVFilterLink *outlink)
{
AVFilterContext *ctx = outlink->src;
FrameRateContext *s = ctx->priv;
- int val, i;
+ int ret, i;
ff_dlog(ctx, "request_frame()\n");
// if there is no "next" frame AND we are not in flush then get one from our input filter
- if (!s->srce[s->frst] && !s->flush) {
- ff_dlog(ctx, "request_frame() call source's request_frame()\n");
- val = ff_request_frame(outlink->src->inputs[0]);
- if (val < 0 && (val != AVERROR_EOF)) {
- ff_dlog(ctx, "request_frame() source's request_frame() returned error:%d\n", val);
- return val;
- } else if (val == AVERROR_EOF) {
- s->flush = 1;
- }
- ff_dlog(ctx, "request_frame() source's request_frame() returned:%d\n", val);
- return 0;
- }
+ if (!s->srce[s->frst] && !s->flush)
+ goto request;
ff_dlog(ctx, "request_frame() REPEAT or FLUSH\n");
@@ -695,7 +689,23 @@ static int request_frame(AVFilterLink *outlink)
}
set_work_frame_pts(ctx);
- return process_work_frame(ctx, 0);
+ ret = process_work_frame(ctx, 0);
+ if (ret < 0)
+ return ret;
+ if (ret)
+ return ff_filter_frame(ctx->outputs[0], s->work);
+
+request:
+ ff_dlog(ctx, "request_frame() call source's request_frame()\n");
+ ret = ff_request_frame(ctx->inputs[0]);
+ if (ret < 0 && (ret != AVERROR_EOF)) {
+ ff_dlog(ctx, "request_frame() source's request_frame() returned error:%d\n", ret);
+ return ret;
+ } else if (ret == AVERROR_EOF) {
+ s->flush = 1;
+ }
+ ff_dlog(ctx, "request_frame() source's request_frame() returned:%d\n", ret);
+ return 0;
}
static const AVFilterPad framerate_inputs[] = {