commit:     9aaa1586a3b67e7211e2c54424f9fec0ebb22b3a
Author:     Alexis Ballier <aballier <AT> gentoo <DOT> org>
AuthorDate: Mon Dec  5 10:19:40 2016 +0000
Commit:     Alexis Ballier <aballier <AT> gentoo <DOT> org>
CommitDate: Mon Dec  5 10:19:40 2016 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=9aaa1586

media-video/ffdiaporama: fix build with ffmpeg-3. Patch by charlot in bug 
#575058.

Package-Manager: portage-2.3.2

 media-video/ffdiaporama/ffdiaporama-2.1-r1.ebuild  |   4 +-
 .../files/ffdiaporama-2.1-ffmpeg-3.0.patch         | 196 +++++++++++++++++++++
 2 files changed, 198 insertions(+), 2 deletions(-)

diff --git a/media-video/ffdiaporama/ffdiaporama-2.1-r1.ebuild 
b/media-video/ffdiaporama/ffdiaporama-2.1-r1.ebuild
index e935fdc..cb539a9 100644
--- a/media-video/ffdiaporama/ffdiaporama-2.1-r1.ebuild
+++ b/media-video/ffdiaporama/ffdiaporama-2.1-r1.ebuild
@@ -1,4 +1,4 @@
-# Copyright 1999-2015 Gentoo Foundation
+# Copyright 1999-2016 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
 # $Id$
 
@@ -39,7 +39,7 @@ RDEPEND="
 DEPEND="${RDEPEND}"
 
 DOCS=( authors.txt )
-PATCHES=( "${FILESDIR}"/${P}-{ffmpeg-2.4,libav10}.patch )
+PATCHES=( "${FILESDIR}"/${P}-{ffmpeg-2.4,libav10,ffmpeg-3.0}.patch )
 
 S="${WORKDIR}/ffDiaporama"
 

diff --git a/media-video/ffdiaporama/files/ffdiaporama-2.1-ffmpeg-3.0.patch 
b/media-video/ffdiaporama/files/ffdiaporama-2.1-ffmpeg-3.0.patch
new file mode 100644
index 00000000..4eb8c97
--- /dev/null
+++ b/media-video/ffdiaporama/files/ffdiaporama-2.1-ffmpeg-3.0.patch
@@ -0,0 +1,196 @@
+--- src/ffDiaporama/engine/cBaseMediaFile.cpp  2014-02-09 10:48:04.000000000 
+0100
++++ src/ffDiaporama/engine/cBaseMediaFile.cpp  2016-02-21 19:00:43.129114600 
+0100
+@@ -113,10 +113,23 @@
+ #define VC_USERDATA     0x00000008
+ #define VC_FLUSHED      0x00000010
+ 
+-#define PIXFMT          PIX_FMT_RGB24
++#if (defined(FFMPEG)&&(FFMPEGVERSIONINT>=300))
++  #define PIXELFORMAT AVPixelFormat
++  #define PIXFMT AV_PIX_FMT_RGB24
++#else
++  #define PIXELFORMAT PixelFormat
++  #define PIXFMT PIX_FMT_RGB24
++#endif
+ #define QTPIXFMT        QImage::Format_RGB888
+ 
+-AVFrame *ALLOCFRAME()           { return avcodec_alloc_frame(); }
++AVFrame *ALLOCFRAME()           { return 
++  #if (defined(FFMPEG)&&(FFMPEGVERSIONINT>=300))
++    av_frame_alloc();
++  #else
++    avcodec_alloc_frame();
++  #endif
++}
++
+ void    FREEFRAME(AVFrame **Buf){ avcodec_free_frame(Buf); *Buf=NULL; }
+ 
+ 
//****************************************************************************************************************************************************************
+@@ -2402,7 +2415,7 @@
+                             AVFrame *FrameRGB=ALLOCFRAME();
+                             if ((FrameRGB)&&(!Thumbnail.isNull())) {
+                                 avpicture_fill((AVPicture 
*)FrameRGB,Thumbnail.bits(),PIXFMT,RealW,RealH);
+-                                struct SwsContext 
*img_convert_ctx=sws_getContext(FrameYUV->width,FrameYUV->height,(PixelFormat)FrameYUV->format,RealW,RealH,PIXFMT,SWS_FAST_BILINEAR,NULL,NULL,NULL);
++                                struct SwsContext 
*img_convert_ctx=sws_getContext(FrameYUV->width,FrameYUV->height,(PIXELFORMAT)FrameYUV->format,RealW,RealH,PIXFMT,SWS_FAST_BILINEAR,NULL,NULL,NULL);
+                                 if (img_convert_ctx!=NULL) {
+                                     int ret = 
sws_scale(img_convert_ctx,FrameYUV->data,FrameYUV->linesize,0,FrameYUV->height,FrameRGB->data,FrameRGB->linesize);
+                                     if (ret>0) {
+@@ -3482,7 +3495,7 @@
+         struct SwsContext *img_convert_ctx=sws_getContext(
+             Frame->width,                                                     
// Src width
+             Frame->height,                                                    
// Src height
+-            (PixelFormat)Frame->format,                                       
// Src Format
++            (PIXELFORMAT)Frame->format,                                       
// Src Format
+             W,                                                                
// Destination width
+             H,                                                                
// Destination height
+             PIXFMT,                                                           
// Destination Format
+--- src/ffDiaporama/engine/cDeviceModelDef.h   2016-02-21 19:53:00.487286000 
+0100
++++ src/ffDiaporama/engine/cDeviceModelDef.h   2016-02-21 19:52:47.623287800 
+0100
+@@ -53,7 +53,9 @@
+ 
+ #include <libavutil/mathematics.h>
+ #include <libavutil/pixdesc.h>
+-#include <libavutil/audioconvert.h>
++#if (LIBAVUTIL_VERSION_INT<AV_VERSION_INT(54,31,100))
++    #include <libavutil/audioconvert.h>
++#endif
+ 
+ #include <libavcodec/avcodec.h>
+ 
+@@ -90,10 +92,10 @@
+       #define RESAMPLE_MAX_CHANNELS 32
+     #endif
+     
+-    #include "libavfilter/avcodec.h"
+-    #include "libavfilter/buffersink.h"
+-    #include "libavfilter/buffersrc.h"
+-    #if     
((LIBAVUTIL_VERSION_INT>=AV_VERSION_INT(52,48,100))&&(LIBAVCODEC_VERSION_INT>=AV_VERSION_INT(55,39,100))&&(LIBAVFORMAT_VERSION_INT>=AV_VERSION_INT(55,19,104))&&(LIBAVDEVICE_VERSION_INT>=AV_VERSION_INT(55,5,100))&&(LIBAVFILTER_VERSION_INT>=AV_VERSION_INT(3,90,100))&&(LIBSWSCALE_VERSION_INT>=AV_VERSION_INT(2,5,101))&&(LIBSWRESAMPLE_VERSION_INT>=AV_VERSION_INT(0,17,104)))
++    #if     
((LIBAVUTIL_VERSION_INT>=AV_VERSION_INT(55,17,103))&&(LIBAVCODEC_VERSION_INT>=AV_VERSION_INT(57,24,102))&&(LIBAVFORMAT_VERSION_INT>=AV_VERSION_INT(57,25,100))&&(LIBAVDEVICE_VERSION_INT>=AV_VERSION_INT(57,0,101))&&(LIBAVFILTER_VERSION_INT>=AV_VERSION_INT(6,31,100))&&(LIBSWSCALE_VERSION_INT>=AV_VERSION_INT(4,0,100))&&(LIBSWRESAMPLE_VERSION_INT>=AV_VERSION_INT(2,0,101)))
++        #define FFMPEGVERSIONINT    300
++        #define FFMPEGVERSION       "FFmpeg 3.0 or higher"
++    #elif     
((LIBAVUTIL_VERSION_INT>=AV_VERSION_INT(52,48,100))&&(LIBAVCODEC_VERSION_INT>=AV_VERSION_INT(55,39,100))&&(LIBAVFORMAT_VERSION_INT>=AV_VERSION_INT(55,19,104))&&(LIBAVDEVICE_VERSION_INT>=AV_VERSION_INT(55,5,100))&&(LIBAVFILTER_VERSION_INT>=AV_VERSION_INT(3,90,100))&&(LIBSWSCALE_VERSION_INT>=AV_VERSION_INT(2,5,101))&&(LIBSWRESAMPLE_VERSION_INT>=AV_VERSION_INT(0,17,104)))
+         #define FFMPEGVERSIONINT    210
+         #define FFMPEGVERSION       "FFmpeg 2.1 or higher"
+     #elif   
((LIBAVUTIL_VERSION_INT>=AV_VERSION_INT(52,38,100))&&(LIBAVCODEC_VERSION_INT>=AV_VERSION_INT(55,18,102))&&(LIBAVFORMAT_VERSION_INT>=AV_VERSION_INT(55,12,100))&&(LIBAVDEVICE_VERSION_INT>=AV_VERSION_INT(55,3,100))&&(LIBAVFILTER_VERSION_INT>=AV_VERSION_INT(3,79,101))&&(LIBSWSCALE_VERSION_INT>=AV_VERSION_INT(2,3,100))&&(LIBSWRESAMPLE_VERSION_INT>=AV_VERSION_INT(0,17,102)))
+@@ -108,6 +110,13 @@
+     #else
+         // unsupported version
+     #endif
++    #if (FFMPEGVERSIONINT<300)
++      #include "libavfilter/avcodec.h"
++    #else
++      #include "libavcodec/avcodec.h"
++    #endif
++    #include "libavfilter/buffersink.h"
++    #include "libavfilter/buffersrc.h"
+ #endif
+ }
+ 
+--- src/ffDiaporama/engine/_EncodeVideo.cpp    2016-02-22 08:19:13.935794200 
+0100
++++ src/ffDiaporama/engine/_EncodeVideo.cpp    2016-02-22 08:33:52.928215900 
+0100
+@@ -20,7 +20,11 @@
+ 
+ #include "_EncodeVideo.h"
+ 
+-#define PIXFMT      PIX_FMT_RGB24
++#if (defined(FFMPEG)&&(FFMPEGVERSIONINT>=300))
++  #define PIXFMT AV_PIX_FMT_RGB24
++#else
++  #define PIXFMT PIX_FMT_RGB24
++#endif
+ #define QTPIXFMT    QImage::Format_RGB888
+ 
+ 
//*************************************************************************************************************************************************
+@@ -410,8 +414,13 @@
+     // Setup codec parameters
+     VideoStream->codec->width               =ImageWidth;
+     VideoStream->codec->height              =ImageHeight;
++    #if (defined(FFMPEG)&&(FFMPEGVERSIONINT>=300))
++    VideoStream->codec->pix_fmt             =AV_PIX_FMT_YUV420P;
++    #else
+     VideoStream->codec->pix_fmt             =PIX_FMT_YUV420P;
++    #endif
+     VideoStream->codec->time_base           =VideoFrameRate;
++    VideoStream->time_base                  =VideoFrameRate;
+     VideoStream->codec->sample_aspect_ratio =PixelAspectRatio;
+     VideoStream->sample_aspect_ratio        =PixelAspectRatio;
+     if ((codec->id!=AV_CODEC_ID_H264)||(!VBR)) {
+@@ -434,7 +443,11 @@
+ 
+     } else if (codec->id==AV_CODEC_ID_MJPEG) {
+         //-qscale 2 -qmin 2 -qmax 2
++        #if (defined(FFMPEG)&&(FFMPEGVERSIONINT>=300))
++        VideoStream->codec->pix_fmt             =AV_PIX_FMT_YUVJ420P;
++        #else
+         VideoStream->codec->pix_fmt             =PIX_FMT_YUVJ420P;
++        #endif
+         VideoStream->codec->qmin                =2;
+         VideoStream->codec->qmax                =2;
+         VideoStream->codec->bit_rate_tolerance  
=(ImageWidth*ImageHeight*2*VideoFrameRate.den/VideoFrameRate.num)*2;
+@@ -564,7 +577,11 @@
+     #endif
+ 
+     // Create and prepare VideoFrame and VideoFrameBuf
+-    VideoFrame=avcodec_alloc_frame();  // Allocate structure for RGB image
++    #if (defined(FFMPEG)&&(FFMPEGVERSIONINT>=300))
++    VideoFrame=av_frame_alloc();
++    #else
++    VideoFrame=avcodec_alloc_frame();
++    #endif
+     if (!VideoFrame) {
+         ToLog(LOGMSG_CRITICAL,"EncodeVideo-OpenVideoStream: 
avcodec_alloc_frame() failed");
+         return false;
+@@ -654,7 +671,11 @@
+         return false;
+     }
+ 
++    #if (defined(FFMPEG)&&(FFMPEGVERSIONINT>=300))
++    AudioFrame=av_frame_alloc();
++    #else
+     AudioFrame=avcodec_alloc_frame();
++    #endif
+     if (AudioFrame==NULL) {
+         ToLog(LOGMSG_CRITICAL,QString("EncodeVideo-OpenAudioStream:: 
avcodec_alloc_frame failed"));
+         return false;
+@@ -1095,7 +1116,11 @@
+             if (Continue) {
+                 // Init AudioFrame
+                 AVRational AVR;
++                #if (defined(FFMPEG)&&(FFMPEGVERSIONINT>=300))
++                av_frame_unref(AudioFrame);
++                #else
+                 avcodec_get_frame_defaults(AudioFrame);
++                #endif
+                 AVR.num                     =1;
+                 AVR.den                     =AudioStream->codec->sample_rate;
+                 AudioFrame->nb_samples      =DestPacketSize/DestSampleSize;
+@@ -1180,7 +1205,11 @@
+     int     errcode;
+ 
+     if (Image) {
+-        avcodec_get_frame_defaults(VideoFrame);
++        #if (defined(FFMPEG)&&(FFMPEGVERSIONINT>=300))
++        av_frame_unref(AudioFrame);
++        #else
++        avcodec_get_frame_defaults(AudioFrame);
++        #endif
+         if (avpicture_fill(
+             (AVPicture *)VideoFrame,            // Frame to prepare
+             VideoFrameBuf,                      // Buffer which will contain 
the image data
+@@ -1225,9 +1254,14 @@
+         }
+     }
+ 
+-    if ((VideoFrameNbr%VideoStream->codec->gop_size)==0) 
VideoFrame->pict_type=AV_PICTURE_TYPE_I;
+-        else VideoFrame->pict_type=(AVPictureType)0;
++    if ((VideoFrameNbr%VideoStream->codec->gop_size)==0)
++        VideoFrame->pict_type=AV_PICTURE_TYPE_I;
++    else
++        VideoFrame->pict_type=(AVPictureType)0;
+     VideoFrame->pts=VideoFrameNbr;
++    VideoFrame->format=VideoStream->codec->pix_fmt;
++    VideoFrame->width=VideoStream->codec->width;
++    VideoFrame->height=VideoStream->codec->height;
+ 
+     if ((Continue)&&(!StopProcessWanted)) {
+ 

Reply via email to