summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/combined/ffmpeg/ff_audio_decoder.c13
-rw-r--r--src/combined/ffmpeg/ff_video_decoder.c14
-rw-r--r--src/combined/ffmpeg/ffmpeg_compat.h95
-rw-r--r--src/combined/ffmpeg/ffmpeg_decoder.c1
-rw-r--r--src/combined/ffmpeg/ffmpeg_decoder.h4
-rw-r--r--src/dxr3/ffmpeg_encoder.c2
-rw-r--r--src/xine-engine/load_plugins.c3
-rw-r--r--src/xine-engine/xine.c10
8 files changed, 116 insertions, 26 deletions
diff --git a/src/combined/ffmpeg/ff_audio_decoder.c b/src/combined/ffmpeg/ff_audio_decoder.c
index a45d57c69..740595b9e 100644
--- a/src/combined/ffmpeg/ff_audio_decoder.c
+++ b/src/combined/ffmpeg/ff_audio_decoder.c
@@ -42,15 +42,10 @@
#include <xine/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;
@@ -172,7 +167,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) {
@@ -355,7 +350,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;
@@ -382,7 +377,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 b11967880..6d972fdc7 100644
--- a/src/combined/ffmpeg/ff_video_decoder.c
+++ b/src/combined/ffmpeg/ff_video_decoder.c
@@ -50,6 +50,8 @@
# include <libpostproc/postprocess.h>
#endif
+#include "ffmpeg_compat.h"
+
#define VIDEOBUFSIZE (128*1024)
#define SLICE_BUFFER_SIZE (1194*1024)
@@ -57,18 +59,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
-
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..371b5ccdb
--- /dev/null
+++ b/src/combined/ffmpeg/ffmpeg_compat.h
@@ -0,0 +1,95 @@
+/*
+ * 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)
+#else
+# 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
+
+/**/
+#if LIBAVCODEC_VERSION_MAJOR > 53 || (LIBAVCODEC_VERSION_MAJOR == 53 && LIBAVCODEC_VERSION_MINOR >= 8)
+# define avcodec_init() do {} while(0)
+#endif
+
+/* avcodec_alloc_context() */
+#if LIBAVCODEC_VERSION_MAJOR >= 54 || (LIBAVCODEC_VERSION_MAJOR == 53 && LIBAVCODEC_VERSION_MINOR >= 6)
+# define AVCONTEXT 3
+# define avcodec_alloc_context() avcodec_alloc_context3(NULL)
+#else
+# define AVCONTEXT 1
+#endif
+
+/* avcodec_open() */
+#if LIBAVCODEC_VERSION_MAJOR >= 54 || (LIBAVCODEC_VERSION_MAJOR == 53 && LIBAVCODEC_VERSION_MINOR >= 6)
+# define AVOPEN 2
+# define avcodec_open(ctx,codec) avcodec_open2(ctx, codec, NULL)
+#else
+# define AVOPEN 1
+#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.c b/src/combined/ffmpeg/ffmpeg_decoder.c
index 4f9a0f7a4..4f44a7f8b 100644
--- a/src/combined/ffmpeg/ffmpeg_decoder.c
+++ b/src/combined/ffmpeg/ffmpeg_decoder.c
@@ -27,6 +27,7 @@
#include <xine/xine_internal.h>
#include "ffmpeg_decoder.h"
+#include "ffmpeg_compat.h"
/*
* common initialisation
diff --git a/src/combined/ffmpeg/ffmpeg_decoder.h b/src/combined/ffmpeg/ffmpeg_decoder.h
index f679a5ce9..4d9943384 100644
--- a/src/combined/ffmpeg/ffmpeg_decoder.h
+++ b/src/combined/ffmpeg/ffmpeg_decoder.h
@@ -31,10 +31,6 @@
# include <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;
diff --git a/src/dxr3/ffmpeg_encoder.c b/src/dxr3/ffmpeg_encoder.c
index 2181dd543..4b444a3bc 100644
--- a/src/dxr3/ffmpeg_encoder.c
+++ b/src/dxr3/ffmpeg_encoder.c
@@ -44,6 +44,8 @@
# include <libavcodec/avcodec.h>
#endif
+#include "../combined/ffmpeg/ffmpeg_compat.h"
+
/* buffer size for encoded mpeg1 stream; will hold one intra frame
* at 640x480 typical sizes are <50 kB. 512 kB should be plenty */
#define DEFAULT_BUFFER_SIZE 512*1024
diff --git a/src/xine-engine/load_plugins.c b/src/xine-engine/load_plugins.c
index 8189592ba..c86cc5f6e 100644
--- a/src/xine-engine/load_plugins.c
+++ b/src/xine-engine/load_plugins.c
@@ -1326,7 +1326,8 @@ void _x_scan_plugins (xine_t *this) {
load_required_plugins (this);
- XINE_PROFILE(save_catalog (this));
+ if ((_x_flags & XINE_FLAG_NO_WRITE_CACHE) == 0)
+ XINE_PROFILE(save_catalog (this));
map_decoders (this);
}
diff --git a/src/xine-engine/xine.c b/src/xine-engine/xine.c
index 2a67d89b5..9a7e28a7f 100644
--- a/src/xine-engine/xine.c
+++ b/src/xine-engine/xine.c
@@ -83,6 +83,10 @@
#include "xine_private.h"
+/* FIXME-ABI Global variable. Done this way for ABI & API reasons... */
+int _x_flags = 0;
+
+
static void mutex_cleanup (void *mutex) {
pthread_mutex_unlock ((pthread_mutex_t *) mutex);
}
@@ -1742,6 +1746,12 @@ static void config_save_cb (void *this_gen, xine_cfg_entry_t *entry) {
this->save_path = entry->str_value;
}
+void xine_set_flags (xine_t *this, int flags)
+{
+ this = this; /* FIXME-ABI: one day, these will be in xine_t...? */
+ _x_flags = flags;
+}
+
void xine_init (xine_t *this) {
static const char *const demux_strategies[] = {"default", "reverse", "content",
"extension", NULL};