diff mbox series

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

Message ID 20220320193619.51185-7-jamrial@gmail.com
State New
Headers show
Series [FFmpeg-devel,1/7] avformat/pcmdec: deprecate channels option | expand

Checks

Context Check Description
yinshiyou/make_loongarch64 fail Make failed
andriy/make_armv7_RPi4 fail Make failed
andriy/make_aarch64_jetson fail Make failed

Commit Message

James Almer March 20, 2022, 7:36 p.m. UTC
Same as the AVCodecContext option.

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

Comments

Nicolas George March 20, 2022, 7:44 p.m. UTC | #1
James Almer (12022-03-20):
> Same as the AVCodecContext option.
> 
> Signed-off-by: James Almer <jamrial@gmail.com>
> ---
>  fftools/ffmpeg.h     | 2 ++
>  fftools/ffmpeg_opt.c | 8 ++++++++
>  2 files changed, 10 insertions(+)

I do not like this: it requires more typing from the user, even with the
"short" alias in the previous patch.

Also, there are many occurrences of "-ac" in the documentation, they
need to be updated too.

Regards,
James Almer March 20, 2022, 8:05 p.m. UTC | #2
On 3/20/2022 4:44 PM, Nicolas George wrote:
> James Almer (12022-03-20):
>> Same as the AVCodecContext option.
>>
>> Signed-off-by: James Almer <jamrial@gmail.com>
>> ---
>>   fftools/ffmpeg.h     | 2 ++
>>   fftools/ffmpeg_opt.c | 8 ++++++++
>>   2 files changed, 10 insertions(+)
> 
> I do not like this: it requires more typing from the user, even with the
> "short" alias in the previous patch.

Ok, patch dropped then. Will map it to set ch_layout on the underlying 
demuxer instead.

> 
> Also, there are many occurrences of "-ac" in the documentation, they
> need to be updated too.
> 
> Regards,
> 
> 
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
> 
> To unsubscribe, visit link above, or email
> ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
diff mbox series

Patch

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 |