gst_element_query_duration() fails for certain filetypes

Tim-Philipp Müller t.i.m at zen.co.uk
Sun Jan 27 13:43:06 PST 2013


On Sun, 2013-01-27 at 13:07 -0800, Nate Bogdanowicz wrote:

Hi,

> > The problem is that the state change to PAUSED/PLAYING will take place
> > asynchronously in another thread. You will have to wait until the
> > pipeline is prerolled (has reached PAUSED state) before you query the
> > duration.
> >
> > Either wait for the ASYNC_DONE message on the bus, or do a _get_state()
> > call with a timeout to wait for the state change to complete.
>
> Thanks for your reply. Thanks for the suggestion about GST_SECOND.
> However, as you can see, I already do use a _get_state() call to wait
> for the pipeline to be prerolled (that's where I've use the 1e9). I
> then verify that the state has successfully changed using
> GST_STATE_CHANGE_SUCCESS, and exit(1) if it hasn't.
> 
> Furthermore, in my larger program I've also queried the duration
> repeatedly *while the pipeline is in the PLAYING state and music is
> playing through my speakers* and _query_duration() consistently
> returns the same value. It definitely does not seem to be connected to
> an incomplete state change.

Oh, sorry, I completely missed that (obviously) :)

Try using GST_FORMAT_TIME, if that works better.

DEFAULT is supposed to mean samples for audio and frames for video, but
may or may not work depending on media and elements involved.

Cheers
 -Tim



More information about the gstreamer-devel mailing list