diff options
author | James Almer <jamrial@gmail.com> | 2022-03-20 17:14:13 -0300 |
---|---|---|
committer | James Almer <jamrial@gmail.com> | 2022-03-22 08:45:39 -0300 |
commit | e78173557da898f18a78241cc3525b76694164b5 (patch) | |
tree | 8b8350b08d75bb0a73668272da6e75776988c21d /fftools/ffmpeg_opt.c | |
parent | 639c2f00497257cb60ecaeeac1aacfa80df3be06 (diff) | |
download | ffmpeg-e78173557da898f18a78241cc3525b76694164b5.tar.gz |
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>
Diffstat (limited to 'fftools/ffmpeg_opt.c')
-rw-r--r-- | fftools/ffmpeg_opt.c | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/fftools/ffmpeg_opt.c b/fftools/ffmpeg_opt.c index 28f5a027d5..5598f0e53d 100644 --- a/fftools/ffmpeg_opt.c +++ b/fftools/ffmpeg_opt.c @@ -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) { |