From: François Cartegnie Date: Thu, 13 Jun 2024 05:21:58 +0000 (+0700) Subject: avcodec: encoder: fix channel_layout conditionals X-Git-Tag: archive/raspbian/3.0.21-6+rpi1^2~55 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=5e75403263cb0f429ce3ae7de824dc4683ec0bc6;p=vlc.git avcodec: encoder: fix channel_layout conditionals Gbp-Pq: Name 0070-avcodec-encoder-fix-channel_layout-conditionals.patch --- diff --git a/modules/codec/avcodec/encoder.c b/modules/codec/avcodec/encoder.c index 52848de0..6bd58f50 100644 --- a/modules/codec/avcodec/encoder.c +++ b/modules/codec/avcodec/encoder.c @@ -43,12 +43,13 @@ #include #include -#include #include "avcodec.h" #include "avcommon.h" -#if LIBAVUTIL_VERSION_CHECK( 52,2,6,0,0 ) +#define API_CHANNEL_LAYOUT (LIBAVUTIL_VERSION_CHECK( 52, 2, 6, 0, 100)) + +#if API_CHANNEL_LAYOUT # include #endif @@ -157,6 +158,7 @@ struct encoder_sys_t /* Taken from audio.c*/ +#if API_CHANNEL_LAYOUT static const uint64_t pi_channels_map[][2] = { { AV_CH_FRONT_LEFT, AOUT_CHAN_LEFT }, @@ -193,6 +195,7 @@ static const uint32_t channel_mask[][2] = { {AOUT_CHANS_7_1, AV_CH_LAYOUT_7POINT1}, {AOUT_CHANS_8_1, AV_CH_LAYOUT_OCTAGONAL}, }; +#endif static const char *const ppsz_enc_options[] = { "keyint", "bframes", "vt", "qmin", "qmax", "codec", "hq", @@ -746,7 +749,7 @@ int InitVideoEnc( vlc_object_t *p_this ) p_context->time_base.num = 1; p_context->time_base.den = p_context->sample_rate; p_context->channels = p_enc->fmt_out.audio.i_channels; -#if LIBAVUTIL_VERSION_CHECK( 52, 2, 6, 0, 0) +#if API_CHANNEL_LAYOUT p_context->channel_layout = channel_mask[p_context->channels][1]; /* Setup Channel ordering for multichannel audio @@ -925,7 +928,9 @@ errmsg: if( p_enc->fmt_out.audio.i_channels > 2 ) { p_context->channels = 2; +#if API_CHANNEL_LAYOUT p_context->channel_layout = channel_mask[p_context->channels][1]; +#endif /* Change fmt_in in order to ask for a channels conversion */ p_enc->fmt_in.audio.i_channels =