[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#888327: xine-lib-1.2: FTBFS with FFmpeg 3.5



Control: tags -1 fixed-upstream patch

On Wed, 24 Jan 2018 22:26:51 +0000 jcowgill@debian.org wrote:
> Source: xine-lib-1.2
> Version: 1.2.8-2
> Severity: important
> User: debian-multimedia@lists.debian.org
> Usertags: ffmpeg-3.5-transition
> 
> Hi,
> 
> Your package FTBFS with the upcoming version 3.5 of FFmpeg.

Fixed upstream by this commit:
https://sourceforge.net/p/xine/xine-lib-1.2/ci/abd6e04c7a53f10d1a2975159f65ba7e33bee61c/

Patch attached.

James
Description: Fix FTBFS with FFmpeg 4.0
Origin: upstream, https://sourceforge.net/p/xine/xine-lib-1.2/ci/abd6e04c7a53f10d1a2975159f65ba7e33bee61c/
Bug-Debian: https://bugs.debian.org/888327
---
This patch header follows DEP-3: http://dep.debian.net/deps/dep3/
--- a/src/combined/ffmpeg/ff_audio_decoder.c
+++ b/src/combined/ffmpeg/ff_audio_decoder.c
@@ -221,7 +221,7 @@ static void ff_audio_ensure_buffer_size(
     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 @@ static void ff_audio_handle_special_buff
 
     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 @@ static void ff_handle_header_buffer(ff_a
             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 @@ static void ff_audio_decode_data (audio_
       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) {
 
--- a/src/combined/ffmpeg/ff_mpeg_parser.c
+++ b/src/combined/ffmpeg/ff_mpeg_parser.c
@@ -26,6 +26,7 @@
 #define LOG
 */
 #include "ff_mpeg_parser.h"
+#include "ffmpeg_compat.h"
 
 /* mpeg frame rate table from lavc */
 static const int frame_rate_tab[][2] = {
@@ -50,7 +51,7 @@ static const int frame_rate_tab[][2] = {
 
 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);
 }
 
--- a/src/combined/ffmpeg/ff_video_decoder.c
+++ b/src/combined/ffmpeg/ff_video_decoder.c
@@ -869,16 +869,18 @@ static void init_video_codec (ff_video_d
   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 ();
+#ifdef CODEC_FLAG_EMU_EDGE
     } 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;
+#endif
     }
   }
 
@@ -887,7 +889,7 @@ static void init_video_codec (ff_video_d
   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 +914,7 @@ static void init_video_codec (ff_video_d
   /* 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 +1458,7 @@ static void ff_check_bufsize (ff_video_d
     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 +1469,7 @@ static int ff_vc1_find_header(ff_video_d
   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 +1598,10 @@ static void ff_handle_header_buffer (ff_
       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 +1622,7 @@ static void ff_handle_header_buffer (ff_
 	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 +1630,10 @@ static void ff_handle_header_buffer (ff_
 	     ((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 +1665,10 @@ static void ff_handle_special_buffer (ff
     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 +1676,10 @@ static void ff_handle_special_buffer (ff
     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 +2087,7 @@ static void ff_handle_buffer (ff_video_d
   /* 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 +2123,7 @@ static void ff_handle_buffer (ff_video_d
     /* 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 +2734,7 @@ static video_decoder_t *ff_video_open_pl
 
   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;
--- a/src/combined/ffmpeg/ffmpeg_compat.h
+++ b/src/combined/ffmpeg/ffmpeg_compat.h
@@ -234,4 +234,15 @@
 #define XFF_PACKET_UNREF av_packet_unref
 #endif
 
+#ifndef AV_INPUT_BUFFER_PADDING_SIZE
+#  define AV_INPUT_BUFFER_PADDING_SIZE FF_INPUT_BUFFER_PADDING_SIZE
+#endif
+#ifndef AV_CODEC_CAP_DR1
+#  define AV_CODEC_CAP_DR1 CODEC_CAP_DR1
+#endif
+#ifndef AV_CODEC_FLAG2_FAST
+#  define AV_CODEC_FLAG2_FAST CODEC_FLAG2_FAST
+#endif
+
+
 #endif /* XINE_AVCODEC_COMPAT_H */
--- a/src/dxr3/ffmpeg_encoder.c
+++ b/src/dxr3/ffmpeg_encoder.c
@@ -207,7 +207,9 @@ static int lavc_on_update_format(dxr3_dr
   this->context->height = frame->oheight;
 
   this->context->gop_size = 0; /*intra frames only */
+#if defined(LIBAVCODEC_VERSION_MAJOR) && LIBAVCODEC_VERSION_MAJOR < 58
   this->context->me_method = ME_ZERO; /*motion estimation type*/
+#endif
 
   this->context->time_base.den = 90000;
   if (frame->vo_frame.duration > 90000 / 24)

Attachment: signature.asc
Description: OpenPGP digital signature


Reply to: