[packages/xine-lib] - fix building with ffmpeg 4.0 - rel 7

baggins baggins at pld-linux.org
Sun Apr 29 00:42:04 CEST 2018


commit 5587f787dc65fb1f49b662ddda7900e68bac9860
Author: Jan Rękorajski <baggins at pld-linux.org>
Date:   Sun Apr 29 00:41:28 2018 +0200

    - fix building with ffmpeg 4.0
    - rel 7

 ffmpeg4.patch | 200 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 xine-lib.spec |   4 +-
 2 files changed, 203 insertions(+), 1 deletion(-)
---
diff --git a/xine-lib.spec b/xine-lib.spec
index d3bd546..78197f7 100644
--- a/xine-lib.spec
+++ b/xine-lib.spec
@@ -41,7 +41,7 @@ Summary(pl.UTF-8):	Odtwarzacz filmów
 Summary(pt_BR.UTF-8):	Xine, um player de video
 Name:		xine-lib
 Version:	1.2.8
-Release:	6
+Release:	7
 Epoch:		2
 License:	GPL v2+
 Group:		Libraries
@@ -54,6 +54,7 @@ Patch3:		%{name}-ac.patch
 # from DirectFB 1.7.0
 Patch4:		%{name}-vdpau-hooks.patch
 Patch5:		x32.patch
+Patch6:		ffmpeg4.patch
 Patch8:		imagemagick7.patch
 URL:		http://xine.sourceforge.net/
 %{?with_directfb:BuildRequires:	DirectFB-devel >= 0.9.22}
@@ -968,6 +969,7 @@ XINE - wtyczka postprocessingu oparta na libpostproc z pakietu FFmpeg.
 %patch3 -p1
 %patch4 -p1
 %patch5 -p1
+%patch6 -p1
 %patch8 -p1
 
 %build
diff --git a/ffmpeg4.patch b/ffmpeg4.patch
new file mode 100644
index 0000000..ad899ef
--- /dev/null
+++ b/ffmpeg4.patch
@@ -0,0 +1,200 @@
+--- xine-lib-1.2.8/src/combined/ffmpeg/ff_audio_decoder.c~	2017-02-21 12:13:13.000000000 +0100
++++ xine-lib-1.2.8/src/combined/ffmpeg/ff_audio_decoder.c	2018-04-29 00:29:06.993144238 +0200
+@@ -221,7 +221,7 @@
+     xprintf(this->stream->xine, XINE_VERBOSITY_LOG,
+             _("ffmpeg_audio_dec: increasing buffer to %d to avoid overflow.\n"),
+             this->bufsize);
+-    this->buf = xine_realloc_aligned (this->buf, this->bufsize + FF_INPUT_BUFFER_PADDING_SIZE);
++    this->buf = xine_realloc_aligned (this->buf, this->bufsize + AV_INPUT_BUFFER_PADDING_SIZE);
+   }
+ }
+ 
+@@ -232,9 +232,9 @@
+ 
+     free (this->context->extradata);
+     this->context->extradata_size = buf->decoder_info[2];
+-    this->context->extradata = malloc (buf->decoder_info[2] + FF_INPUT_BUFFER_PADDING_SIZE);
++    this->context->extradata = malloc (buf->decoder_info[2] + AV_INPUT_BUFFER_PADDING_SIZE);
+     memcpy (this->context->extradata, buf->decoder_info_ptr[2], buf->decoder_info[2]);
+-    memset (this->context->extradata + buf->decoder_info[2], 0, FF_INPUT_BUFFER_PADDING_SIZE);
++    memset (this->context->extradata + buf->decoder_info[2], 0, AV_INPUT_BUFFER_PADDING_SIZE);
+ 
+     ff_aac_mode_set (this, 0);
+   }
+@@ -451,10 +451,10 @@
+             this->ff_channels, this->ff_bits, this->ff_sample_rate,
+             this->context->block_align);
+           if (!data_len) break;
+-          e = malloc (data_len + FF_INPUT_BUFFER_PADDING_SIZE);
++          e = malloc (data_len + AV_INPUT_BUFFER_PADDING_SIZE);
+           if (!e) break;
+           xine_fast_memcpy (e, p, data_len);
+-          memset (e + data_len, 0, FF_INPUT_BUFFER_PADDING_SIZE);
++          memset (e + data_len, 0, AV_INPUT_BUFFER_PADDING_SIZE);
+           this->context->extradata = e;
+           this->context->extradata_size = data_len;
+           break;
+@@ -1008,7 +1008,7 @@
+       offset = 0;
+ 
+       /* pad input data */
+-      memset(&this->buf[this->size], 0, FF_INPUT_BUFFER_PADDING_SIZE);
++      memset(&this->buf[this->size], 0, AV_INPUT_BUFFER_PADDING_SIZE);
+ 
+       while (this->size>=0) {
+ 
+--- xine-lib-1.2.8/src/combined/ffmpeg/ff_video_decoder.c.orig	2017-02-21 12:13:13.000000000 +0100
++++ xine-lib-1.2.8/src/combined/ffmpeg/ff_video_decoder.c	2018-04-29 00:35:47.244275385 +0200
+@@ -869,16 +869,12 @@
+   this->stream->video_out->open (this->stream->video_out, this->stream);
+ 
+   this->edge = 0;
+-  if(this->codec->capabilities & CODEC_CAP_DR1 && this->class->enable_dri) {
++  if(this->codec->capabilities & AV_CODEC_CAP_DR1 && this->class->enable_dri) {
+     if (this->stream->video_out->get_capabilities (this->stream->video_out) & VO_CAP_CROP) {
+       /* We can crop. Fine. Lets allow decoders to paint over the frame edges.
+          This will be slightly faster. And it is also a workaround for buggy
+          v54 who likes to ignore EMU_EDGE for wmv2 and xvid. */
+       this->edge = XFF_EDGE_WIDTH ();
+-    } else {
+-      /* 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 */
+-      this->context->flags |= CODEC_FLAG_EMU_EDGE;
+     }
+   }
+ 
+@@ -887,7 +883,7 @@
+   this->context->codec_type = this->codec->type;
+ 
+   if (this->class->choose_speed_over_accuracy)
+-    this->context->flags2 |= CODEC_FLAG2_FAST;
++    this->context->flags2 |= AV_CODEC_FLAG2_FAST;
+ 
+   this->context->skip_loop_filter = skip_loop_filter_enum_values[this->class->skip_loop_filter_enum];
+ 
+@@ -912,7 +908,7 @@
+   /* enable direct rendering by default */
+   this->output_format = XINE_IMGFMT_YV12;
+ #ifdef ENABLE_DIRECT_RENDERING
+-  if( this->codec->capabilities & CODEC_CAP_DR1 && this->class->enable_dri ) {
++  if( this->codec->capabilities & AV_CODEC_CAP_DR1 && this->class->enable_dri ) {
+ #ifdef XFF_AV_BUFFER
+     this->context->get_buffer2 = get_buffer;
+     this->context->thread_safe_callbacks = 1;
+@@ -1456,7 +1452,7 @@
+     xprintf(this->stream->xine, XINE_VERBOSITY_LOG,
+ 	    _("ffmpeg_video_dec: increasing buffer to %d to avoid overflow.\n"),
+ 	    this->bufsize);
+-    this->buf = realloc(this->buf, this->bufsize + FF_INPUT_BUFFER_PADDING_SIZE );
++    this->buf = realloc(this->buf, this->bufsize + AV_INPUT_BUFFER_PADDING_SIZE );
+   }
+ }
+ 
+@@ -1467,7 +1463,7 @@
+   if (!p[0] && !p[1] && p[2] == 1 && p[3] == 0x0f) {
+     int i;
+ 
+-    this->context->extradata = calloc(1, buf->size + FF_INPUT_BUFFER_PADDING_SIZE);
++    this->context->extradata = calloc(1, buf->size + AV_INPUT_BUFFER_PADDING_SIZE);
+     this->context->extradata_size = 0;
+ 
+     for (i = 0; i < buf->size && i < 128; i++) {
+@@ -1596,10 +1592,10 @@
+       if (this->bih.biSize > sizeof(xine_bmiheader)) {
+       this->context->extradata_size = this->bih.biSize - sizeof(xine_bmiheader);
+         this->context->extradata = malloc(this->context->extradata_size +
+-                                          FF_INPUT_BUFFER_PADDING_SIZE);
++                                          AV_INPUT_BUFFER_PADDING_SIZE);
+         memcpy(this->context->extradata, this->buf + sizeof(xine_bmiheader),
+               this->context->extradata_size);
+-        memset(this->context->extradata + this->context->extradata_size, 0, FF_INPUT_BUFFER_PADDING_SIZE);
++        memset(this->context->extradata + this->context->extradata_size, 0, AV_INPUT_BUFFER_PADDING_SIZE);
+       }
+ 
+       this->context->bits_per_sample = this->bih.biBitCount;
+@@ -1620,7 +1616,7 @@
+ 	if (this->context->extradata_size < 8) {
+ 	  this->context->extradata_size= 8;
+ 	  this->context->extradata = calloc(1, this->context->extradata_size +
+-		                            FF_INPUT_BUFFER_PADDING_SIZE);
++		                            AV_INPUT_BUFFER_PADDING_SIZE);
+           ((uint32_t *)this->context->extradata)[0] = 0;
+ 	  if (codec_type == BUF_VIDEO_RV10)
+ 	     ((uint32_t *)this->context->extradata)[1] = 0x10000000;
+@@ -1628,10 +1624,10 @@
+ 	     ((uint32_t *)this->context->extradata)[1] = 0x10003001;
+ 	} else {
+           this->context->extradata = malloc(this->context->extradata_size +
+-	                                    FF_INPUT_BUFFER_PADDING_SIZE);
++	                                    AV_INPUT_BUFFER_PADDING_SIZE);
+ 	  memcpy(this->context->extradata, this->buf + 26,
+ 	         this->context->extradata_size);
+-          memset(this->context->extradata + this->context->extradata_size, 0, FF_INPUT_BUFFER_PADDING_SIZE);
++          memset(this->context->extradata + this->context->extradata_size, 0, AV_INPUT_BUFFER_PADDING_SIZE);
+ 	}
+ 
+ 	xprintf(this->stream->xine, XINE_VERBOSITY_LOG,
+@@ -1663,10 +1659,10 @@
+     lprintf("BUF_SPECIAL_STSD_ATOM\n");
+     this->context->extradata_size = buf->decoder_info[2];
+     this->context->extradata = malloc(buf->decoder_info[2] +
+-				      FF_INPUT_BUFFER_PADDING_SIZE);
++				      AV_INPUT_BUFFER_PADDING_SIZE);
+     memcpy(this->context->extradata, buf->decoder_info_ptr[2],
+       buf->decoder_info[2]);
+-    memset(this->context->extradata + this->context->extradata_size, 0, FF_INPUT_BUFFER_PADDING_SIZE);
++    memset(this->context->extradata + this->context->extradata_size, 0, AV_INPUT_BUFFER_PADDING_SIZE);
+ 
+   } else if (buf->decoder_info[1] == BUF_SPECIAL_DECODER_CONFIG &&
+             !this->context->extradata_size) {
+@@ -1674,10 +1670,10 @@
+     lprintf("BUF_SPECIAL_DECODER_CONFIG\n");
+     this->context->extradata_size = buf->decoder_info[2];
+     this->context->extradata = malloc(buf->decoder_info[2] +
+-				      FF_INPUT_BUFFER_PADDING_SIZE);
++				      AV_INPUT_BUFFER_PADDING_SIZE);
+     memcpy(this->context->extradata, buf->decoder_info_ptr[2],
+       buf->decoder_info[2]);
+-    memset(this->context->extradata + this->context->extradata_size, 0, FF_INPUT_BUFFER_PADDING_SIZE);
++    memset(this->context->extradata + this->context->extradata_size, 0, AV_INPUT_BUFFER_PADDING_SIZE);
+   }
+   else if (buf->decoder_info[1] == BUF_SPECIAL_PALETTE) {
+     unsigned int i;
+@@ -2085,7 +2081,7 @@
+   /* data accumulation */
+   if (buf->size > 0) {
+     if ((this->size == 0) &&
+-	((buf->size + FF_INPUT_BUFFER_PADDING_SIZE) < buf->max_size) &&
++	((buf->size + AV_INPUT_BUFFER_PADDING_SIZE) < buf->max_size) &&
+ 	(buf->decoder_flags & BUF_FLAG_FRAME_END)) {
+       /* buf contains a complete frame */
+       /* no memcpy needed */
+@@ -2121,7 +2117,7 @@
+     /* note: bitstream, alt bitstream reader or something will cause
+      * severe mpeg4 artifacts if padding is less than 32 bits.
+      */
+-    memset(&chunk_buf[this->size], 0, FF_INPUT_BUFFER_PADDING_SIZE);
++    memset(&chunk_buf[this->size], 0, AV_INPUT_BUFFER_PADDING_SIZE);
+ 
+     while (this->size > 0) {
+ 
+@@ -2732,7 +2728,7 @@
+ 
+   this->decoder_ok        = 0;
+   this->decoder_init_mode = 1;
+-  this->buf               = calloc(1, VIDEOBUFSIZE + FF_INPUT_BUFFER_PADDING_SIZE);
++  this->buf               = calloc(1, VIDEOBUFSIZE + AV_INPUT_BUFFER_PADDING_SIZE);
+   this->bufsize           = VIDEOBUFSIZE;
+ 
+   this->is_mpeg12         = 0;
+--- xine-lib-1.2.8/src/combined/ffmpeg/ff_mpeg_parser.c~	2017-02-21 12:13:13.000000000 +0100
++++ xine-lib-1.2.8/src/combined/ffmpeg/ff_mpeg_parser.c	2018-04-29 00:36:37.109002910 +0200
+@@ -50,7 +50,7 @@
+ 
+ void mpeg_parser_init (mpeg_parser_t *parser)
+ {
+-  parser->chunk_buffer = malloc(BUFFER_SIZE + FF_INPUT_BUFFER_PADDING_SIZE);
++  parser->chunk_buffer = malloc(BUFFER_SIZE + AV_INPUT_BUFFER_PADDING_SIZE);
+   mpeg_parser_reset(parser);
+ }
+ 
================================================================

---- gitweb:

http://git.pld-linux.org/gitweb.cgi/packages/xine-lib.git/commitdiff/5587f787dc65fb1f49b662ddda7900e68bac9860



More information about the pld-cvs-commit mailing list