From 1dfbe19da9d3e1be38522d07985682f6fae1e669 Mon Sep 17 00:00:00 2001 From: EXL Date: Tue, 21 Apr 2015 16:32:16 +0600 Subject: [PATCH] Fix avcodec compile errors MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit mp3_libavcodec.c:141:31: error: ‘CODEC_ID_MP3’ undeclared (first use in this function) mp3_libavcodec.c:141:31: error: type of formal parameter 1 is incomplete --- platform/common/mp3_libavcodec.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/platform/common/mp3_libavcodec.c b/platform/common/mp3_libavcodec.c index 2d3c799..9a528c1 100644 --- a/platform/common/mp3_libavcodec.c +++ b/platform/common/mp3_libavcodec.c @@ -16,6 +16,11 @@ #include "../libpicofe/lprintf.h" #include "mp3.h" +#if LIBAVCODEC_VERSION_MAJOR < 55 +#define AVCodecID CodecID +#define AV_CODEC_ID_MP3 CODEC_ID_MP3 +#endif + static AVCodecContext *ctx; /* avoid compile time linking to libavcodec due to huge list of it's deps.. @@ -94,7 +99,7 @@ int mp3dec_decode(FILE *f, int *file_pos, int file_len) int mp3dec_start(FILE *f, int fpos_start) { void (*avcodec_register_all)(void); - AVCodec *(*avcodec_find_decoder)(enum CodecID id); + AVCodec *(*avcodec_find_decoder)(enum AVCodecID id); AVCodecContext *(*avcodec_alloc_context)(void); int (*avcodec_open)(AVCodecContext *avctx, AVCodec *codec); void (*av_free)(void *ptr); @@ -137,8 +142,7 @@ int mp3dec_start(FILE *f, int fpos_start) //avcodec_init(); avcodec_register_all(); - // AV_CODEC_ID_MP3 ? - codec = avcodec_find_decoder(CODEC_ID_MP3); + codec = avcodec_find_decoder(AV_CODEC_ID_MP3); if (codec == NULL) { lprintf("mp3dec: codec missing\n"); return -1; -- 2.39.2