diff options
author | Anton Khirnov <anton@khirnov.net> | 2012-11-27 07:49:45 +0100 |
---|---|---|
committer | Anton Khirnov <anton@khirnov.net> | 2012-11-28 08:50:19 +0100 |
commit | 565e4993c63f797e2d50ad2f1e8f62fdbe299666 (patch) | |
tree | bae5282b2ee875de4b01467f3cfaab54b0ab6ec0 /libavfilter/split.c | |
parent | bb6c67bb36b136de10256f0999128df4a42f9ffc (diff) | |
download | ffmpeg-565e4993c63f797e2d50ad2f1e8f62fdbe299666.tar.gz |
lavfi: merge start_frame/draw_slice/end_frame
Any alleged performance benefits gained from the split are purely
mythological and do not justify added code complexity.
Diffstat (limited to 'libavfilter/split.c')
-rw-r--r-- | libavfilter/split.c | 64 |
1 files changed, 9 insertions, 55 deletions
diff --git a/libavfilter/split.c b/libavfilter/split.c index 01bb4489f0..c1e1669bd8 100644 --- a/libavfilter/split.c +++ b/libavfilter/split.c @@ -67,46 +67,23 @@ 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 = 0; for (i = 0; i < ctx->nb_outputs; i++) { - AVFilterBufferRef *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 = 0; - - for (i = 0; i < ctx->nb_outputs; i++) { - ret = ff_draw_slice(ctx->outputs[i], y, h, slice_dir); - if (ret < 0) + AVFilterBufferRef *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 = 0; + } - for (i = 0; i < ctx->nb_outputs; i++) { - 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; } @@ -115,9 +92,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 } }; @@ -133,33 +108,12 @@ AVFilter avfilter_vf_split = { .outputs = NULL, }; -static int filter_samples(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_samples(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_samples = filter_samples + .filter_frame = filter_frame, }, { NULL } }; |