[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Gnash-commit] /srv/bzr/gnash/trunk r11116: Make things more modular. In
From: |
Benjamin Wolsey |
Subject: |
[Gnash-commit] /srv/bzr/gnash/trunk r11116: Make things more modular. Introduce a MovieFactory, currently with only |
Date: |
Mon, 15 Jun 2009 18:27:26 +0200 |
User-agent: |
Bazaar (1.13.1) |
------------------------------------------------------------
revno: 11116
committer: Benjamin Wolsey <address@hidden>
branch nick: trunk
timestamp: Mon 2009-06-15 18:27:26 +0200
message:
Make things more modular. Introduce a MovieFactory, currently with only
static methods, as it's not yet available where it would be needed as
an object.
added:
libcore/MovieLibrary.h
libcore/swf/DefaultTagLoaders.cpp
libcore/swf/DefaultTagLoaders.h
renamed:
libcore/impl.h => libcore/MovieFactory.h
libcore/swf/swf.cpp => libcore/swf/SWF.cpp
libcore/swf/swf.h => libcore/swf/SWF.h
modified:
cygnal/cvm.cpp
gui/Player.cpp
gui/pythonmod/gnash-view.cpp
libbase/shm.h
libcore/DisplayList.h
libcore/Makefile.am
libcore/MovieClip.cpp
libcore/RGBA.h
libcore/RunInfo.h
libcore/SWFStream.cpp
libcore/SWFStream.h
libcore/asobj/Math_as.h
libcore/asobj/NetStream_as.h
libcore/asobj/flash/media/Sound_as.h
libcore/asobj/flash/xml/XMLNode_as.h
libcore/debugger.cpp
libcore/fill_style.cpp
libcore/fill_style.h
libcore/fontlib.cpp
libcore/gnash.h
libcore/impl.cpp
libcore/movie_root.cpp
libcore/parser/SWFParser.cpp
libcore/parser/SWFParser.h
libcore/parser/action_buffer.cpp
libcore/styles.cpp
libcore/styles.h
libcore/swf/DefineButtonCxformTag.cpp
libcore/swf/DefineButtonCxformTag.h
libcore/swf/DefineButtonSoundTag.h
libcore/swf/DefineButtonTag.cpp
libcore/swf/DefineButtonTag.h
libcore/swf/DefineEditTextTag.h
libcore/swf/DefineFontNameTag.h
libcore/swf/DefineFontTag.cpp
libcore/swf/DefineFontTag.h
libcore/swf/DefineMorphShapeTag.h
libcore/swf/DefineSceneAndFrameLabelDataTag.h
libcore/swf/DefineShapeTag.cpp
libcore/swf/DefineShapeTag.h
libcore/swf/DefineTextTag.cpp
libcore/swf/DefineTextTag.h
libcore/swf/DefineVideoStreamTag.h
libcore/swf/DisplayListTag.h
libcore/swf/DoABCTag.h
libcore/swf/DoActionTag.h
libcore/swf/DoInitActionTag.h
libcore/swf/PlaceObject2Tag.h
libcore/swf/RemoveObjectTag.cpp
libcore/swf/RemoveObjectTag.h
libcore/swf/ScriptLimitsTag.h
libcore/swf/SetBackgroundColorTag.h
libcore/swf/ShapeRecord.cpp
libcore/swf/StartSoundTag.h
libcore/swf/StreamSoundBlockTag.h
libcore/swf/SymbolClassTag.h
libcore/swf/TagLoadersTable.cpp
libcore/swf/TagLoadersTable.h
libcore/swf/TextRecord.cpp
libcore/swf/TextRecord.h
libcore/swf/VideoFrameTag.h
libcore/swf/tag_loaders.cpp
libcore/swf/tag_loaders.h
libcore/swf_function.h
libcore/vm/ASHandlers.cpp
libcore/vm/ASHandlers.h
libcore/vm/ActionExec.cpp
libcore/vm/ActionExec.h
libcore/vm/Machine.h
libcore/vm/action.cpp
plugin/win32/plugin.cpp
testsuite/MovieTester.cpp
utilities/processor.cpp
libcore/MovieFactory.h
libcore/swf/SWF.cpp
------------------------------------------------------------
revno: 11112.1.1
committer: Benjamin Wolsey <address@hidden>
branch nick: test
timestamp: Mon 2009-06-15 13:32:49 +0200
message:
Rename swf.h and swf.cpp to match Gnash file naming style.
renamed:
libcore/swf/swf.cpp => libcore/swf/SWF.cpp
libcore/swf/swf.h => libcore/swf/SWF.h
modified:
libcore/Makefile.am
libcore/RGBA.h
libcore/SWFStream.cpp
libcore/SWFStream.h
libcore/debugger.cpp
libcore/fill_style.cpp
libcore/fill_style.h
libcore/impl.cpp
libcore/parser/SWFParser.h
libcore/parser/action_buffer.cpp
libcore/styles.cpp
libcore/styles.h
libcore/swf/DefineButtonCxformTag.cpp
libcore/swf/DefineButtonCxformTag.h
libcore/swf/DefineButtonSoundTag.h
libcore/swf/DefineButtonTag.cpp
libcore/swf/DefineButtonTag.h
libcore/swf/DefineEditTextTag.h
libcore/swf/DefineFontNameTag.h
libcore/swf/DefineFontTag.cpp
libcore/swf/DefineFontTag.h
libcore/swf/DefineMorphShapeTag.h
libcore/swf/DefineSceneAndFrameLabelDataTag.h
libcore/swf/DefineShapeTag.cpp
libcore/swf/DefineShapeTag.h
libcore/swf/DefineTextTag.cpp
libcore/swf/DefineTextTag.h
libcore/swf/DefineVideoStreamTag.h
libcore/swf/DisplayListTag.h
libcore/swf/DoABCTag.h
libcore/swf/DoActionTag.h
libcore/swf/DoInitActionTag.h
libcore/swf/PlaceObject2Tag.h
libcore/swf/RemoveObjectTag.cpp
libcore/swf/RemoveObjectTag.h
libcore/swf/ScriptLimitsTag.h
libcore/swf/SetBackgroundColorTag.h
libcore/swf/ShapeRecord.cpp
libcore/swf/StartSoundTag.h
libcore/swf/StreamSoundBlockTag.h
libcore/swf/SymbolClassTag.h
libcore/swf/TagLoadersTable.cpp
libcore/swf/TagLoadersTable.h
libcore/swf/TextRecord.cpp
libcore/swf/TextRecord.h
libcore/swf/VideoFrameTag.h
libcore/swf/tag_loaders.cpp
libcore/swf/tag_loaders.h
libcore/vm/ASHandlers.cpp
libcore/vm/ASHandlers.h
libcore/vm/ActionExec.cpp
libcore/vm/ActionExec.h
libcore/vm/Machine.h
libcore/vm/action.cpp
libcore/swf/SWF.cpp
------------------------------------------------------------
revno: 11112.1.2
committer: Benjamin Wolsey <address@hidden>
branch nick: test
timestamp: Mon 2009-06-15 14:07:43 +0200
message:
Put Gnash's default tag loaders in their own file, away from impl.cpp.
Make TagLoadersTable non-static, not a singleton, and for now solely owned
by RunInfo. Load table on startup (temporarily RunInfo construction) as
there is no advantage to later initialization.
Clean up includes. Rename loader_function to LoaderFunction and expose
typedefs from TagLoadersTable.
added:
libcore/swf/DefaultTagLoaders.cpp
libcore/swf/DefaultTagLoaders.h
modified:
libcore/Makefile.am
libcore/RunInfo.h
libcore/impl.cpp
libcore/impl.h
libcore/parser/SWFParser.cpp
libcore/swf/ScriptLimitsTag.h
libcore/swf/SymbolClassTag.h
libcore/swf/TagLoadersTable.cpp
libcore/swf/TagLoadersTable.h
libcore/swf/tag_loaders.cpp
libcore/swf/tag_loaders.h
------------------------------------------------------------
revno: 11112.1.3
committer: Benjamin Wolsey <address@hidden>
branch nick: test
timestamp: Mon 2009-06-15 14:30:59 +0200
message:
Add a TagLoadersTable to RunInfos.
modified:
gui/Player.cpp
libcore/RunInfo.h
testsuite/MovieTester.cpp
utilities/processor.cpp
------------------------------------------------------------
revno: 11112.1.4
committer: Benjamin Wolsey <address@hidden>
branch nick: test
timestamp: Mon 2009-06-15 14:46:38 +0200
message:
Change the way loaders are added to encapsulate it better.
modified:
gui/Player.cpp
libcore/swf/DefaultTagLoaders.cpp
libcore/swf/DefaultTagLoaders.h
testsuite/MovieTester.cpp
utilities/processor.cpp
------------------------------------------------------------
revno: 11112.1.5
committer: Benjamin Wolsey <address@hidden>
branch nick: test
timestamp: Mon 2009-06-15 15:46:54 +0200
message:
Move MovieLibrary to its own file.
modified:
libcore/Makefile.am
libcore/impl.cpp
------------------------------------------------------------
revno: 11112.1.6
committer: Benjamin Wolsey <address@hidden>
branch nick: test
timestamp: Mon 2009-06-15 15:50:02 +0200
message:
Add file.
added:
libcore/MovieLibrary.h
------------------------------------------------------------
revno: 11112.1.7
committer: Benjamin Wolsey <address@hidden>
branch nick: test
timestamp: Mon 2009-06-15 15:52:23 +0200
message:
Drop function declaration from impl.h.
modified:
libcore/impl.h
------------------------------------------------------------
revno: 11112.1.8
committer: Benjamin Wolsey <address@hidden>
branch nick: test
timestamp: Mon 2009-06-15 15:58:12 +0200
message:
Drop function declarations from gnash.h
modified:
libcore/gnash.h
------------------------------------------------------------
revno: 11112.1.9
committer: Benjamin Wolsey <address@hidden>
branch nick: test
timestamp: Mon 2009-06-15 15:59:04 +0200
message:
Drop includes.
modified:
libcore/impl.h
------------------------------------------------------------
revno: 11112.1.10
committer: Benjamin Wolsey <address@hidden>
branch nick: test
timestamp: Mon 2009-06-15 16:04:56 +0200
message:
Forward declare RunInfo now it's not included via other headers.
modified:
libcore/swf/DefineMorphShapeTag.h
libcore/swf/DefineShapeTag.h
------------------------------------------------------------
revno: 11112.1.11
committer: Benjamin Wolsey <address@hidden>
branch nick: test
timestamp: Mon 2009-06-15 16:07:12 +0200
message:
Drop unnecessary includes of impl.h.
modified:
libcore/DisplayList.h
libcore/asobj/flash/media/Sound_as.h
libcore/asobj/flash/xml/XMLNode_as.h
libcore/swf_function.h
------------------------------------------------------------
revno: 11112.1.12
committer: Benjamin Wolsey <address@hidden>
branch nick: test
timestamp: Mon 2009-06-15 16:08:03 +0200
message:
More unnecessry includes.
modified:
libcore/asobj/NetStream_as.h
libcore/swf/DefineShapeTag.cpp
------------------------------------------------------------
revno: 11112.1.13
committer: Benjamin Wolsey <address@hidden>
branch nick: test
timestamp: Mon 2009-06-15 16:08:58 +0200
message:
Correct header guard.
modified:
libcore/asobj/Math_as.h
------------------------------------------------------------
revno: 11112.1.14
committer: Benjamin Wolsey <address@hidden>
branch nick: test
timestamp: Mon 2009-06-15 16:10:05 +0200
message:
Drop more useless includes.
modified:
libcore/asobj/Math_as.h
libcore/fill_style.cpp
libcore/fontlib.cpp
libcore/styles.cpp
libcore/styles.h
------------------------------------------------------------
revno: 11112.1.15
committer: Benjamin Wolsey <address@hidden>
branch nick: test
timestamp: Mon 2009-06-15 16:46:41 +0200
message:
Introduce MovieFactory class, presently with only static methods. Move
Movie creation functions from gnash.h to the new class.
renamed:
libcore/impl.h => libcore/MovieFactory.h
modified:
cygnal/cvm.cpp
gui/Player.cpp
gui/pythonmod/gnash-view.cpp
libbase/shm.h
libcore/Makefile.am
libcore/MovieClip.cpp
libcore/gnash.h
libcore/impl.cpp
libcore/movie_root.cpp
libcore/swf/tag_loaders.cpp
plugin/win32/plugin.cpp
testsuite/MovieTester.cpp
utilities/processor.cpp
libcore/MovieFactory.h
------------------------------------------------------------
revno: 11112.1.16
committer: Benjamin Wolsey <address@hidden>
branch nick: test
timestamp: Mon 2009-06-15 16:53:11 +0200
message:
Rename createMovie to makeMovie to avoid annoying name conflict with
movie_definition::createMovie (makes grepping harder).
modified:
gui/Player.cpp
libcore/MovieClip.cpp
libcore/MovieFactory.h
libcore/impl.cpp
libcore/movie_root.cpp
libcore/swf/tag_loaders.cpp
testsuite/MovieTester.cpp
utilities/processor.cpp
------------------------------------------------------------
revno: 11112.1.17
committer: Benjamin Wolsey <address@hidden>
branch nick: test
timestamp: Mon 2009-06-15 17:38:47 +0200
message:
Drop useless include.
modified:
libcore/gnash.h
------------------------------------------------------------
revno: 11112.1.18
committer: Benjamin Wolsey <address@hidden>
branch nick: test
timestamp: Mon 2009-06-15 17:47:34 +0200
message:
Add documentation from old gnash.h to MovieFactory.
modified:
libcore/MovieFactory.h
=== modified file 'cygnal/cvm.cpp'
--- a/cygnal/cvm.cpp 2009-04-15 05:33:51 +0000
+++ b/cygnal/cvm.cpp 2009-06-15 16:27:26 +0000
@@ -55,6 +55,7 @@
#include "smart_ptr.h"
#include "IOChannel.h" // for proper dtor call
#include "GnashSleep.h" // for usleep comptibility.
+#include "MovieFactory.h"
extern "C"{
#ifdef HAVE_GETOPT_H
@@ -406,7 +407,7 @@
{
std::auto_ptr<IOChannel> in (
noseek_fd_adapter::make_stream(fileno(stdin)) );
- md = gnash::create_movie(in, filename, runInfo, false);
+ md = gnash::MovieFactory::makeMovie(in, filename, runInfo, false);
}
else
{
@@ -423,7 +424,7 @@
log_debug(_("%s appended to local sandboxes"), path.c_str());
#endif
}
- md = gnash::create_library_movie(url, runInfo, NULL, false);
+ md = gnash::MovieFactory::makeMovie(url, runInfo, NULL, false);
}
}
catch (GnashException& ge)
=== modified file 'gui/Player.cpp'
--- a/gui/Player.cpp 2009-04-26 17:26:09 +0000
+++ b/gui/Player.cpp 2009-06-15 14:53:11 +0000
@@ -28,7 +28,7 @@
#include "gui.h"
#include "NullGui.h"
-#include "gnash.h" // still needed ?
+#include "MovieFactory.h"
#include "movie_definition.h"
#include "sound_handler.h" // for set_sound_handler and create_sound_handler_*
#include "MovieClip.h" // for setting FlashVars
@@ -36,6 +36,8 @@
#include "Player.h"
#include "StreamProvider.h"
+#include "swf/TagLoadersTable.h"
+#include "swf/DefaultTagLoaders.h"
#include "NamingPolicy.h"
#include "StringPredicates.h"
#include "URL.h"
@@ -261,7 +263,7 @@
{
std::auto_ptr<IOChannel> in (
noseek_fd_adapter::make_stream(fileno(stdin)));
- md = gnash::create_movie(in, _url, *_runInfo, false);
+ md = MovieFactory::makeMovie(in, _url, *_runInfo, false);
}
else
{
@@ -272,7 +274,7 @@
// We'll need to allow load of the file, no matter virtual url
// specified...
// This is kind of hackish, cleaner would be adding an argument
- // to create_library_movie to skip the security checking phase.
+ // to createMovie to skip the security checking phase.
// NOTE that if we fail to allow this load, the konqueror
plugin
// would not be able to load anything
//
@@ -281,7 +283,7 @@
}
// _url should be always set at this point...
- md = gnash::create_library_movie(url, *_runInfo, _url.c_str(),
+ md = MovieFactory::makeMovie(url, *_runInfo, _url.c_str(),
false);
}
} catch (const GnashException& er) {
@@ -377,6 +379,10 @@
_runInfo.reset(new RunInfo(baseURL.str()));
_runInfo->setSoundHandler(_soundHandler);
+ boost::shared_ptr<SWF::TagLoadersTable> loaders(new
SWF::TagLoadersTable());
+ addDefaultLoaders(*loaders);
+ _runInfo->setTagLoaders(loaders);
+
std::auto_ptr<NamingPolicy> np(new IncrementalRename(_baseurl));
boost::shared_ptr<StreamProvider> sp(new StreamProvider(np));
=== modified file 'gui/pythonmod/gnash-view.cpp'
--- a/gui/pythonmod/gnash-view.cpp 2009-05-01 17:12:03 +0000
+++ b/gui/pythonmod/gnash-view.cpp 2009-06-15 14:46:41 +0000
@@ -455,7 +455,7 @@
}
// Load the actual movie.
- view->movie_definition.reset(gnash::create_library_movie(url,
+ view->movie_definition.reset(gnash::createMovie(url,
*view->run_info, url.str().c_str(), false));
g_return_if_fail(view->movie_definition.get() != NULL);
=== modified file 'libbase/shm.h'
--- a/libbase/shm.h 2009-02-25 22:33:03 +0000
+++ b/libbase/shm.h 2009-06-15 14:46:41 +0000
@@ -24,7 +24,6 @@
#include <string>
-//#include "impl.h"
#include "as_object.h" // for inheritance
#include <sys/types.h>
=== modified file 'libcore/DisplayList.h'
--- a/libcore/DisplayList.h 2009-06-02 12:38:45 +0000
+++ b/libcore/DisplayList.h 2009-06-15 14:07:12 +0000
@@ -8,7 +8,6 @@
// (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.
//
@@ -20,7 +19,6 @@
#ifndef GNASH_DLIST_H
#define GNASH_DLIST_H
-#include "impl.h"
#include "snappingrange.h"
#include "DisplayObject.h"
=== modified file 'libcore/Makefile.am'
--- a/libcore/Makefile.am 2009-06-13 20:34:48 +0000
+++ b/libcore/Makefile.am 2009-06-15 14:46:41 +0000
@@ -87,8 +87,9 @@
namedStrings.cpp \
rect.cpp \
MovieClip.cpp \
- swf/swf.cpp \
+ swf/SWF.cpp \
swf/TagLoadersTable.cpp \
+ swf/DefaultTagLoaders.cpp \
swf/DefineVideoStreamTag.cpp \
swf/DefineTextTag.cpp \
swf/DefineButtonSoundTag.cpp \
@@ -166,7 +167,9 @@
SWFMovie.h \
render.h \
SWFStream.h \
+ MovieLibrary.h \
swf/tag_loaders.h \
+ swf/DefaultTagLoaders.h \
swf/VideoFrameTag.h \
swf/DefineVideoStreamTag.h \
swf/DefineFontAlignZonesTag.h \
@@ -243,8 +246,8 @@
swf/DefinitionTag.h \
swf/ShapeRecord.h \
swf/TagLoadersTable.h \
- swf/swf.h \
- impl.h \
+ swf/SWF.h \
+ MovieFactory.h \
fill_style.h \
styles.h \
ExportableResource.h \
=== modified file 'libcore/MovieClip.cpp'
--- a/libcore/MovieClip.cpp 2009-06-09 07:59:09 +0000
+++ b/libcore/MovieClip.cpp 2009-06-15 14:53:11 +0000
@@ -21,6 +21,7 @@
#include "gnashconfig.h" // USE_SWFTREE
#endif
+#include "MovieFactory.h"
#include "log.h"
#include "action.h" // for call_method_parsed (call_method_args)
#include "MovieClip.h"
@@ -2280,7 +2281,7 @@
const movie_root& mr = _vm.getRoot();
boost::intrusive_ptr<movie_definition> md(
- create_library_movie(url, mr.runInfo(), NULL, true, postdata));
+ MovieFactory::makeMovie(url, mr.runInfo(), NULL, true, postdata));
if (!md)
{
=== renamed file 'libcore/impl.h' => 'libcore/MovieFactory.h'
--- a/libcore/impl.h 2009-04-28 15:22:32 +0000
+++ b/libcore/MovieFactory.h 2009-06-15 15:47:34 +0000
@@ -16,29 +16,106 @@
// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
-#ifndef GNASH_IMPL_H
-#define GNASH_IMPL_H
+#ifndef GNASH_MOVIE_FACTORY_H
+#define GNASH_MOVIE_FACTORY_H
#include "dsodefs.h"
-#include "smart_ptr.h"
-#include "TagLoadersTable.h"
-
-namespace gnash {
-
-//
-// Loader callbacks.
-//
-
-// Register a loader function for a certain tag type. Most
-// standard tags are handled within gnash. Host apps might want
-// to call this in order to handle special tag types.
-
-/// Register a tag loader for the given tag
-void register_tag_loader(SWF::TagType t,
- SWF::TagLoadersTable::loader_function lf);
-
-} // end namespace gnash
+#include <string>
+#include <memory>
+
+namespace gnash {
+ class IOChannel;
+ class RunInfo;
+ class movie_definition;
+ class URL;
+}
+
+namespace gnash {
+
+class MovieFactory
+{
+public:
+
+ /// Create a gnash::movie_definition from the given URL
+ //
+ /// The URL can correspond to either a JPEG or SWF file.
+ ///
+ /// This is just like create_movie(), except that it checks the
+ /// "library" to see if a movie of this name has already been
+ /// created, and returns that movie if so. Also, if it creates
+ /// a new movie, it adds it back into the library.
+ ///
+ /// The "library" is used when importing symbols from external
+ /// movies, so this call might be useful if you want to
+ /// explicitly load a movie that you know exports symbols
+ /// (e.g. fonts) to other movies as well.
+ ///
+ /// @@ this explanation/functionality could be clearer!
+ ///
+ /// This calls add_ref() on the newly created definition; call
+ /// drop_ref() when you're done with it.
+ /// Or use boost::intrusive_ptr<T> from base/smart_ptr.h if you want.
+ ///
+ /// If real_url is given, the movie's url will be set to that value.
+ ///
+ /// @param url
+ /// The URL to load the movie from.
+ ///
+ /// @param runInfo
+ /// A RunInfo containing resources needed for parsing, such as the
+ /// base URL for the run, the sound::sound_handler, and a StreamProvider.
+ ///
+ /// @param real_url
+ /// The url to encode as the _url member of the resulting
+ /// movie definition. Use NULL if it is not different from
+ /// the actual url (default). This is used to simulate a run from
+ /// the official publication url.
+ ///
+ /// @param startLoaderThread
+ /// If false only the header will be read, and you'll need to call
+ /// completeLoad on the returned movie_definition to actually start it.
+ /// This is typically used to postpone parsing until a VirtualMachine
+ /// is initialized. Initializing the VirtualMachine requires a target
+ /// SWF version, which can be found in the SWF header.
+ ///
+ /// @param postdata
+ /// If not NULL, use POST method (only valid for HTTP).
+ /// NOTE: when POSTing, the movies library won't be used.
+ static DSOEXPORT movie_definition* makeMovie(const URL& url,
+ const RunInfo& runInfo, const char* real_url = NULL,
+ bool startLoaderThread = true, const std::string* postdata = NULL);
+
+ /// Load a movie from an already opened stream.
+ //
+ /// The movie can be both an SWF or JPEG, the url parameter
+ /// will be used to set the _url member of the resulting object.
+ ///
+ /// @param in
+ /// The stream to load the movie from. Ownership is transferred
+ /// to the returned object.
+ ///
+ /// @param url
+ /// The url to use as the _url member of the resulting
+ /// movie definition. This is required as it can not be
+ /// derived from the IOChannel.
+ ///
+ /// @param runInfo
+ /// A RunInfo containing resources needed for parsing, such as the
+ /// base URL for the run, the sound::sound_handler, and a StreamProvider.
+ ///
+ /// @param startLoaderThread
+ /// If false only the header will be read, and you'll need to call
+ /// completeLoad on the returned movie_definition to actually start it.
+ /// This is typically used to postpone parsing until a VirtualMachine
+ /// is initialized. Initializing the VirtualMachine requires a target
+ /// SWF version, which can be found in the SWF header.
+ static DSOEXPORT movie_definition* makeMovie(std::auto_ptr<IOChannel> in,
+ const std::string& url, const RunInfo& runInfo,
+ bool startLoaderThread);
+};
+
+} // namespace gnash
#endif // GNASH_IMPL_H
=== added file 'libcore/MovieLibrary.h'
--- a/libcore/MovieLibrary.h 1970-01-01 00:00:00 +0000
+++ b/libcore/MovieLibrary.h 2009-06-15 13:50:02 +0000
@@ -0,0 +1,140 @@
+//
+// Copyright (C) 2005, 2006, 2007, 2008, 2009 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_MOVIELIBRARY_H
+#define GNASH_MOVIELIBRARY_H
+
+#include "rc.h"
+#include "movie_definition.h"
+
+#include <map>
+#include <algorithm>
+
+namespace gnash {
+
+/// Library of SWF movies indexed by URL strings
+//
+/// Elements are actually movie_definitions, the ones
+/// associated with URLS. They may be BitmapMovieDefinitions or
+/// SWFMovieDefinitions.
+class MovieLibrary
+{
+public:
+
+ struct LibraryItem
+ {
+ boost::intrusive_ptr<movie_definition> def;
+ unsigned hitCount;
+ };
+
+ typedef std::map<std::string, LibraryItem> LibraryContainer;
+
+ MovieLibrary()
+ :
+ _limit(8)
+ {
+ RcInitFile& rcfile = RcInitFile::getDefaultInstance();
+ setLimit(rcfile.getMovieLibraryLimit());
+ }
+
+ /// Sets the maximum number of items to hold in the library. When adding
new
+ /// items, the one with the least hit count is being removed in that case.
+ /// Zero is a valid limit (disables library).
+ void setLimit(LibraryContainer::size_type limit)
+ {
+ _limit = limit;
+ limitSize(_limit);
+ }
+
+ bool get(const std::string& key,
+ boost::intrusive_ptr<movie_definition>* ret)
+ {
+ LibraryContainer::iterator it = _map.find(key);
+ if (it == _map.end()) return false;
+
+ *ret = it->second.def;
+ it->second.hitCount++;
+ return true;
+ }
+
+#ifdef GNASH_USE_GC
+ /// Mark all library elements as reachable (for GC)
+ void markReachableResources() const
+ {
+ for (LibraryContainer::const_iterator i=_map.begin(), e=_map.end();
+ i!=e; ++i)
+ {
+ i->second.def->setReachable();
+ }
+ }
+#endif
+
+ void add(const std::string& key, movie_definition* mov)
+ {
+
+ if (!_limit) return;
+
+ if (_limit) limitSize(_limit - 1);
+
+ LibraryItem temp;
+
+ temp.def = mov;
+ temp.hitCount = 0;
+
+ _map[key] = temp;
+ }
+
+
+ void clear() { _map.clear(); }
+
+private:
+
+ static bool findWorstHitCount(const LibraryContainer::value_type& a,
+ const LibraryContainer::value_type& b)
+ {
+ return (a.second.hitCount < b.second.hitCount);
+ }
+
+ LibraryContainer _map;
+ unsigned _limit;
+
+ void limitSize(LibraryContainer::size_type max) {
+
+ if (max < 1) {
+ clear();
+ return;
+ }
+
+ while (_map.size() > max) {
+ _map.erase(std::min_element(_map.begin(), _map.end(),
+ &findWorstHitCount));
+ }
+
+ }
+
+};
+
+}
+#endif
+
+
+// Local Variables:
+// mode: C++
+// c-basic-offset: 8
+// tab-width: 8
+// indent-tabs-mode: t
+// End:
=== modified file 'libcore/RGBA.h'
--- a/libcore/RGBA.h 2009-05-14 11:45:23 +0000
+++ b/libcore/RGBA.h 2009-06-15 11:32:49 +0000
@@ -8,7 +8,7 @@
#ifndef GNASH_TYPES_H
#define GNASH_TYPES_H
-#include "swf.h"
+#include "SWF.h"
#include <string>
#include <boost/cstdint.hpp> // for boost::?int??_t
=== modified file 'libcore/RunInfo.h'
--- a/libcore/RunInfo.h 2009-06-05 11:19:22 +0000
+++ b/libcore/RunInfo.h 2009-06-15 12:30:59 +0000
@@ -52,8 +52,7 @@
/// construction.
RunInfo(const std::string& baseURL)
:
- _baseURL(baseURL),
- _tagLoaders(SWF::TagLoadersTable::getInstance())
+ _baseURL(baseURL)
{
}
@@ -100,8 +99,20 @@
return _soundHandler.get();
}
+ /// Set the loader functions for SWF parsing.
+ //
+ /// This must be present before parsing.
+ /// It is a pointer to const so that the same table can be shared between
+ /// simultaneous runs if desired.
+ void setTagLoaders(boost::shared_ptr<const SWF::TagLoadersTable> loaders)
+ {
+ _tagLoaders = loaders;
+ }
+
+ /// Get the loader function table for parsing a SWF.
const SWF::TagLoadersTable& tagLoaders() const {
- return _tagLoaders;
+ assert(_tagLoaders.get());
+ return *_tagLoaders;
}
private:
@@ -112,7 +123,7 @@
boost::shared_ptr<sound::sound_handler> _soundHandler;
- const SWF::TagLoadersTable& _tagLoaders;
+ boost::shared_ptr<const SWF::TagLoadersTable> _tagLoaders;
};
=== modified file 'libcore/SWFStream.cpp'
--- a/libcore/SWFStream.cpp 2009-02-20 12:24:00 +0000
+++ b/libcore/SWFStream.cpp 2009-06-15 11:32:49 +0000
@@ -21,7 +21,7 @@
#include "log.h"
#include "IOChannel.h"
-#include "swf.h"
+#include "SWF.h"
#include "Property.h"
#include "action_buffer.h"
=== modified file 'libcore/SWFStream.h'
--- a/libcore/SWFStream.h 2009-05-19 09:54:11 +0000
+++ b/libcore/SWFStream.h 2009-06-15 11:32:49 +0000
@@ -19,7 +19,7 @@
#ifndef GNASH_STREAM_H
#define GNASH_STREAM_H
-#include "swf.h"
+#include "SWF.h"
#include "dsodefs.h" // still neded ?
#include "GnashException.h"
=== modified file 'libcore/asobj/Math_as.h'
--- a/libcore/asobj/Math_as.h 2009-02-25 22:33:03 +0000
+++ b/libcore/asobj/Math_as.h 2009-06-15 14:10:05 +0000
@@ -16,10 +16,9 @@
// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
//
-#ifndef __GMATH_H__
-#define __GMATH_H__
+#ifndef GNASH_ASOBJ_MATH_H
+#define GNASH_ASOBJ_MATH_H
-#include "impl.h"
#include "as_object.h"
namespace gnash {
=== modified file 'libcore/asobj/NetStream_as.h'
--- a/libcore/asobj/NetStream_as.h 2009-04-03 09:18:40 +0000
+++ b/libcore/asobj/NetStream_as.h 2009-06-15 14:08:03 +0000
@@ -28,7 +28,6 @@
#endif
#include "smart_ptr.h" // GNASH_USE_GC
-#include "impl.h"
#include "MediaParser.h"
#include "as_function.h" // for visibility of destructor by intrusive_ptr
#include "NetConnection_as.h"
=== modified file 'libcore/asobj/flash/media/Sound_as.h'
--- a/libcore/asobj/flash/media/Sound_as.h 2009-06-10 11:27:47 +0000
+++ b/libcore/asobj/flash/media/Sound_as.h 2009-06-15 14:07:12 +0000
@@ -25,7 +25,6 @@
#endif
#include "smart_ptr.h" //GNASH_USE_GC
-#include "impl.h"
#include "as_object.h"
#include <boost/scoped_ptr.hpp>
=== modified file 'libcore/asobj/flash/xml/XMLNode_as.h'
--- a/libcore/asobj/flash/xml/XMLNode_as.h 2009-06-04 21:48:41 +0000
+++ b/libcore/asobj/flash/xml/XMLNode_as.h 2009-06-15 14:07:12 +0000
@@ -26,7 +26,6 @@
#include "smart_ptr.h" // GNASH_USE_GC
#include "action.h"
-#include "impl.h"
#include "log.h"
#include <list>
=== modified file 'libcore/debugger.cpp'
--- a/libcore/debugger.cpp 2009-03-16 13:22:01 +0000
+++ b/libcore/debugger.cpp 2009-06-15 11:32:49 +0000
@@ -31,7 +31,7 @@
#include "log.h"
#include "as_value.h"
#include "as_environment.h"
-#include "swf.h"
+#include "SWF.h"
#include "ASHandlers.h"
#include "movie_root.h"
=== modified file 'libcore/fill_style.cpp'
--- a/libcore/fill_style.cpp 2009-05-14 11:45:23 +0000
+++ b/libcore/fill_style.cpp 2009-06-15 14:10:05 +0000
@@ -21,12 +21,11 @@
#include "smart_ptr.h" // GNASH_USE_GC
#include "fill_style.h"
-#include "impl.h"
#include "log.h"
#include "render.h"
#include "SWFStream.h"
#include "movie_definition.h"
-#include "swf.h"
+#include "SWF.h"
#include "GnashException.h"
#include "GnashNumeric.h"
#include <cmath> // sqrt, floor
=== modified file 'libcore/fill_style.h'
--- a/libcore/fill_style.h 2009-05-14 11:45:23 +0000
+++ b/libcore/fill_style.h 2009-06-15 11:32:49 +0000
@@ -24,7 +24,7 @@
#include "smart_ptr.h" // GNASH_USE_GC
#include "SWFMatrix.h"
#include "BitmapInfo.h"
-#include "swf.h"
+#include "SWF.h"
#include "RGBA.h" // for rgba type
#include <vector> // for composition
=== modified file 'libcore/fontlib.cpp'
--- a/libcore/fontlib.cpp 2009-04-07 12:34:43 +0000
+++ b/libcore/fontlib.cpp 2009-06-15 14:10:05 +0000
@@ -10,7 +10,6 @@
#endif
#include "Font.h"
-#include "impl.h"
#include "log.h"
#include "render.h"
#include "DefineShapeTag.h"
=== modified file 'libcore/gnash.h'
--- a/libcore/gnash.h 2009-01-22 20:10:39 +0000
+++ b/libcore/gnash.h 2009-06-15 15:38:47 +0000
@@ -25,7 +25,6 @@
#include "dsodefs.h"
-#include <memory> // for auto_ptr
#include <string>
namespace gnash {
@@ -73,134 +72,9 @@
// version of the library, depending on platform etc.
DSOEXPORT render_handler* create_render_handler_ogl(bool init = true);
-/// Create a gnash::movie_definition from the given URL.
-//
-/// The URL can correspond to either a JPEG or SWF file.
-///
-/// Uses the global StreamProvider 'streamProvider'
-/// to read the files themselves.
-///
-/// This calls add_ref() on the newly created definition; call
-/// drop_ref() when you're done with it.
-/// Or use boost::intrusive_ptr<T> from base/smart_ptr.h if you want.
-///
-/// @@ Hm, need to think about these creation API's. Perhaps
-/// divide it into "low level" and "high level" calls. Also,
-/// perhaps we need a "context" object that contains all
-/// global-ish flags, libraries, callback pointers, font
-/// library, etc.
-///
-/// If real_url is given, the movie's url will be set to that value.
-///
-/// @param url
-/// The URL to load the movie from.
-///
-/// @param real_url
-/// The url to encode as the _url member of the resulting
-/// movie definition. Use NULL if it is not different from
-/// the actual url (default). This is used to simulate a run from
-/// the official publication url.
-///
-/// @param startLoaderThread
-/// If false only the header will be read, and you'll need to call completeLoad
-/// on the returned movie_definition to actually start it. This is tipically
-/// used to postpone parsing until a VirtualMachine is initialized.
-/// Initializing the VirtualMachine requires a target SWF version, which can
-/// be found in the SWF header.
-///
-/// @param postdata
-/// If not NULL, use POST method (only valid for HTTP)
-///
-movie_definition* create_movie(const URL& url, const char* real_url=NULL, bool
startLoaderThread=true, const std::string* postdata=NULL);
-
-/// Load a movie from an already opened stream.
-//
-/// The movie can be both an SWF or JPEG, the url parameter
-/// will be used to set the _url member of the resulting object.
-///
-/// No attempt will be made to load associated .gsc (cache) files
-/// by this function.
-///
-/// @param in
-/// The stream to load the movie from. Ownership is transferred
-/// to the returned object.
-///
-/// @param url
-/// The url to use as the _url member of the resulting
-/// movie definition. This is required as it can not be
-/// derived from the IOChannel.
-///
-/// @param runInfo
-/// A RunInfo containing resources needed for parsing, such as the
-/// base URL for the run, the sound::sound_handler, and a StreamProvider.
-///
-/// @param startLoaderThread
-/// If false only the header will be read, and you'll need to call completeLoad
-/// on the returned movie_definition to actually start it. This is tipically
-/// used to postpone parsing until a VirtualMachine is initialized.
-/// Initializing the VirtualMachine requires a target SWF version, which can
-/// be found in the SWF header.
-///
-DSOEXPORT movie_definition* create_movie(std::auto_ptr<IOChannel> in,
- const std::string& url, const RunInfo& runInfo,
- bool startLoaderThread = true);
-
-/// \brief
-/// Create a gnash::movie_definition from the given URL
-//
-/// The URL can correspond to either a JPEG or SWF file.
-///
-/// This is just like create_movie(), except that it checks the
-/// "library" to see if a movie of this name has already been
-/// created, and returns that movie if so. Also, if it creates
-/// a new movie, it adds it back into the library.
-///
-/// The "library" is used when importing symbols from external
-/// movies, so this call might be useful if you want to
-/// explicitly load a movie that you know exports symbols
-/// (e.g. fonts) to other movies as well.
-///
-/// @@ this explanation/functionality could be clearer!
-///
-/// This calls add_ref() on the newly created definition; call
-/// drop_ref() when you're done with it.
-/// Or use boost::intrusive_ptr<T> from base/smart_ptr.h if you want.
-///
-/// If real_url is given, the movie's url will be set to that value.
-///
-/// @param url
-/// The URL to load the movie from.
-///
-/// @param runInfo
-/// A RunInfo containing resources needed for parsing, such as the
-/// base URL for the run, the sound::sound_handler, and a StreamProvider.
-///
-/// @param real_url
-/// The url to encode as the _url member of the resulting
-/// movie definition. Use NULL if it is not different from
-/// the actual url (default). This is used to simulate a run from
-/// the official publication url.
-///
-/// @param startLoaderThread
-/// If false only the header will be read, and you'll need to call completeLoad
-/// on the returned movie_definition to actually start it. This is tipically
-/// used to postpone parsing until a VirtualMachine is initialized.
-/// Initializing the VirtualMachine requires a target SWF version, which can
-/// be found in the SWF header.
-///
-/// @param postdata
-/// If not NULL, use POST method (only valid for HTTP).
-/// NOTE: when POSTing, the movies library won't be used.
-///
-DSOEXPORT movie_definition* create_library_movie(const URL& url,
- const RunInfo& runInfo, const char* real_url = NULL,
- bool startLoaderThread = true, const std::string* postdata = NULL);
-
-
-
/// Initialize gnash core library
//
-DSOEXPORT void gnashInit();
+DSOEXPORT void gnashInit();
/// Maximum release of resources.
//
=== modified file 'libcore/impl.cpp'
--- a/libcore/impl.cpp 2009-05-19 10:18:34 +0000
+++ b/libcore/impl.cpp 2009-06-15 14:53:11 +0000
@@ -21,52 +21,22 @@
# include "gnashconfig.h"
#endif
+#include "MovieFactory.h"
#include "smart_ptr.h" // GNASH_USE_GC
#include "IOChannel.h"
#include "utility.h"
-#include "impl.h"
#include "fontlib.h"
#include "log.h"
#include "GnashImage.h"
#include "sprite_definition.h"
#include "SWFMovieDefinition.h"
-#include "swf.h"
-#include "swf/TagLoadersTable.h"
+#include "BitmapMovieDefinition.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"
-#include "DefineShapeTag.h"
-#include "DefineButtonCxformTag.h"
-#include "CSMTextSettingsTag.h"
-#include "DefineFontTag.h"
-#include "DefineButtonTag.h"
-#include "DefineTextTag.h"
-#include "PlaceObject2Tag.h"
-#include "RemoveObjectTag.h"
-#include "DoActionTag.h"
-#include "DoInitActionTag.h"
-#include "DefineEditTextTag.h"
-#include "SetBackgroundColorTag.h"
-#include "StartSoundTag.h"
-#include "StreamSoundBlockTag.h"
-#include "DefineButtonSoundTag.h"
-#include "DefineMorphShapeTag.h"
-#include "DefineVideoStreamTag.h"
-#include "DefineFontNameTag.h"
-#include "VideoFrameTag.h"
-#ifdef ENABLE_AVM2
-# include "SymbolClassTag.h"
-# include "DoABCTag.h"
-# include "DefineSceneAndFrameLabelDataTag.h"
-#endif
-
+#include "MovieLibrary.h"
#ifdef GNASH_USE_GC
#include "GC.h"
@@ -77,7 +47,6 @@
#include <memory> // for auto_ptr
#include <algorithm>
-
namespace gnash
{
@@ -91,181 +60,6 @@
static void clear_library();
-// Associate the specified tag type with the given tag loader
-// function.
-void
-register_tag_loader(SWF::TagType t, SWF::TagLoadersTable::loader_function lf)
-{
- using SWF::TagLoadersTable;
-
- TagLoadersTable& table = TagLoadersTable::getInstance();
-
- bool loader_registered = table.register_loader(t, lf);
- assert(loader_registered);
-}
-
-static void ensure_loaders_registered()
-{
- using namespace SWF::tag_loaders;
- using namespace SWF;
-
- static bool s_registered = false;
-
- if (s_registered) return;
-
- // Register the standard loaders.
- s_registered = true;
-
- // End tag doesn't really need to exist.
- // TODO: use null_loader here ?
- register_tag_loader(SWF::END, end_loader);
-
- 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::DEFINEBUTTON, DefineButtonTag::loader);
- register_tag_loader(SWF::JPEGTABLES, jpeg_tables_loader);
- register_tag_loader(SWF::SETBACKGROUNDCOLOR,
SetBackgroundColorTag::loader);
- register_tag_loader(SWF::DEFINEFONT, DefineFontTag::loader);
- register_tag_loader(SWF::DEFINETEXT, DefineTextTag::loader);
- register_tag_loader(SWF::DOACTION, DoActionTag::loader);
- register_tag_loader(SWF::DEFINEFONTINFO, DefineFontInfoTag::loader);
- // 62
- register_tag_loader(SWF::DEFINEFONTINFO2, DefineFontInfoTag::loader);
- register_tag_loader(SWF::DEFINESOUND, define_sound_loader);
- register_tag_loader(SWF::STARTSOUND, StartSoundTag::loader);
- // 89
- register_tag_loader(SWF::STARTSOUND2, StartSound2Tag::loader);
-
- register_tag_loader(SWF::STOPSOUND, fixme_loader); // 16
-
- // 17
- register_tag_loader(SWF::DEFINEBUTTONSOUND, DefineButtonSoundTag::loader);
- // 18
- register_tag_loader(SWF::SOUNDSTREAMHEAD, sound_stream_head_loader);
- // 19
- register_tag_loader(SWF::SOUNDSTREAMBLOCK, StreamSoundBlockTag::loader);
- register_tag_loader(SWF::DEFINELOSSLESS, define_bits_lossless_2_loader);
- register_tag_loader(SWF::DEFINEBITSJPEG2, define_bits_jpeg2_loader);
- register_tag_loader(SWF::DEFINESHAPE2, DefineShapeTag::loader);
- register_tag_loader(SWF::DEFINEBUTTONCXFORM,
DefineButtonCxformTag::loader); // 23
- // "protect" tag; we're not an authoring tool so we don't care.
- // (might be nice to dump the password instead..)
- register_tag_loader(SWF::PROTECT, null_loader);
- register_tag_loader(SWF::PATHSAREPOSTSCRIPT, fixme_loader); // 25
- register_tag_loader(SWF::PLACEOBJECT2, PlaceObject2Tag::loader);
- // 27 - _UNKNOWN_ unimplemented
- register_tag_loader(SWF::REMOVEOBJECT2, RemoveObjectTag::loader); // 28
- register_tag_loader(SWF::SYNCFRAME, fixme_loader); // 29
- // 30 - _UNKNOWN_ unimplemented
- register_tag_loader(SWF::FREEALL, fixme_loader); // 31
- register_tag_loader(SWF::DEFINESHAPE3, DefineShapeTag::loader);
- register_tag_loader(SWF::DEFINETEXT2, DefineText2Tag::loader);
- // 37
- register_tag_loader(SWF::DEFINEBUTTON2, DefineButton2Tag::loader);
- register_tag_loader(SWF::DEFINEBITSJPEG3, define_bits_jpeg3_loader);
- register_tag_loader(SWF::DEFINELOSSLESS2, define_bits_lossless_2_loader);
- register_tag_loader(SWF::DEFINEEDITTEXT, DefineEditTextTag::loader);
- register_tag_loader(SWF::DEFINEVIDEO, fixme_loader); // 38
- register_tag_loader(SWF::DEFINESPRITE, sprite_loader);
- register_tag_loader(SWF::NAMECHARACTER, fixme_loader); // 40
- register_tag_loader(SWF::SERIALNUMBER, serialnumber_loader); // 41
- register_tag_loader(SWF::DEFINETEXTFORMAT, fixme_loader); // 42
- register_tag_loader(SWF::FRAMELABEL, frame_label_loader); // 43
-
- // TODO: Implement, but fixme_loader breaks tests.
- register_tag_loader(SWF::DEFINEBEHAVIOR, fixme_loader); // 44
-
- register_tag_loader(SWF::SOUNDSTREAMHEAD2, sound_stream_head_loader); // 45
- // 46
- register_tag_loader(SWF::DEFINEMORPHSHAPE, DefineMorphShapeTag::loader);
- register_tag_loader(SWF::FRAMETAG, fixme_loader); // 47
- // 48
- register_tag_loader(SWF::DEFINEFONT2, DefineFontTag::loader);
- register_tag_loader(SWF::GENCOMMAND, fixme_loader); // 49
- register_tag_loader(SWF::DEFINECOMMANDOBJ, fixme_loader); // 50
- register_tag_loader(SWF::CHARACTERSET, fixme_loader); // 51
- register_tag_loader(SWF::FONTREF, fixme_loader); // 52
-
- // TODO: Implement, but fixme_loader breaks tests.
- register_tag_loader(SWF::DEFINEFUNCTION, fixme_loader); // 53
- register_tag_loader(SWF::PLACEFUNCTION, fixme_loader); // 54
- register_tag_loader(SWF::GENTAGOBJECT, fixme_loader); // 55
-
- register_tag_loader(SWF::EXPORTASSETS, export_loader); // 56
- register_tag_loader(SWF::IMPORTASSETS, import_loader); // 57
-
- // We're not an authoring tool so we don't care.
- // (might be nice to dump the password instead..)
- register_tag_loader(SWF::ENABLEDEBUGGER, null_loader); // 58
-
- // 59
- register_tag_loader(SWF::INITACTION, DoInitActionTag::loader);
- // 60
- register_tag_loader(SWF::DEFINEVIDEOSTREAM, DefineVideoStreamTag::loader);
- // 61
- register_tag_loader(SWF::VIDEOFRAME, VideoFrameTag::loader);
-
- // 62, DEFINEFONTINFO2 is done above.
- // We're not an authoring tool.
- register_tag_loader(SWF::DEBUGID, null_loader); // 63
-
- // We're not an authoring tool so we don't care.
- // (might be nice to dump the password instead..)
- register_tag_loader(SWF::ENABLEDEBUGGER2, null_loader); // 64
- register_tag_loader(SWF::SCRIPTLIMITS, ScriptLimitsTag::loader); //65
-
- // TODO: Fix this, but probably not critical.
- register_tag_loader(SWF::SETTABINDEX, fixme_loader); //66
-
- // TODO: Alexis reference says these are 83, 84. The 67, 68 comes from
- // Tamarin. Figure out which one is correct (possibly both are).
- // 67
- register_tag_loader(SWF::DEFINESHAPE4_, DefineShapeTag::loader);
- // 68
- register_tag_loader(SWF::DEFINEMORPHSHAPE2_, DefineMorphShapeTag::loader);
- // 69
- register_tag_loader(SWF::FILEATTRIBUTES, file_attributes_loader);
- // 70
- register_tag_loader(SWF::PLACEOBJECT3, PlaceObject2Tag::loader);
- // 71
- register_tag_loader(SWF::IMPORTASSETS2, import_loader);
- // 73
- register_tag_loader(SWF::DEFINEALIGNZONES,
DefineFontAlignZonesTag::loader);
- // 74
- register_tag_loader(SWF::CSMTEXTSETTINGS, CSMTextSettingsTag::loader);
- // 75
- register_tag_loader(SWF::DEFINEFONT3, DefineFontTag::loader);
- // 77
- register_tag_loader(SWF::METADATA, metadata_loader);
- // 78
- register_tag_loader(SWF::DEFINESCALINGGRID, fixme_loader);
- // 83
- register_tag_loader(SWF::DEFINESHAPE4, DefineShapeTag::loader);
- // 84
- register_tag_loader(SWF::DEFINEMORPHSHAPE2, DefineMorphShapeTag::loader);
- // 88
- register_tag_loader(SWF::DEFINEFONTNAME, DefineFontNameTag::loader);
- // 777
- register_tag_loader(SWF::REFLEX, reflex_loader);
-
- // The following tags are AVM2 only.
-
-#ifdef ENABLE_AVM2
- // 72 -- AS3 codeblock.
- register_tag_loader(SWF::DOABC, DoABCTag::loader);
- // 76
- register_tag_loader(SWF::SYMBOLCLASS, SymbolClassTag::loader);
- // 82
- register_tag_loader(SWF::DOABCDEFINE, DoABCTag::loader);
- // 86
- register_tag_loader(SWF::DEFINESCENEANDFRAMELABELDATA,
- DefineSceneAndFrameLabelDataTag::loader);
-#endif
-}
-
// Create a movie_definition from an image format stream
// NOTE: this method assumes this *is* the format described in the
// FileType type
@@ -305,13 +99,11 @@
movie_definition*
-create_movie(std::auto_ptr<IOChannel> in, const std::string& url,
+MovieFactory::makeMovie(std::auto_ptr<IOChannel> in, const std::string& url,
const RunInfo& runInfo, bool startLoaderThread)
{
assert(in.get());
- ensure_loaders_registered();
-
// see if it's a jpeg or an swf
FileType type = getFileType(*in);
@@ -348,8 +140,9 @@
}
movie_definition*
-create_movie(const URL& url, const RunInfo& runInfo, const char* reset_url,
- bool startLoaderThread, const std::string* postdata)
+createNonLibraryMovie(const URL& url, const RunInfo& runInfo,
+ const char* reset_url, bool startLoaderThread,
+ const std::string* postdata)
{
std::auto_ptr<IOChannel> in;
@@ -376,7 +169,7 @@
}
std::string movie_url = reset_url ? reset_url : url.str();
- movie_definition* ret = create_movie(in, movie_url, runInfo,
+ movie_definition* ret = MovieFactory::makeMovie(in, movie_url, runInfo,
startLoaderThread);
return ret;
@@ -527,119 +320,6 @@
set_render_handler(NULL);
}
-//
-// library stuff, for sharing resources among different movies.
-//
-
-
-/// Library of SWF movies indexed by URL strings
-//
-/// Elements are actually SWFMovieDefinition, the ones
-/// associated with URLS. Dunno why, but we were using
-/// movie_definition here before so this didn't change
-/// when the new class was introduced.
-///
-class MovieLibrary
-{
-public:
-
- struct LibraryItem {
- boost::intrusive_ptr<movie_definition> def;
- unsigned hitCount;
- };
-
- typedef std::map<std::string, LibraryItem> LibraryContainer;
-
- MovieLibrary() :
- _limit(8)
- {
- RcInitFile& rcfile = RcInitFile::getDefaultInstance();
- setLimit(rcfile.getMovieLibraryLimit());
- }
-
- /// Sets the maximum number of items to hold in the library. When adding
new
- /// items, the one with the least hit count is being removed in that case.
- /// Zero is a valid limit (disables library).
- void setLimit(unsigned limit)
- {
- _limit = limit;
- limitSize(_limit);
- }
-
- bool get(const std::string& key, boost::intrusive_ptr<movie_definition>*
ret)
- {
- LibraryContainer::iterator it = _map.find(key);
- if ( it != _map.end() )
- {
- *ret = it->second.def;
- it->second.hitCount++;
-
- return true;
- }
- return false;
- }
-
-#ifdef GNASH_USE_GC
- /// Mark all library elements as reachable (for GC)
- void markReachableResources() const
- {
- for (LibraryContainer::const_iterator i=_map.begin(), e=_map.end();
- i!=e; ++i)
- {
- i->second.def->setReachable();
- }
- }
-#endif
-
- void add(const std::string& key, movie_definition* mov)
- {
-
- if (_limit)
- {
- limitSize(_limit-1);
- }
- else return; // zero limit, library is a no-op
-
- LibraryItem temp;
-
- temp.def = mov;
- temp.hitCount=0;
-
- _map[key] = temp;
- }
-
-
- void clear() { _map.clear(); }
-
-private:
-
- static bool findWorstHitCount(const
MovieLibrary::LibraryContainer::value_type& a,
- const
MovieLibrary::LibraryContainer::value_type& b)
- {
- return (a.second.hitCount < b.second.hitCount);
- }
-
- LibraryContainer _map;
- unsigned _limit;
-
- void limitSize(unsigned max)
- {
-
- if (max < 1)
- {
- clear();
- return;
- }
-
- while (_map.size() > max)
- {
- _map.erase(std::min_element(_map.begin(), _map.end(),
&findWorstHitCount));
- }
-
- }
-
-};
-
static MovieLibrary s_movie_library;
static void clear_library()
@@ -653,7 +333,8 @@
// loaded it already. Add it to our library on success, and
// return a pointer to it.
//
-movie_definition* create_library_movie(const URL& url, const RunInfo& runInfo,
+movie_definition*
+MovieFactory::makeMovie(const URL& url, const RunInfo& runInfo,
const char* real_url, bool startLoaderThread,
const std::string* postdata)
{
@@ -674,9 +355,9 @@
// Try to open a file under the filename, but DO NOT start
// the loader thread now to avoid IMPORT tag loaders from
- // calling create_library_movie() again and NOT finding
+ // calling createMovie() again and NOT finding
// the just-created movie.
- movie_definition* mov = create_movie(url, runInfo, real_url, false,
+ movie_definition* mov = createNonLibraryMovie(url, runInfo, real_url,
false,
postdata);
if (!mov)
=== modified file 'libcore/movie_root.cpp'
--- a/libcore/movie_root.cpp 2009-06-09 15:51:03 +0000
+++ b/libcore/movie_root.cpp 2009-06-15 14:53:11 +0000
@@ -34,7 +34,7 @@
#include "sound_handler.h"
#include "Timers.h"
#include "GnashKey.h"
-#include "gnash.h"
+#include "MovieFactory.h"
#include "GnashAlgorithm.h"
#include "GnashNumeric.h"
@@ -425,7 +425,7 @@
movie_root::loadLevel(unsigned int num, const URL& url)
{
boost::intrusive_ptr<movie_definition> md (
- create_library_movie(url, _runInfo));
+ MovieFactory::makeMovie(url, _runInfo));
if (!md)
{
log_error(_("can't create movie_definition for %s"), url.str());
=== modified file 'libcore/parser/SWFParser.cpp'
--- a/libcore/parser/SWFParser.cpp 2009-06-05 11:19:22 +0000
+++ b/libcore/parser/SWFParser.cpp 2009-06-15 12:07:43 +0000
@@ -85,14 +85,14 @@
return false;
}
- SWF::TagLoadersTable::loader_function lf = 0;
+ SWF::TagLoadersTable::TagLoader lf = 0;
if (_tag == SWF::SHOWFRAME) {
// show frame tag -- advance to the next frame.
IF_VERBOSE_PARSE(log_parse("SHOWFRAME tag"));
_md->incrementLoadedFrames();
}
- else if (tagLoaders.get(_tag, &lf)) {
+ else if (tagLoaders.get(_tag, lf)) {
// call the tag loader. The tag loader should add
// DisplayObjects or tags to the movie data structure.
lf(_stream, _tag, *_md, _runInfo);
=== modified file 'libcore/parser/SWFParser.h'
--- a/libcore/parser/SWFParser.h 2009-06-08 14:50:28 +0000
+++ b/libcore/parser/SWFParser.h 2009-06-15 11:32:49 +0000
@@ -22,7 +22,7 @@
#ifndef GNASH_SWFPARSER_H
#define GNASH_SWFPARSER_H
-#include "swf.h"
+#include "SWF.h"
#include "TagLoadersTable.h"
namespace gnash {
=== modified file 'libcore/parser/action_buffer.cpp'
--- a/libcore/parser/action_buffer.cpp 2009-03-09 06:50:41 +0000
+++ b/libcore/parser/action_buffer.cpp 2009-06-15 11:32:49 +0000
@@ -25,7 +25,7 @@
#include "action_buffer.h"
#include "log.h"
#include "SWFStream.h"
-#include "swf.h"
+#include "SWF.h"
#include "ASHandlers.h"
#include "as_environment.h"
#include "movie_definition.h"
=== modified file 'libcore/styles.cpp'
--- a/libcore/styles.cpp 2009-03-24 10:56:52 +0000
+++ b/libcore/styles.cpp 2009-06-15 14:10:05 +0000
@@ -7,12 +7,11 @@
#include "styles.h"
-#include "impl.h"
#include "log.h"
#include "render.h"
#include "SWFStream.h"
#include "movie_definition.h"
-#include "swf.h"
+#include "SWF.h"
#include "GnashException.h"
#include "fill_style.h"
#include "GnashNumeric.h"
=== modified file 'libcore/styles.h'
--- a/libcore/styles.h 2009-02-20 12:24:00 +0000
+++ b/libcore/styles.h 2009-06-15 14:10:05 +0000
@@ -9,9 +9,8 @@
#ifndef GNASH_STYLES_H
#define GNASH_STYLES_H
-#include "impl.h"
#include "RGBA.h"
-#include "swf.h"
+#include "SWF.h"
namespace gnash {
=== added file 'libcore/swf/DefaultTagLoaders.cpp'
--- a/libcore/swf/DefaultTagLoaders.cpp 1970-01-01 00:00:00 +0000
+++ b/libcore/swf/DefaultTagLoaders.cpp 2009-06-15 12:46:38 +0000
@@ -0,0 +1,235 @@
+//
+// Copyright (C) 2005, 2006, 2007, 2008, 2009 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 "SWF.h"
+#include "DefaultTagLoaders.h"
+#include "TagLoadersTable.h"
+#include "tag_loaders.h"
+#include "ScriptLimitsTag.h"
+#include "BitmapMovieDefinition.h"
+#include "DefineFontAlignZonesTag.h"
+#include "DefineShapeTag.h"
+#include "DefineButtonCxformTag.h"
+#include "CSMTextSettingsTag.h"
+#include "DefineFontTag.h"
+#include "DefineButtonTag.h"
+#include "DefineTextTag.h"
+#include "PlaceObject2Tag.h"
+#include "RemoveObjectTag.h"
+#include "DoActionTag.h"
+#include "DoInitActionTag.h"
+#include "DefineEditTextTag.h"
+#include "SetBackgroundColorTag.h"
+#include "StartSoundTag.h"
+#include "StreamSoundBlockTag.h"
+#include "DefineButtonSoundTag.h"
+#include "DefineMorphShapeTag.h"
+#include "DefineVideoStreamTag.h"
+#include "DefineFontNameTag.h"
+#include "VideoFrameTag.h"
+#ifdef ENABLE_AVM2
+# include "SymbolClassTag.h"
+# include "DoABCTag.h"
+# include "DefineSceneAndFrameLabelDataTag.h"
+#endif
+
+#include <boost/assign.hpp>
+#include <boost/bind.hpp>
+
+namespace gnash {
+namespace SWF {
+
+namespace {
+ class AddLoader
+ {
+ public:
+ AddLoader(TagLoadersTable& table)
+ :
+ _table(table)
+ {}
+ void operator()(const TagLoadersTable::Loaders::value_type& p)
+ {
+ _table.registerLoader(p.first, p.second);
+ }
+ private:
+ TagLoadersTable& _table;
+ };
+}
+
+void
+addDefaultLoaders(TagLoadersTable& table)
+{
+
+ const std::map<TagType, TagLoadersTable::TagLoader> tags =
+ boost::assign::map_list_of
+
+ (SWF::END, end_loader)
+ (SWF::DEFINESHAPE, DefineShapeTag::loader)
+ (SWF::FREECHARACTER, fixme_loader) // 03
+ (SWF::PLACEOBJECT, PlaceObject2Tag::loader)
+ (SWF::REMOVEOBJECT, RemoveObjectTag::loader) // 05
+ (SWF::DEFINEBITS, define_bits_jpeg_loader)
+ (SWF::DEFINEBUTTON, DefineButtonTag::loader)
+ (SWF::JPEGTABLES, jpeg_tables_loader)
+ (SWF::SETBACKGROUNDCOLOR, SetBackgroundColorTag::loader)
+ (SWF::DEFINEFONT, DefineFontTag::loader)
+ (SWF::DEFINETEXT, DefineTextTag::loader)
+ (SWF::DOACTION, DoActionTag::loader)
+ (SWF::DEFINEFONTINFO, DefineFontInfoTag::loader)
+ // 62
+ (SWF::DEFINEFONTINFO2, DefineFontInfoTag::loader)
+ (SWF::DEFINESOUND, define_sound_loader)
+ (SWF::STARTSOUND, StartSoundTag::loader)
+ // 89
+ (SWF::STARTSOUND2, StartSound2Tag::loader)
+
+ (SWF::STOPSOUND, fixme_loader) // 16
+
+ // 17
+ (SWF::DEFINEBUTTONSOUND, DefineButtonSoundTag::loader)
+ // 18
+ (SWF::SOUNDSTREAMHEAD, sound_stream_head_loader)
+ // 19
+ (SWF::SOUNDSTREAMBLOCK, StreamSoundBlockTag::loader)
+ (SWF::DEFINELOSSLESS, define_bits_lossless_2_loader)
+ (SWF::DEFINEBITSJPEG2, define_bits_jpeg2_loader)
+ (SWF::DEFINESHAPE2, DefineShapeTag::loader)
+ (SWF::DEFINEBUTTONCXFORM, DefineButtonCxformTag::loader) // 23
+ // "protect" tag; we're not an authoring tool so we don't care.
+ // (might be nice to dump the password instead..)
+ (SWF::PROTECT, null_loader)
+ (SWF::PATHSAREPOSTSCRIPT, fixme_loader) // 25
+ (SWF::PLACEOBJECT2, PlaceObject2Tag::loader)
+ // 27 - _UNKNOWN_ unimplemented
+ (SWF::REMOVEOBJECT2, RemoveObjectTag::loader) // 28
+ (SWF::SYNCFRAME, fixme_loader) // 29
+ // 30 - _UNKNOWN_ unimplemented
+ (SWF::FREEALL, fixme_loader) // 31
+ (SWF::DEFINESHAPE3, DefineShapeTag::loader)
+ (SWF::DEFINETEXT2, DefineText2Tag::loader)
+ // 37
+ (SWF::DEFINEBUTTON2, DefineButton2Tag::loader)
+ (SWF::DEFINEBITSJPEG3, define_bits_jpeg3_loader)
+ (SWF::DEFINELOSSLESS2, define_bits_lossless_2_loader)
+ (SWF::DEFINEEDITTEXT, DefineEditTextTag::loader)
+ (SWF::DEFINEVIDEO, fixme_loader) // 38
+ (SWF::DEFINESPRITE, sprite_loader)
+ (SWF::NAMECHARACTER, fixme_loader) // 40
+ (SWF::SERIALNUMBER, serialnumber_loader) // 41
+ (SWF::DEFINETEXTFORMAT, fixme_loader) // 42
+ (SWF::FRAMELABEL, frame_label_loader) // 43
+
+ // TODO: Implement, but fixme_loader breaks tests.
+ (SWF::DEFINEBEHAVIOR, fixme_loader) // 44
+
+ (SWF::SOUNDSTREAMHEAD2, sound_stream_head_loader) // 45
+ // 46
+ (SWF::DEFINEMORPHSHAPE, DefineMorphShapeTag::loader)
+ (SWF::FRAMETAG, fixme_loader) // 47
+ // 48
+ (SWF::DEFINEFONT2, DefineFontTag::loader)
+ (SWF::GENCOMMAND, fixme_loader) // 49
+ (SWF::DEFINECOMMANDOBJ, fixme_loader) // 50
+ (SWF::CHARACTERSET, fixme_loader) // 51
+ (SWF::FONTREF, fixme_loader) // 52
+
+ // TODO: Implement, but fixme_loader breaks tests.
+ (SWF::DEFINEFUNCTION, fixme_loader) // 53
+ (SWF::PLACEFUNCTION, fixme_loader) // 54
+ (SWF::GENTAGOBJECT, fixme_loader) // 55
+
+ (SWF::EXPORTASSETS, export_loader) // 56
+ (SWF::IMPORTASSETS, import_loader) // 57
+
+ // We're not an authoring tool so we don't care.
+ // (might be nice to dump the password instead..)
+ (SWF::ENABLEDEBUGGER, null_loader) // 58
+
+ // 59
+ (SWF::INITACTION, DoInitActionTag::loader)
+ // 60
+ (SWF::DEFINEVIDEOSTREAM, DefineVideoStreamTag::loader)
+ // 61
+ (SWF::VIDEOFRAME, VideoFrameTag::loader)
+
+ // 62, DEFINEFONTINFO2 is done above.
+ // We're not an authoring tool.
+ (SWF::DEBUGID, null_loader) // 63
+
+ // We're not an authoring tool so we don't care.
+ // (might be nice to dump the password instead..)
+ (SWF::ENABLEDEBUGGER2, null_loader) // 64
+ (SWF::SCRIPTLIMITS, ScriptLimitsTag::loader) //65
+
+ // TODO: Fix this, but probably not critical.
+ (SWF::SETTABINDEX, fixme_loader) //66
+
+ // TODO: Alexis reference says these are 83, 84. The 67, 68 comes from
+ // Tamarin. Figure out which one is correct (possibly both are).
+ // 67
+ (SWF::DEFINESHAPE4_, DefineShapeTag::loader)
+ // 68
+ (SWF::DEFINEMORPHSHAPE2_, DefineMorphShapeTag::loader)
+ // 69
+ (SWF::FILEATTRIBUTES, file_attributes_loader)
+ // 70
+ (SWF::PLACEOBJECT3, PlaceObject2Tag::loader)
+ // 71
+ (SWF::IMPORTASSETS2, import_loader)
+ // 73
+ (SWF::DEFINEALIGNZONES, DefineFontAlignZonesTag::loader)
+ // 74
+ (SWF::CSMTEXTSETTINGS, CSMTextSettingsTag::loader)
+ // 75
+ (SWF::DEFINEFONT3, DefineFontTag::loader)
+ // 77
+ (SWF::METADATA, metadata_loader)
+ // 78
+ (SWF::DEFINESCALINGGRID, fixme_loader)
+ // 83
+ (SWF::DEFINESHAPE4, DefineShapeTag::loader)
+ // 84
+ (SWF::DEFINEMORPHSHAPE2, DefineMorphShapeTag::loader)
+ // 88
+ (SWF::DEFINEFONTNAME, DefineFontNameTag::loader)
+ // 777
+ (SWF::REFLEX, reflex_loader)
+
+#ifdef ENABLE_AVM2
+ // The following tags are AVM2 only.
+ // 72 -- AS3 codeblock.
+ (SWF::DOABC, DoABCTag::loader)
+ // 76
+ (SWF::SYMBOLCLASS, SymbolClassTag::loader)
+ // 82
+ (SWF::DOABCDEFINE, DoABCTag::loader)
+ // 86
+ (SWF::DEFINESCENEANDFRAMELABELDATA,
+ DefineSceneAndFrameLabelDataTag::loader);
+#endif
+
+ std::for_each(tags.begin(), tags.end(), AddLoader(table));
+
+}
+
+} // namespace SWF
+} // namespace gnash
+
=== added file 'libcore/swf/DefaultTagLoaders.h'
--- a/libcore/swf/DefaultTagLoaders.h 1970-01-01 00:00:00 +0000
+++ b/libcore/swf/DefaultTagLoaders.h 2009-06-15 12:46:38 +0000
@@ -0,0 +1,37 @@
+//
+// Copyright (C) 2005, 2006, 2007, 2008, 2009 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_DEFAULTLOADERS_H
+#define GNASH_SWF_DEFAULTLOADERS_H
+
+#ifdef HAVE_CONFIG_H
+#include "gnashconfig.h"
+#endif
+
+#include "SWF.h"
+#include "TagLoadersTable.h"
+
+namespace gnash {
+namespace SWF {
+
+/// Add the default parsing functions for SWF files to a TagLoadersTable.
+void addDefaultLoaders(TagLoadersTable& table);
+
+} // namespace gnash::SWF
+} // namespace gnash
+
+#endif
=== modified file 'libcore/swf/DefineButtonCxformTag.cpp'
--- a/libcore/swf/DefineButtonCxformTag.cpp 2009-06-03 10:17:39 +0000
+++ b/libcore/swf/DefineButtonCxformTag.cpp 2009-06-15 11:32:49 +0000
@@ -16,7 +16,7 @@
// along with this program; if not, write to the Free Software
// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
-#include "swf.h" // for TagType definition
+#include "SWF.h" // for TagType definition
#include "SWFStream.h" // for inlines
#include "movie_definition.h"
#include "DefineButtonTag.h"
=== modified file 'libcore/swf/DefineButtonCxformTag.h'
--- a/libcore/swf/DefineButtonCxformTag.h 2009-01-22 20:10:39 +0000
+++ b/libcore/swf/DefineButtonCxformTag.h 2009-06-15 11:32:49 +0000
@@ -19,7 +19,7 @@
#ifndef GNASH_SWF_DEFINEBUTTONCXFORMTAG_H
#define GNASH_SWF_DEFINEBUTTONCXFORMTAG_H
-#include "swf.h" // for TagType definition
+#include "SWF.h" // for TagType definition
namespace gnash {
class SWFStream;
=== modified file 'libcore/swf/DefineButtonSoundTag.h'
--- a/libcore/swf/DefineButtonSoundTag.h 2009-04-03 09:18:40 +0000
+++ b/libcore/swf/DefineButtonSoundTag.h 2009-06-15 11:32:49 +0000
@@ -21,7 +21,7 @@
#define GNASH_SWF_DEFINEBUTTONSOUNDTAG_H
#include "smart_ptr.h"
-#include "swf.h"
+#include "SWF.h"
#include "sound_definition.h" // For sound_sample. Ugh.
#include "SoundInfoRecord.h"
=== modified file 'libcore/swf/DefineButtonTag.cpp'
--- a/libcore/swf/DefineButtonTag.cpp 2009-06-03 11:12:12 +0000
+++ b/libcore/swf/DefineButtonTag.cpp 2009-06-15 11:32:49 +0000
@@ -25,7 +25,7 @@
#include "DisplayObject.h"
#include "Button.h" // for createDisplayObject()
#include "DefineButtonCxformTag.h"
-#include "swf.h"
+#include "SWF.h"
#include "SWFStream.h" // for read()
#include "movie_definition.h"
#include "action_buffer.h"
=== modified file 'libcore/swf/DefineButtonTag.h'
--- a/libcore/swf/DefineButtonTag.h 2009-06-03 11:05:59 +0000
+++ b/libcore/swf/DefineButtonTag.h 2009-06-15 11:32:49 +0000
@@ -29,7 +29,7 @@
#include "filter_factory.h" // for Filters (composition of button_record)
#include "sound_handler.h" // for sound_handler::sound_envelope in a vector..
#include "DefineButtonSoundTag.h"
-#include "swf.h"
+#include "SWF.h"
#include "Button.h"
#include <boost/scoped_ptr.hpp>
=== modified file 'libcore/swf/DefineEditTextTag.h'
--- a/libcore/swf/DefineEditTextTag.h 2009-06-09 07:59:09 +0000
+++ b/libcore/swf/DefineEditTextTag.h 2009-06-15 11:32:49 +0000
@@ -24,7 +24,7 @@
#include "rect.h"
#include "DefinitionTag.h"
-#include "swf.h" // for TagType definition
+#include "SWF.h" // for TagType definition
#include "RGBA.h"
#include "TextField.h"
=== modified file 'libcore/swf/DefineFontNameTag.h'
--- a/libcore/swf/DefineFontNameTag.h 2009-01-22 20:10:39 +0000
+++ b/libcore/swf/DefineFontNameTag.h 2009-06-15 11:32:49 +0000
@@ -17,7 +17,7 @@
// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
//
-#include "swf.h"
+#include "SWF.h"
#include "SWFStream.h"
#include "Font.h"
#include "RunInfo.h"
=== modified file 'libcore/swf/DefineFontTag.cpp'
--- a/libcore/swf/DefineFontTag.cpp 2009-04-07 11:14:10 +0000
+++ b/libcore/swf/DefineFontTag.cpp 2009-06-15 11:32:49 +0000
@@ -21,7 +21,7 @@
#include "SWFStream.h"
#include "Font.h"
#include "RunInfo.h"
-#include "swf.h"
+#include "SWF.h"
#include "movie_definition.h"
#include "ShapeRecord.h"
=== modified file 'libcore/swf/DefineFontTag.h'
--- a/libcore/swf/DefineFontTag.h 2009-04-03 09:18:40 +0000
+++ b/libcore/swf/DefineFontTag.h 2009-06-15 11:32:49 +0000
@@ -30,7 +30,7 @@
#define GNASH_SWF_DEFINEFONTTAG_H
#include "smart_ptr.h" // GC
-#include "swf.h"
+#include "SWF.h"
#include "Font.h"
#include <vector>
=== modified file 'libcore/swf/DefineMorphShapeTag.h'
--- a/libcore/swf/DefineMorphShapeTag.h 2009-05-14 11:45:23 +0000
+++ b/libcore/swf/DefineMorphShapeTag.h 2009-06-15 14:04:56 +0000
@@ -23,7 +23,7 @@
#define GNASH_SWF_MORPH_SHAPE_H
#include "smart_ptr.h" // GNASH_USE_GC
-#include "swf.h"
+#include "SWF.h"
#include "ShapeRecord.h"
#include "DefinitionTag.h"
@@ -31,6 +31,7 @@
namespace gnash {
class movie_definition;
class SWFStream;
+ class RunInfo;
class MorphShape;
}
=== modified file 'libcore/swf/DefineSceneAndFrameLabelDataTag.h'
--- a/libcore/swf/DefineSceneAndFrameLabelDataTag.h 2009-05-19 10:56:40
+0000
+++ b/libcore/swf/DefineSceneAndFrameLabelDataTag.h 2009-06-15 11:32:49
+0000
@@ -19,7 +19,7 @@
#define GNASH_SWF_SCENEANDLABELTAG_H
#include "ControlTag.h"
-#include "swf.h"
+#include "SWF.h"
#include "MovieClip.h"
#include "SWFStream.h"
#include "VM.h"
=== modified file 'libcore/swf/DefineShapeTag.cpp'
--- a/libcore/swf/DefineShapeTag.cpp 2009-05-25 09:45:58 +0000
+++ b/libcore/swf/DefineShapeTag.cpp 2009-06-15 14:08:03 +0000
@@ -25,13 +25,12 @@
#include "DefineShapeTag.h"
#include "smart_ptr.h" // GNASH_USE_GC
-#include "impl.h"
#include "log.h"
#include "render.h"
#include "Shape.h"
#include "SWFStream.h"
#include "MovieClip.h"
-#include "swf.h"
+#include "SWF.h"
#include <algorithm>
=== modified file 'libcore/swf/DefineShapeTag.h'
--- a/libcore/swf/DefineShapeTag.h 2009-05-14 11:45:23 +0000
+++ b/libcore/swf/DefineShapeTag.h 2009-06-15 14:04:56 +0000
@@ -11,7 +11,7 @@
#include "DefinitionTag.h" // for inheritance of DefineShapeTag
#include "smart_ptr.h" // GNASH_USE_GC
-#include "swf.h"
+#include "SWF.h"
#include "ShapeRecord.h"
namespace gnash {
@@ -19,6 +19,7 @@
class cxform;
class Shape;
class SWFMatrix;
+ class RunInfo;
}
namespace gnash {
=== modified file 'libcore/swf/DefineTextTag.cpp'
--- a/libcore/swf/DefineTextTag.cpp 2009-05-14 11:45:23 +0000
+++ b/libcore/swf/DefineTextTag.cpp 2009-06-15 11:32:49 +0000
@@ -10,7 +10,7 @@
#include "DefineTextTag.h"
#include "SWFStream.h"
#include "log.h"
-#include "swf.h"
+#include "SWF.h"
#include "TextRecord.h"
#include "Font.h"
#include "StaticText.h"
=== modified file 'libcore/swf/DefineTextTag.h'
--- a/libcore/swf/DefineTextTag.h 2009-05-14 11:45:23 +0000
+++ b/libcore/swf/DefineTextTag.h 2009-06-15 11:32:49 +0000
@@ -21,7 +21,7 @@
#include "DefinitionTag.h" // for inheritance
#include "styles.h"
#include "rect.h" // for composition
-#include "swf.h"
+#include "SWF.h"
#include "movie_definition.h"
#include "SWFMatrix.h"
#include "TextRecord.h"
=== modified file 'libcore/swf/DefineVideoStreamTag.h'
--- a/libcore/swf/DefineVideoStreamTag.h 2009-05-14 11:45:23 +0000
+++ b/libcore/swf/DefineVideoStreamTag.h 2009-06-15 11:32:49 +0000
@@ -25,7 +25,7 @@
#endif
#include "DefinitionTag.h"
-#include "swf.h"
+#include "SWF.h"
#include "rect.h" // for composition
#include "MediaParser.h" // for videoFrameType and videoCodecType enums
=== modified file 'libcore/swf/DisplayListTag.h'
--- a/libcore/swf/DisplayListTag.h 2009-04-03 09:18:40 +0000
+++ b/libcore/swf/DisplayListTag.h 2009-06-15 11:32:49 +0000
@@ -25,7 +25,7 @@
#endif
#include "ControlTag.h" // for inheritance
-//#include "swf.h" // for TagType definition
+//#include "SWF.h" // for TagType definition
// Forward declarations
=== modified file 'libcore/swf/DoABCTag.h'
--- a/libcore/swf/DoABCTag.h 2009-05-29 14:23:57 +0000
+++ b/libcore/swf/DoABCTag.h 2009-06-15 11:32:49 +0000
@@ -19,7 +19,7 @@
#define GNASH_SWF_DOABCTAG_H
#include "ControlTag.h" // for inheritance
-#include "swf.h" // for tag_type definition
+#include "SWF.h" // for tag_type definition
#include "action_buffer.h" // for composition
#include "MovieClip.h" // for inlines
#include "SWFStream.h" // for inlines
=== modified file 'libcore/swf/DoActionTag.h'
--- a/libcore/swf/DoActionTag.h 2009-05-19 10:18:34 +0000
+++ b/libcore/swf/DoActionTag.h 2009-06-15 11:32:49 +0000
@@ -19,7 +19,7 @@
#define GNASH_SWF_DOACTIONTAG_H
#include "ControlTag.h" // for inheritance
-#include "swf.h" // for TagType definition
+#include "SWF.h" // for TagType definition
#include "action_buffer.h" // for composition
#include "MovieClip.h" // for inlines
#include "SWFStream.h" // for inlines
=== modified file 'libcore/swf/DoInitActionTag.h'
--- a/libcore/swf/DoInitActionTag.h 2009-05-18 13:41:45 +0000
+++ b/libcore/swf/DoInitActionTag.h 2009-06-15 11:32:49 +0000
@@ -19,7 +19,7 @@
#define GNASH_SWF_DOINITACTIONTAG_H
#include "ControlTag.h" // for inheritance
-#include "swf.h" // for TagType definition
+#include "SWF.h" // for TagType definition
#include "action_buffer.h" // for composition
#include "MovieClip.h" // for inlines
#include "SWFStream.h" // for inlines
=== modified file 'libcore/swf/PlaceObject2Tag.h'
--- a/libcore/swf/PlaceObject2Tag.h 2009-04-08 11:48:21 +0000
+++ b/libcore/swf/PlaceObject2Tag.h 2009-06-15 11:32:49 +0000
@@ -24,7 +24,7 @@
#endif
#include "DisplayListTag.h" // for inheritance
-#include "swf.h" // for TagType definition
+#include "SWF.h" // for TagType definition
#include "SWFMatrix.h" // for composition
#include "cxform.h" // for composition
#include "DisplayObject.h" // BlendMode enum
=== modified file 'libcore/swf/RemoveObjectTag.cpp'
--- a/libcore/swf/RemoveObjectTag.cpp 2009-04-08 11:48:21 +0000
+++ b/libcore/swf/RemoveObjectTag.cpp 2009-06-15 11:32:49 +0000
@@ -20,7 +20,7 @@
#include "RemoveObjectTag.h"
#include "MovieClip.h"
-#include "swf.h" // for TagType definition
+#include "SWF.h" // for TagType definition
#include "log.h"
#include "SWFStream.h"
=== modified file 'libcore/swf/RemoveObjectTag.h'
--- a/libcore/swf/RemoveObjectTag.h 2009-04-08 11:48:21 +0000
+++ b/libcore/swf/RemoveObjectTag.h 2009-06-15 11:32:49 +0000
@@ -25,7 +25,7 @@
#endif
#include "DisplayListTag.h" // for inheritance
-#include "swf.h" // for TagType definition
+#include "SWF.h" // for TagType definition
// Forward declarations
namespace gnash {
=== renamed file 'libcore/swf/swf.cpp' => 'libcore/swf/SWF.cpp'
--- a/libcore/swf/swf.cpp 2009-05-14 11:45:23 +0000
+++ b/libcore/swf/SWF.cpp 2009-06-15 11:32:49 +0000
@@ -15,7 +15,7 @@
// along with this program; if not, write to the Free Software
// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
-#include "swf.h"
+#include "SWF.h"
#include <iostream>
namespace gnash {
=== renamed file 'libcore/swf/swf.h' => 'libcore/swf/SWF.h'
=== modified file 'libcore/swf/ScriptLimitsTag.h'
--- a/libcore/swf/ScriptLimitsTag.h 2009-06-08 15:43:21 +0000
+++ b/libcore/swf/ScriptLimitsTag.h 2009-06-15 12:07:43 +0000
@@ -18,11 +18,12 @@
#ifndef GNASH_SWF_SCRIPTLIMITSTAG_H
#define GNASH_SWF_SCRIPTLIMITSTAG_H
-#include "swf.h" // for TagType definition
+#include "SWF.h" // for TagType definition
#include "SWFStream.h" // for inlines
#include "movie_root.h"
#include "movie_definition.h"
#include "ControlTag.h"
+#include "VM.h"
namespace gnash {
namespace SWF {
=== modified file 'libcore/swf/SetBackgroundColorTag.h'
--- a/libcore/swf/SetBackgroundColorTag.h 2009-05-14 11:45:23 +0000
+++ b/libcore/swf/SetBackgroundColorTag.h 2009-06-15 11:32:49 +0000
@@ -23,7 +23,7 @@
#endif
#include "ControlTag.h" // for inheritance
-#include "swf.h" // for TagType definition
+#include "SWF.h" // for TagType definition
#include "MovieClip.h" // for inlines (execute)
#include "movie_definition.h" // for inlines (loader)
#include "log.h" // for log_parse
=== modified file 'libcore/swf/ShapeRecord.cpp'
--- a/libcore/swf/ShapeRecord.cpp 2009-05-25 09:45:58 +0000
+++ b/libcore/swf/ShapeRecord.cpp 2009-06-15 11:32:49 +0000
@@ -16,7 +16,7 @@
#include "ShapeRecord.h"
-#include "swf.h"
+#include "SWF.h"
#include "SWFStream.h"
#include "movie_definition.h"
#include "Geometry.h"
=== modified file 'libcore/swf/StartSoundTag.h'
--- a/libcore/swf/StartSoundTag.h 2009-04-08 11:48:21 +0000
+++ b/libcore/swf/StartSoundTag.h 2009-06-15 11:32:49 +0000
@@ -25,7 +25,7 @@
#include "ControlTag.h" // for inheritance
#include "sound_handler.h" // for sound_envelope (composition)
#include "VM.h" // We only need this to get movie_root
-#include "swf.h" // for TagType definition
+#include "SWF.h" // for TagType definition
#include "SoundInfoRecord.h"
#include <vector> // for composition
=== modified file 'libcore/swf/StreamSoundBlockTag.h'
--- a/libcore/swf/StreamSoundBlockTag.h 2009-06-09 14:04:51 +0000
+++ b/libcore/swf/StreamSoundBlockTag.h 2009-06-15 11:32:49 +0000
@@ -23,7 +23,7 @@
#endif
#include "ControlTag.h" // for inheritance
-#include "swf.h" // for TagType definition
+#include "SWF.h" // for TagType definition
#include "sound_handler.h" // for StreamBlockId identifier
#include <boost/cstdint.hpp> // for boost::uint16_t and friends
=== modified file 'libcore/swf/SymbolClassTag.h'
--- a/libcore/swf/SymbolClassTag.h 2009-05-19 10:18:34 +0000
+++ b/libcore/swf/SymbolClassTag.h 2009-06-15 12:07:43 +0000
@@ -19,12 +19,13 @@
#define GNASH_SWF_SYMBOLCLASSTAG_H
#include "ControlTag.h" // for inheritance
-#include "swf.h" // for tag_type definition
+#include "SWF.h" // for tag_type definition
#include "action_buffer.h" // for composition
#include "MovieClip.h" // for inlines
#include "SWFStream.h" // for inlines
#include "Machine.h"
#include "VM.h"
+#include "sprite_definition.h"
// Forward declarations
namespace gnash {
=== modified file 'libcore/swf/TagLoadersTable.cpp'
--- a/libcore/swf/TagLoadersTable.cpp 2009-06-05 11:19:22 +0000
+++ b/libcore/swf/TagLoadersTable.cpp 2009-06-15 12:07:43 +0000
@@ -20,7 +20,7 @@
#endif
#include "swf/TagLoadersTable.h"
-#include "swf.h"
+#include "SWF.h"
#include <map>
#include <cassert>
@@ -29,30 +29,23 @@
namespace SWF {
bool
-TagLoadersTable::get(SWF::TagType t, loader_function* lf) const
+TagLoadersTable::get(SWF::TagType t, TagLoader& lf) const
{
- container::const_iterator it = _tag_loaders.find(t);
+ Loaders::const_iterator it = _loaders.find(t);
// no loader found for the specified tag
- if (it == _tag_loaders.end()) return false;
+ if (it == _loaders.end()) return false;
- // copy loader_function to the given pointer
- *lf = it->second;
+ // copy TagLoader to the given pointer
+ lf = it->second;
return true;
}
bool
-TagLoadersTable::register_loader(SWF::TagType t, loader_function lf)
+TagLoadersTable::registerLoader(SWF::TagType t, TagLoader lf)
{
assert(lf);
- return _tag_loaders.insert(std::make_pair(t, lf)).second;
-}
-
-TagLoadersTable&
-TagLoadersTable::getInstance()
-{
- static TagLoadersTable inst;
- return inst;
+ return _loaders.insert(std::make_pair(t, lf)).second;
}
} // namespace gnash::SWF
=== modified file 'libcore/swf/TagLoadersTable.h'
--- a/libcore/swf/TagLoadersTable.h 2009-06-05 11:19:22 +0000
+++ b/libcore/swf/TagLoadersTable.h 2009-06-15 12:07:43 +0000
@@ -22,7 +22,7 @@
#include "gnashconfig.h"
#endif
-#include "swf.h"
+#include "SWF.h"
#include <map>
#include <boost/noncopyable.hpp>
@@ -48,44 +48,40 @@
/// 't' is the tag type
/// 'm' a pointer to the movie (or sprite) being read
///
- typedef void (*loader_function)(
- SWFStream& input, TagType type, movie_definition& m, const RunInfo& r);
-
- /// \brief
- /// Get a pointer to the loader_function for the
- /// specified SWF::TagType.
+ typedef void (*TagLoader)(SWFStream& input, TagType type,
+ movie_definition& m, const RunInfo& r);
+
+ typedef std::map<SWF::TagType, TagLoader> Loaders;
+
+ /// Construct an empty TagLoadersTable
+ TagLoadersTable() {}
+
+ /// Construct a TagLoadersTable by copying another table
+ TagLoadersTable(const Loaders& loaders)
+ :
+ _loaders(loaders)
+ {}
+
+ ~TagLoadersTable() {}
+
+ /// Get the TagLoader for a specified TagType.
//
/// @return false if no loader is associated with the tag.
///
- bool get(TagType t, loader_function* lf) const;
+ bool get(TagType t, TagLoader& lf) const;
- /// \brief
/// Register a loader for the specified SWF::TagType.
//
+ /// This is part of an API for allowing external applications
+ /// to register custom tags, and is not used by Gnash itself.
/// @return false if a loader is already registered
/// for the given tag
///
- bool register_loader(TagType t, loader_function lf);
-
- /// \brief
- /// Return a reference to the singleton instance
- /// of this class.
- static TagLoadersTable& getInstance();
+ bool registerLoader(TagType t, TagLoader lf);
private:
- /// The container being used for the table
- typedef std::map<SWF::TagType, loader_function> container;
-
- container _tag_loaders;
-
- /// Use getInstance()
- TagLoadersTable()
- :
- _tag_loaders()
- {}
-
- ~TagLoadersTable() {}
+ Loaders _loaders;
};
=== modified file 'libcore/swf/TextRecord.cpp'
--- a/libcore/swf/TextRecord.cpp 2009-04-09 06:29:33 +0000
+++ b/libcore/swf/TextRecord.cpp 2009-06-15 11:32:49 +0000
@@ -21,7 +21,7 @@
#include "cxform.h"
#include "movie_definition.h"
#include "DisplayObject.h"
-#include "swf.h"
+#include "SWF.h"
#include "log.h"
#include "render.h"
#include "fill_style.h"
=== modified file 'libcore/swf/TextRecord.h'
--- a/libcore/swf/TextRecord.h 2009-04-09 06:17:15 +0000
+++ b/libcore/swf/TextRecord.h 2009-06-15 11:32:49 +0000
@@ -19,7 +19,7 @@
#define GNASH_SWF_TEXTRECORD_H
#include "RGBA.h"
-#include "swf.h"
+#include "SWF.h"
#include <vector>
namespace gnash {
=== modified file 'libcore/swf/VideoFrameTag.h'
--- a/libcore/swf/VideoFrameTag.h 2009-04-07 12:34:43 +0000
+++ b/libcore/swf/VideoFrameTag.h 2009-06-15 11:32:49 +0000
@@ -26,7 +26,7 @@
#include "DefinitionTag.h"
#include "movie_definition.h"
-#include "swf.h"
+#include "SWF.h"
#include "rect.h" // for composition
#include "ControlTag.h"
#include "VideoDecoder.h"
=== modified file 'libcore/swf/tag_loaders.cpp'
--- a/libcore/swf/tag_loaders.cpp 2009-06-10 11:27:47 +0000
+++ b/libcore/swf/tag_loaders.cpp 2009-06-15 14:53:11 +0000
@@ -38,18 +38,18 @@
#include "swf_function.h"
#include "as_function.h"
#include "SWFMovieDefinition.h"
-#include "swf.h"
+#include "SWF.h"
#include "swf/TagLoadersTable.h"
#include "URL.h"
#include "GnashException.h"
#include "swf/DefineVideoStreamTag.h"
#include "sound_definition.h"
#include "SoundInfo.h"
-#include "gnash.h"
#include "MediaHandler.h"
#include "SimpleBuffer.h"
#include "sound_handler.h"
#include "ExportableResource.h"
+#include "MovieFactory.h"
#include "render.h"
#ifdef HAVE_ZLIB_H
@@ -64,7 +64,6 @@
namespace gnash {
namespace SWF {
-namespace tag_loaders {
/// Anonymous namespace
@@ -859,7 +858,7 @@
boost::intrusive_ptr<movie_definition> source_movie;
try {
- source_movie = create_library_movie(abs_url, r);
+ source_movie = MovieFactory::makeMovie(abs_url, r);
}
catch (gnash::GnashException& e) {
log_error(_("Exception: %s"), e.what());
@@ -1316,7 +1315,6 @@
}
-} // namespace gnash::SWF::tag_loaders
} // namespace gnash::SWF
// Local Variables:
=== modified file 'libcore/swf/tag_loaders.h'
--- a/libcore/swf/tag_loaders.h 2009-05-19 10:18:34 +0000
+++ b/libcore/swf/tag_loaders.h 2009-06-15 12:07:43 +0000
@@ -19,7 +19,7 @@
#ifndef GNASH_SWF_TAG_LOADERS_H
#define GNASH_SWF_TAG_LOADERS_H
-#include "swf.h"
+#include "SWF.h"
#include "SWFStream.h"
#include <cassert>
@@ -33,9 +33,6 @@
namespace gnash {
namespace SWF {
-/// Tag loader functions.
-namespace tag_loaders {
-
/// Silently ignore the contents of this tag.
void null_loader(SWFStream&, TagType, movie_definition&, const RunInfo&);
@@ -137,7 +134,6 @@
const RunInfo& /*r*/);
-} // namespace gnash::SWF::tag_loaders
} // namespace gnash::SWF
} // namespace gnash
=== modified file 'libcore/swf_function.h'
--- a/libcore/swf_function.h 2009-02-25 22:33:03 +0000
+++ b/libcore/swf_function.h 2009-06-15 14:07:12 +0000
@@ -22,7 +22,6 @@
#include "gnashconfig.h" // GNASH_USE_GC
#endif
-#include "impl.h"
#include "as_function.h" // for inheritance
#include "as_object.h" // for composition (vector element)
#include "VM.h" //fow SWF version
=== modified file 'libcore/vm/ASHandlers.cpp'
--- a/libcore/vm/ASHandlers.cpp 2009-05-20 09:05:45 +0000
+++ b/libcore/vm/ASHandlers.cpp 2009-06-15 11:32:49 +0000
@@ -24,7 +24,7 @@
#include "smart_ptr.h" // GNASH_USE_GC
#include "log.h"
-#include "swf.h"
+#include "SWF.h"
#include "rc.h"
#include "ASHandlers.h"
#include "movie_definition.h"
=== modified file 'libcore/vm/ASHandlers.h'
--- a/libcore/vm/ASHandlers.h 2009-04-03 09:18:40 +0000
+++ b/libcore/vm/ASHandlers.h 2009-06-15 11:32:49 +0000
@@ -21,7 +21,7 @@
#include <map>
#include <vector>
#include "action.h" // we should get rid of this probably
-#include "swf.h"
+#include "SWF.h"
// Forward declarations
=== modified file 'libcore/vm/ActionExec.cpp'
--- a/libcore/vm/ActionExec.cpp 2009-06-03 16:05:40 +0000
+++ b/libcore/vm/ActionExec.cpp 2009-06-15 11:32:49 +0000
@@ -30,7 +30,7 @@
#include "GnashException.h"
#include "DisplayObject.h"
#include "movie_root.h"
-#include "swf.h"
+#include "SWF.h"
#include "ASHandlers.h"
#include "as_environment.h"
#include "debugger.h"
=== modified file 'libcore/vm/ActionExec.h'
--- a/libcore/vm/ActionExec.h 2009-04-03 09:18:40 +0000
+++ b/libcore/vm/ActionExec.h 2009-06-15 11:32:49 +0000
@@ -21,7 +21,7 @@
#include "with_stack_entry.h"
#include "as_environment.h" // for ScopeStack
#include "smart_ptr.h"
-#include "swf.h"
+#include "SWF.h"
#include "action_buffer.h"
#include <vector>
=== modified file 'libcore/vm/Machine.h'
--- a/libcore/vm/Machine.h 2009-05-25 09:01:34 +0000
+++ b/libcore/vm/Machine.h 2009-06-15 11:32:49 +0000
@@ -24,7 +24,7 @@
#include "SafeStack.h"
#include "as_value.h"
#include "asClass.h"
-#include "swf.h"
+#include "SWF.h"
#include "as_environment.h"
#include "VM.h"
=== modified file 'libcore/vm/action.cpp'
--- a/libcore/vm/action.cpp 2009-06-03 16:05:40 +0000
+++ b/libcore/vm/action.cpp 2009-06-15 11:32:49 +0000
@@ -22,7 +22,7 @@
#include "as_object.h"
#include "log.h"
#include "as_function.h"
-#include "swf.h"
+#include "SWF.h"
#include "GnashException.h"
#include "as_environment.h"
#include "fn_call.h"
=== modified file 'plugin/win32/plugin.cpp'
--- a/plugin/win32/plugin.cpp 2009-04-15 05:33:51 +0000
+++ b/plugin/win32/plugin.cpp 2009-06-15 14:46:41 +0000
@@ -433,7 +433,7 @@
gnash::movie_definition* md = NULL;
try {
- md = gnash::create_library_movie(url, _url.c_str(), false);
+ md = gnash::createMovie(url, _url.c_str(), false);
} catch (const gnash::GnashException& err) {
md = NULL;
}
=== modified file 'testsuite/MovieTester.cpp'
--- a/testsuite/MovieTester.cpp 2009-06-11 15:11:25 +0000
+++ b/testsuite/MovieTester.cpp 2009-06-15 14:53:11 +0000
@@ -26,7 +26,7 @@
#include "Movie.h"
#include "movie_root.h"
#include "MovieClip.h"
-#include "gnash.h" // for create_movie and create_library_movie and for
gnash::key namespace
+#include "MovieFactory.h"
#include "sound_handler.h" // for creating the "test" sound handlers
#include "NullSoundHandler.h"
#include "RGBA.h" // for rgba class (pixel checking)
@@ -35,6 +35,8 @@
#include "render_handler.h"
#include "ManualClock.h" // for use by advance
#include "StreamProvider.h" // for passing to RunInfo
+#include "swf/TagLoadersTable.h"
+#include "swf/DefaultTagLoaders.h"
#ifdef RENDERER_CAIRO
# include "render_handler_cairo.h"
#endif
@@ -57,6 +59,7 @@
#include <memory> // for auto_ptr
#include <cmath> // for ceil and (possibly) exp2
#include <iostream>
+#include <boost/shared_ptr.hpp>
#define SHOW_INVALIDATED_BOUNDS_ON_ADVANCE 1
@@ -86,6 +89,11 @@
_runInfo.reset(new RunInfo(url));
_runInfo->setSoundHandler(_sound_handler);
+
+ boost::shared_ptr<SWF::TagLoadersTable> loaders(new
SWF::TagLoadersTable());
+ addDefaultLoaders(*loaders);
+
+ _runInfo->setTagLoaders(loaders);
_runInfo->setStreamProvider(boost::shared_ptr<StreamProvider>(
new StreamProvider));
@@ -95,7 +103,7 @@
std::auto_ptr<IOChannel> in (
noseek_fd_adapter::make_stream(fileno(stdin))
);
- _movie_def = gnash::create_movie(in, url, *_runInfo, false);
+ _movie_def = MovieFactory::makeMovie(in, url, *_runInfo, false);
}
else
{
@@ -115,7 +123,7 @@
#endif
}
// _url should be always set at this point...
- _movie_def = gnash::create_library_movie(urlObj, *_runInfo,
+ _movie_def = MovieFactory::makeMovie(urlObj, *_runInfo,
NULL, false);
}
=== modified file 'utilities/processor.cpp'
--- a/utilities/processor.cpp 2009-06-07 21:14:22 +0000
+++ b/utilities/processor.cpp 2009-06-15 14:53:11 +0000
@@ -38,6 +38,9 @@
#include <locale>
#endif
+#include "MovieFactory.h"
+#include "swf/TagLoadersTable.h"
+#include "swf/DefaultTagLoaders.h"
#include "gettext.h"
#include "ClockTime.h"
#include "gnash.h"
@@ -372,6 +375,10 @@
boost::shared_ptr<StreamProvider> sp(new StreamProvider);
std::vector<movie_data> data;
+
+
+ boost::shared_ptr<SWF::TagLoadersTable> loaders(new
SWF::TagLoadersTable());
+ addDefaultLoaders(*loaders);
// Play through all the movies.
for (std::vector<std::string>::const_iterator i = infiles.begin(),
@@ -381,6 +388,7 @@
RunInfo runInfo(*i);
runInfo.setSoundHandler(soundHandler);
runInfo.setStreamProvider(sp);
+ runInfo.setTagLoaders(loaders);
boost::intrusive_ptr<gnash::movie_definition> m =
play_movie(*i, runInfo);
@@ -424,7 +432,7 @@
{
std::auto_ptr<IOChannel> in (
noseek_fd_adapter::make_stream(fileno(stdin)) );
- md = gnash::create_movie(in, filename, runInfo, false);
+ md = MovieFactory::makeMovie(in, filename, runInfo, false);
}
else
{
@@ -441,7 +449,7 @@
log_debug(_("%s appended to local sandboxes"), path.c_str());
#endif
}
- md = gnash::create_library_movie(url, runInfo, NULL, false);
+ md = MovieFactory::makeMovie(url, runInfo, NULL, false);
}
}
catch (GnashException& ge)
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Gnash-commit] /srv/bzr/gnash/trunk r11116: Make things more modular. Introduce a MovieFactory, currently with only,
Benjamin Wolsey <=