[packages/pHash] Add -ffmpeg.patch to fix build with ffmpeg 3.x
megabajt
megabajt at pld-linux.org
Sun Feb 12 15:38:09 CET 2017
commit 1500dd123e5991058dd02132c8b91b6f8ea79274
Author: Marcin Banasiak <marcin.banasiak at gmail.com>
Date: Sun Feb 12 15:37:12 2017 +0100
Add -ffmpeg.patch to fix build with ffmpeg 3.x
pHash-ffmpeg.patch | 145 +++++++++++++++++++++++++++++++++++++++++++++++++++++
pHash.spec | 2 +
2 files changed, 147 insertions(+)
---
diff --git a/pHash.spec b/pHash.spec
index 7bcb460..3a049e7 100644
--- a/pHash.spec
+++ b/pHash.spec
@@ -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}
diff --git a/pHash-ffmpeg.patch b/pHash-ffmpeg.patch
new file mode 100644
index 0000000..c70017f
--- /dev/null
+++ b/pHash-ffmpeg.patch
@@ -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"
+ #include "./libavcodec/avcodec.h"
+ #include "./libswscale/swscale.h"
++ #include <libavutil/imgutils.h>
+ }
+
+ using namespace cimg_library;
================================================================
---- gitweb:
http://git.pld-linux.org/gitweb.cgi/packages/pHash.git/commitdiff/1500dd123e5991058dd02132c8b91b6f8ea79274
More information about the pld-cvs-commit
mailing list