Home | History | Annotate | Download | only in common
History log of /src/usr.bin/audio/common/wav.c
RevisionDateAuthorComments
 1.24  20-Mar-2024  mrg audio_wav_parse_hdr: handle zero-length data files again

the previous clean up turns zero-length data into no data and thus
an error, instead of simply doing nothing. noted by gson.
 1.23  14-Mar-2024  mrg fix some sizeof() confusion.

using "const char search[4]" as a function parameter means that
"search" is actually a pointer type so "sizeof search" returns
8 on 64-bit platforms. i mis-read this and used "sizeof *search"
which is always 1, noted by rillig.

instead of trying to avoid writing "4" twice, put it in a define
and use that in various places instead. annoying.
 1.22  12-Mar-2024  mrg audioplay(1): handle mis-aligned RIFF chunks.

put the code to find RIFF chunks into a new find_riff_chunk() function,
and handle mis-aligned chunk lengths. can now play files with chunks
that say they are 7 bytes long, and have 1 byte padding.

add some -V -V extra-verbose for the wav parser.
 1.21  11-Mar-2024  mrg minor clean up in the RIFF/WAVE header checking.

use memcmp() not strncmp() to check for "RIFF" and "WAVE".
avoid endian convesion on part.len 3 times.
 1.20  11-Mar-2024  mrg be sure to byte swap ext.len when checking/printing it.

noted by rillig@.
 1.19  08-Mar-2024  mrg audio_wav_parse_hdr(): avoid buffer overreads and clean up

reimplement most of this function using a new method of buffer
management to ensure that we never read beyond the provided size.

properly handle RIFF chunk lengths, instead of assuming various
offsets from most files are right.

update list of consumed documentation and fill the list of WAVE
formats from RFC 2361 (most remain not supported.)

should fix PR#57973.

tested against a large number of .wav files i have handy and with
a testsuite generator that should be incoming soon.
 1.18  27-Feb-2024  gson Clean up lines containing only tabs.
 1.17  27-Feb-2024  gson Clean up lines containing only spaces.
 1.16  15-Apr-2023  mlelstv Add support for recording 24bit wav files.
 1.15  09-Nov-2019  mrg branches: 1.15.8;
add support for playing IEEE float32 and float64 RIFF WAVE
samples on platforms that have these types natively, and
can handle signed linear 32 bit samples. explicitly
disabled on vax, run-or-compile-time sizeof() check
disabled for everyone else

now i can play a float32 .wav file i found.
float64 not tested.

copyright maint, update HISTORY, update audio drivers list.
 1.14  25-Nov-2017  jdolecek branches: 1.14.4; 1.14.6;
need getle16() for ext.sub_tag too

PR bin/52762 by Yosuke Sugahara
 1.13  05-Aug-2015  mrg branches: 1.13.8;
rename struct write_info as struct track_info, and the variable name 'wi'
as 'ti', as this info is useful for reading as well.
 1.12  18-Oct-2013  christos fix unused variable warnings
 1.11  30-Aug-2013  mrg move most of the header writing code from record.c into wav.c and sun.c.

introduce a struct write_info for communication between front ends and
backends.

libaudio API is still pretty ugly, and needs to stay local here for now,
but it is a little more usable for other tools now.
 1.10  28-Aug-2011  joerg branches: 1.10.2; 1.10.8;
ANSIfy. Add static. Add __dead.
 1.9  18-Jun-2009  mrg - add extended WAVE header support
- attempt to play a bunch more WAV files
 1.8  29-May-2008  mrg branches: 1.8.4; 1.8.10;
remove clause #3 from my license where there are no other
copyright holders involved.
 1.7  21-Jan-2004  mrg branches: 1.7.32; 1.7.34;
apply the patch from PR#24127: make audio_wav_parse_hdr() take u_int *
parameters for encoding, precision, sample rate and channels.
 1.6  23-Jun-2003  agc Add NetBSD RCS Ids.
 1.5  06-Apr-2003  wiz Respect the law: Use A-law and mu-law as spellings as far as easily possible.
Inspired by Igor Sobrado in PR 19680.
 1.4  08-Dec-2002  mrg remove some #if 0 debug code
 1.3  25-Jan-2002  mrg branches: 1.3.2;
add $NetBSD$
 1.2  15-Jan-2002  mrg - WARNS=3 (from ross@netbsd.org)
- fix a bug in WAV conversions
 1.1  15-Jan-2002  mrg - add rudimentary "wav" recording support: don't think it copes with
big-endian systems properly yet -- need to add RIFX support or swap
samples while writing. more on this coming soon.

- new "-F <format>" option for audiorecord. supported values of <format>
are "sun", "wav" and "none", plus a few aliases.

- split sun & wav support out into their own files.

- don't assume that WAV header elements are properly aligned for the
type of data they hold.

XXX: still need to clean up libaudio interfaces a lot.
 1.3.2.2  29-Jan-2002  he Pull up revisions 1.1-1.3 (new, requested by mrg):
Bring in several fixes and enhancements to these tools:
o fix stdin audioplay
o add WAV support to audiorecord
o allows any host to output any endian sample
o don't output a bogus header
o fix a bug in audiorecord -t
o many manual page fixes
o exit immediately on signals
 1.3.2.1  25-Jan-2002  he file wav.c was added on branch netbsd-1-5 on 2002-01-29 23:10:14 +0000
 1.7.34.1  23-Jun-2008  wrstuden Sync w/ -current. 34 merge conflicts to follow.
 1.7.32.1  04-Jun-2008  yamt sync with head
 1.8.10.1  21-Apr-2010  matt sync to netbsd-5
 1.8.4.1  23-Jun-2009  snj Pull up following revision(s) (requested by mrg in ticket #825):
usr.bin/audio/common/libaudio.h: revision 1.16
usr.bin/audio/common/wav.c: revision 1.9
- - add extended WAVE header support
- - attempt to play a bunch more WAV files
 1.10.8.1  20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.10.2.1  22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.13.8.3  25-Mar-2024  martin Pull up following revision(s) (requested by mrg in ticket #1950):

usr.bin/audio/common/wav.c: revision 1.24

audio_wav_parse_hdr: handle zero-length data files again
the previous clean up turns zero-length data into no data and thus
an error, instead of simply doing nothing. noted by gson.
 1.13.8.2  12-Mar-2024  martin Pull up the following revisions, requested by mrg in ticket #1948:

usr.bin/audio/common/auconv.h up to 1.6
usr.bin/audio/common/audio.c up to 1.27
usr.bin/audio/common/decode.c up to 1.2
usr.bin/audio/common/libaudio.h up to 1.22
usr.bin/audio/common/sun.c up to 1.11
usr.bin/audio/common/wav.c up to 1.22
usr.bin/audio/play/audioplay.1 up to 1.34
usr.bin/audio/play/play.c up to 1.64
usr.bin/audio/record/audiorecord.1 up to 1.45
usr.bin/audio/record/record.c up to 1.58

- support for playing 32-bit and 64-bit IEEE FP .wav files
- support for recording 24 bit .wav files
- read-overflow fixes for .wav files, and other fixes for the
wav parser
- audioplay gains -n flag (no play, like make -n)
- audiorecord manual gained useful examples
 1.13.8.1  27-Nov-2017  martin Pull up following revision(s) (requested by jdolecek in ticket #395):
usr.bin/audio/common/wav.c: revision 1.14
need getle16() for ext.sub_tag too
PR bin/52762 by Yosuke Sugahara
 1.14.6.3  23-Aug-2024  martin Pull up following revision(s) (requested by mrg in ticket #1874):

usr.bin/audio/common/wav.c: revision 1.23
usr.bin/audio/record/record.c: revision 1.59

fix some sizeof() confusion.

using "const char search[4]" as a function parameter means that
"search" is actually a pointer type so "sizeof search" returns
8 on 64-bit platforms. i mis-read this and used "sizeof *search"
which is always 1, noted by rillig.

instead of trying to avoid writing "4" twice, put it in a define
and use that in various places instead. annoying.
match message & conversion function name properly.

probably should make this into an array with two members.
 1.14.6.2  25-Mar-2024  martin Pull up following revision(s) (requested by mrg in ticket #1950):

usr.bin/audio/common/wav.c: revision 1.24

audio_wav_parse_hdr: handle zero-length data files again
the previous clean up turns zero-length data into no data and thus
an error, instead of simply doing nothing. noted by gson.
 1.14.6.1  12-Mar-2024  martin Pull up the following revisions, requested by mrg in ticket #1818:

usr.bin/audio/common/auconv.h up to 1.6
usr.bin/audio/common/audio.c up to 1.27
usr.bin/audio/common/decode.c up to 1.2
usr.bin/audio/common/libaudio.h up to 1.22
usr.bin/audio/common/sun.c up to 1.11
usr.bin/audio/common/wav.c up to 1.22
usr.bin/audio/ctl/audioctl.1 up to 1.25
usr.bin/audio/play/audioplay.1 up to 1.34
usr.bin/audio/play/play.c up to 1.64
usr.bin/audio/record/audiorecord.1 up to 1.45
usr.bin/audio/record/record.c up to 1.58

- support for playing 32-bit and 64-bit IEEE FP .wav files
- support for recording 24 bit .wav files
- read-overflow fixes for .wav files, and other fixes for the
wav parser
- audioplay gains -n flag (no play, like make -n)
- audioctl manual spruced up
- audiorecord manual gained useful examples
 1.14.4.1  13-Apr-2020  martin Mostly merge changes from HEAD upto 20200411
 1.15.8.3  23-Aug-2024  martin Pull up following revision(s) (requested by mrg in ticket #797):

usr.bin/audio/common/wav.c: revision 1.23
usr.bin/audio/record/record.c: revision 1.59

fix some sizeof() confusion.

using "const char search[4]" as a function parameter means that
"search" is actually a pointer type so "sizeof search" returns
8 on 64-bit platforms. i mis-read this and used "sizeof *search"
which is always 1, noted by rillig.

instead of trying to avoid writing "4" twice, put it in a define
and use that in various places instead. annoying.
match message & conversion function name properly.

probably should make this into an array with two members.
 1.15.8.2  25-Mar-2024  martin Pull up following revision(s) (requested by mrg in ticket #640):

usr.bin/audio/common/wav.c: revision 1.24

audio_wav_parse_hdr: handle zero-length data files again
the previous clean up turns zero-length data into no data and thus
an error, instead of simply doing nothing. noted by gson.
 1.15.8.1  12-Mar-2024  martin Pull up the following revisions, requested by mrg in ticket #634:

usr.bin/audio/common/auconv.h up to 1.6
usr.bin/audio/common/audio.c up to 1.27
usr.bin/audio/common/decode.c up to 1.2
usr.bin/audio/common/libaudio.h up to 1.22
usr.bin/audio/common/sun.c up to 1.11
usr.bin/audio/common/wav.c up to 1.22
usr.bin/audio/play/audioplay.1 up to 1.34
usr.bin/audio/play/play.c up to 1.64
usr.bin/audio/record/audiorecord.1 up to 1.45
usr.bin/audio/record/record.c up to 1.58

- support for recording 24 bit .wav files
- read-overflow fixes for .wav files, and other fixes for the
wav parser
- audioplay gains -n flag (no play, like make -n)

RSS XML Feed