1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2024-11-26 19:01:44 +02:00

ffmpeg: make the ac option set the demuxer's ch_layout AVOption

channels is deprecated on all supported raw demuxers.

Signed-off-by: James Almer <jamrial@gmail.com>
This commit is contained in:
James Almer 2022-03-20 17:14:13 -03:00
parent 639c2f0049
commit e78173557d

View File

@ -1116,13 +1116,12 @@ static int open_input_file(OptionsContext *o, const char *filename)
}
if (o->nb_audio_channels) {
const AVClass *priv_class;
/* because we set audio_channels based on both the "ac" and
* "channel_layout" options, we need to check that the specified
* demuxer actually has the "channels" option before setting it */
if (file_iformat && (priv_class = file_iformat->priv_class) &&
av_opt_find(&priv_class, "channels", NULL, 0,
av_opt_find(&priv_class, "ch_layout", NULL, 0,
AV_OPT_SEARCH_FAKE_OBJ)) {
av_dict_set_int(&o->g->format_opts, "channels", o->audio_channels[o->nb_audio_channels - 1].u.i, 0);
char buf[32];
snprintf(buf, sizeof(buf), "%dC", o->audio_channels[o->nb_audio_channels - 1].u.i);
av_dict_set(&o->g->format_opts, "ch_layout", buf, 0);
}
}
if (o->nb_audio_ch_layouts) {