diff --git a/www/gnash/Makefile b/www/gnash/Makefile index 44c96fd9321..1d2e2c6e601 100644 --- a/www/gnash/Makefile +++ b/www/gnash/Makefile @@ -1,4 +1,4 @@ -# $OpenBSD: Makefile,v 1.54 2013/02/05 11:50:48 brad Exp $ +# $OpenBSD: Makefile,v 1.55 2013/03/08 00:58:26 brad Exp $ SHARED_ONLY= Yes @@ -8,7 +8,7 @@ COMMENT= SWF player with Firefox browser plugin VER= 0.8.10 DISTNAME= gnash-${VER} -REVISION= 2 +REVISION= 3 EPOCH= 0 CATEGORIES= www MASTER_SITES= ${MASTER_SITE_GNU:=gnash/${VER}/} @@ -24,28 +24,25 @@ PERMIT_PACKAGE_FTP= Yes PERMIT_DISTFILES_CDROM= Yes PERMIT_DISTFILES_FTP= Yes -WANTLIB= SDL X11 agg boost_iostreams boost_program_options-mt \ - boost_system-mt boost_thread-mt c curl fontconfig \ +WANTLIB= SDL X11 agg avcodec avformat avutil boost_iostreams \ + boost_program_options-mt boost_thread-mt c curl fontconfig \ freetype gdk-x11-2.0 gdk_pixbuf-2.0 gif glib-2.0 gobject-2.0 \ - gstinterfaces-0.10 gstpbutils-0.10 gstreamer-0.10 gtk-x11-2.0 \ - jpeg ltdl m png pthread speex speexdsp stdc++ z \ + gtk-x11-2.0 jpeg ltdl m png pthread speex speexdsp \ + stdc++ swscale z MODULES= devel/gettext BUILD_DEPENDS= devel/xulrunner/1.9,-devel RUN_DEPENDS= devel/desktop-file-utils \ - multimedia/gstreamer-0.10/plugins-ffmpeg \ - multimedia/gstreamer-0.10/plugins-good \ - multimedia/gstreamer-0.10/plugins-ugly \ x11/gtk+2,-guic LIB_DEPENDS= audio/speex \ devel/boost \ devel/libtool,-ltdl \ devel/sdl \ graphics/agg \ + graphics/ffmpeg>=20121026 \ graphics/jpeg \ graphics/libungif \ graphics/png \ - multimedia/gstreamer-0.10/plugins-base \ net/curl \ x11/gtk+2 @@ -58,7 +55,7 @@ CONFIGURE_ARGS= --disable-cygnal \ --disable-jemalloc \ --enable-renderer=agg \ --enable-gui=gtk \ - --enable-media=gst \ + --enable-media=ffmpeg \ --without-gconf \ --with-npapi-plugindir=${LOCALBASE}/lib/mozilla/plugins CONFIGURE_ENV= CPPFLAGS="-I${LOCALBASE}/include" \ diff --git a/www/gnash/patches/patch-libmedia_ffmpeg_AudioDecoderFfmpeg_cpp b/www/gnash/patches/patch-libmedia_ffmpeg_AudioDecoderFfmpeg_cpp new file mode 100644 index 00000000000..095d9d3d75e --- /dev/null +++ b/www/gnash/patches/patch-libmedia_ffmpeg_AudioDecoderFfmpeg_cpp @@ -0,0 +1,100 @@ +$OpenBSD: patch-libmedia_ffmpeg_AudioDecoderFfmpeg_cpp,v 1.1 2013/03/08 00:58:26 brad Exp $ + +Update for newer FFmpeg API. + +--- libmedia/ffmpeg/AudioDecoderFfmpeg.cpp.orig Thu Jan 19 14:17:48 2012 ++++ libmedia/ffmpeg/AudioDecoderFfmpeg.cpp Mon Feb 18 12:06:22 2013 +@@ -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; +@@ -131,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; +@@ -158,14 +168,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 +183,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; +@@ -254,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")); +@@ -297,7 +314,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; + } + +@@ -305,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/www/gnash/patches/patch-libmedia_ffmpeg_MediaParserFfmpeg_cpp b/www/gnash/patches/patch-libmedia_ffmpeg_MediaParserFfmpeg_cpp new file mode 100644 index 00000000000..ee23002f376 --- /dev/null +++ b/www/gnash/patches/patch-libmedia_ffmpeg_MediaParserFfmpeg_cpp @@ -0,0 +1,122 @@ +$OpenBSD: patch-libmedia_ffmpeg_MediaParserFfmpeg_cpp,v 1.1 2013/03/08 00:58:26 brad Exp $ + +Update for newer FFmpeg API. + +--- libmedia/ffmpeg/MediaParserFfmpeg.cpp.orig Thu Jan 19 14:17:48 2012 ++++ libmedia/ffmpeg/MediaParserFfmpeg.cpp Mon Feb 18 12:06:22 2013 +@@ -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,30 +644,34 @@ MediaParserFfmpeg::seekMedia(boost::int64_t offset, in + } + + boost::uint16_t +-MediaParserFfmpeg::SampleFormatToSampleSize(SampleFormat fmt) ++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 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 + } ++#endif + } + + diff --git a/www/gnash/patches/patch-libmedia_ffmpeg_MediaParserFfmpeg_h b/www/gnash/patches/patch-libmedia_ffmpeg_MediaParserFfmpeg_h new file mode 100644 index 00000000000..1bb6b9a7b51 --- /dev/null +++ b/www/gnash/patches/patch-libmedia_ffmpeg_MediaParserFfmpeg_h @@ -0,0 +1,30 @@ +$OpenBSD: patch-libmedia_ffmpeg_MediaParserFfmpeg_h,v 1.1 2013/03/08 00:58:26 brad Exp $ + +Update for newer FFmpeg API. + +--- libmedia/ffmpeg/MediaParserFfmpeg.h.orig Thu Jan 19 14:17:48 2012 ++++ libmedia/ffmpeg/MediaParserFfmpeg.h Mon Feb 18 12:06:22 2013 +@@ -154,7 +154,13 @@ class MediaParserFfmpeg: public MediaParser (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 @@ class MediaParserFfmpeg: public MediaParser (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/www/gnash/patches/patch-libmedia_ffmpeg_VideoDecoderFfmpeg_cpp b/www/gnash/patches/patch-libmedia_ffmpeg_VideoDecoderFfmpeg_cpp new file mode 100644 index 00000000000..0cf02c36e1c --- /dev/null +++ b/www/gnash/patches/patch-libmedia_ffmpeg_VideoDecoderFfmpeg_cpp @@ -0,0 +1,53 @@ +$OpenBSD: patch-libmedia_ffmpeg_VideoDecoderFfmpeg_cpp,v 1.1 2013/03/08 00:58:26 brad Exp $ + +Update for newer FFmpeg API. + +--- libmedia/ffmpeg/VideoDecoderFfmpeg.cpp.orig Thu Jan 19 14:17:49 2012 ++++ libmedia/ffmpeg/VideoDecoderFfmpeg.cpp Mon Feb 18 12:06:22 2013 +@@ -171,7 +171,10 @@ VideoDecoderFfmpeg::init(enum CodecID codecId, int /*w + 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); +@@ -180,7 +183,11 @@ VideoDecoderFfmpeg::init(enum CodecID codecId, int /*w + 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")); + } +@@ -203,7 +210,11 @@ VideoDecoderFfmpeg::init(enum CodecID codecId, int /*w + } + #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 " +@@ -529,7 +540,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/www/gnash/patches/patch-libmedia_ffmpeg_ffmpegHeaders_h b/www/gnash/patches/patch-libmedia_ffmpeg_ffmpegHeaders_h new file mode 100644 index 00000000000..07b925f0ced --- /dev/null +++ b/www/gnash/patches/patch-libmedia_ffmpeg_ffmpegHeaders_h @@ -0,0 +1,19 @@ +$OpenBSD: patch-libmedia_ffmpeg_ffmpegHeaders_h,v 1.1 2013/03/08 00:59:08 brad Exp $ +--- libmedia/ffmpeg/ffmpegHeaders.h.orig Mon Feb 18 12:04:12 2013 ++++ libmedia/ffmpeg/ffmpegHeaders.h Mon Feb 18 12:06:22 2013 +@@ -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/gnash/pkg/PLIST b/www/gnash/pkg/PLIST index 86c108c1355..4bbb0436a82 100644 --- a/www/gnash/pkg/PLIST +++ b/www/gnash/pkg/PLIST @@ -1,6 +1,4 @@ -@comment $OpenBSD: PLIST,v 1.14 2013/02/05 11:50:48 brad Exp $ -@bin bin/findmicrophones -@bin bin/findwebcams +@comment $OpenBSD: PLIST,v 1.15 2013/03/08 00:58:26 brad Exp $ bin/gnash bin/gnash-gtk-launcher @bin bin/gprocessor @@ -199,8 +197,8 @@ lib/mozilla/plugins/ lib/mozilla/plugins/libgnashplugin.so lib/pkgconfig/gnash.pc @comment @man man/man1/cygnal.1 -@man man/man1/findmicrophones.1 -@man man/man1/findwebcams.1 +@comment @man man/man1/findmicrophones.1 +@comment @man man/man1/findwebcams.1 @comment @man man/man1/flvdumper.1 @man man/man1/gnash-gtk-launcher.1 @man man/man1/gnash.1