[vorbis] developing with libvorbis

Sune Foldager cryo at tiscali.dk
Wed Mar 26 16:45:44 PST 2003



On thursday, march 27, 2003, at 01:35 (Europe/Copenhagen time), Ed 
Sweetman wrote:

> In the example decoder it writes data in varying lengths to stdout, is 
> it possible to alter the decoder to write the same length data to 
> stdout every time?  Rather, how would you alter the decoder to do 
> that.  It seems to be writing everything from 512 to 4096 bytes each 
> time and i cant really see why this is and how to change it.

This is because the decoder doesn't decode farther than the current 
frame. Make a small loop, repeatedly calling the decode function until 
you get the amount you need. I believe it says something about this in 
the libvorbisfile documentation. Something like this:

int left = 4096;
while(left > 0)
{
     int data_read = vorbis_read(..., left);  // Can't remember the name 
of the decode function.
     // Do something with data, e.g. buffer it.
     left -= data_read;
}
// Write buffer to stdout or similar. Unless there was an EOF, it 
should be size 4096.

In the above code, special concern needs to be taken with regard to EOF.


-- 
Sune Foldager
DIKU - Department of Computer Science,
University of Copenhagen.

--- >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 mailing list