sci-libs/ViSP: fix build with ffmpeg git master.
authorAlexis Ballier <aballier@gentoo.org>
Wed, 16 Sep 2015 17:03:18 +0000 (19:03 +0200)
committerAlexis Ballier <aballier@gentoo.org>
Wed, 16 Sep 2015 17:04:33 +0000 (19:04 +0200)
Package-Manager: portage-2.2.20.1

sci-libs/ViSP/ViSP-2.10.0-r1.ebuild
sci-libs/ViSP/files/ffmpeg.patch [new file with mode: 0644]

index 2b3aab4fb0d319876f902f7bd402d2770408bbac..6323a7d39c6df9f28bd7cf8a7dc5baf3fee004c2 100644 (file)
@@ -51,7 +51,11 @@ REQUIRED_USE="
        qt4? ( coin )
        motif? ( coin )
 "
-PATCHES=( "${FILESDIR}/opencv.patch" "${FILESDIR}/opencv3.patch" )
+PATCHES=( 
+       "${FILESDIR}/opencv.patch"
+       "${FILESDIR}/opencv3.patch"
+       "${FILESDIR}/ffmpeg.patch"
+)
 
 src_configure() {
        local mycmakeargs=(
diff --git a/sci-libs/ViSP/files/ffmpeg.patch b/sci-libs/ViSP/files/ffmpeg.patch
new file mode 100644 (file)
index 0000000..5c81d05
--- /dev/null
@@ -0,0 +1,78 @@
+Index: ViSP-2.10.0/src/video/vpFFMPEG.cpp
+===================================================================
+--- ViSP-2.10.0.orig/src/video/vpFFMPEG.cpp
++++ ViSP-2.10.0/src/video/vpFFMPEG.cpp
+@@ -184,7 +184,7 @@ bool vpFFMPEG::openStream(const char *fi
+       if (pFrameRGB == NULL)
+         return false;
+       
+-      numBytes = avpicture_get_size (PIX_FMT_RGB24,pCodecCtx->width,pCodecCtx->height);
++      numBytes = avpicture_get_size (AV_PIX_FMT_RGB24,pCodecCtx->width,pCodecCtx->height);
+     }
+     
+     else if (color_type == vpFFMPEG::GRAY_SCALED)
+@@ -198,7 +198,7 @@ bool vpFFMPEG::openStream(const char *fi
+       if (pFrameGRAY == NULL)
+         return false;
+       
+-      numBytes = avpicture_get_size (PIX_FMT_GRAY8,pCodecCtx->width,pCodecCtx->height);
++      numBytes = avpicture_get_size (AV_PIX_FMT_GRAY8,pCodecCtx->width,pCodecCtx->height);
+     }  
+     /*
+@@ -215,10 +215,10 @@ bool vpFFMPEG::openStream(const char *fi
+   }
+   
+   if (color_type == vpFFMPEG::COLORED)
+-    avpicture_fill((AVPicture *)pFrameRGB, buffer, PIX_FMT_RGB24, pCodecCtx->width, pCodecCtx->height);
++    avpicture_fill((AVPicture *)pFrameRGB, buffer, AV_PIX_FMT_RGB24, pCodecCtx->width, pCodecCtx->height);
+   
+   else if (color_type == vpFFMPEG::GRAY_SCALED)
+-    avpicture_fill((AVPicture *)pFrameGRAY, buffer, PIX_FMT_GRAY8, pCodecCtx->width, pCodecCtx->height);
++    avpicture_fill((AVPicture *)pFrameGRAY, buffer, AV_PIX_FMT_GRAY8, pCodecCtx->width, pCodecCtx->height);
+   
+   streamWasOpen = true;
+@@ -235,10 +235,10 @@ bool vpFFMPEG::openStream(const char *fi
+ bool vpFFMPEG::initStream()
+ {
+   if (color_type == vpFFMPEG::COLORED)
+-    img_convert_ctx= sws_getContext(pCodecCtx->width, pCodecCtx->height, pCodecCtx->pix_fmt, pCodecCtx->width,pCodecCtx->height,PIX_FMT_RGB24, SWS_BICUBIC, NULL, NULL, NULL);
++    img_convert_ctx= sws_getContext(pCodecCtx->width, pCodecCtx->height, pCodecCtx->pix_fmt, pCodecCtx->width,pCodecCtx->height,AV_PIX_FMT_RGB24, SWS_BICUBIC, NULL, NULL, NULL);
+   
+   else if (color_type == vpFFMPEG::GRAY_SCALED)
+-    img_convert_ctx= sws_getContext(pCodecCtx->width, pCodecCtx->height, pCodecCtx->pix_fmt, pCodecCtx->width,pCodecCtx->height,PIX_FMT_GRAY8, SWS_BICUBIC, NULL, NULL, NULL);
++    img_convert_ctx= sws_getContext(pCodecCtx->width, pCodecCtx->height, pCodecCtx->pix_fmt, pCodecCtx->width,pCodecCtx->height,AV_PIX_FMT_GRAY8, SWS_BICUBIC, NULL, NULL, NULL);
+   int ret = av_seek_frame(pFormatCtx, (int)videoStream, 0, AVSEEK_FLAG_ANY) ;
+   if (ret < 0 )
+@@ -707,7 +707,7 @@ bool vpFFMPEG::openEncoder(const char *f
+   pCodecCtx->time_base.den = framerate_encoder;
+   pCodecCtx->gop_size = 10; /* emit one intra frame every ten frames */
+   pCodecCtx->max_b_frames=1;
+-  pCodecCtx->pix_fmt = PIX_FMT_YUV420P;
++  pCodecCtx->pix_fmt = AV_PIX_FMT_YUV420P;
+   /* open it */
+ #if LIBAVCODEC_VERSION_INT < AV_VERSION_INT(53,35,0) // libavcodec 53.35.0
+@@ -730,15 +730,15 @@ bool vpFFMPEG::openEncoder(const char *f
+   outbuf_size = 100000;
+   outbuf = new uint8_t[outbuf_size];
+-  numBytes = avpicture_get_size (PIX_FMT_YUV420P,pCodecCtx->width,pCodecCtx->height);
++  numBytes = avpicture_get_size (AV_PIX_FMT_YUV420P,pCodecCtx->width,pCodecCtx->height);
+   picture_buf = new uint8_t[numBytes];
+-  avpicture_fill((AVPicture *)pFrame, picture_buf, PIX_FMT_YUV420P, pCodecCtx->width, pCodecCtx->height);
++  avpicture_fill((AVPicture *)pFrame, picture_buf, AV_PIX_FMT_YUV420P, pCodecCtx->width, pCodecCtx->height);
+-  numBytes = avpicture_get_size (PIX_FMT_RGB24,pCodecCtx->width,pCodecCtx->height);
++  numBytes = avpicture_get_size (AV_PIX_FMT_RGB24,pCodecCtx->width,pCodecCtx->height);
+   buffer = new uint8_t[numBytes];
+-  avpicture_fill((AVPicture *)pFrameRGB, buffer, PIX_FMT_RGB24, pCodecCtx->width, pCodecCtx->height);
++  avpicture_fill((AVPicture *)pFrameRGB, buffer, AV_PIX_FMT_RGB24, pCodecCtx->width, pCodecCtx->height);
+-  img_convert_ctx= sws_getContext(pCodecCtx->width, pCodecCtx->height, PIX_FMT_RGB24, pCodecCtx->width,pCodecCtx->height,PIX_FMT_YUV420P, SWS_BICUBIC, NULL, NULL, NULL);
++  img_convert_ctx= sws_getContext(pCodecCtx->width, pCodecCtx->height, AV_PIX_FMT_RGB24, pCodecCtx->width,pCodecCtx->height,AV_PIX_FMT_YUV420P, SWS_BICUBIC, NULL, NULL, NULL);
+   
+   encoderWasOpened = true;