]> git.sesse.net Git - vlc/blobdiff - modules/codec/avcodec/audio.c
Try to fix compilation with older ffmpeg version.
[vlc] / modules / codec / avcodec / audio.c
index c9cbd3148c86c2be16c373c00e19c4ad5fc2073b..da0bd4b15304ca5c4520b4670cfbf04db8eeb20a 100644 (file)
@@ -390,6 +390,7 @@ void EndAudioDec( decoder_t *p_dec )
 /*****************************************************************************
  *
  *****************************************************************************/
+#if defined(LIBAVCODEC_AUDIO_LAYOUT)
 static const uint64_t pi_channels_map[][2] =
 {
     { CH_FRONT_LEFT,        AOUT_CHAN_LEFT },
@@ -413,6 +414,31 @@ static const uint64_t pi_channels_map[][2] =
     { CH_STEREO_LEFT,       0 },
     { CH_STEREO_RIGHT,      0 },
 };
+#else
+static const uint64_t pi_channels_map[][2] =
+{
+    { 0, AOUT_CHAN_LEFT },
+    { 0, AOUT_CHAN_RIGHT },
+    { 0, AOUT_CHAN_CENTER },
+    { 0, AOUT_CHAN_LFE },
+    { 0, AOUT_CHAN_REARLEFT },
+    { 0, AOUT_CHAN_REARRIGHT },
+    { 0, 0 },
+    { 0, 0 },
+    { 0, AOUT_CHAN_REARCENTER },
+    { 0, AOUT_CHAN_MIDDLELEFT },
+    { 0, AOUT_CHAN_MIDDLERIGHT },
+    { 0, 0 },
+    { 0, 0 },
+    { 0, 0 },
+    { 0, 0 },
+    { 0, 0 },
+    { 0, 0 },
+    { 0, 0 },
+    { 0, 0 },
+    { 0, 0 },
+};
+#endif
 
 #if LIBAVCODEC_VERSION_INT >= AV_VERSION_INT( 52, 2, 0 )
 #   define LIBAVCODEC_AUDIO_LAYOUT
@@ -457,10 +483,12 @@ static void SetupOutputFormat( decoder_t *p_dec, bool b_trust )
     p_dec->fmt_out.audio.i_channels = p_sys->p_context->channels;
 
     /* */
-    if( p_sys->i_previous_channels == p_sys->p_context->channels )
-        return;
 #if defined(LIBAVCODEC_AUDIO_LAYOUT)
-    if( p_sys->i_previous_layout == p_sys->p_context->channel_layout )
+    if( p_sys->i_previous_channels == p_sys->p_context->channels &&
+        p_sys->i_previous_layout == p_sys->p_context->channel_layout )
+        return;
+#else
+    if( p_sys->i_previous_channels == p_sys->p_context->channels )
         return;
 #endif
     if( b_trust )