## GESFormatter

GESFormatter — Timeline saving and loading.

## Synopsis

    #include <ges/ges.h>

                        GESFormatter;
                        GESFormatterClass;
    gboolean            (*GESFormatterLoadFromURIMethod)    (GESFormatter *formatter,
                                                             GESTimeline *timeline,
                                                             gchar *uri);
    gboolean            (*GESFormatterSaveToURIMethod)      (GESFormatter *formatter,
                                                             GESTimeline *timeline,
                                                             gchar *uri);
    GESFormatter *      ges_default_formatter_new           (void);
    gboolean            ges_formatter_load_from_uri         (GESFormatter *formatter,
                                                             GESTimeline *timeline,
                                                             gchar *uri);
    gboolean            ges_formatter_save_to_uri           (GESFormatter *formatter,
                                                             GESTimeline *timeline,
                                                             gchar *uri);
    GESFormatter *      ges_formatter_new_for_uri           (gchar *uri);
    gboolean            ges_formatter_can_load_uri          (gchar *uri);
    gboolean            ges_formatter_can_save_uri          (gchar *uri);

## Object Hierarchy

      GObject
       +----GESFormatter
             +----GESKeyfileFormatter

## Description

The GESFormatter is the object responsible for loading and/or saving the contents of a GESTimeline to/from various formats.

In order to save a GESTimeline, you can either let GES pick a default formatter by using `ges_timeline_save_to_uri()`, or pick your own formatter and use `ges_formatter_save_to_uri()`.

To load a GESTimeline, you might want to be able to track the progress of the loading, in which case you should create an empty GESTimeline, connect to the relevant signals and call `ges_formatter_load_from_uri()`.

If you do not care about tracking the loading progress, you can use the convenience `ges_timeline_new_from_uri()` method.

Support for saving or loading new formats can be added by creating a subclass of GESFormatter and implement the various vmethods of GESFormatterClass.

## Details

### GESFormatter

    typedef struct _GESFormatter GESFormatter;

Base class for timeline data serialization and deserialization.

### GESFormatterClass

    typedef struct {
      GObjectClass parent_class;

      /* FIXME : formatter name */
      /* FIXME : formatter description */
      /* FIXME : format name/mime-type */

      GESFormatterCanLoadURIMethod can_load_uri;
      GESFormatterCanSaveURIMethod can_save_uri;
      GESFormatterLoadFromURIMethod load_from_uri;
      GESFormatterSaveToURIMethod save_to_uri;
    } GESFormatterClass;

GES Formatter class. Override the vmethods to implement the formatter functionnality.

GObjectClass `parent_class`; | the parent class structure
GESFormatterCanLoadURIMethod `can_load_uri`; | Whether the URI can be loaded
GESFormatterCanSaveURIMethod `can_save_uri`; | Whether the URI can be saved
GESFormatterLoadFromURIMethod `load_from_uri`; | class method to deserialize data from a URI
GESFormatterSaveToURIMethod `save_to_uri`; | class method to serialize data to a URI

### GESFormatterLoadFromURIMethod ()

    gboolean            (*GESFormatterLoadFromURIMethod)    (GESFormatter *formatter,
                                                             GESTimeline *timeline,
                                                             gchar *uri);

Virtual method for loading a timeline from a given URI.

Every GESFormatter subclass needs to implement this method.

`formatter` : | a GESFormatter
`timeline` : | a GESTimeline
`uri` : | the URI to load from
Returns : | TRUE if the `timeline` was properly loaded from the given `uri`, else FALSE.

### GESFormatterSaveToURIMethod ()

    gboolean            (*GESFormatterSaveToURIMethod)      (GESFormatter *formatter,
                                                             GESTimeline *timeline,
                                                             gchar *uri);

Virtual method for saving a timeline to a uri.

Every GESFormatter subclass needs to implement this method.

`formatter` : | a GESFormatter
`timeline` : | a GESTimeline
`uri` : | the URI to save to
Returns : | TRUE if the `timeline` was properly stored to the given `uri`, else FALSE.

### ges_default_formatter_new ()

    GESFormatter *      ges_default_formatter_new           (void);

Creates a new instance of the default GESFormatter type on this system (currently GESKeyfileFormatter).

Returns : | a GESFormatter instance or NULL

### ges_formatter_load_from_uri ()

    gboolean            ges_formatter_load_from_uri         (GESFormatter *formatter,
                                                             GESTimeline *timeline,
                                                             gchar *uri);

Load data from the given URI into timeline.

`formatter` : | a GESFormatter
`timeline` : | a GESTimeline
`uri` : | a gchar * pointing to a URI
Returns : | TRUE if the timeline data was successfully loaded from the URI, else FALSE.

### ges_formatter_save_to_uri ()

    gboolean            ges_formatter_save_to_uri           (GESFormatter *formatter,
                                                             GESTimeline *timeline,
                                                             gchar *uri);

Save data from timeline to the given URI.

`formatter` : | a GESFormatter
`timeline` : | a GESTimeline
`uri` : | a gchar * pointing to a URI
Returns : | TRUE if the timeline data was successfully saved to the URI else FALSE.

### ges_formatter_new_for_uri ()

    GESFormatter *      ges_formatter_new_for_uri           (gchar *uri);

Creates a GESFormatter that can handle the given URI.

`uri` : | a gchar * pointing to the uri
Returns : | A GESFormatter that can load the given uri, or NULL if the uri is not supported.

### ges_formatter_can_load_uri ()

    gboolean            ges_formatter_can_load_uri          (gchar *uri);

Checks if there is a GESFormatter available which can load a GESTimeline from the given URI.

`uri` : | a gchar * pointing to the URI
Returns : | TRUE if there is a GESFormatter that can support the given uri or FALSE if not.

### ges_formatter_can_save_uri ()

    gboolean            ges_formatter_can_save_uri          (gchar *uri);

Returns TRUE if there is a GESFormatter available which can save a GESTimeline to the given URI.

`uri` : | a gchar * pointing to a URI
Returns : | TRUE if the given `uri` is supported, else FALSE.