[alsa-devel] [PATCH 2/4] a52: fix some usage of deprecated/removed lavc API.
Anton Khirnov
anton at khirnov.net
Sun Nov 11 11:30:02 CET 2012
---
a52/pcm_a52.c | 12 ++++++------
configure.in | 6 +++---
2 files changed, 9 insertions(+), 9 deletions(-)
diff --git a/a52/pcm_a52.c b/a52/pcm_a52.c
index c1dd96e..9fd326c 100644
--- a/a52/pcm_a52.c
+++ b/a52/pcm_a52.c
@@ -26,6 +26,7 @@
#include <alsa/pcm_external.h>
#include <alsa/pcm_plugin.h>
#include <libavcodec/avcodec.h>
+#include <libavutil/audioconvert.h>
struct a52_ctx {
snd_pcm_ioplug_t io;
@@ -424,7 +425,7 @@ static int a52_prepare(snd_pcm_ioplug_t *io)
a52_free(rec);
- rec->avctx = avcodec_alloc_context();
+ rec->avctx = avcodec_alloc_context3(rec->codec);
if (! rec->avctx)
return -ENOMEM;
@@ -434,19 +435,19 @@ static int a52_prepare(snd_pcm_ioplug_t *io)
rec->avctx->sample_fmt = AV_SAMPLE_FMT_S16;
switch (io->channels) {
case 2:
- rec->avctx->channel_layout = CH_LAYOUT_STEREO;
+ rec->avctx->channel_layout = AV_CH_LAYOUT_STEREO;
break;
case 4:
- rec->avctx->channel_layout = CH_LAYOUT_QUAD;
+ rec->avctx->channel_layout = AV_CH_LAYOUT_QUAD;
break;
case 6:
- rec->avctx->channel_layout = CH_LAYOUT_5POINT1;
+ rec->avctx->channel_layout = AV_CH_LAYOUT_5POINT1;
break;
default:
break;
}
- if (avcodec_open(rec->avctx, rec->codec) < 0)
+ if (avcodec_open2(rec->avctx, rec->codec, NULL) < 0)
return -EINVAL;
rec->inbuf = malloc(rec->avctx->frame_size * 2 * io->channels);
@@ -691,7 +692,6 @@ SND_PCM_PLUGIN_DEFINE_FUNC(a52)
rec->channels = channels;
rec->format = format;
- avcodec_init();
avcodec_register_all();
rec->codec = avcodec_find_encoder_by_name("ac3_fixed");
diff --git a/configure.in b/configure.in
index 2b422df..0a3d424 100644
--- a/configure.in
+++ b/configure.in
@@ -67,7 +67,7 @@ AC_ARG_ENABLE([avcodec],
AS_HELP_STRING([--disable-avcodec], [Don't build plugins depending on avcodec (a52)]))
if test "x$enable_avcodec" != "xno"; then
- PKG_CHECK_MODULES(AVCODEC, [libavcodec >= 53.34.0], [HAVE_AVCODEC=yes], [HAVE_AVCODEC=no])
+ PKG_CHECK_MODULES(AVCODEC, [libavcodec >= 53.34.0 libavutil >= 51.21.0], [HAVE_AVCODEC=yes], [HAVE_AVCODEC=no])
fi
if test "x$HAVE_AVCODEC" = "xno"; then
@@ -84,8 +84,8 @@ if test "x$HAVE_AVCODEC" = "xno"; then
LDFLAGS_saved="$LDFLAGS"
CFLAGS="$CFLAGS $AVCODEC_CFLAGS"
LDFLAGS="$LDFLAGS $AVCODEC_LIBS"
- AVCODEC_LIBS="$AVCODEC_LIBS -lavcodec"
- AC_CHECK_LIB([avcodec], [avcodec_open], [HAVE_AVCODEC=yes], [HAVE_AVCODEC=no])
+ AVCODEC_LIBS="$AVCODEC_LIBS -lavutil -lavcodec"
+ AC_CHECK_LIB([avcodec], [avcodec_open2], [HAVE_AVCODEC=yes], [HAVE_AVCODEC=no])
CFLAGS="$CFLAGS_saved"
LDFLAGS="$LDFLAGS_saved"
fi
--
1.7.10.4
More information about the Alsa-devel
mailing list