GES.Layer

g GES.Extractable GES.Extractable GES.Layer GES.Layer GES.Extractable->GES.Layer GES.MetaContainer GES.MetaContainer GES.MetaContainer->GES.Layer GObject.GInterface GObject.GInterface GObject.GInterface->GES.Extractable GObject.GInterface->GES.MetaContainer GObject.InitiallyUnowned GObject.InitiallyUnowned GObject.InitiallyUnowned->GES.Layer GObject.Object GObject.Object GObject.Object->GObject.InitiallyUnowned

Subclasses

None

Methods

Inherited

GObject.Object (37), GES.Extractable (3), GES.MetaContainer (40)

Structs

GObject.ObjectClass (5)

class

new ()

add_asset (asset, start, inpoint, duration, track_types)

add_asset_full (asset, start, inpoint, duration, track_types)

add_clip (clip)

add_clip_full (clip)

get_active_for_track (track)

get_auto_transition ()

get_clips ()

get_clips_in_interval (start, end)

get_duration ()

get_priority ()

get_timeline ()

is_empty ()

remove_clip (clip)

set_active_for_tracks (active, tracks)

set_auto_transition (auto_transition)

set_priority (priority)

set_timeline (timeline)

Virtual Methods

Inherited

GObject.Object (7), GES.Extractable (3)

do_object_added (object)

do_object_removed (object)

Properties

Name

Type

Flags

Short Description

auto-transition

bool

r/w

whether the transitions are added

priority

int

r/w

The priority of the layer deprecated

Signals

Inherited

GObject.Object (1), GES.MetaContainer (1)

Name

Short Description

active-changed

Will be emitted whenever the layer is activated or deactivated for some GES.Track.

clip-added

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

clip-removed

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

Fields

Inherited

GObject.Object (1), GES.MetaContainer (1)

Name

Type

Access

Description

max_nle_priority

int

r

min_nle_priority

int

r

parent

GObject.InitiallyUnowned

r

timeline

GES.Timeline

r

the GES.Timeline where this layer is being used.

Class Details

class GES.Layer(**kwargs)
Bases

GObject.InitiallyUnowned, GES.Extractable, GES.MetaContainer

Abstract

No

Structure

GES.LayerClass

GES.Layer-s are responsible for collecting and ordering GES.Clip-s.

A layer within a timeline will have an associated priority, corresponding to their index within the timeline. A layer with the index/priority 0 will have the highest priority and the layer with the largest index will have the lowest priority (the order of priorities, in this sense, is the _reverse_ of the numerical ordering of the indices). GES.Timeline.move_layer() should be used if you wish to change how layers are prioritised in a timeline.

Layers with higher priorities will have their content priorities over content from lower priority layers, similar to how layers are used in image editing. For example, if two separate layers both display video content, then the layer with the higher priority will have its images shown first. The other layer will only have its image shown if the higher priority layer has no content at the given playtime, or is transparent in some way. Audio content in separate layers will simply play in addition.

classmethod new()[source]
Returns

A new layer.

Return type

GES.Layer

Creates a new layer.

add_asset(asset, start, inpoint, duration, track_types)[source]
Parameters
Returns

The newly created clip.

Return type

GES.Clip or None

See GES.Layer.add_asset_full(), which also gives an error.

add_asset_full(asset, start, inpoint, duration, track_types)[source]
Parameters
Raises

GLib.Error

Returns

The newly created clip.

Return type

GES.Clip

Extracts a new clip from an asset and adds it to the layer with the given properties.

New in version 1.18.

add_clip(clip)[source]
Parameters

clip (GES.Clip) – The clip to add

Returns

True if clip was properly added to self, or False if self refused to add clip.

Return type

bool

See GES.Layer.add_clip_full(), which also gives an error.

add_clip_full(clip)[source]
Parameters

clip (GES.Clip) – The clip to add

Raises

GLib.Error

Returns

True if clip was properly added to self, or False if self refused to add clip.

Return type

bool

Adds the given clip to the layer. If the method succeeds, the layer will take ownership of the clip.

This method will fail and return False if clip already resides in some layer. It can also fail if the additional clip breaks some compositional rules (see GES.TimelineElement).

New in version 1.18.

get_active_for_track(track)[source]
Parameters

track (GES.Track) – The GES.Track to check if self is currently active for

Returns

True if self is active for track, or False otherwise.

Return type

bool

Gets whether the layer is active for the given track. See GES.Layer.set_active_for_tracks().

New in version 1.18.

get_auto_transition()[source]
Returns

True if transitions are automatically added to self.

Return type

bool

Gets the GES.Layer :auto-transition of the layer.

get_clips()[source]
Returns

A list of clips in self.

Return type

[GES.Clip]

Get the GES.Clip-s contained in this layer.

get_clips_in_interval(start, end)[source]
Parameters
  • start (int) – Start of the interval

  • end (int) – End of the interval

Returns

A list of GES.Clip-s that intersect the interval [start, end) in self.

Return type

[GES.Clip]

Gets the clips within the layer that appear between start and end.

get_duration()[source]
Returns

The duration of self.

Return type

int

Retrieves the duration of the layer, which is the difference between the start of the layer (always time 0) and the end (which will be the end time of the final clip).

get_priority()[source]
Returns

The priority of self within its timeline.

Return type

int

Get the priority of the layer. When inside a timeline, this is its index in the timeline. See GES.Timeline.move_layer().

get_timeline()[source]
Returns

The timeline that self is currently part of, or None if it is not associated with any timeline.

Return type

GES.Timeline or None

Gets the timeline that the layer is a part of.

is_empty()[source]
Returns

True if self is empty, False if it contains at least one clip.

Return type

bool

Convenience method to check if the layer is empty (doesn’t contain any GES.Clip), or not.

remove_clip(clip)[source]
Parameters

clip (GES.Clip) – The clip to remove

Returns

True if clip was removed from self, or False if the operation failed.

Return type

bool

Removes the given clip from the layer.

set_active_for_tracks(active, tracks)[source]
Parameters
  • active (bool) – Whether elements in tracks should be active or not

  • tracks ([GES.Track] or None) – The list of tracks self should be (de-)active in, or None to include all the tracks in the self's timeline

Returns

True if the operation worked False otherwise.

Return type

bool

Activate or deactivate track elements in tracks (or in all tracks if tracks is None).

When a layer is deactivated for a track, all the GES.TrackElement-s in the track that belong to a GES.Clip in the layer will no longer be active in the track, regardless of their individual GES.TrackElement :active value.

Note that by default a layer will be active for all of its timeline’s tracks.

New in version 1.18.

set_auto_transition(auto_transition)[source]
Parameters

auto_transition (bool) – Whether transitions should be automatically added to the layer

Sets GES.Layer :auto-transition for the layer. Use GES.Timeline.set_auto_transition() if you want all layers within a GES.Timeline to have GES.Layer :auto-transition set to True. Use this method if you want different values for different layers (and make sure to keep GES.Timeline :auto-transition as False for the corresponding timeline).

set_priority(priority)[source]
Parameters

priority (int) – The priority to set

Sets the layer to the given priority. See GES.Layer :priority.

Deprecated since version 1.16.0: use GES.Timeline.move_layer instead. This deprecation means that you will not need to handle layer priorities at all yourself, GES will make sure there is never ‘gaps’ between layer priorities.

set_timeline(timeline)[source]
Parameters

timeline (GES.Timeline) –

do_object_added(object) virtual
Parameters

object (GES.Clip) –

do_object_removed(object) virtual
Parameters

object (GES.Clip) –

Signal Details

GES.Layer.signals.active_changed(layer, active, tracks)
Signal Name

active-changed

Flags

RUN_FIRST

Parameters
  • layer (GES.Layer) – The object which received the signal

  • active (bool) – Whether layer has been made active or de-active in the tracks

  • tracks ([GES.Track]) – A list of GES.Track which have been activated or deactivated

Will be emitted whenever the layer is activated or deactivated for some GES.Track. See GES.Layer.set_active_for_tracks().

New in version 1.18.

GES.Layer.signals.clip_added(layer, clip)
Signal Name

clip-added

Flags

RUN_FIRST

Parameters
  • layer (GES.Layer) – The object which received the signal

  • clip (GES.Clip) – The clip that was added

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

GES.Layer.signals.clip_removed(layer, clip)
Signal Name

clip-removed

Flags

RUN_FIRST

Parameters
  • layer (GES.Layer) – The object which received the signal

  • clip (GES.Clip) – The clip that was removed

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

Property Details

GES.Layer.props.auto_transition
Name

auto-transition

Type

bool

Default Value

False

Flags

READABLE, WRITABLE

Whether to automatically create a GES.TransitionClip whenever two GES.Source-s that both belong to a GES.Clip in the layer overlap. See GES.Timeline for what counts as an overlap.

When a layer is added to a GES.Timeline, if this property is left as False, but the timeline’s GES.Timeline :auto-transition is True, it will be set to True as well.

GES.Layer.props.priority
Name

priority

Type

int

Default Value

0

Flags

READABLE, WRITABLE

The priority of the layer in the GES.Timeline. 0 is the highest priority. Conceptually, a timeline is a stack of layers, and the priority of the layer represents its position in the stack. Two layers should not have the same priority within a given GES.Timeline.

Note that the timeline needs to be committed (with GES.Timeline.commit) for the change to be taken into account.

Deprecated since version 1.16.0: use GES.Timeline.move_layer instead. This deprecation means that you will not need to handle layer priorities at all yourself, GES will make sure there is never ‘gaps’ between layer priorities.