[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Gnash-commit] /srv/bzr/gnash/trunk r10884: Parse scenes and frame label
From: |
Benjamin Wolsey |
Subject: |
[Gnash-commit] /srv/bzr/gnash/trunk r10884: Parse scenes and frame labels correctly and add as a control tag as documented. |
Date: |
Tue, 19 May 2009 13:38:34 +0200 |
User-agent: |
Bazaar (1.13.1) |
------------------------------------------------------------
revno: 10884
committer: Benjamin Wolsey <address@hidden>
branch nick: trunk
timestamp: Tue 2009-05-19 13:38:34 +0200
message:
Parse scenes and frame labels correctly and add as a control tag as
documented.
Not yet implemented, but gives useful logging information.
Minor cleanups to other tags.
added:
libcore/swf/DefineSceneAndFrameLabelDataTag.h
modified:
.bzrignore
libcore/Makefile.am
libcore/SWFStream.h
libcore/impl.cpp
libcore/swf/ControlTag.h
libcore/swf/DoABCTag.h
libcore/swf/DoActionTag.h
libcore/swf/SymbolClassTag.h
libcore/swf/tag_loaders.cpp
libcore/swf/tag_loaders.h
------------------------------------------------------------
revno: 10883.1.1
committer: Benjamin Wolsey <address@hidden>
branch nick: test
timestamp: Tue 2009-05-19 11:38:13 +0200
message:
Always log the VM version for debugging purposes.
modified:
libcore/swf/tag_loaders.cpp
------------------------------------------------------------
revno: 10883.1.2
committer: Benjamin Wolsey <address@hidden>
branch nick: test
timestamp: Tue 2009-05-19 11:54:11 +0200
message:
Use ensureBytes on encoded U32 reads, which is slower but prevents
potential
memory corruption.
modified:
libcore/SWFStream.h
------------------------------------------------------------
revno: 10883.1.3
committer: Benjamin Wolsey <address@hidden>
branch nick: test
timestamp: Tue 2009-05-19 12:00:46 +0200
message:
Parse DefineSceneAndFrameLabelData tag correctly.
modified:
libcore/swf/tag_loaders.cpp
------------------------------------------------------------
revno: 10883.1.4
committer: Benjamin Wolsey <address@hidden>
branch nick: test
timestamp: Tue 2009-05-19 12:04:09 +0200
message:
Add autogenerated macros to .bzrignore.
modified:
.bzrignore
------------------------------------------------------------
revno: 10883.1.5
committer: Benjamin Wolsey <address@hidden>
branch nick: test
timestamp: Tue 2009-05-19 12:18:34 +0200
message:
Make some ctors private. Move DefineSceneAndFrameLabelData tag to its
own file in accordance with other tags.
modified:
libcore/Makefile.am
libcore/impl.cpp
libcore/swf/DoABCTag.h
libcore/swf/DoActionTag.h
libcore/swf/SymbolClassTag.h
libcore/swf/tag_loaders.cpp
libcore/swf/tag_loaders.h
------------------------------------------------------------
revno: 10883.1.6
committer: Benjamin Wolsey <address@hidden>
branch nick: test
timestamp: Tue 2009-05-19 12:35:10 +0200
message:
Add tag file mentioned in last commit.
added:
libcore/swf/DefineSceneAndFrameLabelDataTag.h
------------------------------------------------------------
revno: 10883.1.7
committer: Benjamin Wolsey <address@hidden>
branch nick: test
timestamp: Tue 2009-05-19 12:52:48 +0200
message:
Add some useful comments for doxygen.
modified:
libcore/swf/ControlTag.h
------------------------------------------------------------
revno: 10883.1.8
committer: Benjamin Wolsey <address@hidden>
branch nick: test
timestamp: Tue 2009-05-19 12:56:40 +0200
message:
Correct comment.
modified:
libcore/swf/DefineSceneAndFrameLabelDataTag.h
=== modified file '.bzrignore'
--- a/.bzrignore 2009-05-14 11:45:23 +0000
+++ b/.bzrignore 2009-05-19 10:04:09 +0000
@@ -30,6 +30,9 @@
utilities/gprocessor
utilities/soldumper
testsuite/gnashrc
+macros/lt*.m4
+macros/libtool.m4
+macros/argz.m4
gui/gnash
gui/gtk-gnash
gui/kde-gnash
=== modified file 'libcore/Makefile.am'
--- a/libcore/Makefile.am 2009-05-14 15:02:29 +0000
+++ b/libcore/Makefile.am 2009-05-19 10:18:34 +0000
@@ -167,6 +167,7 @@
swf/DefineVideoStreamTag.h \
swf/DefineFontAlignZonesTag.h \
swf/SymbolClassTag.h \
+ swf/DefineSceneAndFrameLabelDataTag.h \
swf/CSMTextSettingsTag.h \
swf/DefineShapeTag.h \
swf/DefineMorphShapeTag.h \
=== modified file 'libcore/SWFStream.h'
--- a/libcore/SWFStream.h 2009-02-20 12:24:00 +0000
+++ b/libcore/SWFStream.h 2009-05-19 09:54:11 +0000
@@ -195,18 +195,23 @@
///
boost::uint32_t read_V32()
{
+ ensureBytes(1);
boost::uint32_t res = read_u8();
- if (!(res & 0x00000080))
- return res;
+ if (!(res & 0x00000080)) return res;
+
+ ensureBytes(1);
res = (res & 0x0000007F) | read_u8() << 7;
- if (!(res & 0x00004000))
- return res;
+ if (!(res & 0x00004000)) return res;
+
+ ensureBytes(1);
res = (res & 0x00003FFF) | read_u8() << 14;
- if (!(res & 0x00200000))
- return res;
+ if (!(res & 0x00200000)) return res;
+
+ ensureBytes(1);
res = (res & 0x001FFFFF) | read_u8() << 21;
- if (!(res & 0x10000000))
- return res;
+ if (!(res & 0x10000000)) return res;
+
+ ensureBytes(1);
res = (res & 0x0FFFFFFF) | read_u8() << 28;
return res;
}
@@ -219,14 +224,15 @@
///
void skip_V32()
{
- if (!(read_u8() & 0x80))
- return;
- if (!(read_u8() & 0x80))
- return;
- if (!(read_u8() & 0x80))
- return;
- if (!(read_u8() & 0x80))
- return;
+ ensureBytes(1);
+ if (!(read_u8() & 0x80)) return;
+ ensureBytes(1);
+ if (!(read_u8() & 0x80)) return;
+ ensureBytes(1);
+ if (!(read_u8() & 0x80)) return;
+ ensureBytes(1);
+ if (!(read_u8() & 0x80)) return;
+ ensureBytes(1);
static_cast<void> (read_u8());
}
@@ -259,9 +265,9 @@
///
/// aligned read
///
- /// Will throw ParserException if no terminating null is found within
tag boundaries
- ///
- void read_string(std::string& to);
+ /// Will throw ParserException if no terminating null is found within
+ /// tag boundaries
+ void read_string(std::string& to);
/// Reads a sized string into a provided std::string.
//
=== modified file 'libcore/impl.cpp'
--- a/libcore/impl.cpp 2009-05-18 13:41:45 +0000
+++ b/libcore/impl.cpp 2009-05-19 10:18:34 +0000
@@ -32,10 +32,13 @@
#include "SWFMovieDefinition.h"
#include "swf.h"
#include "swf/TagLoadersTable.h"
+#include "RunInfo.h"
#include "URL.h"
#include "StreamProvider.h"
#include "MovieClip.h"
#include "VM.h"
+
+#include "swf/tag_loaders.h"
#include "ScriptLimitsTag.h"
#include "BitmapMovieDefinition.h"
#include "DefineFontAlignZonesTag.h"
@@ -58,15 +61,15 @@
#include "DefineVideoStreamTag.h"
#include "DefineFontNameTag.h"
#include "VideoFrameTag.h"
-#include "swf/tag_loaders.h" // for all tag loaders..
-#include "RunInfo.h"
-#ifdef GNASH_USE_GC
-#include "GC.h"
-#endif
-
#ifdef ENABLE_AVM2
# include "SymbolClassTag.h"
# include "DoABCTag.h"
+# include "DefineSceneAndFrameLabelDataTag.h"
+#endif
+
+
+#ifdef GNASH_USE_GC
+#include "GC.h"
#endif
#include <string>
@@ -120,8 +123,8 @@
register_tag_loader(SWF::DEFINESHAPE, DefineShapeTag::loader);
register_tag_loader(SWF::FREECHARACTER, fixme_loader); // 03
register_tag_loader(SWF::PLACEOBJECT, PlaceObject2Tag::loader);
- register_tag_loader(SWF::REMOVEOBJECT, RemoveObjectTag::loader); // 05
- register_tag_loader(SWF::DEFINEBITS, define_bits_jpeg_loader);
+ register_tag_loader(SWF::REMOVEOBJECT, RemoveObjectTag::loader); // 05
+ register_tag_loader(SWF::DEFINEBITS, define_bits_jpeg_loader);
register_tag_loader(SWF::DEFINEBUTTON, DefineButtonTag::loader);
register_tag_loader(SWF::JPEGTABLES, jpeg_tables_loader);
register_tag_loader(SWF::SETBACKGROUNDCOLOR,
SetBackgroundColorTag::loader);
@@ -259,7 +262,7 @@
register_tag_loader(SWF::DOABCDEFINE, DoABCTag::loader);
// 86
register_tag_loader(SWF::DEFINESCENEANDFRAMELABELDATA,
- define_scene_frame_label_loader);
+ DefineSceneAndFrameLabelDataTag::loader);
#endif
}
=== modified file 'libcore/swf/ControlTag.h'
--- a/libcore/swf/ControlTag.h 2009-04-15 06:41:11 +0000
+++ b/libcore/swf/ControlTag.h 2009-05-19 10:52:48 +0000
@@ -49,14 +49,15 @@
}
/// Execute this tag, whatever it is.
- virtual void execute(MovieClip* /*m*/, DisplayList& /*dlist*/) const
+ //
+ /// The default does nothing.
+ virtual void execute(MovieClip* /*m*/, DisplayList& /*dlist*/) const
{
}
/// Execute this tag but only if it's a "state" tag.
//
/// State tags include all tags except action tags.
- ///
virtual void execute_state(MovieClip* /*m*/, DisplayList& /*dlist*/)
const
{
}
@@ -64,11 +65,13 @@
/// Execute this tag but only if it is an action tag
void execute_action(MovieClip* m, DisplayList& dlist) const
{
- if ( is_action_tag() ) execute(m, dlist);
+ if (is_action_tag()) execute(m, dlist);
}
/// Return true if this is an action tag.
- virtual bool is_action_tag() const { return false; }
+ //
+ /// The default returns false.
+ virtual bool is_action_tag() const { return false; }
};
=== added file 'libcore/swf/DefineSceneAndFrameLabelDataTag.h'
--- a/libcore/swf/DefineSceneAndFrameLabelDataTag.h 1970-01-01 00:00:00
+0000
+++ b/libcore/swf/DefineSceneAndFrameLabelDataTag.h 2009-05-19 10:56:40
+0000
@@ -0,0 +1,118 @@
+//
+// 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_SCENEANDLABELTAG_H
+#define GNASH_SWF_SCENEANDLABELTAG_H
+
+#include "ControlTag.h"
+#include "swf.h"
+#include "MovieClip.h"
+#include "SWFStream.h"
+#include "VM.h"
+#include "log.h"
+
+#include <map>
+
+// Forward declarations
+namespace gnash {
+ class movie_definition;
+}
+
+namespace gnash {
+namespace SWF {
+
+class DefineSceneAndFrameLabelDataTag : public ControlTag
+{
+public:
+
+ /// TODO: implement this.
+ virtual void execute(MovieClip* /*m*/, DisplayList& /* dlist */) const
+ {
+ log_unimpl("DefineSceneAndFrameLabelDataTag");
+ }
+
+ static void loader(SWFStream& in, TagType tag, movie_definition& m,
+ const RunInfo& /*r*/)
+ {
+ assert(tag == DEFINESCENEANDFRAMELABELDATA);
+
+ if (!m.isAS3()) {
+ IF_VERBOSE_MALFORMED_SWF(
+ log_swferror("SWF contains DefineSceneAndFrameLabelData tag, "
+ "but is not an AS3 SWF!");
+ );
+ throw ParserException("DefineSceneAndFrameLabelData tag found in "
+ "non-AS3 SWF!");
+ }
+
+ DefineSceneAndFrameLabelDataTag* t =
+ new DefineSceneAndFrameLabelDataTag(in);
+
+ /// This tag is only added to the main timeline (SWFMovieDefinition).
+ m.addControlTag(t);
+
+ }
+
+private:
+
+ DefineSceneAndFrameLabelDataTag(SWFStream& in)
+ {
+ read(in);
+ }
+
+ void read(SWFStream& in) {
+
+ boost::uint32_t scenes = in.read_V32();
+
+ log_parse("Scene count: %d", scenes);
+
+ for (size_t i = 0; i < scenes; ++i) {
+ boost::uint32_t offset = in.read_V32();
+ std::string name;
+ in.read_string(name);
+ log_parse("Offset %d name: %s", offset, name);
+ _scenes[offset] = name;
+ }
+
+ boost::uint32_t labels = in.read_V32();
+
+ for (size_t i = 0; i < labels; ++i) {
+ boost::uint32_t num = in.read_V32();
+ std::string label;
+ in.read_string(label);
+ log_parse("Frame %d label: %s", num, label);
+ _frames[num] = label;
+ }
+
+ }
+
+ std::map<boost::uint32_t, std::string> _scenes;
+ std::map<boost::uint32_t, std::string> _frames;
+
+};
+
+} // namespace gnash::SWF
+} // namespace gnash
+
+
+#endif // GNASH_SWF_SYMBOLCLASSTAG_H
+
+
+// Local Variables:
+// mode: C++
+// indent-tabs-mode: t
+// End:
=== modified file 'libcore/swf/DoABCTag.h'
--- a/libcore/swf/DoABCTag.h 2009-05-18 13:41:45 +0000
+++ b/libcore/swf/DoABCTag.h 2009-05-19 10:18:34 +0000
@@ -41,11 +41,7 @@
{
public:
- DoABCTag(abc_block *block) : mABC(block)
-
- {}
-
- virtual void execute(MovieClip* /*m*/, DisplayList& /* dlist */) const
+ virtual void execute(MovieClip* /*m*/, DisplayList& /* dlist */) const
{
VM& vm = VM::get();
log_debug("getting machine.");
@@ -109,6 +105,8 @@
private:
+ DoABCTag(abc_block *block) : mABC(block) {}
+
abc_block *mABC;
};
=== modified file 'libcore/swf/DoActionTag.h'
--- a/libcore/swf/DoActionTag.h 2009-05-18 13:41:45 +0000
+++ b/libcore/swf/DoActionTag.h 2009-05-19 10:18:34 +0000
@@ -40,11 +40,6 @@
{
public:
- DoActionTag(movie_definition& md)
- :
- m_buf(md)
- {}
-
/// Read a DoAction block from the stream
//
void read(SWFStream& in)
@@ -87,6 +82,11 @@
private:
+ DoActionTag(movie_definition& md)
+ :
+ m_buf(md)
+ {}
+
action_buffer m_buf;
};
=== modified file 'libcore/swf/SymbolClassTag.h'
--- a/libcore/swf/SymbolClassTag.h 2009-05-18 13:41:45 +0000
+++ b/libcore/swf/SymbolClassTag.h 2009-05-19 10:18:34 +0000
@@ -40,12 +40,6 @@
{
public:
- SymbolClassTag(std::string name)
- :
- _rootClass(name)
-
- {}
-
virtual void execute(MovieClip* /*m*/, DisplayList& /* dlist */) const
{
VM& vm = VM::get();
@@ -87,6 +81,11 @@
}
private:
+
+ SymbolClassTag(std::string name)
+ :
+ _rootClass(name)
+ {}
const std::string _rootClass;
};
=== modified file 'libcore/swf/tag_loaders.cpp'
--- a/libcore/swf/tag_loaders.cpp 2009-05-18 13:41:45 +0000
+++ b/libcore/swf/tag_loaders.cpp 2009-05-19 10:18:34 +0000
@@ -1218,13 +1218,14 @@
}
if (flags.as3) {
- log_debug("This SWF uses AVM2 / AS3");
+ log_debug("This SWF uses AVM2");
#ifndef ENABLE_AVM2
- /// Log an error if this build can't interpret AS3.
+ /// Log an error if this build can't interpret AS3.
log_error(_("This SWF file requires AVM2, which was not enabled at "
"compile time."));
#endif
}
+ else log_debug("This SWF uses AVM1");
// TODO: - don't allow later FileAttributes tags in the same movie
// to override the first one used.
@@ -1239,14 +1240,15 @@
metadata_loader(SWFStream& in, TagType tag, movie_definition& m,
const RunInfo& /*r*/)
{
- assert(tag == SWF::METADATA); // 77
+ assert(tag == SWF::METADATA);
// this is supposed to be an XML string
std::string metadata;
in.read_string(metadata);
IF_VERBOSE_PARSE (
- log_parse(_(" RDF metadata (information only): [[\n%s\n]]"), metadata);
+ log_parse(_(" RDF metadata (information only): [[\n%s\n]]"),
+ metadata);
);
// The metadata tag exists exclusively for external
@@ -1330,24 +1332,6 @@
}
-void
-define_scene_frame_label_loader(SWFStream& in, TagType tag,
- movie_definition& /*m*/, const RunInfo& /*r*/)
-{
- assert(tag == SWF::DEFINESCENEANDFRAMELABELDATA); //86
-
- in.ensureBytes(4);
-
- boost::uint32_t scene_count = in.read_u32();
- std::stringstream ss;
- ss << "Scene count is " << scene_count << ".\n";
-
- log_debug("%s", ss.str());
-
- log_unimpl(_("%s tag parsed but not yet used"),
"DEFINESCENEANDFRAMELABELDATA");
-}
-
-
} // namespace gnash::SWF::tag_loaders
} // namespace gnash::SWF
=== modified file 'libcore/swf/tag_loaders.h'
--- a/libcore/swf/tag_loaders.h 2009-05-14 10:26:47 +0000
+++ b/libcore/swf/tag_loaders.h 2009-05-19 10:18:34 +0000
@@ -19,7 +19,8 @@
#ifndef GNASH_SWF_TAG_LOADERS_H
#define GNASH_SWF_TAG_LOADERS_H
-#include "swf.h" // for SWF::TagType
+#include "swf.h"
+#include "SWFStream.h"
#include <cassert>
@@ -81,8 +82,8 @@
// TODO: drop this loader ?
void end_loader(SWFStream& in, TagType tag, movie_definition&, const RunInfo&)
{
- assert(tag == SWF::END); // 0
- assert(in.tell() == in.get_tag_end_position());
+ assert(tag == SWF::END); // 0
+ assert(in.tell() == in.get_tag_end_position());
}
void remove_object_2_loader(SWFStream&, TagType, movie_definition&,
@@ -135,10 +136,6 @@
serialnumber_loader(SWFStream& in, TagType tag, movie_definition& /*m*/,
const RunInfo& /*r*/);
-/// Load a SWF::DEFINESCENEANDFRAMELABELDATA tag.
-void
-define_scene_frame_label_loader(SWFStream& in, TagType tag,
- movie_definition& /*m*/, const RunInfo& /*r*/);
} // namespace gnash::SWF::tag_loaders
} // namespace gnash::SWF
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Gnash-commit] /srv/bzr/gnash/trunk r10884: Parse scenes and frame labels correctly and add as a control tag as documented.,
Benjamin Wolsey <=