[gst-devel] how do queries get processed by a pipeline?

Julien Moutte julien at moutte.net
Sat Sep 29 18:38:02 CEST 2007


Queries are sent from sinks in upstream direction. Every element can try
to handle the query. Usually an audio decoder will try to handle the
duration query.

To handle the duration query the audio decoder will most likely do a
duration query in bytes upstream, get the result, convert it using
bitrate of average bitrate for vbr and then return the duration in time
unit to your query.

Does that reply to your question ?

Best regards,

Julien

On Sat, 2007-09-29 at 12:35 -0400, Daniel Lenski wrote:
> Anybody? ;-D
> Or maybe somebody can point me to another source of information on how
> GStreamer handles queries that involve cooperation among elements?
> 
> Thanks!
> Dan
> 
> On 9/27/07, Daniel Lenski <dlenski at gmail.com> wrote:
> > Hi all,
> > I'm working on a plugin, and trying to understand how GStreamer
> > processes queries on a pipeline.  For example, if I have this
> > pipeline:
> >
> > 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!
> >
> > Dan
> >
> > PS- The gstreamer design documentation seems to be down.  But I found
> > this (very old) document on query handling:
> > http://64.233.169.104/search?q=cache:pmjtKuC71TMJ:webcvs.freedesktop.org/gstreamer/gstreamer/docs/design/part-query.txt%3Frevision%3D1.1%26view%3Dmarkup+gstreamer+query+handler&hl=en&ct=clnk&cd=1&gl=us&client=firefox-a
> >  Anyone know if there's a newer version?
> >
> 
> -------------------------------------------------------------------------
> This SF.net email is sponsored by: Microsoft
> Defy all challenges. Microsoft(R) Visual Studio 2005.
> http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
> _______________________________________________
> gstreamer-devel mailing list
> gstreamer-devel at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/gstreamer-devel




More information about the gstreamer-devel mailing list