On Sun, Dec 15, 2013 at 01:58:34AM +0100, Gabriele Giacone wrote: > On Sat, Dec 14, 2013 at 5:31 PM, Adam D. Barratt > <a...@adam-barratt.org.uk> wrote: > > On Sat, 2013-12-14 at 15:46 +0100, Gabriele Giacone wrote: > >> Anything still wrong/missing here? > > > > Someone reviewing the patch, at least. > > I've preferred lazy approach: picking upstream git commit as is. IMHO > it's not worth improving it for instance by removing Ifdefs according > to specific wheezy libav{codec,util,format} versions.
Attached a smaller debdiff: removed useless ifdefs according to wheezy libav versions. libavcodec 533500 libavformat 532101 libavutil 512201 libav from wheezy-backports would break it unless one installed gnash from backports as well. Thanks for reviewing. -- G..e
diff -Nru gnash-0.8.11~git20120629/debian/changelog gnash-0.8.11~git20120629/debian/changelog --- gnash-0.8.11~git20120629/debian/changelog 2012-06-30 02:35:58.000000000 +0200 +++ gnash-0.8.11~git20120629/debian/changelog 2014-01-11 16:46:32.000000000 +0100 @@ -1,3 +1,9 @@ +gnash (0.8.11~git20120629-1+wheezy1) stable; urgency=low + + * Fix youtube movies play with ffmpeg media handler (Closes: #729995). + + -- Gabriele Giacone <1o5g4...@gmail.com> Sat, 11 Jan 2014 16:45:09 +0100 + gnash (0.8.11~git20120629-1) unstable; urgency=low * Git snapshot. diff -Nru gnash-0.8.11~git20120629/debian/patches/02fixffmpegyt gnash-0.8.11~git20120629/debian/patches/02fixffmpegyt --- gnash-0.8.11~git20120629/debian/patches/02fixffmpegyt 1970-01-01 01:00:00.000000000 +0100 +++ gnash-0.8.11~git20120629/debian/patches/02fixffmpegyt 2014-01-11 16:46:32.000000000 +0100 @@ -0,0 +1,174 @@ +Description: Fixes build and ffmpeg decoding with recent ffmpeg/libav + versions. For instance yt movies play with libav wheezy version. +Author: Alexis Ballier <aball...@gentoo.org> +Origin: http://git.savannah.gnu.org/gitweb/?p=gnash.git;a=commit;h=4b3dae970549d42723c2528c250a1f95248145c7 + +--- a/libmedia/ffmpeg/AudioDecoderFfmpeg.cpp ++++ b/libmedia/ffmpeg/AudioDecoderFfmpeg.cpp +@@ -84,8 +84,6 @@ AudioDecoderFfmpeg::~AudioDecoderFfmpeg( + + void AudioDecoderFfmpeg::setup(SoundInfo& info) + { +- // Init the avdecoder-decoder +- avcodec_init(); + avcodec_register_all();// change this to only register need codec? + + enum CodecID codec_id; +@@ -158,22 +156,20 @@ void AudioDecoderFfmpeg::setup(SoundInfo + 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; + } + } + + void AudioDecoderFfmpeg::setup(const AudioInfo& info) + { +- // Init the avdecoder-decoder +- avcodec_init(); + avcodec_register_all();// change this to only register need codec? + + enum CodecID codec_id = CODEC_ID_NONE; +@@ -297,7 +293,7 @@ void AudioDecoderFfmpeg::setup(const Aud + _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; + } + +--- a/libmedia/ffmpeg/MediaParserFfmpeg.cpp ++++ b/libmedia/ffmpeg/MediaParserFfmpeg.cpp +@@ -344,8 +344,6 @@ MediaParserFfmpeg::initializeParser() + { + av_register_all(); // TODO: needs to be invoked only once ? + +- _byteIOCxt.buffer = NULL; +- + _inputFmt = probeStream(); + + #ifdef GNASH_ALLOW_VCODEC_ENV +@@ -366,7 +364,7 @@ MediaParserFfmpeg::initializeParser() + // which isn't needed. + _byteIOBuffer.reset(new unsigned char[byteIOBufferSize]); + +- init_put_byte(&_byteIOCxt, ++ _avIOCxt = avio_alloc_context( + _byteIOBuffer.get(), // buffer + byteIOBufferSize, // buffer size + 0, // write flags +@@ -376,7 +374,7 @@ MediaParserFfmpeg::initializeParser() + MediaParserFfmpeg::seekMediaWrapper // seeker callback + ); + +- _byteIOCxt.is_streamed = 1; ++ _avIOCxt->seekable = 0; + + #if !defined(LIBAVCODEC_VERSION_MAJOR) || LIBAVCODEC_VERSION_MAJOR < 52 + // Needed for Lenny. +@@ -387,12 +385,9 @@ MediaParserFfmpeg::initializeParser() + + assert(_formatCtx); + +- // Otherwise av_open_input_stream will reallocate the context. +- AVFormatParameters ap; +- std::memset(&ap, 0, sizeof ap); +- ap.prealloced_context = 1; ++ _formatCtx->pb = _avIOCxt; + +- if (av_open_input_stream(&_formatCtx, &_byteIOCxt, "", _inputFmt, &ap) < 0) ++ if (avformat_open_input(&_formatCtx, "", _inputFmt, NULL) < 0) + { + throw IOException("MediaParserFfmpeg couldn't open input stream"); + } +@@ -400,10 +395,10 @@ 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. +- AVMetadata* md = _formatCtx->metadata; ++ AVDictionary* md = _formatCtx->metadata; + if (md) { +- AVMetadataTag* tag = av_metadata_get(md, "album", 0, +- AV_METADATA_MATCH_CASE); ++ AVDictionaryEntry* tag = av_dict_get(md, "album", 0, ++ AV_DICT_MATCH_CASE); + if (tag && tag->value) { + setId3Info(&Id3Info::album, std::string(tag->value), + _id3Object); +@@ -620,27 +615,27 @@ MediaParserFfmpeg::seekMedia(boost::int6 + } + + 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 + } +--- a/libmedia/ffmpeg/MediaParserFfmpeg.h ++++ b/libmedia/ffmpeg/MediaParserFfmpeg.h +@@ -154,7 +154,7 @@ private: + AVStream* _audioStream; + + /// ? +- ByteIOContext _byteIOCxt; ++ AVIOContext* _avIOCxt; + + /// Size of the ByteIO context buffer + // +@@ -172,7 +172,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 + // +--- a/libmedia/ffmpeg/VideoDecoderFfmpeg.cpp ++++ b/libmedia/ffmpeg/VideoDecoderFfmpeg.cpp +@@ -170,8 +170,6 @@ void + VideoDecoderFfmpeg::init(enum CodecID codecId, int /*width*/, int /*height*/, + boost::uint8_t* extradata, int extradataSize) + { +- // Init the avdecoder-decoder +- avcodec_init(); + avcodec_register_all();// change this to only register need codec? + + _videoCodec = avcodec_find_decoder(codecId); diff -Nru gnash-0.8.11~git20120629/debian/patches/series gnash-0.8.11~git20120629/debian/patches/series --- gnash-0.8.11~git20120629/debian/patches/series 2012-06-30 02:35:58.000000000 +0200 +++ gnash-0.8.11~git20120629/debian/patches/series 2014-01-11 16:46:32.000000000 +0100 @@ -1,2 +1,3 @@ 00sensible 01gprocessor +02fixffmpegyt