[vorbis-dev] Calculating vorbis packet durations...

Adriano Almeida adriano at continuum.com.br
Tue May 18 06:40:18 PDT 2004



> What is this window configurations... i'm not very familiar with the
vorbis
> packet structure, as i use a wrapper to libvorbis. Could you perhaps tell
me
> what the field names (or their byte positions ) in the packet are for this
?
>
basically when u get a audio packet u need to to this steps:
read audio bit
read modes bit
thisWindowSize = mode->blockFlag  //found when u decode the setup packets

the specs say that after this step you should do  the following (at chapter
4.3)

  1.. if this is a long window (the [vorbis_mode_blockflag] flag of this
mode is set):

    1.. read 1 bit for [previous_window_flag]
    2.. read 1 bit for [next_window_flag]
    3.. if [previous_window_flag] is not set  (the left half of the window
will be a hybrid window for lapping with a short block. See Section 1.3.2.3,
"Window shape decode (long windows only)" for an illustration of overlapping
dissimilar windows. )
            Else ( the left half window will have normal long shape. )
    1.. if [next_window_flag] is not set, the right half of the window will
be a hybrid window for lapping with a short block. See Section 1.3.2.3,
"Window shape decode (long windows only)" for an illustration of overlapping
dissimilar windows. Else, the left right window will have normal long shape.
  2.. if this is a short window, the window is always the same short-window
shape.

I usually keep the last packetwindow type (0 for small and 1 for big) and
then i use the formula Provided by Monty

     thisPacketSize = previousPacketWindowSize/4+ thisPacketWindowSize/4;
// packet size in samples

>
> So this means that you still can't get an accurate result without the
> previous page ?
>
well, having all the packets inside this page you can find all their values
and then subtract them from the page granule position until the packet u
want.
I have only a doubt that when u have a continued page, i don't know if the
first packet samples should be calculated. the continued page is always the
problem

--- >8 ----
List archives:  http://www.xiph.org/archives/
Ogg project homepage: http://www.xiph.org/ogg/
To unsubscribe from this list, send a message to 'vorbis-dev-request at xiph.org'
containing only the word 'unsubscribe' in the body.  No subject is needed.
Unsubscribe messages sent to the list will be ignored/filtered.



More information about the Vorbis-dev mailing list