return 0;
}
-static AVFilterBufferRef *get_video_buffer(AVFilterLink *link, int perms,
- int w, int h)
+static AVFrame *get_video_buffer(AVFilterLink *link, int w, int h)
{
FlipContext *flip = link->dst->priv;
- AVFilterBufferRef *picref;
+ AVFrame *frame;
int i;
- if (!(perms & AV_PERM_NEG_LINESIZES))
- return ff_default_get_video_buffer(link, perms, w, h);
-
- picref = ff_get_video_buffer(link->dst->outputs[0], perms, w, h);
- if (!picref)
+ frame = ff_get_video_buffer(link->dst->outputs[0], w, h);
+ if (!frame)
return NULL;
for (i = 0; i < 4; i ++) {
int vsub = i == 1 || i == 2 ? flip->vsub : 0;
- if (picref->data[i]) {
- picref->data[i] += ((h >> vsub)-1) * picref->linesize[i];
- picref->linesize[i] = -picref->linesize[i];
+ if (frame->data[i]) {
+ frame->data[i] += ((h >> vsub) - 1) * frame->linesize[i];
+ frame->linesize[i] = -frame->linesize[i];
}
}
- return picref;
+ return frame;
}
-static int start_frame(AVFilterLink *link, AVFilterBufferRef *inpicref)
+static int filter_frame(AVFilterLink *link, AVFrame *frame)
{
FlipContext *flip = link->dst->priv;
- AVFilterBufferRef *outpicref = avfilter_ref_buffer(inpicref, ~0);
int i;
- if (!outpicref)
- return AVERROR(ENOMEM);
-
for (i = 0; i < 4; i ++) {
int vsub = i == 1 || i == 2 ? flip->vsub : 0;
- if (outpicref->data[i]) {
- outpicref->data[i] += ((link->h >> vsub)-1) * outpicref->linesize[i];
- outpicref->linesize[i] = -outpicref->linesize[i];
+ if (frame->data[i]) {
+ frame->data[i] += ((link->h >> vsub)-1) * frame->linesize[i];
+ frame->linesize[i] = -frame->linesize[i];
}
}
- return ff_start_frame(link->dst->outputs[0], outpicref);
+ return ff_filter_frame(link->dst->outputs[0], frame);
}
-
-static int draw_slice(AVFilterLink *link, int y, int h, int slice_dir)
-{
- AVFilterContext *ctx = link->dst;
-
- return ff_draw_slice(ctx->outputs[0], link->h - (y+h), h, -1 * slice_dir);
-}
-
static const AVFilterPad avfilter_vf_vflip_inputs[] = {
{
.name = "default",
.type = AVMEDIA_TYPE_VIDEO,
.get_video_buffer = get_video_buffer,
- .start_frame = start_frame,
- .draw_slice = draw_slice,
+ .filter_frame = filter_frame,
.config_props = config_input,
},
{ NULL }
{ NULL }
};
-AVFilter avfilter_vf_vflip = {
+AVFilter ff_vf_vflip = {
.name = "vflip",
.description = NULL_IF_CONFIG_SMALL("Flip the input video vertically."),