home *** CD-ROM | disk | FTP | other *** search
/ Mac Easy 2010 May / Mac Life Ubuntu.iso / casper / filesystem.squashfs / usr / share / gst-python / 0.10 / examples / f2f.pyc (.txt) < prev    next >
Encoding:
Python Compiled Bytecode  |  2009-04-20  |  1.3 KB  |  40 lines

  1. # Source Generated with Decompyle++
  2. # File: in.pyc (Python 2.6)
  3.  
  4. import sys
  5. import pygst
  6. pygst.require('0.10')
  7. import gst
  8.  
  9. def handoff_cb(sender, *args):
  10.     print sender.get_name(), args
  11.  
  12.  
  13. def main(args):
  14.     bin = gst.parse_launch('fakesrc name=source silent=1 num-buffers=10 signal-handoffs=true ! ' + 'fakesink name=sink silent=1 signal-handoffs=true')
  15.     source = bin.get_by_name('source')
  16.     source.connect('handoff', handoff_cb)
  17.     source.get_pad('src').connect('have-data', handoff_cb)
  18.     sink = bin.get_by_name('sink')
  19.     sink.connect('handoff', handoff_cb)
  20.     sink.get_pad('sink').connect('have-data', handoff_cb)
  21.     print source, sink
  22.     bus = bin.get_bus()
  23.     res = bin.set_state(gst.STATE_PLAYING)
  24.     if not res:
  25.         raise AssertionError
  26.     while None:
  27.         msg = bus.poll(gst.MESSAGE_EOS | gst.MESSAGE_ERROR, gst.SECOND)
  28.         if msg:
  29.             break
  30.             continue
  31.         continue
  32.         res = bin.set_state(gst.STATE_NULL)
  33.         if not res:
  34.             raise AssertionError
  35.         return None
  36.  
  37. if __name__ == '__main__':
  38.     sys.exit(main(sys.argv))
  39.  
  40.