summaryrefslogtreecommitdiff
path: root/multimedia/libxine/files/patch-libav-0.7
diff options
context:
space:
mode:
Diffstat (limited to 'multimedia/libxine/files/patch-libav-0.7')
-rw-r--r--multimedia/libxine/files/patch-libav-0.7237
1 files changed, 237 insertions, 0 deletions
diff --git a/multimedia/libxine/files/patch-libav-0.7 b/multimedia/libxine/files/patch-libav-0.7
new file mode 100644
index 000000000000..d4358bec2c40
--- /dev/null
+++ b/multimedia/libxine/files/patch-libav-0.7
@@ -0,0 +1,237 @@
+From: Reinhard Tartler <siretart@tauware.de>
+Subject: unbreak compilation with Libav 0.7
+
+Index: src/combined/ffmpeg/ff_video_decoder.c
+===================================================================
+--- xine-lib.orig/src/combined/ffmpeg/ff_video_decoder.c 2011-05-27 19:46:33.550935020 +0200
++++ xine-lib/src/combined/ffmpeg/ff_video_decoder.c 2011-05-27 19:58:40.030934613 +0200
+@@ -58,12 +58,28 @@
+
+ #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
++
+ /* 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 == 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
++
+ typedef struct ff_video_decoder_s ff_video_decoder_t;
+
+ typedef struct ff_video_class_s {
+@@ -116,8 +132,8 @@
+
+ int pp_quality;
+ int pp_flags;
+- pp_context_t *pp_context;
+- pp_mode_t *pp_mode;
++ pp_context *pp_context;
++ pp_mode *pp_mode;
+
+ /* mpeg-es parsing */
+ mpeg_parser_t *mpeg_parser;
+@@ -1055,12 +1071,26 @@
+ }
+
+ /* skip decoding b frames if too late */
++#if AVVIDEO > 1
++ this->context->skip_frame = (this->skipframes > 0) ? AVDISCARD_NONREF : AVDISCARD_DEFAULT;
++#else
+ this->context->hurry_up = (this->skipframes > 0);
++#endif
+
+ lprintf("avcodec_decode_video: size=%d\n", this->mpeg_parser->buffer_size);
++#if AVVIDEO > 1
++ AVPacket avpkt;
++ av_init_packet(&avpkt);
++ avpkt.data = (uint8_t *)this->mpeg_parser->chunk_buffer;
++ avpkt.size = this->mpeg_parser->buffer_size;
++ avpkt.flags = AV_PKT_FLAG_KEY;
++ len = avcodec_decode_video2 (this->context, this->av_frame,
++ &got_picture, &avpkt);
++#else
+ len = avcodec_decode_video (this->context, this->av_frame,
+ &got_picture, this->mpeg_parser->chunk_buffer,
+ this->mpeg_parser->buffer_size);
++#endif
+ lprintf("avcodec_decode_video: decoded_size=%d, got_picture=%d\n",
+ len, got_picture);
+ len = current - buf->content - offset;
+@@ -1112,7 +1142,13 @@
+
+ } else {
+
+- if (this->context->hurry_up) {
++ if (
++#if AVVIDEO > 1
++ this->context->skip_frame != AVDISCARD_DEFAULT
++#else
++ this->context->hurry_up
++#endif
++ ) {
+ /* skipped frame, output a bad frame */
+ img = this->stream->video_out->get_frame (this->stream->video_out,
+ this->bih.biWidth,
+@@ -1304,13 +1340,25 @@
+ got_picture = 0;
+ } else {
+ /* skip decoding b frames if too late */
++#if AVVIDEO > 1
++ this->context->skip_frame = (this->skipframes > 0) ? AVDISCARD_NONREF : AVDISCARD_DEFAULT;
++#else
+ this->context->hurry_up = (this->skipframes > 0);
+-
++#endif
+ lprintf("buffer size: %d\n", this->size);
++#if AVVIDEO > 1
++ AVPacket avpkt;
++ av_init_packet(&avpkt);
++ avpkt.data = (uint8_t *)&chunk_buf[offset];
++ avpkt.size = this->size;
++ avpkt.flags = AV_PKT_FLAG_KEY;
++ len = avcodec_decode_video2 (this->context, this->av_frame,
++ &got_picture, &avpkt);
++#else
+ len = avcodec_decode_video (this->context, this->av_frame,
+ &got_picture, &chunk_buf[offset],
+ this->size);
+-
++#endif
+ #ifdef AVCODEC_HAS_REORDERED_OPAQUE
+ /* reset consumed pts value */
+ this->context->reordered_opaque = ff_tag_pts(this, 0);
+Index: src/input/input_cdda.c
+===================================================================
+--- xine-lib.orig/src/input/input_cdda.c 2011-05-27 19:46:33.570934872 +0200
++++ xine-lib/src/input/input_cdda.c 2011-05-27 19:46:38.340934964 +0200
+@@ -89,6 +89,14 @@
+ #define CD_LEADOUT_TRACK 0xAA
+ #define CD_BLOCK_OFFSET 150
+
++#ifdef HAVE_LIBAVUTIL_SHA1_H
++/* old libavutil/sha1.h was found... */
++#define AVSHA AVSHA1
++# define av_sha_init(c,b) av_sha1_init(c)
++# define av_sha_update av_sha1_update
++# define av_sha_final av_sha1_final
++#endif
++
+ typedef struct _cdrom_toc_entry {
+ int track_mode;
+ int first_frame;
+Index: src/post/planar/pp.c
+===================================================================
+--- xine-lib.orig/src/post/planar/pp.c 2011-05-27 19:46:33.540935109 +0200
++++ xine-lib/src/post/planar/pp.c 2011-05-27 19:51:21.830934917 +0200
+@@ -35,6 +35,12 @@
+ # include <libpostproc/postprocess.h>
+ #endif
+
++#if LIBPOSTPROC_VERSION_MAJOR < 52
++# define pp_context pp_context_t
++# define pp_mode pp_mode_t
++# define PP_PARAMETERS_T
++#endif
++
+ #define PP_STRING_SIZE 256 /* size of pp mode string (including all options) */
+
+ /* plugin class initialization function */
+@@ -76,8 +82,8 @@
+
+ /* libpostproc specific stuff */
+ int pp_flags;
+- pp_context_t *pp_context;
+- pp_mode_t *pp_mode;
++ pp_context *pp_context;
++ pp_mode *pp_mode;
+
+ pthread_mutex_t lock;
+ };
+Index: src/combined/ffmpeg/ff_audio_decoder.c
+===================================================================
+--- xine-lib.orig/src/combined/ffmpeg/ff_audio_decoder.c 2011-05-27 19:53:22.700933869 +0200
++++ xine-lib/src/combined/ffmpeg/ff_audio_decoder.c 2011-05-27 19:55:40.820939483 +0200
+@@ -46,6 +46,13 @@
+
+ #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;
+@@ -255,6 +262,9 @@
+ buf->decoder_info[2]);
+
+ } else if (!(buf->decoder_flags & BUF_FLAG_SPECIAL)) {
++#if AVAUDIO > 2
++ AVPacket avpkt;
++#endif
+
+ if( !this->decoder_ok ) {
+ if ( ! this->context || ! this->codec ) {
+@@ -286,11 +296,21 @@
+ if (!this->output_open) {
+ if (!this->audio_bits || !this->audio_sample_rate || !this->audio_channels) {
+ decode_buffer_size = AVCODEC_MAX_AUDIO_FRAME_SIZE;
++#if AVAUDIO > 2
++ av_init_packet (&avpkt);
++ avpkt.data = (uint8_t *)&this->buf[0];
++ avpkt.size = this->size;
++ avpkt.flags = AV_PKT_FLAG_KEY;
++ avcodec_decode_audio3 (this->context,
++ (int16_t *)this->decode_buffer,
++ &decode_buffer_size, &avpkt);
++#else
+ avcodec_decode_audio2 (this->context,
+ (int16_t *)this->decode_buffer,
+ &decode_buffer_size,
+ &this->buf[0],
+ this->size);
++#endif
+ this->audio_bits = this->context->bits_per_sample;
+ this->audio_sample_rate = this->context->sample_rate;
+ this->audio_channels = this->context->channels;
+@@ -311,12 +331,21 @@
+ offset = 0;
+ while (this->size>0) {
+ decode_buffer_size = AVCODEC_MAX_AUDIO_FRAME_SIZE;
++#if AVAUDIO > 2
++ av_init_packet (&avpkt);
++ avpkt.data = (uint8_t *)&this->buf[offset];
++ avpkt.size = this->size;
++ avpkt.flags = AV_PKT_FLAG_KEY;
++ bytes_consumed = avcodec_decode_audio3 (this->context,
++ (int16_t *)this->decode_buffer,
++ &decode_buffer_size, &avpkt);
++#else
+ bytes_consumed = avcodec_decode_audio2 (this->context,
+ (int16_t *)this->decode_buffer,
+ &decode_buffer_size,
+ &this->buf[offset],
+ this->size);
+-
++#endif
+ if (bytes_consumed<0) {
+ xprintf (this->stream->xine, XINE_VERBOSITY_DEBUG,
+ "ffmpeg_audio_dec: error decompressing audio frame\n");