Bug#888357: opal: FTBFS with FFmpeg 3.5

Iain Lane iain at orangesquash.org.uk
Wed Aug 15 10:32:04 BST 2018


Control: tags -1 + patch

On Wed, Jan 24, 2018 at 10:26:50PM +0000, jcowgill at debian.org wrote:
> Source: opal
> Version: 3.10.10~dfsg2-2.1
> Severity: important
> User: debian-multimedia at lists.debian.org
> Usertags: ffmpeg-3.5-transition
> 
> Hi,
> 
> Your package FTBFS with the upcoming version 3.5 of FFmpeg. In FFmpeg 3.5,
> there are a number of API changes which will cause many packages to FTBFS.
> For this reason I have uploaded an early development snapshot to experimental
> before the 3.5 release in an attempt to fix some of these a bit quicker.
> While 3.5 has not been finalized and the ABI is not stable yet, there should
> not be any significant API breakages before the release.

Attached is a patch which at least makes opal build. I think probably
some of the "#if" guards are wrong and should be replaced with new API,
but I'm not sure. Hope it helps.

Cheers,

-- 
Iain Lane                                  [ iain at orangesquash.org.uk ]
Debian Developer                                   [ laney at debian.org ]
Ubuntu Developer                                   [ laney at ubuntu.com ]
-------------- next part --------------
Description: FFmpeg 4.0 compatibility
Author: Iain Lane <iain.lane at canonical.com>
Bug-Debian: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=888357
Forwarded: yes

Index: b/plugins/video/H.263-1998/h263-1998.cxx
===================================================================
--- a/plugins/video/H.263-1998/h263-1998.cxx
+++ b/plugins/video/H.263-1998/h263-1998.cxx
@@ -230,7 +230,7 @@
 
   m_context->opaque = this;
 
-  m_context->flags = CODEC_FLAG_TRUNCATED  // Possible missing packets
+  m_context->flags = AV_CODEC_FLAG_TRUNCATED  // Possible missing packets
                    ;
 
   m_context->pix_fmt = AV_PIX_FMT_YUV420P;
@@ -341,9 +341,9 @@
     // Level 3+
     // works with eyeBeam
     if (atoi(value) == 1)
-      m_context->flags |= CODEC_FLAG_AC_PRED; 
+      m_context->flags |= AV_CODEC_FLAG_AC_PRED; 
     else
-      m_context->flags &= ~CODEC_FLAG_AC_PRED; 
+      m_context->flags &= ~AV_CODEC_FLAG_AC_PRED; 
     return;
   }
 
@@ -351,9 +351,9 @@
     // Annex J: Deblocking Filter
     // works with eyeBeam
     if (atoi(value) == 1)
-      m_context->flags |= CODEC_FLAG_LOOP_FILTER; 
+      m_context->flags |= AV_CODEC_FLAG_LOOP_FILTER; 
     else
-      m_context->flags &= ~CODEC_FLAG_LOOP_FILTER; 
+      m_context->flags &= ~AV_CODEC_FLAG_LOOP_FILTER; 
     return;
   }
 
@@ -420,9 +420,11 @@
   m_context->max_qdiff = 10;  // was 3      // max q difference between frames
   m_context->qcompress = 0.5;               // qscale factor between easy & hard scenes (0.0-1.0)
 
+#if LIBAVCODEC_VERSION_INT <= AV_VERSION_INT(52, 0, 0)
   // Lagrange multipliers - this is how the context defaults do it:
   m_context->lmin = m_context->qmin * FF_QP2LAMBDA;
   m_context->lmax = m_context->qmax * FF_QP2LAMBDA; 
+#endif
 
   // YUV420P input
   m_inputFrame->linesize[0] = m_context->width;
@@ -599,7 +601,7 @@
 #ifdef CODEC_FLAG_H263P_UMV
   m_context->flags &= ~CODEC_FLAG_H263P_UMV;
 #endif
-  m_context->flags &= ~CODEC_FLAG_4MV;
+  m_context->flags &= ~AV_CODEC_FLAG_4MV;
 #if LIBAVCODEC_RTP_MODE
   m_context->flags &= ~CODEC_FLAG_H263P_AIC;
 #endif
Index: b/plugins/video/H.263-1998/rfc2429.cxx
===================================================================
--- a/plugins/video/H.263-1998/rfc2429.cxx
+++ b/plugins/video/H.263-1998/rfc2429.cxx
@@ -286,7 +286,7 @@
 
 unsigned char * RFC2429Frame::GetBuffer()
 {
-  memset (m_encodedFrame.ptr + m_encodedFrame.pos,0 , FF_INPUT_BUFFER_PADDING_SIZE);
+  memset (m_encodedFrame.ptr + m_encodedFrame.pos,0 , AV_INPUT_BUFFER_PADDING_SIZE);
   return (m_encodedFrame.ptr);
 }
 
@@ -340,10 +340,10 @@
 
   unsigned remBytes = packet.GetPayloadSize() - headerPLEN - (headerV ? 3 : 2);
 
-  if ((m_encodedFrame.pos + (headerP ? 2 : 0) + remBytes) > (m_maxFrameSize - FF_INPUT_BUFFER_PADDING_SIZE)) {
+  if ((m_encodedFrame.pos + (headerP ? 2 : 0) + remBytes) > (m_maxFrameSize - AV_INPUT_BUFFER_PADDING_SIZE)) {
     PTRACE(2, "H.263-RFC2429", "Trying to add " << remBytes 
          << " bytes to frame at position " << m_encodedFrame.pos + (headerP ? 2 : 0) 
-         << " bytes while maximum frame size is  " << m_maxFrameSize << "-" << FF_INPUT_BUFFER_PADDING_SIZE << " bytes");
+         << " bytes while maximum frame size is  " << m_maxFrameSize << "-" << AV_INPUT_BUFFER_PADDING_SIZE << " bytes");
     return false;
   }
 
Index: b/plugins/video/MPEG4-ffmpeg/mpeg4.cxx
===================================================================
--- a/plugins/video/MPEG4-ffmpeg/mpeg4.cxx
+++ b/plugins/video/MPEG4-ffmpeg/mpeg4.cxx
@@ -546,11 +546,14 @@
 
     // Reduce the difference in quantization between frames.
     m_avcontext->qblur = 0.3f;
+#if LIBAVCODEC_VERSION_INT <= AV_VERSION_INT(52, 0, 0)
     // default is tex^qComp; 1 is constant bitrate
     m_avcontext->rc_eq = (char*) "1";
+#endif
     //avcontext->rc_eq = "tex^qComp";
     // These ones technically could be dynamic, I think
     m_avcontext->rc_min_rate = 0;
+#if LIBAVCODEC_VERSION_INT <= AV_VERSION_INT(52, 0, 0)
     // This is set to 0 in ffmpeg.c, the command-line utility.
     m_avcontext->rc_initial_cplx = 0.0f;
 
@@ -560,6 +563,7 @@
     // the "vbv buffer", not bits per second, so nobody really knows how
     // it works.
     m_avcontext->rc_buffer_aggressivity = 1.0f;
+#endif
 
     // Ratecontrol buffer size, in bits. Usually 0.5-1 second worth.
     // 224 kbyte is what VLC uses, and it seems to fix the quantization pulse (at Level 5)
@@ -592,10 +596,10 @@
     m_avcontext->flags |= CODEC_FLAG_4MV;    // 4 motion vectors
 #else
     m_avcontext->max_b_frames=0; /*don't use b frames*/
-    m_avcontext->flags|=CODEC_FLAG_AC_PRED;
+    m_avcontext->flags|=AV_CODEC_FLAG_AC_PRED;
     /*c->flags|=CODEC_FLAG_QPEL;*/ /*don't enable this one: this forces profile_level to advanced simple profile */
-    m_avcontext->flags|=CODEC_FLAG_4MV;
-    m_avcontext->flags|=CODEC_FLAG_LOOP_FILTER;
+    m_avcontext->flags|=AV_CODEC_FLAG_4MV;
+    m_avcontext->flags|=AV_CODEC_FLAG_LOOP_FILTER;
 #endif
     m_avcontext->opaque = this;              // for use in RTP callback
 }
@@ -631,9 +635,11 @@
     m_avcontext->qmax = round ( (double)(31 - m_videoQMin) / 31 * m_videoTSTO + m_videoQMin);
     m_avcontext->qmax = std::min( m_avcontext->qmax, 31);
 
+#if LIBAVCODEC_VERSION_INT <= AV_VERSION_INT(52, 0, 0)
     // Lagrange multipliers - this is how the context defaults do it:
     m_avcontext->lmin = m_avcontext->qmin * FF_QP2LAMBDA;
     m_avcontext->lmax = m_avcontext->qmax * FF_QP2LAMBDA;
+#endif
 
     // If framesize has changed or is not yet initialized, fix it up
     if((unsigned)m_avcontext->width != m_frameWidth || (unsigned)m_avcontext->height != m_frameHeight) {
@@ -661,7 +667,7 @@
     {
         delete[] m_rawFrameBuffer;
     }
-    m_rawFrameBuffer = new BYTE[m_rawFrameLen + FF_INPUT_BUFFER_PADDING_SIZE];
+    m_rawFrameBuffer = new BYTE[m_rawFrameLen + AV_INPUT_BUFFER_PADDING_SIZE];
 
     if (m_encFrameBuffer)
     {
@@ -671,7 +677,7 @@
     m_encFrameBuffer = new BYTE[m_encFrameLen];
 
     // Clear the back padding
-    memset(m_rawFrameBuffer + m_rawFrameLen, 0, FF_INPUT_BUFFER_PADDING_SIZE);
+    memset(m_rawFrameBuffer + m_rawFrameLen, 0, AV_INPUT_BUFFER_PADDING_SIZE);
     const unsigned fsz = m_frameWidth * m_frameHeight;
     m_avpicture->data[0] = m_rawFrameBuffer;              // luminance
     m_avpicture->data[1] = m_rawFrameBuffer + fsz;        // first chroma channel
@@ -1322,7 +1328,7 @@
 //
 
 void MPEG4DecoderContext::SetStaticDecodingParams() {
-    m_avcontext->flags |= CODEC_FLAG_4MV; 
+    m_avcontext->flags |= AV_CODEC_FLAG_4MV; 
     m_avcontext->workaround_bugs = 0; // no workaround for buggy implementations
 }
 
Index: b/plugins/video/H.264/h264-x264.cxx
===================================================================
--- a/plugins/video/H.264/h264-x264.cxx
+++ b/plugins/video/H.264/h264-x264.cxx
@@ -1078,7 +1078,7 @@
 #ifdef CODEC_FLAG2_DROP_FRAME_TIMECODE
                           CODEC_FLAG2_DROP_FRAME_TIMECODE |
 #endif
-                          CODEC_FLAG2_CHUNKS;
+                          AV_CODEC_FLAG2_CHUNKS;
 
       if ((m_picture = FFMPEGLibraryInstance.AvcodecAllocFrame()) == NULL)
         return false;
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <http://alioth-lists.debian.net/pipermail/pkg-voip-maintainers/attachments/20180815/1d180cbf/attachment.sig>


More information about the Pkg-voip-maintainers mailing list