#!/usr/bin/python import pygst pygst.require('0.10') import gst def event_loop(pipeline): bus = pipeline.get_bus() while 1: msg = bus.poll (gst.MESSAGE_ANY, -1) if msg.type == gst.MESSAGE_EOS: return elif msg.type == gst.MESSAGE_ERROR: print "Error: ", msg return pipeline = gst.element_factory_make ("playbin") pipeline.set_property("uri", "file:///tmp/test.ogg") pipeline.set_state (gst.STATE_PLAYING) event_loop(pipeline) pipeline.set_state (gst.STATE_NULL)