gnash-commit
[Top][All Lists]
Advanced

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

[Gnash-commit] gnash ChangeLog server/Makefile.am server/impl....


From: Sandro Santilli
Subject: [Gnash-commit] gnash ChangeLog server/Makefile.am server/impl....
Date: Wed, 30 Apr 2008 12:21:37 +0000

CVSROOT:        /sources/gnash
Module name:    gnash
Changes by:     Sandro Santilli <strk>  08/04/30 12:21:37

Modified files:
        .              : ChangeLog 
        server         : Makefile.am impl.cpp 
        server/parser  : sound_definition.cpp sound_definition.h 
        server/swf     : tag_loaders.cpp 
Added files:
        server/swf     : StreamSoundBlockTag.cpp StreamSoundBlockTag.h 

Log message:
        Move StreamSoundBlockTag handling in its
        own file and document it, fix the execute
        signature to match the one expected by ControlTag.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/gnash/ChangeLog?cvsroot=gnash&r1=1.6461&r2=1.6462
http://cvs.savannah.gnu.org/viewcvs/gnash/server/Makefile.am?cvsroot=gnash&r1=1.141&r2=1.142
http://cvs.savannah.gnu.org/viewcvs/gnash/server/impl.cpp?cvsroot=gnash&r1=1.143&r2=1.144
http://cvs.savannah.gnu.org/viewcvs/gnash/server/parser/sound_definition.cpp?cvsroot=gnash&r1=1.11&r2=1.12
http://cvs.savannah.gnu.org/viewcvs/gnash/server/parser/sound_definition.h?cvsroot=gnash&r1=1.11&r2=1.12
http://cvs.savannah.gnu.org/viewcvs/gnash/server/swf/tag_loaders.cpp?cvsroot=gnash&r1=1.195&r2=1.196
http://cvs.savannah.gnu.org/viewcvs/gnash/server/swf/StreamSoundBlockTag.cpp?cvsroot=gnash&rev=1.1
http://cvs.savannah.gnu.org/viewcvs/gnash/server/swf/StreamSoundBlockTag.h?cvsroot=gnash&rev=1.1

Patches:
Index: ChangeLog
===================================================================
RCS file: /sources/gnash/gnash/ChangeLog,v
retrieving revision 1.6461
retrieving revision 1.6462
diff -u -b -r1.6461 -r1.6462
--- ChangeLog   30 Apr 2008 09:51:21 -0000      1.6461
+++ ChangeLog   30 Apr 2008 12:21:32 -0000      1.6462
@@ -1,5 +1,15 @@
 2008-04-30 Sandro Santilli <address@hidden>
 
+       * server/Makefile.am, server/impl.cpp,
+         server/parser/sound_definition.{cpp,h},
+         server/swf/StreamSoundBlockTag.{cpp,h},
+         server/swf/tag_loaders.cpp:
+         Move StreamSoundBlockTag handling in its
+         own file and document it, fix the execute
+         signature to match the one expected by ControlTag.
+
+2008-04-30 Sandro Santilli <address@hidden>
+
        * macros/boost.m4: filesystem/exception.hpp might also
          be useful.
 

Index: server/Makefile.am
===================================================================
RCS file: /sources/gnash/gnash/server/Makefile.am,v
retrieving revision 1.141
retrieving revision 1.142
diff -u -b -r1.141 -r1.142
--- server/Makefile.am  9 Apr 2008 20:52:45 -0000       1.141
+++ server/Makefile.am  30 Apr 2008 12:21:34 -0000      1.142
@@ -85,6 +85,7 @@
        swf/PlaceObject2Tag.cpp \
        swf/RemoveObjectTag.cpp \
        swf/StartSoundTag.cpp \
+       swf/StreamSoundBlockTag.cpp \
        swf_function.cpp \
        video_stream_instance.cpp \
        StreamProvider.cpp \
@@ -176,6 +177,7 @@
        swf/DoInitActionTag.h \
        swf/SetBackgroundColorTag.h \
        swf/StartSoundTag.h \
+       swf/StreamSoundBlockTag.h \
        swf_event.h \
        swf_function.h \
        text.h \

Index: server/impl.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/impl.cpp,v
retrieving revision 1.143
retrieving revision 1.144
diff -u -b -r1.143 -r1.144
--- server/impl.cpp     21 Apr 2008 11:27:43 -0000      1.143
+++ server/impl.cpp     30 Apr 2008 12:21:34 -0000      1.144
@@ -54,6 +54,7 @@
 #include "DoInitActionTag.h"
 #include "SetBackgroundColorTag.h"
 #include "StartSoundTag.h"
+#include "StreamSoundBlockTag.h"
 #include "swf/tag_loaders.h" // for all tag loaders..
 #include "sound_handler.h" // for get_sound_handler
 #ifdef GNASH_USE_GC
@@ -177,7 +178,7 @@
   
         register_tag_loader(SWF::DEFINEBUTTONSOUND, button_sound_loader);
   register_tag_loader(SWF::SOUNDSTREAMHEAD, sound_stream_head_loader); // 18
-  register_tag_loader(SWF::SOUNDSTREAMBLOCK, sound_stream_block_loader); // 19
+  register_tag_loader(SWF::SOUNDSTREAMBLOCK, StreamSoundBlockTag::loader); // 
19
   register_tag_loader(SWF::DEFINELOSSLESS, define_bits_lossless_2_loader);
   register_tag_loader(SWF::DEFINEBITSJPEG2, define_bits_jpeg2_loader);
   register_tag_loader(SWF::DEFINESHAPE2,  define_shape_loader);

Index: server/parser/sound_definition.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/parser/sound_definition.cpp,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -b -r1.11 -r1.12
--- server/parser/sound_definition.cpp  19 Mar 2008 20:50:56 -0000      1.11
+++ server/parser/sound_definition.cpp  30 Apr 2008 12:21:35 -0000      1.12
@@ -25,39 +25,6 @@
        }
 }
 
-//
-// SWF Tag SoundStreamBlock (19) 
-//
-
-// Initialize this StartSound tag from the stream & given sample.
-// Insert ourself into the movie.
-void
-start_stream_sound_tag::read(movie_definition* m, int handler_id, long start)
-{
-       m_handler_id = handler_id;
-       m_start = start;
-       m->addControlTag(this);
-}
-
-
-void
-start_stream_sound_tag::execute(sprite_instance* m) const
-{
-       // Make static ?
-       media::sound_handler* handler = get_sound_handler();
-       if (handler)
-       {
-               // This makes it possible to stop only the stream when 
framejumping.
-               m->setStreamSoundId(m_handler_id);
-               handler->play_sound(m_handler_id, 0, 0, m_start, NULL);
-       }
-}
-
-void
-start_stream_sound_tag::execute_state(sprite_instance* /* m */) const
-{
-}
-
 } // namespace gnash
 
 

Index: server/parser/sound_definition.h
===================================================================
RCS file: /sources/gnash/gnash/server/parser/sound_definition.h,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -b -r1.11 -r1.12
--- server/parser/sound_definition.h    21 Jan 2008 20:56:01 -0000      1.11
+++ server/parser/sound_definition.h    30 Apr 2008 12:21:35 -0000      1.12
@@ -70,39 +70,6 @@
        sound_sample* cast_to_sound_sample() { return this; }
 };
 
-/// SWF Tag SoundStreamBlock (19) 
-//
-/// TODO: move in it's own SoundStreamBlockTag files...
-///
-class start_stream_sound_tag : public ControlTag
-{
-public:
-       boost::uint16_t m_handler_id;
-       long            m_start;
-       int             latency;
-
-       start_stream_sound_tag()
-               :
-               m_handler_id(0),
-               m_start(0),
-               latency(0)
-       {
-       }
-
-
-       /// \brief
-       /// Initialize this StartSound tag
-       /// from the stream & given sample.
-       //
-       /// Insert ourself into the movie.
-       void    read(movie_definition* m, int handler_id, long start);
-
-       void    execute(sprite_instance* m) const;
-
-       /// StartStreamSound is not a "state" tag?
-       void execute_state(sprite_instance* m) const;
-};
-
 } // namespace gnash
 
 

Index: server/swf/tag_loaders.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/swf/tag_loaders.cpp,v
retrieving revision 1.195
retrieving revision 1.196
diff -u -b -r1.195 -r1.196
--- server/swf/tag_loaders.cpp  21 Apr 2008 11:27:46 -0000      1.195
+++ server/swf/tag_loaders.cpp  30 Apr 2008 12:21:36 -0000      1.196
@@ -1451,74 +1451,6 @@
     m->set_loading_sound_stream_id(handler_id);
 }
 
-
-// Load a SoundStreamBlock tag.
-void
-sound_stream_block_loader(stream* in, tag_type tag, movie_definition* m)
-{
-    assert(tag == SWF::SOUNDSTREAMBLOCK); // 19
-
-    media::sound_handler* handler = get_sound_handler();
-
-    // If we don't have a sound_handler registered stop here
-    if (!handler)
-    {
-               // log_debug ?
-        return;
-    }
-
-    // Get the ID of the sound stream currently being loaded
-    int handle_id = m->get_loading_sound_stream_id();
-
-    // Get the SoundInfo object that contains info about the sound stream.
-    // Ownership of the object is in the soundhandler
-    media::SoundInfo* sinfo = handler->get_sound_info(handle_id);
-
-    // If there is no SoundInfo something is wrong...
-    if (!sinfo)
-       {
-               IF_VERBOSE_MALFORMED_SWF(
-               log_swferror(_("Found SOUNDSTREAMBLOCK tag w/out preceeding 
SOUNDSTREAMHEAD"));
-               );
-               return;
-       }
-
-    media::audioCodecType format = sinfo->getFormat();
-    unsigned int sample_count = sinfo->getSampleCount();
-
-    // MP3 format blocks have additional info
-    if (format == media::AUDIO_CODEC_MP3)
-    {
-        in->ensureBytes(4);
-       // FIXME: use these values !
-        unsigned int samplesCount = in->read_u16(); UNUSED(samplesCount);
-        unsigned int seekSamples = in->read_u16();
-       LOG_ONCE ( if ( seekSamples ) log_unimpl("MP3 soundblock seek samples") 
);
-    }
-
-    unsigned int data_bytes = in->get_tag_end_position() - in->get_position();
-    if ( ! data_bytes )
-    {
-        IF_VERBOSE_MALFORMED_SWF(
-        LOG_ONCE( log_swferror("Empty SOUNDSTREAMBLOCK tag, seems common waste 
of space") );
-        );
-        return;
-    }
-
-    unsigned char *data = new unsigned char[data_bytes];
-    in->read((char*)data, data_bytes);
-
-    // 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);
-
-    start_stream_sound_tag*    ssst = new start_stream_sound_tag();
-    ssst->read(m, handle_id, start);
-}
-
 void
 define_video_loader(stream* in, tag_type tag, movie_definition* m)
 {

Index: server/swf/StreamSoundBlockTag.cpp
===================================================================
RCS file: server/swf/StreamSoundBlockTag.cpp
diff -N server/swf/StreamSoundBlockTag.cpp
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ server/swf/StreamSoundBlockTag.cpp  30 Apr 2008 12:21:35 -0000      1.1
@@ -0,0 +1,125 @@
+// StreamSoundBlockTag.cpp:  for Gnash.
+//
+//   Copyright (C) 2007, 2008 Free Software Foundation, Inc.
+//
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; either version 3 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+//
+
+
+#ifdef HAVE_CONFIG_H
+#include "gnashconfig.h"
+#endif
+
+#include "StreamSoundBlockTag.h"
+#include "sound_handler.h" 
+#include "movie_definition.h" // for addControlTag
+#include "sprite_instance.h" // for execute
+#include "SoundInfo.h" // for loader
+#include "stream.h"
+#include "log.h" 
+//#include "sound_definition.h" // for sound_sample
+
+namespace gnash {
+namespace SWF {
+
+void
+StreamSoundBlockTag::execute(sprite_instance* m, DisplayList& /*dlist*/) const
+{
+       // Make static ?
+       media::sound_handler* handler = get_sound_handler();
+       if (handler)
+       {
+               // This makes it possible to stop only the stream when 
framejumping.
+               m->setStreamSoundId(m_handler_id);
+               handler->play_sound(m_handler_id, 0, 0, m_start, NULL);
+       }
+}
+
+/* public static */
+void
+StreamSoundBlockTag::loader(stream* in, tag_type tag, movie_definition* m)
+{
+    assert(tag == SWF::SOUNDSTREAMBLOCK); // 19
+
+    media::sound_handler* handler = get_sound_handler();
+
+    // If we don't have a sound_handler registered stop here
+    if (!handler)
+    {
+       // log_debug ?
+        return;
+    }
+
+    // Get the ID of the sound stream currently being loaded
+    int handle_id = m->get_loading_sound_stream_id();
+
+    // Get the SoundInfo object that contains info about the sound stream.
+    // Ownership of the object is in the soundhandler
+    media::SoundInfo* sinfo = handler->get_sound_info(handle_id);
+
+    // If there is no SoundInfo something is wrong...
+    if (!sinfo)
+    {
+        IF_VERBOSE_MALFORMED_SWF(
+        log_swferror(_("Found SOUNDSTREAMBLOCK tag w/out preceeding 
SOUNDSTREAMHEAD"));
+        );
+        return;
+    }
+
+    media::audioCodecType format = sinfo->getFormat();
+    unsigned int sample_count = sinfo->getSampleCount();
+
+    // MP3 format blocks have additional info
+    if (format == media::AUDIO_CODEC_MP3)
+    {
+        in->ensureBytes(4);
+       // FIXME: use these values !
+        unsigned int samplesCount = in->read_u16(); UNUSED(samplesCount);
+        unsigned int seekSamples = in->read_u16();
+       LOG_ONCE ( if ( seekSamples ) log_unimpl("MP3 soundblock seek samples") 
);
+    }
+
+    unsigned int data_bytes = in->get_tag_end_position() - in->get_position();
+    if ( ! data_bytes )
+    {
+        IF_VERBOSE_MALFORMED_SWF(
+        LOG_ONCE( log_swferror("Empty SOUNDSTREAMBLOCK tag, seems common waste 
of space") );
+        );
+        return;
+    }
+
+    unsigned char *data = new unsigned char[data_bytes];
+    in->read((char*)data, data_bytes);
+
+    // 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);
+
+    // TODO: log_parse ?
+
+    StreamSoundBlockTag* ssst = new StreamSoundBlockTag(handle_id, start);
+    m->addControlTag(ssst); // ownership is transferred to movie_definition
+}
+
+} // namespace gnash::SWF
+} // namespace gnash
+
+// Local Variables:
+// mode: C++
+// indent-tabs-mode: t
+// End:

Index: server/swf/StreamSoundBlockTag.h
===================================================================
RCS file: server/swf/StreamSoundBlockTag.h
diff -N server/swf/StreamSoundBlockTag.h
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ server/swf/StreamSoundBlockTag.h    30 Apr 2008 12:21:36 -0000      1.1
@@ -0,0 +1,101 @@
+// 
+//   Copyright (C) 2007, 2008 Free Software Foundation, Inc.
+// 
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; either version 3 of the License, or
+// (at your option) any later version.
+// 
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+// 
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+
+#ifndef GNASH_SWF_STREAMSOUNDBLOCK_TAG_H
+#define GNASH_SWF_STREAMSOUNDBLOCK_TAG_H
+
+#ifdef HAVE_CONFIG_H
+#include "gnashconfig.h"
+#endif
+
+#include "ControlTag.h" // for inheritance
+#include "swf.h" // for tag_type definition
+
+#include <boost/cstdint.hpp> // for boost::uint16_t and friends
+ 
+
+// Forward declarations
+namespace gnash {
+       class stream;
+       class movie_definition;
+}
+
+namespace gnash {
+namespace SWF {
+
+/// SWF Tag StreamSoundBlock (19).
+//
+///
+/// Virtual control tag for syncing streaming sound to playhead
+///
+/// Gnash will register instances of this ControlTag in the 
+/// frame containing blocks of a streaming sound, which is
+/// occurrences of SWF Tag StreamSoundBlock (19).
+///
+/// The tag will then be used to start playing the specific block
+/// in sync with the frame playhead.
+///
+class StreamSoundBlockTag : public ControlTag
+{
+
+       /// Id of the stream this tag should play
+       boost::uint16_t m_handler_id;
+
+       /// Offset in the stream buffer to play
+       long            m_start;
+
+       //int           latency;
+
+public:
+
+       /// Create a ControlTag playing the given sample when executed.
+       //
+       /// @param handlerId
+       ///     Identifier of the stream to play.
+       ///
+       /// @param start
+       ///     Offset to start playback from.
+       ///     (Should be offset of the associated sound block).
+       ///
+       StreamSoundBlockTag(int handlerId, long start)
+               :
+               m_handler_id(handlerId),
+               m_start(start)
+       {}
+
+       /// Start the associated block of sound
+       void execute(sprite_instance* m, DisplayList& /*dlist*/) const;
+
+       /// Load an SWF::SOUNDSTREAMBLOCK (19) tag.
+       static void loader(stream* in, tag_type tag, movie_definition* m);
+
+       /// Not a "state" (DisplayList?) tag, do doesn't need to provide 
execute_state
+       //void execute_state(sprite_instance* m) const {}
+};
+
+
+} // namespace gnash::SWF
+} // namespace gnash
+
+
+#endif // GNASH_SWF_STREAMSOUNDBLOCK_TAG_H
+
+
+// Local Variables:
+// mode: C++
+// indent-tabs-mode: t
+// End:




reply via email to

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