GESTimelineElement

## GESTimelineElement GESTimelineElement — Base Class for all elements that will be in a way or another inside a GESTimeline. |

## Synopsis

    #include <ges/ges.h>

                        GESTimelineElement;
                        GESTimelineElementClass;
    gboolean            ges_timeline_element_set_parent     (GESTimelineElement *self,
                                                             GESTimelineElement *parent);
    GESTimelineElement * ges_timeline_element_get_parent    (GESTimelineElement *self);
    gboolean            ges_timeline_element_set_timeline   (GESTimelineElement *self,
                                                             GESTimeline *timeline);
    GESTimeline *       ges_timeline_element_get_timeline   (GESTimelineElement *self);
    void                ges_timeline_element_set_start      (GESTimelineElement *self,
                                                             GstClockTime start);
    void                ges_timeline_element_set_inpoint    (GESTimelineElement *self,
                                                             GstClockTime inpoint);
    void                ges_timeline_element_set_duration   (GESTimelineElement *self,
                                                             GstClockTime duration);
    void                ges_timeline_element_set_max_duration
                                                            (GESTimelineElement *self,
                                                             GstClockTime maxduration);
    void                ges_timeline_element_set_priority   (GESTimelineElement *self,
                                                             guint32 priority);
    GstClockTime        ges_timeline_element_get_start      (GESTimelineElement *self);
    GstClockTime        ges_timeline_element_get_inpoint    (GESTimelineElement *self);
    GstClockTime        ges_timeline_element_get_duration   (GESTimelineElement *self);
    GstClockTime        ges_timeline_element_get_max_duration
                                                            (GESTimelineElement *self);
    guint32             ges_timeline_element_get_priority   (GESTimelineElement *self);
    gboolean            ges_timeline_element_ripple         (GESTimelineElement *self,
                                                             GstClockTime start);
    gboolean            ges_timeline_element_ripple_end     (GESTimelineElement *self,
                                                             GstClockTime end);
    gboolean            ges_timeline_element_roll_start     (GESTimelineElement *self,
                                                             GstClockTime start);
    gboolean            ges_timeline_element_roll_end       (GESTimelineElement *self,
                                                             GstClockTime end);
    gboolean            ges_timeline_element_trim           (GESTimelineElement *self,
                                                             GstClockTime start);
    GESTimelineElement * ges_timeline_element_get_toplevel_parent
                                                            (GESTimelineElement *self);
    #define             GES_TIMELINE_ELEMENT_PARENT         (obj)
    #define             GES_TIMELINE_ELEMENT_TIMELINE       (obj)
    #define             GES_TIMELINE_ELEMENT_START          (obj)
    #define             GES_TIMELINE_ELEMENT_END            (obj)
    #define             GES_TIMELINE_ELEMENT_INPOINT        (obj)
    #define             GES_TIMELINE_ELEMENT_DURATION       (obj)
    #define             GES_TIMELINE_ELEMENT_MAX_DURATION   (obj)
    #define             GES_TIMELINE_ELEMENT_PRIORITY       (obj)

## Object Hierarchy

      GObject
       +----GInitiallyUnowned
             +----GESTimelineElement
                   +----GESContainer
                   +----GESTrackElement

## Implemented Interfaces

GESTimelineElement implements GESExtractable and GESMetaContainer.

## Description

The GESTimelineElement base class implements the notion of timing as well as priority. A GESTimelineElement can have a parent object which will be responsible for controlling its timing properties.

## Details

### GESTimelineElement

    typedef struct {
      /*< read only >*/
      GESTimelineElement *parent;
      GESAsset *asset;
      GstClockTime start;
      GstClockTime inpoint;
      GstClockTime duration;
      GstClockTime maxduration;
      guint32 priority;
      GESTimeline *timeline;
    } GESTimelineElement;

Those filed can be accessed from outside but in no case should be changed from there. Subclasses can write them but should make sure to properly call g_object_notify.

GESTimelineElement *`parent`; | The GESTimelineElement that controls the object
GESAsset *`asset`; | The GESAsset from which the object has been extracted
GstClockTime `start`; | position (in time) of the object
GstClockTime `inpoint`; | Position in the media from which the object should be used
GstClockTime `duration`; | duration of the object to be used
GstClockTime `maxduration`; | The maximum duration the object can have
guint32 `priority`; | priority of the object in the layer (0:top priority)
GESTimeline *`timeline`; |

### GESTimelineElementClass

    typedef struct {
      GInitiallyUnownedClass parent_class;

      gboolean (*set_parent)       (GESTimelineElement * self, GESTimelineElement *parent);
      gboolean (*set_start)        (GESTimelineElement * self, GstClockTime start);
      gboolean (*set_inpoint)      (GESTimelineElement * self, GstClockTime inpoint);
      gboolean (*set_duration)     (GESTimelineElement * self, GstClockTime duration);
      gboolean (*set_max_duration) (GESTimelineElement * self, GstClockTime maxduration);
      gboolean (*set_priority)     (GESTimelineElement * self, guint32 priority);

      gboolean (*ripple)           (GESTimelineElement *self, guint64  start);
      gboolean (*ripple_end)       (GESTimelineElement *self, guint64  end);
      gboolean (*roll_start)       (GESTimelineElement *self, guint64  start);
      gboolean (*roll_end)         (GESTimelineElement *self, guint64  end);
      gboolean (*trim)             (GESTimelineElement *self, guint64  start);
      void (*deep_copy)            (GESTimelineElement *self, GESTimelineElement *copy);
    } GESTimelineElementClass;

The GESTimelineElement base class. Subclasses should override at least `set_start` `set_inpoint` `set_duration` `ripple` `ripple_end` `roll_start` `roll_end` and `trim`.

Vmethods in subclasses should apply all the operation they need to but the real method implementation is in charge of setting the proper field, and emit the notify signal.

GInitiallyUnownedClass `parent_class`; |
`set_parent` () | method to set the parent of a GESTimelineElement.
`set_start` () | method to set the start of a GESTimelineElement
`set_inpoint` () | method to set the inpoint of a GESTimelineElement
`set_duration` () | method to set the duration of a GESTimelineElement
`set_max_duration` () | method to set the maximun duration of a GESTimelineElement
`set_priority` () | method to set the priority of a GESTimelineElement
`ripple` () | method to ripple an object
`ripple_end` () | method to ripple an object on its GES_EDGE_END edge
`roll_start` () | method to roll an object on its GES_EDGE_START edge
`roll_end` () | method to roll an object on its GES_EDGE_END edge
`trim` () | method to trim an object
`deep_copy` () | Copy the children properties of `self` into `copy`

### ges_timeline_element_set_parent ()

    gboolean            ges_timeline_element_set_parent     (GESTimelineElement *self,
                                                             GESTimelineElement *parent);

Sets the parent of `self` to `parent`. The object's reference count will be incremented, and any floating reference will be removed (see `gst_object_ref_sink()`).

`self` : | a GESTimelineElement
`parent` : | new parent of self
Returns : | `TRUE` if `parent` could be set or `FALSE` when `self` already had a parent or `self` and `parent` are the same.

### ges_timeline_element_get_parent ()

    GESTimelineElement * ges_timeline_element_get_parent    (GESTimelineElement *self);

Returns the parent of `self`. This function increases the refcount of the parent object so you should `gst_object_unref()` it after usage.

`self` : | a GESTimelineElement
Returns : | parent of `self`, this can be `NULL` if `self` has no parent. unref after usage. [transfer full]

### ges_timeline_element_set_timeline ()

    gboolean            ges_timeline_element_set_timeline   (GESTimelineElement *self,
                                                             GESTimeline *timeline);

Sets the timeline of `self` to `timeline`.

`self` : | a GESTimelineElement
`timeline` : | The GESTimeline `self` is in
Returns : | `TRUE` if `timeline` could be set or `FALSE` when `timeline` already had a timeline.

### ges_timeline_element_get_timeline ()

    GESTimeline *       ges_timeline_element_get_timeline   (GESTimelineElement *self);

Returns the timeline of `self`. This function increases the refcount of the timeline so you should `gst_object_unref()` it after usage.

`self` : | a GESTimelineElement
Returns : | timeline of `self`, this can be `NULL` if `self` has no timeline. unref after usage. [transfer full]

### ges_timeline_element_set_start ()

    void                ges_timeline_element_set_start      (GESTimelineElement *self,
                                                             GstClockTime start);

Set the position of the object in its containing layer

Note that if the timeline snap-distance property of the timeline containing `self` is set, `self` will properly snap to its neighboors.

`self` : | a GESTimelineElement
`start` : | the position in GstClockTime

### ges_timeline_element_set_inpoint ()

    void                ges_timeline_element_set_inpoint    (GESTimelineElement *self,
                                                             GstClockTime inpoint);

Set the in-point, that is the moment at which the `self` will start outputting data from its contents.

`self` : | a GESTimelineElement
`inpoint` : | the in-point in GstClockTime

### ges_timeline_element_set_duration ()

    void                ges_timeline_element_set_duration   (GESTimelineElement *self,
                                                             GstClockTime duration);

Set the duration of the object

Note that if the timeline snap-distance property of the timeline containing `self` is set, `self` will properly snap to its neighboors.

`self` : | a GESTimelineElement
`duration` : | the duration in GstClockTime

### ges_timeline_element_set_max_duration ()

    void                ges_timeline_element_set_max_duration
                                                            (GESTimelineElement *self,
                                                             GstClockTime maxduration);

Set the maximun duration of the object

`self` : | a GESTimelineElement
`maxduration` : | the maximum duration in GstClockTime

### ges_timeline_element_set_priority ()

    void                ges_timeline_element_set_priority   (GESTimelineElement *self,
                                                             guint32 priority);

Sets the priority of the object within the containing layer

`self` : | a GESTimelineElement
`priority` : | the priority

### ges_timeline_element_get_start ()

    GstClockTime        ges_timeline_element_get_start      (GESTimelineElement *self);

`self` : | a GESTimelineElement
Returns : | The `start` of `self`

### ges_timeline_element_get_inpoint ()

    GstClockTime        ges_timeline_element_get_inpoint    (GESTimelineElement *self);

`self` : | a GESTimelineElement
Returns : | The `inpoint` of `self`

### ges_timeline_element_get_duration ()

    GstClockTime        ges_timeline_element_get_duration   (GESTimelineElement *self);

`self` : | a GESTimelineElement
Returns : | The `duration` of `self`

### ges_timeline_element_get_max_duration ()

    GstClockTime        ges_timeline_element_get_max_duration
                                                            (GESTimelineElement *self);

`self` : | a GESTimelineElement
Returns : | The `maxduration` of `self`

### ges_timeline_element_get_priority ()

    guint32             ges_timeline_element_get_priority   (GESTimelineElement *self);

`self` : | a GESTimelineElement
Returns : | The `priority` of `self`

### ges_timeline_element_ripple ()

    gboolean            ges_timeline_element_ripple         (GESTimelineElement *self,
                                                             GstClockTime start);

Edits `self` in ripple mode. It allows you to modify the start of `self` and move the following neighbours accordingly. This will change the overall timeline duration.

`self` : | The GESTimelineElement to ripple.
`start` : | The new start of `self` in ripple mode.
Returns : | `TRUE` if the self as been rippled properly, `FALSE` if an error occured

### ges_timeline_element_ripple_end ()

    gboolean            ges_timeline_element_ripple_end     (GESTimelineElement *self,
                                                             GstClockTime end);

Edits `self` in ripple mode. It allows you to modify the duration of a `self` and move the following neighbours accordingly. This will change the overall timeline duration.

`self` : | The GESTimelineElement to ripple.
`end` : | The new end (start + duration) of `self` in ripple mode. It will basically only change the duration of `self`.
Returns : | `TRUE` if the self as been rippled properly, `FALSE` if an error occured

### ges_timeline_element_roll_start ()

    gboolean            ges_timeline_element_roll_start     (GESTimelineElement *self,
                                                             GstClockTime start);

Edits `self` in roll mode. It allows you to modify the start and inpoint of a `self` and "resize" (basicly change the duration in this case) of the previous neighbours accordingly. This will not change the overall timeline duration.

`self` : | The GESTimelineElement to roll
`start` : | The new start of `self` in roll mode, it will also adapat the in-point of `self` according
Returns : | `TRUE` if the self as been roll properly, `FALSE` if an error occured

### ges_timeline_element_roll_end ()

    gboolean            ges_timeline_element_roll_end       (GESTimelineElement *self,
                                                             GstClockTime end);

Edits `self` in roll mode. It allows you to modify the duration of a `self` and trim (basicly change the start + inpoint in this case) the following neighbours accordingly. This will not change the overall timeline duration.

`self` : | The GESTimelineElement to roll.
`end` : | The new end (start + duration) of `self` in roll mode
Returns : | `TRUE` if the self as been rolled properly, `FALSE` if an error occured

### ges_timeline_element_trim ()

    gboolean            ges_timeline_element_trim           (GESTimelineElement *self,
                                                             GstClockTime start);

Edits `self` in trim mode. It allows you to modify the inpoint and start of `self`. This will not change the overall timeline duration.

Note that to trim the end of an self you can just set its duration. The same way as this method, it will take into account the snapping-distance property of the timeline in which `self` is.

`self` : | The GESTimelineElement to trim.
`start` : | The new start of `self` in trim mode, will adapt the inpoint of `self` accordingly
Returns : | `TRUE` if the self as been trimmed properly, `FALSE` if an error occured

### ges_timeline_element_get_toplevel_parent ()

    GESTimelineElement * ges_timeline_element_get_toplevel_parent
                                                            (GESTimelineElement *self);

Gets the toplevel GESTimelineElement controlling `self`

`self` : | The GESTimelineElement to get the toplevel parent from
Returns : | The toplevel controlling parent of `self`. [transfer full]

### GES_TIMELINE_ELEMENT_PARENT()

    #define GES_TIMELINE_ELEMENT_PARENT(obj) (((GESTimelineElement*)obj)->parent)

The parent of the object.

`obj` : | a GESTimelineElement

### GES_TIMELINE_ELEMENT_TIMELINE()

    #define GES_TIMELINE_ELEMENT_TIMELINE(obj) (((GESTimelineElement*)obj)->timeline)

The timeline in which the object is.

`obj` : | a GESTimelineElement

### GES_TIMELINE_ELEMENT_START()

    #define GES_TIMELINE_ELEMENT_START(obj) (((GESTimelineElement*)obj)->start)

The start position of the object (in nanoseconds).

`obj` : | a GESTimelineElement

### GES_TIMELINE_ELEMENT_END()

    #define GES_TIMELINE_ELEMENT_END(obj) ((((GESTimelineElement*)obj)->start) + (((GESTimelineElement*)obj)->duration))

The end position of the object (in nanoseconds).

`obj` : | a GESTimelineElement

### GES_TIMELINE_ELEMENT_INPOINT()

    #define GES_TIMELINE_ELEMENT_INPOINT(obj) (((GESTimelineElement*)obj)->inpoint)

The in-point of the object (in nanoseconds).

`obj` : | a GESTimelineElement

### GES_TIMELINE_ELEMENT_DURATION()

    #define GES_TIMELINE_ELEMENT_DURATION(obj) (((GESTimelineElement*)obj)->duration)

The duration of the object (in nanoseconds).

`obj` : | a GESTimelineElement

### GES_TIMELINE_ELEMENT_MAX_DURATION()

    #define GES_TIMELINE_ELEMENT_MAX_DURATION(obj) (((GESTimelineElement*)obj)->maxduration)

The maximun duration of the object (in nanoseconds).

`obj` : | a GESTimelineElement

### GES_TIMELINE_ELEMENT_PRIORITY()

    #define GES_TIMELINE_ELEMENT_PRIORITY(obj) (((GESTimelineElement*)obj)->priority)

The priority of the object.

`obj` : | a GESTimelineElement