summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLuca Barbato <lu_zero@gentoo.org>2014-09-17 11:41:14 +0000
committerLuca Barbato <lu_zero@gentoo.org>2014-09-17 11:41:14 +0000
commitbbc00d0f3b4473a414ca5a494eb47654301844a2 (patch)
tree2d38a062d8bf4313714aa90c9258792016115c5a /media-libs/opencv
parentBump (diff)
downloadhistorical-bbc00d0f3b4473a414ca5a494eb47654301844a2.tar.gz
historical-bbc00d0f3b4473a414ca5a494eb47654301844a2.tar.bz2
historical-bbc00d0f3b4473a414ca5a494eb47654301844a2.zip
Fix #509302, thanks to Nikoli
Package-Manager: portage-2.2.13/cvs/Linux x86_64
Diffstat (limited to 'media-libs/opencv')
-rw-r--r--media-libs/opencv/ChangeLog6
-rw-r--r--media-libs/opencv/Manifest19
-rw-r--r--media-libs/opencv/files/opencv-2.4.9-libav10.patch748
-rw-r--r--media-libs/opencv/opencv-2.4.9.ebuild3
4 files changed, 758 insertions, 18 deletions
diff --git a/media-libs/opencv/ChangeLog b/media-libs/opencv/ChangeLog
index 0b44926cc53e..6b67cffafba8 100644
--- a/media-libs/opencv/ChangeLog
+++ b/media-libs/opencv/ChangeLog
@@ -1,6 +1,10 @@
# ChangeLog for media-libs/opencv
# Copyright 1999-2014 Gentoo Foundation; Distributed under the GPL v2
-# $Header: /var/cvsroot/gentoo-x86/media-libs/opencv/ChangeLog,v 1.110 2014/08/26 22:10:36 amynka Exp $
+# $Header: /var/cvsroot/gentoo-x86/media-libs/opencv/ChangeLog,v 1.111 2014/09/17 11:41:11 lu_zero Exp $
+
+ 17 Sep 2014; Luca Barbato <lu_zero@gentoo.org>
+ +files/opencv-2.4.9-libav10.patch, opencv-2.4.9.ebuild:
+ Fix #509302, thanks to Nikoli
26 Aug 2014; Amy Winston <amynka@gentoo.org> +files/opencv-2.4.9-cuda.patch,
opencv-2.4.9.ebuild:
diff --git a/media-libs/opencv/Manifest b/media-libs/opencv/Manifest
index 5caec66eca39..3317c2815a51 100644
--- a/media-libs/opencv/Manifest
+++ b/media-libs/opencv/Manifest
@@ -1,28 +1,15 @@
------BEGIN PGP SIGNED MESSAGE-----
-Hash: SHA256
-
AUX opencv-2.3.1a-libav-0.7.patch 415 SHA256 3186998b7b9eaae061d538633276c7de47b2388b639106e190d80dcf09fb9099 SHA512 b17466470a47876e1a8434367f47ce13ec989bdc35ec707d87188187e08b8ccca6af4c5563f20b3170758582b500323030cff22961a7fbbc6b4843d8bb808f1e WHIRLPOOL 5caf84c49efef118e1c90f6bd88237c6d91e9b37163248e5a6f6c135ae60f5f4f4328d83f061df2c4d5f81fdf68faa5b55828feaf67707956701c633614cc5fc
AUX opencv-2.4.2-cflags.patch 742 SHA256 7ea8c07becb830fb03c14bfbf6c25fdfeaf3fcb75949b810520f4fd6c1178c1c SHA512 b92c07d8c9c40ad7721e0cca2d79b001f825478a336ad40cb43d02218fcd9e8b94b871575028ca8eaf6616cfce8138c796f32d4cf55d83d5cbe819ec50cf7c82 WHIRLPOOL f83ee4b677490cf6981b5a326ae6a7ad4cfae1c27fc6c516d054337939957d801ff1319798d2b0b9e86429b8d688f514e74b74bfff56c64df06fc3c7035f320e
AUX opencv-2.4.3-gcc47.patch 835 SHA256 bb64b8af632b67293d1c8024b3786162fccc9f4ee4159f6592af0e76e86b7b00 SHA512 cc5e3e4c0def0745867403e990abf4b88d7d3edc72867a283403a991fd96f59c4cca6524ca184a52a40c913cd5d9cdfb52e98be71d5060fc4c7aa6b613a2a220 WHIRLPOOL 52aa228d8ebf2ba51eb67cc31ba4eee27f43d5fc86d3b5028e32e2a8caf1350ebda70bab2a060f9a387312795788b575253d446380645e52e7cf10f57cad9a88
AUX opencv-2.4.5-javamagic.patch 1140 SHA256 1a3fd6918982909dc1de4258cc386139f7005617032cb457d5ea521f0b4d2ad5 SHA512 f283529bc6482203b2ffdf57aafcdf80351eaf8d09c07c6f14991e5d6bc25679dab31f3dd0475b1eee32f9ba8636e9ba96755b90c96de7059c8f69c0d43746aa WHIRLPOOL a483809bfe0ca11a299757bd1ec42ada5fc1d415eb366f9e2d05a6e8a30dec6b8d8baf662da0041632e23b3ed0d4f90e612fb15ede0e126c09e9a98da7a9621c
AUX opencv-2.4.8-javamagic.patch 1165 SHA256 b13037b93683ee8e6f535cbbd8742005e675e13a11ebd6593815625c3328bfec SHA512 fd8a0d33997889c9316c0a4474c836b2528b676cd26bbb0e6ee2262377e45c5a0c465534831bd7fec3c0aa9cb198bc792a53f958b05a5217009314b678076d64 WHIRLPOOL 405901f0de77d1f16dc9d28deec6a56062bbfd514994ec094f468ea2298a15111067031cef33ce92b4c237539ed2ee294ec54e2ea6b5c739466e879c291af964
AUX opencv-2.4.9-cuda.patch 7247 SHA256 94f01e58038306a6f699d867936038c9815f965f31075c268e80ad30aab33cc2 SHA512 b8d7a18e00359a985f389eecf779b2d648ea88f2508c31f1895eb0d9ef9ce2924866054a2df0bb452ba161c3ba254e4cb9717c1275392a2e8691b9b34c245e9b WHIRLPOOL 6bc5b4afb724a6450228eae6e6920ee57d36f2d1bb50c09a6bd7230f870224d75367d3a9dbd0f02d1bacb1fa48d6e2d331d363716cc547fb85b67b48985dc5fb
+AUX opencv-2.4.9-libav10.patch 22417 SHA256 7c95f31c8242b239c2cb3259e2bdecad4a56d1dfd8d6087e71265ab6123aeb8c SHA512 e6ce98f788df2cfa32861d62c21296e4a3cea7a8b6747bc945cf80267a23aa207f94b30c000bddf6ccea69fc22edef635ee33cd3dd683a4b790bcca49e068a93 WHIRLPOOL 887a684bdc0994b8a5bf6a83aca4e94eca45c5a65ab5bfda873156b4cb8c9ab3b3bc6a5a75a8a2016f4416e47ab4f6f9a3b6776ac10af3ca57d9a4e2c3b08c9c
DIST opencv-2.4.5.tar.gz 81884985 SHA256 d30beecf4b57977fbd1635af54c5ab3fc00113e9e59a9d58081732260fe06292 SHA512 2e0ab19203cc5d3a4d83633ee9762441d0d12128752edecb351b3c4abddc1714baf4b320b161f8b58e771933506bfa5a192d394a3b6b5b63d914923c6a767a08 WHIRLPOOL 117551edab5837a9382a6d84dec7f84fb693485e3cad7c08d38158baa22951381eb4958caaaa910dcef6ee2b78a0a494d732d0cac88cd18f1f6ebc2d30e3ddf0
DIST opencv-2.4.8.zip 91302285 SHA256 f1ea29de0707939f6e09ae7a78dd271c032cac69a9ba6c6f7eb29fd4f83b9a68 SHA512 a451f4cc2fc7f31a5dba2997c57f3964d8239949dedb62e83b3fb2c68c2533786750906823137fa126a20d28d841aafc3a49b82c6358a6e6bc7d223e66598237 WHIRLPOOL 5881682746b30601421874bf6acb13bd0354b607f2e4da8abaa6077a59c8015c60bfbe888da077eaa7413c5fd8816b50616cee2eeb7dfcd884afff4df8c22561
DIST opencv-2.4.9.zip 91684751 SHA256 803010848154988e9cbda8b3fa857fcbb27382c2946ed729e1a7e40600bb4c71 SHA512 8eb6ee11d8260428ae461e06348ce037979efc29b7e33d59c3d348a6b4bae95b7004df4527aba7c634e7356f7b5635c98493dc15a0b43479e8f10f7258540c62 WHIRLPOOL 5bb5e39678b3072b2e8b923216529c84982559dd69d5ec51b8703e65af3401f3a8ff31e4e3bfc076480d0605e333df0b03a61713a927ec058bfaf25b4fa8fd5e
EBUILD opencv-2.4.5.ebuild 5174 SHA256 9947ef216eb778c4db530afa7c0c73ecfaf007d4195f652c552038e4d1afac92 SHA512 95b2cc6cf749046e66c783d3a13e0b098e4044c9741a9cd336c189bfcc454f2d1a554c33df3c0e71111e16601cb1cafe5db3f37839abc118a68d2755d296c916 WHIRLPOOL e9e9e2aec05fcaabacd7e973094591eac839e8cfd42a18bfd2567c047f33006a18191dd313e2e3244ee8e2cf6aa087701cd640d9caaf43c81e74a71f2a08e52e
EBUILD opencv-2.4.8.ebuild 5818 SHA256 190da86183dc78feb6ad3f3f779e18b5dfd13fc1b44970e62f0af399108a2cba SHA512 6452194524bd7598654ada564c99c5e7afe6c95abd4b65efc2468a89e4d95cb84fba7f7b6ff118f97bb7c0f3be5e671cd45d231370502dad4157b40d0030adc5 WHIRLPOOL 7e5c8d5306e3a343589c17ab589514a3ad31eef4da2e15af830562e74a4ef500ab1a26d2013fb36d14772526ee11c6258d8c1ef4f3900fafa66d1f0e24bbce15
-EBUILD opencv-2.4.9.ebuild 5973 SHA256 84bc61ba70efc601e0d85929a57ac4b084ec764edceb91ef0c538cdbe83c8648 SHA512 f1db87672f3a50d6b5204d5f2c2452e8b2341d616e313fae702be5e03b7e22221814f8daeb8bbf0db20ea6d9e617872091edbf38fb36f66b11ba7d78020f2c58 WHIRLPOOL 9c9c010c723c160cc9a36c13770546ba57b17bb7476a516e30d97d91251032a1d030299af489185a20588d90974a32a2b994e86f40909e823e20f5bcbeb82c27
-MISC ChangeLog 18658 SHA256 1ee7b5b08186280aa9605019e54114df06c48e6bb349421ac64654f6c0ffcfe8 SHA512 ec234ed4ec9a817e049f8ef580e24f3e00e5fbac980018cd6512b29becae93f3169c033b67845c840bffc5f9bde8ed4bbddd31b68141c9b386d29222a4cd57bb WHIRLPOOL 8f6d0f41e7dc6c3350d46eb4d1058234ca3a42c0c868ca2968d3ba891538b5f2f3b388ebc025f9e4d1b9ba424231f2be498bc9c0a41d31793c520283160d706a
+EBUILD opencv-2.4.9.ebuild 6015 SHA256 b3cb855378173efeb2a86ec351b6eb574c9f17dccd2752c98d824354923d762f SHA512 25c841a98ec57406ea190ada7416aabdf42701240d55760e2dc491e4c5ce954ae55b417c65123c0dfd1b8e077c08e08d38eb8e9f9f46196e132be9423f5fca31 WHIRLPOOL da5b1d1c2fb01accbccdce0fe750a0e5827968dd39517162e7d906bb63fca2c58c7a19b6e2924613ddf87e334a4b6dbd80f20393f367a19de7e06555bbcfe9cc
+MISC ChangeLog 18799 SHA256 c76c58ce766c9160173f56019f18aff1288a093eda1fd2d1fb452f02a0a07426 SHA512 c4c942900ea7b29597489e261d2c0731ed455b70f7cf4610765aaa9cab8b5a1feff6eb5b0336048899b621c3e4b4391f0bff1d21427a436c419e66db92035dbd WHIRLPOOL 5cebc72372138bea17bd2075104a1c19c8466d336036c45a0be5b615bcdc27d8a6201fb6a755a1b4c70515bb395a0321428cb40eb0618d9c4a14ff0801f7934c
MISC metadata.xml 1230 SHA256 8ac77d1094c6a1d2f83c13693a34e3c7745e4b55d99d44d7471ed0d847bae369 SHA512 4a3191076a5e9c211ffbff7ea6870214c1533193d7a26d0937f78b00d80f4874561dbe76d05c63dbde820db2e49603d048fcb6a34cb704bb0f5e7cb33f645be0 WHIRLPOOL 87825beff89509383be4fc077471c3c91e0b3956ea19b2f7373310404f0e27c1d394309d996ce3763f63f611a61b9d8e7e6c3b82c50a0cf4c56b399accc396a7
------BEGIN PGP SIGNATURE-----
-Version: GnuPG v2
-
-iQEcBAEBCAAGBQJT/QYPAAoJEDuJ1FA05peBhIUIAJOcHsrii9vllnbmUsQCytDD
-sagXQ01ysKqQeY+XQ6vA8K1pqBpOabyqk27DfiN7mB2haZ3jitR9tWdrgd64Du8q
-1VAFR7ta3+t8HveO04098ny8ed2fbpt4qa8KUynOBeqtdqQRtKlvozqIQrMsRnsF
-57gL8Kz6HX/3bkT87gyUkuunpJ9eTGHK82X544N8I9nH6Kkc7N1ZmyBahyrT+s+M
-NaNl6wBIC33Ctwdgp+QgsGW1N5Wn2CgyvhMV2LydAMumfO7leUQHphrNBs+E2eFJ
-M5G/kMQnppMD3vvs89RrFKtLTmlapw9oSum5MzLgjvDSTKMBGhPgGskQ/YZccNg=
-=H7d3
------END PGP SIGNATURE-----
diff --git a/media-libs/opencv/files/opencv-2.4.9-libav10.patch b/media-libs/opencv/files/opencv-2.4.9-libav10.patch
new file mode 100644
index 000000000000..df517285e000
--- /dev/null
+++ b/media-libs/opencv/files/opencv-2.4.9-libav10.patch
@@ -0,0 +1,748 @@
+From: anton@khirnov.net
+Description: Support building with the upcoming Libav 10 release
+Origin: upstream, https://github.com/Itseez/opencv/pull/2293
+
+--- a/modules/highgui/src/cap_ffmpeg_impl.hpp
++++ b/modules/highgui/src/cap_ffmpeg_impl.hpp
+@@ -57,10 +57,28 @@
+ extern "C" {
+ #endif
+
+-#include "ffmpeg_codecs.hpp"
++#if !defined(WIN32) || defined(__MINGW32__)
+
++#include <stdint.h>
++
++// some versions of FFMPEG assume a C99 compiler, and don't define INT64_C
++#ifndef INT64_C
++#define INT64_C(c) (c##LL)
++#endif
++
++#ifndef UINT64_C
++#define UINT64_C(c) (c##ULL)
++#endif
++
++#include <errno.h>
++
++#endif
++
++#include <libavformat/avformat.h>
+ #include <libavutil/mathematics.h>
+
++#include <libavutil/opt.h>
++
+ #ifdef WIN32
+ #define HAVE_FFMPEG_SWSCALE 1
+ #include <libavcodec/avcodec.h>
+@@ -144,10 +162,6 @@ extern "C" {
+ #define AV_NOPTS_VALUE_ ((int64_t)AV_NOPTS_VALUE)
+ #endif
+
+-#ifndef AVERROR_EOF
+-#define AVERROR_EOF (-MKTAG( 'E','O','F',' '))
+-#endif
+-
+ #if LIBAVCODEC_BUILD >= CALC_FFMPEG_VERSION(54,25,0)
+ # define CV_CODEC_ID AVCodecID
+ # define CV_CODEC(name) AV_##name
+@@ -158,9 +172,7 @@ extern "C" {
+
+ static int get_number_of_cpus(void)
+ {
+-#if LIBAVFORMAT_BUILD < CALC_FFMPEG_VERSION(52, 111, 0)
+- return 1;
+-#elif defined WIN32 || defined _WIN32
++#if defined WIN32 || defined _WIN32
+ SYSTEM_INFO sysinfo;
+ GetSystemInfo( &sysinfo );
+
+@@ -296,25 +308,13 @@ void CvCapture_FFMPEG::close()
+
+ if( video_st )
+ {
+-#if LIBAVFORMAT_BUILD > 4628
+ avcodec_close( video_st->codec );
+-
+-#else
+- avcodec_close( &(video_st->codec) );
+-
+-#endif
+ video_st = NULL;
+ }
+
+ if( ic )
+ {
+-#if LIBAVFORMAT_BUILD < CALC_FFMPEG_VERSION(53, 24, 2)
+- av_close_input_file(ic);
+-#else
+ avformat_close_input(&ic);
+-#endif
+-
+- ic = NULL;
+ }
+
+ if( rgb_picture.data[0] )
+@@ -501,9 +501,7 @@ public:
+ _mutex.lock();
+ if (!_initialized)
+ {
+- #if LIBAVFORMAT_BUILD >= CALC_FFMPEG_VERSION(53, 13, 0)
+ avformat_network_init();
+- #endif
+
+ /* register all codecs, demux and protocols */
+ av_register_all();
+@@ -534,11 +532,7 @@ bool CvCapture_FFMPEG::open( const char*
+
+ close();
+
+-#if LIBAVFORMAT_BUILD >= CALC_FFMPEG_VERSION(52, 111, 0)
+ int err = avformat_open_input(&ic, _filename, NULL, NULL);
+-#else
+- int err = av_open_input_file(&ic, _filename, NULL, 0, NULL);
+-#endif
+
+ if (err < 0)
+ {
+@@ -546,11 +540,7 @@ bool CvCapture_FFMPEG::open( const char*
+ goto exit_func;
+ }
+ err =
+-#if LIBAVFORMAT_BUILD >= CALC_FFMPEG_VERSION(53, 6, 0)
+ avformat_find_stream_info(ic, NULL);
+-#else
+- av_find_stream_info(ic);
+-#endif
+ if (err < 0)
+ {
+ CV_WARN("Could not find codec parameters");
+@@ -558,11 +548,7 @@ bool CvCapture_FFMPEG::open( const char*
+ }
+ for(i = 0; i < ic->nb_streams; i++)
+ {
+-#if LIBAVFORMAT_BUILD > 4628
+ AVCodecContext *enc = ic->streams[i]->codec;
+-#else
+- AVCodecContext *enc = &ic->streams[i]->codec;
+-#endif
+
+ //#ifdef FF_API_THREAD_INIT
+ // avcodec_thread_init(enc, get_number_of_cpus());
+@@ -570,10 +556,6 @@ bool CvCapture_FFMPEG::open( const char*
+ enc->thread_count = get_number_of_cpus();
+ //#endif
+
+-#if LIBAVFORMAT_BUILD < CALC_FFMPEG_VERSION(53, 2, 0)
+-#define AVMEDIA_TYPE_VIDEO CODEC_TYPE_VIDEO
+-#endif
+-
+ if( AVMEDIA_TYPE_VIDEO == enc->codec_type && video_stream < 0)
+ {
+ // backup encoder' width/height
+@@ -581,13 +563,7 @@ bool CvCapture_FFMPEG::open( const char*
+ int enc_height = enc->height;
+
+ AVCodec *codec = avcodec_find_decoder(enc->codec_id);
+- if (!codec ||
+-#if LIBAVCODEC_VERSION_INT >= ((53<<16)+(8<<8)+0)
+- avcodec_open2(enc, codec, NULL)
+-#else
+- avcodec_open(enc, codec)
+-#endif
+- < 0)
++ if (!codec || avcodec_open2(enc, codec, NULL) < 0)
+ goto exit_func;
+
+ // checking width/height (since decoder can sometimes alter it, eg. vp6f)
+@@ -660,17 +636,7 @@ bool CvCapture_FFMPEG::grabFrame()
+ }
+
+ // Decode video frame
+- #if LIBAVFORMAT_BUILD >= CALC_FFMPEG_VERSION(53, 2, 0)
+ avcodec_decode_video2(video_st->codec, picture, &got_picture, &packet);
+- #elif LIBAVFORMAT_BUILD > 4628
+- avcodec_decode_video(video_st->codec,
+- picture, &got_picture,
+- packet.data, packet.size);
+- #else
+- avcodec_decode_video(&video_st->codec,
+- picture, &got_picture,
+- packet.data, packet.size);
+- #endif
+
+ // Did we get a video frame?
+ if(got_picture)
+@@ -769,18 +735,9 @@ double CvCapture_FFMPEG::getProperty( in
+ case CV_FFMPEG_CAP_PROP_FRAME_HEIGHT:
+ return (double)frame.height;
+ case CV_FFMPEG_CAP_PROP_FPS:
+-#if LIBAVCODEC_BUILD > 4753
+- return av_q2d(video_st->r_frame_rate);
+-#else
+- return (double)video_st->codec.frame_rate
+- / (double)video_st->codec.frame_rate_base;
+-#endif
++ return av_q2d(video_st->avg_frame_rate);
+ case CV_FFMPEG_CAP_PROP_FOURCC:
+-#if LIBAVFORMAT_BUILD > 4628
+ return (double)video_st->codec->codec_tag;
+-#else
+- return (double)video_st->codec.codec_tag;
+-#endif
+ default:
+ break;
+ }
+@@ -817,14 +774,7 @@ int CvCapture_FFMPEG::get_bitrate()
+
+ double CvCapture_FFMPEG::get_fps()
+ {
+- double fps = r2d(ic->streams[video_stream]->r_frame_rate);
+-
+-#if LIBAVFORMAT_BUILD >= CALC_FFMPEG_VERSION(52, 111, 0)
+- if (fps < eps_zero)
+- {
+- fps = r2d(ic->streams[video_stream]->avg_frame_rate);
+- }
+-#endif
++ double fps = r2d(ic->streams[video_stream]->avg_frame_rate);
+
+ if (fps < eps_zero)
+ {
+@@ -984,7 +934,6 @@ struct CvVideoWriter_FFMPEG
+
+ static const char * icvFFMPEGErrStr(int err)
+ {
+-#if LIBAVFORMAT_BUILD >= CALC_FFMPEG_VERSION(53, 2, 0)
+ switch(err) {
+ case AVERROR_BSF_NOT_FOUND:
+ return "Bitstream filter not found";
+@@ -1015,22 +964,6 @@ static const char * icvFFMPEGErrStr(int
+ default:
+ break;
+ }
+-#else
+- switch(err) {
+- case AVERROR_NUMEXPECTED:
+- return "Incorrect filename syntax";
+- case AVERROR_INVALIDDATA:
+- return "Invalid data in header";
+- case AVERROR_NOFMT:
+- return "Unknown format";
+- case AVERROR_IO:
+- return "I/O error occurred";
+- case AVERROR_NOMEM:
+- return "Memory allocation error";
+- default:
+- break;
+- }
+-#endif
+
+ return "Unspecified error";
+ }
+@@ -1098,28 +1031,16 @@ static AVStream *icv_add_video_stream_FF
+ int frame_rate, frame_rate_base;
+ AVCodec *codec;
+
+-#if LIBAVFORMAT_BUILD >= CALC_FFMPEG_VERSION(53, 10, 0)
+ st = avformat_new_stream(oc, 0);
+-#else
+- st = av_new_stream(oc, 0);
+-#endif
+
+ if (!st) {
+ CV_WARN("Could not allocate stream");
+ return NULL;
+ }
+
+-#if LIBAVFORMAT_BUILD > 4628
+ c = st->codec;
+-#else
+- c = &(st->codec);
+-#endif
+
+-#if LIBAVFORMAT_BUILD > 4621
+ c->codec_id = av_guess_codec(oc->oformat, NULL, oc->filename, NULL, AVMEDIA_TYPE_VIDEO);
+-#else
+- c->codec_id = oc->oformat->video_codec;
+-#endif
+
+ if(codec_id != CV_CODEC(CODEC_ID_NONE)){
+ c->codec_id = codec_id;
+@@ -1154,7 +1075,6 @@ static AVStream *icv_add_video_stream_FF
+ frame_rate_base*=10;
+ frame_rate=(int)(fps*frame_rate_base + 0.5);
+ }
+-#if LIBAVFORMAT_BUILD > 4752
+ c->time_base.den = frame_rate;
+ c->time_base.num = frame_rate_base;
+ /* adjust time base for supported framerates */
+@@ -1174,10 +1094,6 @@ static AVStream *icv_add_video_stream_FF
+ c->time_base.den= best->num;
+ c->time_base.num= best->den;
+ }
+-#else
+- c->frame_rate = frame_rate;
+- c->frame_rate_base = frame_rate_base;
+-#endif
+
+ c->gop_size = 12; /* emit one intra frame every twelve frames at most */
+ c->pix_fmt = (PixelFormat) pixel_format;
+@@ -1207,12 +1123,7 @@ static const int OPENCV_NO_FRAMES_WRITTE
+
+ static int icv_av_write_frame_FFMPEG( AVFormatContext * oc, AVStream * video_st, uint8_t * outbuf, uint32_t outbuf_size, AVFrame * picture )
+ {
+-#if LIBAVFORMAT_BUILD > 4628
+ AVCodecContext * c = video_st->codec;
+-#else
+- AVCodecContext * c = &(video_st->codec);
+-#endif
+- int out_size;
+ int ret = 0;
+
+ if (oc->oformat->flags & AVFMT_RAWPICTURE) {
+@@ -1232,24 +1143,39 @@ static int icv_av_write_frame_FFMPEG( AV
+
+ ret = av_write_frame(oc, &pkt);
+ } else {
++ AVPacket pkt;
++ int got_output;
++
++ av_init_packet(&pkt);
++#if LIBAVCODEC_VERSION_INT < AV_VERSION_INT(54, 1, 0)
+ /* encode the image */
+- out_size = avcodec_encode_video(c, outbuf, outbuf_size, picture);
+- /* if zero size, it means the image was buffered */
+- if (out_size > 0) {
+- AVPacket pkt;
+- av_init_packet(&pkt);
+-
+-#if LIBAVFORMAT_BUILD > 4752
+- if(c->coded_frame->pts != (int64_t)AV_NOPTS_VALUE)
+- pkt.pts = av_rescale_q(c->coded_frame->pts, c->time_base, video_st->time_base);
+-#else
++ int out_size = avcodec_encode_video(c, outbuf, outbuf_size, picture);
++ got_output = out_size > 0;
++ pkt.data = outbuf;
++ pkt.size = out_size;
++ if(c->coded_frame->pts != (int64_t)AV_NOPTS_VALUE)
+ pkt.pts = c->coded_frame->pts;
++ pkt.dts = AV_NOPTS_VALUE;
++ if(c->coded_frame->key_frame)
++ pkt.flags |= PKT_FLAG_KEY;
++#else
++ pkt.data = NULL;
++ pkt.size = 0;
++
++ ret = avcodec_encode_video2(c, &pkt, picture, &got_output);
++ if (ret < 0)
++ got_output = 0;
+ #endif
+- if(c->coded_frame->key_frame)
+- pkt.flags |= PKT_FLAG_KEY;
++
++ if (got_output) {
++ if (pkt.pts != (int64_t)AV_NOPTS_VALUE)
++ pkt.pts = av_rescale_q(pkt.pts, c->time_base, video_st->time_base);
++ if (pkt.dts != (int64_t)AV_NOPTS_VALUE)
++ pkt.dts = av_rescale_q(pkt.dts, c->time_base, video_st->time_base);
++ if (pkt.duration)
++ pkt.duration = av_rescale_q(pkt.duration, c->time_base, video_st->time_base);
++
+ pkt.stream_index= video_st->index;
+- pkt.data= outbuf;
+- pkt.size= out_size;
+
+ /* write the compressed frame in the media file */
+ ret = av_write_frame(oc, &pkt);
+@@ -1271,30 +1197,8 @@ bool CvVideoWriter_FFMPEG::writeFrame( c
+ height = frame_height;
+
+ // typecast from opaque data type to implemented struct
+-#if LIBAVFORMAT_BUILD > 4628
+ AVCodecContext *c = video_st->codec;
+-#else
+- AVCodecContext *c = &(video_st->codec);
+-#endif
+
+-#if LIBAVFORMAT_BUILD < 5231
+- // It is not needed in the latest versions of the ffmpeg
+- if( c->codec_id == CV_CODEC(CODEC_ID_RAWVIDEO) && origin != 1 )
+- {
+- if( !temp_image.data )
+- {
+- temp_image.step = (width*cn + 3) & -4;
+- temp_image.width = width;
+- temp_image.height = height;
+- temp_image.cn = cn;
+- temp_image.data = (unsigned char*)malloc(temp_image.step*temp_image.height);
+- }
+- for( int y = 0; y < height; y++ )
+- memcpy(temp_image.data + y*temp_image.step, data + (height-1-y)*step, width*cn);
+- data = temp_image.data;
+- step = temp_image.step;
+- }
+-#else
+ if( width*cn != step )
+ {
+ if( !temp_image.data )
+@@ -1314,7 +1218,6 @@ bool CvVideoWriter_FFMPEG::writeFrame( c
+ data = temp_image.data;
+ step = temp_image.step;
+ }
+-#endif
+
+ // check parameters
+ if (input_pix_fmt == PIX_FMT_BGR24) {
+@@ -1401,11 +1304,7 @@ void CvVideoWriter_FFMPEG::close()
+ }
+
+ // free pictures
+-#if LIBAVFORMAT_BUILD > 4628
+ if( video_st->codec->pix_fmt != input_pix_fmt)
+-#else
+- if( video_st->codec.pix_fmt != input_pix_fmt)
+-#endif
+ {
+ if(picture->data[0])
+ free(picture->data[0]);
+@@ -1417,11 +1316,7 @@ void CvVideoWriter_FFMPEG::close()
+ av_free(input_picture);
+
+ /* close codec */
+-#if LIBAVFORMAT_BUILD > 4628
+ avcodec_close(video_st->codec);
+-#else
+- avcodec_close(&(video_st->codec));
+-#endif
+
+ av_free(outbuf);
+
+@@ -1429,15 +1324,7 @@ void CvVideoWriter_FFMPEG::close()
+ {
+ /* close the output file */
+
+-#if LIBAVCODEC_VERSION_INT < ((52<<16)+(123<<8)+0)
+-#if LIBAVCODEC_VERSION_INT >= ((51<<16)+(49<<8)+0)
+- url_fclose(oc->pb);
+-#else
+- url_fclose(&oc->pb);
+-#endif
+-#else
+ avio_close(oc->pb);
+-#endif
+
+ }
+
+@@ -1479,11 +1366,7 @@ bool CvVideoWriter_FFMPEG::open( const c
+
+ /* auto detect the output format from the name and fourcc code. */
+
+-#if LIBAVFORMAT_BUILD >= CALC_FFMPEG_VERSION(53, 2, 0)
+ fmt = av_guess_format(NULL, filename, NULL);
+-#else
+- fmt = guess_format(NULL, filename, NULL);
+-#endif
+
+ if (!fmt)
+ return false;
+@@ -1497,21 +1380,12 @@ bool CvVideoWriter_FFMPEG::open( const c
+ }
+
+ /* Lookup codec_id for given fourcc */
+-#if LIBAVCODEC_VERSION_INT<((51<<16)+(49<<8)+0)
+- if( (codec_id = codec_get_bmp_id( fourcc )) == CV_CODEC(CODEC_ID_NONE) )
+- return false;
+-#else
+- const struct AVCodecTag * tags[] = { codec_bmp_tags, NULL};
++ const struct AVCodecTag * tags[] = { avformat_get_riff_video_tags(), NULL};
+ if( (codec_id = av_codec_get_id(tags, fourcc)) == CV_CODEC(CODEC_ID_NONE) )
+ return false;
+-#endif
+
+ // alloc memory for context
+-#if LIBAVFORMAT_BUILD >= CALC_FFMPEG_VERSION(53, 2, 0)
+ oc = avformat_alloc_context();
+-#else
+- oc = av_alloc_format_context();
+-#endif
+ assert (oc);
+
+ /* set file name */
+@@ -1523,12 +1397,10 @@ bool CvVideoWriter_FFMPEG::open( const c
+
+ // set a few optimal pixel formats for lossless codecs of interest..
+ switch (codec_id) {
+-#if LIBAVCODEC_VERSION_INT>((50<<16)+(1<<8)+0)
+ case CV_CODEC(CODEC_ID_JPEGLS):
+ // BGR24 or GRAY8 depending on is_color...
+ codec_pix_fmt = input_pix_fmt;
+ break;
+-#endif
+ case CV_CODEC(CODEC_ID_HUFFYUV):
+ codec_pix_fmt = PIX_FMT_YUV422P;
+ break;
+@@ -1555,14 +1427,6 @@ bool CvVideoWriter_FFMPEG::open( const c
+ width, height, (int)(bitrate + 0.5),
+ fps, codec_pix_fmt);
+
+- /* set the output parameters (must be done even if no
+- parameters). */
+-#if LIBAVFORMAT_BUILD < CALC_FFMPEG_VERSION(53, 2, 0)
+- if (av_set_parameters(oc, NULL) < 0) {
+- return false;
+- }
+-#endif
+-
+ #if 0
+ #if FF_API_DUMP_FORMAT
+ dump_format(oc, 0, filename, 1);
+@@ -1580,23 +1444,14 @@ bool CvVideoWriter_FFMPEG::open( const c
+ AVCodec *codec;
+ AVCodecContext *c;
+
+-#if LIBAVFORMAT_BUILD > 4628
+ c = (video_st->codec);
+-#else
+- c = &(video_st->codec);
+-#endif
+
+ c->codec_tag = fourcc;
+ /* find the video encoder */
+ codec = avcodec_find_encoder(c->codec_id);
+ if (!codec) {
+ fprintf(stderr, "Could not find encoder for codec id %d: %s", c->codec_id, icvFFMPEGErrStr(
+- #if LIBAVFORMAT_BUILD >= CALC_FFMPEG_VERSION(53, 2, 0)
+- AVERROR_ENCODER_NOT_FOUND
+- #else
+- -1
+- #endif
+- ));
++ AVERROR_ENCODER_NOT_FOUND));
+ return false;
+ }
+
+@@ -1607,13 +1462,7 @@ bool CvVideoWriter_FFMPEG::open( const c
+ c->bit_rate = (int)lbit_rate;
+
+ /* open the codec */
+- if ((err=
+-#if LIBAVCODEC_VERSION_INT >= ((53<<16)+(8<<8)+0)
+- avcodec_open2(c, codec, NULL)
+-#else
+- avcodec_open(c, codec)
+-#endif
+- ) < 0) {
++ if ((err = avcodec_open2(c, codec, NULL)) < 0) {
+ fprintf(stderr, "Could not open codec '%s': %s", codec->name, icvFFMPEGErrStr(err));
+ return false;
+ }
+@@ -1649,22 +1498,14 @@ bool CvVideoWriter_FFMPEG::open( const c
+
+ /* open the output file, if needed */
+ if (!(fmt->flags & AVFMT_NOFILE)) {
+-#if LIBAVFORMAT_BUILD < CALC_FFMPEG_VERSION(53, 2, 0)
+- if (url_fopen(&oc->pb, filename, URL_WRONLY) < 0)
+-#else
+ if (avio_open(&oc->pb, filename, AVIO_FLAG_WRITE) < 0)
+-#endif
+ {
+ return false;
+ }
+ }
+
+-#if LIBAVFORMAT_BUILD >= CALC_FFMPEG_VERSION(52, 111, 0)
+ /* write the stream header, if any */
+ err=avformat_write_header(oc, NULL);
+-#else
+- err=av_write_header( oc );
+-#endif
+
+ if(err < 0)
+ {
+@@ -1799,15 +1640,7 @@ void OutputMediaStream_FFMPEG::close()
+ {
+ // close the output file
+
+- #if LIBAVCODEC_VERSION_INT < ((52<<16)+(123<<8)+0)
+- #if LIBAVCODEC_VERSION_INT >= ((51<<16)+(49<<8)+0)
+- url_fclose(oc_->pb);
+- #else
+- url_fclose(&oc_->pb);
+- #endif
+- #else
+- avio_close(oc_->pb);
+- #endif
++ avio_close(oc_->pb);
+ }
+
+ // free the stream
+@@ -1817,19 +1650,11 @@ void OutputMediaStream_FFMPEG::close()
+
+ AVStream* OutputMediaStream_FFMPEG::addVideoStream(AVFormatContext *oc, CV_CODEC_ID codec_id, int w, int h, int bitrate, double fps, PixelFormat pixel_format)
+ {
+- #if LIBAVFORMAT_BUILD >= CALC_FFMPEG_VERSION(53, 10, 0)
+ AVStream* st = avformat_new_stream(oc, 0);
+- #else
+- AVStream* st = av_new_stream(oc, 0);
+- #endif
+ if (!st)
+ return 0;
+
+- #if LIBAVFORMAT_BUILD > 4628
+ AVCodecContext* c = st->codec;
+- #else
+- AVCodecContext* c = &(st->codec);
+- #endif
+
+ c->codec_id = codec_id;
+ c->codec_type = AVMEDIA_TYPE_VIDEO;
+@@ -1865,7 +1690,6 @@ AVStream* OutputMediaStream_FFMPEG::addV
+ c->time_base.den = frame_rate;
+ c->time_base.num = frame_rate_base;
+
+- #if LIBAVFORMAT_BUILD > 4752
+ // adjust time base for supported framerates
+ if (codec && codec->supported_framerates)
+ {
+@@ -1890,7 +1714,6 @@ AVStream* OutputMediaStream_FFMPEG::addV
+ c->time_base.den= best->num;
+ c->time_base.num= best->den;
+ }
+- #endif
+
+ c->gop_size = 12; // emit one intra frame every twelve frames at most
+ c->pix_fmt = pixel_format;
+@@ -1909,13 +1732,11 @@ AVStream* OutputMediaStream_FFMPEG::addV
+ c->mb_decision = 2;
+ }
+
+- #if LIBAVCODEC_VERSION_INT > 0x000409
+ // some formats want stream headers to be seperate
+ if (oc->oformat->flags & AVFMT_GLOBALHEADER)
+ {
+ c->flags |= CODEC_FLAG_GLOBAL_HEADER;
+ }
+- #endif
+
+ return st;
+ }
+@@ -1927,22 +1748,14 @@ bool OutputMediaStream_FFMPEG::open(cons
+ video_st_ = 0;
+
+ // auto detect the output format from the name and fourcc code
+- #if LIBAVFORMAT_BUILD >= CALC_FFMPEG_VERSION(53, 2, 0)
+ fmt_ = av_guess_format(NULL, fileName, NULL);
+- #else
+- fmt_ = guess_format(NULL, fileName, NULL);
+- #endif
+ if (!fmt_)
+ return false;
+
+ CV_CODEC_ID codec_id = CV_CODEC(CODEC_ID_H264);
+
+ // alloc memory for context
+- #if LIBAVFORMAT_BUILD >= CALC_FFMPEG_VERSION(53, 2, 0)
+ oc_ = avformat_alloc_context();
+- #else
+- oc_ = av_alloc_format_context();
+- #endif
+ if (!oc_)
+ return false;
+
+@@ -1961,20 +1774,10 @@ bool OutputMediaStream_FFMPEG::open(cons
+ if (!video_st_)
+ return false;
+
+- // set the output parameters (must be done even if no parameters)
+- #if LIBAVFORMAT_BUILD < CALC_FFMPEG_VERSION(53, 2, 0)
+- if (av_set_parameters(oc_, NULL) < 0)
+- return false;
+- #endif
+-
+ // now that all the parameters are set, we can open the audio and
+ // video codecs and allocate the necessary encode buffers
+
+- #if LIBAVFORMAT_BUILD > 4628
+ AVCodecContext* c = (video_st_->codec);
+- #else
+- AVCodecContext* c = &(video_st_->codec);
+- #endif
+
+ c->codec_tag = MKTAG('H', '2', '6', '4');
+ c->bit_rate_tolerance = c->bit_rate;
+@@ -1982,22 +1785,14 @@ bool OutputMediaStream_FFMPEG::open(cons
+ // open the output file, if needed
+ if (!(fmt_->flags & AVFMT_NOFILE))
+ {
+- #if LIBAVFORMAT_BUILD < CALC_FFMPEG_VERSION(53, 2, 0)
+- int err = url_fopen(&oc_->pb, fileName, URL_WRONLY);
+- #else
+- int err = avio_open(&oc_->pb, fileName, AVIO_FLAG_WRITE);
+- #endif
++ int err = avio_open(&oc_->pb, fileName, AVIO_FLAG_WRITE);
+
+ if (err != 0)
+ return false;
+ }
+
+ // write the stream header, if any
+- #if LIBAVFORMAT_BUILD < CALC_FFMPEG_VERSION(53, 2, 0)
+- av_write_header(oc_);
+- #else
+- avformat_write_header(oc_, NULL);
+- #endif
++ avformat_write_header(oc_, NULL);
+
+ return true;
+ }
+@@ -2102,33 +1897,19 @@ bool InputMediaStream_FFMPEG::open(const
+ video_stream_id_ = -1;
+ memset(&pkt_, 0, sizeof(AVPacket));
+
+- #if LIBAVFORMAT_BUILD >= CALC_FFMPEG_VERSION(53, 13, 0)
+- avformat_network_init();
+- #endif
+-
+- #if LIBAVFORMAT_BUILD >= CALC_FFMPEG_VERSION(53, 6, 0)
+- err = avformat_open_input(&ctx_, fileName, 0, 0);
+- #else
+- err = av_open_input_file(&ctx_, fileName, 0, 0, 0);
+- #endif
++ avformat_network_init();
++
++ err = avformat_open_input(&ctx_, fileName, 0, 0);
+ if (err < 0)
+ return false;
+
+- #if LIBAVFORMAT_BUILD >= CALC_FFMPEG_VERSION(53, 6, 0)
+- err = avformat_find_stream_info(ctx_, 0);
+- #else
+- err = av_find_stream_info(ctx_);
+- #endif
++ err = avformat_find_stream_info(ctx_, 0);
+ if (err < 0)
+ return false;
+
+ for (unsigned int i = 0; i < ctx_->nb_streams; ++i)
+ {
+- #if LIBAVFORMAT_BUILD > 4628
+ AVCodecContext *enc = ctx_->streams[i]->codec;
+- #else
+- AVCodecContext *enc = &ctx_->streams[i]->codec;
+- #endif
+
+ if (enc->codec_type == AVMEDIA_TYPE_VIDEO)
+ {
+@@ -2197,11 +1978,7 @@ void InputMediaStream_FFMPEG::close()
+ {
+ if (ctx_)
+ {
+- #if LIBAVFORMAT_BUILD >= CALC_FFMPEG_VERSION(53, 24, 2)
+- avformat_close_input(&ctx_);
+- #else
+- av_close_input_file(ctx_);
+- #endif
++ avformat_close_input(&ctx_);
+ }
+
+ // free last packet if exist
diff --git a/media-libs/opencv/opencv-2.4.9.ebuild b/media-libs/opencv/opencv-2.4.9.ebuild
index 83da9de8530f..e05338ffc840 100644
--- a/media-libs/opencv/opencv-2.4.9.ebuild
+++ b/media-libs/opencv/opencv-2.4.9.ebuild
@@ -1,6 +1,6 @@
# Copyright 1999-2014 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
-# $Header: /var/cvsroot/gentoo-x86/media-libs/opencv/opencv-2.4.9.ebuild,v 1.2 2014/08/26 22:10:36 amynka Exp $
+# $Header: /var/cvsroot/gentoo-x86/media-libs/opencv/opencv-2.4.9.ebuild,v 1.3 2014/09/17 11:41:11 lu_zero Exp $
EAPI=5
PYTHON_COMPAT=( python2_{6,7} )
@@ -76,6 +76,7 @@ PATCHES=(
"${FILESDIR}/${PN}-2.4.2-cflags.patch"
"${FILESDIR}/${PN}-2.4.8-javamagic.patch"
"${FILESDIR}/${PN}-2.4.9-cuda.patch"
+ "${FILESDIR}/${PN}-2.4.9-libav10.patch"
)
pkg_setup() {