[Vorbis] Using decoding vorebis from a Vorbis / Theora Video

Ralph Giles giles at xiph.org
Thu Feb 15 10:45:17 PST 2007


On Thu, Feb 15, 2007 at 12:47:30PM +0000, Charles Mason wrote:

> I am trying to write a media player in c# which will be able to play .ogg
> video files which contain Theora video and Vorbis audio streams.

You might also take a look a pjcast's C# decoder port.

  http://www.wreckedgames.com/ogg.zip

> I was hoping to do the same with LibVorbis but I am a little confused by all
> the methods in Codec.h. Which functions are expecting the raw packet from
> LibOgg and can I then simply get the raw PCM data to play, like I can with
> LibTheora or is it more complicated.
> 
> Is all the talk of framing in Codec.h just Ogg which I am using LibOgg for
> or is it something different and acautlly part of the Vorbis codec itself.

Unfortunately there's not API documentation for the lower-level 
libvorbis api. (please write some!) But you can get the call sequence
from decoder_example.c in the libvorbis source.

  http://svn.xiph.org/trunk/vorbis/examples/decoder_example.c

basically (once the headers are parsed) it goes:

for packet in packets_from_ogg_stream_packetout:
  if vorbis_synthesis():	# ogg_packet -> vorbis_block
    vorbis_synthesis_blockin()	# vorbis_block -> decoder
  while vorbis_synthesis_pcmout(): # decode -> pcm buffer
    write_or_play_audio()	# pcm buffer -> output

So there's an extra level of parsing the data goes through compared to 
theora.

Hope that helps,
 -r


More information about the Vorbis mailing list