#!/usr/bin/python

# bugzilla 572643
import gst

def main():
    pipeline = gst.parse_launch('''
        audiotestsrc num-buffers=3 !
        appsink name=sink sync=False''')

    pipeline.set_state(gst.STATE_PLAYING)

    sink = pipeline.get_by_name('sink')
    while True:
        try:
            buf = sink.emit('pull-buffer')
        except SystemError, e:
            print 'SystemError', e
            break

        print 'got buffer'

main()
