Hi! I would like to decompress an ogg vorbis file from the memory to the memory. I wrote my own callbacks for it (Why isn't there callback functions for it? Just for void* data, and a size_t size). Now I can read the ogg file from the memory but I don't know the total size of the uncompressed data (I would like to decompress the data at once). How can I get the bitstream decompressed size? Another question: The sample bits are always 16? The ov_read can handle 8 bit samples (one of it's parameters), but where can I see whether the ogg file contains 8 or 16 bit samples? Thanks, Csiki <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@xiph.org' containing only the word 'unsubscribe' in the body. No subject is needed. Unsubscribe messages sent to the list will be ignored/filtered.
Andrew Csikvari wrote:> How can I get the bitstream decompressed size?It's the amount of samples contained in the .ogg file times whatever bit resolution your player wants to play it (see below), or 4 if you don't make a conversion.> The sample bits are always 16?Internally, Vorbis is always 32bit float and doesn't know about things like 8, 16 or 24 bit etc. It's up to the player what to make out of it, i.e. at what bit resolution the audio shall be played. In not a programmer, but your mail suggests that ov_read() supports a few standard bit resolutions to convert to. <p>Moritz --- >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@xiph.org' containing only the word 'unsubscribe' in the body. No subject is needed. Unsubscribe messages sent to the list will be ignored/filtered.
On Wednesday 30 July 2003 07:43, Andrew Csikvari wrote:> Hi! > > I would like to decompress an ogg vorbis file from the memory to the > memory. > I wrote my own callbacks for it (Why isn't there callback functions for > it? Just for void* data, and a size_t size).Not sure what you mean here - there ARE callbacks for everything neccesary.> Now I can read the ogg file from the memory but I don't know the total > size of the uncompressed data (I would like to decompress the data at > once). > How can I get the bitstream decompressed size? > > Another question: > The sample bits are always 16? > The ov_read can handle 8 bit samples (one of it's parameters), but where > can I see whether the ogg file contains 8 or 16 bit samples? >As others described, sample size is an application choice, not a bitstream parameter. 16 bit is probably appropriate for you to use always. Then the total size (assuming a seekable input, so your callbacks must implement seeking for this to work) of the decompressed audio is: ogg_int64_t total_size = 0; for(i=0; i < ov_streams(&vf); i++) { total_size += ov_info(&vf, i)->channels * ov_pcm_total(&vf, i); } But note that since the number of channels can vary between different streams in the file, this won't directly give you anything particularly useful. You probably only want to decode one stream at a time, perhaps the first one: total_size = ov_info(&vf, 0)->channels * ov_pcm_total(&vf, i); Mike --- >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@xiph.org' containing only the word 'unsubscribe' in the body. No subject is needed. Unsubscribe messages sent to the list will be ignored/filtered.