import pygst
pygst.require('0.10')
import gst

e = gst.element_factory_make('alsasrc')
p = e.get_pad('src')
# must go to READY before trying to activate a pad
e.set_state(gst.STATE_READY)
# activate a pad for pull mode by default pads are activated
# in push mode when going to PAUSED.
p.activate_pull (True)
# now go to playing 
e.set_state(gst.STATE_PLAYING)
# read data, this must be a multiple of samples, alsasrc negotiates
# on my machint to 32 bits stereo so any multple of 8 will do.
(result, buffer) = p.get_range(long(-1), 96)
print len(buffer)
# stop
e.set_state(gst.STATE_NULL)
