From fdff1b9cbfd8cf5a9810c29efa4baf13a4786742 Mon Sep 17 00:00:00 2001 From: Andreas Rheinhardt Date: Mon, 26 Sep 2022 01:10:51 +0200 Subject: avcodec/codec_internal: Avoid deprecation warnings for channel_layouts AVCodec.channel_layouts is deprecated and Clang (unlike GCC) warns when setting this field in a codec definition. Fortunately, Clang (unlike GCC) allows to use FF_DISABLE_DEPRECATION_WARNINGS inside a definition (of an FFCodec), so that one can create simple macros to set AVCodec.channel_layouts that also suppress deprecation warnings for Clang. (Notice that some of the codec definitions were already inside FF_DISABLE/ENABLE_DEPRECATION_WARNINGS (that were not guarded by FF_API_OLD_CHANNEL_LAYOUT); these have been removed. Also notice that setting AVCodec.channel_layouts was not guarded by FF_API_OLD_CHANNEL_LAYOUT either, so testing disabling it it without removing all the codeblocks would not have worked.) Signed-off-by: Andreas Rheinhardt --- libavcodec/eac3enc.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) (limited to 'libavcodec/eac3enc.c') diff --git a/libavcodec/eac3enc.c b/libavcodec/eac3enc.c index 648c93dcaa..78d4f1399a 100644 --- a/libavcodec/eac3enc.c +++ b/libavcodec/eac3enc.c @@ -249,7 +249,6 @@ void ff_eac3_output_frame_header(AC3EncodeContext *s) } -FF_DISABLE_DEPRECATION_WARNINGS const FFCodec ff_eac3_encoder = { .p.name = "eac3", CODEC_LONG_NAME("ATSC A/52 E-AC-3"), @@ -264,11 +263,8 @@ const FFCodec ff_eac3_encoder = { AV_SAMPLE_FMT_NONE }, .p.priv_class = &eac3enc_class, .p.supported_samplerates = ff_ac3_sample_rate_tab, -#if FF_API_OLD_CHANNEL_LAYOUT - .p.channel_layouts = ff_ac3_channel_layouts, -#endif + CODEC_OLD_CHANNEL_LAYOUTS_ARRAY(ff_ac3_channel_layouts) .p.ch_layouts = ff_ac3_ch_layouts, .defaults = ff_ac3_enc_defaults, .caps_internal = FF_CODEC_CAP_INIT_CLEANUP, }; -FF_ENABLE_DEPRECATION_WARNINGS -- cgit v1.2.3