[gst-devel] how do queries get processed by a pipeline?
dlenski at gmail.com
Thu Sep 27 07:21:44 CEST 2007
I'm working on a plugin, and trying to understand how GStreamer
processes queries on a pipeline. For example, if I have this
gnomevfssrc location=http://shoutcast/stream ! mad ! fakesink
... it will respond to position queries, in both GST_FORMAT_TIME and
GST_FORMAT_BYTES, but it won't respond to duration queries, since it
can't determine the stream duration.
However, if I have this other pipeline:
filesrc location=/path/song.mp3 ! mad ! fakesink
... it will respond to *both* position and duration queries. One
thing seems magical to me: how does a duration query in time units
work??? It must require cooperation between both the filesrc and the
mad element, since:
* only the filesrc element knows the file length in bytes
* only the mad element knows the bitrate
So how does such a query work? I've tried using
gst_pad_set_query_function on pads and watching the queries that come
through, and haven't figured out anything very useful from that.
The reason I'm interested in this is because I've made an improved
version of the Last.FM plugin (original here:
http://base-art.net/Articles/82/). The Last.FM radio service
basically consists of MP3 streams, but it includes out-of-stream
metadata on the duration of each individual tracks. With my code I
make a pipeline like:
lastfmsrc ! mad ! audioconvert ! autoaudiosink
Obviously, the mad element can't determine the stream duration, but
the lastfmsrc CAN. On the other hand, the mad element CAN determine
the stream position in time units. But I don't know how to tell the
mad element to reset its position to zero when the stream changes to a
new track. So I need to understand how to make the queries work
right. Thanks for any advice!
PS- The gstreamer design documentation seems to be down. But I found
this (very old) document on query handling:
Anyone know if there's a newer version?
More information about the gstreamer-devel