On Sunday 09 March 2008 23:15:21 Hannu Savolainen wrote: > Yair K. wrote: > > Hi, > > > > This patch folds the WAV parser into the IFF parser (the formats are > > very similar anyway). While at it, I've added some support for > > WAVE_FORMAT_EXTENSIBLE format and the rare RIFX container. > > I hope somebody (if not everybody) could beta test this patch before > inclusion. I don't want to take any risk that WAV playback gets broken > by this. > > Also there seems to be problems with WAV files produced by ossrecord and > Media player of Windows Vista. It looks like Vista doesn't accept WAV > files produced by ossrecord. Help on debugging this problem is highly > welcome. >
The attached diff should fix ossrecord. It looks like the main issue was channels being used twice instead of once when calculating bytes_p_sec. Yours, Yair K.
--- cmd/ossrecord/ossrecord.c 2008-03-07 03:28:25.142484280 +0200 +++ cmd/ossrecord/ossrecord.c 2008-03-10 00:57:48.303239315 +0200 @@ -31,7 +31,7 @@ #define WAVE_STEREO 2 -typedef struct +typedef struct __attribute__ ((__packed__)) { char main_chunk[4]; unsigned int length; @@ -43,7 +43,7 @@ unsigned short modus; unsigned int sample_fq; unsigned int byte_p_sec; - unsigned short byte_p_spl; + unsigned short block_align; unsigned short bit_p_spl; char data_chunk[4]; @@ -265,15 +265,15 @@ write_head (void) { memcpy ((char *) &wh.main_chunk, RIFF, 4); - wh.length = bswap (datalimit + sizeof (WaveHeader)); + wh.length = bswap (datalimit + sizeof (WaveHeader) - 8); memcpy ((char *) &wh.chunk_type, WAVE, 4); memcpy ((char *) &wh.sub_chunk, FMT, 4); wh.sc_len = bswap (16); wh.format = bswaps (PCM_CODE); wh.modus = bswaps (channels); wh.sample_fq = bswap (speed); - wh.byte_p_spl = bswaps ((bits / 8) * channels); - wh.byte_p_sec = bswap (speed * wh.modus * wh.byte_p_spl); + wh.block_align = bswaps ((bits / 8) * channels); + wh.byte_p_sec = bswap (speed * channels * (bits / 8)); wh.bit_p_spl = bswaps (bits); memcpy ((char *) &wh.data_chunk, DATA, 4); wh.data_length = bswap (datalimit);
_______________________________________________ oss-devel mailing list oss-devel@mailman.opensound.com http://mailman.opensound.com/mailman/listinfo/oss-devel