summaryrefslogtreecommitdiff
path: root/bindings/python/testsuite/test_textoverlay.py
blob: 25571e2ae49a28b3667e56060654fd4f016143d9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
import gst

from common import TestCase
from gst import ges

class Timeline(TestCase):

    def testTimeline(self):

        tl = ges.timeline_new_audio_video()
        lyr = ges.SimpleTimelineLayer()
        src = ges.TimelineTestSource()
        pip = ges.TimelinePipeline()
        ovrl = ges.TimelineTextOverlay()
        bus = pip.get_bus()

        # Let's add the layer to the timeline, and the sources to the layer.

        tl.add_layer(lyr)
        src.set_duration(long(gst.SECOND * 10))
        ovrl.set_duration(long(gst.SECOND * 5))
        ovrl.set_start(long(gst.SECOND * 5))
        ovrl.set_text("Foo")

        lyr.add_object(src, -1)
        lyr.add_object(ovrl, -1)

        pip.add_timeline(tl)
        bus.set_sync_handler(self.bus_handler)

        self.pipeline = pip
        self.layer = lyr

        #Mainloop is finished, tear down.
        self.pipeline = None


    def bus_handler(self, unused_bus, message):
        if message.type == gst.MESSAGE_ERROR:
            print "ERROR"
            self.mainloop.quit()
        elif message.type == gst.MESSAGE_EOS:
            print "Done"
            self.mainloop.quit()
        return gst.BUS_PASS