[vorbis-dev] two questions re vorbisfile API

Michael Smith msmith at xiph.org
Mon Oct 28 13:41:11 PST 2002



At 06:14 PM 28/10/2002 +0100, you wrote:
>Hey guys,
>
>currently wrapping my head around the vorbisfile API.  The stream callback 
>interface is really nice ! Great work.
>
>I'm running into two snags using it though.
>
>a) getting ov_bitrate on a seakable stream returns a long.
>When I print it as %ld, I get
>Bitstream is 2 channel, 44100 Hz, 0 version, -2147483648 bitrate

To cover this on the mailing lists for people that want to search for
this...
This is a gcc optimiser bug at -O2 and above, with gcc 3.x (at least
in 3.1 and 3.2). cvs contains rearranged code that won't trigger the
bug. 

>
>I get this same number for any vorbis file.
>I checked them with ogginfo, and that reports the right ABR.
>Am I missing something ?

ogginfo uses a different mechanism to detect bitrate (it's already doing
a linear scan of the file, so it doesn't need to call the vorbisfile
functions), so it doesn't get hit by this.

>
>Why is there a slight difference between the two values ?

Vorbisfile and ogginfo will both report bitrate using only the data
sections of the stream (i.e. they both ignore the headers for bitrate
calculation).

>
>b) 
>ov_bitrate interprets "link == -1" as "the entire bitstream"
>ov_comment interprets "link == -1" as "the current bitstream"
>
>why the different behaviour ? Is there a reason behind this ?

This is mostly a matter of providing the most useful possible
interface by default. Getting the comments for "all streams"
doesn't make sense (and would be difficult to provide anyway), 
whereas calculating an average bitrate over the entire file does, 
so that's what the API provides.

>
>c) am i correct in assuming that each logical bitstream in the phyiscal 
>one can contain at most one COMMENT tag ?

Absolutely NOT. There may be any number of tags with the same name
(the spec says this).

Michael

<p>--- >8 ----
List archives:  http://www.xiph.org/archives/
Ogg project homepage: http://www.xiph.org/ogg/
To unsubscribe from this list, send a message to 'vorbis-dev-request at xiph.org'
containing only the word 'unsubscribe' in the body.  No subject is needed.
Unsubscribe messages sent to the list will be ignored/filtered.



More information about the Vorbis-dev mailing list