Charles Mason
2007-Feb-15 04:47 UTC
[Vorbis] Using decoding vorebis from a Vorbis / Theora Video
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.
Currently I am using LibOgg and LibTheora (via a SWIG generated wrapper).
This currently is able to decode the video and output it to the screen. I
would like to use LibVorbis to decode the audio stream. Looking at the
documentation it looks like I have to use LibVorbis and not the more popular
Vorbis APIs.
With Theora I currently go through the below proccess
Get a Packet Out LibOgg
Pass the Packet to Theroa to decode
Get the YUV frame to display from Theora
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.
Any help to point me in the right direction would be greatly appreciated.
Charlie
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
http://lists.xiph.org/pipermail/vorbis/attachments/20070215/9def10ce/attachment.html
Ralph Giles
2007-Feb-15 10:45 UTC
[Vorbis] Using decoding vorebis from a Vorbis / Theora Video
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