3 # vi:si:et:sw=4:sts=4:ts=4
6 # Copyright (C) 2002 David I. Lehn
8 # This library is free software; you can redistribute it and/or
9 # modify it under the terms of the GNU Library General Public
10 # License as published by the Free Software Foundation; either
11 # version 2 of the License, or (at your option) any later version.
13 # This library 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 # Library General Public License for more details.
18 # You should have received a copy of the GNU Library General Public
19 # License along with this library; if not, write to the
20 # Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
21 # Boston, MA 02110-1301, USA.
23 # Author: David I. Lehn <dlehn@users.sourceforge.net>
33 def handoff_cb(sender, *args):
34 print sender.get_name(), args
37 # create a new bin to hold the elements
38 #gst_debug_set_categories(-1)
39 bin = gst.parse_launch('fakesrc name=source silent=1 num-buffers=10 signal-handoffs=true ! ' +
40 'fakesink name=sink silent=1 signal-handoffs=true')
41 source = bin.get_by_name('source')
42 source.connect('handoff', handoff_cb)
43 source.get_pad("src").connect("have-data", handoff_cb)
44 sink = bin.get_by_name('sink')
45 sink.connect('handoff', handoff_cb)
46 sink.get_pad("sink").connect('have-data', handoff_cb)
52 res = bin.set_state(gst.STATE_PLAYING);
56 msg = bus.poll(gst.MESSAGE_EOS | gst.MESSAGE_ERROR, gst.SECOND)
60 res = bin.set_state(gst.STATE_NULL)
63 if __name__ == '__main__':
64 sys.exit(main(sys.argv))