From: Joerg Reuter Date: Wed, 6 Apr 2011 14:36:11 +0000 (+0200) Subject: a52 - Fix a52 codec with recent libavcodec updates X-Git-Tag: v1.0.25~12 X-Git-Url: https://git.alsa-project.org/?a=commitdiff_plain;h=40c129a160f37fe9488b2828d6299f99c269703e;p=alsa-plugins.git 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 --- 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;