mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2024-11-26 19:01:44 +02:00
vf_frei0r: switch to filter_frame, the filter did not support slices
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
This commit is contained in:
parent
57d9c86bf3
commit
6325957b28
@ -379,35 +379,34 @@ static int query_formats(AVFilterContext *ctx)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int null_draw_slice(AVFilterLink *inlink, int y, int h, int slice_dir)
|
static int filter_frame(AVFilterLink *inlink, AVFilterBufferRef *in)
|
||||||
{
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
static int end_frame(AVFilterLink *inlink)
|
|
||||||
{
|
{
|
||||||
Frei0rContext *frei0r = inlink->dst->priv;
|
Frei0rContext *frei0r = inlink->dst->priv;
|
||||||
AVFilterLink *outlink = inlink->dst->outputs[0];
|
AVFilterLink *outlink = inlink->dst->outputs[0];
|
||||||
AVFilterBufferRef *inpicref = inlink->cur_buf;
|
AVFilterBufferRef *out;
|
||||||
AVFilterBufferRef *outpicref = outlink->out_buf;
|
|
||||||
int ret;
|
|
||||||
|
|
||||||
frei0r->update(frei0r->instance, inpicref->pts * av_q2d(inlink->time_base) * 1000,
|
out = ff_get_video_buffer(outlink, AV_PERM_WRITE, outlink->w, outlink->h);
|
||||||
(const uint32_t *)inpicref->data[0],
|
if (!out) {
|
||||||
(uint32_t *)outpicref->data[0]);
|
avfilter_unref_bufferp(&in);
|
||||||
if ((ret = ff_draw_slice(outlink, 0, outlink->h, 1)) ||
|
return AVERROR(ENOMEM);
|
||||||
(ret = ff_end_frame(outlink)) < 0)
|
}
|
||||||
return ret;
|
avfilter_copy_buffer_ref_props(out, in);
|
||||||
return 0;
|
|
||||||
|
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[] = {
|
static const AVFilterPad avfilter_vf_frei0r_inputs[] = {
|
||||||
{
|
{
|
||||||
.name = "default",
|
.name = "default",
|
||||||
.type = AVMEDIA_TYPE_VIDEO,
|
.type = AVMEDIA_TYPE_VIDEO,
|
||||||
.draw_slice = null_draw_slice,
|
|
||||||
.config_props = config_input_props,
|
.config_props = config_input_props,
|
||||||
.end_frame = end_frame,
|
.filter_frame = filter_frame,
|
||||||
.min_perms = AV_PERM_READ
|
.min_perms = AV_PERM_READ
|
||||||
},
|
},
|
||||||
{ NULL }
|
{ NULL }
|
||||||
@ -489,8 +488,6 @@ static int source_request_frame(AVFilterLink *outlink)
|
|||||||
{
|
{
|
||||||
Frei0rContext *frei0r = outlink->src->priv;
|
Frei0rContext *frei0r = outlink->src->priv;
|
||||||
AVFilterBufferRef *picref = ff_get_video_buffer(outlink, AV_PERM_WRITE, outlink->w, outlink->h);
|
AVFilterBufferRef *picref = ff_get_video_buffer(outlink, AV_PERM_WRITE, outlink->w, outlink->h);
|
||||||
AVFilterBufferRef *buf_out;
|
|
||||||
int ret;
|
|
||||||
|
|
||||||
if (!picref)
|
if (!picref)
|
||||||
return AVERROR(ENOMEM);
|
return AVERROR(ENOMEM);
|
||||||
@ -499,28 +496,10 @@ static int source_request_frame(AVFilterLink *outlink)
|
|||||||
picref->pts = frei0r->pts++;
|
picref->pts = frei0r->pts++;
|
||||||
picref->pos = -1;
|
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}),
|
frei0r->update(frei0r->instance, av_rescale_q(picref->pts, frei0r->time_base, (AVRational){1,1000}),
|
||||||
NULL, (uint32_t *)picref->data[0]);
|
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);
|
return ff_filter_frame(outlink, picref);
|
||||||
|
|
||||||
fail:
|
|
||||||
avfilter_unref_buffer(picref);
|
|
||||||
|
|
||||||
return ret;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static const AVFilterPad avfilter_vsrc_frei0r_src_outputs[] = {
|
static const AVFilterPad avfilter_vsrc_frei0r_src_outputs[] = {
|
||||||
|
Loading…
Reference in New Issue
Block a user