aboutsummaryrefslogtreecommitdiffstats
path: root/libavfilter/buffersrc.c
diff options
context:
space:
mode:
authorNicolas George <george@nsup.org>2017-04-03 15:01:45 +0200
committerNicolas George <george@nsup.org>2017-09-08 10:31:01 +0200
commit5ba2aef6ec47689300debd3ddd1f39cad010a971 (patch)
treebc5a3961a346ea4cde75cf7806f18ce3fb79832c /libavfilter/buffersrc.c
parent36c111c40f4bd7da114df0e9c484833aa2cdf2dc (diff)
downloadffmpeg-5ba2aef6ec47689300debd3ddd1f39cad010a971.tar.gz
lavfi/buffersrc: add av_buffersrc_close().
Diffstat (limited to 'libavfilter/buffersrc.c')
-rw-r--r--libavfilter/buffersrc.c22
1 files changed, 12 insertions, 10 deletions
diff --git a/libavfilter/buffersrc.c b/libavfilter/buffersrc.c
index e8f59c2de7..ad5aedd5f7 100644
--- a/libavfilter/buffersrc.c
+++ b/libavfilter/buffersrc.c
@@ -196,16 +196,9 @@ static int av_buffersrc_add_frame_internal(AVFilterContext *ctx,
s->nb_failed_requests = 0;
- 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)
+ if (!frame)
+ return av_buffersrc_close(ctx, AV_NOPTS_VALUE, flags);
+ if (s->eof)
return AVERROR(EINVAL);
refcounted = !!frame->buf[0];
@@ -267,6 +260,15 @@ static int av_buffersrc_add_frame_internal(AVFilterContext *ctx,
return 0;
}
+int av_buffersrc_close(AVFilterContext *ctx, int64_t pts, unsigned flags)
+{
+ BufferSourceContext *s = ctx->priv;
+
+ s->eof = 1;
+ ff_avfilter_link_set_in_status(ctx->outputs[0], AVERROR_EOF, pts);
+ return (flags & AV_BUFFERSRC_FLAG_PUSH) ? push_frame(ctx->graph) : 0;
+}
+
static av_cold int init_video(AVFilterContext *ctx)
{
BufferSourceContext *c = ctx->priv;