5 # Copyright (C) 2011 Mathieu Duponchelle <seeed@laposte.net>
6 # Copyright (C) 2011 Luis de Bethencourt <luis.debethencourt@collabora.co.uk>
8 # This program is free software; you can redistribute it and/or
9 # modify it under the terms of the GNU Lesser General Public
10 # License as published by the Free Software Foundation; either
11 # version 2.1 of the License, or (at your option) any later version.
13 # This program is distributed in the hope that it will be useful,
14 # but WITHOUT ANY WARRANTY; without even the implied warranty of
15 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 # Lesser General Public License for more details.
18 # You should have received a copy of the GNU Lesser General Public
19 # License along with this program; if not, write to the
20 # Free Software Foundation, Inc., 59 Temple Place - Suite 330,
21 # Boston, MA 02111-1307, USA.
22 # This program is free software; you can redistribute it and/or modify
23 # it under the terms of the GNU General Public License as published by
24 # the Free Software Foundation; either version 3, or (at your option)
32 gobject.threads_init()
38 def __init__(self, effects):
40 self.mainloop = glib.MainLoop()
42 self.timeline = ges.timeline_new_audio_video()
43 layer = ges.TimelineLayer()
44 self.src = ges.TimelineTestSource()
45 self.src.set_start(long(0))
47 self.src.set_duration(long(3000000000))
48 self.src.set_vpattern("smpte75")
49 layer.add_object(self.src)
50 self.timeline.add_layer(layer)
52 self.add_effects(effects)
54 self.pipeline = ges.TimelinePipeline()
55 self.pipeline.add_timeline(self.timeline)
56 bus = self.pipeline.get_bus()
57 bus.set_sync_handler(self.bus_handler)
59 def add_effects(self, effects):
61 effect = ges.TrackParseLaunchEffect(e)
62 self.src.add_track_object(effect)
63 for track in self.timeline.get_tracks():
64 if track.get_caps().to_string() == \
65 "video/x-raw-yuv; video/x-raw-rgb":
66 print "setting effect: " + e
67 track.add_object(effect)
69 def bus_handler(self, unused_bus, message):
70 if message.type == gst.MESSAGE_ERROR:
73 elif message.type == gst.MESSAGE_EOS:
80 if (self.pipeline.set_state(gst.STATE_PLAYING) == \
81 gst.STATE_CHANGE_FAILURE):
82 print "Couldn't start pipeline"
87 usage = "usage: %s effect_name-1 .. effect_name-n\n" % args[0]
90 print usage + "using aging tv as a default instead"
91 args.append("agingtv")
93 parser = optparse.OptionParser (usage=usage)
94 (opts, args) = parser.parse_args ()
99 if __name__ == "__main__":