summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexis Ballier <aballier@gentoo.org>2013-02-15 16:04:48 +0000
committerAlexis Ballier <aballier@gentoo.org>2013-02-15 16:04:48 +0000
commitc5bbbbb092c30b0b110aeb4e3e7134e70c5c1f9e (patch)
treef605e50ae9f0f32fcc24fc4451d980ae479b5be9 /www-plugins/gnash
parentUpdate radeon-ucode license. (diff)
downloadgentoo-2-c5bbbbb092c30b0b110aeb4e3e7134e70c5c1f9e.tar.gz
gentoo-2-c5bbbbb092c30b0b110aeb4e3e7134e70c5c1f9e.tar.bz2
gentoo-2-c5bbbbb092c30b0b110aeb4e3e7134e70c5c1f9e.zip
Fix build with ffmpeg-1 / libav-9, bug #443184
(Portage version: 2.2.0_alpha163/cvs/Linux x86_64, signed Manifest commit with key 160F534A)
Diffstat (limited to 'www-plugins/gnash')
-rw-r--r--www-plugins/gnash/ChangeLog10
-rw-r--r--www-plugins/gnash/files/gnash-0.8.10_p20120903-bytesfmt.patch32
-rw-r--r--www-plugins/gnash/files/gnash-0.8.10_p20120903-ffmpeg1.patch252
-rw-r--r--www-plugins/gnash/files/gnash-0.8.10_p20120903-libav9.patch85
-rw-r--r--www-plugins/gnash/gnash-0.8.10_p20120903.ebuild9
5 files changed, 384 insertions, 4 deletions
diff --git a/www-plugins/gnash/ChangeLog b/www-plugins/gnash/ChangeLog
index fed65c5d2cef..90628b1d9a4c 100644
--- a/www-plugins/gnash/ChangeLog
+++ b/www-plugins/gnash/ChangeLog
@@ -1,6 +1,12 @@
# ChangeLog for www-plugins/gnash
-# Copyright 1999-2012 Gentoo Foundation; Distributed under the GPL v2
-# $Header: /var/cvsroot/gentoo-x86/www-plugins/gnash/ChangeLog,v 1.91 2012/11/04 04:38:36 flameeyes Exp $
+# Copyright 1999-2013 Gentoo Foundation; Distributed under the GPL v2
+# $Header: /var/cvsroot/gentoo-x86/www-plugins/gnash/ChangeLog,v 1.92 2013/02/15 16:04:48 aballier Exp $
+
+ 15 Feb 2013; Alexis Ballier <aballier@gentoo.org>
+ gnash-0.8.10_p20120903.ebuild, +files/gnash-0.8.10_p20120903-bytesfmt.patch,
+ +files/gnash-0.8.10_p20120903-ffmpeg1.patch,
+ +files/gnash-0.8.10_p20120903-libav9.patch:
+ Fix build with ffmpeg-1 / libav-9, bug #443184
04 Nov 2012; Diego E. Pettenò <flameeyes@gentoo.org> gnash-0.8.10-r2.ebuild:
Remove pointless version check after unslotting boost.
diff --git a/www-plugins/gnash/files/gnash-0.8.10_p20120903-bytesfmt.patch b/www-plugins/gnash/files/gnash-0.8.10_p20120903-bytesfmt.patch
new file mode 100644
index 000000000000..918be74369f6
--- /dev/null
+++ b/www-plugins/gnash/files/gnash-0.8.10_p20120903-bytesfmt.patch
@@ -0,0 +1,32 @@
+commit 80989fcd47d33e30336785422ded17f4c607a113
+Author: Alexis Ballier <aballier@gentoo.org>
+Date: Thu Feb 14 17:21:50 2013 -0300
+
+ Use av_get_bytes_per_sample in SampleFormatToSampleSize (#38333)
+
+ This is more future proof against the addition of sample formats.
+
+ Signed-off-by: Sandro Santilli <strk@keybit.net>
+
+diff --git a/libmedia/ffmpeg/MediaParserFfmpeg.cpp b/libmedia/ffmpeg/MediaParserFfmpeg.cpp
+index 136cc08..83b1d74 100644
+--- a/libmedia/ffmpeg/MediaParserFfmpeg.cpp
++++ b/libmedia/ffmpeg/MediaParserFfmpeg.cpp
+@@ -646,6 +646,9 @@ MediaParserFfmpeg::seekMedia(boost::int64_t offset, int whence)
+ boost::uint16_t
+ MediaParserFfmpeg::SampleFormatToSampleSize(AVSampleFormat fmt)
+ {
++#if LIBAVUTIL_VERSION_INT > AV_VERSION_INT(51,4,0)
++ return av_get_bytes_per_sample(fmt);
++#else
+ switch (fmt)
+ {
+ case AV_SAMPLE_FMT_U8: // unsigned 8 bits
+@@ -668,6 +671,7 @@ MediaParserFfmpeg::SampleFormatToSampleSize(AVSampleFormat fmt)
+ default:
+ return 8; // arbitrary value
+ }
++#endif
+ }
+
+
diff --git a/www-plugins/gnash/files/gnash-0.8.10_p20120903-ffmpeg1.patch b/www-plugins/gnash/files/gnash-0.8.10_p20120903-ffmpeg1.patch
new file mode 100644
index 000000000000..0759e443255a
--- /dev/null
+++ b/www-plugins/gnash/files/gnash-0.8.10_p20120903-ffmpeg1.patch
@@ -0,0 +1,252 @@
+commit 4b3dae970549d42723c2528c250a1f95248145c7
+Author: Alexis Ballier <aballier@gentoo.org>
+Date: Wed Feb 13 14:38:44 2013 -0300
+
+ Fix build with latest FFmpeg (second attempt)
+
+ Add ifdefery to be compatible with older versions.
+ See ticket #38122
+
+ Signed-off-by: Sandro Santilli <strk@keybit.net>
+
+diff --git a/libmedia/ffmpeg/AudioDecoderFfmpeg.cpp b/libmedia/ffmpeg/AudioDecoderFfmpeg.cpp
+index 067e418..5c8e1ad 100644
+--- a/libmedia/ffmpeg/AudioDecoderFfmpeg.cpp
++++ b/libmedia/ffmpeg/AudioDecoderFfmpeg.cpp
+@@ -84,8 +84,10 @@ AudioDecoderFfmpeg::~AudioDecoderFfmpeg()
+
+ void AudioDecoderFfmpeg::setup(SoundInfo& info)
+ {
+- // Init the avdecoder-decoder
++#if LIBAVCODEC_VERSION_INT < AV_VERSION_INT(52,6,2)
++ // Starting from this version avcodec_register calls avcodec_init
+ avcodec_init();
++#endif
+ avcodec_register_all();// change this to only register need codec?
+
+ enum CodecID codec_id;
+@@ -158,14 +160,14 @@ void AudioDecoderFfmpeg::setup(SoundInfo& info)
+ case CODEC_ID_PCM_U16LE:
+ _audioCodecCtx->channels = (info.isStereo() ? 2 : 1);
+ _audioCodecCtx->sample_rate = info.getSampleRate();
+- _audioCodecCtx->sample_fmt = SAMPLE_FMT_S16; // ?! arbitrary ?
++ _audioCodecCtx->sample_fmt = AV_SAMPLE_FMT_S16; // ?! arbitrary ?
+ _audioCodecCtx->frame_size = 1;
+ break;
+
+ default:
+ _audioCodecCtx->channels = (info.isStereo() ? 2 : 1);
+ _audioCodecCtx->sample_rate = info.getSampleRate();
+- _audioCodecCtx->sample_fmt = SAMPLE_FMT_S16; // ?! arbitrary ?
++ _audioCodecCtx->sample_fmt = AV_SAMPLE_FMT_S16; // ?! arbitrary ?
+ break;
+ }
+ }
+@@ -173,7 +175,10 @@ void AudioDecoderFfmpeg::setup(SoundInfo& info)
+ void AudioDecoderFfmpeg::setup(const AudioInfo& info)
+ {
+ // Init the avdecoder-decoder
++#if LIBAVCODEC_VERSION_INT < AV_VERSION_INT(52,6,2)
++ // Starting from this version avcodec_register calls avcodec_init
+ avcodec_init();
++#endif
+ avcodec_register_all();// change this to only register need codec?
+
+ enum CodecID codec_id = CODEC_ID_NONE;
+@@ -297,7 +302,7 @@ void AudioDecoderFfmpeg::setup(const AudioInfo& info)
+ _audioCodecCtx->channels = (info.stereo ? 2 : 1);
+ _audioCodecCtx->sample_rate = info.sampleRate;
+ // was commented out (why?):
+- _audioCodecCtx->sample_fmt = SAMPLE_FMT_S16;
++ _audioCodecCtx->sample_fmt = AV_SAMPLE_FMT_S16;
+ break;
+ }
+
+diff --git a/libmedia/ffmpeg/MediaParserFfmpeg.cpp b/libmedia/ffmpeg/MediaParserFfmpeg.cpp
+index d6e6902..136cc08 100644
+--- a/libmedia/ffmpeg/MediaParserFfmpeg.cpp
++++ b/libmedia/ffmpeg/MediaParserFfmpeg.cpp
+@@ -344,8 +344,10 @@ MediaParserFfmpeg::initializeParser()
+ {
+ av_register_all(); // TODO: needs to be invoked only once ?
+
++#if LIBAVFORMAT_VERSION_INT < AV_VERSION_INT(52,107,0)
+ _byteIOCxt.buffer = NULL;
+-
++#endif
++
+ _inputFmt = probeStream();
+
+ #ifdef GNASH_ALLOW_VCODEC_ENV
+@@ -366,7 +368,11 @@ MediaParserFfmpeg::initializeParser()
+ // which isn't needed.
+ _byteIOBuffer.reset(new unsigned char[byteIOBufferSize]);
+
++#if LIBAVFORMAT_VERSION_INT < AV_VERSION_INT(52,107,0)
+ init_put_byte(&_byteIOCxt,
++#else
++ _avIOCxt = avio_alloc_context(
++#endif
+ _byteIOBuffer.get(), // buffer
+ byteIOBufferSize, // buffer size
+ 0, // write flags
+@@ -376,7 +382,11 @@ MediaParserFfmpeg::initializeParser()
+ MediaParserFfmpeg::seekMediaWrapper // seeker callback
+ );
+
++#if LIBAVFORMAT_VERSION_INT < AV_VERSION_INT(52,107,0)
+ _byteIOCxt.is_streamed = 1;
++#else
++ _avIOCxt->seekable = 0;
++#endif
+
+ #if !defined(LIBAVCODEC_VERSION_MAJOR) || LIBAVCODEC_VERSION_MAJOR < 52
+ // Needed for Lenny.
+@@ -387,12 +397,19 @@ MediaParserFfmpeg::initializeParser()
+
+ assert(_formatCtx);
+
++#if LIBAVFORMAT_VERSION_INT < AV_VERSION_INT(52,107,0)
+ // Otherwise av_open_input_stream will reallocate the context.
+ AVFormatParameters ap;
+ std::memset(&ap, 0, sizeof ap);
+ ap.prealloced_context = 1;
+
+ if (av_open_input_stream(&_formatCtx, &_byteIOCxt, "", _inputFmt, &ap) < 0)
++#else
++
++ _formatCtx->pb = _avIOCxt;
++
++ if (avformat_open_input(&_formatCtx, "", _inputFmt, NULL) < 0)
++#endif
+ {
+ throw IOException("MediaParserFfmpeg couldn't open input stream");
+ }
+@@ -400,10 +417,17 @@ MediaParserFfmpeg::initializeParser()
+ #if defined(LIBAVCODEC_VERSION_MAJOR) && LIBAVCODEC_VERSION_MAJOR >= 52
+ // Note: in at least some versions of ffmpeg, av_open_input_stream does
+ // not parse metadata; not sure why.
++#if LIBAVUTIL_VERSION_INT < AV_VERSION_INT(51,5,0)
+ AVMetadata* md = _formatCtx->metadata;
+ if (md) {
+ AVMetadataTag* tag = av_metadata_get(md, "album", 0,
+ AV_METADATA_MATCH_CASE);
++#else
++ AVDictionary* md = _formatCtx->metadata;
++ if (md) {
++ AVDictionaryEntry* tag = av_dict_get(md, "album", 0,
++ AV_DICT_MATCH_CASE);
++#endif
+ if (tag && tag->value) {
+ setId3Info(&Id3Info::album, std::string(tag->value),
+ _id3Object);
+@@ -620,27 +644,27 @@ MediaParserFfmpeg::seekMedia(boost::int64_t offset, int whence)
+ }
+
+ boost::uint16_t
+-MediaParserFfmpeg::SampleFormatToSampleSize(SampleFormat fmt)
++MediaParserFfmpeg::SampleFormatToSampleSize(AVSampleFormat fmt)
+ {
+ switch (fmt)
+ {
+- case SAMPLE_FMT_U8: // unsigned 8 bits
++ case AV_SAMPLE_FMT_U8: // unsigned 8 bits
+ return 1;
+
+- case SAMPLE_FMT_S16: // signed 16 bits
+- case SAMPLE_FMT_FLT: // float
++ case AV_SAMPLE_FMT_S16: // signed 16 bits
++ case AV_SAMPLE_FMT_FLT: // float
+ return 2;
+
+ #if !defined (LIBAVCODEC_VERSION_MAJOR) || LIBAVCODEC_VERSION_MAJOR < 52
+ // Was dropped for version 52.0.0
+- case SAMPLE_FMT_S24: // signed 24 bits
++ case AV_SAMPLE_FMT_S24: // signed 24 bits
+ return 3;
+ #endif
+
+- case SAMPLE_FMT_S32: // signed 32 bits
++ case AV_SAMPLE_FMT_S32: // signed 32 bits
+ return 4;
+
+- case SAMPLE_FMT_NONE:
++ case AV_SAMPLE_FMT_NONE:
+ default:
+ return 8; // arbitrary value
+ }
+diff --git a/libmedia/ffmpeg/MediaParserFfmpeg.h b/libmedia/ffmpeg/MediaParserFfmpeg.h
+index 4e410d8..a14cfb6 100644
+--- a/libmedia/ffmpeg/MediaParserFfmpeg.h
++++ b/libmedia/ffmpeg/MediaParserFfmpeg.h
+@@ -154,7 +154,13 @@ private:
+ AVStream* _audioStream;
+
+ /// ?
+- ByteIOContext _byteIOCxt;
++#if LIBAVFORMAT_VERSION_INT < AV_VERSION_INT(52,107,0)
++// AVIOContext was introduced a bit earlier but without version bump, so let's
++// be safe
++ ByteIOContext _byteIOCxt;
++#else
++ AVIOContext* _avIOCxt;
++#endif
+
+ /// Size of the ByteIO context buffer
+ //
+@@ -172,7 +178,7 @@ private:
+ //
+ /// TODO: move somewhere in ffmpeg utils..
+ ///
+- boost::uint16_t SampleFormatToSampleSize(SampleFormat fmt);
++ boost::uint16_t SampleFormatToSampleSize(AVSampleFormat fmt);
+
+ /// Make an EncodedVideoFrame from an AVPacket and push to buffer
+ //
+diff --git a/libmedia/ffmpeg/VideoDecoderFfmpeg.cpp b/libmedia/ffmpeg/VideoDecoderFfmpeg.cpp
+index 40a5c80..eeefafe 100644
+--- a/libmedia/ffmpeg/VideoDecoderFfmpeg.cpp
++++ b/libmedia/ffmpeg/VideoDecoderFfmpeg.cpp
+@@ -171,7 +171,10 @@ VideoDecoderFfmpeg::init(enum CodecID codecId, int /*width*/, int /*height*/,
+ boost::uint8_t* extradata, int extradataSize)
+ {
+ // Init the avdecoder-decoder
++#if LIBAVCODEC_VERSION_INT < AV_VERSION_INT(52,6,2)
++ // Starting from this version avcodec_register calls avcodec_init
+ avcodec_init();
++#endif
+ avcodec_register_all();// change this to only register need codec?
+
+ _videoCodec = avcodec_find_decoder(codecId);
+@@ -529,7 +532,11 @@ get_buffer(AVCodecContext* avctx, AVFrame* pic)
+
+ static unsigned int pic_num = 0;
+ pic->type = FF_BUFFER_TYPE_USER;
++#if LIBAVCODEC_VERSION_MAJOR < 54
++ // This field has been unused for longer but has been removed with
++ // libavcodec 54.
+ pic->age = ++pic_num - surface->getPicNum();
++#endif
+ surface->setPicNum(pic_num);
+ return 0;
+ #endif
+diff --git a/libmedia/ffmpeg/ffmpegHeaders.h b/libmedia/ffmpeg/ffmpegHeaders.h
+index 65a8d0c..7710121 100644
+--- a/libmedia/ffmpeg/ffmpegHeaders.h
++++ b/libmedia/ffmpeg/ffmpegHeaders.h
+@@ -83,5 +83,15 @@ extern "C" {
+ #define HAVE_SWSCALE_H 1
+ #endif
+
++#if LIBAVCODEC_VERSION_INT < AV_VERSION_INT(52,94,1)
++#define AV_SAMPLE_FMT_NONE SAMPLE_FMT_NONE
++#define AV_SAMPLE_FMT_U8 SAMPLE_FMT_U8
++#define AV_SAMPLE_FMT_S16 SAMPLE_FMT_S16
++#define AV_SAMPLE_FMT_S32 SAMPLE_FMT_S32
++#define AV_SAMPLE_FMT_FLT SAMPLE_FMT_FLT
++#define AV_SAMPLE_FMT_DBL SAMPLE_FMT_DBL
++
++#define AVSampleFormat SampleFormat
++#endif
+
+ #endif // GNASH_MEDIA_FFMPEG_HEADERS_H
diff --git a/www-plugins/gnash/files/gnash-0.8.10_p20120903-libav9.patch b/www-plugins/gnash/files/gnash-0.8.10_p20120903-libav9.patch
new file mode 100644
index 000000000000..ab6baa7673dc
--- /dev/null
+++ b/www-plugins/gnash/files/gnash-0.8.10_p20120903-libav9.patch
@@ -0,0 +1,85 @@
+commit dfba5258dc230669a7e1ad309e25ef190c77e854
+Author: Alexis Ballier <aballier@gentoo.org>
+Date: Thu Feb 14 16:54:08 2013 -0300
+
+ Fix build with libav-9 (#38333)
+
+ Signed-off-by: Sandro Santilli <strk@keybit.net>
+
+diff --git a/libmedia/ffmpeg/AudioDecoderFfmpeg.cpp b/libmedia/ffmpeg/AudioDecoderFfmpeg.cpp
+index 5c8e1ad..50947fb 100644
+--- a/libmedia/ffmpeg/AudioDecoderFfmpeg.cpp
++++ b/libmedia/ffmpeg/AudioDecoderFfmpeg.cpp
+@@ -133,12 +133,20 @@ void AudioDecoderFfmpeg::setup(SoundInfo& info)
+ }
+ }
+
++#if LIBAVCODEC_VERSION_INT > AV_VERSION_INT(53,8,0)
++ _audioCodecCtx = avcodec_alloc_context3(_audioCodec);
++#else
+ _audioCodecCtx = avcodec_alloc_context();
++#endif
+ if (!_audioCodecCtx) {
+ throw MediaException(_("libavcodec couldn't allocate context"));
+ }
+
++#if LIBAVCODEC_VERSION_INT > AV_VERSION_INT(53,8,0)
++ int ret = avcodec_open2(_audioCodecCtx, _audioCodec, NULL);
++#else
+ int ret = avcodec_open(_audioCodecCtx, _audioCodec);
++#endif
+ if (ret < 0) {
+ av_free(_audioCodecCtx);
+ _audioCodecCtx=0;
+@@ -259,7 +267,11 @@ void AudioDecoderFfmpeg::setup(const AudioInfo& info)
+ _needsParsing = (_parser != NULL);
+
+ // Create an audioCodecCtx from the ffmpeg parser if exists/possible
++#if LIBAVCODEC_VERSION_INT > AV_VERSION_INT(53,8,0)
++ _audioCodecCtx = avcodec_alloc_context3(_audioCodec);
++#else
+ _audioCodecCtx = avcodec_alloc_context();
++#endif
+ if (!_audioCodecCtx) {
+ throw MediaException(_("AudioDecoderFfmpeg: libavcodec couldn't "
+ "allocate context"));
+@@ -310,7 +322,11 @@ void AudioDecoderFfmpeg::setup(const AudioInfo& info)
+ #ifdef GNASH_DEBUG_AUDIO_DECODING
+ log_debug(" Opening codec");
+ #endif // GNASH_DEBUG_AUDIO_DECODING
++#if LIBAVCODEC_VERSION_INT > AV_VERSION_INT(53,8,0)
++ int ret = avcodec_open2(_audioCodecCtx, _audioCodec, NULL);
++#else
+ int ret = avcodec_open(_audioCodecCtx, _audioCodec);
++#endif
+ if (ret < 0) {
+ //avcodec_close(_audioCodecCtx);
+ av_free(_audioCodecCtx);
+diff --git a/libmedia/ffmpeg/VideoDecoderFfmpeg.cpp b/libmedia/ffmpeg/VideoDecoderFfmpeg.cpp
+index eeefafe..e5263c6 100644
+--- a/libmedia/ffmpeg/VideoDecoderFfmpeg.cpp
++++ b/libmedia/ffmpeg/VideoDecoderFfmpeg.cpp
+@@ -183,7 +183,11 @@ VideoDecoderFfmpeg::init(enum CodecID codecId, int /*width*/, int /*height*/,
+ throw MediaException(_("libavcodec can't decode this video format"));
+ }
+
++#if LIBAVCODEC_VERSION_INT > AV_VERSION_INT(53,8,0)
++ _videoCodecCtx.reset(new CodecContextWrapper(avcodec_alloc_context3(_videoCodec)));
++#else
+ _videoCodecCtx.reset(new CodecContextWrapper(avcodec_alloc_context()));
++#endif
+ if (!_videoCodecCtx->getContext()) {
+ throw MediaException(_("libavcodec couldn't allocate context"));
+ }
+@@ -206,7 +210,11 @@ VideoDecoderFfmpeg::init(enum CodecID codecId, int /*width*/, int /*height*/,
+ }
+ #endif
+
++#if LIBAVCODEC_VERSION_INT > AV_VERSION_INT(53,8,0)
++ int ret = avcodec_open2(ctx, _videoCodec, NULL);
++#else
+ int ret = avcodec_open(ctx, _videoCodec);
++#endif
+ if (ret < 0) {
+ boost::format msg = boost::format(_("libavcodec "
+ "failed to initialize FFMPEG "
diff --git a/www-plugins/gnash/gnash-0.8.10_p20120903.ebuild b/www-plugins/gnash/gnash-0.8.10_p20120903.ebuild
index e9ffb9214e39..8c22e4c580b1 100644
--- a/www-plugins/gnash/gnash-0.8.10_p20120903.ebuild
+++ b/www-plugins/gnash/gnash-0.8.10_p20120903.ebuild
@@ -1,6 +1,6 @@
-# Copyright 1999-2012 Gentoo Foundation
+# Copyright 1999-2013 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
-# $Header: /var/cvsroot/gentoo-x86/www-plugins/gnash/gnash-0.8.10_p20120903.ebuild,v 1.2 2012/10/31 17:26:47 flameeyes Exp $
+# $Header: /var/cvsroot/gentoo-x86/www-plugins/gnash/gnash-0.8.10_p20120903.ebuild,v 1.3 2013/02/15 16:04:48 aballier Exp $
EAPI=4
CMAKE_REQUIRED="never"
@@ -155,6 +155,11 @@ src_prepare() {
# Allow building against boost-1.50, bug #425442
epatch "${FILESDIR}"/${PN}-0.8.10-boost-1.50.patch
+ # fix build with ffmpeg-1 / libav-9, bug #443184
+ epatch "${FILESDIR}/${P}-ffmpeg1.patch" \
+ "${FILESDIR}/${P}-libav9.patch" \
+ "${FILESDIR}/${P}-bytesfmt.patch"
+
eautoreconf
}
src_configure() {