[gst-devel] Several novice questions
Edward Hervey
bilboed at gmail.com
Fri Jan 18 16:35:11 CET 2008
Hi,
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):
> 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?
Are you running a mainloop ? I think it won't work if you're not
runnign a mainloop.
>
> 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?
Look in the C API for gst_element_get_state. The returned values are
the 3 last arguments of that function.
>
> 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)?
>
What are you doing that query on ? the pipeline ? the sinks ?
> In case it matters, I am using GStreamer 0.10.14 on Kubuntu 7.10 with Python
> 2.5.1.
More information about the gstreamer-devel
mailing list