[gst-devel] Several novice questions

Jeffrey Barish jeff_barish at earthlink.net
Fri Jan 18 16:28:36 CET 2008


1. I gather that I am expected to change the state of the player on EOS
(which seems strange to me as I would have thought that the player would
know to stop playing when the stream has ended).  To this end, I included
the following code:

    self.player = gst.element_factory_make('playbin', 'player')
    bus = self.player.get_bus()
    bus.add_signal_watch()
    bus.connect('message', self.on_message)

def on_message(self, bus, message):
    print "Got message", message  # nothing ever prints
    t = message.type
    if t in (gst.MESSAGE_EOS, gst.MESSAGE_ERROR):
        self.player.set_state(gst.STATE_NULL)

However, on_message is never called.  Any idea what I am doing wrong?

2. get_state() returns a tuple (with 3 elements) of the Element's current
state.  Where is the documentation on the elements of the tuple?  It
appears that the second element is the actual state.  Is this observation
always true?

3. I would like to know the elapsed ratio so I tried
query_position(gst.FORMAT_PERCENT).  I get a query error.  It works to do
query_position(gst.FORMAT_TIME) and query_duration(gst.FORMAT_TIME) and
compute the ratio, but why doesn't the simpler solution work?  Is
gst.FORMAT_PERCENT a percentage (0 to 100), as the name implies, or is it
actually a ratio (0 to 1)?

In case it matters, I am using GStreamer 0.10.14 on Kubuntu 7.10 with Python
2.5.1.
-- 
Jeffrey Barish





More information about the gstreamer-devel mailing list