diff options
-rw-r--r-- | multimedia/libxine/files/ffmpeg-vaapi_xine-lib-1.1.19-initerrorhack.diff | 66 | ||||
-rw-r--r-- | multimedia/libxine/files/patch-libav-0.7 | 237 |
2 files changed, 260 insertions, 43 deletions
diff --git a/multimedia/libxine/files/ffmpeg-vaapi_xine-lib-1.1.19-initerrorhack.diff b/multimedia/libxine/files/ffmpeg-vaapi_xine-lib-1.1.19-initerrorhack.diff index 047a38f35896..a48468a47de9 100644 --- a/multimedia/libxine/files/ffmpeg-vaapi_xine-lib-1.1.19-initerrorhack.diff +++ b/multimedia/libxine/files/ffmpeg-vaapi_xine-lib-1.1.19-initerrorhack.diff @@ -23,7 +23,7 @@ diff -Naur xine-lib-1.1.19.orig/src/combined/ffmpeg/ff_video_decoder.c xine-lib- #define VIDEOBUFSIZE (128*1024) #define SLICE_BUFFER_SIZE (1194*1024) -@@ -73,6 +88,7 @@ typedef struct ff_video_class_s { +@@ -89,6 +104,7 @@ typedef struct ff_video_class_s { int thread_count; int8_t skip_loop_filter_enum; int8_t choose_speed_over_accuracy; @@ -31,7 +31,7 @@ diff -Naur xine-lib-1.1.19.orig/src/combined/ffmpeg/ff_video_decoder.c xine-lib- xine_t *xine; } ff_video_class_t; -@@ -111,6 +127,7 @@ struct ff_video_decoder_s { +@@ -127,6 +143,7 @@ struct ff_video_decoder_s { int slice_offset_size; AVFrame *av_frame; @@ -39,7 +39,7 @@ diff -Naur xine-lib-1.1.19.orig/src/combined/ffmpeg/ff_video_decoder.c xine-lib- AVCodecContext *context; AVCodec *codec; -@@ -138,8 +155,31 @@ struct ff_video_decoder_s { +@@ -154,8 +171,31 @@ struct ff_video_decoder_s { #ifdef LOG enum PixelFormat debug_fmt; #endif @@ -71,7 +71,7 @@ diff -Naur xine-lib-1.1.19.orig/src/combined/ffmpeg/ff_video_decoder.c xine-lib- static void set_stream_info(ff_video_decoder_t *this) { _x_stream_info_set(this->stream, XINE_STREAM_INFO_VIDEO_WIDTH, this->bih.biWidth); -@@ -147,7 +187,70 @@ static void set_stream_info(ff_video_dec +@@ -163,7 +203,70 @@ static void set_stream_info(ff_video_dec _x_stream_info_set(this->stream, XINE_STREAM_INFO_VIDEO_RATIO, this->aspect_ratio * 10000); } @@ -142,7 +142,7 @@ diff -Naur xine-lib-1.1.19.orig/src/combined/ffmpeg/ff_video_decoder.c xine-lib- /* called from ffmpeg to do direct rendering method 1 */ static int get_buffer(AVCodecContext *context, AVFrame *av_frame){ ff_video_decoder_t *this = (ff_video_decoder_t *)context->opaque; -@@ -169,6 +272,43 @@ static int get_buffer(AVCodecContext *co +@@ -185,6 +288,43 @@ static int get_buffer(AVCodecContext *co avcodec_align_dimensions(context, &width, &height); @@ -186,7 +186,7 @@ diff -Naur xine-lib-1.1.19.orig/src/combined/ffmpeg/ff_video_decoder.c xine-lib- if( this->context->pix_fmt != PIX_FMT_YUV420P && this->context->pix_fmt != PIX_FMT_YUVJ420P ) { if (!this->is_direct_rendering_disabled) { xprintf(this->stream->xine, XINE_VERBOSITY_LOG, -@@ -238,10 +378,33 @@ static int get_buffer(AVCodecContext *co +@@ -254,10 +394,33 @@ static int get_buffer(AVCodecContext *co static void release_buffer(struct AVCodecContext *context, AVFrame *av_frame){ ff_video_decoder_t *this = (ff_video_decoder_t *)context->opaque; @@ -222,7 +222,7 @@ diff -Naur xine-lib-1.1.19.orig/src/combined/ffmpeg/ff_video_decoder.c xine-lib- img->free(img); } -@@ -283,13 +446,272 @@ static const int skip_loop_filter_enum_v +@@ -299,13 +462,272 @@ static const int skip_loop_filter_enum_v AVDISCARD_ALL }; @@ -285,7 +285,7 @@ diff -Naur xine-lib-1.1.19.orig/src/combined/ffmpeg/ff_video_decoder.c xine-lib- + //context->draw_horiz_band = draw_slice; + context->draw_horiz_band = NULL; + context->slice_flags = SLICE_FLAG_CODED_ORDER | SLICE_FLAG_ALLOW_FIELD; -+ context->dsp_mask = FF_MM_FORCE | FF_MM_MMX | FF_MM_MMXEXT | FF_MM_SSE; ++ context->dsp_mask = AV_CPU_FLAG_FORCE | AV_CPU_FLAG_MMX | AV_CPU_FLAG_MMX2 | AV_CPU_FLAG_SSE; + + va_context->vaapi_context->config_id = va_context->va_config_id; + va_context->vaapi_context->context_id = va_context->va_context_id; @@ -496,7 +496,7 @@ diff -Naur xine-lib-1.1.19.orig/src/combined/ffmpeg/ff_video_decoder.c xine-lib- if(ff_video_lookup[i].type == codec_type) { pthread_mutex_lock(&ffmpeg_lock); this->codec = avcodec_find_decoder(ff_video_lookup[i].id); -@@ -298,6 +720,8 @@ static void init_video_codec (ff_video_d +@@ -314,6 +736,8 @@ static void init_video_codec (ff_video_d ff_video_lookup[i].name); break; } @@ -505,7 +505,7 @@ diff -Naur xine-lib-1.1.19.orig/src/combined/ffmpeg/ff_video_decoder.c xine-lib- if (!this->codec) { xprintf (this->stream->xine, XINE_VERBOSITY_LOG, -@@ -311,9 +735,11 @@ static void init_video_codec (ff_video_d +@@ -327,9 +751,11 @@ static void init_video_codec (ff_video_d this->context->width = this->bih.biWidth; this->context->height = this->bih.biHeight; @@ -517,7 +517,7 @@ diff -Naur xine-lib-1.1.19.orig/src/combined/ffmpeg/ff_video_decoder.c xine-lib- /* Some codecs (eg rv10) copy flags in init so it's necessary to set * this flag here in case we are going to use direct rendering */ -@@ -323,7 +749,6 @@ static void init_video_codec (ff_video_d +@@ -339,7 +765,6 @@ static void init_video_codec (ff_video_d if (this->class->choose_speed_over_accuracy) this->context->flags2 |= CODEC_FLAG2_FAST; @@ -525,7 +525,7 @@ diff -Naur xine-lib-1.1.19.orig/src/combined/ffmpeg/ff_video_decoder.c xine-lib- pthread_mutex_lock(&ffmpeg_lock); if (avcodec_open (this->context, this->codec) < 0) { pthread_mutex_unlock(&ffmpeg_lock); -@@ -337,7 +762,6 @@ static void init_video_codec (ff_video_d +@@ -353,7 +778,6 @@ static void init_video_codec (ff_video_d if (this->codec->id == CODEC_ID_VC1 && (!this->bih.biWidth || !this->bih.biHeight)) { @@ -533,7 +533,7 @@ diff -Naur xine-lib-1.1.19.orig/src/combined/ffmpeg/ff_video_decoder.c xine-lib- avcodec_close(this->context); if (avcodec_open (this->context, this->codec) < 0) { -@@ -390,6 +814,13 @@ static void init_video_codec (ff_video_d +@@ -406,6 +830,13 @@ static void init_video_codec (ff_video_d xprintf(this->stream->xine, XINE_VERBOSITY_LOG, _("ffmpeg_video_dec: direct rendering enabled\n")); } @@ -547,7 +547,7 @@ diff -Naur xine-lib-1.1.19.orig/src/combined/ffmpeg/ff_video_decoder.c xine-lib- #endif /* flag for interlaced streams */ -@@ -413,7 +844,13 @@ static void init_video_codec (ff_video_d +@@ -429,7 +860,13 @@ static void init_video_codec (ff_video_d this->frame_flags |= VO_INTERLACED_FLAG; break; } @@ -561,7 +561,7 @@ diff -Naur xine-lib-1.1.19.orig/src/combined/ffmpeg/ff_video_decoder.c xine-lib- } static void choose_speed_over_accuracy_cb(void *user_data, xine_cfg_entry_t *entry) { -@@ -542,6 +979,36 @@ static int ff_handle_mpeg_sequence(ff_vi +@@ -558,6 +995,36 @@ static int ff_handle_mpeg_sequence(ff_vi return 1; } @@ -598,7 +598,7 @@ diff -Naur xine-lib-1.1.19.orig/src/combined/ffmpeg/ff_video_decoder.c xine-lib- static void ff_convert_frame(ff_video_decoder_t *this, vo_frame_t *img) { int y; uint8_t *dy, *du, *dv, *sy, *su, *sv; -@@ -551,6 +1018,49 @@ static void ff_convert_frame(ff_video_de +@@ -567,6 +1034,49 @@ static void ff_convert_frame(ff_video_de printf ("frame format == %08x\n", this->debug_fmt = this->context->pix_fmt); #endif @@ -648,7 +648,7 @@ diff -Naur xine-lib-1.1.19.orig/src/combined/ffmpeg/ff_video_decoder.c xine-lib- dy = img->base[0]; du = img->base[1]; dv = img->base[2]; -@@ -1022,6 +1532,11 @@ static void ff_handle_mpeg12_buffer (ff_ +@@ -1038,6 +1548,11 @@ static void ff_handle_mpeg12_buffer (ff_ lprintf("handle_mpeg12_buffer\n"); @@ -660,27 +660,7 @@ diff -Naur xine-lib-1.1.19.orig/src/combined/ffmpeg/ff_video_decoder.c xine-lib- while ((size > 0) || (flush == 1)) { uint8_t *current; -@@ -1307,10 +1822,19 @@ static void ff_handle_buffer (ff_video_d - this->context->hurry_up = (this->skipframes > 0); - - lprintf("buffer size: %d\n", this->size); -+ -+ //this->av_pkt.size = this->size; -+ //this->av_pkt.data = &chunk_buf[offset]; -+ //this->av_pkt.data = this->buf; -+ -+ //len = avcodec_decode_video2 (this->context, this->av_frame, &got_picture, &this->av_pkt); -+ - len = avcodec_decode_video (this->context, this->av_frame, - &got_picture, &chunk_buf[offset], - this->size); - -+ //av_free_packet(&this->av_pkt); -+ - #ifdef AVCODEC_HAS_REORDERED_OPAQUE - /* reset consumed pts value */ - this->context->reordered_opaque = ff_tag_pts(this, 0); -@@ -1355,47 +1879,48 @@ static void ff_handle_buffer (ff_video_d +@@ -1403,47 +1918,48 @@ static void ff_handle_buffer (ff_video_d /* aspect ratio provided by ffmpeg, override previous setting */ if ((this->aspect_ratio_prio < 2) && @@ -757,7 +737,7 @@ diff -Naur xine-lib-1.1.19.orig/src/combined/ffmpeg/ff_video_decoder.c xine-lib- /* xine-lib expects the framesize to be a multiple of 16x16 (macroblock) */ img = this->stream->video_out->get_frame (this->stream->video_out, -@@ -1436,7 +1961,7 @@ static void ff_handle_buffer (ff_video_d +@@ -1484,7 +2000,7 @@ static void ff_handle_buffer (ff_video_d this->av_frame->pict_type); } else if (!this->av_frame->opaque) { @@ -766,7 +746,7 @@ diff -Naur xine-lib-1.1.19.orig/src/combined/ffmpeg/ff_video_decoder.c xine-lib- ff_convert_frame(this, img); } -@@ -1524,6 +2049,15 @@ static void ff_decode_data (video_decode +@@ -1572,6 +2088,15 @@ static void ff_decode_data (video_decode _x_stream_info_set(this->stream, XINE_STREAM_INFO_FRAME_DURATION, (this->reported_video_step = this->video_step)); } @@ -782,7 +762,7 @@ diff -Naur xine-lib-1.1.19.orig/src/combined/ffmpeg/ff_video_decoder.c xine-lib- if (buf->decoder_flags & BUF_FLAG_PREVIEW) { ff_handle_preview_buffer(this, buf); -@@ -1541,24 +2075,24 @@ static void ff_decode_data (video_decode +@@ -1589,24 +2114,24 @@ static void ff_decode_data (video_decode ff_handle_header_buffer(this, buf); if (buf->decoder_flags & BUF_FLAG_ASPECT) { @@ -816,7 +796,7 @@ diff -Naur xine-lib-1.1.19.orig/src/combined/ffmpeg/ff_video_decoder.c xine-lib- } } -@@ -1637,6 +2171,8 @@ static void ff_dispose (video_decoder_t +@@ -1685,6 +2210,8 @@ static void ff_dispose (video_decoder_t lprintf ("ff_dispose\n"); @@ -825,7 +805,7 @@ diff -Naur xine-lib-1.1.19.orig/src/combined/ffmpeg/ff_video_decoder.c xine-lib- if (this->decoder_ok) { xine_list_iterator_t it; AVFrame *av_frame; -@@ -1728,10 +2264,31 @@ static video_decoder_t *ff_video_open_pl +@@ -1776,10 +2303,31 @@ static video_decoder_t *ff_video_open_pl this->dr1_frames = xine_list_new(); 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"); |