diff options
author | Anton Khirnov <anton@khirnov.net> | 2012-11-29 04:20:10 +0400 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2012-11-29 04:20:53 +0400 |
commit | 69d4420aeac4dad43614fcb0d9aee3ce88989612 (patch) | |
tree | d230dd598c7debd60632fefbab28c2a0188594ec | |
parent | 94fdef818e2745016263b86268344026bba0407c (diff) |
libavfilter/split: switch to filter_frame
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
-rw-r--r-- | libavfilter/split.c | 68 |
1 files changed, 9 insertions, 59 deletions
diff --git a/libavfilter/split.c b/libavfilter/split.c index 742148536b..a54bef9db6 100644 --- a/libavfilter/split.c +++ b/libavfilter/split.c @@ -68,7 +68,7 @@ static void split_uninit(AVFilterContext *ctx) av_freep(&ctx->output_pads[i].name); } -static int start_frame(AVFilterLink *inlink, AVFilterBufferRef *picref) +static int filter_frame(AVFilterLink *inlink, AVFilterBufferRef *frame) { AVFilterContext *ctx = inlink->dst; int i, ret = AVERROR_EOF; @@ -78,44 +78,17 @@ static int start_frame(AVFilterLink *inlink, AVFilterBufferRef *picref) if (ctx->outputs[i]->closed) continue; - buf_out = avfilter_ref_buffer(picref, ~AV_PERM_WRITE); - if (!buf_out) - return AVERROR(ENOMEM); - - ret = ff_start_frame(ctx->outputs[i], buf_out); - if (ret < 0) - break; - } - return ret; -} - -static int draw_slice(AVFilterLink *inlink, int y, int h, int slice_dir) -{ - AVFilterContext *ctx = inlink->dst; - 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) + buf_out = avfilter_ref_buffer(frame, ~AV_PERM_WRITE); + if (!buf_out) { + ret = AVERROR(ENOMEM); break; - } - return ret; -} - -static int end_frame(AVFilterLink *inlink) -{ - AVFilterContext *ctx = inlink->dst; - 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]); + ret = ff_filter_frame(ctx->outputs[i], buf_out); if (ret < 0) break; } + avfilter_unref_bufferp(&frame); return ret; } @@ -124,9 +97,7 @@ static const AVFilterPad avfilter_vf_split_inputs[] = { .name = "default", .type = AVMEDIA_TYPE_VIDEO, .get_video_buffer = ff_null_get_video_buffer, - .start_frame = start_frame, - .draw_slice = draw_slice, - .end_frame = end_frame, + .filter_frame = filter_frame, }, { NULL } }; @@ -142,33 +113,12 @@ AVFilter avfilter_vf_split = { .outputs = NULL, }; -static int filter_frame(AVFilterLink *inlink, AVFilterBufferRef *samplesref) -{ - AVFilterContext *ctx = inlink->dst; - int i, ret = 0; - - for (i = 0; i < ctx->nb_outputs; i++) { - AVFilterBufferRef *buf_out = avfilter_ref_buffer(samplesref, - ~AV_PERM_WRITE); - if (!buf_out) { - ret = AVERROR(ENOMEM); - break; - } - - ret = ff_filter_frame(inlink->dst->outputs[i], buf_out); - if (ret < 0) - break; - } - avfilter_unref_buffer(samplesref); - return ret; -} - static const AVFilterPad avfilter_af_asplit_inputs[] = { { .name = "default", .type = AVMEDIA_TYPE_AUDIO, .get_audio_buffer = ff_null_get_audio_buffer, - .filter_frame = filter_frame + .filter_frame = filter_frame, }, { NULL } }; |