]> git.alsa-project.org Git - alsa-plugins.git/commitdiff
a52 - Fix a52 codec with recent libavcodec updates
authorJoerg Reuter <jreuter@suse.de>
Wed, 6 Apr 2011 14:36:11 +0000 (16:36 +0200)
committerTakashi Iwai <tiwai@suse.de>
Wed, 6 Apr 2011 14:39:28 +0000 (16:39 +0200)
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

index ed491b31c32a87a65258524b497d05d6e876fc0b..76f21cd003bfcfb8c3b07e003f04aca6132a7b79 100644 (file)
@@ -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;