[vorbis] developing with libvorbis

Sune Foldager cryo at tiscali.dk
Wed Mar 26 17:41:37 PST 2003



On torsdag, mar 27, 2003, at 02:33 Europe/Copenhagen, Ed Sweetman wrote:

> what about something like this
>
> right where it says fwrite in the example decoder
>
> if(left > 0){
> 		memcpy(tbuffer+(4096-left),convbuffer,bout*2*vi.channels);
> left -= bout*2*vi.channels;
>
> } else {
> do my write function with the knowledge that i'm writing 4096 bytes
> left = 4096;
> }

Yes, if you remembered to pass the 'left' variable to the decode 
function correctly. See below.

> can i really be sure that it wont try writing 1024 bytes one time and 
> then 4096 the next?   and other combinations that overrun 4096?

Well, without having looked at the example in a bit, I am sure there is 
no problem. The reason being that you specify a maximum size for the 
decode function. It will NOT decode more than that. It MAY decode less, 
and it will do so if the frame stops before the buffer is full. So by 
filling the buffer in a loop like I suggested, __and passing the 'left' 
parameter to the decode function__ (instead of just 4096), it should 
work fine.


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