Package: mrpt
Version: 1.3.0-1.1
Severity: important
Tags: patch
User: [email protected]
Usertags: ffmpeg2.9

Dear Maintainer,

your package fails to build with the upcoming ffmpeg 2.9.
This bug will become release-critical at some point when the
ffmpeg2.9 transition gets closer.

Attached is a patch replacing the deprecated functionality.
It also works with ffmpeg 2.8.
Please apply this patch and forward it upstream, if necessary.

These changes have little regression potential.

Best regards,
Andreas

diff --git a/debian/patches/ffmpeg_2.9.patch b/debian/patches/ffmpeg_2.9.patch
new file mode 100644
index 0000000..3258c73
--- /dev/null
+++ b/debian/patches/ffmpeg_2.9.patch
@@ -0,0 +1,70 @@
+Description: Replace deprecated FFmpeg API
+Author: Andreas Cadhalpun <[email protected]>
+Last-Update: <2015-11-02>
+
+--- mrpt-1.3.0.orig/libs/hwdrivers/src/CFFMPEG_InputStream.cpp
++++ mrpt-1.3.0/libs/hwdrivers/src/CFFMPEG_InputStream.cpp
+@@ -206,10 +206,10 @@ bool CFFMPEG_InputStream::openURL( const
+     }
+ 
+     // Allocate video frame
+-    ctx->pFrame=avcodec_alloc_frame();
++    ctx->pFrame=av_frame_alloc();
+ 
+     // Allocate an AVFrame structure
+-    ctx->pFrameRGB=avcodec_alloc_frame();
++    ctx->pFrameRGB=av_frame_alloc();
+ 
+     if(ctx->pFrameRGB==NULL || ctx->pFrame==NULL)
+     {
+@@ -219,7 +219,7 @@ bool CFFMPEG_InputStream::openURL( const
+ 
+     // Determine required buffer size and allocate buffer
+     size_t numBytes=avpicture_get_size(
+-		m_grab_as_grayscale ? PIX_FMT_GRAY8 : PIX_FMT_BGR24,   // BGR vs. RGB for OpenCV
++		m_grab_as_grayscale ? AV_PIX_FMT_GRAY8 : AV_PIX_FMT_BGR24,   // BGR vs. RGB for OpenCV
+ 		ctx->pCodecCtx->width,
+ 		ctx->pCodecCtx->height);
+ 
+@@ -229,7 +229,7 @@ bool CFFMPEG_InputStream::openURL( const
+     avpicture_fill(
+ 		(AVPicture *)ctx->pFrameRGB,
+ 		&ctx->buffer[0],
+-		m_grab_as_grayscale ? PIX_FMT_GRAY8 : PIX_FMT_BGR24,   // BGR vs. RGB for OpenCV
++		m_grab_as_grayscale ? AV_PIX_FMT_GRAY8 : AV_PIX_FMT_BGR24,   // BGR vs. RGB for OpenCV
+ 		ctx->pCodecCtx->width,
+ 		ctx->pCodecCtx->height);
+ 
+@@ -273,12 +273,12 @@ void CFFMPEG_InputStream::close()
+ 
+     if (ctx->pFrameRGB)
+     {
+-		av_free(ctx->pFrameRGB);
++		av_frame_free(&ctx->pFrameRGB);
+ 		ctx->pFrameRGB=NULL;
+     }
+     if (ctx->pFrame)
+     {
+-		av_free(ctx->pFrame);
++		av_frame_free(&ctx->pFrame);
+ 		ctx->pFrame = NULL;
+     }
+ 
+@@ -335,7 +335,7 @@ bool CFFMPEG_InputStream::retrieveFrame(
+ 					ctx->pCodecCtx->pix_fmt,
+ 					ctx->pCodecCtx->width,
+ 					ctx->pCodecCtx->height,
+-					m_grab_as_grayscale ? PIX_FMT_GRAY8 : PIX_FMT_BGR24,   // BGR vs. RGB for OpenCV
++					m_grab_as_grayscale ? AV_PIX_FMT_GRAY8 : AV_PIX_FMT_BGR24,   // BGR vs. RGB for OpenCV
+ 					SWS_BICUBIC,
+ 					NULL, NULL, NULL);
+ 
+@@ -350,7 +350,7 @@ bool CFFMPEG_InputStream::retrieveFrame(
+ 				/*	JL: Old code (deprecated)
+ 				img_convert(
+ 					(AVPicture *)ctx->pFrameRGB,
+-					m_grab_as_grayscale ? PIX_FMT_GRAY8 : PIX_FMT_BGR24,   // BGR vs. RGB for OpenCV
++					m_grab_as_grayscale ? AV_PIX_FMT_GRAY8 : AV_PIX_FMT_BGR24,   // BGR vs. RGB for OpenCV
+                     (AVPicture*)ctx->pFrame,
+                     ctx->pCodecCtx->pix_fmt,
+                     ctx->pCodecCtx->width,
diff --git a/debian/patches/series b/debian/patches/series
index 24fd20c..25115b5 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -1 +1,2 @@
 eigen3.patch
+ffmpeg_2.9.patch

Reply via email to