[gst-devel] Several novice questions
Jeffrey Barish
jeff_barish at earthlink.net
Mon Jan 21 08:12:07 CET 2008
Edward Hervey wrote:
> On Fri, 2008-01-18 at 08:28 -0700, Jeffrey Barish wrote:
>> 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):
>> 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?
>
> Are you running a mainloop ? I think it won't work if you're not
> runnign a mainloop.
It turns out that you were exactly right. The chunk of code in which
GStreamer is running is outside the GTK main loop. When I put the code in
a gobject mainloop, I do receive messages. Thank you for the suggestion.
I am still wondering why query_position(gst.FORMAT_PERCENT) produces a query
error whereas query_position(gst.FORMAT_TIME) does not and whether
gst.FORMAT_PERCENT is a misnomer.
--
Jeffrey Barish
More information about the gstreamer-devel
mailing list