gnash-commit
[Top][All Lists]
Advanced

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

[Gnash-commit] gnash ChangeLog backend/sound_handler.h backend...


From: Sandro Santilli
Subject: [Gnash-commit] gnash ChangeLog backend/sound_handler.h backend...
Date: Tue, 25 Sep 2007 18:58:43 +0000

CVSROOT:        /sources/gnash
Module name:    gnash
Changes by:     Sandro Santilli <strk>  07/09/25 18:58:43

Modified files:
        .              : ChangeLog 
        backend        : sound_handler.h sound_handler_gst.cpp 
                         sound_handler_gst.h sound_handler_sdl.cpp 
                         sound_handler_sdl.h 
        server/swf     : tag_loaders.cpp 

Log message:
                * backend/: sound_handler.h, sound_handler_gst.{cpp,h},
                  sound_handler_sdl.{cpp,h}: changed fill_stream_data
                  interface to take ownership of the data array.
                  Data is still copied, but can now be optimized locally
                  in each sound hanlder.
                * server/swf/tag_loaders.cpp (sound_stream_block_loader):
                  update use of fill_stream_data.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/gnash/ChangeLog?cvsroot=gnash&r1=1.4409&r2=1.4410
http://cvs.savannah.gnu.org/viewcvs/gnash/backend/sound_handler.h?cvsroot=gnash&r1=1.24&r2=1.25
http://cvs.savannah.gnu.org/viewcvs/gnash/backend/sound_handler_gst.cpp?cvsroot=gnash&r1=1.61&r2=1.62
http://cvs.savannah.gnu.org/viewcvs/gnash/backend/sound_handler_gst.h?cvsroot=gnash&r1=1.15&r2=1.16
http://cvs.savannah.gnu.org/viewcvs/gnash/backend/sound_handler_sdl.cpp?cvsroot=gnash&r1=1.84&r2=1.85
http://cvs.savannah.gnu.org/viewcvs/gnash/backend/sound_handler_sdl.h?cvsroot=gnash&r1=1.32&r2=1.33
http://cvs.savannah.gnu.org/viewcvs/gnash/server/swf/tag_loaders.cpp?cvsroot=gnash&r1=1.141&r2=1.142

Patches:
Index: ChangeLog
===================================================================
RCS file: /sources/gnash/gnash/ChangeLog,v
retrieving revision 1.4409
retrieving revision 1.4410
diff -u -b -r1.4409 -r1.4410
--- ChangeLog   25 Sep 2007 18:08:28 -0000      1.4409
+++ ChangeLog   25 Sep 2007 18:58:42 -0000      1.4410
@@ -1,3 +1,13 @@
+2007-09-26 Sandro Santilli <address@hidden>
+
+       * backend/: sound_handler.h, sound_handler_gst.{cpp,h},
+         sound_handler_sdl.{cpp,h}: changed fill_stream_data
+         interface to take ownership of the data array.
+         Data is still copied, but can now be optimized locally
+         in each sound hanlder.
+       * server/swf/tag_loaders.cpp (sound_stream_block_loader):
+         update use of fill_stream_data.
+
 2007-09-26 Benjamin Wolsey <address@hidden>
 
        * gui/gtk.cpp: change Oslash to Ooblique - GDK_Oslash is evidently

Index: backend/sound_handler.h
===================================================================
RCS file: /sources/gnash/gnash/backend/sound_handler.h,v
retrieving revision 1.24
retrieving revision 1.25
diff -u -b -r1.24 -r1.25
--- backend/sound_handler.h     10 Aug 2007 10:24:11 -0000      1.24
+++ backend/sound_handler.h     25 Sep 2007 18:58:43 -0000      1.25
@@ -18,7 +18,7 @@
 // 
 //
 
-/* $Id: sound_handler.h,v 1.24 2007/08/10 10:24:11 tgc Exp $ */
+/* $Id: sound_handler.h,v 1.25 2007/09/25 18:58:43 strk Exp $ */
 
 /// \page sound_handler_intro Sound handler introduction
 ///
@@ -112,8 +112,8 @@
        /// gnash's parser calls this to fill up soundstreams data
        //
        /// @param data
-       ///     The sound data to be saved. Will be copied.
-       ///     TODO: avoid the copy, if possible, getting ownership 
transferred instead
+       ///     The sound data to be saved, allocated by new[]. Ownership is 
transferred.
+       ///     TODO: define a class for containing both data and data_bytes ? 
or use vector ?
        ///
        /// @param data_bytes
        /// Size of the data in bytes
@@ -124,7 +124,7 @@
        /// @param handle_id
        /// The soundhandlers id of the sound we want some info about.
        ///
-       virtual long    fill_stream_data(void* data, unsigned int data_bytes, 
unsigned int sample_count, int handle_id) = 0;
+       virtual long    fill_stream_data(unsigned char* data, unsigned int 
data_bytes, unsigned int sample_count, int handle_id) = 0;
 
        /// Returns a pointer to the SoundInfo object for the sound with the 
given id.
        /// The SoundInfo object is still owned by the soundhandler.

Index: backend/sound_handler_gst.cpp
===================================================================
RCS file: /sources/gnash/gnash/backend/sound_handler_gst.cpp,v
retrieving revision 1.61
retrieving revision 1.62
diff -u -b -r1.61 -r1.62
--- backend/sound_handler_gst.cpp       5 Sep 2007 13:05:15 -0000       1.61
+++ backend/sound_handler_gst.cpp       25 Sep 2007 18:58:43 -0000      1.62
@@ -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_gst.cpp,v 1.61 2007/09/05 13:05:15 tgc Exp $ */
+/* $Id: sound_handler_gst.cpp,v 1.62 2007/09/25 18:58:43 strk Exp $ */
 
 #ifdef HAVE_CONFIG_H
 #include "config.h"
@@ -137,7 +137,7 @@
 
 
 // this gets called when a stream gets more data
-long   GST_sound_handler::fill_stream_data(void* data, unsigned int 
data_bytes, unsigned int /*sample_count*/, int handle_id)
+long   GST_sound_handler::fill_stream_data(unsigned char* data, unsigned int 
data_bytes, unsigned int /*sample_count*/, int handle_id)
 {
        try_mutex::scoped_lock lock(_mutex);
 
@@ -163,8 +163,11 @@
                        sound->set_data(tmp_data);
                }
 
+               delete [] data;
                return sounddata->data_size - data_bytes;
        }
+
+       delete [] data;
        return 0;
 }
 

Index: backend/sound_handler_gst.h
===================================================================
RCS file: /sources/gnash/gnash/backend/sound_handler_gst.h,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -b -r1.15 -r1.16
--- backend/sound_handler_gst.h 10 Aug 2007 10:24:11 -0000      1.15
+++ backend/sound_handler_gst.h 25 Sep 2007 18:58:43 -0000      1.16
@@ -138,7 +138,7 @@
                                     std::auto_ptr<SoundInfo> sinfo);
 
        /// this gets called when a stream gets more data
-       virtual long    fill_stream_data(void* data, unsigned int data_bytes,
+       virtual long    fill_stream_data(unsigned char* data, unsigned int 
data_bytes,
                                         unsigned int sample_count, int 
handle_id);
 
        /// Play the index'd sample.

Index: backend/sound_handler_sdl.cpp
===================================================================
RCS file: /sources/gnash/gnash/backend/sound_handler_sdl.cpp,v
retrieving revision 1.84
retrieving revision 1.85
diff -u -b -r1.84 -r1.85
--- backend/sound_handler_sdl.cpp       5 Sep 2007 13:05:15 -0000       1.84
+++ backend/sound_handler_sdl.cpp       25 Sep 2007 18:58:43 -0000      1.85
@@ -18,7 +18,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.84 2007/09/05 13:05:15 tgc Exp $
+// $Id: sound_handler_sdl.cpp,v 1.85 2007/09/25 18:58:43 strk Exp $
 
 #ifdef HAVE_CONFIG_H
 #include "config.h"
@@ -143,13 +143,15 @@
 }
 
 // this gets called when a stream gets more data
-long   SDL_sound_handler::fill_stream_data(void* data, unsigned int 
data_bytes, unsigned int sample_count, int handle_id)
+long   SDL_sound_handler::fill_stream_data(unsigned char* data, unsigned int 
data_bytes, unsigned int sample_count, int handle_id)
 {
 
        boost::mutex::scoped_lock lock(_mutex);
        // @@ does a negative handle_id have any meaning ?
        //    should we change it to unsigned instead ?
-       if (handle_id < 0 || (unsigned int) handle_id+1 > m_sound_data.size()) {
+       if (handle_id < 0 || (unsigned int) handle_id+1 > m_sound_data.size())
+       {
+               delete [] data;
                return -1;
        }
        int start_size = 0;
@@ -166,8 +168,10 @@
                                 data, sample_count, 2 /*sample size*/,
                                 sounddata->soundinfo->getSampleRate(), 
sounddata->soundinfo->isStereo(),
                                 audioSpec.freq, (audioSpec.channels == 2));
-               if (!adjusted_data || adjusted_size < 1) {
+               if (!adjusted_data || adjusted_size < 1)
+               {
                        log_error(_("Some kind of error with resampling sound 
data"));
+                       delete [] data;
                        return -1;
                }
 
@@ -219,6 +223,7 @@
                log_error(_("Behavior for this audio codec %d is unknown.  
Please send this SWF to the developers"), 
(int)(sounddata->soundinfo->getFormat()));
        }
 
+       delete [] data;
        return start_size;
 }
 

Index: backend/sound_handler_sdl.h
===================================================================
RCS file: /sources/gnash/gnash/backend/sound_handler_sdl.h,v
retrieving revision 1.32
retrieving revision 1.33
diff -u -b -r1.32 -r1.33
--- backend/sound_handler_sdl.h 10 Aug 2007 10:24:11 -0000      1.32
+++ backend/sound_handler_sdl.h 25 Sep 2007 18:58:43 -0000      1.33
@@ -14,7 +14,7 @@
 // along with this program; if not, write to the Free Software
 // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 
-// $Id: sound_handler_sdl.h,v 1.32 2007/08/10 10:24:11 tgc Exp $
+// $Id: sound_handler_sdl.h,v 1.33 2007/09/25 18:58:43 strk Exp $
 
 #ifndef SOUND_HANDLER_SDL_H
 #define SOUND_HANDLER_SDL_H
@@ -181,7 +181,7 @@
        virtual int     create_sound(void* data, unsigned int data_bytes, 
std::auto_ptr<SoundInfo> sinfo);
 
        /// this gets called when a stream gets more data
-       virtual long    fill_stream_data(void* data, unsigned int data_bytes,
+       virtual long    fill_stream_data(unsigned char* data, unsigned int 
data_bytes,
                                         unsigned int sample_count, int 
handle_id);
 
        /// Play the index'd sample.

Index: server/swf/tag_loaders.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/swf/tag_loaders.cpp,v
retrieving revision 1.141
retrieving revision 1.142
diff -u -b -r1.141 -r1.142
--- server/swf/tag_loaders.cpp  24 Sep 2007 15:39:31 -0000      1.141
+++ server/swf/tag_loaders.cpp  25 Sep 2007 18:58:43 -0000      1.142
@@ -17,7 +17,7 @@
 // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 //
 
-/* $Id: tag_loaders.cpp,v 1.141 2007/09/24 15:39:31 cmusick Exp $ */
+/* $Id: tag_loaders.cpp,v 1.142 2007/09/25 18:58:43 strk Exp $ */
 
 #ifdef HAVE_CONFIG_H
 #include "config.h"
@@ -1697,10 +1697,11 @@
 
     // Fill the data on the apropiate sound, and receives the starting point
     // for later "start playing from this frame" events.
+    //
+    // ownership of 'data' is transferred here
+    //
     long start = handler->fill_stream_data(data, data_bytes, sample_count, 
handle_id);
 
-    delete [] data;
-
     start_stream_sound_tag*    ssst = new start_stream_sound_tag();
     ssst->read(m, handle_id, start);
 }




reply via email to

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