Sign in to follow this  
daedalic

A Question About Ogg Decoding

Recommended Posts

daedalic    104
When you decode data from an ogg file, are you able to convert every N bytes of ogg data into exactly M bytes of pcm/raw data? Or is the result variable?

Share this post


Link to post
Share on other sites
DaBono    1496
Ogg/Vorbis supports both variable and fixed rates. In case of fixed rates you may indeed be able to deduce how much PCM-data N bytes of ogg-data would be. But why would you want to?

The Vorbis-library has a utility function ov_read, which allows you to request a number of bytes of PCM-data, and the library reads in just as much compressed data as it needs.

Share this post


Link to post
Share on other sites
daedalic    104
Quote:
Original post by DaBono
Ogg/Vorbis supports both variable and fixed rates. In case of fixed rates you may indeed be able to deduce how much PCM-data N bytes of ogg-data would be. But why would you want to?


The idea is to have individual blocks of ogg data from multiple sounds converted into pcm data before being mixed into a single pcm buffer, which is then played. I need pcm blocks of a fixed size to mix them properly.

Share this post


Link to post
Share on other sites
Sneftel    1788
Quote:
Original post by daedalic
The idea is to have individual blocks of ogg data from multiple sounds converted into pcm data before being mixed into a single pcm buffer, which is then played. I need pcm blocks of a fixed size to mix them properly.
Sure, but that doesn't mean you have to decompress exactly that much. Have a buffer for the unused results of each decompression; when you need more PCM data you pull a chunk off, and whenever there isn't enough data in the buffer for that you decompress OGG data until there is.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this