diff options
-rw-r--r-- | src/combined/ffmpeg/Makefile.am | 3 | ||||
-rw-r--r-- | src/combined/ffmpeg/ff_audio_decoder.c | 13 | ||||
-rw-r--r-- | src/combined/ffmpeg/ff_video_decoder.c | 20 | ||||
-rw-r--r-- | src/combined/ffmpeg/ffmpeg_compat.h | 73 | ||||
-rw-r--r-- | src/combined/ffmpeg/ffmpeg_decoder.h | 4 |
5 files changed, 81 insertions, 32 deletions
diff --git a/src/combined/ffmpeg/Makefile.am b/src/combined/ffmpeg/Makefile.am index 6dfc55de4..86200d718 100644 --- a/src/combined/ffmpeg/Makefile.am +++ b/src/combined/ffmpeg/Makefile.am @@ -30,7 +30,8 @@ EXTRA_DIST = ffmpeg_encoder.c \ xineplug_LTLIBRARIES = xineplug_decode_ff.la xineplug_decode_dvaudio.la xineplug_decode_ff_la_SOURCES = ffmpeg_decoder.c ff_audio_decoder.c ff_video_decoder.c \ - ff_mpeg_parser.c ffmpeg_decoder.h ff_mpeg_parser.h + ff_mpeg_parser.c ffmpeg_decoder.h ff_mpeg_parser.h \ + ffmpeg_compat.h if HAVE_DXR3 AM_CPPFLAGS = -I$(top_srcdir)/src/dxr3 $(X_CFLAGS) $(ff_cppflags) \ $(ZLIB_CPPFLAGS) diff --git a/src/combined/ffmpeg/ff_audio_decoder.c b/src/combined/ffmpeg/ff_audio_decoder.c index e4a9c16bf..7ecf8290d 100644 --- a/src/combined/ffmpeg/ff_audio_decoder.c +++ b/src/combined/ffmpeg/ff_audio_decoder.c @@ -43,15 +43,10 @@ #include "xineutils.h" #include "bswap.h" #include "ffmpeg_decoder.h" +#include "ffmpeg_compat.h" #define AUDIOBUFSIZE (64 * 1024) -#if LIBAVCODEC_VERSION_MAJOR >= 53 || (LIBAVCODEC_VERSION_MAJOR == 52 && LIBAVCODEC_VERSION_MINOR >= 32) -# define AVAUDIO 3 -#else -# define AVAUDIO 2 -#endif - typedef struct { audio_decoder_class_t decoder_class; } ff_audio_class_t; @@ -173,7 +168,7 @@ static void ff_audio_init_codec(ff_audio_decoder_t *this, unsigned int codec_typ * - DVB streams where multiple AAC LATM frames are packed to single PES * - DVB streams where MPEG audio frames do not follow PES packet boundaries */ -#if LIBAVCODEC_VERSION_MAJOR >= 53 || (LIBAVCODEC_VERSION_MAJOR == 52 && LIBAVCODEC_VERSION_MINOR >= 94) +#if AVPARSE > 1 if (codec_type == BUF_AUDIO_AAC_LATM || codec_type == BUF_AUDIO_MPEG) { @@ -356,7 +351,7 @@ static int ff_audio_decode(xine_t *xine, int consumed; int parser_consumed = 0; -#if LIBAVCODEC_VERSION_MAJOR >= 53 || (LIBAVCODEC_VERSION_MAJOR == 52 && LIBAVCODEC_VERSION_MINOR >= 94) +#if AVPARSE > 1 if (parser_ctx) { uint8_t *outbuf; int outsize; @@ -383,7 +378,7 @@ static int ff_audio_decode(xine_t *xine, buf = outbuf; size = outsize; } -#endif /* LIBAVCODEC_VERSION_MAJOR >= 53 || (LIBAVCODEC_VERSION_MAJOR == 52 && LIBAVCODEC_VERSION_MINOR >= 94) */ +#endif /* AVPARSE > 1 */ #if AVAUDIO > 2 AVPacket avpkt; diff --git a/src/combined/ffmpeg/ff_video_decoder.c b/src/combined/ffmpeg/ff_video_decoder.c index 50357182a..90eeadffe 100644 --- a/src/combined/ffmpeg/ff_video_decoder.c +++ b/src/combined/ffmpeg/ff_video_decoder.c @@ -51,6 +51,8 @@ # include <libpostproc/postprocess.h> #endif +#include "ffmpeg_compat.h" + #define VIDEOBUFSIZE (128*1024) #define SLICE_BUFFER_SIZE (1194*1024) @@ -58,24 +60,6 @@ #define ENABLE_DIRECT_RENDERING -#if LIBAVCODEC_VERSION_MAJOR >= 53 || (LIBAVCODEC_VERSION_MAJOR == 52 && LIBAVCODEC_VERSION_MINOR >= 32) -# define AVVIDEO 2 -#else -# define AVVIDEO 1 -# define pp_context pp_context_t -# define pp_mode pp_mode_t -#endif - -#if LIBAVCODEC_VERSION_MAJOR >= 53 || (LIBAVCODEC_VERSION_MAJOR == 52 && LIBAVCODEC_VERSION_MINOR >= 112) -# define DEPRECATED_AVCODEC_THREAD_INIT 1 -#endif - -/* reordered_opaque appeared in libavcodec 51.68.0 */ -#define AVCODEC_HAS_REORDERED_OPAQUE -#if LIBAVCODEC_VERSION_INT < 0x334400 -# undef AVCODEC_HAS_REORDERED_OPAQUE -#endif - typedef struct ff_video_decoder_s ff_video_decoder_t; typedef struct ff_video_class_s { diff --git a/src/combined/ffmpeg/ffmpeg_compat.h b/src/combined/ffmpeg/ffmpeg_compat.h new file mode 100644 index 000000000..9a8aaf203 --- /dev/null +++ b/src/combined/ffmpeg/ffmpeg_compat.h @@ -0,0 +1,73 @@ +/* + * Copyright (C) 2000-2012 the xine project + * + * This file is part of xine, a unix video player. + * + * xine is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * xine is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA + * + * Compability macros for various ffmpeg versions + */ + +#ifndef XINE_AVCODEC_COMPAT_H +#define XINE_AVCODEC_COMPAT_H + +#ifndef LIBAVCODEC_VERSION_MAJOR +# error ffmpeg headers must be included first ! +#endif + + +#if LIBAVCODEC_VERSION_MAJOR > 51 +# define bits_per_sample bits_per_coded_sample +#endif + +#if LIBAVCODEC_VERSION_MAJOR >= 53 || (LIBAVCODEC_VERSION_MAJOR == 52 && LIBAVCODEC_VERSION_MINOR >= 32) +# define pp_context pp_context_t +# define pp_mode pp_mode_t +#endif + +/* reordered_opaque appeared in libavcodec 51.68.0 */ +#define AVCODEC_HAS_REORDERED_OPAQUE +#if LIBAVCODEC_VERSION_INT < 0x334400 +# undef AVCODEC_HAS_REORDERED_OPAQUE +#endif + +/* avcodec_thread_init() */ +#if LIBAVCODEC_VERSION_MAJOR >= 53 || (LIBAVCODEC_VERSION_MAJOR == 52 && LIBAVCODEC_VERSION_MINOR >= 112) +# define DEPRECATED_AVCODEC_THREAD_INIT 1 +#endif + +/* av_parser_parse() */ +#if LIBAVCODEC_VERSION_MAJOR >= 53 || (LIBAVCODEC_VERSION_MAJOR == 52 && LIBAVCODEC_VERSION_MINOR >= 94) +# define AVPARSE 2 +#else +# define AVPARSE 1 +#endif + +/* avcodec_decode_video() */ +#if LIBAVCODEC_VERSION_MAJOR >= 53 || (LIBAVCODEC_VERSION_MAJOR == 52 && LIBAVCODEC_VERSION_MINOR >= 32) +# define AVVIDEO 2 +#else +# define AVVIDEO 1 +#endif + +/* avcodec_decode_audio() */ +#if LIBAVCODEC_VERSION_MAJOR >= 53 || (LIBAVCODEC_VERSION_MAJOR == 52 && LIBAVCODEC_VERSION_MINOR >= 32) +# define AVAUDIO 3 +#else +# define AVAUDIO 2 +#endif + + +#endif /* XINE_AVCODEC_COMPAT_H */ diff --git a/src/combined/ffmpeg/ffmpeg_decoder.h b/src/combined/ffmpeg/ffmpeg_decoder.h index 0aeb71271..957a25231 100644 --- a/src/combined/ffmpeg/ffmpeg_decoder.h +++ b/src/combined/ffmpeg/ffmpeg_decoder.h @@ -33,10 +33,6 @@ # include "../../libffmpeg/libavcodec/avcodec.h" #endif -#if LIBAVCODEC_VERSION_MAJOR > 51 -#define bits_per_sample bits_per_coded_sample -#endif - typedef struct ff_codec_s { uint32_t type; enum CodecID id; |