[vorbis] retrieving "instant" bitrate without vo_open?
msmith at labyrinth.net.au
Sat Sep 22 20:41:34 PDT 2001
>How could i do that without vorbisfile? none of the other structures have a
>bitrate element. That's the problem i'm having.
Ah... Now I see. Ok, vorbisfile is totally useless for this (well, not totally.
One COULD make it work. But it's not suitable).
You want to use mostly libogg, plus two or three functions from libvorbis.
You need to read in each packet in order (see the ogg docs or maybe
decoder_example.c for how to do this). Then, instead of actually decoding the
packet, use vorbis_packet_blocksize() to get the size (in samples) of the
packet (see vcut or vorbiscomment for an example of how to use these).
Then, you have the length in samples of the packet, and the length in bytes
of the packet (packet->length) - to get bitrate, you just need the samplerate
of the file. To get this, submit the three header packets (at the start of
the stream) to vorbis_synthesis_headerin() (again, see decoder_example).
Then vi->rate is the sample rate.
--- >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-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