[Vorbis-dev] How can I seek in Ogg Vorbis file,
but not using Vorbisfile library?
Ian Malone
ibmalone at gmail.com
Tue Aug 29 07:58:18 PDT 2006
On 29/08/06, 隽 徐 <china_xujun at yahoo.com.cn> wrote:
>
> Hello, All.
>
> I am making an Ogg Vorbis decoder based on Tremor. The Vorbisfile library
> provides a high-level API which enables us to seek in the file, but it needs
> to declare a pointer to OggVorbis_File structure.
>
> Because I am supposed not to use file, so I can't use the ov_pcm_seek() or
> ov_raw_seek() functions to seek in the file. For decoding an Ogg Vorbis
> file, I first put it in a buffer, then use API provided by libogg and
> libvorbis to decode it, and put the PCM in ouput buffer.
>
> Now I have a problem, how to seek in the Ogg Vorbis file not using
> Vorbisfile library? That means, I can only use API provided by libogg and
> libvorbis libraries, and I didn't find an example.
>
> I hope someone can help me to solve this problem. And an example will be
> most grateful.
>
You may want to investigate how libvorbisfile does its search. IIRC the
typical strategy is to bisection search, jump in the Ogg stream, try to
get page synced and get a packet, then check the granulepos. I don't
have an example for this though.
Alternatively you could; implement call-backs which read from your buffer,
this shouldn't be too much work, or build a list of pages when you start
with pertinent data (granulepos, offset) and use that to speed up your
search (you should be able to find the page before the one containing
your desired granulepos).
--
imalone
More information about the Vorbis-dev
mailing list