Skip to content
Browse files

xges: Fix tracks ordering (#538)

The tracks should be loaded in reverse order for the XGES format.

Also in GES, layers (tracks in otio terms) do not have a track type
(tracks are global to the timeline which formalizes the outputed
types), thus we should try to keep audio and video tracks in the same
order during deserialization.
  • Loading branch information...
thiblahute authored and ssteinbach committed Aug 7, 2019
1 parent 6096ad0 commit f38c21e48515285cad64f3e211abfdea9886cda3
Showing with 26 additions and 2 deletions.
  1. +26 −2 contrib/opentimelineio_contrib/adapters/
@@ -307,7 +307,8 @@ def to_otio(self):
def _add_layers(self, timeline, otio_timeline, all_names):
for layer in timeline.findall("./layer"):
tracks = self._build_tracks_from_layer_clips(layer, all_names)
for track in tracks:
otio_timeline.tracks.insert(0, track)

def _get_clips_for_type(self, clips, track_type):
if not clips:
@@ -695,7 +696,30 @@ def _serialize_timeline(self, project, ressources, otio_timeline):

all_clips = set()
layers = {}
for layer_priority, otio_track in enumerate(otio_timeline.tracks):

video_tracks = [
t for t in otio_timeline.tracks
if t.kind == otio.schema.TrackKind.Video and list(t)
audio_tracks = [
t for t in otio_timeline.tracks
if t.kind == otio.schema.TrackKind.Audio and list(t)

all_tracks = []
for i, otio_track in enumerate(video_tracks):
except IndexError:

if len(audio_tracks) > len(video_tracks):

for layer_priority, otio_track in enumerate(all_tracks):
self._serialize_layer(timeline, layers, layer_priority)
offset = 0
for otio_element in otio_track:

0 comments on commit f38c21e

Please sign in to comment.
You can’t perform that action at this time.