[gst-devel] Ogg and GStreamer

Michael Smith msmith at xiph.org
Thu Jul 31 23:10:04 CEST 2003

On Thursday 31 July 2003 20:55, in7y118 at public.uni-hamburg.de wrote:
> Zitat von Ronald Bultje <rbultje at ronald.bitfreak.net>:
> > doesn't GST_BUFFER_DURATION(buf) suffice here? It's the actual reason why
> > I added it... And well, not all plugins use it or fill it in perfectly,
> > but it works, mostly.
> >
> > If GST_BUFFER_DURATION(buf) isn't good enough, could you please explain
> > what more it should do? We could then remove GST_BUFFER_DURATION() in
> > favour of something else. We shouldn't add something, I think, they look
> > too much alike...
> Duration is the length value of the time format.
> Let me do a little matrix:
> format\position |   start   |  length  | end
> ----------------+-----------+----------+-----
>           bytes |           | size     |
> ----------------+-----------+----------+-----
>            time | timestamp | duration |
> ----------------+-----------+----------+-----
>          frames | offset    |          |  ?
> ----------------+-----------+----------+-----
>     [any other] |           |          |
> This matrix summarizes for every format GStreamer uses what information
> about the buffer is available directly as a value inside the buffer struct.
> The value marked with the question mark is the only value that is available
> in ogg. How do I
> - get this value when encoding in oggmux?
> - store this value when decoding in oggdemux?
> (Please keep in mind that in the future ogg might be used for loads of
> formats and not only audio or video.)
> The suggested - and currently possible - ways to do this are
> - use gst_pad_query for encoding
> - discard the value when decoding
> and those don't look like best (and not like the fastest either).

Whilst I don't really know gstreamer internals well enough to comment on how 
well this might work for encoding, discarding the value when decoding is a 
bad idea: for some formats (such as vorbis, which is - obviously - quite 
common in an ogg container) this value is _required_ for correct decoding 
(for vorbis, it's needed for some special BOS/EOS handling. More details on 

Recreating it later would be difficult (you'd have to get it back from the 
'duration' value and the timestamp. This would be a pain, because then you'd 
have to have a correct 'duration' value. You can't easily do that from ogg 
(since it's highly interdependent on BOTH the ogg granulepos field and the 
contained format. 

Just a little warning...


More information about the gstreamer-devel mailing list