[gst-devel] a few questions: getting total length (in seconds) of a file

james at teyandei.net james at teyandei.net
Mon Mar 1 12:23:06 CET 2004


[please cc me in replies, I'm not subscribed... yet]

Hi, I'm working on an application and using gstreamer... it really is a
great framework adn I am enjoying using it so far. I've been reading
through the Application Developer's Manual, the API docs and digging
through source code from other projects and I'm having some problems
understanding some concepts so I hope I can bounce a few questions off you
guys.

For the record I'm using 0.6.x from Debian unstable.

My project is an audio player. I'm setting up a pipeline:

filesrc -> autoplugger -> audiosink

Keeping things simple for the moment. It works great. My first question
is, is a filesrc object tied to whatever you set for the 'location'
property? It seems that if I want to open another file, I need to unref
the old filesrc, remove it from the pipeline, create a new one, and then
readd/relink it. This is what I'm doing now and it works fine but I just
want to make sure I'm doing the "Right Thing" here.

Second question: I want to drive a seek bar. Right now I would just like
to have it track the current position, not actually let me seek in the
file. I know how to use GtkAdjustments etc so using them is no problem. I
figured out how to get the current elapsed time from the stream as well.
What I'm having problems with is getting the total length of the file. I'm
doing this:

gst_element_query(<element>, GST_QUERY_TOTAL, GST_FORMAT_TIME, &value);

and getting a 'false' value from gst_element_query (failed). In place of
<element> I have tried the filesrc, autoplugger and audiosink elements and
get the same result every time. Which part of the pipeline do I need to
query exactly to get the total length?

Last, would you guys consider gstreamer-play to be a robust enough plugin
to base an application on, or is it just considered an example plugin and
basis for gst-player? I have re-implemented a tiny subsection of it in my
own code for learning purposes, but I'm afraid to use it in my application
if it's really not meant for such purposes.

Thank you for your patience and help.

James






More information about the gstreamer-devel mailing list