]> git.pld-linux.org Git - packages/pHash.git/commitdiff
Add -ffmpeg.patch to fix build with ffmpeg 3.x auto/th/pHash-0.9.6-1
authorMarcin Banasiak <marcin.banasiak@gmail.com>
Sun, 12 Feb 2017 14:37:12 +0000 (15:37 +0100)
committerMarcin Banasiak <marcin.banasiak@gmail.com>
Sun, 12 Feb 2017 14:37:12 +0000 (15:37 +0100)
pHash-ffmpeg.patch [new file with mode: 0644]
pHash.spec

diff --git a/pHash-ffmpeg.patch b/pHash-ffmpeg.patch
new file mode 100644 (file)
index 0000000..c70017f
--- /dev/null
@@ -0,0 +1,145 @@
+--- pHash-0.9.6/configure.ac.ffmpeg    2017-02-12 14:14:03.665670491 +0100
++++ pHash-0.9.6/configure.ac   2017-02-12 14:14:31.025702743 +0100
+@@ -110,7 +110,7 @@ fi])
+ AC_DEFUN([AC_CHECK_FFMPEG],
+ [
+ AC_MSG_CHECKING([whether FFmpeg is present])
+-AC_CHECK_LIB([avcodec], [avcodec_alloc_frame], [], [AC_MSG_ERROR([
++AC_CHECK_LIB([avcodec], [avcodec_parameters_alloc], [], [AC_MSG_ERROR([
+ *** libavcodec not found.
+ You need FFmpeg. Get it at <http://ffmpeg.org/>])])
+--- pHash-0.9.6/src/cimgffmpeg.cpp.ffmpeg      2017-02-12 14:56:45.098900259 +0100
++++ pHash-0.9.6/src/cimgffmpeg.cpp     2017-02-12 15:29:15.201289349 +0100
+@@ -39,11 +39,11 @@ void vfinfo_close(VFInfo  *vfinfo){
+ int ReadFrames(VFInfo *st_info, CImgList<uint8_t> *pFrameList, unsigned int low_index, unsigned int hi_index)
+ {
+         //target pixel format
+-      PixelFormat ffmpeg_pixfmt;
++      AVPixelFormat ffmpeg_pixfmt;
+       if (st_info->pixelformat == 0)
+-          ffmpeg_pixfmt = PIX_FMT_GRAY8;
++          ffmpeg_pixfmt = AV_PIX_FMT_GRAY8;
+       else 
+-          ffmpeg_pixfmt = PIX_FMT_RGB24;
++          ffmpeg_pixfmt = AV_PIX_FMT_RGB24;
+       st_info->next_index = low_index;
+@@ -100,30 +100,30 @@ int ReadFrames(VFInfo *st_info, CImgList
+         AVFrame *pFrame;
+       // Allocate video frame
+-      pFrame=avcodec_alloc_frame();
++      pFrame=av_frame_alloc();
+       if (pFrame==NULL)
+           return -1;
+       // Allocate an AVFrame structure
+-      AVFrame *pConvertedFrame = avcodec_alloc_frame();
++      AVFrame *pConvertedFrame = av_frame_alloc();
+       if(pConvertedFrame==NULL)
+         return -1;
+               
+       uint8_t *buffer;
+       int numBytes;
+       // Determine required buffer size and allocate buffer
+-      numBytes=avpicture_get_size(ffmpeg_pixfmt, st_info->width,st_info->height);
++      numBytes=av_image_get_buffer_size(ffmpeg_pixfmt, st_info->width,st_info->height,1);
+       buffer=(uint8_t *)av_malloc(numBytes*sizeof(uint8_t));
+       if (buffer == NULL)
+           return -1;
+-      avpicture_fill((AVPicture *)pConvertedFrame,buffer,ffmpeg_pixfmt,st_info->width,st_info->height);
++      av_image_fill_arrays(pConvertedFrame->data,pConvertedFrame->linesize,buffer,ffmpeg_pixfmt,st_info->width,st_info->height,1);
+               
+       int frameFinished;
+       int size = 0;
+       
+-        int channels = ffmpeg_pixfmt == PIX_FMT_GRAY8 ? 1 : 3;
++        int channels = ffmpeg_pixfmt == AV_PIX_FMT_GRAY8 ? 1 : 3;
+       AVPacket packet;
+       int result = 1;
+@@ -160,7 +160,7 @@ int ReadFrames(VFInfo *st_info, CImgList
+                 }    
+                 st_info->current_index++;
+             }
+-            av_free_packet(&packet);
++            av_packet_unref(&packet);
+         }
+       }
+@@ -189,11 +189,11 @@ int ReadFrames(VFInfo *st_info, CImgList
+ int NextFrames(VFInfo *st_info, CImgList<uint8_t> *pFrameList)
+ {
+-        PixelFormat ffmpeg_pixfmt;
++        AVPixelFormat ffmpeg_pixfmt;
+       if (st_info->pixelformat == 0)
+-          ffmpeg_pixfmt = PIX_FMT_GRAY8;
++          ffmpeg_pixfmt = AV_PIX_FMT_GRAY8;
+         else 
+-          ffmpeg_pixfmt = PIX_FMT_RGB24;
++          ffmpeg_pixfmt = AV_PIX_FMT_RGB24;
+       if (st_info->pFormatCtx == NULL)
+       {
+@@ -254,10 +254,10 @@ int NextFrames(VFInfo *st_info, CImgList
+       AVFrame *pFrame;
+       // Allocate video frame
+-      pFrame=avcodec_alloc_frame();
++      pFrame=av_frame_alloc();
+               
+       // Allocate an AVFrame structure
+-      AVFrame *pConvertedFrame = avcodec_alloc_frame();
++      AVFrame *pConvertedFrame = av_frame_alloc();
+       if(pConvertedFrame==NULL){
+         return -1;
+       }
+@@ -265,13 +265,13 @@ int NextFrames(VFInfo *st_info, CImgList
+       uint8_t *buffer;
+       int numBytes;
+       // Determine required buffer size and allocate buffer
+-      numBytes=avpicture_get_size(ffmpeg_pixfmt, st_info->width,st_info->height);
++      numBytes=av_image_get_buffer_size(ffmpeg_pixfmt, st_info->width,st_info->height,1);
+       buffer=(uint8_t *)av_malloc(numBytes*sizeof(uint8_t));
+       if (buffer == NULL){
+           return -1;
+       }
+-      avpicture_fill((AVPicture *)pConvertedFrame,buffer,ffmpeg_pixfmt,st_info->width,st_info->height);
++      av_image_fill_arrays(pConvertedFrame->data,pConvertedFrame->linesize,buffer,ffmpeg_pixfmt,st_info->width,st_info->height,1);
+               
+       int frameFinished;
+       int size = 0;
+@@ -287,7 +287,7 @@ int NextFrames(VFInfo *st_info, CImgList
+                       break;
+               if(packet.stream_index == st_info->videoStream) {
+                       
+-              int channels = ffmpeg_pixfmt == PIX_FMT_GRAY8 ? 1 : 3;
++              int channels = ffmpeg_pixfmt == AV_PIX_FMT_GRAY8 ? 1 : 3;
+               AVPacket avpkt;
+                 av_init_packet(&avpkt);
+                 avpkt.data = packet.data;
+@@ -318,7 +318,7 @@ int NextFrames(VFInfo *st_info, CImgList
+                               st_info->current_index++;
+                   }
+         }
+-              av_free_packet(&packet);
++              av_packet_unref(&packet);
+       }
+       
+       av_free(buffer);
+--- pHash-0.9.6/src/cimgffmpeg.h.ffmpeg        2017-02-12 15:12:22.272120451 +0100
++++ pHash-0.9.6/src/cimgffmpeg.h       2017-02-12 15:13:11.995922157 +0100
+@@ -38,6 +38,7 @@ extern "C" {
+       #include "./libavformat/avformat.h"\r
+       #include "./libavcodec/avcodec.h"\r
+       #include "./libswscale/swscale.h"\r
++      #include <libavutil/imgutils.h>
+ }\r
\r
+ using namespace cimg_library;\r
index 7bcb4602a4e23f84b5e9a17c4896a4c8ffc70f27..3a049e7d53933c5f0a5866eac0deb9a68e545fb2 100644 (file)
@@ -12,6 +12,7 @@ Source0:      http://www.phash.org/releases/%{name}-%{version}.tar.gz
 # Source0-md5: 0572f3cfe2219a5537b78d3c5b78f84c
 Patch0:                %{name}-optflags.patch
 Patch1:                %{name}-link.patch
+Patch2:                %{name}-ffmpeg.patch
 URL:           http://www.phash.org/
 BuildRequires: CImg >= 1.6.7
 BuildRequires: autoconf >= 2.61
@@ -60,6 +61,7 @@ Statyczna biblioteka pHash.
 %setup -q
 %patch0 -p1
 %patch1 -p1
+%patch2 -p1
 
 %build
 %{__libtoolize}
This page took 0.089237 seconds and 4 git commands to generate.