[vorbis-dev] some more granulepos questions
joshua at haberman.com
Sun Nov 16 22:10:08 PST 2003
On Sun, 2003-11-16 at 18:06, Michael Smith wrote:
> On Sunday 16 November 2003 14:09, Joshua Haberman wrote:
> > I want to know the granulepos of individual packets. It appears that
> > Ogg cannot provide me this information. Glancing at vcut, it appears
> > that I can use the function vorbis_packet_blocksize() to determine the
> > number of samples contained in a given vorbis packet. But I have no
> > idea why the vcut function get_blocksize() adds the packet's block size
> > to the previous packet's blocksize and divides by 4.
> > Q2. How does vcut's get_blocksize() work?
> This is how the vorbis format is specified. get_blocksize() is probably poorly
> named - what it does is calculate the number of output samples from the
> packet (i.e. the amount by which granulepos will be incremented). This is a
> property of the block size of the current and previous blocks.
OK. Can the reasoning behind this formula (bs[n-1]+bs[n])/4 be deduced
from the overlap/add diagram in the spec? I think I understand based on
that diagram, but I may be deluding myself. :)
> > The spec says that the stream starts at an offset greater than zero if
> > there are less samples in the first page than the granulepos of the
> > first page. For on-disk streams that have this characteristic, how will
> > the vorbisfile ov_*_seek() and ov_*_tell() functions behave? Will they
> > act as though the file begins at offset 0, or will they expose the >0
> > starting offset?
> > Q3. How does vorbisfile deal with >0 offsets?
> This situation is a characteristic of files that have had the start removed -
> it's nicer (vcut does this) to clean up by re-numbering the granulepos of all
> the page.
I don't intend to generate files with this characteristic, I just want
to be able to handle them correctly. ("Be liberal in what you accept
and conservative in what you generate")
Again, thanks for the useful answers.
--- >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