From 3eeea1ae47cbee8ee29b51376b3b604516d7bd5f Mon Sep 17 00:00:00 2001 From: Alexander Kojevnikov Date: Sat, 24 Jul 2010 13:21:25 +1000 Subject: [PATCH] Loosen dependency on libavcodec --- NEWS | 5 ++++- configure.ac | 2 +- src/spek-audio.c | 6 ++++++ 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/NEWS b/NEWS index e2b8d3c..476cbb1 100644 --- a/NEWS +++ b/NEWS @@ -50,4 +50,7 @@ Dependencies ------------------------------------------------------------------------------ * GTK+ >= 2.18 - * FFmpeg >= r18351 + * FFmpeg libraries: + * libavcodec + * libavformat + * libavutil diff --git a/configure.ac b/configure.ac index 9c51716..7f86c63 100644 --- a/configure.ac +++ b/configure.ac @@ -24,7 +24,7 @@ AM_PROG_VALAC([0.7.0]) AC_PROG_INSTALL AC_PROG_INTLTOOL([0.35]) -pkg_modules="gtk+-2.0 >= 2.18.0 libavformat libavcodec >= 52.23.0 libavutil" +pkg_modules="gtk+-2.0 >= 2.18.0 libavformat libavcodec libavutil" PKG_CHECK_MODULES(SPEK, [$pkg_modules]) AC_SUBST(SPEK_CFLAGS) AC_SUBST(SPEK_LIBS) diff --git a/src/spek-audio.c b/src/spek-audio.c index 892e613..a7f911a 100644 --- a/src/spek-audio.c +++ b/src/spek-audio.c @@ -141,8 +141,14 @@ gint spek_audio_read (SpekAudioContext *cx) { for (;;) { while (cx->packet->size > 0) { buffer_size = cx->buffer_size; +#if LIBAVCODEC_VERSION_INT >= AV_VERSION_INT (52, 23, 0) len = avcodec_decode_audio3 ( cx->codec_context, (int16_t *) cx->buffer, &buffer_size, cx->packet); +#else + len = avcodec_decode_audio2 ( + cx->codec_context, (int16_t *) cx->buffer, &buffer_size, + cx->packet->data, cx->packet->size); +#endif if (len < 0) { /* Error, skip the frame. */ cx->packet->size = 0;