[vorbis-dev] Wave Header Question

Monty xiphmont at xiph.org
Sun Jan 14 15:01:35 PST 2001



On Sun, Jan 14, 2001 at 09:52:54AM -0700, volsung at asu.edu wrote:
> I'm reordering the code in ao_wav.c that writes wav files to prevent the
> problem we had earlier.  If ogg123 was improperly terminated (Segfault, 
> kill -9, etc.), the output wav file was not even recognizable because the
> header was totally blank.
> 
> I have found that at the start of playback (from libao's perspective), I know
> all of the wav header info except two things:
> 
> 1) The length of the RIFF chunk. (filesize - 8, in our case)
> 2) The length of the data chunk. (filesize - 44, in our case)

You can find the PCM length of the Vorbis file iff* the input is
seekable.  

*(if and only if)

> Assuming I have no idea how long the file is going to be, what are sane values
> to put in for these lengths ahead of time?  I find if I put 0, the sox
> frontend "play" will just play nothing (it actually pays attention to the
> value).

If you know the finished PCM size, write it in.  If you don't, you can
make it 'infinite' length; this will break, AFAIK, only XMMS among the
apps I use.  Then go back and fill it in at the end.  If the output
isn't seekable and you don't know the output length when you start,
proper behavior is to warn the user (much as sox does).

>
> Basically, wav files don't seem like they should be streamable anyway, so you
> shouldn't use them for that purpose.  However, since I have to pick something
> to put in those blanks, I want something that will be useful in the most
> cases.

Right.

Monty

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