Enum gstreamer_editing_services::EditMode

source ·
#[non_exhaustive]
pub enum EditMode { Normal, Ripple, Roll, Trim, Slide, }
Expand description

When a single timeline element is edited within its timeline at some position, using TimelineElementExt::edit(), depending on the edit mode, its start, duration or in-point will be adjusted accordingly. In addition, any clips may change layer.

Each edit can be broken down into a combination of three basic edits:

  • MOVE: This moves the start of the element to the edit position.
  • START-TRIM: This cuts or grows the start of the element, whilst maintaining the time at which its internal content appears in the timeline data output. If the element is made shorter, the data that appeared at the edit position will still appear in the timeline at the same time. If the element is made longer, the data that appeared at the previous start of the element will still appear in the timeline at the same time.
  • END-TRIM: Similar to START-TRIM, but the end of the element is cut or grown.

In particular, when editing a Clip:

  • MOVE: This will set the start of the clip to the edit position.
  • START-TRIM: This will set the start of the clip to the edit position. To keep the end time the same, the duration of the clip will be adjusted in the opposite direction. In addition, the in-point of the clip will be shifted such that the content that appeared at the new or previous start time, whichever is latest, still appears at the same timeline time. For example, if a frame appeared at the start of the clip, and the start of the clip is reduced, the in-point of the clip will also reduce such that the frame will appear later within the clip, but at the same timeline position.
  • END-TRIM: This will set the duration of the clip such that its end time will match the edit position.

When editing a Group:

  • MOVE: This will set the start of the clip to the edit position by shifting all of its children by the same amount. So each child will maintain their relative positions.
  • START-TRIM: If the group is made shorter, this will START-TRIM any clips under the group that start after the edit position to the same edit position. If the group is made longer, this will START-TRIM any clip under the group whose start matches the start of the group to the same edit position.
  • END-TRIM: If the group is made shorter, this will END-TRIM any clips under the group that end after the edit position to the same edit position. If the group is made longer, this will END-TRIM any clip under the group whose end matches the end of the group to the same edit position.

When editing a TrackElement, if it has a Clip parent, this will be edited instead. Otherwise it is edited in the same way as a Clip.

The layer priority of a Group is the lowest layer priority of any Clip underneath it. When a group is edited to a new layer priority, it will shift all clips underneath it by the same amount, such that their relative layers stay the same.

If the Timeline has a snapping-distance, then snapping may occur for some of the edges of the main edited element:

  • MOVE: The start or end edge of any Source under the element may be snapped.
  • START-TRIM: The start edge of a Source whose start edge touches the start edge of the element may snap.
  • END-TRIM: The end edge of a Source whose end edge touches the end edge of the element may snap.

These edges may snap with either the start or end edge of any other Source in the timeline that is not also being moved by the element, including those in different layers, if they are within the snapping-distance. During an edit, only up to one snap can occur. This will shift the edit position such that the snapped edges will touch once the edit has completed.

Note that snapping can cause an edit to fail where it would have otherwise succeeded because it may push the edit position such that the edit would result in an unsupported timeline configuration. Similarly, snapping can cause an edit to succeed where it would have otherwise failed.

For example, in Ripple acting on Edge::None, the main element is the MOVED toplevel of the edited element. Any source under the main MOVED toplevel may have its start or end edge snapped. Note, these sources cannot snap with each other. The edit may also push other elements, but any sources under these elements cannot snap, nor can they be snapped with. If a snap does occur, the MOVE of the toplevel and all other elements pushed by the ripple will be shifted by the same amount such that the snapped edges will touch.

You can also find more explanation about the behaviour of those modes at: trim, ripple and roll and clip management.

Variants (Non-exhaustive)§

This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
§

Normal

The element is edited the normal way (default). If acting on the element as a whole (Edge::None), this will MOVE the element by MOVING its toplevel. When acting on the start of the element (Edge::Start), this will only MOVE the element, but not its toplevel parent. This can allow you to move a Clip or Group to a new start time or layer within its container group, without effecting other members of the group. When acting on the end of the element (Edge::End), this will END-TRIM the element, leaving its toplevel unchanged.

§

Ripple

The element is edited in ripple mode: moving itself as well as later elements, keeping their relative times. This edits the element the same as Normal. In addition, if acting on the element as a whole, or the start of the element, any toplevel element in the same timeline (including different layers) whose start time is later than the current start time of the MOVED element will also be MOVED by the same shift as the edited element. If acting on the end of the element, any toplevel element whose start time is later than the current end time of the edited element will also be MOVED by the same shift as the change in the end of the edited element. These additional elements will also be shifted by the same shift in layers as the edited element.

§

Roll

The element is edited in roll mode: swapping its content for its neighbour’s, or vis versa, in the timeline output. This edits the element the same as Trim. In addition, any neighbours are also TRIMMED at their opposite edge to the same timeline position. When acting on the start of the element, a neighbour is any earlier element in the timeline whose end time matches the current start time of the edited element. When acting on the end of the element, a neighbour is any later element in the timeline whose start time matches the current start time of the edited element. In addition, a neighbour have a Source at its end/start edge that shares a track with a Source at the start/end edge of the edited element. Basically, a neighbour is an element that can be extended, or cut, to have its content replace, or be replaced by, the content of the edited element. Acting on the element as a whole (Edge::None) is not defined. The element can not shift layers under this mode.

§

Trim

The element is edited in trim mode. When acting on the start of the element, this will START-TRIM it. When acting on the end of the element, this will END-TRIM it. Acting on the element as a whole (Edge::None) is not defined.

§

Slide

The element is edited in slide mode (not yet implemented): moving the element replacing or consuming content on each end. When acting on the element as a whole, this will MOVE the element, and TRIM any neighbours on either side. A neighbour is defined in the same way as in Roll, but they may be on either side of the edited elements. Elements at the end with be START-TRIMMED to the new end position of the edited element. Elements at the start will be END-TRIMMED to the new start position of the edited element. Acting on the start or end of the element (Edge::Start and Edge::End) is not defined. The element can not shift layers under this mode.

Implementations§

source§

impl EditMode

source

pub fn name<'a>(self) -> &'a GStr

Trait Implementations§

source§

impl Clone for EditMode

source§

fn clone(&self) -> EditMode

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for EditMode

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl Display for EditMode

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl From<EditMode> for Value

source§

fn from(v: EditMode) -> Self

Converts to this type from the input type.
source§

impl<'a> FromValue<'a> for EditMode

§

type Checker = GenericValueTypeChecker<EditMode>

Value type checker.
source§

unsafe fn from_value(value: &'a Value) -> Self

Get the contained value from a Value. Read more
source§

impl HasParamSpec for EditMode

§

type ParamSpec = ParamSpecEnum

§

type SetValue = EditMode

Preferred value to be used as setter for the associated ParamSpec.
§

type BuilderFn = fn(_: &str, _: EditMode) -> ParamSpecEnumBuilder<'_, EditMode>

source§

fn param_spec_builder() -> Self::BuilderFn

source§

impl Hash for EditMode

source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
source§

impl Ord for EditMode

source§

fn cmp(&self, other: &EditMode) -> Ordering

This method returns an Ordering between self and other. Read more
1.21.0 · source§

fn max(self, other: Self) -> Self
where Self: Sized,

Compares and returns the maximum of two values. Read more
1.21.0 · source§

fn min(self, other: Self) -> Self
where Self: Sized,

Compares and returns the minimum of two values. Read more
1.50.0 · source§

fn clamp(self, min: Self, max: Self) -> Self
where Self: Sized + PartialOrd,

Restrict a value to a certain interval. Read more
source§

impl PartialEq for EditMode

source§

fn eq(&self, other: &EditMode) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl PartialOrd for EditMode

source§

fn partial_cmp(&self, other: &EditMode) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · source§

fn lt(&self, other: &Rhs) -> bool

This method tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · source§

fn le(&self, other: &Rhs) -> bool

This method tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 · source§

fn gt(&self, other: &Rhs) -> bool

This method tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · source§

fn ge(&self, other: &Rhs) -> bool

This method tests greater than or equal to (for self and other) and is used by the >= operator. Read more
source§

impl StaticType for EditMode

source§

fn static_type() -> Type

Returns the type identifier of Self.
source§

impl ToValue for EditMode

source§

fn to_value(&self) -> Value

Convert a value to a Value.
source§

fn value_type(&self) -> Type

Returns the type identifier of self. Read more
source§

impl ValueType for EditMode

§

type Type = EditMode

Type to get the Type from. Read more
source§

impl Copy for EditMode

source§

impl Eq for EditMode

source§

impl StructuralPartialEq for EditMode

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> CloneToUninit for T
where T: Copy,

source§

unsafe fn clone_to_uninit(&self, dst: *mut T)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. Read more
source§

impl<T> CloneToUninit for T
where T: Clone,

source§

default unsafe fn clone_to_uninit(&self, dst: *mut T)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> IntoClosureReturnValue for T
where T: Into<Value>,

source§

impl<T> IntoEither for T

source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
source§

impl<T> Property for T
where T: HasParamSpec,

§

type Value = T

source§

impl<T> PropertyGet for T
where T: HasParamSpec,

§

type Value = T

source§

fn get<R, F>(&self, f: F) -> R
where F: Fn(&<T as PropertyGet>::Value) -> R,

source§

impl<T> StaticTypeExt for T
where T: StaticType,

source§

fn ensure_type()

Ensures that the type has been registered with the type system.
source§

impl<T> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T> ToSendValue for T
where T: Send + ToValue + ?Sized,

source§

fn to_send_value(&self) -> SendValue

Returns a SendValue clone of self.
source§

impl<T> ToString for T
where T: Display + ?Sized,

source§

default fn to_string(&self) -> String

Converts the given value to a String. Read more
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T> TryFromClosureReturnValue for T
where T: for<'a> FromValue<'a> + StaticType + 'static,

source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

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

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.