[FFmpeg-devel] [PATCH 7/7] ffmpeg: deprecate the ac option

James Almer jamrial at gmail.com
Sun Mar 20 21:36:19 EET 2022


Same as the AVCodecContext option.

Signed-off-by: James Almer <jamrial at gmail.com>
---
 fftools/ffmpeg.h     | 2 ++
 fftools/ffmpeg_opt.c | 8 ++++++++
 2 files changed, 10 insertions(+)

diff --git a/fftools/ffmpeg.h b/fftools/ffmpeg.h
index 1e14bf9fa9..d0bc4b6afb 100644
--- a/fftools/ffmpeg.h
+++ b/fftools/ffmpeg.h
@@ -98,8 +98,10 @@ typedef struct OptionsContext {
     int        nb_codec_names;
     SpecifierOpt *audio_ch_layouts;
     int        nb_audio_ch_layouts;
+#if FF_API_OLD_CHANNEL_LAYOUT
     SpecifierOpt *audio_channels;
     int        nb_audio_channels;
+#endfi
     SpecifierOpt *audio_sample_rate;
     int        nb_audio_sample_rate;
     SpecifierOpt *frame_rates;
diff --git a/fftools/ffmpeg_opt.c b/fftools/ffmpeg_opt.c
index 720a3cc46a..4b8de9f2c3 100644
--- a/fftools/ffmpeg_opt.c
+++ b/fftools/ffmpeg_opt.c
@@ -54,7 +54,9 @@
 #define SPECIFIER_OPT_FMT_dbl  "%lf"
 
 static const char *const opt_name_codec_names[]               = {"c", "codec", "acodec", "vcodec", "scodec", "dcodec", NULL};
+#if FF_API_OLD_CHANNEL_LAYOUT
 static const char *const opt_name_audio_channels[]            = {"ac", NULL};
+#endif
 static const char *const opt_name_audio_ch_layouts[]          = {"channel_layout", "ch_layout", NULL};
 static const char *const opt_name_audio_sample_rate[]         = {"ar", NULL};
 static const char *const opt_name_frame_rates[]               = {"r", NULL};
@@ -1114,6 +1116,7 @@ static int open_input_file(OptionsContext *o, const char *filename)
     if (o->nb_audio_sample_rate) {
         av_dict_set_int(&o->g->format_opts, "sample_rate", o->audio_sample_rate[o->nb_audio_sample_rate - 1].u.i, 0);
     }
+#if FF_API_OLD_CHANNEL_LAYOUT
     if (o->nb_audio_channels) {
         const AVClass *priv_class;
         /* because we set audio_channels based on both the "ac" and
@@ -1125,6 +1128,7 @@ static int open_input_file(OptionsContext *o, const char *filename)
             av_dict_set_int(&o->g->format_opts, "channels", o->audio_channels[o->nb_audio_channels - 1].u.i, 0);
         }
     }
+#endif
     if (o->nb_audio_ch_layouts) {
         const AVClass *priv_class;
         if (file_iformat && (priv_class = file_iformat->priv_class) &&
@@ -1959,11 +1963,13 @@ static OutputStream *new_audio_stream(OptionsContext *o, AVFormatContext *oc, in
         char *layout = NULL;
         char *sample_fmt = NULL;
 
+#if FF_API_OLD_CHANNEL_LAYOUT
         MATCH_PER_STREAM_OPT(audio_channels, i, channels, oc, st);
         if (channels) {
             audio_enc->ch_layout.order       = AV_CHANNEL_ORDER_UNSPEC;
             audio_enc->ch_layout.nb_channels = channels;
         }
+#endif
 
         MATCH_PER_STREAM_OPT(audio_ch_layouts, str, layout, oc, st);
         if (layout) {
@@ -3795,9 +3801,11 @@ const OptionDef options[] = {
     { "ar",             OPT_AUDIO | HAS_ARG  | OPT_INT | OPT_SPEC |
                         OPT_INPUT | OPT_OUTPUT,                                    { .off = OFFSET(audio_sample_rate) },
         "set audio sampling rate (in Hz)", "rate" },
+#if FF_API_OLD_CHANNEL_LAYOUT
     { "ac",             OPT_AUDIO | HAS_ARG  | OPT_INT | OPT_SPEC |
                         OPT_INPUT | OPT_OUTPUT,                                    { .off = OFFSET(audio_channels) },
         "set number of audio channels", "channels" },
+#endfi
     { "an",             OPT_AUDIO | OPT_BOOL | OPT_OFFSET | OPT_INPUT | OPT_OUTPUT,{ .off = OFFSET(audio_disable) },
         "disable audio" },
     { "acodec",         OPT_AUDIO | HAS_ARG  | OPT_PERFILE |
-- 
2.35.1



More information about the ffmpeg-devel mailing list