aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAnton Khirnov <anton@khirnov.net>2012-11-28 19:45:48 +0100
committerMichael Niedermayer <michaelni@gmx.at>2012-11-28 20:06:06 +0100
commit6325957b28858b10913e6b476f6936c473093a6f (patch)
treeb4a799e7e8fa3f392b9148883c72d46a376d1f4b
parent57d9c86bf34e81fb6f94b576dcae06766dce7047 (diff)
downloadffmpeg-6325957b28858b10913e6b476f6936c473093a6f.tar.gz
vf_frei0r: switch to filter_frame, the filter did not support slices
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
-rw-r--r--libavfilter/vf_frei0r.c59
1 files changed, 19 insertions, 40 deletions
diff --git a/libavfilter/vf_frei0r.c b/libavfilter/vf_frei0r.c
index 7e89e57049..0fb86b4267 100644
--- a/libavfilter/vf_frei0r.c
+++ b/libavfilter/vf_frei0r.c
@@ -379,35 +379,34 @@ static int query_formats(AVFilterContext *ctx)
return 0;
}
-static int null_draw_slice(AVFilterLink *inlink, int y, int h, int slice_dir)
-{
- return 0;
-}
-
-static int end_frame(AVFilterLink *inlink)
+static int filter_frame(AVFilterLink *inlink, AVFilterBufferRef *in)
{
Frei0rContext *frei0r = inlink->dst->priv;
AVFilterLink *outlink = inlink->dst->outputs[0];
- AVFilterBufferRef *inpicref = inlink->cur_buf;
- AVFilterBufferRef *outpicref = outlink->out_buf;
- int ret;
-
- frei0r->update(frei0r->instance, inpicref->pts * av_q2d(inlink->time_base) * 1000,
- (const uint32_t *)inpicref->data[0],
- (uint32_t *)outpicref->data[0]);
- if ((ret = ff_draw_slice(outlink, 0, outlink->h, 1)) ||
- (ret = ff_end_frame(outlink)) < 0)
- return ret;
- return 0;
+ AVFilterBufferRef *out;
+
+ out = ff_get_video_buffer(outlink, AV_PERM_WRITE, outlink->w, outlink->h);
+ if (!out) {
+ avfilter_unref_bufferp(&in);
+ return AVERROR(ENOMEM);
+ }
+ avfilter_copy_buffer_ref_props(out, in);
+
+ frei0r->update(frei0r->instance, in->pts * av_q2d(inlink->time_base) * 1000,
+ (const uint32_t *)in->data[0],
+ (uint32_t *)out->data[0]);
+
+ avfilter_unref_bufferp(&in);
+
+ return ff_filter_frame(outlink, out);
}
static const AVFilterPad avfilter_vf_frei0r_inputs[] = {
{
.name = "default",
.type = AVMEDIA_TYPE_VIDEO,
- .draw_slice = null_draw_slice,
.config_props = config_input_props,
- .end_frame = end_frame,
+ .filter_frame = filter_frame,
.min_perms = AV_PERM_READ
},
{ NULL }
@@ -489,8 +488,6 @@ static int source_request_frame(AVFilterLink *outlink)
{
Frei0rContext *frei0r = outlink->src->priv;
AVFilterBufferRef *picref = ff_get_video_buffer(outlink, AV_PERM_WRITE, outlink->w, outlink->h);
- AVFilterBufferRef *buf_out;
- int ret;
if (!picref)
return AVERROR(ENOMEM);
@@ -499,28 +496,10 @@ static int source_request_frame(AVFilterLink *outlink)
picref->pts = frei0r->pts++;
picref->pos = -1;
- buf_out = avfilter_ref_buffer(picref, ~0);
- if (!buf_out) {
- ret = AVERROR(ENOMEM);
- goto fail;
- }
-
- ret = ff_start_frame(outlink, buf_out);
- if (ret < 0)
- goto fail;
-
frei0r->update(frei0r->instance, av_rescale_q(picref->pts, frei0r->time_base, (AVRational){1,1000}),
NULL, (uint32_t *)picref->data[0]);
- ret = ff_draw_slice(outlink, 0, outlink->h, 1);
- if (ret < 0)
- goto fail;
-
- ret = ff_end_frame(outlink);
-
-fail:
- avfilter_unref_buffer(picref);
- return ret;
+ return ff_filter_frame(outlink, picref);
}
static const AVFilterPad avfilter_vsrc_frei0r_src_outputs[] = {