Trait gstreamer_editing_services::prelude::TimelineExt[][src]

pub trait TimelineExt: 'static {
Show methods fn add_layer<P: IsA<Layer>>(&self, layer: &P) -> Result<(), BoolError>;
fn add_track<P: IsA<Track>>(&self, track: &P) -> Result<(), BoolError>;
fn append_layer(&self) -> Layer;
fn commit(&self) -> bool;
fn commit_sync(&self) -> bool;
fn is_auto_transition(&self) -> bool;
fn duration(&self) -> ClockTime;
fn element(&self, name: &str) -> Option<TimelineElement>;
fn frame_at(&self, timestamp: ClockTime) -> FrameNumber;
fn frame_time(&self, frame_number: FrameNumber) -> ClockTime;
fn groups(&self) -> Vec<Group>;
fn layer(&self, priority: u32) -> Option<Layer>;
fn layers(&self) -> Vec<Layer>;
fn pad_for_track<P: IsA<Track>>(&self, track: &P) -> Option<Pad>;
fn snapping_distance(&self) -> ClockTime;
fn track_for_pad<P: IsA<Pad>>(&self, pad: &P) -> Option<Track>;
fn tracks(&self) -> Vec<Track>;
fn is_empty(&self) -> bool;
fn load_from_uri(&self, uri: &str) -> Result<(), Error>;
fn move_layer<P: IsA<Layer>>(
        &self,
        layer: &P,
        new_layer_priority: u32
    ) -> Result<(), BoolError>;
fn paste_element<P: IsA<TimelineElement>>(
        &self,
        element: &P,
        position: ClockTime,
        layer_priority: i32
    ) -> Option<TimelineElement>;
fn remove_layer<P: IsA<Layer>>(&self, layer: &P) -> Result<(), BoolError>;
fn remove_track<P: IsA<Track>>(&self, track: &P) -> Result<(), BoolError>;
fn save_to_uri<P: IsA<Asset>>(
        &self,
        uri: &str,
        formatter_asset: Option<&P>,
        overwrite: bool
    ) -> Result<(), Error>;
fn set_auto_transition(&self, auto_transition: bool);
fn set_snapping_distance(&self, snapping_distance: ClockTime);
fn connect_commited<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId;
fn connect_group_added<F: Fn(&Self, &Group) + 'static>(
        &self,
        f: F
    ) -> SignalHandlerId;
fn connect_layer_added<F: Fn(&Self, &Layer) + 'static>(
        &self,
        f: F
    ) -> SignalHandlerId;
fn connect_layer_removed<F: Fn(&Self, &Layer) + 'static>(
        &self,
        f: F
    ) -> SignalHandlerId;
fn connect_select_element_track<F: Fn(&Self, &Clip, &TrackElement) -> Track + 'static>(
        &self,
        f: F
    ) -> SignalHandlerId;
fn connect_snapping_ended<F: Fn(&Self, &TrackElement, &TrackElement, u64) + 'static>(
        &self,
        f: F
    ) -> SignalHandlerId;
fn connect_snapping_started<F: Fn(&Self, &TrackElement, &TrackElement, u64) + 'static>(
        &self,
        f: F
    ) -> SignalHandlerId;
fn connect_track_added<F: Fn(&Self, &Track) + 'static>(
        &self,
        f: F
    ) -> SignalHandlerId;
fn connect_track_removed<F: Fn(&Self, &Track) + 'static>(
        &self,
        f: F
    ) -> SignalHandlerId;
fn connect_auto_transition_notify<F: Fn(&Self) + 'static>(
        &self,
        f: F
    ) -> SignalHandlerId;
fn connect_duration_notify<F: Fn(&Self) + 'static>(
        &self,
        f: F
    ) -> SignalHandlerId;
fn connect_snapping_distance_notify<F: Fn(&Self) + 'static>(
        &self,
        f: F
    ) -> SignalHandlerId;
}

Trait containing all Timeline methods.

Implementors

crate::Timeline

Required methods

fn add_layer<P: IsA<Layer>>(&self, layer: &P) -> Result<(), BoolError>[src]

👎 Deprecated:

Since 1.18

Add a layer to the timeline.

If the layer contains crate::Clip-s, then this may trigger the creation of their core track element children for the timeline’s tracks, and the placement of the clip’s children in the tracks of the timeline using [crate::Timeline::select-tracks-for-object]. Some errors may occur if this would break one of the configuration rules of the timeline in one of its tracks. In such cases, some track elements would fail to be added to their tracks, but this method would still return true. As such, it is advised that you only add clips to layers that already part of a timeline. In such situations, crate::prelude::LayerExt::add_clip() is able to fail if adding the clip would cause such an error.

Deprecated since 1.18

This method requires you to ensure the layer’s [crate::Layer:priority] will be unique to the timeline. Use Self::append_layer() and Self::move_layer() instead.

layer

The layer to add

Returns

true if layer was properly added.

fn add_track<P: IsA<Track>>(&self, track: &P) -> Result<(), BoolError>[src]

Add a track to the timeline.

If the timeline already contains clips, then this may trigger the creation of their core track element children for the track, and the placement of the clip’s children in the track of the timeline using [crate::Timeline::select-tracks-for-object]. Some errors may occur if this would break one of the configuration rules for the timeline in the track. In such cases, some track elements would fail to be added to the track, but this method would still return true. As such, it is advised that you avoid adding tracks to timelines that already contain clips.

track

The track to add

Returns

true if track was properly added.

fn append_layer(&self) -> Layer[src]

Append a newly created layer to the timeline. The layer will be added at the lowest [crate::Layer:priority] (numerically, the highest).

Returns

The newly created layer.

fn commit(&self) -> bool[src]

Commit all the pending changes of the clips contained in the timeline.

When changes happen in a timeline, they are not immediately executed internally, in a way that effects the output data of the timeline. You should call this method when you are done with a set of changes and you want them to be executed.

Any pending changes will be executed in the backend. The [crate::Timeline::commited] signal will be emitted once this has completed. You should not try to change the state of the timeline, seek it or add tracks to it before receiving this signal. You can use Self::commit_sync() if you do not want to perform other tasks in the mean time.

Note that all the pending changes will automatically be executed when the timeline goes from crate::gst::State::Ready to crate::gst::State::Paused, which is usually triggered by a corresponding state changes in a containing crate::Pipeline.

Returns

true if pending changes were committed, or false if nothing needed to be committed.

fn commit_sync(&self) -> bool[src]

Commit all the pending changes of the clips contained in the timeline and wait for the changes to complete.

See Self::commit().

Returns

true if pending changes were committed, or false if nothing needed to be committed.

fn is_auto_transition(&self) -> bool[src]

Gets [crate::Timeline:auto-transition] for the timeline.

Returns

The auto-transition of self_.

fn duration(&self) -> ClockTime[src]

Get the current [crate::Timeline:duration] of the timeline

Returns

The current duration of self.

fn element(&self, name: &str) -> Option<TimelineElement>[src]

Gets the element contained in the timeline with the given name.

name

The name of the element to find

Returns

The timeline element in self with the given name, or None if it was not found.

fn frame_at(&self, timestamp: ClockTime) -> FrameNumber[src]

This is supported on crate feature v1_18 only.

This method allows you to convert a timeline crate::gst::ClockTime into its corresponding crate::FrameNumber in the timeline’s output.

timestamp

The timestamp to get the corresponding frame number of

Returns

The frame number timestamp corresponds to.

fn frame_time(&self, frame_number: FrameNumber) -> ClockTime[src]

This is supported on crate feature v1_18 only.

This method allows you to convert a timeline output frame number into a timeline crate::gst::ClockTime. For example, this time could be used to seek to a particular frame in the timeline’s output, or as the edit position for an element within the timeline.

frame_number

The frame number to get the corresponding timestamp of in the timeline coordinates

Returns

The timestamp corresponding to frame_number in the output of self.

fn groups(&self) -> Vec<Group>[src]

Get the list of crate::Group-s present in the timeline.

Returns

The list of groups that contain clips present in self’s layers. Must not be changed.

fn layer(&self, priority: u32) -> Option<Layer>[src]

Retrieve the layer whose index in the timeline matches the given priority.

priority

The priority/index of the layer to find

Returns

The layer with the given priority, or None if none was found.

Since 1.6

fn layers(&self) -> Vec<Layer>[src]

Get the list of crate::Layer-s present in the timeline.

Returns

The list of layers present in self sorted by priority.

fn pad_for_track<P: IsA<Track>>(&self, track: &P) -> Option<Pad>[src]

Search for the crate::gst::Pad corresponding to the given timeline’s track. You can link to this pad to receive the output data of the given track.

track

A track

Returns

The pad corresponding to track, or None if there is an error.

fn snapping_distance(&self) -> ClockTime[src]

Gets the [crate::Timeline:snapping-distance] for the timeline.

Returns

The snapping distance (in nanoseconds) of self.

fn track_for_pad<P: IsA<Pad>>(&self, pad: &P) -> Option<Track>[src]

Search for the crate::Track corresponding to the given timeline’s pad.

pad

A pad

Returns

The track corresponding to pad, or None if there is an error.

fn tracks(&self) -> Vec<Track>[src]

Get the list of crate::Track-s used by the timeline.

Returns

The list of tracks used by self.

fn is_empty(&self) -> bool[src]

Check whether the timeline is empty or not.

Returns

true if self is empty.

fn load_from_uri(&self, uri: &str) -> Result<(), Error>[src]

Loads the contents of URI into the timeline.

uri

The URI to load from

Returns

true if the timeline was loaded successfully from uri.

fn move_layer<P: IsA<Layer>>(
    &self,
    layer: &P,
    new_layer_priority: u32
) -> Result<(), BoolError>
[src]

This is supported on crate feature v1_16 only.

Moves a layer within the timeline to the index given by new_layer_priority. An index of 0 corresponds to the layer with the highest priority in a timeline. If new_layer_priority is greater than the number of layers present in the timeline, it will become the lowest priority layer.

layer

A layer within self, whose priority should be changed

new_layer_priority

The new index for layer

fn paste_element<P: IsA<TimelineElement>>(
    &self,
    element: &P,
    position: ClockTime,
    layer_priority: i32
) -> Option<TimelineElement>
[src]

Paste an element inside the timeline. element must be the return of crate::prelude::TimelineElementExt::copy() with deep=TRUE, and it should not be changed before pasting. element itself is not placed in the timeline, instead a new element is created, alike to the originally copied element. Note that the originally copied element must also lie within self, at both the point of copying and pasting.

Pasting may fail if it would place the timeline in an unsupported configuration.

After calling this function element should not be used. In particular, element can not be pasted again. Instead, you can copy the returned element and paste that copy (although, this is only possible if the paste was successful).

See also crate::prelude::TimelineElementExt::paste().

element

The element to paste

position

The position in the timeline element should be pasted to, i.e. the [crate::TimelineElement:start] value for the pasted element.

layer_priority

The layer into which the element should be pasted. -1 means paste to the same layer from which element has been copied from

Returns

The newly created element, or None if pasting fails.

fn remove_layer<P: IsA<Layer>>(&self, layer: &P) -> Result<(), BoolError>[src]

Removes a layer from the timeline.

layer

The layer to remove

Returns

true if layer was properly removed.

fn remove_track<P: IsA<Track>>(&self, track: &P) -> Result<(), BoolError>[src]

Remove a track from the timeline.

track

The track to remove

Returns

true if track was properly removed.

fn save_to_uri<P: IsA<Asset>>(
    &self,
    uri: &str,
    formatter_asset: Option<&P>,
    overwrite: bool
) -> Result<(), Error>
[src]

Saves the timeline to the given location. If formatter_asset is None, the method will attempt to save in the same format the timeline was loaded from, before defaulting to the formatter with highest rank.

uri

The location to save to

formatter_asset

The formatter asset to use, or None

overwrite

true to overwrite file if it exists

Returns

true if self was successfully saved to uri.

fn set_auto_transition(&self, auto_transition: bool)[src]

Sets [crate::Timeline:auto-transition] for the timeline. This will also set the corresponding [crate::Layer:auto-transition] for all of the timeline’s layers to the same value. See crate::prelude::LayerExt::set_auto_transition() if you wish to set the layer’s [crate::Layer:auto-transition] individually.

auto_transition

Whether transitions should be automatically added to self’s layers

fn set_snapping_distance(&self, snapping_distance: ClockTime)[src]

Sets [crate::Timeline:snapping-distance] for the timeline. This new value will only effect future snappings and will not be used to snap the current element positions within the timeline.

snapping_distance

The snapping distance to use (in nanoseconds)

fn connect_commited<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId[src]

This signal will be emitted once the changes initiated by Self::commit() have been executed in the backend. Use Self::commit_sync() if you do not want to have to connect to this signal.

fn connect_group_added<F: Fn(&Self, &Group) + 'static>(
    &self,
    f: F
) -> SignalHandlerId
[src]

Will be emitted after the group is added to to the timeline. This can happen when grouping with ges_container_group, or by adding containers to a newly created group.

Note that this should not be emitted whilst a timeline is being loaded from its crate::Project asset. You should connect to the project’s [crate::Project::loaded] signal if you want to know which groups were created for the timeline.

group

The group that was added to timeline

fn connect_layer_added<F: Fn(&Self, &Layer) + 'static>(
    &self,
    f: F
) -> SignalHandlerId
[src]

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

Note that this should not be emitted whilst a timeline is being loaded from its crate::Project asset. You should connect to the project’s [crate::Project::loaded] signal if you want to know which layers were created for the timeline.

layer

The layer that was added to timeline

fn connect_layer_removed<F: Fn(&Self, &Layer) + 'static>(
    &self,
    f: F
) -> SignalHandlerId
[src]

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

layer

The layer that was removed from timeline

fn connect_select_element_track<F: Fn(&Self, &Clip, &TrackElement) -> Track + 'static>(
    &self,
    f: F
) -> SignalHandlerId
[src]

This is supported on crate feature v1_18 only.

Simplified version of [crate::Timeline::select-tracks-for-object] which only allows track_element to be added to a single crate::Track.

clip

The clip that track_element is being added to

track_element

The element being added

Returns

A track to put track_element into, or None if it should be discarded.

fn connect_snapping_ended<F: Fn(&Self, &TrackElement, &TrackElement, u64) + 'static>(
    &self,
    f: F
) -> SignalHandlerId
[src]

Will be emitted whenever a snapping event ends. After a snap event has started (see [crate::Timeline::snapping-started]), it can later end because either another timeline edit has occurred (which may or may not have created a new snapping event), or because the timeline has been committed.

obj1

The first element that was snapping

obj2

The second element that was snapping

position

The position where the two objects were to be snapped to

fn connect_snapping_started<F: Fn(&Self, &TrackElement, &TrackElement, u64) + 'static>(
    &self,
    f: F
) -> SignalHandlerId
[src]

Will be emitted whenever an element’s movement invokes a snapping event during an edit (usually of one of its ancestors) because its start or end point lies within the [crate::Timeline:snapping-distance] of another element’s start or end point.

See crate::EditMode to see what can snap during an edit.

Note that only up to one snapping-started signal will be emitted per element edit within a timeline.

obj1

The first element that is snapping

obj2

The second element that is snapping

position

The position where the two objects will snap to

fn connect_track_added<F: Fn(&Self, &Track) + 'static>(
    &self,
    f: F
) -> SignalHandlerId
[src]

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

Note that this should not be emitted whilst a timeline is being loaded from its crate::Project asset. You should connect to the project’s [crate::Project::loaded] signal if you want to know which tracks were created for the timeline.

track

The track that was added to timeline

fn connect_track_removed<F: Fn(&Self, &Track) + 'static>(
    &self,
    f: F
) -> SignalHandlerId
[src]

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

track

The track that was removed from timeline

fn connect_auto_transition_notify<F: Fn(&Self) + 'static>(
    &self,
    f: F
) -> SignalHandlerId
[src]

fn connect_duration_notify<F: Fn(&Self) + 'static>(
    &self,
    f: F
) -> SignalHandlerId
[src]

fn connect_snapping_distance_notify<F: Fn(&Self) + 'static>(
    &self,
    f: F
) -> SignalHandlerId
[src]

Loading content...

Implementors

impl<O: IsA<Timeline>> TimelineExt for O[src]

fn add_layer<P: IsA<Layer>>(&self, layer: &P) -> Result<(), BoolError>[src]

👎 Deprecated:

Since 1.18

fn add_track<P: IsA<Track>>(&self, track: &P) -> Result<(), BoolError>[src]

fn append_layer(&self) -> Layer[src]

fn commit(&self) -> bool[src]

fn commit_sync(&self) -> bool[src]

fn is_auto_transition(&self) -> bool[src]

fn duration(&self) -> ClockTime[src]

fn element(&self, name: &str) -> Option<TimelineElement>[src]

fn frame_at(&self, timestamp: ClockTime) -> FrameNumber[src]

This is supported on crate feature v1_18 only.

fn frame_time(&self, frame_number: FrameNumber) -> ClockTime[src]

This is supported on crate feature v1_18 only.

fn groups(&self) -> Vec<Group>[src]

fn layer(&self, priority: u32) -> Option<Layer>[src]

fn layers(&self) -> Vec<Layer>[src]

fn pad_for_track<P: IsA<Track>>(&self, track: &P) -> Option<Pad>[src]

fn snapping_distance(&self) -> ClockTime[src]

fn track_for_pad<P: IsA<Pad>>(&self, pad: &P) -> Option<Track>[src]

fn tracks(&self) -> Vec<Track>[src]

fn is_empty(&self) -> bool[src]

fn load_from_uri(&self, uri: &str) -> Result<(), Error>[src]

fn move_layer<P: IsA<Layer>>(
    &self,
    layer: &P,
    new_layer_priority: u32
) -> Result<(), BoolError>
[src]

This is supported on crate feature v1_16 only.

fn paste_element<P: IsA<TimelineElement>>(
    &self,
    element: &P,
    position: ClockTime,
    layer_priority: i32
) -> Option<TimelineElement>
[src]

fn remove_layer<P: IsA<Layer>>(&self, layer: &P) -> Result<(), BoolError>[src]

fn remove_track<P: IsA<Track>>(&self, track: &P) -> Result<(), BoolError>[src]

fn save_to_uri<P: IsA<Asset>>(
    &self,
    uri: &str,
    formatter_asset: Option<&P>,
    overwrite: bool
) -> Result<(), Error>
[src]

fn set_auto_transition(&self, auto_transition: bool)[src]

fn set_snapping_distance(&self, snapping_distance: ClockTime)[src]

fn connect_commited<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId[src]

fn connect_group_added<F: Fn(&Self, &Group) + 'static>(
    &self,
    f: F
) -> SignalHandlerId
[src]

fn connect_layer_added<F: Fn(&Self, &Layer) + 'static>(
    &self,
    f: F
) -> SignalHandlerId
[src]

fn connect_layer_removed<F: Fn(&Self, &Layer) + 'static>(
    &self,
    f: F
) -> SignalHandlerId
[src]

fn connect_select_element_track<F: Fn(&Self, &Clip, &TrackElement) -> Track + 'static>(
    &self,
    f: F
) -> SignalHandlerId
[src]

This is supported on crate feature v1_18 only.

fn connect_snapping_ended<F: Fn(&Self, &TrackElement, &TrackElement, u64) + 'static>(
    &self,
    f: F
) -> SignalHandlerId
[src]

fn connect_snapping_started<F: Fn(&Self, &TrackElement, &TrackElement, u64) + 'static>(
    &self,
    f: F
) -> SignalHandlerId
[src]

fn connect_track_added<F: Fn(&Self, &Track) + 'static>(
    &self,
    f: F
) -> SignalHandlerId
[src]

fn connect_track_removed<F: Fn(&Self, &Track) + 'static>(
    &self,
    f: F
) -> SignalHandlerId
[src]

fn connect_auto_transition_notify<F: Fn(&Self) + 'static>(
    &self,
    f: F
) -> SignalHandlerId
[src]

fn connect_duration_notify<F: Fn(&Self) + 'static>(
    &self,
    f: F
) -> SignalHandlerId
[src]

fn connect_snapping_distance_notify<F: Fn(&Self) + 'static>(
    &self,
    f: F
) -> SignalHandlerId
[src]

Loading content...