23 #ifndef GNASH_SWF_MOVIE_DEFINITION_H 24 #define GNASH_SWF_MOVIE_DEFINITION_H 30 #include <boost/intrusive_ptr.hpp> 40 #include <condition_variable> 54 class SWFMovieDefinition;
89 bool isSelfThread()
const;
95 mutable std::mutex _mutex;
112 typedef std::map<int, boost::intrusive_ptr<SWF::DefinitionTag> >
123 boost::intrusive_ptr<SWF::DefinitionTag> getDisplayObject(
int id)
const;
129 DSOTEXPORT void addDisplayObject(
int id, boost::intrusive_ptr<SWF::DefinitionTag>
c);
132 CharacterIterator
begin() {
return _map.begin(); }
135 CharacterConstIterator
begin()
const {
return _map.begin(); }
138 CharacterIterator
end() {
return _map.end(); }
141 CharacterConstIterator
end()
const {
return _map.end(); }
172 return m_frame_count;
216 virtual size_t get_loading_frame()
const;
220 return _bytes_loaded.load();
225 return m_file_length;
228 DSOTEXPORT virtual void importResources(boost::intrusive_ptr<movie_definition>
source,
239 DSOTEXPORT bool get_labeled_frame(
const std::string& label,
size_t& frame_number)
252 void addBitmap(
int DisplayObject_id, boost::intrusive_ptr<CachedBitmap> im);
255 sound_sample* get_sound_sample(
int DisplayObject_id)
const;
258 virtual void add_sound_sample(
int DisplayObject_id,
sound_sample* sam);
262 m_loading_sound_stream = id;
267 return m_loading_sound_stream;
273 size_t frames_loaded = get_loading_frame();
274 m_playlist[frames_loaded].push_back(tag);
281 DSOTEXPORT void add_frame_name(
const std::string& name);
285 DSOTEXPORT void set_jpeg_loader(std::unique_ptr<image::JpegInput> j_in);
289 return m_jpeg_in.get();
295 assert(frame_number <= _frames_loaded.load());
298 PlayListMap::const_iterator it = m_playlist.find(frame_number);
299 if ( it == m_playlist.end() )
return nullptr;
300 else return &(it->second);
312 bool readHeader(std::unique_ptr<IOChannel> in,
const std::string&
url);
326 bool ensure_frame_loaded(
size_t framenum)
const;
352 virtual const std::string&
get_url()
const {
return _url; }
362 std::uint16_t exportID(
const std::string& symbol)
const;
371 void registerExport(
const std::string& symbol, std::uint16_t
id);
378 virtual void storeDescriptiveMetadata(
const std::string&
data) {
382 virtual const std::string& getDescriptiveMetadata()
const {
392 std::string _metadata;
399 mutable std::mutex _dictionaryMutex;
401 typedef std::map<int, boost::intrusive_ptr<Font> > FontMap;
404 typedef std::map<int, boost::intrusive_ptr<CachedBitmap> > Bitmaps;
407 typedef std::map<int, boost::intrusive_ptr<sound_sample> > SoundSampleMap;
408 SoundSampleMap m_sound_samples;
410 typedef std::map<size_t, PlayList> PlayListMap;
413 PlayListMap m_playlist;
416 typedef std::map<std::string, size_t, StringNoCaseLessThan> NamedFrameMap;
417 NamedFrameMap _namedFrames;
420 mutable std::mutex _namedFramesMutex;
423 typedef std::map<std::string, std::uint16_t,
427 Exports _exportTable;
430 mutable std::mutex _exportedResourcesMutex;
434 typedef std::vector<boost::intrusive_ptr<movie_definition> > ImportVect;
435 ImportVect m_import_source_movies;
439 size_t m_frame_count;
443 std::atomic<size_t> _frames_loaded;
446 mutable std::condition_variable _frame_reached_condition;
449 mutable std::atomic<size_t> _waiting_for_frame;
452 std::atomic<unsigned long> _bytes_loaded;
454 int m_loading_sound_stream;
456 std::uint32_t m_file_length;
458 std::unique_ptr<image::JpegInput> m_jpeg_in;
463 std::unique_ptr<SWFStream> _str;
465 std::unique_ptr<IOChannel> _in;
478 DSOTEXPORT virtual void incrementLoadedFrames();
481 void setBytesLoaded(
unsigned long bytes)
487 mutable std::mutex _loadingCanceledMutex;
488 bool _loadingCanceled;
491 std::set< boost::intrusive_ptr<movie_definition> > _importSources;
503 std::atomic<bool> _as3;
void setAS3()
Call this to inform callers that tags should be executed using AVM2.
Definition: SWFMovieDefinition.h:194
std::map< int, boost::intrusive_ptr< SWF::DefinitionTag > > CharacterContainer
The container used by this dictionary.
Definition: SWFMovieDefinition.h:113
Client program's interface to the definition of a movie or sprite.
Definition: movie_definition.h:95
Definition: klash_part.cpp:329
std::vector< ImportSpec > Imports
Definition: movie_definition.h:166
DisplayObject is the base class for all DisplayList objects.
Definition: DisplayObject.h:168
A Font resource.
Definition: Font.h:89
virtual const std::string & get_url() const
Return the URL of the SWF stream this definition has been read from.
Definition: SWFMovieDefinition.h:352
CharacterConstIterator begin() const
Return a const_iterator to the first dictionary element.
Definition: SWFMovieDefinition.h:135
Definition: klash_part.cpp:330
virtual DisplayObject * createDisplayObject(Global_as &, DisplayObject *) const
Create a DisplayObject with the given parent.
Definition: SWFMovieDefinition.h:347
size_t get_width_pixels() const
Frame width in pixels.
Definition: SWFMovieDefinition.h:185
Font * get_font(const std::string &name, bool bold, bool italic)
Definition: fontlib.cpp:50
double twipsToPixels(int i)
Definition: GnashNumeric.h:97
const SWFRect & get_frame_size() const
Return dimensions of the SWFMovie.
Definition: SWFMovieDefinition.h:181
A top-level, standalone Movie that can be loaded and played.
Definition: Movie.h:46
SimpleBuffer data
Definition: LocalConnection_as.cpp:151
Anonymous namespace for callbacks, local functions, event handlers etc.
Definition: dbus_ext.cpp:40
Immutable data representing the definition of a movie display element.
Definition: DefinitionTag.h:47
size_t get_bytes_total() const
Get total number of bytes as parsed from the SWF header.
Definition: SWFMovieDefinition.h:224
Helper class handling start and execution of a loading thread.
Definition: SWFMovieDefinition.h:69
virtual const PlayList * getPlaylist(size_t frame_number) const
Return the list of execute tags for given frame number.
Definition: SWFMovieDefinition.h:292
Definition: GnashKey.h:149
Definition: GnashKey.h:152
Definition: GnashKey.h:161
Immutable definition of a SWF movie's contents.
Definition: SWFMovieDefinition.h:158
The Characters dictionary associated with each SWF file.
Definition: SWFMovieDefinition.h:104
CharacterContainer::const_iterator CharacterConstIterator
Definition: SWFMovieDefinition.h:117
CharacterIterator end()
Return an iterator to one-past last dictionary element.
Definition: SWFMovieDefinition.h:138
std::ostream & operator<<(std::ostream &o, const URL &u)
Definition: URL.cpp:447
size_t get_height_pixels() const
Frame height in pixels.
Definition: SWFMovieDefinition.h:189
Class to group together per-run and external resources for Gnash.
Definition: RunResources.h:53
std::vector< boost::intrusive_ptr< SWF::ControlTag > > PlayList
Definition: movie_definition.h:98
CharacterContainer::iterator CharacterIterator
Definition: SWFMovieDefinition.h:115
float get_frame_rate() const
Return frame rate advertised for the SWFMovie.
Definition: SWFMovieDefinition.h:176
virtual void set_loading_sound_stream_id(int id)
Set the currently being loaded sound stream.
Definition: SWFMovieDefinition.h:261
void add_font(Font *f)
Definition: fontlib.cpp:67
void addControlTag(boost::intrusive_ptr< SWF::ControlTag > tag)
Add an ControlTag to this movie_definition's playlist.
Definition: SWFMovieDefinition.h:271
The Global object ultimately contains all objects in an ActionScript run.
Definition: Global_as.h:49
int get_loading_sound_stream_id() const
Get the currently being loaded sound stream, if any.
Definition: SWFMovieDefinition.h:266
image::JpegInput * get_jpeg_loader() const
Get the jpeg input loader, to load a DefineBits image (one without table info).
Definition: SWFMovieDefinition.h:288
CharacterIterator begin()
Return an iterator to the first dictionary element.
Definition: SWFMovieDefinition.h:132
A case-insensitive string comparator.
Definition: StringPredicates.h:31
Rectangle class, see swf defined rectangle record.
Definition: SWFRect.h:44
std::string url
Definition: gnash.cpp:59
virtual int get_version() const
Return the advertised version for the SWFMovie.
Definition: SWFMovieDefinition.h:207
#define DSOTEXPORT
Definition: dsodefs.h:63
bool isAS3() const
Check whether tags should be executed using AVM2.
Definition: SWFMovieDefinition.h:199
An identifier for a sound sample managed by a sound_handler.
Definition: sound_definition.h:61
A CachedBitmap is created by the renderer in a format of its choosing.
Definition: CachedBitmap.h:37
size_t get_frame_count() const
Return total number of frames advertised for the SWFMovie.
Definition: SWFMovieDefinition.h:171
std::string name
Definition: LocalConnection_as.cpp:149
Definition: GnashKey.h:331
CharacterConstIterator end() const
Return a const_iterator to one-past last dictionary element.
Definition: SWFMovieDefinition.h:141
size_t get_bytes_loaded() const
Get number of bytes loaded from input stream.
Definition: SWFMovieDefinition.h:219