[FFmpeg-cvslog] libavfilter/split: switch to filter_frame
Anton Khirnov
git at videolan.org
Thu Nov 29 01:24:35 CET 2012
ffmpeg | branch: master | Anton Khirnov <anton at khirnov.net> | Thu Nov 29 01:20:10 2012 +0100| [69d4420aeac4dad43614fcb0d9aee3ce88989612] | committer: Michael Niedermayer
libavfilter/split: switch to filter_frame
Signed-off-by: Michael Niedermayer <michaelni at gmx.at>
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=69d4420aeac4dad43614fcb0d9aee3ce88989612
---
libavfilter/split.c | 68 +++++++--------------------------------------------
1 file changed, 9 insertions(+), 59 deletions(-)
diff --git a/libavfilter/split.c b/libavfilter/split.c
index 7421485..a54bef9 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 }
};
More information about the ffmpeg-cvslog
mailing list