[Vorbis-dev] Comments in vorbisfile_example
Ralph Giles
giles at xiph.org
Thu Jun 16 10:31:11 PDT 2005
On Thu, Jun 16, 2005 at 10:55:02AM -0500, Christopher Egner wrote:
> 1) Near the end, there is a comment that says "we don't bother dealing
> with sample rate changes, etc, but you'll have to." I assume the author is
> regarding to different sample rates as a whole, not dynamic sample rates. Am
> I correct in that assumption?
The sample rate and number of channels is fixed for any chain segment,
but there can be chain boundaries in the file (where the serial number
changes) and at those boundaries playback may switch to a different
sample rate and/or number of channels. A real application must
handle those cases. That is what that comment is about.
> 2) That etc bothers me. Are there other things I should keep an eye
> out for? I can't seem to think of any.
Number of channels and metadata comments changing are the main things
the etc. refers to, but anything associated with stream decoding can
change, so if you're doing something subtle with frame lengths or
something, you also have to reset that when vorbisfile notifies you of a
chain boundary.
>
> 3) At the top, he says that using vorbisfile is easier than using
> libvorbis. Is there any advantage to using libvorbis? I honestly can't see
> one, unless one needs access to raw functions for some reason.
vorbisfile only handles degenerate (vorbis-only) ogg streams, so if you
have vorbis multiplexed with another codec, or in another container you
have to use libvorbis directly.
> With respect to the "encoder_example" why do you use a random number for the
> stream rather than just starting at some arbitrary number (zero or
> otherwise) and increment. The only viable reason I can assume is to prevent
> logical streams becoming mixed because of bad transfer. Is there some other
> reason?
Laziness? Always choosing a random serialno reduces the chance of
collision if the segments are rechained, but really it's the encoder or
remixer's job to ensure there are no collisions within a particular
stream. I guess using the same number all the time also feels like the
wrong kind of laziness.
Hope that helps,
-r
More information about the Vorbis-dev
mailing list