Skip to contentSkip to conversation

alsa-plugins-1.0.25: fix building with ffmpeg >= 0.11

PATCH Guido Trentalancia 1 participant 1 message Jun 1, 2012

lore
Share & tools
lore
#0 lore raw

alsa-plugins version 1.0.25 cannot build with latest ffmpeg version 0.11 because a few CH_LAYOUT_* aliases to AV_CH_LAYOUT_* defines have been removed from the ffmpeg libavcodec header files.

A bug has been opened in the bug tracking system (#0005587):

https://bugtrack.alsa-project.org/alsa-bug/view.php?id=5587

Here is an example patch to fix the issue:

Ffmpeg 0.11 (LIBAVCODEC_VERSION_MAJOR = 54) removed the CH_LAYOUT_* aliases for the AV_CH_LAYOUT_* defines.

a52/pcm_a52.c +15 -1
diff -pru alsa-plugins-1.0.25-original/a52/pcm_a52.c alsa-plugins-1.0.25-for-ffmpeg-0.11/a52/pcm_a52.c
@@ -441,7 +441,21 @@ static int a52_prepare(snd_pcm_ioplug_t
 #else
   rec->avctx->sample_fmt = SAMPLE_FMT_S16;
 #endif
-#if LIBAVCODEC_VERSION_MAJOR > 52 || (LIBAVCODEC_VERSION_MAJOR == 52 && LIBAVCODEC_VERSION_MINOR >= 3)
+#if (LIBAVCODEC_VERSION_MAJOR >= 54)
+	switch (io->channels) {
+	case 2:
+		rec->avctx->channel_layout = AV_CH_LAYOUT_STEREO;
+		break;
+	case 4:
+		rec->avctx->channel_layout = AV_CH_LAYOUT_QUAD;
+		break;
+	case 6:
+		rec->avctx->channel_layout = AV_CH_LAYOUT_5POINT1;
+		break;
+	default:
+		break;
+	}
+#elif (LIBAVCODEC_VERSION_MAJOR > 52 && LIBAVCODEC_VERSION_MAJOR < 54) || (LIBAVCODEC_VERSION_MAJOR == 52 && LIBAVCODEC_VERSION_MINOR >= 3)
	switch (io->channels) {

case 2:
rec->avctx->channel_layout = CH_LAYOUT_STEREO;