tests: Add utilities to print the timeline

Making debugging tests simpler
This commit is contained in:
Thibault Saunier 2019-03-01 19:30:41 -03:00 committed by Thibault Saunier
parent 7c5f2d11b2
commit 4a1679f698
3 changed files with 62 additions and 0 deletions

View file

@ -271,3 +271,44 @@ ges_test_get_tmp_uri (const gchar * filename)
return uri;
}
void
print_timeline (GESTimeline * timeline)
{
GList *layer, *clip, *clips, *group;
g_printerr
("\n\n=========================== GESTimeline: %p ==================\n",
timeline);
for (layer = timeline->layers; layer; layer = layer->next) {
clips = ges_layer_get_clips (layer->data);
g_printerr ("layer %04d: ", ges_layer_get_priority (layer->data));
for (clip = clips; clip; clip = clip->next) {
g_printerr ("{ %s [ %" G_GUINT64_FORMAT "(%" G_GUINT64_FORMAT ") %"
G_GUINT64_FORMAT "] } ", GES_TIMELINE_ELEMENT_NAME (clip->data),
GES_TIMELINE_ELEMENT_START (clip->data),
GES_TIMELINE_ELEMENT_INPOINT (clip->data),
GES_TIMELINE_ELEMENT_END (clip->data));
}
if (layer->next)
g_printerr ("\n--------------------------------------------------\n");
g_list_free_full (clips, gst_object_unref);
}
if (ges_timeline_get_groups (timeline)) {
g_printerr ("\n--------------------------------------------------\n");
g_printerr ("\nGROUPS:");
g_printerr ("\n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n");
}
for (group = ges_timeline_get_groups (timeline); group; group = group->next) {
g_printerr ("%" GES_FORMAT ": ", GES_ARGS (group->data));
for (clip = GES_CONTAINER_CHILDREN (group->data); clip; clip = clip->next)
g_printerr ("[ %s ]", GES_TIMELINE_ELEMENT_NAME (clip->data));
}
g_printerr
("\n=====================================================================\n");
}

View file

@ -108,4 +108,6 @@ G_STMT_START { \
GST_TIME_ARGS(GES_TIMELINE_ELEMENT_INPOINT(element)), \
GST_TIME_ARGS(GES_TIMELINE_ELEMENT_DURATION(element))
void print_timeline(GESTimeline *timeline);
#endif /* _GES_TEST_UTILS */

View file

@ -152,6 +152,25 @@ class GESSimpleTimelineTest(GESTest):
self.track_types = [GES.TrackType.AUDIO, GES.TrackType.VIDEO]
super(GESSimpleTimelineTest, self).__init__(*args)
def timeline_as_str(self):
res = "====== %s =======\n" % self.timeline
for layer in self.timeline.get_layers():
res += "Layer %04d: " % layer.get_priority()
for clip in layer.get_clips():
res += "{ %s }" % clip
res += '\n------------------------\n'
for group in self.timeline.get_groups():
res += "GROUP %s :" % group
for clip in group.get_children(False):
res += " { %s }" % clip.props.name
res += '\n'
res += "================================\n"
return res
def print_timeline(self):
print(self.timeline_as_str())
def setUp(self):
self.timeline = GES.Timeline.new()
for track_type in self.track_types: