GES.Track¶
- Subclasses:
Methods¶
- Inherited:
Gst.Bin (18), Gst.Element (82), Gst.Object (27), GObject.Object (37), Gst.ChildProxy (9), GES.MetaContainer (40)
- Structs:
class |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Virtual Methods¶
Properties¶
- Inherited:
Name |
Type |
Flags |
Short Description |
---|---|---|---|
r/w/co |
Caps used to choose the output stream |
||
r |
The current duration of the track |
||
r/w |
The stream-id of the composition |
||
r/w/c/en |
Whether layer mixing is activated on the track or not |
||
r/w |
Caps used as a final filter on the output stream |
||
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 |
---|---|
This signal will be emitted once the changes initiated by |
|
Will be emitted after a track element is added to the track. |
|
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 |
r |
||
type |
r |
The |
Class Details¶
- class GES.Track(**kwargs)¶
- Bases:
- Abstract:
No
- Structure:
A
GES.Track
acts an output source for aGES.Timeline
. Each one essentially provides an additionalGst.Pad
for the timeline, withGES.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 aGES.Source
when itsGES.TimelineElement
:start
is reached by outputting its data for itsGES.TimelineElement
:duration
. Similarly, aGES.Operation
would be activated by applying its effect to the source data, starting from itsGES.TimelineElement
:start
time and lasting for itsGES.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:
type (
GES.TrackType
) – TheGES.Track
:track-type
for the track
- Returns:
A new track.
- Return type:
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 aGES.VideoTrack
is created. This will automatically choose a gap creation method suitable for video data. You will likely want to setGES.Track
:restriction-caps
separately. You may prefer to use theGES.VideoTrack.new
() method instead.If type is
GES.TrackType.AUDIO
, and caps is a subset of “audio/x-raw(ANY)”, then aGES.AudioTrack
is created. This will automatically choose a gap creation method suitable for audio data, and will set theGES.Track
:restriction-caps
to the default forGES.AudioTrack
. You may prefer to use theGES.AudioTrack.new
() method instead.Otherwise, a plain
GES.Track
is returned. You will likely want to set theGES.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:
See
GES.Track.add_element
(), which also gives an error.
- add_element_full(object)[source]¶
- Parameters:
object (
GES.TrackElement
) – The element to add- Raises:
- Returns:
True
if object was successfully added to self.- Return type:
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, orFalse
if nothing needed to be committed.- Return type:
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_elements()[source]¶
- Returns:
A list of all the
GES.TrackElement
-s in self.- Return type:
Gets the track elements contained in the track. The returned list is sorted by the element’s
GES.TimelineElement
:priority
andGES.TimelineElement
:start
.
- get_restriction_caps()[source]¶
-
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
orNone
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:
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:
- Returns:
True
if object was successfully removed from self.- Return type:
Removes the given track element from the track, which revokes ownership of the element.
New in version 1.18.
- 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 theGst.Structure
-s in caps is compared against the existing structure with the same index in the currentGES.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 newGES.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:
- 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:
- Parameters:
track (
GES.Track
) – The object which received the signaleffect (
GES.TrackElement
) – The element that was added
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:
- Parameters:
track (
GES.Track
) – The object which received the signaleffect (
GES.TrackElement
) – The element that was removed
Will be emitted after a track element is removed from the track.
Property Details¶
- GES.Track.props.caps¶
- Name:
caps
- Type:
- Default Value:
- Flags:
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 itsGst.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** theGES.Track
:restriction-caps
is applied. Therefore, this should be set to a *generic* superset of theGES.Track
:restriction-caps
, such as “video/x-raw(ANY)”. In addition, it should match with the track’sGES.Track
:track-type
.Note that when you set this property, the
Gst.CapsFeatures
of all itsGst.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¶
-
Current duration of the track
Default value: O
- GES.Track.props.id¶
-
The #nlecomposition:id of the underlying #nlecomposition.
New in version 1.18.
- GES.Track.props.mixing¶
-
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 toTrue
.
- GES.Track.props.restriction_caps¶
-
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’sGES.Track
:caps
.Default value: #GST_CAPS_ANY.
- GES.Track.props.track_type¶
- Name:
track-type
- Type:
- Default Value:
- Flags:
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’sGES.Track
:caps
.Once a track has been added to a
GES.Timeline
, you should not change this.