[vorbis] problems loading an ogg to memory

Joel Gonzales mk at tradewars.org
Wed Sep 3 10:16:34 PDT 2003



This seems to be where I'm stuck at currently. What function do I call 
to set the sample size?

Just to make sure my math is correct:
if we have 200 PCM samples, 1 channel and a rate of 44100, that would give
200*1*44100 = 8820000 (assuming a file that isn't chained)

So I'd need an array of size 8820000? or is the number given in bits/bytes?

Thanks a bunch for the help.

Stan Seibert wrote:

>On Wed, 2003-08-27 at 18:03, Joel Gonzales wrote:
>  
>
>>I'm trying to load an entire ogg file into memory, but having some 
>>problems trying to figure out how big the ogg file will be in 
>>uncompressed form.  I've tried a couple diffrent ways but no luck.  I'm 
>>basically just trying to load the uncompressed file into an array of 
>>chars. Any help on this?
>>    
>>
>
>Take a look at the ov_pcm_total() function.  It will return the number
>of PCM samples in the stream, which you can then multiply by the number
>of channels and the sample size to get the number of bytes.  (Note that
>when you decode with vorbisfile, you get to pick the sample size.  It
>isn't an attribute of the stream like in a WAV file.)
>
>One complication to consider for the general case is that Ogg streams
>can be chained, and each link in the chain can have a different number
>of channels potentially.  This would affect the calculation of the total
>size, so you will have to iterate through the links individually to
>count the number of bytes needed in total.
>
>---
>Stan Seibert
>
>  
>

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