int nb_frames;
int current_frame;
int finished;
+ AVRational framerate;
} ZPContext;
#define OFFSET(x) offsetof(ZPContext, x)
{ "y", "set the y expression", OFFSET(y_expr_str), AV_OPT_TYPE_STRING, {.str="0"}, .flags = FLAGS },
{ "d", "set the duration expression", OFFSET(duration_expr_str), AV_OPT_TYPE_STRING, {.str="90"}, .flags = FLAGS },
{ "s", "set the output image size", OFFSET(w), AV_OPT_TYPE_IMAGE_SIZE, {.str="hd720"}, .flags = FLAGS },
+ { "fps", "set the output framerate", OFFSET(framerate), AV_OPT_TYPE_VIDEO_RATE, { .str = "25" }, .flags = FLAGS },
{ NULL }
};
outlink->w = s->w;
outlink->h = s->h;
+ outlink->time_base = av_inv_q(s->framerate);
+ outlink->frame_rate = s->framerate;
s->desc = av_pix_fmt_desc_get(outlink->format);
return 0;
{
ZPContext *s = ctx->priv;
AVFilterLink *outlink = ctx->outputs[0];
- int64_t pts = av_rescale_q(in->pts, ctx->inputs[0]->time_base,
- outlink->time_base) + s->frame_count;
+ int64_t pts = s->frame_count;
int k, x, y, w, h, ret = 0;
uint8_t *input[4];
int px[4], py[4];
return ret;
}
- px[1] = px[2] = FF_CEIL_RSHIFT(x, s->desc->log2_chroma_w);
+ px[1] = px[2] = AV_CEIL_RSHIFT(x, s->desc->log2_chroma_w);
px[0] = px[3] = x;
- py[1] = py[2] = FF_CEIL_RSHIFT(y, s->desc->log2_chroma_h);
+ py[1] = py[2] = AV_CEIL_RSHIFT(y, s->desc->log2_chroma_h);
py[0] = py[3] = y;
s->sws = sws_alloc_context();
double nb_frames;
int ret;
- if (s->in) {
- av_frame_free(&in);
- return 0;
- }
+ av_assert0(s->in == NULL);
s->finished = 0;
s->var_values[VAR_IN_W] = s->var_values[VAR_IW] = in->width;
AVFilterContext *ctx = outlink->src;
ZPContext *s = ctx->priv;
AVFrame *in = s->in;
- double zoom, dx, dy;
- int ret;
+ double zoom=1, dx=0, dy=0;
+ int ret = -1;
if (in) {
ret = output_single_frame(ctx, in, s->var_values, s->current_frame,
s->nb_frames = 0;
s->current_frame = 0;
av_frame_free(&s->in);
- ret = 0;
s->finished = 1;
ret = ff_request_frame(ctx->inputs[0]);
}
.name = "default",
.type = AVMEDIA_TYPE_VIDEO,
.filter_frame = filter_frame,
+ .needs_fifo = 1,
},
{ NULL }
};