--- libphash-0.9.4.orig/src/cimgffmpeg.cpp +++ libphash-0.9.4/src/cimgffmpeg.cpp @@ -29,7 +29,7 @@ if (vfinfo->pFormatCtx != NULL){ avcodec_close(vfinfo->pCodecCtx); vfinfo->pCodecCtx = NULL; - av_close_input_file(vfinfo->pFormatCtx); + avformat_close_input(&vfinfo->pFormatCtx); vfinfo->pFormatCtx = NULL; vfinfo->width = -1; vfinfo->height = -1; @@ -54,11 +54,11 @@ av_register_all(); // Open video file - if(av_open_input_file(&st_info->pFormatCtx, st_info->filename, NULL, 0, NULL)!=0) + if(avformat_open_input(&st_info->pFormatCtx, st_info->filename, NULL, NULL)!=0) return -1 ; // Couldn't open file // Retrieve stream information - if(av_find_stream_info(st_info->pFormatCtx)<0) + if(avformat_find_stream_info(st_info->pFormatCtx,NULL)<0) return -1; // Couldn't find stream information //dump_format(pFormatCtx,0,NULL,0);//debugging function to print infomation about format @@ -67,7 +67,7 @@ // Find the video stream for(i=0; ipFormatCtx->nb_streams; i++) { - if(st_info->pFormatCtx->streams[i]->codec->codec_type==CODEC_TYPE_VIDEO) + if(st_info->pFormatCtx->streams[i]->codec->codec_type==AVMEDIA_TYPE_VIDEO) { st_info->videoStream=i; break; @@ -90,7 +90,7 @@ return -1 ; // Codec not found } // Open codec - if(avcodec_open(st_info->pCodecCtx, st_info->pCodec)<0) + if(avcodec_open2(st_info->pCodecCtx, st_info->pCodec,NULL)<0) return -1; // Could not open codec st_info->height = (st_info->height<=0) ? st_info->pCodecCtx->height : st_info->height; @@ -122,6 +122,9 @@ int frameFinished; int size = 0; + + int channels = ffmpeg_pixfmt == PIX_FMT_GRAY8 ? 1 : 3; + AVPacket packet; int result = 1; CImg next_image; @@ -131,24 +134,29 @@ if (result < 0) break; if(packet.stream_index==st_info->videoStream) { - avcodec_decode_video(st_info->pCodecCtx, pFrame, &frameFinished,packet.data, packet.size); + + AVPacket avpkt; + av_init_packet(&avpkt); + avpkt.data = packet.data; + avpkt.size = packet.size; + // + // HACK for CorePNG to decode as normal PNG by default + // same method used by ffmpeg + avpkt.flags = AV_PKT_FLAG_KEY; + + avcodec_decode_video2(st_info->pCodecCtx, pFrame, &frameFinished,&avpkt); + + // avcodec_decode_video(st_info->pCodecCtx, pFrame, &frameFinished,packet.data, packet.size); + if(frameFinished) { if (st_info->current_index == st_info->next_index){ st_info->next_index += st_info->step; sws_scale(c, pFrame->data, pFrame->linesize, 0, st_info->pCodecCtx->height, pConvertedFrame->data, pConvertedFrame->linesize); - if (ffmpeg_pixfmt == PIX_FMT_GRAY8) { - next_image.assign(pConvertedFrame->data[0],1,st_info->width,st_info->height,1,true); - next_image.permute_axes("yzcx"); - pFrameList->push_back(next_image); - size++; - } - else if (ffmpeg_pixfmt == PIX_FMT_RGB24){ - next_image.assign(*pConvertedFrame->data,3,st_info->width,st_info->height,1,true); - next_image.permute_axes("yzcx"); - pFrameList->push_back(next_image); - size++; - } + next_image.assign(*pConvertedFrame->data, channels,st_info->width,st_info->height,1,true); + next_image.permute_axes("yzcx"); + pFrameList->push_back(next_image); + size++; } st_info->current_index++; } @@ -159,7 +167,7 @@ if (result < 0){ avcodec_close(st_info->pCodecCtx); - av_close_input_file(st_info->pFormatCtx); + avformat_close_input(&st_info->pFormatCtx); st_info->pFormatCtx = NULL; st_info->pCodecCtx = NULL; st_info->width = -1; @@ -199,12 +207,12 @@ av_log_set_level(AV_LOG_QUIET); // Open video file - if(av_open_input_file(&(st_info->pFormatCtx),st_info->filename,NULL,0,NULL)!=0){ + if(avformat_open_input(&st_info->pFormatCtx,st_info->filename,NULL,NULL)!=0){ return -1 ; // Couldn't open file } // Retrieve stream information - if(av_find_stream_info(st_info->pFormatCtx)<0){ + if(avformat_find_stream_info(st_info->pFormatCtx,NULL)<0){ return -1; // Couldn't find stream information } @@ -213,7 +221,7 @@ // Find the video stream for(i=0; i< st_info->pFormatCtx->nb_streams; i++) { - if(st_info->pFormatCtx->streams[i]->codec->codec_type==CODEC_TYPE_VIDEO) + if(st_info->pFormatCtx->streams[i]->codec->codec_type==AVMEDIA_TYPE_VIDEO) { st_info->videoStream=i; break; @@ -234,7 +242,7 @@ return -1 ; // Codec not found } // Open codec - if(avcodec_open(st_info->pCodecCtx, st_info->pCodec)<0){ + if(avcodec_open2(st_info->pCodecCtx, st_info->pCodec,NULL)<0){ return -1; // Could not open codec } @@ -279,8 +287,20 @@ break; if(packet.stream_index == st_info->videoStream) { - avcodec_decode_video(st_info->pCodecCtx, pFrame, &frameFinished, - packet.data,packet.size); + int channels = ffmpeg_pixfmt == PIX_FMT_GRAY8 ? 1 : 3; + AVPacket avpkt; + av_init_packet(&avpkt); + avpkt.data = packet.data; + avpkt.size = packet.size; + // + // HACK for CorePNG to decode as normal PNG by default + // same method used by ffmpeg + avpkt.flags = AV_PKT_FLAG_KEY; + + avcodec_decode_video2(st_info->pCodecCtx, pFrame, &frameFinished,&avpkt); + + // avcodec_decode_video(st_info->pCodecCtx, pFrame, &frameFinished, + // packet.data,packet.size); if(frameFinished) { if (st_info->current_index == st_info->next_index) @@ -289,18 +309,10 @@ sws_scale(c, pFrame->data, pFrame->linesize, 0, st_info->pCodecCtx->height, pConvertedFrame->data, pConvertedFrame->linesize); - if (ffmpeg_pixfmt == PIX_FMT_RGB24){ - next_image.assign(*pConvertedFrame->data,3,st_info->width,st_info->height,1,true); - next_image.permute_axes("yzcx"); - pFrameList->push_back(next_image); - size++; - } - else if (ffmpeg_pixfmt == PIX_FMT_GRAY8){ - next_image.assign(pConvertedFrame->data[0],1,st_info->width,st_info->height,1,true); + next_image.assign(*pConvertedFrame->data, channels, st_info->width,st_info->height,1,true); next_image.permute_axes("yzcx"); pFrameList->push_back(next_image); size++; - } } st_info->current_index++; @@ -320,7 +332,7 @@ if (result < 0) { avcodec_close(st_info->pCodecCtx); - av_close_input_file(st_info->pFormatCtx); + avformat_close_input(&st_info->pFormatCtx); st_info->pCodecCtx = NULL; st_info->pFormatCtx = NULL; st_info->pCodec = NULL; @@ -336,14 +348,14 @@ av_log_set_level(AV_LOG_QUIET); av_register_all(); // Open video file - if (av_open_input_file(&pFormatCtx, file, NULL, 0, NULL)) + if (avformat_open_input(&pFormatCtx, file, NULL, NULL)) return -1 ; // Couldn't open file // Retrieve stream information - if(av_find_stream_info(pFormatCtx)<0) + if(avformat_find_stream_info(pFormatCtx, NULL)<0) return -1; // Couldn't find stream information int result = pFormatCtx->nb_streams; - av_close_input_file(pFormatCtx); + avformat_close_input(&pFormatCtx); return result; } @@ -354,18 +366,18 @@ av_log_set_level(AV_LOG_QUIET); av_register_all(); // Open video file - if (av_open_input_file(&pFormatCtx, file, NULL, 0, NULL)) + if (avformat_open_input(&pFormatCtx, file, NULL, NULL)) return -1 ; // Couldn't open file // Retrieve stream information - if(av_find_stream_info(pFormatCtx)<0) + if(avformat_find_stream_info(pFormatCtx, NULL)<0) return -1; // Couldn't find stream information // Find the first video stream int videoStream=-1; for(unsigned int i=0; inb_streams; i++) { - if(pFormatCtx->streams[i]->codec->codec_type==CODEC_TYPE_VIDEO) + if(pFormatCtx->streams[i]->codec->codec_type==AVMEDIA_TYPE_VIDEO) { videoStream=i; break; @@ -378,14 +390,17 @@ nb_frames = str->nb_frames; if (nb_frames > 0) { //the easy way if value is already contained in struct - av_close_input_file(pFormatCtx); + avformat_close_input(&pFormatCtx); return nb_frames; } else { // frames must be counted AVPacket packet; nb_frames = (long)av_index_search_timestamp(str,str->duration, AVSEEK_FLAG_ANY|AVSEEK_FLAG_BACKWARD); // Close the video file - av_close_input_file(pFormatCtx); + int timebase = str->time_base.den / str->time_base.num; + if (nb_frames <= 0) + nb_frames = str->duration/timebase; + avformat_close_input(&pFormatCtx); return nb_frames; } } @@ -396,18 +411,18 @@ AVFormatContext *pFormatCtx; // Open video file - if (av_open_input_file(&pFormatCtx, filename, NULL, 0, NULL)) + if (avformat_open_input(&pFormatCtx, filename, NULL, NULL)) return -1 ; // Couldn't open file // Retrieve stream information - if(av_find_stream_info(pFormatCtx)<0) + if(avformat_find_stream_info(pFormatCtx,NULL)<0) return -1; // Couldn't find stream information // Find the first video stream int videoStream=-1; for(unsigned int i=0; inb_streams; i++) { - if(pFormatCtx->streams[i]->codec->codec_type==CODEC_TYPE_VIDEO) + if(pFormatCtx->streams[i]->codec->codec_type==AVMEDIA_TYPE_VIDEO) { videoStream=i; break; @@ -420,7 +435,7 @@ int den = (pFormatCtx->streams[videoStream]->r_frame_rate).den; result = num/den; - av_close_input_file(pFormatCtx); + avformat_close_input(&pFormatCtx); return result; --- libphash-0.9.4.orig/debian/copyright +++ libphash-0.9.4/debian/copyright @@ -0,0 +1,21 @@ +Format-Specification: + http://svn.debian.org/wsvn/dep/web/deps/dep5.mdwn?op=file&rev=112 +Name: pHash +Maintainer: Evan Klinger , + David Starkweather +Source: http://phash.org/releases/ + +Files: * +Copyright: 2009, Aetilius, Inc +License: GPL-3 + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; version 3 dated June, 2007. + On Debian GNU/Linux systems, the complete text of version 3 of the GNU + General Public License can be found in `/usr/share/common-licenses/GPL-3' + +Files: debian/* +Copyright: 2009, Tiago Bortoletto Vaz +License: GPL-2+ + On Debian systems, the complete text of the GNU General Public License + can be found in /usr/share/common-licenses/GPL-2 file. --- libphash-0.9.4.orig/debian/changelog +++ libphash-0.9.4/debian/changelog @@ -0,0 +1,79 @@ +libphash (0.9.4-1.3build1) trusty; urgency=low + + * No change rebuild against libav 9. + + -- Dmitrijs Ledkovs Sat, 09 Nov 2013 23:43:32 +0000 + +libphash (0.9.4-1.3) unstable; urgency=low + + * Non-maintainer upload. + * Apply libav 9 compatibility fixes from 0.9.6 to fix the build failure with + libav 9. (Closes: #720797) + + -- Sebastian Ramacher Mon, 02 Sep 2013 21:13:44 +0200 + +libphash (0.9.4-1.2) unstable; urgency=low + + * Non-maintainer upload. + * Fix compatibility with libav 0.7, patch by Andreas Moog + (Closes: #638243) + + -- Moritz Muehlenhoff Sat, 01 Oct 2011 12:55:28 +0200 + +libphash (0.9.4-1.1) unstable; urgency=low + + * Non-maintainer upload. + * Don't ship .la file (Closes: #620933). + * Strengthen versioned dep as debhelper overrides are used. + + -- Luk Claes Sun, 05 Jun 2011 18:34:03 +0200 + +libphash (0.9.4-1) unstable; urgency=low + + [ Christophe Monniez ] + * Merging upstream version 0.9.4. + * Fixing debian watch file. + * Bumping standards-version to 3.9.1. + * Adding build depends on libsnfile1-dev. + * Adding build depends on libsamplerate0-dev. + * Adding build depends on libmpg123-dev. + * Simplifying debian/rules. + * Removing obsolete patch. + * Adding dependency on cimg-dev for dev package. + (Closes: #590614, #607724). + * Fixing CXXFLAGS to build on armel. Thanks to Peter Green + (Closes: #613961). + + -- Michael Prokop Mon, 21 Feb 2011 22:49:50 +0100 + +libphash (0.9.0-2) unstable; urgency=low + + * Added patch 01_build_on_kfreebsd.dpatch: testing libc variant rather than + kernel in order to build for kfreebsd. Thanks to Petr Salinger and Cyril + Brulebois. (Closes: #576895) + + -- Tiago Bortoletto Vaz Sat, 15 May 2010 03:07:53 +0000 + +libphash (0.9.0-1) unstable; urgency=low + + * New upstream release. + + -- Tiago Bortoletto Vaz Sun, 28 Mar 2010 15:24:10 -0300 + +libphash (0.8.1-1) unstable; urgency=low + + * New upstream release. + + -- Tiago Bortoletto Vaz Mon, 01 Feb 2010 00:53:08 +0000 + +libphash (0.7.2-1) unstable; urgency=low + + * New upstream release. + + -- Tiago Bortoletto Vaz Fri, 25 Dec 2009 15:48:35 -0200 + +libphash (0.7-1) unstable; urgency=low + + * Initial Release. (Closes: #519290) + + -- Tiago Bortoletto Vaz Mon, 14 Dec 2009 00:05:34 -0200 --- libphash-0.9.4.orig/debian/control +++ libphash-0.9.4/debian/control @@ -0,0 +1,52 @@ +Source: libphash +Section: libs +Priority: optional +Maintainer: Ubuntu Developers +XSBC-Original-Maintainer: Debian Forensics +Uploaders: Tiago Bortoletto Vaz +Build-Depends: debhelper (>= 7.0.50~), libavformat-dev, libavcodec-dev, libswscale-dev, libfftw3-dev, libjpeg-dev, libpng-dev, cimg-dev, libsndfile1-dev, libsamplerate0-dev, libmpg123-dev +Standards-Version: 3.9.1 +Homepage: http://phash.org +Vcs-Browser: http://git.debian.org/?p=forensics/libphash.git +Vcs-Git: git://git.debian.org/forensics/libphash.git + +Package: libphash0 +Architecture: any +Depends: ${misc:Depends}, ${shlibs:Depends} +Description: Perceptual hashing library + Unlike cryptographic hash functions which rely on an avalanche effect of + changes in input leading to drastic changes in the output, perceptual + hashes are "close" to one another if the inputs are visually or + auditorily similar. + . + Perceptual hashes have applications in searching, identifying potential + copyright infringement, locating duplicates etc. - since a fingerprint + of a file is usually less than 1% of the original media file's size, + the fingerprint can be stored in a database and used for semantic + searching, such as finding all images that look like another. + . + pHash implements several perceptual hashing algorithms and provides a + C++ API to use those functions in your own programs. + +Package: libphash0-dev +Architecture: any +Section: libdevel +Depends: ${misc:Depends}, ${shlibs:Depends}, cimg-dev, libphash0 (= ${binary:Version}) +Provides: libphash-dev +Description: Perceptual hashing library development package + Unlike cryptographic hash functions which rely on an avalanche effect of + changes in input leading to drastic changes in the output, perceptual + hashes are "close" to one another if the inputs are visually or + auditorily similar. + . + Perceptual hashes have applications in searching, identifying potential + copyright infringement, locating duplicates etc. - since a fingerprint + of a file is usually less than 1% of the original media file's size, + the fingerprint can be stored in a database and used for semantic + searching, such as finding all images that look like another. + . + pHash implements several perceptual hashing algorithms and provides a + C++ API to use those functions in your own programs. + . + This package provides the files necessary to compile programs which + use pHash library. --- libphash-0.9.4.orig/debian/rules +++ libphash-0.9.4/debian/rules @@ -0,0 +1,7 @@ +#!/usr/bin/make -f + +%: + dh ${@} + +override_dh_auto_configure: + dh_auto_configure -- CXXFLAGS="$(CXXFLAGS) -D__STDC_CONSTANT_MACROS" --- libphash-0.9.4.orig/debian/watch +++ libphash-0.9.4/debian/watch @@ -0,0 +1,2 @@ +version=3 +http://phash.org/download/ /releases/pHash-(.+)\.tar\.gz --- libphash-0.9.4.orig/debian/libphash0.install +++ libphash-0.9.4/debian/libphash0.install @@ -0,0 +1 @@ +debian/tmp/usr/lib/*.so.* usr/lib --- libphash-0.9.4.orig/debian/libphash0-dev.install +++ libphash-0.9.4/debian/libphash0-dev.install @@ -0,0 +1,4 @@ +debian/tmp/usr/lib/*.so usr/lib +debian/tmp/usr/lib/*.a usr/lib +debian/tmp/usr/include/* usr/include +debian/tmp/usr/lib/pkgconfig/* usr/lib/pkgconfig --- libphash-0.9.4.orig/debian/README.source +++ libphash-0.9.4/debian/README.source @@ -0,0 +1,5 @@ +This source package uses dpatch for the modifications of the upstream source. +If you want to change something it is best to use the dpatch approach as +documented in /usr/share/doc/dpatch/README.source.gz + + -- Tiago Bortoletto Vaz Sat, 15 May 2010 03:31:16 +0000 --- libphash-0.9.4.orig/debian/compat +++ libphash-0.9.4/debian/compat @@ -0,0 +1 @@ +7 --- libphash-0.9.4.orig/debian/libphash0-dev.examples +++ libphash-0.9.4/debian/libphash0-dev.examples @@ -0,0 +1 @@ +examples/*.cpp --- libphash-0.9.4.orig/debian/source/format +++ libphash-0.9.4/debian/source/format @@ -0,0 +1 @@ +1.0