mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2025-08-06 15:49:50 +08:00
lavfi: rewrite nullsrc using the code in vsrc_testsrc.c
Factorize code, extend the functionality of the filter, and make it return empty buffers. This is useful for filters which ignore the input frames content. This is also changing the syntax of the nullsrc source, and dropping the framerate expression evaluation, which does not look particularly useful.
This commit is contained in:
@ -148,6 +148,46 @@ static int request_frame(AVFilterLink *outlink)
|
||||
return 0;
|
||||
}
|
||||
|
||||
#if CONFIG_NULLSRC_FILTER
|
||||
|
||||
static const char *nullsrc_get_name(void *ctx)
|
||||
{
|
||||
return "nullsrc";
|
||||
}
|
||||
|
||||
static const AVClass nullsrc_class = {
|
||||
.class_name = "NullSourceContext",
|
||||
.item_name = nullsrc_get_name,
|
||||
.option = testsrc_options,
|
||||
};
|
||||
|
||||
static void nullsrc_fill_picture(AVFilterContext *ctx, AVFilterBufferRef *picref) { }
|
||||
|
||||
static av_cold int nullsrc_init(AVFilterContext *ctx, const char *args, void *opaque)
|
||||
{
|
||||
TestSourceContext *test = ctx->priv;
|
||||
|
||||
test->class = &nullsrc_class;
|
||||
test->fill_picture_fn = nullsrc_fill_picture;
|
||||
return init(ctx, args, opaque);
|
||||
}
|
||||
|
||||
AVFilter avfilter_vsrc_nullsrc = {
|
||||
.name = "nullsrc",
|
||||
.description = NULL_IF_CONFIG_SMALL("Null video source, return unprocessed video frames."),
|
||||
.init = nullsrc_init,
|
||||
.priv_size = sizeof(TestSourceContext),
|
||||
|
||||
.inputs = (AVFilterPad[]) {{ .name = NULL}},
|
||||
.outputs = (AVFilterPad[]) {{ .name = "default",
|
||||
.type = AVMEDIA_TYPE_VIDEO,
|
||||
.request_frame = request_frame,
|
||||
.config_props = config_props, },
|
||||
{ .name = NULL}},
|
||||
};
|
||||
|
||||
#endif /* CONFIG_NULLSRC_FILTER */
|
||||
|
||||
#if CONFIG_TESTSRC_FILTER
|
||||
|
||||
static const char *testsrc_get_name(void *ctx)
|
||||
|
Reference in New Issue
Block a user