[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Gnash-commit] gnash ChangeLog server/parser/movie_def_impl.cp...
From: |
Sandro Santilli |
Subject: |
[Gnash-commit] gnash ChangeLog server/parser/movie_def_impl.cp... |
Date: |
Fri, 17 Nov 2006 12:38:23 +0000 |
CVSROOT: /sources/gnash
Module name: gnash
Changes by: Sandro Santilli <strk> 06/11/17 12:38:23
Modified files:
. : ChangeLog
server/parser : movie_def_impl.cpp movie_def_impl.h
Log message:
* server/parser/movie_def_impl.{cpp,h}: decomposed
read() method in readHeader() and completeLoad();
added a MovieLoader::started() method.
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/gnash/ChangeLog?cvsroot=gnash&r1=1.1646&r2=1.1647
http://cvs.savannah.gnu.org/viewcvs/gnash/server/parser/movie_def_impl.cpp?cvsroot=gnash&r1=1.37&r2=1.38
http://cvs.savannah.gnu.org/viewcvs/gnash/server/parser/movie_def_impl.h?cvsroot=gnash&r1=1.18&r2=1.19
Patches:
Index: ChangeLog
===================================================================
RCS file: /sources/gnash/gnash/ChangeLog,v
retrieving revision 1.1646
retrieving revision 1.1647
diff -u -b -r1.1646 -r1.1647
--- ChangeLog 17 Nov 2006 10:10:58 -0000 1.1646
+++ ChangeLog 17 Nov 2006 12:38:23 -0000 1.1647
@@ -1,3 +1,9 @@
+2006-11-17 Sandro Santilli <address@hidden>
+
+ * server/parser/movie_def_impl.{cpp,h}: decomposed
+ read() method in readHeader() and completeLoad();
+ added a MovieLoader::started() method.
+
2006-11-17 Tomas Groth Christensen <address@hidden>
* plugin/plugin.cpp: Remove Mozilla license exemption.
Index: server/parser/movie_def_impl.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/parser/movie_def_impl.cpp,v
retrieving revision 1.37
retrieving revision 1.38
diff -u -b -r1.37 -r1.38
--- server/parser/movie_def_impl.cpp 16 Nov 2006 21:48:30 -0000 1.37
+++ server/parser/movie_def_impl.cpp 17 Nov 2006 12:38:23 -0000 1.38
@@ -62,7 +62,8 @@
MovieLoader::MovieLoader(movie_def_impl& md)
:
_waiting_for_frame(0),
- _movie_def(md)
+ _movie_def(md),
+ _thread(0)
{
#ifdef LOAD_MOVIES_IN_A_SEPARATE_THREAD
pthread_cond_init(&_frame_reached_condition, NULL);
@@ -85,6 +86,12 @@
#endif
}
+bool
+MovieLoader::started() const
+{
+ return _thread != 0;
+}
+
void*
MovieLoader::execute(void* arg)
{
@@ -476,13 +483,12 @@
m_sound_samples.add(character_id, sam);
}
-
-// Read a .SWF movie.
+// Read header and assign url
bool
-movie_def_impl::read(tu_file* in, const std::string& url)
+movie_def_impl::readHeader(tu_file* in, const std::string& url)
{
- // we only read a movie once (well, headers at least)
+ // we only read a movie once
assert(_str.get() == NULL);
if ( url == "" ) _url = "<anonymous>";
@@ -560,12 +566,27 @@
m_frame_rate, m_frame_count);
);
+ return true;
+}
+
+// Fire up the loading thread
+bool
+movie_def_impl::completeLoad()
+{
+
+ // should call this only once
+ assert( ! _loader.started() );
+
+ // should call readHeader before this
+ assert( _str.get() != NULL );
+
#ifdef LOAD_MOVIES_IN_A_SEPARATE_THREAD
// Start the loading frame
if ( ! _loader.start() )
{
log_error("Could not start loading thread");
+ return false;
}
// Wait until 'startup_frames' have been loaded
@@ -594,6 +615,16 @@
return true;
}
+// Read a .SWF movie.
+bool
+movie_def_impl::read(tu_file* in, const std::string& url)
+{
+
+ if ( ! readHeader(in, url) ) return false;
+
+ return completeLoad();
+}
+
// 1-based frame number
bool
@@ -762,6 +793,11 @@
movie_interface*
movie_def_impl::create_instance()
{
+
+ // Guess we want to make sure the loader is started
+ // before we create an instance, right ?
+ assert (_loader.started());
+
// @@ Shouldn't we return a movie_instance instead ?
// @@ and leave movie_root creation to the caller ..
Index: server/parser/movie_def_impl.h
===================================================================
RCS file: /sources/gnash/gnash/server/parser/movie_def_impl.h,v
retrieving revision 1.18
retrieving revision 1.19
diff -u -b -r1.18 -r1.19
--- server/parser/movie_def_impl.h 16 Nov 2006 20:13:32 -0000 1.18
+++ server/parser/movie_def_impl.h 17 Nov 2006 12:38:23 -0000 1.19
@@ -109,6 +109,9 @@
void unlock();
+ /// Return true if the MovieLoader thread was started
+ bool started() const;
+
private:
size_t _waiting_for_frame;
@@ -442,18 +445,36 @@
return &m_init_action_list[frame_number];
}
- /// Read (w/out playing) a Movie definition from an SWF file.
+ /// Calls readHeader() and completeLoad() in sequence.
+ //
+ /// @return false on failure
+ /// see description of readHeader() and completeLoad()
+ /// for possible reasons of failures
+ ///
+ bool read(tu_file *in, const std::string& url);
+
+ /// Read the header of the SWF file
//
- /// This function reads the header and then fires
- /// up a separate thread to complete parsing of the full
- /// stream.
+ /// This function only reads the header of the SWF
+ /// stream and assigns the movie an URL.
+ /// Call completeLoad() to fire up the loader thread.
///
/// @param in the tu_file from which to read SWF
/// @param url the url associated with the input
///
- /// @return false if SWF file could not be parsed
+ /// @return false if SWF header could not be parsed
///
- bool read(tu_file *in, const std::string& url);
+ bool readHeader(tu_file *in, const std::string& url);
+
+ /// Complete load of the SWF file
+ //
+ /// This function completes parsing of the SWF stream
+ /// engaging a separate thread.
+ /// Make sure you called readHeader before this!
+ ///
+ /// @return false if the loading thread could not be started.
+ ///
+ bool completeLoad();
/// \brief
/// Ensure that frame number 'framenum' (1-based offset)
@@ -490,6 +511,9 @@
/// \brief
/// Create a playable movie_root instance from a def.
//
+ /// Make sure you called completeLoad() before this
+ /// function is invoked (calling read() will do that for you).
+ ///
/// The _root reference of the newly created movie_root
/// will be set to a newly created movie_instance.
///