Return AVERROR_EOF if all outputs are closed.
Showing the changes to libavfilter/split.c (1 of 1 file). Show all
Unified · Split
| @@ -71,10 +71,14 @@ static void split_uninit(AVFilterContext *ctx) · 70 unmodified lines | ||
| 71 | 71 | static int start_frame(AVFilterLink *inlink, AVFilterBufferRef *picref) |
| 72 | 72 | { |
| 73 | 73 | AVFilterContext *ctx = inlink->dst; |
| 74 | − int i, ret = 0; | |
| 74 | + int i, ret = AVERROR_EOF; | |
| 75 | 75 | |
| 76 | 76 | for (i = 0; i < ctx->nb_outputs; i++) { |
| 77 | − AVFilterBufferRef *buf_out = avfilter_ref_buffer(picref, ~AV_PERM_WRITE); | |
| 77 | + AVFilterBufferRef *buf_out; | |
| 78 | + | |
| 79 | + if (ctx->outputs[i]->closed) | |
| 80 | + continue; | |
| 81 | + buf_out = avfilter_ref_buffer(picref, ~AV_PERM_WRITE); | |
| 78 | 82 | if (!buf_out) |
| 79 | 83 | return AVERROR(ENOMEM); |
| 80 | 84 | |
| @@ -88,9 +92,11 @@ static int start_frame(AVFilterLink *inlink, AVFilterBufferRef *picref) · 7 unmodified lines | ||
| 88 | 92 | static int draw_slice(AVFilterLink *inlink, int y, int h, int slice_dir) |
| 89 | 93 | { |
| 90 | 94 | AVFilterContext *ctx = inlink->dst; |
| 91 | − int i, ret = 0; | |
| 95 | + int i, ret = AVERROR_EOF; | |
| 92 | 96 | |
| 93 | 97 | for (i = 0; i < ctx->nb_outputs; i++) { |
| 98 | + if (ctx->outputs[i]->closed) | |
| 99 | + continue; | |
| 94 | 100 | ret = ff_draw_slice(ctx->outputs[i], y, h, slice_dir); |
| 95 | 101 | if (ret < 0) |
| 96 | 102 | break; |
| @@ -101,9 +107,11 @@ static int draw_slice(AVFilterLink *inlink, int y, int h, int slice_dir) · 4 unmodified lines | ||
| 101 | 107 | static int end_frame(AVFilterLink *inlink) |
| 102 | 108 | { |
| 103 | 109 | AVFilterContext *ctx = inlink->dst; |
| 104 | − int i, ret = 0; | |
| 110 | + int i, ret = AVERROR_EOF; | |
| 105 | 111 | |
| 106 | 112 | for (i = 0; i < ctx->nb_outputs; i++) { |
| 113 | + if (ctx->outputs[i]->closed) | |
| 114 | + continue; | |
| 107 | 115 | ret = ff_end_frame(ctx->outputs[i]); |
| 108 | 116 | if (ret < 0) |
| 109 | 117 | break; |