[vorbis-dev] [fwd] ogg123 (from: pfk@fuchs.offl.uni-jena.de)

Beni Cherniavsky cben at crosswinds.net
Tue Jan 9 05:59:48 PST 2001



volsung at asu.edu wrote:
> 
> > For ogg123 I need the following feature:
> >
> > - Decode one .ogg file and write it as 44 byte standard header .wav
> >   to stdout.
> >
> > Can you add this feature?
> 
> This looked easy at first, but then I remembered that our wav output code
> writes the header last (using file seeking fuctions) so that it can get the
> file size information correct.  Is there a way to change the code so that it
> writes it first?  Will programs break if the size info is incorrect?
> 
Yes, the RIFF spec says that data after the end of chunk as defined by
the header should be ignored.  However broken headers are a common
case, so many programs just read as much data as there is, ignoring
the header (OggEnc does this, IIRC).  Besides, it's just simpler :-).

If you can get an estimate of the size before you start writing, and
"round" it up a little, you should work with most programs - ignoring
the header is the reasonable thing to do if it indicates higher length
than there is in the file.  Some, though, will complain even in this
case, or even put unitilized garbage in the end.

Note also that most programs use the header when they need a track time
estimate.

If you write to a seekable device, it's best to patch the header,
IMO.  However it might be reasonable to put the estimate in when you
start (instead of zeros).  This will support WAV streaming ;-).  OTOH,
it wouldn't detect crashes.


-- 
Beni Cherniavsky <cben at crosswinds.net>
                 (also scben at t2,cben at tx in Technion)

  No, No! You're not thinking; you're just being logical.
                                             - Niels Bohr

--- >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