[Vorbis-dev] Fwd: Newbie q: decoupling vorbis from ogg

Michael Smith msmith at xiph.org
Wed Sep 14 13:23:12 PDT 2005


> Hi,
> 
> Sorry if this is a newbie question.  I'm trying to write an OS X
> AudioCodec for Vorbis using libvorbis.  I'm confused about the
> libvorbis dependency on libogg.  I thought the vorbis spec didn't
> require ogg as the container, but the libvorbis API requires ogg data
> structures in various synthesis layer functions like
> vorbis_synthesis_headerin.  Is this library only intended to be used
> with ogg containers or is there a way to use it without ogg?

Well first up - great news - there are a lot of people who'd love to
have properly working vorbis in OS X. Are you intending to make this
work open source (if so, we'd be happy to host your source in our svn
repository)?

On to your actual question... Yes, libvorbis depends on part of
libogg. There are two points of reliance - one is the ogg_packet
structure. This is a public structure - you can look at the ogg.h
header file to see the definition. Though libogg fills all of this out
for you automatically if you're using it, it's perfectly normal and
legal for an application to directly fill in this structure in any way
it so chooses. Other than the fact that this structure is defined in a
libogg header file, there's nothing that actually ties it to libogg.

The second place libvorbis uses libogg is for the bitpacker. This
usage is extensive, and would be difficult to remove. However, the
bitpacker code is part of libogg basically just for convenience - it's
in no way tied to the ogg format. This is just code that knows how to
take a data buffer (i.e. an actual vorbis packet, whereever it came
from) and read bits from it incrementally. It's actually just a single
file (ogg/src/bitwise.c).

So in summary - you're correct that you have to use libogg with
libvorbis, but this does not require actual usage of an ogg bitstream.

If you have any more questions, we're happy to help out.

Mike


More information about the Vorbis-dev mailing list