Commit 69d4420a authored by Anton Khirnov's avatar Anton Khirnov Committed by Michael Niedermayer

libavfilter/split: switch to filter_frame

Signed-off-by: 's avatarMichael Niedermayer <michaelni@gmx.at>
parent 94fdef81
......@@ -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)
buf_out = avfilter_ref_buffer(frame, ~AV_PERM_WRITE);
if (!buf_out) {
ret = AVERROR(ENOMEM);
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)
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 }
};
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment