1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2024-11-21 10:55:51 +02:00

vf_fps: switch to filter_frame

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
This commit is contained in:
Anton Khirnov 2012-11-28 19:28:41 +01:00 committed by Michael Niedermayer
parent e67fdbffe5
commit 92b57e8dac

View File

@ -152,9 +152,7 @@ static int request_frame(AVFilterLink *outlink)
buf->pts = av_rescale_q(s->first_pts, ctx->inputs[0]->time_base,
outlink->time_base) + s->frames_out;
if ((ret = ff_start_frame(outlink, buf)) < 0 ||
(ret = ff_draw_slice(outlink, 0, outlink->h, 1)) < 0 ||
(ret = ff_end_frame(outlink)) < 0)
if ((ret = ff_filter_frame(outlink, buf)) < 0)
return ret;
s->frames_out++;
@ -179,16 +177,14 @@ static int write_to_fifo(AVFifoBuffer *fifo, AVFilterBufferRef *buf)
return 0;
}
static int end_frame(AVFilterLink *inlink)
static int filter_frame(AVFilterLink *inlink, AVFilterBufferRef *buf)
{
AVFilterContext *ctx = inlink->dst;
FPSContext *s = ctx->priv;
AVFilterLink *outlink = ctx->outputs[0];
AVFilterBufferRef *buf = inlink->cur_buf;
int64_t delta;
int i, ret;
inlink->cur_buf = NULL;
s->frames_in++;
/* discard frames until we get the first timestamp */
if (s->pts == AV_NOPTS_VALUE) {
@ -259,9 +255,7 @@ static int end_frame(AVFilterLink *inlink)
buf_out->pts = av_rescale_q(s->first_pts, inlink->time_base,
outlink->time_base) + s->frames_out;
if ((ret = ff_start_frame(outlink, buf_out)) < 0 ||
(ret = ff_draw_slice(outlink, 0, outlink->h, 1)) < 0 ||
(ret = ff_end_frame(outlink)) < 0) {
if ((ret = ff_filter_frame(outlink, buf_out)) < 0) {
avfilter_unref_bufferp(&buf);
return ret;
}
@ -276,24 +270,12 @@ static int end_frame(AVFilterLink *inlink)
return ret;
}
static int null_start_frame(AVFilterLink *link, AVFilterBufferRef *buf)
{
return 0;
}
static int null_draw_slice(AVFilterLink *link, int y, int h, int slice_dir)
{
return 0;
}
static const AVFilterPad avfilter_vf_fps_inputs[] = {
{
.name = "default",
.type = AVMEDIA_TYPE_VIDEO,
.min_perms = AV_PERM_READ | AV_PERM_PRESERVE,
.start_frame = null_start_frame,
.draw_slice = null_draw_slice,
.end_frame = end_frame,
.filter_frame = filter_frame,
},
{ NULL }
};