[Speex-dev] Speex seek with high precision

Arnau Alemany arnau.alemany at gmail.com
Wed May 13 13:18:51 PDT 2009


Hello everybody,
I'm new to this mailing list so I'm sorry if it's the wrong place to post
this.

I'm developing a Speex player and I need to seek with a precision of
milliseconds. I used liboggz that supposedly does just that, but it never
seeks exactly where it should. For example if I use oggz_seek_units(oggz,
18450, SEEK_SET) result it's 16386 and there is a delay between the playback
and the moment where it should start. Only when I seek to position 0 I get
the desired result.

I've also used ogg_page_granulepos for seeking but it seems more difficult
to use. I use something like this:

    do
    {
        while (ogg_sync_pageout(&oy, &og) != 1)
        {
            data = ogg_sync_buffer(&oy, 512);
            readbytes = fread(data, 1, 512, spxfile);
            ogg_sync_wrote(&oy, readbytes);
        }
        //printf("ogg_page_granulepos: %lld\n", ogg_page_granulepos(&og));
    }
    while (ogg_page_granulepos(&og) < time * freq); // time in seconds,
freq: 16000

But this way I can't get enough precision neither.

Could anyone give me some idea of what could I do to get a high precision
when seeking?

Thank you,
Arnau
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.xiph.org/pipermail/speex-dev/attachments/20090513/33ed8b2e/attachment.htm 


More information about the Speex-dev mailing list