lavfi/af_pan: support unknown layouts on output.
(cherry picked from commit 4e9adc9b73
)
This commit is contained in:

committed by
Carl Eugen Hoyos

parent
02c8c064ea
commit
cf8462ce00
@@ -116,10 +116,10 @@ static av_cold int init(AVFilterContext *ctx)
|
|||||||
if (!args)
|
if (!args)
|
||||||
return AVERROR(ENOMEM);
|
return AVERROR(ENOMEM);
|
||||||
arg = av_strtok(args, "|", &tokenizer);
|
arg = av_strtok(args, "|", &tokenizer);
|
||||||
ret = ff_parse_channel_layout(&pan->out_channel_layout, NULL, arg, ctx);
|
ret = ff_parse_channel_layout(&pan->out_channel_layout,
|
||||||
|
&pan->nb_output_channels, arg, ctx);
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
goto fail;
|
goto fail;
|
||||||
pan->nb_output_channels = av_get_channel_layout_nb_channels(pan->out_channel_layout);
|
|
||||||
|
|
||||||
/* parse channel specifications */
|
/* parse channel specifications */
|
||||||
while ((arg = arg0 = av_strtok(NULL, "|", &tokenizer))) {
|
while ((arg = arg0 = av_strtok(NULL, "|", &tokenizer))) {
|
||||||
@@ -244,7 +244,9 @@ static int query_formats(AVFilterContext *ctx)
|
|||||||
|
|
||||||
// outlink supports only requested output channel layout
|
// outlink supports only requested output channel layout
|
||||||
layouts = NULL;
|
layouts = NULL;
|
||||||
ff_add_channel_layout(&layouts, pan->out_channel_layout);
|
ff_add_channel_layout(&layouts,
|
||||||
|
pan->out_channel_layout ? pan->out_channel_layout :
|
||||||
|
FF_COUNT2LAYOUT(pan->nb_output_channels));
|
||||||
ff_channel_layouts_ref(layouts, &outlink->in_channel_layouts);
|
ff_channel_layouts_ref(layouts, &outlink->in_channel_layouts);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@@ -286,6 +288,8 @@ static int config_props(AVFilterLink *link)
|
|||||||
0, ctx);
|
0, ctx);
|
||||||
if (!pan->swr)
|
if (!pan->swr)
|
||||||
return AVERROR(ENOMEM);
|
return AVERROR(ENOMEM);
|
||||||
|
if (!pan->out_channel_layout)
|
||||||
|
av_opt_set_int(pan->swr, "och", pan->nb_output_channels, 0);
|
||||||
|
|
||||||
// gains are pure, init the channel mapping
|
// gains are pure, init the channel mapping
|
||||||
if (pan->pure_gains) {
|
if (pan->pure_gains) {
|
||||||
|
Reference in New Issue
Block a user