Getting the position of a stream in frame numbre not time

Sylvain "Skarsnik" Colinet scolinet at gmail.com
Wed Sep 28 14:21:58 PDT 2011


Hi,
First here some context :)
I write a weird karaoke application when timing of subtitle is
expressed in frame number.
Eg : {20}{40} blabla
I need to do thing every time a frame is decoded.

The perfect solution :
Having the multimedia framework send a signal every time a frame is
decoded (Never see such a thing in Xine, QuickTime and gstreamer)

A good workaround :
Getting the stream position every X ms

It seems I have to use the workaround with gstreamer, not that bad
I use Gstreamer in a Qt application (no QtGst, It bring boost in
compile dependancies)

[end of context]

So here my prob. I use playbin2 to avoid writing too much code

I try simply using gst_element_query_position on the playbin2 element.
I set the GstFormat at GST_FORMAT_DEFAULT, but it only return position
in ms (the gstformat  is set to GST_FORMAT_TIME).
I having the same prob with Xine so I get the framerate of the video
and do the conversion (all video have fixed framerate). I start
looking to caps and pads and try to iterate over the pads that
playbin2 hold to find something that can hold the metadata I need. But
the gst_iterator_next raise an error (gst_iterator_next: assertion
`elem != NULL' failed) even I check that the GstIterator is not Null
before the call.

So I am kind of stuck and I mail here have some help :) Remember my
first goal is to know when a new frame is decoded (and it number)

Here the complete code, mainly in the play and checkframe method
http://pastebin.com/VWpxM6pB
-- 
Sylvain "Skarsnik" Colinet

Victory was near but the power of the ring couldn't be undone


More information about the gstreamer-devel mailing list