[FFmpeg-cvslog] ffmpeg: make the ac option set the demuxer's ch_layout AVOption

James Almer git at videolan.org
Tue Mar 22 14:01:31 EET 2022


ffmpeg | branch: master | James Almer <jamrial at gmail.com> | Sun Mar 20 17:14:13 2022 -0300| [e78173557da898f18a78241cc3525b76694164b5] | committer: James Almer

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 at gmail.com>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=e78173557da898f18a78241cc3525b76694164b5
---

 fftools/ffmpeg_opt.c | 9 ++++-----
 1 file 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) {



More information about the ffmpeg-cvslog mailing list