diff options
author | Nicolas George <nicolas.george@normalesup.org> | 2012-08-20 21:18:46 +0400 |
---|---|---|
committer | Nicolas George <nicolas.george@normalesup.org> | 2012-08-22 21:04:30 +0400 |
commit | a9cfe656d7b52d416a1316336adb39efbeb250b8 (patch) | |
tree | f912ec1c5e36bd1f99a1cb9aeaad090a2a0fb922 /libavfilter/split.c | |
parent | 8b61abac2ee6f4184d65e8527b82cd103cc0b98b (diff) |
lavfi/split: handle closed outputs.
Return AVERROR_EOF if all outputs are closed.
Diffstat (limited to 'libavfilter/split.c')
-rw-r--r-- | libavfilter/split.c | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/libavfilter/split.c b/libavfilter/split.c index 083e31b602..b0d36f34ce 100644 --- a/libavfilter/split.c +++ b/libavfilter/split.c @@ -71,10 +71,14 @@ static void split_uninit(AVFilterContext *ctx) static int start_frame(AVFilterLink *inlink, AVFilterBufferRef *picref) { AVFilterContext *ctx = inlink->dst; - int i, ret = 0; + int i, ret = AVERROR_EOF; for (i = 0; i < ctx->nb_outputs; i++) { - AVFilterBufferRef *buf_out = avfilter_ref_buffer(picref, ~AV_PERM_WRITE); + AVFilterBufferRef *buf_out; + + if (ctx->outputs[i]->closed) + continue; + buf_out = avfilter_ref_buffer(picref, ~AV_PERM_WRITE); if (!buf_out) return AVERROR(ENOMEM); @@ -88,9 +92,11 @@ static int start_frame(AVFilterLink *inlink, AVFilterBufferRef *picref) static int draw_slice(AVFilterLink *inlink, int y, int h, int slice_dir) { AVFilterContext *ctx = inlink->dst; - int i, ret = 0; + int i, ret = AVERROR_EOF; for (i = 0; i < ctx->nb_outputs; i++) { + if (ctx->outputs[i]->closed) + continue; ret = ff_draw_slice(ctx->outputs[i], y, h, slice_dir); if (ret < 0) break; @@ -101,9 +107,11 @@ static int draw_slice(AVFilterLink *inlink, int y, int h, int slice_dir) static int end_frame(AVFilterLink *inlink) { AVFilterContext *ctx = inlink->dst; - int i, ret = 0; + int i, ret = AVERROR_EOF; for (i = 0; i < ctx->nb_outputs; i++) { + if (ctx->outputs[i]->closed) + continue; ret = ff_end_frame(ctx->outputs[i]); if (ret < 0) break; |