Package: gnash Version: 0.8.10~git20110618-3 Followup-For: Bug #638247 User: ubuntu-de...@lists.ubuntu.com Usertags: origin-ubuntu oneiric ubuntu-patch
*** /tmp/tmpgCHrjT Here is the patch from Colin Watson that provides compatibility with the libav 0.7 API. Thanks for considering the patch. -- System Information: Debian Release: wheezy/sid APT prefers oneiric-updates APT policy: (500, 'oneiric-updates'), (500, 'oneiric-security'), (500, 'oneiric-proposed'), (500, 'oneiric'), (100, 'oneiric-backports') Architecture: amd64 (x86_64) Kernel: Linux 3.0.0-10-generic (SMP w/8 CPU cores) Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8) Shell: /bin/sh linked to /bin/dash
diff -Nru gnash-0.8.10~git20110618/debian/patches/libav_0.7.patch gnash-0.8.10~git20110618/debian/patches/libav_0.7.patch --- gnash-0.8.10~git20110618/debian/patches/libav_0.7.patch 1969-12-31 18:00:00.000000000 -0600 +++ gnash-0.8.10~git20110618/debian/patches/libav_0.7.patch 2011-09-11 00:35:05.000000000 -0500 @@ -0,0 +1,275 @@ +Description: Port to libav 0.7 API +Author: Colin Watson <cjwat...@ubuntu.com> +Bug-Debian: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=638247 +--- + libmedia/ffmpeg/AudioDecoderFfmpeg.cpp | 30 ++++++++++++++--- + libmedia/ffmpeg/AudioResamplerFfmpeg.cpp | 5 +- + libmedia/ffmpeg/MediaParserFfmpeg.cpp | 53 ++++++++++++++++++++++++++++++- + libmedia/ffmpeg/MediaParserFfmpeg.h | 7 ++++ + libmedia/ffmpeg/VideoDecoderFfmpeg.cpp | 12 +++++++ + macros/ffmpeg.m4 | 6 ++- + 6 files changed, 104 insertions(+), 9 deletions(-) + +Index: gnash-0.8.10~git20110618/libmedia/ffmpeg/AudioDecoderFfmpeg.cpp +=================================================================== +--- gnash-0.8.10~git20110618.orig/libmedia/ffmpeg/AudioDecoderFfmpeg.cpp ++++ gnash-0.8.10~git20110618/libmedia/ffmpeg/AudioDecoderFfmpeg.cpp +@@ -29,8 +29,6 @@ + + //#define GNASH_DEBUG_AUDIO_DECODING + +-#define AVCODEC_DECODE_AUDIO avcodec_decode_audio2 +- + namespace gnash { + namespace media { + namespace ffmpeg { +@@ -549,11 +547,22 @@ + #endif + + // older ffmpeg versions didn't accept a const input.. +- int tmp = AVCODEC_DECODE_AUDIO(_audioCodecCtx, outPtr, &outSize, +- input, inputSize); ++#if !defined (LIBAVCODEC_VERSION_MAJOR) || LIBAVCODEC_VERSION_MAJOR < 53 ++ int tmp = avcodec_decode_audio2(_audioCodecCtx, outPtr, &outSize, ++ input, inputSize); ++#else ++ AVPacket packet; ++ av_init_packet(&packet); ++ // avcodec_decode_audio3 doesn't actually change packet.data ++ packet.data = const_cast<boost::uint8_t*>(input); ++ packet.size = inputSize; ++ int tmp = avcodec_decode_audio3(_audioCodecCtx, outPtr, &outSize, &packet); ++ packet.data = NULL; ++ av_free_packet(&packet); ++#endif + + #ifdef GNASH_DEBUG_AUDIO_DECODING +- log_debug(" avcodec_decode_audio[2](ctx, bufptr, %d, input, %d) " ++ log_debug(" avcodec_decode_audio[23](ctx, bufptr, %d, input, %d) " + "returned %d; set frame_size=%d", + bufsize, inputSize, tmp, outSize); + #endif +@@ -658,6 +667,7 @@ + { + if ( _needsParsing ) + { ++#if !defined (LIBAVCODEC_VERSION_MAJOR) || LIBAVCODEC_VERSION_MAJOR < 53 + return av_parser_parse(_parser, _audioCodecCtx, + // as of 2008-10-28 SVN, ffmpeg doesn't + // accept a pointer to pointer to const.. +@@ -665,6 +675,16 @@ + outFrameSize, + input, inputSize, + 0, 0); // pts & dts ++#else ++ return av_parser_parse2(_parser, _audioCodecCtx, ++ // as of 2008-10-28 SVN, ffmpeg doesn't ++ // accept a pointer to pointer to const.. ++ const_cast<boost::uint8_t**>(outFrame), ++ outFrameSize, ++ input, inputSize, ++ 0, 0, // pts & dts ++ AV_NOPTS_VALUE); ++#endif + } + else + { +Index: gnash-0.8.10~git20110618/libmedia/ffmpeg/MediaParserFfmpeg.cpp +=================================================================== +--- gnash-0.8.10~git20110618.orig/libmedia/ffmpeg/MediaParserFfmpeg.cpp ++++ gnash-0.8.10~git20110618/libmedia/ffmpeg/MediaParserFfmpeg.cpp +@@ -341,11 +341,26 @@ + + /*private*/ + void ++MediaParserFfmpeg::logMetadataEntry(const char *format, const char* key) ++{ ++#if !defined (LIBAVUTIL_VERSION_INT) || LIBAVUTIL_VERSION_INT < AV_VERSION_INT( 51, 5, 0 ) ++ const AVMetadataTag* entry = av_metadata_get(_formatCtx->metadata, key, 0, 0); ++#else ++ const AVDictionaryEntry* entry = av_dict_get(_formatCtx->metadata, key, 0, 0); ++#endif ++ if ( entry->value[0] ) ++ log_debug(format, entry->value); ++} ++ ++/*private*/ ++void + MediaParserFfmpeg::initializeParser() + { + av_register_all(); // TODO: needs to be invoked only once ? + ++#if !defined (LIBAVFORMAT_VERSION_MAJOR) || LIBAVFORMAT_VERSION_MAJOR < 53 + _byteIOCxt.buffer = NULL; ++#endif + + _inputFmt = probeStream(); + #ifdef GNASH_ALLOW_VCODEC_ENV +@@ -375,6 +390,8 @@ + // 7th argument (NULL) is the writer function, + // which isn't needed. + _byteIOBuffer.reset( new unsigned char[byteIOBufferSize] ); ++ ++#if !defined (LIBAVFORMAT_VERSION_MAJOR) || LIBAVFORMAT_VERSION_MAJOR < 53 + init_put_byte(&_byteIOCxt, + _byteIOBuffer.get(), // buffer + byteIOBufferSize, // buffer size +@@ -386,9 +403,27 @@ + ); + + _byteIOCxt.is_streamed = 1; ++#else ++ _formatCtx->pb = avio_alloc_context( ++ _byteIOBuffer.get(), // buffer ++ byteIOBufferSize, // buffer size ++ 0, // write flags ++ this, // opaque pointer to pass to the callbacks ++ MediaParserFfmpeg::readPacketWrapper, // packet reader callback ++ NULL, // packet writer callback ++ MediaParserFfmpeg::seekMediaWrapper // seeker callback ++ ); ++ ++ _formatCtx->pb->seekable = 0; ++#endif + +- // Open the stream. the 4th argument is the filename, which we ignore. ++#if !defined (LIBAVFORMAT_VERSION_INT) || LIBAVFORMAT_VERSION_INT < AV_VERSION_INT (53, 2, 0) ++ // Open the stream. The 3rd argument is the filename, which we ignore. + if(av_open_input_stream(&_formatCtx, &_byteIOCxt, "", _inputFmt, NULL) < 0) ++#else ++ // Open the stream. The 2nd argument is the filename, which we ignore. ++ if(avformat_open_input(&_formatCtx, "", _inputFmt, NULL) < 0) ++#endif + { + throw IOException("MediaParserFfmpeg couldn't open input stream"); + } +@@ -396,6 +431,7 @@ + log_debug("Parsing FFMPEG media file: format:%s; nstreams:%d", + _inputFmt->name, _formatCtx->nb_streams); + ++#if !defined (LIBAVFORMAT_VERSION_INT) || LIBAVFORMAT_VERSION_INT < AV_VERSION_INT( 52, 31, 0 ) + if ( _formatCtx->title[0] ) + log_debug(_(" Title:'%s'"), _formatCtx->title); + if ( _formatCtx->author[0] ) +@@ -406,6 +442,13 @@ + log_debug(_(" Comment:'%s'"), _formatCtx->comment); + if ( _formatCtx->album[0] ) + log_debug(_(" Album:'%s'"), _formatCtx->album); ++#else ++ logMetadataEntry(_(" Title:'%s'"), "title"); ++ logMetadataEntry(_(" Author:'%s'"), "author"); ++ logMetadataEntry(_(" Copyright:'%s'"), "copyright"); ++ logMetadataEntry(_(" Comment:'%s'"), "comment"); ++ logMetadataEntry(_(" Album:'%s'"), "album"); ++#endif + + // Find first audio and video stream + for (unsigned int i = 0; i < static_cast<unsigned int>(_formatCtx->nb_streams); i++) +@@ -423,7 +466,11 @@ + } + + switch (enc->codec_type) { ++#if !defined (LIBAVCODEC_VERSION_MAJOR) || LIBAVCODEC_VERSION_MAJOR < 53 + case CODEC_TYPE_AUDIO: ++#else ++ case AVMEDIA_TYPE_AUDIO: ++#endif + if (_audioStreamIndex < 0) { + _audioStreamIndex = i; + _audioStream = _formatCtx->streams[i]; +@@ -433,7 +480,11 @@ + } + break; + ++#if LIBAVCODEC_VERSION_MAJOR < 53 + case CODEC_TYPE_VIDEO: ++#else ++ case AVMEDIA_TYPE_VIDEO: ++#endif + if (_videoStreamIndex < 0) { + _videoStreamIndex = i; + _videoStream = _formatCtx->streams[i]; +Index: gnash-0.8.10~git20110618/libmedia/ffmpeg/VideoDecoderFfmpeg.cpp +=================================================================== +--- gnash-0.8.10~git20110618.orig/libmedia/ffmpeg/VideoDecoderFfmpeg.cpp ++++ gnash-0.8.10~git20110618/libmedia/ffmpeg/VideoDecoderFfmpeg.cpp +@@ -356,8 +356,20 @@ + + int bytes = 0; + // no idea why avcodec_decode_video wants a non-const input... ++#if !defined (LIBAVCODEC_VERSION_MAJOR) || LIBAVCODEC_VERSION_MAJOR < 53 + avcodec_decode_video(_videoCodecCtx->getContext(), frame, &bytes, + input, input_size); ++#else ++ AVPacket packet; ++ av_init_packet(&packet); ++ // avcodec_decode_video2 doesn't actually change packet.data ++ packet.data = const_cast<boost::uint8_t*>(input); ++ packet.size = input_size; ++ avcodec_decode_video2(_videoCodecCtx->getContext(), frame, &bytes, ++ &packet); ++ packet.data = NULL; ++ av_free_packet(&packet); ++#endif + + if (!bytes) { + log_error("Decoding of a video frame failed"); +Index: gnash-0.8.10~git20110618/macros/ffmpeg.m4 +=================================================================== +--- gnash-0.8.10~git20110618.orig/macros/ffmpeg.m4 ++++ gnash-0.8.10~git20110618/macros/ffmpeg.m4 +@@ -43,7 +43,11 @@ + ffmpeg_top_incl=`dirname ${with_ffmpeg_incl}` + if test -f ${with_ffmpeg_incl}/avcodec.h; then + ac_cv_path_ffmpeg_incl="-I`(cd ${ffmpeg_top_incl}; pwd)`" +- avcodec_h=${with_ffmpeg_incl}/avcodec.h ++ if test -f ${with_ffmpeg_incl}/version.h && $EGREP LIBAVCODEC_VERSION ${with_ffmpeg_incl}/version.h >/dev/null; then ++ avcodec_h=${with_ffmpeg_incl}/version.h ++ else ++ avcodec_h=${with_ffmpeg_incl}/avcodec.h ++ fi + else + AC_MSG_ERROR([${with_ffmpeg_incl} directory does not contain the avcodec.h header]) + fi +Index: gnash-0.8.10~git20110618/libmedia/ffmpeg/MediaParserFfmpeg.h +=================================================================== +--- gnash-0.8.10~git20110618.orig/libmedia/ffmpeg/MediaParserFfmpeg.h ++++ gnash-0.8.10~git20110618/libmedia/ffmpeg/MediaParserFfmpeg.h +@@ -92,6 +92,11 @@ + + private: + ++#if defined (LIBAVFORMAT_VERSION_INT) && LIBAVFORMAT_VERSION_INT >= AV_VERSION_INT( 52, 31, 0 ) ++ /// Log debugging information about a metadata entry ++ void logMetadataEntry(const char *format, const char* key); ++#endif ++ + /// Initialize parser, figuring format and + /// creating VideoInfo and AudioInfo objects + void initializeParser(); +@@ -149,7 +154,9 @@ + AVStream* _audioStream; + + /// ? ++#if !defined (LIBAVFORMAT_VERSION_MAJOR) || LIBAVFORMAT_VERSION_MAJOR < 53 + ByteIOContext _byteIOCxt; ++#endif + + /// Size of the ByteIO context buffer + // +Index: gnash-0.8.10~git20110618/libmedia/ffmpeg/AudioResamplerFfmpeg.cpp +=================================================================== +--- gnash-0.8.10~git20110618.orig/libmedia/ffmpeg/AudioResamplerFfmpeg.cpp ++++ gnash-0.8.10~git20110618/libmedia/ffmpeg/AudioResamplerFfmpeg.cpp +@@ -46,8 +46,9 @@ + { + if ( (ctx->sample_rate != 44100) || (ctx->channels != 2) ) { + if ( ! _context ) { +- _context = audio_resample_init( +- 2, ctx->channels, 44100, ctx->sample_rate ++ _context = av_audio_resample_init( ++ 2, ctx->channels, 44100, ctx->sample_rate, ++ AV_SAMPLE_FMT_S16, AV_SAMPLE_FMT_S16, 16, 10, 0, 0.8 + ); + } + diff -Nru gnash-0.8.10~git20110618/debian/patches/series gnash-0.8.10~git20110618/debian/patches/series --- gnash-0.8.10~git20110618/debian/patches/series 2011-06-30 18:26:38.000000000 -0500 +++ gnash-0.8.10~git20110618/debian/patches/series 2011-09-11 00:32:18.000000000 -0500 @@ -1,3 +1,4 @@ 01cygnalman 02multiarch 03qtopengl +libav_0.7.patch