tags 638247 + patch
tags 638247 + pending
thanks

Dear maintainer,

I've prepared an NMU for gnash (versioned as 0.8.10~git20110618-3.1) and uploaded it to DELAYED/3. Please feel free to tell me if I should delay it longer.

--
Jakub Wilk
diffstat for gnash-0.8.10~git20110618 gnash-0.8.10~git20110618

 changelog          |    9 +
 patches/04libav0.7 |  257 +++++++++++++++++++++++++++++++++++++++++++++++++++++
 patches/series     |    1 
 3 files changed, 267 insertions(+)

diff -Nru gnash-0.8.10~git20110618/debian/changelog gnash-0.8.10~git20110618/debian/changelog
--- gnash-0.8.10~git20110618/debian/changelog	2011-07-01 01:26:38.000000000 +0200
+++ gnash-0.8.10~git20110618/debian/changelog	2011-09-19 00:09:23.000000000 +0200
@@ -1,3 +1,12 @@
+gnash (0.8.10~git20110618-3.1) unstable; urgency=low
+
+  * Non-maintainer upload.
+  * Port to libav 0.7 API (closes: #638247). Thanks to Moritz Muehlenhoff for
+    the bug report, to Colin Watson for the patch, and to Micah Gersten for
+    submitting it to the BTS.
+
+ -- Jakub Wilk <jw...@debian.org>  Mon, 19 Sep 2011 00:08:41 +0200
+
 gnash (0.8.10~git20110618-3) unstable; urgency=low
 
   * Remove opengl renderer. 
diff -Nru gnash-0.8.10~git20110618/debian/patches/04libav0.7 gnash-0.8.10~git20110618/debian/patches/04libav0.7
--- gnash-0.8.10~git20110618/debian/patches/04libav0.7	1970-01-01 01:00:00.000000000 +0100
+++ gnash-0.8.10~git20110618/debian/patches/04libav0.7	2011-09-19 00:06:56.000000000 +0200
@@ -0,0 +1,257 @@
+Description: Port to libav 0.7 API
+Author: Colin Watson <cjwat...@ubuntu.com>
+Bug-Debian: http://bugs.debian.org/638247
+Forwarded: no
+Last-Update: 2011-09-19
+
+--- a/libmedia/ffmpeg/AudioDecoderFfmpeg.cpp
++++ b/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
+     {
+--- a/libmedia/ffmpeg/MediaParserFfmpeg.cpp
++++ b/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];
+--- a/libmedia/ffmpeg/VideoDecoderFfmpeg.cpp
++++ b/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");
+--- a/macros/ffmpeg.m4
++++ b/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
+--- a/libmedia/ffmpeg/MediaParserFfmpeg.h
++++ b/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
+ 	//
+--- a/libmedia/ffmpeg/AudioResamplerFfmpeg.cpp
++++ b/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-07-01 01:26:38.000000000 +0200
+++ gnash-0.8.10~git20110618/debian/patches/series	2011-09-19 00:04:01.000000000 +0200
@@ -1,3 +1,4 @@
 01cygnalman
 02multiarch
 03qtopengl
+04libav0.7

Reply via email to