X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=libavfilter%2Faf_pan.c;h=4ba77a73666e7d73db6bf907ee295b8fbfcb51b6;hb=c4ac48c5a1464e20bb02ef62da2503906349e297;hp=1b78515b55764b4adf1be2952c4c70376b3d59ed;hpb=a57ece0cb48ba131a2d6ba9d4525d9195238f18c;p=ffmpeg diff --git a/libavfilter/af_pan.c b/libavfilter/af_pan.c index 1b78515b557..4ba77a73666 100644 --- a/libavfilter/af_pan.c +++ b/libavfilter/af_pan.c @@ -50,7 +50,7 @@ typedef struct PanContext { int pure_gains; /* channel mapping specific */ - int channel_map[SWR_CH_MAX]; + int channel_map[MAX_CHANNELS]; struct SwrContext *swr; } PanContext; @@ -271,11 +271,11 @@ static int config_props(AVFilterLink *link) // sanity check; can't be done in query_formats since the inlink // channel layout is unknown at that time - if (link->channels > SWR_CH_MAX || - pan->nb_output_channels > SWR_CH_MAX) { + if (link->channels > MAX_CHANNELS || + pan->nb_output_channels > MAX_CHANNELS) { av_log(ctx, AV_LOG_ERROR, - "libswresample support a maximum of %d channels. " - "Feel free to ask for a higher limit.\n", SWR_CH_MAX); + "af_pan support a maximum of %d channels. " + "Feel free to ask for a higher limit.\n", MAX_CHANNELS); return AVERROR_PATCHWELCOME; } @@ -286,10 +286,14 @@ static int config_props(AVFilterLink *link) 0, ctx); if (!pan->swr) return AVERROR(ENOMEM); - if (!link->channel_layout) - av_opt_set_int(pan->swr, "ich", link->channels, 0); - if (!pan->out_channel_layout) - av_opt_set_int(pan->swr, "och", pan->nb_output_channels, 0); + if (!link->channel_layout) { + if (av_opt_set_int(pan->swr, "ich", link->channels, 0) < 0) + return AVERROR(EINVAL); + } + if (!pan->out_channel_layout) { + if (av_opt_set_int(pan->swr, "och", pan->nb_output_channels, 0) < 0) + return AVERROR(EINVAL); + } // gains are pure, init the channel mapping if (pan->pure_gains) {