File 0001-a52-Fix-a52-codec-with-recent-libavcodec-updates.patch of Package alsa-plugins
From 40c129a160f37fe9488b2828d6299f99c269703e Mon Sep 17 00:00:00 2001
From: Joerg Reuter <jreuter@suse.de>
Date: Wed, 6 Apr 2011 16:36:11 +0200
Subject: [PATCH 1/2] a52 - Fix a52 codec with recent libavcodec updates
The recent libavcodec is changed to accept only float input, but
the old ac3 encoder is still somehow working with a different name.
This patch makes it working again.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
---
a52/pcm_a52.c | 10 ++++++++--
1 files changed, 8 insertions(+), 2 deletions(-)
diff --git a/a52/pcm_a52.c b/a52/pcm_a52.c
index ed491b3..76f21cd 100644
--- a/a52/pcm_a52.c
+++ b/a52/pcm_a52.c
@@ -436,6 +436,7 @@ static int a52_prepare(snd_pcm_ioplug_t *io)
rec->avctx->bit_rate = rec->bitrate * 1000;
rec->avctx->sample_rate = io->rate;
rec->avctx->channels = io->channels;
+ rec->avctx->sample_fmt = AV_SAMPLE_FMT_S16;
#if LIBAVCODEC_VERSION_MAJOR > 52 || (LIBAVCODEC_VERSION_MAJOR == 52 && LIBAVCODEC_VERSION_MINOR >= 3)
switch (io->channels) {
case 2:
@@ -699,8 +700,13 @@ SND_PCM_PLUGIN_DEFINE_FUNC(a52)
avcodec_init();
avcodec_register_all();
- rec->codec = avcodec_find_encoder(CODEC_ID_AC3);
- if (! rec->codec) {
+
+ rec->codec = avcodec_find_encoder_by_name("ac3_fixed");
+ if (rec->codec == NULL)
+ rec->codec = avcodec_find_encoder_by_name("ac3");
+ if (rec->codec == NULL)
+ rec->codec = avcodec_find_encoder(CODEC_ID_AC3);
+ if (rec->codec == NULL) {
SNDERR("Cannot find codec engine");
err = -EINVAL;
goto error;
--
1.7.4.2