23 #ifndef GNASH_SWF_MOVIE_DEFINITION_H
24 #define GNASH_SWF_MOVIE_DEFINITION_H
30 #include <boost/intrusive_ptr.hpp>
36 #include <boost/thread/thread.hpp>
37 #include <boost/thread/condition.hpp>
38 #include <boost/thread/barrier.hpp>
39 #include <boost/scoped_ptr.hpp>
54 class SWFMovieDefinition;
92 mutable boost::mutex _mutex;
93 std::auto_ptr<boost::thread> _thread;
98 boost::barrier _barrier;
118 typedef std::map<int, boost::intrusive_ptr<SWF::DefinitionTag> >
178 return m_frame_count;
224 virtual size_t get_loading_frame()
const;
231 boost::mutex::scoped_lock lock(_bytes_loaded_mutex);
232 return _bytes_loaded;
237 return m_file_length;
240 DSOTEXPORT virtual void importResources(boost::intrusive_ptr<movie_definition>
source,
241 const Imports& imports);
251 DSOTEXPORT bool get_labeled_frame(
const std::string& label,
size_t& frame_number)
264 void addBitmap(
int DisplayObject_id, boost::intrusive_ptr<CachedBitmap> im);
267 sound_sample* get_sound_sample(
int DisplayObject_id)
const;
270 virtual void add_sound_sample(
int DisplayObject_id,
sound_sample* sam);
274 m_loading_sound_stream = id;
279 return m_loading_sound_stream;
285 boost::mutex::scoped_lock lock(_frames_loaded_mutex);
286 m_playlist[_frames_loaded].push_back(tag);
297 DSOTEXPORT void set_jpeg_loader(std::auto_ptr<image::JpegInput> j_in);
301 return m_jpeg_in.get();
307 boost::mutex::scoped_lock lock(_frames_loaded_mutex);
308 assert(frame_number <= _frames_loaded);
311 PlayListMap::const_iterator it = m_playlist.find(frame_number);
312 if ( it == m_playlist.end() )
return NULL;
313 else return &(it->second);
325 bool readHeader(std::auto_ptr<IOChannel> in,
const std::string&
url);
339 bool ensure_frame_loaded(
size_t framenum)
const;
375 boost::uint16_t exportID(
const std::string& symbol)
const;
384 void registerExport(
const std::string& symbol, boost::uint16_t
id);
391 virtual void storeDescriptiveMetadata(
const std::string&
data) {
395 virtual const std::string& getDescriptiveMetadata()
const {
405 std::string _metadata;
409 CharacterDictionary _dictionary;
412 mutable boost::mutex _dictionaryMutex;
414 typedef std::map<int, boost::intrusive_ptr<Font> > FontMap;
417 typedef std::map<int, boost::intrusive_ptr<CachedBitmap> > Bitmaps;
420 typedef std::map<int, boost::intrusive_ptr<sound_sample> > SoundSampleMap;
421 SoundSampleMap m_sound_samples;
423 typedef std::map<size_t, PlayList> PlayListMap;
426 PlayListMap m_playlist;
429 typedef std::map<std::string, size_t, StringNoCaseLessThan> NamedFrameMap;
430 NamedFrameMap _namedFrames;
433 mutable boost::mutex _namedFramesMutex;
436 typedef std::map<std::string, boost::uint16_t,
437 StringNoCaseLessThan> Exports;
440 Exports _exportTable;
443 mutable boost::mutex _exportedResourcesMutex;
447 typedef std::vector<boost::intrusive_ptr<movie_definition> > ImportVect;
448 ImportVect m_import_source_movies;
450 SWFRect m_frame_size;
452 size_t m_frame_count;
456 size_t _frames_loaded;
463 mutable boost::mutex _frames_loaded_mutex;
466 mutable boost::condition _frame_reached_condition;
472 mutable size_t _waiting_for_frame;
475 unsigned long _bytes_loaded;
482 mutable boost::mutex _bytes_loaded_mutex;
484 int m_loading_sound_stream;
486 boost::uint32_t m_file_length;
488 std::auto_ptr<image::JpegInput> m_jpeg_in;
493 boost::scoped_ptr<SWFStream> _str;
495 std::auto_ptr<IOChannel> _in;
501 SWFMovieLoader _loader;
510 DSOTEXPORT virtual void incrementLoadedFrames();
515 void setBytesLoaded(
unsigned long bytes)
517 boost::mutex::scoped_lock lock(_bytes_loaded_mutex);
522 bool _loadingCanceled;
525 std::set< boost::intrusive_ptr<movie_definition> > _importSources;
535 const RunResources& _runResources;