CVSROOT: /sources/gnash Module name: gnash Changes by: Sandro Santilli <strk> 07/11/24 08:23:48
Modified files: . : ChangeLog server : swf.h server/swf : StartSoundTag.cpp StartSoundTag.h Log message: More dox about StartSound tag. CVSWeb URLs: http://cvs.savannah.gnu.org/viewcvs/gnash/ChangeLog?cvsroot=gnash&r1=1.4950&r2=1.4951 http://cvs.savannah.gnu.org/viewcvs/gnash/server/swf.h?cvsroot=gnash&r1=1.41&r2=1.42 http://cvs.savannah.gnu.org/viewcvs/gnash/server/swf/StartSoundTag.cpp?cvsroot=gnash&r1=1.2&r2=1.3 http://cvs.savannah.gnu.org/viewcvs/gnash/server/swf/StartSoundTag.h?cvsroot=gnash&r1=1.2&r2=1.3 Patches: Index: ChangeLog =================================================================== RCS file: /sources/gnash/gnash/ChangeLog,v retrieving revision 1.4950 retrieving revision 1.4951 diff -u -b -r1.4950 -r1.4951 --- ChangeLog 24 Nov 2007 04:58:12 -0000 1.4950 +++ ChangeLog 24 Nov 2007 08:23:47 -0000 1.4951 @@ -1,3 +1,8 @@ +2007-11-24 Sandro Santilli <[EMAIL PROTECTED]> + + * server/: swf.h, swf/StartSoundTag.{cpp,h}: More dox about + StartSound tag. + 2007-11-23 Bastiaan Jacques <[EMAIL PROTECTED]> * backend/Makefile.am: Stop building render_handler_tri.cpp Index: server/swf.h =================================================================== RCS file: /sources/gnash/gnash/server/swf.h,v retrieving revision 1.41 retrieving revision 1.42 diff -u -b -r1.41 -r1.42 --- server/swf.h 16 Sep 2007 16:48:14 -0000 1.41 +++ server/swf.h 24 Nov 2007 08:23:47 -0000 1.42 @@ -45,7 +45,10 @@ DOACTION = 12, DEFINEFONTINFO = 13, DEFINESOUND = 14, + + /// See http://sswf.sourceforge.net/SWFalexref.html#tag_startsound STARTSOUND = 15, + STOPSOUND = 16, // SWF 9 DEFINEBUTTONSOUND = 17, SOUNDSTREAMHEAD = 18, Index: server/swf/StartSoundTag.cpp =================================================================== RCS file: /sources/gnash/gnash/server/swf/StartSoundTag.cpp,v retrieving revision 1.2 retrieving revision 1.3 diff -u -b -r1.2 -r1.3 --- server/swf/StartSoundTag.cpp 23 Nov 2007 23:37:04 -0000 1.2 +++ server/swf/StartSoundTag.cpp 24 Nov 2007 08:23:48 -0000 1.3 @@ -17,7 +17,7 @@ // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA // -/* $Id: StartSoundTag.cpp,v 1.2 2007/11/23 23:37:04 strk Exp $ */ +/* $Id: StartSoundTag.cpp,v 1.3 2007/11/24 08:23:48 strk Exp $ */ #ifdef HAVE_CONFIG_H #include "config.h" @@ -60,9 +60,11 @@ return; } - // NOTE: sound_id != sam->m_sound_handler_id + // NOTE: sound_id is the SWF-defined id, + // sam->m_sound_handler_id is the sound_handler-provided id + // StartSoundTag* sst = new StartSoundTag(sam->m_sound_handler_id); - sst->read(in, tag, m); + sst->read(*in); IF_VERBOSE_PARSE ( log_parse(_("StartSound: id=%d, stop = %d, loop ct = %d"), @@ -74,17 +76,17 @@ /* private */ void -StartSoundTag::read(stream* in, int /* tag_type */, movie_definition* m) +StartSoundTag::read(stream& in) { - in->ensureBytes(1); // header + in.ensureBytes(1); // header - in->read_uint(2); // skip reserved bits. - m_stop_playback = in->read_bit(); - bool no_multiple = in->read_bit(); - bool has_envelope = in->read_bit(); - bool has_loops = in->read_bit(); - bool has_out_point = in->read_bit(); - bool has_in_point = in->read_bit(); + in.read_uint(2); // skip reserved bits. + m_stop_playback = in.read_bit(); + bool no_multiple = in.read_bit(); + bool has_envelope = in.read_bit(); + bool has_loops = in.read_bit(); + bool has_out_point = in.read_bit(); + bool has_in_point = in.read_bit(); UNUSED(no_multiple); UNUSED(has_envelope); @@ -92,24 +94,24 @@ uint32_t in_point = 0; uint32_t out_point = 0; - in->ensureBytes(has_in_point*4 + has_out_point*4 + has_loops*2); + in.ensureBytes(has_in_point*4 + has_out_point*4 + has_loops*2); - if (has_in_point) { in_point = in->read_u32(); } - if (has_out_point) { out_point = in->read_u32(); } - if (has_loops) { m_loop_count = in->read_u16(); } + if (has_in_point) { in_point = in.read_u32(); } + if (has_out_point) { out_point = in.read_u32(); } + if (has_loops) { m_loop_count = in.read_u16(); } if (has_envelope) { - in->ensureBytes(1); - int nPoints = in->read_u8(); + in.ensureBytes(1); + int nPoints = in.read_u8(); m_envelopes.resize(nPoints); - in->ensureBytes(8*nPoints); + in.ensureBytes(8*nPoints); for (int i=0; i < nPoints; i++) { - m_envelopes[i].m_mark44 = in->read_u32(); - m_envelopes[i].m_level0 = in->read_u16(); - m_envelopes[i].m_level1 = in->read_u16(); + m_envelopes[i].m_mark44 = in.read_u32(); + m_envelopes[i].m_level0 = in.read_u16(); + m_envelopes[i].m_level1 = in.read_u16(); } } @@ -128,10 +130,12 @@ { if (m_stop_playback) { + log_debug("Execute StartSoundTag with 'stop playback' flag on"); handler->stop_sound(m_handler_id); } else { + log_debug("Execute StartSoundTag with 'stop playback' flag OFF"); handler->play_sound(m_handler_id, m_loop_count, 0, 0, (m_envelopes.empty() ? NULL : &m_envelopes)); } } Index: server/swf/StartSoundTag.h =================================================================== RCS file: /sources/gnash/gnash/server/swf/StartSoundTag.h,v retrieving revision 1.2 retrieving revision 1.3 diff -u -b -r1.2 -r1.3 --- server/swf/StartSoundTag.h 23 Nov 2007 23:37:04 -0000 1.2 +++ server/swf/StartSoundTag.h 24 Nov 2007 08:23:48 -0000 1.3 @@ -45,26 +45,55 @@ namespace SWF { /// SWF Tag StartSound (15) +// +/// See http://sswf.sourceforge.net/SWFalexref.html#tag_startsound +/// class StartSoundTag : public ControlTag { + /// This should be a reference to an earlier DefineSound tag id + /// but in this implementation is instead the sound_handler specific + /// identifier corresponding to it. + /// movie_definition keeps a mapping between SWF-defined DefineSound + /// identifier and sound_handler-provided identifier. + /// This one is the latter, probably so with the intention of avoiding + /// a lookup at every execution... + /// uint16_t m_handler_id; + + /// Number of loops started by an execution of this tag + // + /// This number is 0 if the sound must be played only once, + /// 1 to play twice and so on... + /// + /// It is not known whether a value exists to specify "loop forever" + /// int m_loop_count; + + /// If true this tag actually *stops* the sound rather then playing it. + // + /// In a well-formed SWF when this flag is on all others should be off + /// (no loops, no envelopes, no in/out points). + /// bool m_stop_playback; - std::vector<sound_handler::sound_envelope> m_envelopes; - /// Envelopes for the current sound instance + /// In/Out points, currently unsupported // - /// TODO: define ownership + /// See http://sswf.sourceforge.net/SWFalexref.html#swf_soundinfo + // unsigned long m_in_point; + // unsigned long m_out_point; + + /// Sound effects (envelopes) for this start of the sound + // + /// See http://sswf.sourceforge.net/SWFalexref.html#swf_envelope /// - uint32_t* envelopes; + std::vector<sound_handler::sound_envelope> m_envelopes; - /// \brief /// Initialize this StartSoundTag from the stream // /// The stream is assumed to be positioned right after the /// sound_id field of the tag structure. /// - void read(stream* in, int tag_type, movie_definition* m); + void read(stream& in); /// Create a StartSoundTag for starting the given sound sample _______________________________________________ Gnash-commit mailing list Gnash-commit@gnu.org http://lists.gnu.org/mailman/listinfo/gnash-commit