timeline-object: Add TrackObject to the Track after the TimelineObject
[platform/upstream/gstreamer.git] / bindings / python / testsuite / test_transition.py
1 import glib
2 import gst
3
4 from common import TestCase
5 import ges
6
7 class Timeline(TestCase):
8
9     def testTimeline(self):
10
11         tl = ges.timeline_new_audio_video()
12         lyr = ges.SimpleTimelineLayer()
13         src = ges.TimelineTestSource()
14         src2 = ges.TimelineTestSource()
15         tr = ges.TimelineStandardTransition("crossfade")
16         pip = ges.TimelinePipeline()
17         bus = pip.get_bus()
18         self.mainloop = glib.MainLoop()
19
20         # Let's add the layer to the timeline, and the sources
21         # and transition to the layer.
22
23         tl.add_layer(lyr)
24         src.set_duration(long(gst.SECOND * 10))
25         src2.set_duration(long(gst.SECOND * 10))
26         src.set_vpattern("Random (television snow)")
27         tr.set_duration(long(gst.SECOND * 10))
28
29         lyr.add_object(src, -1)
30         lyr.add_object(tr, -1)
31         assert (lyr.add_object(src2, -1) == True)
32
33         pip.add_timeline(tl)
34         bus.set_sync_handler(self.bus_handler)
35
36         self.pipeline = pip
37         self.layer = lyr
38
39         #Mainloop is finished, tear down.
40         self.pipeline = None
41
42
43     def bus_handler(self, unused_bus, message):
44         if message.type == gst.MESSAGE_ERROR:
45             print "ERROR"
46             self.mainloop.quit()
47         elif message.type == gst.MESSAGE_EOS:
48             print "Done"
49             self.mainloop.quit()
50         return gst.BUS_PASS