1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2024-12-23 12:43:46 +02:00

lavfi/testsrc: free the context in uninit

Keeping stuff in the context can be useful for debugging purposes.
This commit is contained in:
Stefano Sabatini 2012-07-31 16:34:36 +02:00
parent c2502b7b34
commit 20e940e768

View File

@ -92,13 +92,11 @@ static av_cold int init(AVFilterContext *ctx, const char *args)
av_log(ctx, AV_LOG_ERROR, "Invalid frame rate: '%s'\n", test->rate); av_log(ctx, AV_LOG_ERROR, "Invalid frame rate: '%s'\n", test->rate);
return ret; return ret;
} }
av_freep(&test->rate);
if (test->duration && (ret = av_parse_time(&duration, test->duration, 1)) < 0) { if (test->duration && (ret = av_parse_time(&duration, test->duration, 1)) < 0) {
av_log(ctx, AV_LOG_ERROR, "Invalid duration: '%s'\n", test->duration); av_log(ctx, AV_LOG_ERROR, "Invalid duration: '%s'\n", test->duration);
return ret; return ret;
} }
av_freep(&test->duration);
if (test->nb_decimals && strcmp(ctx->filter->name, "testsrc")) { if (test->nb_decimals && strcmp(ctx->filter->name, "testsrc")) {
av_log(ctx, AV_LOG_WARNING, av_log(ctx, AV_LOG_WARNING,
@ -120,6 +118,13 @@ static av_cold int init(AVFilterContext *ctx, const char *args)
return 0; return 0;
} }
static av_cold void uninit(AVFilterContext *ctx)
{
TestSourceContext *test = ctx->priv;
av_opt_free(test);
}
static int config_props(AVFilterLink *outlink) static int config_props(AVFilterLink *outlink)
{ {
TestSourceContext *test = outlink->src->priv; TestSourceContext *test = outlink->src->priv;
@ -186,6 +191,7 @@ AVFilter avfilter_vsrc_nullsrc = {
.name = "nullsrc", .name = "nullsrc",
.description = NULL_IF_CONFIG_SMALL("Null video source, return unprocessed video frames."), .description = NULL_IF_CONFIG_SMALL("Null video source, return unprocessed video frames."),
.init = nullsrc_init, .init = nullsrc_init,
.uninit = uninit,
.priv_size = sizeof(TestSourceContext), .priv_size = sizeof(TestSourceContext),
.inputs = (const AVFilterPad[]) {{ .name = NULL}}, .inputs = (const AVFilterPad[]) {{ .name = NULL}},
@ -402,6 +408,7 @@ AVFilter avfilter_vsrc_testsrc = {
.description = NULL_IF_CONFIG_SMALL("Generate test pattern."), .description = NULL_IF_CONFIG_SMALL("Generate test pattern."),
.priv_size = sizeof(TestSourceContext), .priv_size = sizeof(TestSourceContext),
.init = test_init, .init = test_init,
.uninit = uninit,
.query_formats = test_query_formats, .query_formats = test_query_formats,
@ -526,6 +533,7 @@ AVFilter avfilter_vsrc_rgbtestsrc = {
.description = NULL_IF_CONFIG_SMALL("Generate RGB test pattern."), .description = NULL_IF_CONFIG_SMALL("Generate RGB test pattern."),
.priv_size = sizeof(TestSourceContext), .priv_size = sizeof(TestSourceContext),
.init = rgbtest_init, .init = rgbtest_init,
.uninit = uninit,
.query_formats = rgbtest_query_formats, .query_formats = rgbtest_query_formats,