Ticket #51213: patch-pHash-ffmpeg-3.0.diff

File patch-pHash-ffmpeg-3.0.diff, 3.5 KB (added by dbevans (David B. Evans), 8 years ago)

Proposed patch allowing build with either ffmpeg 2.8 or 3.0+

  • Portfile

     
    55
    66name                pHash
    77version             0.9.6
    8 revision            3
     8revision            4
    99categories          multimedia
    1010platforms           darwin
    1111maintainers         workisfun.ru:ivan
     
    2828                    port:mpg123 \
    2929                    port:CImg
    3030
     31patchfiles          patch-ffmpeg-3.0.diff
     32
     33use_autoreconf      yes
     34autoreconf.args     -fvi
     35
    3136post-destroot {
    3237    set docdir ${destroot}${prefix}/share/doc/${name}
    3338    xinstall -d ${docdir}
  • files/patch-ffmpeg-3.0.diff

     
     1--- configure.ac.orig   2016-04-22 17:12:32.000000000 -0700
     2+++ configure.ac        2016-04-22 17:13:39.000000000 -0700
     3@@ -122,7 +122,7 @@
     4 AC_DEFUN([AC_CHECK_FFMPEG],
     5 [
     6 AC_MSG_CHECKING([whether FFmpeg is present])
     7-AC_CHECK_LIB([avcodec], [avcodec_alloc_frame], [], [AC_MSG_ERROR([
     8+AC_CHECK_LIB([avcodec], [avcodec_find_decoder], [], [AC_MSG_ERROR([
     9 
     10 *** libavcodec not found.
     11 You need FFmpeg. Get it at <http://ffmpeg.org/>])])
     12--- src/cimgffmpeg.cpp.orig     2016-04-22 17:35:34.000000000 -0700
     13+++ src/cimgffmpeg.cpp  2016-04-22 17:40:34.000000000 -0700
     14@@ -39,11 +39,11 @@
     15 int ReadFrames(VFInfo *st_info, CImgList<uint8_t> *pFrameList, unsigned int low_index, unsigned int hi_index)
     16 {
     17         //target pixel format
     18-       PixelFormat ffmpeg_pixfmt;
     19+       AVPixelFormat ffmpeg_pixfmt;
     20        if (st_info->pixelformat == 0)
     21-           ffmpeg_pixfmt = PIX_FMT_GRAY8;
     22+           ffmpeg_pixfmt = AV_PIX_FMT_GRAY8;
     23        else
     24-           ffmpeg_pixfmt = PIX_FMT_RGB24;
     25+           ffmpeg_pixfmt = AV_PIX_FMT_RGB24;
     26 
     27        st_info->next_index = low_index;
     28 
     29@@ -100,12 +100,12 @@
     30         AVFrame *pFrame;
     31 
     32        // Allocate video frame
     33-       pFrame=avcodec_alloc_frame();
     34+       pFrame=av_frame_alloc();
     35        if (pFrame==NULL)
     36            return -1;
     37 
     38        // Allocate an AVFrame structure
     39-       AVFrame *pConvertedFrame = avcodec_alloc_frame();
     40+       AVFrame *pConvertedFrame = av_frame_alloc();
     41        if(pConvertedFrame==NULL)
     42          return -1;
     43               
     44@@ -123,7 +123,7 @@
     45        int size = 0;
     46       
     47 
     48-        int channels = ffmpeg_pixfmt == PIX_FMT_GRAY8 ? 1 : 3;
     49+        int channels = ffmpeg_pixfmt == AV_PIX_FMT_GRAY8 ? 1 : 3;
     50 
     51        AVPacket packet;
     52        int result = 1;
     53@@ -189,11 +189,11 @@
     54 
     55 int NextFrames(VFInfo *st_info, CImgList<uint8_t> *pFrameList)
     56 {
     57-        PixelFormat ffmpeg_pixfmt;
     58+        AVPixelFormat ffmpeg_pixfmt;
     59        if (st_info->pixelformat == 0)
     60-           ffmpeg_pixfmt = PIX_FMT_GRAY8;
     61+           ffmpeg_pixfmt = AV_PIX_FMT_GRAY8;
     62         else
     63-           ffmpeg_pixfmt = PIX_FMT_RGB24;
     64+           ffmpeg_pixfmt = AV_PIX_FMT_RGB24;
     65 
     66        if (st_info->pFormatCtx == NULL)
     67        {
     68@@ -254,10 +254,10 @@
     69        AVFrame *pFrame;
     70 
     71        // Allocate video frame
     72-       pFrame=avcodec_alloc_frame();
     73+       pFrame=av_frame_alloc();
     74               
     75        // Allocate an AVFrame structure
     76-       AVFrame *pConvertedFrame = avcodec_alloc_frame();
     77+       AVFrame *pConvertedFrame = av_frame_alloc();
     78        if(pConvertedFrame==NULL){
     79          return -1;
     80        }
     81@@ -287,7 +287,7 @@
     82                        break;
     83                if(packet.stream_index == st_info->videoStream) {
     84                       
     85-               int channels = ffmpeg_pixfmt == PIX_FMT_GRAY8 ? 1 : 3;
     86+               int channels = ffmpeg_pixfmt == AV_PIX_FMT_GRAY8 ? 1 : 3;
     87                AVPacket avpkt;
     88                 av_init_packet(&avpkt);
     89                 avpkt.data = packet.data;