![]() |
![]() |
![]() |
Swfdec Reference Manual | ![]() |
---|---|---|---|---|
SwfdecLoader; SwfdecFileLoader; SwfdecLoader* swfdec_file_loader_new (const char *filename); void swfdec_loader_open (SwfdecLoader *loader, const char *url); void swfdec_loader_push (SwfdecLoader *loader, SwfdecBuffer *buffer); void swfdec_loader_eof (SwfdecLoader *loader); void swfdec_loader_error (SwfdecLoader *loader, const char *error); const SwfdecURL* swfdec_loader_get_url (SwfdecLoader *loader); void swfdec_loader_set_size (SwfdecLoader *loader, gulong size); glong swfdec_loader_get_size (SwfdecLoader *loader); gulong swfdec_loader_get_loaded (SwfdecLoader *loader); char* swfdec_loader_get_filename (SwfdecLoader *loader); SwfdecLoaderDataType swfdec_loader_get_data_type (SwfdecLoader *loader);
GObject +----SwfdecLoader +----SwfdecFileLoader
GObject +----SwfdecLoader +----SwfdecFileLoader +----SwfdecGtkLoader
"data-type" SwfdecLoaderDataType : Read "eof" gboolean : Read "error" gchararray : Read "loaded" gulong : Read / Write "size" glong : Read / Write "url" SwfdecURL : Read / Write / Construct Only
SwfdecLoader is the base class used for input. Since developers normally need to adapt input to the needs of their application, this class is provided to be adapted to their needs.
Since Flash files can load new resources while operating, a SwfdecLoader can be instructed to load another resource. It's the loader's responsibility to make sure the player is allowed to access the resource and provide its data.
For convenience, a SwfdecLoader for file access is provided by Swfdec.
typedef struct _SwfdecLoader SwfdecLoader;
This is the base class used for providing input. It is abstract, use a subclass to provide your input.
typedef struct _SwfdecFileLoader SwfdecFileLoader;
This is a SwfdecLoader that can load content from files. This symbol is exported so you can subclass your own loaders from it and have automatic file access.
SwfdecLoader* swfdec_file_loader_new (const char *filename);
Creates a new loader for local files. If an error occurred, the loader will be in error.
filename : |
name of the file to load |
Returns : | a new loader |
void swfdec_loader_open (SwfdecLoader *loader, const char *url);
Call this function when your loader opened the resulting file. For HTTP this
is when having received the headers. You must call this function before
swfdec_laoder_push()
can be called.
loader : |
a SwfdecLoader |
url : |
the real URL used for this loader if it has changed (e.g. after HTTP
redirects) or NULL if it hasn't changed
|
void swfdec_loader_push (SwfdecLoader *loader, SwfdecBuffer *buffer);
Makes the data in buffer
available to loader
and processes it. The loader
must be open.
loader : |
a SwfdecLoader |
buffer : |
new data to make available. The loader takes the reference to the buffer. |
void swfdec_loader_eof (SwfdecLoader *loader);
Indicates to loader
that no more data will follow. The loader must be open.
loader : |
a SwfdecLoader |
void swfdec_loader_error (SwfdecLoader *loader, const char *error);
Moves the loader in the error state if it wasn't before. A loader that is in the error state will not process any more data. Also, internal error handling scripts may be executed.
loader : |
a SwfdecLoader |
error : |
a string describing the error |
const SwfdecURL* swfdec_loader_get_url (SwfdecLoader *loader);
Gets the url this loader is handling. This is mostly useful for writing subclasses of SwfdecLoader.
loader : |
a SwfdecLoader |
Returns : | a SwfdecURL describing loader .
|
void swfdec_loader_set_size (SwfdecLoader *loader, gulong size);
Sets the size of bytes in this loader. This function may only be called once.
loader : |
a SwfdecLoader |
size : |
the amount of bytes in this loader |
glong swfdec_loader_get_size (SwfdecLoader *loader);
Queries the amount of bytes inside loader
. If the size is unknown, -1 is
returned. Otherwise the number is greater or equal to 0.
loader : |
a SwfdecLoader |
Returns : | the total number of bytes for this loader or -1 if unknown |
gulong swfdec_loader_get_loaded (SwfdecLoader *loader);
Gets the amount of bytes that have already been pushed into loader
and are
available to Swfdec.
loader : |
a SwfdecLoader |
Returns : | Amount of bytes in loader
|
char* swfdec_loader_get_filename (SwfdecLoader *loader);
Gets the suggested filename to use for this loader. This may be of interest when displaying information about the file that is played back.
loader : |
a SwfdecLoader |
Returns : | A string in the glib filename encoding that contains the filename
for this loader. g_free() after use.
|
SwfdecLoaderDataType swfdec_loader_get_data_type (SwfdecLoader *loader);
Queries the type of data this loader provides. The type is determined automatically by Swfdec.
loader : |
a SwfdecLoader |
Returns : | the type this data was identified to be in or SWFDEC_LOADER_DATA_UNKNOWN if not identified |
"data-type"
property"data-type" SwfdecLoaderDataType : Read
the data's type as identified by Swfdec.
Default value: SWFDEC_LOADER_DATA_UNKNOWN
"eof"
property"eof" gboolean : Read
TRUE when all data has been handed to the loader.
Default value: FALSE
"error"
property"error" gchararray : Read
NULL when no error or string describing error.
Default value: NULL
"size"
property"size" glong : Read / Write
amount of bytes in loader.
Allowed values: >= -1
Default value: -1