From 9ace0dbe41c67e08291d705a8ec4b0ecbf209783 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Cl=C3=A9ment=20B=C5=93sch?= Date: Thu, 14 Mar 2013 14:36:32 +0100 Subject: [PATCH] lavfi/ebur128: use same ref for inputs and outputs. Fixes Ticket2342. --- libavfilter/f_ebur128.c | 23 ++++++----------------- 1 file changed, 6 insertions(+), 17 deletions(-) diff --git a/libavfilter/f_ebur128.c b/libavfilter/f_ebur128.c index 05ea63033f..6431dfab84 100644 --- a/libavfilter/f_ebur128.c +++ b/libavfilter/f_ebur128.c @@ -665,22 +665,6 @@ static int query_formats(AVFilterContext *ctx) static const int input_srate[] = {48000, -1}; // ITU-R BS.1770 provides coeff only for 48kHz static const enum AVPixelFormat pix_fmts[] = { AV_PIX_FMT_RGB24, AV_PIX_FMT_NONE }; - /* set input audio formats */ - formats = ff_make_format_list(sample_fmts); - if (!formats) - return AVERROR(ENOMEM); - ff_formats_ref(formats, &inlink->out_formats); - - layouts = ff_all_channel_layouts(); - if (!layouts) - return AVERROR(ENOMEM); - ff_channel_layouts_ref(layouts, &inlink->out_channel_layouts); - - formats = ff_make_format_list(input_srate); - if (!formats) - return AVERROR(ENOMEM); - ff_formats_ref(formats, &inlink->out_samplerates); - /* set optional output video format */ if (ebur128->do_video) { formats = ff_make_format_list(pix_fmts); @@ -690,20 +674,25 @@ static int query_formats(AVFilterContext *ctx) outlink = ctx->outputs[1]; } - /* set audio output formats (same as input since it's just a passthrough) */ + /* set input and output audio formats + * Note: ff_set_common_* functions are not used because they affect all the + * links, and thus break the video format negociation */ formats = ff_make_format_list(sample_fmts); if (!formats) return AVERROR(ENOMEM); + ff_formats_ref(formats, &inlink->out_formats); ff_formats_ref(formats, &outlink->in_formats); layouts = ff_all_channel_layouts(); if (!layouts) return AVERROR(ENOMEM); + ff_channel_layouts_ref(layouts, &inlink->out_channel_layouts); ff_channel_layouts_ref(layouts, &outlink->in_channel_layouts); formats = ff_make_format_list(input_srate); if (!formats) return AVERROR(ENOMEM); + ff_formats_ref(formats, &inlink->out_samplerates); ff_formats_ref(formats, &outlink->in_samplerates); return 0; -- 2.11.0