[][src]Struct gstreamer_editing_services::Timeline

pub struct Timeline(_, _);

Timeline is the central object for any multimedia timeline.

A timeline is composed of a set of Track-s and a set of Layer-s, which are added to the timeline using TimelineExt::add_track and TimelineExt::append_layer, respectively.

The contained tracks define the supported types of the timeline and provide the media output. Essentially, each track provides an additional source gst::Pad.

Most usage of a timeline will likely only need a single AudioTrack and/or a single VideoTrack. You can create such a timeline with Timeline::new_audio_video. After this, you are unlikely to need to work with the tracks directly.

A timeline's layers contain Clip-s, which in turn control the creation of TrackElement-s, which are added to the timeline's tracks. See Timeline::select-tracks-for-object if you wish to have more control over which track a clip's elements are added to.

The layers are ordered, with higher priority layers having their content prioritised in the tracks. This ordering can be changed using TimelineExt::move_layer.

Editing

See TimelineElement for the various ways the elements of a timeline can be edited.

If you change the timing or ordering of a timeline's TimelineElement-s, then these changes will not actually be taken into account in the output of the timeline's tracks until the TimelineExt::commit method is called. This allows you to move its elements around, say, in response to an end user's mouse dragging, with little expense before finalising their effect on the produced data.

Overlaps and Auto-Transitions

There are certain restrictions placed on how Source-s may overlap in a Track that belongs to a timeline. These will be enforced by GES, so the user will not need to keep track of them, but they should be aware that certain edits will be refused as a result if the overlap rules would be broken.

Consider two Source-s, A and B, with start times startA and startB, and end times endA and endB, respectively. The start time refers to their TimelineElement:start, and the end time is their TimelineElement:start + TimelineElement:duration. These two sources overlap if:

Note that when startA = endB or startB = endA then the two sources will touch at their edges, but are not considered overlapping.

If, in addition, startA < startB < endA, then we can say that the end of A overlaps the start of B.

If, instead, startA <= startB and endA >= endB, then we can say that A fully overlaps B.

The overlap rules for a timeline are that:

  1. One source cannot fully overlap another source.
  2. A source can only overlap the end of up to one other source at its start.
  3. A source can only overlap the start of up to one other source at its end.

The last two rules combined essentially mean that at any given timeline position, only up to two Source-s may overlap at that position. So triple or more overlaps are not allowed.

If you switch on Timeline:auto-transition, then at any moment when the end of one source (the first source) overlaps the start of another (the second source), a TransitionClip will be automatically created for the pair in the same layer and it will cover their overlap. If the two elements are edited in a way such that the end of the first source no longer overlaps the start of the second, the transition will be automatically removed from the timeline. However, if the two sources still overlap at the same edges after the edit, then the same transition object will be kept, but with its timing and layer adjusted accordingly.

Saving

To save/load a timeline, you can use the TimelineExt::load_from_uri and TimelineExt::save_to_uri methods that use the default format.

Playing

A timeline is a gst::Bin with a source gst::Pad for each of its tracks, which you can fetch with TimelineExt::get_pad_for_track. You will likely want to link these to some compatible sink gst::Element-s to be able to play or capture the content of the timeline.

You can use a Pipeline to easily preview/play the timeline's content, or render it to a file.

Implements

TimelineExt, gst::ElementExt, gst::ObjectExt, glib::object::ObjectExt, ExtractableExt

Implementations

impl Timeline[src]

pub fn new() -> Timeline[src]

Creates a new empty timeline.

Returns

The new timeline.

pub fn new_audio_video() -> Timeline[src]

Creates a new timeline containing a single AudioTrack and a single VideoTrack.

Returns

The new timeline, or None if the tracks could not be created and added.

pub fn from_uri(uri: &str) -> Result<Option<Timeline>, Error>[src]

Trait Implementations

impl Clone for Timeline[src]

impl Debug for Timeline[src]

impl Default for Timeline[src]

impl Eq for Timeline[src]

impl Hash for Timeline[src]

impl IsA<Element> for Timeline[src]

impl IsA<Extractable> for Timeline[src]

impl IsA<Object> for Timeline[src]

impl Ord for Timeline[src]

impl<T: ObjectType> PartialEq<T> for Timeline[src]

impl<T: ObjectType> PartialOrd<T> for Timeline[src]

impl StaticType for Timeline[src]

Auto Trait Implementations

impl RefUnwindSafe for Timeline

impl !Send for Timeline

impl !Sync for Timeline

impl Unpin for Timeline

impl UnwindSafe for Timeline

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<Super, Sub> CanDowncast<Sub> for Super where
    Sub: IsA<Super>,
    Super: IsA<Super>, 
[src]

impl<T> Cast for T where
    T: ObjectType
[src]

impl<O> ElementExt for O where
    O: IsA<Element>, 
[src]

impl<O> ElementExtManual for O where
    O: IsA<Element>, 
[src]

impl<T> From<T> for T[src]

impl<O> GObjectExtManualGst for O where
    O: IsA<Object>, 
[src]

impl<O> GstObjectExt for O where
    O: IsA<Object>, 
[src]

impl<O> GstObjectExtManual for O where
    O: IsA<Object>, 
[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ObjectExt for T where
    T: ObjectType
[src]

impl<'a, T> ToGlibContainerFromSlice<'a, *const GList> for T where
    T: GlibPtrDefault + ToGlibPtr<'a, <T as GlibPtrDefault>::GlibType>, 
[src]

impl<'a, T> ToGlibContainerFromSlice<'a, *const GPtrArray> for T where
    T: GlibPtrDefault + ToGlibPtr<'a, <T as GlibPtrDefault>::GlibType>, 
[src]

impl<'a, T> ToGlibContainerFromSlice<'a, *mut GArray> for T where
    T: GlibPtrDefault + ToGlibPtr<'a, <T as GlibPtrDefault>::GlibType>, 
[src]

impl<'a, T> ToGlibContainerFromSlice<'a, *mut GList> for T where
    T: GlibPtrDefault + ToGlibPtr<'a, <T as GlibPtrDefault>::GlibType>, 
[src]

impl<'a, T> ToGlibContainerFromSlice<'a, *mut GPtrArray> for T where
    T: GlibPtrDefault + ToGlibPtr<'a, <T as GlibPtrDefault>::GlibType>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T> ToValue for T where
    T: SetValue + ?Sized
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.