## GESTimeline

GESTimeline — Multimedia timeline

## Synopsis

    #include <ges/ges.h>

                        GESTimeline;
    GESTimeline *       ges_timeline_new                    (void);
    GESTimeline *       ges_timeline_new_audio_video        (void);
    GESTimeline *       ges_timeline_new_from_uri           (gchar *uri);
    gboolean            ges_timeline_add_layer              (GESTimeline *timeline,
                                                             GESTimelineLayer *layer);
    gboolean            ges_timeline_remove_layer           (GESTimeline *timeline,
                                                             GESTimelineLayer *layer);
    gboolean            ges_timeline_add_track              (GESTimeline *timeline,
                                                             GESTrack *track);
    gboolean            ges_timeline_remove_track           (GESTimeline *timeline,
                                                             GESTrack *track);
    gboolean            ges_timeline_load_from_uri          (GESTimeline *timeline,
                                                             gchar *uri);
    gboolean            ges_timeline_save_to_uri            (GESTimeline *timeline,
                                                             gchar *uri);

    GList *             ges_timeline_get_tracks             (GESTimeline *timeline);
    GList *             ges_timeline_get_layers             (GESTimeline *timeline);
    GESTrack *          ges_timeline_get_track_for_pad      (GESTimeline *timeline,
                                                             GstPad *pad);

## Object Hierarchy

      GObject
       +----GstObject
             +----GstElement
                   +----GstBin
                         +----GESTimeline

## Implemented Interfaces

GESTimeline implements GstChildProxy.

## Signals

      "layer-added"                                    : Run First
      "layer-removed"                                  : Run First
      "track-added"                                    : Run First
      "track-removed"                                  : Run First

## Description

GESTimeline is the central object for any multimedia timeline.

Contains a list of GESTimelineLayer which users should use to arrange the various timeline objects through time.

The output type is determined by the GESTrack that are set on the GESTimeline.

To save/load a timeline, you can use the `ges_timeline_load_from_uri()` and `ges_timeline_save_to_uri()` methods to use the default format. If you wish to specify the format to save/load the timeline from, please consult the documentation about GESFormatter.

## Details

### GESTimeline

    typedef struct _GESTimeline GESTimeline;

### ges_timeline_new ()

    GESTimeline *       ges_timeline_new                    (void);

Creates a new empty GESTimeline.

Returns : | The new timeline.

### ges_timeline_new_audio_video ()

    GESTimeline *       ges_timeline_new_audio_video        (void);

Creates a new GESTimeline containing a raw audio and a raw video track.

Returns : | The newly created GESTimeline. [transfer full]

### ges_timeline_new_from_uri ()

    GESTimeline *       ges_timeline_new_from_uri           (gchar *uri);

Creates a timeline from the given URI.

`uri` : | the URI to load from
Returns : | A new timeline if the uri was loaded successfully, or NULL if the uri could not be loaded

### ges_timeline_add_layer ()

    gboolean            ges_timeline_add_layer              (GESTimeline *timeline,
                                                             GESTimelineLayer *layer);

Add the layer to the timeline. The reference to the `layer` will be stolen by the `timeline`.

`timeline` : | a GESTimeline
`layer` : | the GESTimelineLayer to add
Returns : | TRUE if the layer was properly added, else FALSE.

### ges_timeline_remove_layer ()

    gboolean            ges_timeline_remove_layer           (GESTimeline *timeline,
                                                             GESTimelineLayer *layer);

Removes the layer from the timeline. The reference that the `timeline` holds on the layer will be dropped. If you wish to use the `layer` after calling this method, you need to take a reference before calling.

`timeline` : | a GESTimeline
`layer` : | the GESTimelineLayer to remove
Returns : | TRUE if the layer was properly removed, else FALSE.

### ges_timeline_add_track ()

    gboolean            ges_timeline_add_track              (GESTimeline *timeline,
                                                             GESTrack *track);

Add a track to the timeline. The reference to the track will be stolen by the pipeline.

`timeline` : | a GESTimeline
`track` : | the GESTrack to add
Returns : | TRUE if the track was properly added, else FALSE.

### ges_timeline_remove_track ()

    gboolean            ges_timeline_remove_track           (GESTimeline *timeline,
                                                             GESTrack *track);

Remove the `track` from the `timeline`. The reference stolen when adding the `track` will be removed. If you wish to use the `track` after calling this function you must ensure that you have a reference to it.

`timeline` : | a GESTimeline
`track` : | the GESTrack to remove
Returns : | TRUE if the `track` was properly removed, else FALSE.

### ges_timeline_load_from_uri ()

    gboolean            ges_timeline_load_from_uri          (GESTimeline *timeline,
                                                             gchar *uri);

Loads the contents of URI into the given timeline.

`timeline` : | an empty GESTimeline into which to load the formatter
`uri` : | The URI to load from
Returns : | TRUE if the timeline was loaded successfully, or FALSE if the uri could not be loaded.

### ges_timeline_save_to_uri ()

    gboolean            ges_timeline_save_to_uri            (GESTimeline *timeline,
                                                             gchar *uri);

Saves the timeline to the given location

`timeline` : | a GESTimeline
`uri` : | The location to save to
Returns : | TRUE if the timeline was successfully saved to the given location, else FALSE.

### ges_timeline_get_tracks ()

    GList *             ges_timeline_get_tracks             (GESTimeline *timeline);

Returns the list of GESTrack used by the Timeline.

`timeline` : | a GESTimeline
Returns : | A list of GESTrack. The caller should unref each track once he is done with them. [transfer full][element-type GESTrack]

### ges_timeline_get_layers ()

    GList *             ges_timeline_get_layers             (GESTimeline *timeline);

Get the list of GESTimelineLayer present in the Timeline.

`timeline` : | a GESTimeline
Returns : | the list of GESTimelineLayer present in the Timeline. The caller should unref each Layer once he is done with them. [transfer full][element-type GESTimelineLayer]

### ges_timeline_get_track_for_pad ()

    GESTrack *          ges_timeline_get_track_for_pad      (GESTimeline *timeline,
                                                             GstPad *pad);

Search the GESTrack corresponding to the given `timeline`'s `pad`.

`timeline` : | The GESTimeline
`pad` : | The GstPad
Returns : | The corresponding GESTrack if it is found, or NULL if there is an error. [transfer none]

## Signal Details

### The `"layer-added"` signal

    void                user_function                      (GESTimeline      *timeline,
                                                            GESTimelineLayer *layer,
                                                            gpointer          user_data)      : Run First

Will be emitted after the layer was added to the timeline.

`timeline` : | the GESTimeline
`layer` : | the GESTimelineLayer that was added to the timeline
`user_data` : | user data set when the signal handler was connected.

### The `"layer-removed"` signal

    void                user_function                      (GESTimeline      *timeline,
                                                            GESTimelineLayer *layer,
                                                            gpointer          user_data)      : Run First

Will be emitted after the layer was removed from the timeline.

`timeline` : | the GESTimeline
`layer` : | the GESTimelineLayer that was removed from the timeline
`user_data` : | user data set when the signal handler was connected.

### The `"track-added"` signal

    void                user_function                      (GESTimeline *timeline,
                                                            GESTrack    *track,
                                                            gpointer     user_data)      : Run First

Will be emitted after the track was added to the timeline.

`timeline` : | the GESTimeline
`track` : | the GESTrack that was added to the timeline
`user_data` : | user data set when the signal handler was connected.

### The `"track-removed"` signal

    void                user_function                      (GESTimeline *timeline,
                                                            GESTrack    *track,
                                                            gpointer     user_data)      : Run First

Will be emitted after the track was removed from the timeline.

`timeline` : | the GESTimeline
`track` : | the GESTrack that was removed from the timeline
`user_data` : | user data set when the signal handler was connected.