GES.Track

g GES.MetaContainer GES.MetaContainer GES.Track GES.Track GES.MetaContainer->GES.Track GObject.GInterface GObject.GInterface GObject.GInterface->GES.MetaContainer Gst.ChildProxy Gst.ChildProxy GObject.GInterface->Gst.ChildProxy GObject.InitiallyUnowned GObject.InitiallyUnowned Gst.Object Gst.Object GObject.InitiallyUnowned->Gst.Object GObject.Object GObject.Object GObject.Object->GObject.InitiallyUnowned Gst.Bin Gst.Bin Gst.Bin->GES.Track Gst.ChildProxy->Gst.Bin Gst.Element Gst.Element Gst.Element->Gst.Bin Gst.Object->Gst.Element

Subclasses

GES.AudioTrack, GES.VideoTrack

Methods

Inherited

Gst.Bin (18), Gst.Element (81), Gst.Object (27), GObject.Object (37), Gst.ChildProxy (9), GES.MetaContainer (40)

Structs

Gst.ElementClass (10), GObject.ObjectClass (5)

class

new (type, caps)

add_element (object)

add_element_full (object)

commit ()

get_caps ()

get_elements ()

get_mixing ()

get_restriction_caps ()

get_timeline ()

remove_element (object)

remove_element_full (object)

set_mixing (mixing)

set_restriction_caps (caps)

set_timeline (timeline)

update_restriction_caps (caps)

Virtual Methods

Inherited

Gst.Bin (8), Gst.Element (16), Gst.Object (1), GObject.Object (7), Gst.ChildProxy (5)

Properties

Inherited

Gst.Bin (2), Gst.Object (2)

Name

Type

Flags

Short Description

caps

Gst.Caps

r/w/co

Caps used to choose the output stream

duration

int

r

The current duration of the track

id

str

r/w

The stream-id of the composition

mixing

bool

r/w/c/en

Whether layer mixing is activated on the track or not

restriction-caps

Gst.Caps

r/w

Caps used as a final filter on the output stream

track-type

GES.TrackType

r/w/co

Type of stream the track outputs

Signals

Inherited

Gst.Bin (5), Gst.Element (3), Gst.Object (1), GObject.Object (1), Gst.ChildProxy (2), GES.MetaContainer (1)

Name

Short Description

commited

This signal will be emitted once the changes initiated by GES.Track.commit() have been executed in the backend.

track-element-added

Will be emitted after a track element is added to the track.

track-element-removed

Will be emitted after a track element is removed from the track.

Fields

Inherited

Gst.Bin (5), Gst.Element (3), Gst.Object (1), GObject.Object (1), Gst.ChildProxy (2), GES.MetaContainer (1)

Name

Type

Access

Description

parent

Gst.Bin

r

type

GES.TrackType

r

The GES.Track :track-type of the track

Class Details

class GES.Track(**kwargs)
Bases

Gst.Bin, GES.MetaContainer

Abstract

No

Structure

GES.TrackClass

A GES.Track acts an output source for a GES.Timeline. Each one essentially provides an additional Gst.Pad for the timeline, with GES.Track :restriction-caps capabilities. Internally, a track wraps an #nlecomposition filtered by a #capsfilter.

A track will contain a number of GES.TrackElement-s, and its role is to select and activate these elements according to their timings when the timeline in played. For example, a track would activate a GES.Source when its GES.TimelineElement :start is reached by outputting its data for its GES.TimelineElement :duration. Similarly, a GES.Operation would be activated by applying its effect to the source data, starting from its GES.TimelineElement :start time and lasting for its GES.TimelineElement :duration.

For most users, it will usually be sufficient to add newly created tracks to a timeline, but never directly add an element to a track. Whenever a GES.Clip is added to a timeline, the clip adds its elements to the timeline’s tracks and assumes responsibility for updating them.

classmethod new(type, caps)[source]
Parameters
Returns

A new track.

Return type

GES.Track

Creates a new track with the given track-type and caps.

If type is GES.TrackType.VIDEO, and caps is a subset of “video/x-raw(ANY)”, then a GES.VideoTrack is created. This will automatically choose a gap creation method suitable for video data. You will likely want to set GES.Track :restriction-caps separately. You may prefer to use the GES.VideoTrack.new() method instead.

If type is GES.TrackType.AUDIO, and caps is a subset of “audio/x-raw(ANY)”, then a GES.AudioTrack is created. This will automatically choose a gap creation method suitable for audio data, and will set the GES.Track :restriction-caps to the default for GES.AudioTrack. You may prefer to use the GES.AudioTrack.new() method instead.

Otherwise, a plain GES.Track is returned. You will likely want to set the GES.Track :restriction-caps and call ges_track_set_create_element_for_gap_func() on the returned track.

add_element(object)[source]
Parameters

object (GES.TrackElement) – The element to add

Returns

True if object was successfully added to self.

Return type

bool

See GES.Track.add_element(), which also gives an error.

add_element_full(object)[source]
Parameters

object (GES.TrackElement) – The element to add

Raises

GLib.Error

Returns

True if object was successfully added to self.

Return type

bool

Adds the given track element to the track, which takes ownership of the element.

Note that this can fail if it would break a configuration rule of the track’s GES.Timeline.

Note that a GES.TrackElement can only be added to one track.

New in version 1.18.

commit()[source]
Returns

True if pending changes were committed, or False if nothing needed to be committed.

Return type

bool

Commits all the pending changes for the elements contained in the track.

When changes are made to the timing or priority of elements within a track, they are not directly executed for the underlying #nlecomposition and its children. This method will finally execute these changes so they are reflected in the data output of the track.

Any pending changes will be executed in the backend. The GES.Timeline ::commited signal will be emitted once this has completed.

Note that GES.Timeline.commit() will call this method on all of its tracks, so you are unlikely to need to use this directly.

get_caps()[source]
Returns

The caps of self.

Return type

Gst.Caps or None

Get the GES.Track :caps of the track.

get_elements()[source]
Returns

A list of all the GES.TrackElement-s in self.

Return type

[GES.TrackElement]

Gets the track elements contained in the track. The returned list is sorted by the element’s GES.TimelineElement :priority and GES.TimelineElement :start.

get_mixing()[source]
Returns

Whether self is mixing.

Return type

bool

Gets the GES.Track :mixing of the track.

get_restriction_caps()[source]
Returns

The restriction-caps of self.

Return type

Gst.Caps or None

Gets the GES.Track :restriction-caps of the track.

New in version 1.18.

get_timeline()[source]
Returns

The timeline that self belongs to, or None if it does not belong to a timeline.

Return type

GES.Timeline or None

Get the timeline this track belongs to.

remove_element(object)[source]
Parameters

object (GES.TrackElement) – The element to remove

Returns

True if object was successfully removed from self.

Return type

bool

See GES.Track.remove_element_full(), which also returns an error.

remove_element_full(object)[source]
Parameters

object (GES.TrackElement) – The element to remove

Raises

GLib.Error

Returns

True if object was successfully removed from self.

Return type

bool

Removes the given track element from the track, which revokes ownership of the element.

New in version 1.18.

set_mixing(mixing)[source]
Parameters

mixing (bool) – Whether self should be mixing

Sets the GES.Track :mixing for the track.

set_restriction_caps(caps)[source]
Parameters

caps (Gst.Caps) – The new restriction-caps for self

Sets the GES.Track :restriction-caps for the track.

**NOTE**: Restriction caps are **not** taken into account when using GES.Pipeline :mode=:obj:GES.PipelineFlags.SMART_RENDER.

set_timeline(timeline)[source]
Parameters

timeline (GES.Timeline) –

Informs the track that it belongs to the given timeline. Calling this does not actually add the track to the timeline. For that, you should use GES.Timeline.add_track(), which will also take care of informing the track that it belongs to the timeline. As such, there is no need for you to call this method.

update_restriction_caps(caps)[source]
Parameters

caps (Gst.Caps) – The caps to update the restriction-caps with

Updates the GES.Track :restriction-caps of the track using the fields found in the given caps. Each of the Gst.Structure-s in caps is compared against the existing structure with the same index in the current GES.Track :restriction-caps. If there is no corresponding existing structure at that index, then the new structure is simply copied to that index. Otherwise, any fields in the new structure are copied into the existing structure. This will replace existing values, and may introduce new ones, but any fields ‘missing’ in the new structure are left unchanged in the existing structure.

For example, if the existing GES.Track :restriction-caps are “video/x-raw, width=480, height=360”, and the updating caps is “video/x-raw, format=I420, width=500; video/x-bayer, width=400”, then the new GES.Track :restriction-caps after calling this will be “video/x-raw, width=500, height=360, format=I420; video/x-bayer, width=400”.

Signal Details

GES.Track.signals.commited(track)
Signal Name

commited

Flags

RUN_LAST

Parameters

track (GES.Track) – The object which received the signal

This signal will be emitted once the changes initiated by GES.Track.commit() have been executed in the backend. In particular, this will be emitted whenever the underlying #nlecomposition has been committed (see #nlecomposition::commited).

GES.Track.signals.track_element_added(track, effect)
Signal Name

track-element-added

Flags

RUN_FIRST

Parameters

Will be emitted after a track element is added to the track.

GES.Track.signals.track_element_removed(track, effect)
Signal Name

track-element-removed

Flags

RUN_FIRST

Parameters

Will be emitted after a track element is removed from the track.

Property Details

GES.Track.props.caps
Name

caps

Type

Gst.Caps

Default Value

None

Flags

READABLE, WRITABLE, CONSTRUCT_ONLY

The capabilities used to choose the output of the GES.Track's elements. Internally, this is used to select output streams when several may be available, by determining whether its Gst.Pad is compatible (see #NleObject:caps for #nlecomposition). As such, this is used as a weaker indication of the desired output type of the track, **before** the GES.Track :restriction-caps is applied. Therefore, this should be set to a *generic* superset of the GES.Track :restriction-caps, such as “video/x-raw(ANY)”. In addition, it should match with the track’s GES.Track :track-type.

Note that when you set this property, the Gst.CapsFeatures of all its Gst.Structure-s will be automatically set to #GST_CAPS_FEATURES_ANY.

Once a track has been added to a GES.Timeline, you should not change this.

Default value: #GST_CAPS_ANY.

GES.Track.props.duration
Name

duration

Type

int

Default Value

1000000000

Flags

READABLE

Current duration of the track

Default value: O

GES.Track.props.id
Name

id

Type

str

Default Value

None

Flags

READABLE, WRITABLE

The #nlecomposition:id of the underlying #nlecomposition.

New in version 1.18.

GES.Track.props.mixing
Name

mixing

Type

bool

Default Value

True

Flags

READABLE, WRITABLE, CONSTRUCT, EXPLICIT_NOTIFY

Whether the track should support the mixing of GES.Layer data, such as composing the video data of each layer (when part of the video data is transparent, the next layer will become visible) or adding together the audio data. As such, for audio and video tracks, you’ll likely want to keep this set to True.

GES.Track.props.restriction_caps
Name

restriction-caps

Type

Gst.Caps

Default Value

None

Flags

READABLE, WRITABLE

The capabilities that specifies the final output format of the GES.Track. For example, for a video track, it would specify the height, width, framerate and other properties of the stream.

You may change this property after the track has been added to a GES.Timeline, but it must remain compatible with the track’s GES.Track :caps.

Default value: #GST_CAPS_ANY.

GES.Track.props.track_type
Name

track-type

Type

GES.TrackType

Default Value

GES.TrackType.CUSTOM

Flags

READABLE, WRITABLE, CONSTRUCT_ONLY

The track type of the track. This controls the type of GES.TrackElement-s that can be added to the track. This should match with the track’s GES.Track :caps.

Once a track has been added to a GES.Timeline, you should not change this.