From 7cb04151b9931d34f61f366618f7e5a0f55509c1 Mon Sep 17 00:00:00 2001 From: Erik de Castro Lopo Date: Sun, 20 Mar 2011 20:17:54 +1100 Subject: [PATCH] src/wav.c : For u-law and A-law files, write an 18 byte 'fmt ' chunk. --- ChangeLog | 7 +++++++ src/wav.c | 12 ++++++------ 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/ChangeLog b/ChangeLog index 7625bcba..fb6816a9 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2011-03-20 Erik de Castro Lopo + + * src/wav.c + For u-law and A-law files, write an 18 byte 'fmt ' chunk instead of a 16 + byte one. Win98 accepts files with a 16 but not 18 byte 'fmt' chunk. Later + version accept 18 byte but not 16 byte. + 2011-03-15 Erik de Castro Lopo * doc/FAQ.html diff --git a/src/wav.c b/src/wav.c index 38a2a489..241d9da5 100644 --- a/src/wav.c +++ b/src/wav.c @@ -756,27 +756,27 @@ wav_write_fmt_chunk (SF_PRIVATE *psf) break ; case SF_FORMAT_ULAW : - fmt_size = 2 + 2 + 4 + 4 + 2 + 2 ; + fmt_size = 2 + 2 + 4 + 4 + 2 + 2 + 2 ; /* fmt : format, channels, samplerate */ psf_binheader_writef (psf, "4224", fmt_size, WAVE_FORMAT_MULAW, psf->sf.channels, psf->sf.samplerate) ; /* fmt : bytespersec */ psf_binheader_writef (psf, "4", psf->sf.samplerate * psf->bytewidth * psf->sf.channels) ; - /* fmt : blockalign, bitwidth */ - psf_binheader_writef (psf, "22", psf->bytewidth * psf->sf.channels, 8) ; + /* fmt : blockalign, bitwidth, extrabytes */ + psf_binheader_writef (psf, "222", psf->bytewidth * psf->sf.channels, 8, 0) ; add_fact_chunk = SF_TRUE ; break ; case SF_FORMAT_ALAW : - fmt_size = 2 + 2 + 4 + 4 + 2 + 2 ; + fmt_size = 2 + 2 + 4 + 4 + 2 + 2 + 2 ; /* fmt : format, channels, samplerate */ psf_binheader_writef (psf, "4224", fmt_size, WAVE_FORMAT_ALAW, psf->sf.channels, psf->sf.samplerate) ; /* fmt : bytespersec */ psf_binheader_writef (psf, "4", psf->sf.samplerate * psf->bytewidth * psf->sf.channels) ; - /* fmt : blockalign, bitwidth */ - psf_binheader_writef (psf, "22", psf->bytewidth * psf->sf.channels, 8) ; + /* fmt : blockalign, bitwidth, extrabytes */ + psf_binheader_writef (psf, "222", psf->bytewidth * psf->sf.channels, 8, 0) ; add_fact_chunk = SF_TRUE ; break ;