gnash-commit
[Top][All Lists]
Advanced

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

[Gnash-commit] gnash ChangeLog libmedia/AudioDecoderSimple.cpp...


From: Tomas Groth
Subject: [Gnash-commit] gnash ChangeLog libmedia/AudioDecoderSimple.cpp...
Date: Mon, 08 Oct 2007 11:00:06 +0000

CVSROOT:        /sources/gnash
Module name:    gnash
Changes by:     Tomas Groth <tgc>       07/10/08 11:00:06

Modified files:
        .              : ChangeLog 
        libmedia       : AudioDecoderSimple.cpp 
        libmedia/sdl   : AudioDecoderMad.cpp VideoDecoderFfmpeg.cpp 
                         sound_handler_sdl.cpp 

Log message:
                * libmedia/AudioDecoderSimple.cpp: Fix stereo/mono resampling.
                * libmedia/sdl/AudioDecoderMad.cpp: Fix compilation and 
stereo/mono
                  resampling.
                * libmedia/sdl/VideoDecoderFfmpeg.cpp: Free frame after use. 
Throw
                  bad_alloc, if out of memory.
                * libmedia/sdl/sound_handler_sdl.cpp: Fix decoding multiple 
times until
                  the required buffer is full.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/gnash/ChangeLog?cvsroot=gnash&r1=1.4567&r2=1.4568
http://cvs.savannah.gnu.org/viewcvs/gnash/libmedia/AudioDecoderSimple.cpp?cvsroot=gnash&r1=1.4&r2=1.5
http://cvs.savannah.gnu.org/viewcvs/gnash/libmedia/sdl/AudioDecoderMad.cpp?cvsroot=gnash&r1=1.3&r2=1.4
http://cvs.savannah.gnu.org/viewcvs/gnash/libmedia/sdl/VideoDecoderFfmpeg.cpp?cvsroot=gnash&r1=1.4&r2=1.5
http://cvs.savannah.gnu.org/viewcvs/gnash/libmedia/sdl/sound_handler_sdl.cpp?cvsroot=gnash&r1=1.4&r2=1.5

Patches:
Index: ChangeLog
===================================================================
RCS file: /sources/gnash/gnash/ChangeLog,v
retrieving revision 1.4567
retrieving revision 1.4568
diff -u -b -r1.4567 -r1.4568
--- ChangeLog   8 Oct 2007 07:32:07 -0000       1.4567
+++ ChangeLog   8 Oct 2007 11:00:04 -0000       1.4568
@@ -1,3 +1,13 @@
+2007-10-08 Tomas Groth Christensen <address@hidden>
+
+       * libmedia/AudioDecoderSimple.cpp: Fix stereo/mono resampling.
+       * libmedia/sdl/AudioDecoderMad.cpp: Fix compilation and stereo/mono
+         resampling.
+       * libmedia/sdl/VideoDecoderFfmpeg.cpp: Free frame after use. Throw
+         bad_alloc, if out of memory.
+       * libmedia/sdl/sound_handler_sdl.cpp: Fix decoding multiple times until
+         the required buffer is full.
+
 2007-10-08 Sandro Santilli <address@hidden>
 
        * testsuite/misc-ming.all/loop_test9.c: add a test for RemoveObject

Index: libmedia/AudioDecoderSimple.cpp
===================================================================
RCS file: /sources/gnash/gnash/libmedia/AudioDecoderSimple.cpp,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -b -r1.4 -r1.5
--- libmedia/AudioDecoderSimple.cpp     4 Oct 2007 11:25:31 -0000       1.4
+++ libmedia/AudioDecoderSimple.cpp     8 Oct 2007 11:00:05 -0000       1.5
@@ -17,7 +17,7 @@
 // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 //
 
-// $Id: AudioDecoderSimple.cpp,v 1.4 2007/10/04 11:25:31 tgc Exp $
+// $Id: AudioDecoderSimple.cpp,v 1.5 2007/10/08 11:00:05 tgc Exp $
 
 #include <boost/scoped_array.hpp>
 
@@ -394,7 +394,7 @@
 
                int16_t* adjusted_data = 0;
                int     adjusted_size = 0;
-               int sample_count = outsize / 2;// samples are of size 2
+               int sample_count = outsize / (_stereo ? 4 : 2); // samples are 
of size 2
 
                // Convert to needed samplerate - this converter only support 
standard flash samplerates
                convert_raw_data(&adjusted_data, &adjusted_size, 
tmp_raw_buffer, sample_count, 0, 

Index: libmedia/sdl/AudioDecoderMad.cpp
===================================================================
RCS file: /sources/gnash/gnash/libmedia/sdl/AudioDecoderMad.cpp,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -b -r1.3 -r1.4
--- libmedia/sdl/AudioDecoderMad.cpp    4 Oct 2007 09:41:46 -0000       1.3
+++ libmedia/sdl/AudioDecoderMad.cpp    8 Oct 2007 11:00:06 -0000       1.4
@@ -17,7 +17,7 @@
 // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 //
 
-// $Id: AudioDecoderMad.cpp,v 1.3 2007/10/04 09:41:46 tgc Exp $
+// $Id: AudioDecoderMad.cpp,v 1.4 2007/10/08 11:00:06 tgc Exp $
 
 #include "AudioDecoderMad.h"
 #include "utility.h"
@@ -45,7 +45,7 @@
 
 bool AudioDecoderMad::setup(SoundInfo* info)
 {
-       if (info->getFormat() == FORMAT_MP3) return true;
+       if (info->getFormat() == AUDIO_CODEC_MP3) return true;
        else return false;
 }
 
@@ -141,7 +141,7 @@
 
                int16_t* adjusted_data = 0;
                int     adjusted_size = 0;
-               int sample_count = outsize / 2; // samples are of size 2
+               int sample_count = outsize / (_synth.pcm.channels * 2); // 
samples are of size 2
 
                // Convert to needed samplerate - this converter only support 
standard flash samplerates
                convert_raw_data(&adjusted_data, &adjusted_size, 
tmp_raw_buffer, sample_count, 0, 

Index: libmedia/sdl/VideoDecoderFfmpeg.cpp
===================================================================
RCS file: /sources/gnash/gnash/libmedia/sdl/VideoDecoderFfmpeg.cpp,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -b -r1.4 -r1.5
--- libmedia/sdl/VideoDecoderFfmpeg.cpp 6 Oct 2007 10:32:28 -0000       1.4
+++ libmedia/sdl/VideoDecoderFfmpeg.cpp 8 Oct 2007 11:00:06 -0000       1.5
@@ -17,7 +17,7 @@
 // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 //
 
-// $Id: VideoDecoderFfmpeg.cpp,v 1.4 2007/10/06 10:32:28 strk Exp $
+// $Id: VideoDecoderFfmpeg.cpp,v 1.5 2007/10/08 11:00:06 tgc Exp $
 
 #include "VideoDecoderFfmpeg.h"
 
@@ -218,7 +218,7 @@
        if ( ! frame )
        {
                log_error(_("Out of memory while allocating avcodec frame"));
-               return NULL;
+               throw std::bad_alloc();
        }
 
        int got = 0;
@@ -229,7 +229,6 @@
                uint8_t* decodedData = new uint8_t[_videoCodecCtx->width * 
_videoCodecCtx->height * 3];
                buffer.reset(convertRGB24(_videoCodecCtx, frame));
 
-
                // Copy the data to the buffer in the correct RGB format
                uint8_t* srcptr = frame->data[0];
                uint8_t* srcend = frame->data[0] + frame->linesize[0] * 
_videoCodecCtx->height;
@@ -245,6 +244,7 @@
                        outputSize += srcwidth;
                }
 
+               av_free(frame);
                return decodedData;
 
 /*             if (_videoFrameFormat == NONE) { // NullGui?
@@ -313,6 +313,7 @@
                }*/
        } else {
                log_error("Decoding of a video frame failed");
+               av_free(frame);
                return NULL;
        }
 }

Index: libmedia/sdl/sound_handler_sdl.cpp
===================================================================
RCS file: /sources/gnash/gnash/libmedia/sdl/sound_handler_sdl.cpp,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -b -r1.4 -r1.5
--- libmedia/sdl/sound_handler_sdl.cpp  6 Oct 2007 09:53:45 -0000       1.4
+++ libmedia/sdl/sound_handler_sdl.cpp  8 Oct 2007 11:00:06 -0000       1.5
@@ -20,7 +20,7 @@
 // Based on sound_handler_sdl.cpp by Thatcher Ulrich http://tulrich.com 2003
 // which has been donated to the Public Domain.
 
-// $Id: sound_handler_sdl.cpp,v 1.4 2007/10/06 09:53:45 tgc Exp $
+// $Id: sound_handler_sdl.cpp,v 1.5 2007/10/08 11:00:06 tgc Exp $
 
 #ifdef HAVE_CONFIG_H
 #include "config.h"
@@ -707,7 +707,10 @@
                                // We loop until the size of the decoded sound 
is greater than the buffer size,
                                // or there is no more to decode.
                                unsigned int decoded_size = 0;
-                               // TODO: should we delete any previous raw_data 
?
+
+                               // Delete any previous raw_data
+                               sound->deleteDecodedData();
+
                                while(decoded_size < buffer_length)
                                {
 
@@ -741,13 +744,13 @@
 
                                        sound->position += decodedBytes;
 
-                                       sound->deleteDecodedData();
                                        
sound->appendDecodedData(tmp_raw_buffer, tmp_raw_buffer_size);
 
                                        decoded_size += tmp_raw_buffer_size;
 
                                        // no more to decode from this sound, 
so we break the loop
                                        if (sound->dataSize() <= 
sound->position && sound->loop_count == 0 || tmp_raw_buffer_size == 0 && 
decodedBytes == 0) {
+                                               sound->position = 
sound->dataSize();
                                                break;
                                        }
 




reply via email to

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