Ogg libvorbis - how to get a bit depth

196 views Asked by At

I use ov_open_callbacks and then ov_info functions to get the informations about ogg audio file. vorbis_info struct doesn't contain an information about a bit depth. I have to pass word argument to ov_read:

Specifies word size. Possible arguments are 1 for 8-bit samples, or 2 or 16-bit samples. Typical value is 2

1

There are 1 answers

0
Mike Clarke On

Vorbis stores frequency information, so there is no such concept as bit depth. Decoded data always comes out as 32-bit floating point.

ov_read is part of vorbisfile, which provides some higher-level functionality than the usual libvorbis calls. When you specify a bit-depth there, the vorbisfile code merely takes the decompressed floating point data and converts it to 8-bit or 16-bit before presenting it to you.