3 # vi:si:et:sw=4:sts=4:ts=4
6 # Copyright (C) 2002 David I. Lehn <dlehn@users.sourceforge.net>
7 # 2004 Johan Dahlin <johan@gnome.org>
9 # This library is free software; you can redistribute it and/or
10 # modify it under the terms of the GNU Library General Public
11 # License as published by the Free Software Foundation; either
12 # version 2 of the License, or (at your option) any later version.
14 # This library is distributed in the hope that it will be useful,
15 # but WITHOUT ANY WARRANTY; without even the implied warranty of
16 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 # Library General Public License for more details.
19 # You should have received a copy of the GNU Library General Public
20 # License along with this library; if not, write to the
21 # Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
22 # Boston, MA 02110-1301, USA.
24 # Author: David I. Lehn <dlehn@users.sourceforge.net>
30 gobject.threads_init()
37 mainloop = gobject.MainLoop()
42 def filter(input, output):
43 "A GStreamer copy pipeline which can add arbitrary filters"
45 # create a new bin to hold the elements
46 bin = gst.parse_launch('filesrc name=source ! ' +
48 # This 'statistics' element is depreciated in 0.10
49 #'statistics silent=false buffer-update-freq=1 ' +
50 #'update_on_eos=true ! ' +
52 filesrc = bin.get_by_name('source')
53 filesrc.set_property('location', input)
55 filesink = bin.get_by_name('sink')
56 filesink.set_property('location', output)
59 bus.add_signal_watch()
60 bus.connect('message::eos', on_eos)
63 bin.set_state(gst.STATE_PLAYING)
67 except KeyboardInterrupt:
71 bin.set_state(gst.STATE_NULL)
74 "A GStreamer based cp(1) with stats"
77 print 'usage: %s source dest' % (sys.argv[0])
80 return filter(args[1], args[2])
82 if __name__ == '__main__':
83 sys.exit(main(sys.argv))