SwfdecLoader

## SwfdecLoader SwfdecLoader — object used for input |

## Synopsis

    #include <swfdec/swfdec.h>

                        SwfdecLoader;
                        SwfdecFileLoader;
                        SwfdecLoaderClass;
    void                swfdec_loader_set_url               (SwfdecLoader *loader,
                                                             const char *url);
    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);
    SwfdecLoaderDataType swfdec_loader_get_data_type        (SwfdecLoader *loader);

## Object Hierarchy

      GObject
       +----SwfdecStream
             +----SwfdecLoader
                   +----SwfdecFileLoader

      GObject
       +----SwfdecStream
             +----SwfdecLoader
                   +----SwfdecFileLoader
                         +----SwfdecGtkLoader

## Properties

      "data-type"                SwfdecLoaderDataType  : Read
      "loaded"                   gulong                : Read / Write
      "size"                     glong                 : Read / Write
      "url"                      SwfdecURL*            : Read

## Description

SwfdecLoader is the base class used for reading input. Since developers normally need to adapt input to the needs of their application, this class is provided to be adapted to their needs. It is used both for HTTP and RTMP access.

Since Flash files can load new resources while operating, a SwfdecLoader can be instructed to load another resource.

For convenience, a SwfdecLoader for file access is provided by Swfdec.

## Details

### SwfdecLoader

    typedef struct _SwfdecLoader SwfdecLoader;

This is the base object used for providing input. It is abstract, use a subclass to provide your input.

### SwfdecFileLoader

    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.

### SwfdecLoaderClass

    typedef struct {
      void			(* load)	(SwfdecLoader *			loader,
    					 SwfdecPlayer *			player,
    					 const char *			url,
    					 SwfdecBuffer *			buffer,
    					 guint				n_headers,
    					 const char **			header_names,
    					 const char **			header_values);
    } SwfdecLoaderClass;

This is the base class used for input. If you create a subclass, you are supposed to set the function pointers listed above.

`load` () | initialize a new loader based on a parent loader object. The new loader will already have its URL set.

### swfdec_loader_set_url ()

    void                swfdec_loader_set_url               (SwfdecLoader *loader,
                                                             const char *url);

Updates the url of the given `loader` to point to the new `url`. This is useful whe encountering HTTP redirects, as the loader is supposed to reference the final URL after all rdirections. This function may only be called once and must have been called before calling `swfdec_stream_open()` on `loader`.

`loader` : | the loader to update
`url` : | string specifying the new URL. The url must be a valid absolute URL.

### swfdec_loader_get_url ()

    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` or `NULL` if the `url` is not known yet.

### swfdec_loader_set_size ()

    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

### swfdec_loader_get_size ()

    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

### swfdec_loader_get_loaded ()

    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`

### swfdec_loader_get_data_type ()

    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

## Property Details

### The `"data-type"` property

      "data-type"                SwfdecLoaderDataType  : Read

the data's type as identified by Swfdec.

Default value: SWFDEC_LOADER_DATA_UNKNOWN

### The `"loaded"` property

      "loaded"                   gulong                : Read / Write

bytes already loaded.

### The `"size"` property

      "size"                     glong                 : Read / Write

amount of bytes in loader.

Allowed values: >= -1

Default value: -1

### The `"url"` property

      "url"                      SwfdecURL*            : Read

URL for this file.