gnash-commit
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Gnash-commit] [SCM] Gnash branch, master, updated. e6c2e4bde0225688447d


From: Benjamin Wolsey
Subject: [Gnash-commit] [SCM] Gnash branch, master, updated. e6c2e4bde0225688447d8579f696dff10ed27e03
Date: Sat, 30 Oct 2010 08:17:25 +0000

This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "Gnash".

The branch, master has been updated
       via  e6c2e4bde0225688447d8579f696dff10ed27e03 (commit)
       via  136b669ab9ee350f5543351b6bacf204845dfeb2 (commit)
       via  37954a5dc359733057953c32a03b472675aea35a (commit)
       via  91f3b41c009daf346ffa2078dfc4711177bd6514 (commit)
       via  51d84ecd1adb1f6edfe4b91c090d3c432514b761 (commit)
       via  fc09904ad3796be1622f868d443fa0fa8395eaa3 (commit)
       via  ddfb00078eafa27116261f8c30750731d5080c84 (commit)
       via  b6015e75fcbd38ee61f85973015e343769168b04 (commit)
      from  de32b2f97740d19857b1d812b3541ae1f0034284 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
http://git.savannah.gnu.org/cgit//commit/?id=e6c2e4bde0225688447d8579f696dff10ed27e03


commit e6c2e4bde0225688447d8579f696dff10ed27e03
Author: Benjamin Wolsey <address@hidden>
Date:   Sat Oct 30 10:08:04 2010 +0200

    That made another function unused.

diff --git a/libvaapi/VaapiSurfaceGLX.cpp b/libvaapi/VaapiSurfaceGLX.cpp
index bf879f9..6d24e88 100644
--- a/libvaapi/VaapiSurfaceGLX.cpp
+++ b/libvaapi/VaapiSurfaceGLX.cpp
@@ -80,6 +80,8 @@ static inline bool gl_check_error(void)
     return gl_do_check_error(1);
 }
 
+#if 0
+
 // glGetIntegerv() wrapper
 static bool gl_get_param(GLenum param, unsigned int *pval)
 {
@@ -104,8 +106,6 @@ struct TextureState {
     unsigned int was_bound   : 1;
 };
 
-#if 0
-
 /// Bind texture, preserve previous texture state
 static bool bind_texture(TextureState *ts, GLenum target, GLuint texture)
 {

http://git.savannah.gnu.org/cgit//commit/?id=136b669ab9ee350f5543351b6bacf204845dfeb2


commit 136b669ab9ee350f5543351b6bacf204845dfeb2
Author: Benjamin Wolsey <address@hidden>
Date:   Sat Oct 30 10:06:07 2010 +0200

    Comment out unused functions; no idea what they're for.

diff --git a/libvaapi/VaapiSurfaceGLX.cpp b/libvaapi/VaapiSurfaceGLX.cpp
index be28859..bf879f9 100644
--- a/libvaapi/VaapiSurfaceGLX.cpp
+++ b/libvaapi/VaapiSurfaceGLX.cpp
@@ -104,6 +104,8 @@ struct TextureState {
     unsigned int was_bound   : 1;
 };
 
+#if 0
+
 /// Bind texture, preserve previous texture state
 static bool bind_texture(TextureState *ts, GLenum target, GLuint texture)
 {
@@ -162,6 +164,8 @@ static void unbind_texture(TextureState *ts)
     gl_check_error();
 }
 
+#endif
+
 class VaapiSurfaceGLXImpl: public VaapiSurfaceImplBase {
     void *surface() const
         { return reinterpret_cast<void *>(VaapiSurfaceImplBase::surface()); }

http://git.savannah.gnu.org/cgit//commit/?id=37954a5dc359733057953c32a03b472675aea35a


commit 37954a5dc359733057953c32a03b472675aea35a
Author: Benjamin Wolsey <address@hidden>
Date:   Sat Oct 30 10:03:39 2010 +0200

    We always support VP6.

diff --git a/libmedia/ffmpeg/VideoDecoderFfmpeg.cpp 
b/libmedia/ffmpeg/VideoDecoderFfmpeg.cpp
index 3349f75..9c5bc17 100644
--- a/libmedia/ffmpeg/VideoDecoderFfmpeg.cpp
+++ b/libmedia/ffmpeg/VideoDecoderFfmpeg.cpp
@@ -417,10 +417,8 @@ VideoDecoderFfmpeg::flashToFfmpegCodec(videoCodecType 
format)
                         // CODEC_ID_H263I didn't work with Lavc51.50.0
                         // and NetStream-SquareTest.swf
                          return CODEC_ID_FLV1;
-#ifdef FFMPEG_VP6
                 case VIDEO_CODEC_VP6:
                         return CODEC_ID_VP6F;
-#endif
 #ifdef FFMPEG_VP6A
                 case VIDEO_CODEC_VP6A:
                        return CODEC_ID_VP6A;

http://git.savannah.gnu.org/cgit//commit/?id=91f3b41c009daf346ffa2078dfc4711177bd6514


commit 91f3b41c009daf346ffa2078dfc4711177bd6514
Author: Benjamin Wolsey <address@hidden>
Date:   Sat Oct 30 10:01:20 2010 +0200

    Raise required ffmpeg version, drop warnings related to
    now-unsupported versions.

diff --git a/macros/ffmpeg.m4 b/macros/ffmpeg.m4
index d8426ca..132cec8 100644
--- a/macros/ffmpeg.m4
+++ b/macros/ffmpeg.m4
@@ -223,24 +223,12 @@ AC_DEFUN([GNASH_PATH_FFMPEG],
 
 dnl   AC_EGREP_HEADER(avcodec_decode_audio2, ${avcodec_h}, [avfound=yes], 
[avfound=no])
   
-    if test -z "$ffmpeg_num_version" -o "$ffmpeg_num_version" -lt 511100; then
-      AC_MSG_WARN([Wrong ffmpeg/libavcodec version! 51.11.0 or greater 
required, $ffmpeg_version detected.])
+    if test -z "$ffmpeg_num_version" -o "$ffmpeg_num_version" -lt 512800; then
+      AC_MSG_WARN([Wrong ffmpeg/libavcodec version! 51.28.0 or greater 
required, $ffmpeg_version detected.])
     else
       ffmpeg_version_check=ok
     fi
 
-    if test ! -z "$ffmpeg_num_version" -a "$ffmpeg_num_version" -gt 512800; 
then
-      dnl 51.28.0 or higher required
-      AC_DEFINE(FFMPEG_AUDIO2, 1, [Define if avcodec_decode_audio2 can be 
used.])
-    fi
-
-    if test -z "$ffmpeg_num_version" -o "$ffmpeg_num_version" -lt 512700; then
-      dnl 51.27.0 or higher required
-      AC_MSG_WARN([This version of ffmpeg/libavcodec ($ffmpeg_version) is not 
able to play VP6 encoded video: 51.27.0 or higher required!])
-    else
-      AC_DEFINE(FFMPEG_VP6, 1, [Define if ffmpeg can play VP6.])
-    fi
-
     if test -z "$ffmpeg_num_version" -o "$ffmpeg_num_version" -lt 514900; then
       dnl 51.49.0 or higher required
       AC_MSG_WARN([This version of ffmpeg/libavcodec ($ffmpeg_version) is not 
able to play VP6A encoded video: 51.49.0 or higher required!])

http://git.savannah.gnu.org/cgit//commit/?id=51d84ecd1adb1f6edfe4b91c090d3c432514b761


commit 51d84ecd1adb1f6edfe4b91c090d3c432514b761
Author: Benjamin Wolsey <address@hidden>
Date:   Sat Oct 30 10:01:07 2010 +0200

    Drop const_cast.

diff --git a/libmedia/ffmpeg/AudioDecoderFfmpeg.cpp 
b/libmedia/ffmpeg/AudioDecoderFfmpeg.cpp
index c513586..625eb47 100644
--- a/libmedia/ffmpeg/AudioDecoderFfmpeg.cpp
+++ b/libmedia/ffmpeg/AudioDecoderFfmpeg.cpp
@@ -540,8 +540,7 @@ AudioDecoderFfmpeg::decodeFrame(const boost::uint8_t* input,
 
     // older ffmpeg versions didn't accept a const input..
     int tmp = AVCODEC_DECODE_AUDIO(_audioCodecCtx, outPtr, &outSize,
-                                   const_cast<boost::uint8_t*>(input),
-                                   inputSize);
+                                   input, inputSize);
 
 #ifdef GNASH_DEBUG_AUDIO_DECODING
     log_debug(" avcodec_decode_audio[2](ctx, bufptr, %d, input, %d) "

http://git.savannah.gnu.org/cgit//commit/?id=fc09904ad3796be1622f868d443fa0fa8395eaa3


commit fc09904ad3796be1622f868d443fa0fa8395eaa3
Author: Benjamin Wolsey <address@hidden>
Date:   Sat Oct 30 09:53:41 2010 +0200

    Tabs to spaces.

diff --git a/libmedia/ffmpeg/AudioDecoderFfmpeg.cpp 
b/libmedia/ffmpeg/AudioDecoderFfmpeg.cpp
index 3fdb563..c513586 100644
--- a/libmedia/ffmpeg/AudioDecoderFfmpeg.cpp
+++ b/libmedia/ffmpeg/AudioDecoderFfmpeg.cpp
@@ -34,12 +34,12 @@
 namespace gnash {
 namespace media {
 namespace ffmpeg {
-       
+    
 AudioDecoderFfmpeg::AudioDecoderFfmpeg(const AudioInfo& info)
-       :
-       _audioCodec(NULL),
-       _audioCodecCtx(NULL),
-       _parser(NULL),
+    :
+    _audioCodec(NULL),
+    _audioCodecCtx(NULL),
+    _parser(NULL),
     _needsParsing(false)
 {
     setup(info);
@@ -56,98 +56,98 @@ AudioDecoderFfmpeg::AudioDecoderFfmpeg(const AudioInfo& 
info)
 }
 
 AudioDecoderFfmpeg::AudioDecoderFfmpeg(SoundInfo& info)
-       :
-       _audioCodec(NULL),
-       _audioCodecCtx(NULL),
-       _parser(NULL)
+    :
+    _audioCodec(NULL),
+    _audioCodecCtx(NULL),
+    _parser(NULL)
 {
     setup(info);
 
-       log_debug(_("AudioDecoderFfmpeg: initialized FFmpeg codec %s (%d)"),
-               _audioCodec->name, _audioCodec->id);
+      log_debug(_("AudioDecoderFfmpeg: initialized FFmpeg codec %s (%d)"),
+        _audioCodec->name, _audioCodec->id);
 }
 
 AudioDecoderFfmpeg::~AudioDecoderFfmpeg()
 {
-       if (_audioCodecCtx)
-       {
-               avcodec_close(_audioCodecCtx);
-               av_free(_audioCodecCtx);
-       }
-       if (_parser) av_parser_close(_parser);
+    if (_audioCodecCtx)
+    {
+        avcodec_close(_audioCodecCtx);
+        av_free(_audioCodecCtx);
+    }
+    if (_parser) av_parser_close(_parser);
 }
 
 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;
-
-       switch(info.getFormat()) {
-               case AUDIO_CODEC_RAW:
-                       codec_id = CODEC_ID_PCM_U16LE;
-                       break;
-               case AUDIO_CODEC_ADPCM:
-                       codec_id = CODEC_ID_ADPCM_SWF;
-                       break;
-               case AUDIO_CODEC_MP3:
-                       codec_id = CODEC_ID_MP3;
+    // Init the avdecoder-decoder
+    avcodec_init();
+    avcodec_register_all();// change this to only register need codec?
+
+    enum CodecID codec_id;
+
+    switch(info.getFormat()) {
+        case AUDIO_CODEC_RAW:
+            codec_id = CODEC_ID_PCM_U16LE;
+            break;
+        case AUDIO_CODEC_ADPCM:
+            codec_id = CODEC_ID_ADPCM_SWF;
+            break;
+        case AUDIO_CODEC_MP3:
+            codec_id = CODEC_ID_MP3;
             _needsParsing=true;
-                       break;
+            break;
         case AUDIO_CODEC_AAC:
             codec_id = CODEC_ID_AAC;
             _needsParsing=true;
-                       break;
-               default:
-                       boost::format err = boost::format(
-                               _("Unsupported audio codec %d")) %
-                               static_cast<int>(info.getFormat());
-                       throw MediaException(err.str());
-       }
-
-       _audioCodec = avcodec_find_decoder(codec_id);
-       if (!_audioCodec) {
-               audioCodecType codec = info.getFormat();
-               boost::format err = boost::format(
-                       _("libavcodec could not find a decoder for codec %d 
(%s)")) %
-                       static_cast<int>(codec) % codec;
-               throw MediaException(err.str());
-       }
+            break;
+        default:
+            boost::format err = boost::format(
+                _("Unsupported audio codec %d")) %
+                static_cast<int>(info.getFormat());
+            throw MediaException(err.str());
+    }
+
+    _audioCodec = avcodec_find_decoder(codec_id);
+    if (!_audioCodec) {
+        audioCodecType codec = info.getFormat();
+        boost::format err = boost::format(
+            _("libavcodec could not find a decoder for codec %d (%s)")) %
+            static_cast<int>(codec) % codec;
+        throw MediaException(err.str());
+    }
 
     if ( _needsParsing )
     {
-               // Init the parser
-               _parser = av_parser_init(codec_id);
-               if (!_parser) { 
+        // Init the parser
+        _parser = av_parser_init(codec_id);
+        if (!_parser) {    
         throw MediaException(_("AudioDecoderFfmpeg can't initialize "
                     "MP3 parser"));
-               }
+        }
     }
 
-       _audioCodecCtx = avcodec_alloc_context();
-       if (!_audioCodecCtx) {
-               throw MediaException(_("libavcodec couldn't allocate context"));
-       }
+    _audioCodecCtx = avcodec_alloc_context();
+    if (!_audioCodecCtx) {
+        throw MediaException(_("libavcodec couldn't allocate context"));
+    }
 
-       int ret = avcodec_open(_audioCodecCtx, _audioCodec);
-       if (ret < 0) {
-               av_free(_audioCodecCtx);
-               _audioCodecCtx=0;
+    int ret = avcodec_open(_audioCodecCtx, _audioCodec);
+    if (ret < 0) {
+        av_free(_audioCodecCtx);
+        _audioCodecCtx=0;
         boost::format err = boost::format(
             _("AudioDecoderFfmpeg: avcodec_open failed to initialize "
             "FFmpeg codec %s (%d)")) % _audioCodec->name % (int)codec_id;
-       throw MediaException(err.str());
-       }
+        throw MediaException(err.str());
+    }
 
     /// @todo do this only if !_needsParsing ?
-       switch (_audioCodecCtx->codec->id)
+    switch (_audioCodecCtx->codec->id)
     {
             case CODEC_ID_MP3:
                 break;
 
-                       case CODEC_ID_PCM_U16LE:
+            case CODEC_ID_PCM_U16LE:
                 _audioCodecCtx->channels = (info.isStereo() ? 2 : 1);
                 _audioCodecCtx->sample_rate = info.getSampleRate();
                 _audioCodecCtx->sample_fmt = SAMPLE_FMT_S16; // ?! arbitrary ?
@@ -159,93 +159,93 @@ void AudioDecoderFfmpeg::setup(SoundInfo& info)
                 _audioCodecCtx->sample_rate = info.getSampleRate();
                 _audioCodecCtx->sample_fmt = 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?
+    // Init the avdecoder-decoder
+    avcodec_init();
+    avcodec_register_all();// change this to only register need codec?
 
-       enum CodecID codec_id = CODEC_ID_NONE;
+    enum CodecID codec_id = CODEC_ID_NONE;
 
-       if (info.type == CODEC_TYPE_CUSTOM)
-       {
-               codec_id = static_cast<CodecID>(info.codec);
+    if (info.type == CODEC_TYPE_CUSTOM)
+    {
+        codec_id = static_cast<CodecID>(info.codec);
         _needsParsing=true; // @todo check this !
-       }
-       else if (info.type == CODEC_TYPE_FLASH)
-       {
-
-               switch(info.codec)
-               {
-                       case AUDIO_CODEC_RAW:
-                               codec_id = CODEC_ID_PCM_U16LE;
-                               break;
-
-                       case AUDIO_CODEC_ADPCM:
-                               codec_id = CODEC_ID_ADPCM_SWF;
-                               break;
-
-                       case AUDIO_CODEC_MP3:
-                               codec_id = CODEC_ID_MP3;
+    }
+    else if (info.type == CODEC_TYPE_FLASH)
+    {
+
+        switch(info.codec)
+        {
+            case AUDIO_CODEC_RAW:
+                codec_id = CODEC_ID_PCM_U16LE;
+                break;
+
+            case AUDIO_CODEC_ADPCM:
+                codec_id = CODEC_ID_ADPCM_SWF;
+                break;
+
+            case AUDIO_CODEC_MP3:
+                codec_id = CODEC_ID_MP3;
                 _needsParsing=true;
-                               break;
+                break;
 
-                       case AUDIO_CODEC_AAC:
-                               codec_id = CODEC_ID_AAC;
+            case AUDIO_CODEC_AAC:
+                codec_id = CODEC_ID_AAC;
                 _needsParsing=true;
-                               break;
+                break;
 
 #ifdef FFMPEG_NELLYMOSER
-                       // NOTE: bjacques found this failing in decodeFrame
-                       //       (but probably not Ffmpeg's fault, he said)
-                       //       I'd like to take a look at the testcase --strk
-                       case AUDIO_CODEC_NELLYMOSER:
-                       codec_id = CODEC_ID_NELLYMOSER;
-                               // needs parsing ?
-                               break;
+            // NOTE: bjacques found this failing in decodeFrame
+            //       (but probably not Ffmpeg's fault, he said)
+            //       I'd like to take a look at the testcase --strk
+            case AUDIO_CODEC_NELLYMOSER:
+                codec_id = CODEC_ID_NELLYMOSER;
+                // needs parsing ?
+                break;
 #endif
 
-                       default:
-                           boost::format err = boost::format(
-                               _("AudioDecoderFfmpeg: unsupported flash audio "
+            default:
+                boost::format err = boost::format(
+                    _("AudioDecoderFfmpeg: unsupported flash audio "
                         "codec %d (%s)")) %
                         info.codec % (audioCodecType)info.codec;
-                           throw MediaException(err.str());
-               }
-       }
-       else
-       {
-               boost::format err = boost::format(
-                   _("AudioDecoderFfmpeg: unknown codec type %d "
-                   "(should never happen)")) % info.type;
-               throw MediaException(err.str());
-       }
-
-       _audioCodec = avcodec_find_decoder(codec_id);
-       if (!_audioCodec)
-       {
-               if (info.type == CODEC_TYPE_FLASH) {
-                       boost::format err = boost::format(
-                               _("AudioDecoderFfmpeg: libavcodec could not 
find a decoder "
+                throw MediaException(err.str());
+        }
+    }
+    else
+    {
+        boost::format err = boost::format(
+            _("AudioDecoderFfmpeg: unknown codec type %d "
+            "(should never happen)")) % info.type;
+        throw MediaException(err.str());
+    }
+
+    _audioCodec = avcodec_find_decoder(codec_id);
+    if (!_audioCodec)
+    {
+        if (info.type == CODEC_TYPE_FLASH) {
+            boost::format err = boost::format(
+                _("AudioDecoderFfmpeg: libavcodec could not find a decoder "
                     "for codec %d (%s)")) %
                     info.codec % static_cast<audioCodecType>(info.codec);
-                       throw MediaException(err.str());
-               } else {
-                       boost::format err = boost::format(
-                               _("AudioDecoderFfmpeg: libavcodec could not 
find a decoder "
+            throw MediaException(err.str());
+        } else {
+            boost::format err = boost::format(
+                _("AudioDecoderFfmpeg: libavcodec could not find a decoder "
                     "for ffmpeg codec id %s")) % codec_id;
-                       throw MediaException(err.str());
-               }
-       }
+            throw MediaException(err.str());
+        }
+    }
 
-       // Init the parser
+    // Init the parser
     if (_needsParsing)
     {
 #ifdef GNASH_DEBUG_AUDIO_DECODING
-           log_debug("  Initializing ffmpeg parser");
+        log_debug("  Initializing ffmpeg parser");
 #endif // GNASH_DEBUG_AUDIO_DECODING
         _parser = av_parser_init(codec_id);
         if (!_parser) {
@@ -263,42 +263,42 @@ void AudioDecoderFfmpeg::setup(const AudioInfo& info)
             throw MediaException(err.str());
         }
 #ifdef GNASH_DEBUG_AUDIO_DECODING
-           log_debug("  Ffmpeg parser initialized");
+        log_debug("  Ffmpeg parser initialized");
 #endif // GNASH_DEBUG_AUDIO_DECODING
     }
 
-       // Create an audioCodecCtx from the ffmpeg parser if exists/possible
-       _audioCodecCtx = avcodec_alloc_context();
-       if (!_audioCodecCtx) {
-               throw MediaException(_("AudioDecoderFfmpeg: libavcodec couldn't 
"
+    // Create an audioCodecCtx from the ffmpeg parser if exists/possible
+    _audioCodecCtx = avcodec_alloc_context();
+    if (!_audioCodecCtx) {
+        throw MediaException(_("AudioDecoderFfmpeg: libavcodec couldn't "
                     "allocate context"));
-       }
+    }
 
-       if ( info.extra.get() )
-       {
-               if (dynamic_cast<ExtraAudioInfoFfmpeg*>(info.extra.get())) {
-                       const ExtraAudioInfoFfmpeg& ei = 
+    if ( info.extra.get() )
+    {
+        if (dynamic_cast<ExtraAudioInfoFfmpeg*>(info.extra.get())) {
+            const ExtraAudioInfoFfmpeg& ei = 
                 static_cast<ExtraAudioInfoFfmpeg&>(*info.extra);
-                       _audioCodecCtx->extradata = ei.data;
-                       _audioCodecCtx->extradata_size = ei.dataSize;
-               } else if (dynamic_cast<ExtraAudioInfoFlv*>(info.extra.get())) {
-                       ExtraAudioInfoFlv* extra = 
+            _audioCodecCtx->extradata = ei.data;
+            _audioCodecCtx->extradata_size = ei.dataSize;
+        } else if (dynamic_cast<ExtraAudioInfoFlv*>(info.extra.get())) {
+            ExtraAudioInfoFlv* extra = 
                 static_cast<ExtraAudioInfoFlv*>(info.extra.get());
-                       _audioCodecCtx->extradata = extra->data.get();
-                       _audioCodecCtx->extradata_size = extra->size;
-               }
-       }
+            _audioCodecCtx->extradata = extra->data.get();
+            _audioCodecCtx->extradata_size = extra->size;
+        }
+    }
 
     // Setup known configurations for the audio codec context
     // (should this be done only if ! _needsParsing?)
     // NOTE: this is done before calling avcodec_open, as that might update
     //       some of the variables
-       switch (codec_id)
+    switch (codec_id)
     {
             case CODEC_ID_MP3:
                 break;
 
-                       case CODEC_ID_PCM_U16LE:
+            case CODEC_ID_PCM_U16LE:
                 _audioCodecCtx->channels = (info.stereo ? 2 : 1);
                 _audioCodecCtx->sample_rate = info.sampleRate;
                 // was commented out (why?):
@@ -312,23 +312,23 @@ void AudioDecoderFfmpeg::setup(const AudioInfo& info)
                 // was commented out (why?):
                 _audioCodecCtx->sample_fmt = SAMPLE_FMT_S16; 
                 break;
-       }
+    }
 
 
 #ifdef GNASH_DEBUG_AUDIO_DECODING
-       log_debug("  Opening codec");
+    log_debug("  Opening codec");
 #endif // GNASH_DEBUG_AUDIO_DECODING
-       int ret = avcodec_open(_audioCodecCtx, _audioCodec);
-       if (ret < 0) {
-               //avcodec_close(_audioCodecCtx);
-               av_free(_audioCodecCtx);
-               _audioCodecCtx = 0;
-
-               boost::format err = boost::format(
-                       _("AudioDecoderFfmpeg: avcodec_open failed to 
initialize "
-                       "FFmpeg codec %s (%d)")) % _audioCodec->name % 
(int)codec_id;
-               throw MediaException(err.str());
-       }
+    int ret = avcodec_open(_audioCodecCtx, _audioCodec);
+    if (ret < 0) {
+        //avcodec_close(_audioCodecCtx);
+        av_free(_audioCodecCtx);
+        _audioCodecCtx = 0;
+
+        boost::format err = boost::format(
+            _("AudioDecoderFfmpeg: avcodec_open failed to initialize "
+            "FFmpeg codec %s (%d)")) % _audioCodec->name % (int)codec_id;
+        throw MediaException(err.str());
+    }
 
 }
 
@@ -338,16 +338,16 @@ AudioDecoderFfmpeg::decode(const boost::uint8_t* input,
         outputSize, boost::uint32_t& decodedBytes,
         bool parse)
 {
-       //GNASH_REPORT_FUNCTION;
+    //GNASH_REPORT_FUNCTION;
 
-       if ( ! parse )
-       {
+    if ( ! parse )
+    {
         if ( _needsParsing )
         {
             log_error("AudioDecoderFfmpeg::decode called with 'parse' "
                 "parameter off but we know we need parsing for this codec");
         }
-       }
+    }
     else
     {
         if ( !_needsParsing )
@@ -360,21 +360,21 @@ AudioDecoderFfmpeg::decode(const boost::uint8_t* input,
         }
     }
 
-       size_t retCapacity = AVCODEC_MAX_AUDIO_FRAME_SIZE;
-       boost::uint8_t* retBuf = new boost::uint8_t[retCapacity];
-       int retBufSize = 0;
+    size_t retCapacity = AVCODEC_MAX_AUDIO_FRAME_SIZE;
+    boost::uint8_t* retBuf = new boost::uint8_t[retCapacity];
+    int retBufSize = 0;
 
 #ifdef GNASH_DEBUG_AUDIO_DECODING
-       log_debug("  Parsing loop starts, input is %d bytes, retCapacity is %d "
+    log_debug("  Parsing loop starts, input is %d bytes, retCapacity is %d "
             "bytes", inputSize, retCapacity);
 #endif
-       decodedBytes = 0; // nothing decoded yet
-       while (decodedBytes < inputSize)
-       {
-               const boost::uint8_t* frame=0; // parsed frame (pointer into 
input)
-               int framesize; // parsed frame size
+    decodedBytes = 0; // nothing decoded yet
+    while (decodedBytes < inputSize)
+    {
+        const boost::uint8_t* frame=0; // parsed frame (pointer into input)
+        int framesize; // parsed frame size
 
-               int consumed = parseInput(input+decodedBytes,
+        int consumed = parseInput(input+decodedBytes,
                              inputSize-decodedBytes,
                              &frame, &framesize);
         if (consumed < 0)
@@ -389,24 +389,24 @@ AudioDecoderFfmpeg::decode(const boost::uint8_t* input,
         }
 
 #ifdef GNASH_DEBUG_AUDIO_DECODING
-               log_debug("   parsed frame is %d bytes (consumed +%d = %d/%d)",
+        log_debug("   parsed frame is %d bytes (consumed +%d = %d/%d)",
                 framesize, consumed, decodedBytes+consumed, inputSize);
 #endif
 
 #if GNASH_PARANOIA_LEVEL > 1
-               if ( frame )
-               {
-                       // the returned frame pointer is inside the input buffer
-                       assert(frame == input+decodedBytes);
-                       // the returned frame size is within the input size
-                       assert(framesize <= inputSize);
-               }
+        if ( frame )
+        {
+            // the returned frame pointer is inside the input buffer
+            assert(frame == input+decodedBytes);
+            // the returned frame size is within the input size
+            assert(framesize <= inputSize);
+        }
 #endif
 
-               // all good so far, keep going..
-               // (we might do this immediately, as we'll override decodedBytes
+        // all good so far, keep going..
+        // (we might do this immediately, as we'll override decodedBytes
         // on error anyway)
-               decodedBytes += consumed;
+        decodedBytes += consumed;
 
         if ( ! framesize )
         {
@@ -442,60 +442,60 @@ AudioDecoderFfmpeg::decode(const boost::uint8_t* input,
         }
 
 
-               // Now, decode the frame. We use the ::decodeFrame specialized 
function
-               // here so resampling is done appropriately
-               boost::uint32_t outSize = 0;
-               boost::scoped_array<boost::uint8_t> outBuf(
+        // Now, decode the frame. We use the ::decodeFrame specialized function
+        // here so resampling is done appropriately
+        boost::uint32_t outSize = 0;
+        boost::scoped_array<boost::uint8_t> outBuf(
                 decodeFrame(frame, framesize, outSize));
 
-               if (!outBuf)
-               {
-                       // Setting data position to data size will get the 
sound removed
-                       // from the active sound list later on.
-                       decodedBytes = inputSize;
-                       break;
-               }
+        if (!outBuf)
+        {
+            // Setting data position to data size will get the sound removed
+            // from the active sound list later on.
+            decodedBytes = inputSize;
+            break;
+        }
 
 #ifdef GNASH_DEBUG_AUDIO_DECODING
-               log_debug("   decoded frame is %d bytes, would grow return "
+        log_debug("   decoded frame is %d bytes, would grow return "
                 "buffer size to %d bytes", outSize,
                 retBufSize+static_cast<unsigned int>(outSize));
 #endif 
 
-               //
-               // Now append this data to the buffer we're going to return
-               //
+        //
+        // Now append this data to the buffer we're going to return
+        //
 
-               // if the new data doesn't fit, reallocate the output
-               // TODO: can use the Buffer class here.. if we return it too...
-               if ( retBufSize+(unsigned)outSize > retCapacity )
-               {
+        // if the new data doesn't fit, reallocate the output
+        // TODO: can use the Buffer class here.. if we return it too...
+        if ( retBufSize+(unsigned)outSize > retCapacity )
+        {
 #ifdef GNASH_DEBUG_AUDIO_DECODING
-                       log_debug("    output buffer won't be able to hold %d 
bytes, "
+            log_debug("    output buffer won't be able to hold %d bytes, "
                     "capacity is only %d bytes",
                     retBufSize+(unsigned)outSize, retCapacity);
 #endif 
 
             boost::uint8_t* tmp = retBuf;
-                       retCapacity = 
std::max(retBufSize+static_cast<size_t>(outSize),
+            retCapacity = std::max(retBufSize+static_cast<size_t>(outSize),
                     retCapacity * 2);
 
 #ifdef GNASH_DEBUG_AUDIO_DECODING
-                       log_debug("    reallocating it to hold up to %d bytes",
+            log_debug("    reallocating it to hold up to %d bytes",
                     retCapacity);
 #endif // GNASH_DEBUG_AUDIO_DECODING
 
             retBuf = new boost::uint8_t[retCapacity];
-                       if ( retBufSize ) std::copy(tmp, tmp+retBufSize, 
retBuf);
-                       delete [] tmp;
+            if ( retBufSize ) std::copy(tmp, tmp+retBufSize, retBuf);
+            delete [] tmp;
         }
-               std::copy(outBuf.get(), outBuf.get()+outSize, 
retBuf+retBufSize);
-               retBufSize += static_cast<unsigned int>(outSize);
-       }
+        std::copy(outBuf.get(), outBuf.get()+outSize, retBuf+retBufSize);
+        retBufSize += static_cast<unsigned int>(outSize);
+    }
 
-       
-       outputSize = retBufSize;
-       return retBuf;
+    
+    outputSize = retBufSize;
+    return retBuf;
 
 }
 
@@ -503,34 +503,34 @@ boost::uint8_t*
 AudioDecoderFfmpeg::decode(const EncodedAudioFrame& ef,
         boost::uint32_t& outputSize)
 {
-       return decodeFrame(ef.data.get(), ef.dataSize, outputSize);
+    return decodeFrame(ef.data.get(), ef.dataSize, outputSize);
 }
 
 boost::uint8_t*
 AudioDecoderFfmpeg::decodeFrame(const boost::uint8_t* input,
         boost::uint32_t inputSize, boost::uint32_t& outputSize)
 {
-       //GNASH_REPORT_FUNCTION;
+    //GNASH_REPORT_FUNCTION;
 
     assert(inputSize);
 
     const size_t bufsize = AVCODEC_MAX_AUDIO_FRAME_SIZE;
 
-       // TODO: make this a private member, to reuse (see NetStreamFfmpeg in 
0.8.3)
+    // TODO: make this a private member, to reuse (see NetStreamFfmpeg in 
0.8.3)
     boost::uint8_t* output;
 
-       output = reinterpret_cast<boost::uint8_t*>(av_malloc(bufsize));
-       if (!output) {
-           log_error(_("failed to allocate audio buffer."));
-           outputSize = 0;
-           return NULL;
-       }
+    output = reinterpret_cast<boost::uint8_t*>(av_malloc(bufsize));
+    if (!output) {
+        log_error(_("failed to allocate audio buffer."));
+        outputSize = 0;
+        return NULL;
+    }
 
     boost::int16_t* outPtr = reinterpret_cast<boost::int16_t*>(output);
 
-       // We initialize output size to the full size
-       // then decoding will eventually reduce it
-       int outSize = bufsize; 
+    // We initialize output size to the full size
+    // then decoding will eventually reduce it
+    int outSize = bufsize; 
 
 #ifdef GNASH_DEBUG_AUDIO_DECODING
     log_debug("AudioDecoderFfmpeg: about to decode %d bytes; "
@@ -539,105 +539,105 @@ AudioDecoderFfmpeg::decodeFrame(const boost::uint8_t* 
input,
 #endif
 
     // older ffmpeg versions didn't accept a const input..
-       int tmp = AVCODEC_DECODE_AUDIO(_audioCodecCtx, outPtr, &outSize,
+    int tmp = AVCODEC_DECODE_AUDIO(_audioCodecCtx, outPtr, &outSize,
                                    const_cast<boost::uint8_t*>(input),
                                    inputSize);
 
 #ifdef GNASH_DEBUG_AUDIO_DECODING
-       log_debug(" avcodec_decode_audio[2](ctx, bufptr, %d, input, %d) "
+    log_debug(" avcodec_decode_audio[2](ctx, bufptr, %d, input, %d) "
             "returned %d; set frame_size=%d",
-                   bufsize, inputSize, tmp, outSize);
+            bufsize, inputSize, tmp, outSize);
 #endif
 
-       if (tmp < 0) {
-               log_error(_("avcodec_decode_audio returned %d. Upgrading "
+    if (tmp < 0) {
+        log_error(_("avcodec_decode_audio returned %d. Upgrading "
                     "ffmpeg/libavcodec might fix this issue."), tmp);
-               outputSize = 0;
+        outputSize = 0;
 
         av_free(output);
-       }
+    }
 
-       if (outSize < 2) {
-               log_error(_("outputSize:%d after decoding %d bytes of input 
audio "
+    if (outSize < 2) {
+        log_error(_("outputSize:%d after decoding %d bytes of input audio "
                     "data. Upgrading ffmpeg/libavcodec might fix this issue."),
-                               outputSize, inputSize);
-               outputSize = 0;
+                    outputSize, inputSize);
+        outputSize = 0;
 
         av_free(output);
-       }
+    }
 
-       // Resampling is needed.
-       if (_resampler.init(_audioCodecCtx)) {
-               // Resampling is needed.
+    // Resampling is needed.
+    if (_resampler.init(_audioCodecCtx)) {
+        // Resampling is needed.
 
-               // Compute new size based on frame_size and
-               // resampling configuration
-               double resampleFactor = (44100.0/_audioCodecCtx->sample_rate) * 
(2.0/_audioCodecCtx->channels);
-               bool stereo = _audioCodecCtx->channels > 1 ? true : false;
-               int inSamples = stereo ? outSize >> 2 : outSize >> 1;
+        // Compute new size based on frame_size and
+        // resampling configuration
+        double resampleFactor = (44100.0/_audioCodecCtx->sample_rate) * 
(2.0/_audioCodecCtx->channels);
+        bool stereo = _audioCodecCtx->channels > 1 ? true : false;
+        int inSamples = stereo ? outSize >> 2 : outSize >> 1;
 
-               int expectedMaxOutSamples = std::ceil(inSamples*resampleFactor);
+        int expectedMaxOutSamples = std::ceil(inSamples*resampleFactor);
 
-               // *channels *sampleSize 
-               int resampledFrameSize = expectedMaxOutSamples*2*2;
+        // *channels *sampleSize 
+        int resampledFrameSize = expectedMaxOutSamples*2*2;
 
-               // Allocate just the required amount of bytes
-               boost::uint8_t* resampledOutput = new 
boost::uint8_t[resampledFrameSize]; 
+        // Allocate just the required amount of bytes
+        boost::uint8_t* resampledOutput = new 
boost::uint8_t[resampledFrameSize]; 
 
 #ifdef GNASH_DEBUG_AUDIO_DECODING
-               log_debug("Calling the resampler; resampleFactor:%d; "
-                       "ouput to 44100hz, 2channels, %dbytes; "
-                       "input is %dhz, %dchannels, %dbytes, %dsamples",
-                       resampleFactor,
-                       resampledFrameSize, _audioCodecCtx->sample_rate,
-                       _audioCodecCtx->channels, outSize, inSamples);
+        log_debug("Calling the resampler; resampleFactor:%d; "
+            "ouput to 44100hz, 2channels, %dbytes; "
+            "input is %dhz, %dchannels, %dbytes, %dsamples",
+            resampleFactor,
+            resampledFrameSize, _audioCodecCtx->sample_rate,
+            _audioCodecCtx->channels, outSize, inSamples);
 #endif
 
-               int outSamples = _resampler.resample(outPtr, // input
-                       reinterpret_cast<boost::int16_t*>(resampledOutput), // 
output
-                       inSamples); // input..
+        int outSamples = _resampler.resample(outPtr, // input
+            reinterpret_cast<boost::int16_t*>(resampledOutput), // output
+            inSamples); // input..
 
 #ifdef GNASH_DEBUG_AUDIO_DECODING
-               log_debug("resampler returned %d samples ", outSamples);
+        log_debug("resampler returned %d samples ", outSamples);
 #endif
 
-               // make sure to set outPtr *after* we use it as input to the 
resampler
+        // make sure to set outPtr *after* we use it as input to the resampler
         outPtr = reinterpret_cast<boost::int16_t*>(resampledOutput);
 
         av_free(output);
 
-               if (expectedMaxOutSamples < outSamples) {
-                       log_error(" --- Computation of resampled samples (%d) < 
then the actual returned samples (%d)",
-                               expectedMaxOutSamples, outSamples);
-
-                       log_debug(" input frame size: %d", outSize);
-                       log_debug(" input sample rate: %d", 
_audioCodecCtx->sample_rate);
-                       log_debug(" input channels: %d", 
_audioCodecCtx->channels);
-                       log_debug(" input samples: %d", inSamples);
-
-                       log_debug(" output sample rate (assuming): %d", 44100);
-                       log_debug(" output channels (assuming): %d", 2);
-                       log_debug(" output samples: %d", outSamples);
-
-                       /// Memory errors...
-                       abort();
-               }
-
-               // Use the actual number of samples returned, multiplied
-               // to get size in bytes (not two-byte samples) and for 
-               // stereo?
-               outSize = outSamples * 2 * 2;
-
-       }
-       else {
-           boost::uint8_t* newOutput = new boost::uint8_t[outSize];
-           std::memcpy(newOutput, output, outSize);
-           outPtr = reinterpret_cast<boost::int16_t*>(newOutput);
+        if (expectedMaxOutSamples < outSamples) {
+            log_error(" --- Computation of resampled samples (%d) < then the 
actual returned samples (%d)",
+                expectedMaxOutSamples, outSamples);
+
+            log_debug(" input frame size: %d", outSize);
+            log_debug(" input sample rate: %d", _audioCodecCtx->sample_rate);
+            log_debug(" input channels: %d", _audioCodecCtx->channels);
+            log_debug(" input samples: %d", inSamples);
+
+            log_debug(" output sample rate (assuming): %d", 44100);
+            log_debug(" output channels (assuming): %d", 2);
+            log_debug(" output samples: %d", outSamples);
+
+            /// Memory errors...
+            abort();
+        }
+
+        // Use the actual number of samples returned, multiplied
+        // to get size in bytes (not two-byte samples) and for 
+        // stereo?
+        outSize = outSamples * 2 * 2;
+
+    }
+    else {
+        boost::uint8_t* newOutput = new boost::uint8_t[outSize];
+        std::memcpy(newOutput, output, outSize);
+        outPtr = reinterpret_cast<boost::int16_t*>(newOutput);
         av_free(output);
-       }
+    }
 
-       outputSize = outSize;
-       return reinterpret_cast<uint8_t*>(outPtr);
+    outputSize = outSize;
+    return reinterpret_cast<uint8_t*>(outPtr);
 }
 
 int

http://git.savannah.gnu.org/cgit//commit/?id=ddfb00078eafa27116261f8c30750731d5080c84


commit ddfb00078eafa27116261f8c30750731d5080c84
Author: Benjamin Wolsey <address@hidden>
Date:   Sat Oct 30 09:52:51 2010 +0200

    Drop support for avcodec_decode_audio (Debian stable has the newer
    function).

diff --git a/libmedia/ffmpeg/AudioDecoderFfmpeg.cpp 
b/libmedia/ffmpeg/AudioDecoderFfmpeg.cpp
index 12cb899..3fdb563 100644
--- a/libmedia/ffmpeg/AudioDecoderFfmpeg.cpp
+++ b/libmedia/ffmpeg/AudioDecoderFfmpeg.cpp
@@ -29,11 +29,7 @@
 
 //#define GNASH_DEBUG_AUDIO_DECODING
 
-#ifdef FFMPEG_AUDIO2
-# define AVCODEC_DECODE_AUDIO avcodec_decode_audio2
-#else
-# define AVCODEC_DECODE_AUDIO avcodec_decode_audio
-#endif
+#define AVCODEC_DECODE_AUDIO avcodec_decode_audio2
 
 namespace gnash {
 namespace media {

http://git.savannah.gnu.org/cgit//commit/?id=b6015e75fcbd38ee61f85973015e343769168b04


commit b6015e75fcbd38ee61f85973015e343769168b04
Author: Benjamin Wolsey <address@hidden>
Date:   Sat Oct 30 09:52:03 2010 +0200

    We always use aligned memory, so drop the alternative.

diff --git a/libmedia/ffmpeg/AudioDecoderFfmpeg.cpp 
b/libmedia/ffmpeg/AudioDecoderFfmpeg.cpp
index cead0c7..12cb899 100644
--- a/libmedia/ffmpeg/AudioDecoderFfmpeg.cpp
+++ b/libmedia/ffmpeg/AudioDecoderFfmpeg.cpp
@@ -29,10 +29,6 @@
 
 //#define GNASH_DEBUG_AUDIO_DECODING
 
-/* SIMD versions of DSPContext.float_to_int16_interleave() needs input
-   and output buffers aligned to 16-byte boundaries */
-#define NEEDS_ALIGNED_MEMORY 1
-
 #ifdef FFMPEG_AUDIO2
 # define AVCODEC_DECODE_AUDIO avcodec_decode_audio2
 #else
@@ -527,20 +523,12 @@ AudioDecoderFfmpeg::decodeFrame(const boost::uint8_t* 
input,
        // TODO: make this a private member, to reuse (see NetStreamFfmpeg in 
0.8.3)
     boost::uint8_t* output;
 
-    if (NEEDS_ALIGNED_MEMORY)
-    {
        output = reinterpret_cast<boost::uint8_t*>(av_malloc(bufsize));
-       if (output == NULL)
-       {
+       if (!output) {
            log_error(_("failed to allocate audio buffer."));
            outputSize = 0;
            return NULL;
        }
-    }
-    else
-    {
-       output = new boost::uint8_t[bufsize];
-    }
 
     boost::int16_t* outPtr = reinterpret_cast<boost::int16_t*>(output);
 
@@ -565,36 +553,25 @@ AudioDecoderFfmpeg::decodeFrame(const boost::uint8_t* 
input,
                    bufsize, inputSize, tmp, outSize);
 #endif
 
-       if (tmp < 0)
-       {
+       if (tmp < 0) {
                log_error(_("avcodec_decode_audio returned %d. Upgrading "
                     "ffmpeg/libavcodec might fix this issue."), tmp);
                outputSize = 0;
 
-               if (NEEDS_ALIGNED_MEMORY)
-                   av_free(output);
-               else
-                   delete [] output;
-               return NULL;
+        av_free(output);
        }
 
-       if (outSize < 2)
-       {
+       if (outSize < 2) {
                log_error(_("outputSize:%d after decoding %d bytes of input 
audio "
                     "data. Upgrading ffmpeg/libavcodec might fix this issue."),
                                outputSize, inputSize);
                outputSize = 0;
 
-               if (NEEDS_ALIGNED_MEMORY)
-                   av_free(output);
-               else
-                   delete [] output;
-               return NULL;
+        av_free(output);
        }
 
        // Resampling is needed.
-       if (_resampler.init(_audioCodecCtx))
-       {
+       if (_resampler.init(_audioCodecCtx)) {
                // Resampling is needed.
 
                // Compute new size based on frame_size and
@@ -629,15 +606,11 @@ AudioDecoderFfmpeg::decodeFrame(const boost::uint8_t* 
input,
 #endif
 
                // make sure to set outPtr *after* we use it as input to the 
resampler
-               outPtr = reinterpret_cast<boost::int16_t*>(resampledOutput);
+        outPtr = reinterpret_cast<boost::int16_t*>(resampledOutput);
 
-               if (NEEDS_ALIGNED_MEMORY)
-                   av_free(output);
-               else
-                   delete [] output;
+        av_free(output);
 
-               if (expectedMaxOutSamples < outSamples)
-               {
+               if (expectedMaxOutSamples < outSamples) {
                        log_error(" --- Computation of resampled samples (%d) < 
then the actual returned samples (%d)",
                                expectedMaxOutSamples, outSamples);
 
@@ -660,10 +633,9 @@ AudioDecoderFfmpeg::decodeFrame(const boost::uint8_t* 
input,
                outSize = outSamples * 2 * 2;
 
        }
-       else if (NEEDS_ALIGNED_MEMORY)
-       {
+       else {
            boost::uint8_t* newOutput = new boost::uint8_t[outSize];
-           memcpy(newOutput, output, outSize);
+           std::memcpy(newOutput, output, outSize);
            outPtr = reinterpret_cast<boost::int16_t*>(newOutput);
         av_free(output);
        }

-----------------------------------------------------------------------

Summary of changes:
 libmedia/ffmpeg/AudioDecoderFfmpeg.cpp |  641 +++++++++++++++-----------------
 libmedia/ffmpeg/VideoDecoderFfmpeg.cpp |    2 -
 libvaapi/VaapiSurfaceGLX.cpp           |    4 +
 macros/ffmpeg.m4                       |   16 +-
 4 files changed, 310 insertions(+), 353 deletions(-)


hooks/post-receive
-- 
Gnash



reply via email to

[Prev in Thread] Current Thread [Next in Thread]