shithub: sox

Download patch

ref: 195ea1d236253e39e60e64bc9c5a83ad9a35b156
parent: 4a43d182871839c02b55046b8f525f14ea6a6899
author: cbagwell <cbagwell>
date: Fri Aug 6 18:51:26 EDT 2004

Update txt files.  Memory leak fixes in wav reading.

--- a/Changelog
+++ b/Changelog
@@ -39,6 +39,7 @@
     chunks that are unknown.
   o Bugfix for 8-bit voc files.  Jimen Ching
   o General warning cleanups (cbagwell)
+  o Memory leaks in reading WAV files (Ufuk Kayserilioglu)
 
 sox-12.17.4
 -----------
--- a/sox.txt
+++ b/sox.txt
@@ -499,26 +499,37 @@
 		 the  avg  effect  and use the -l, -r, -f, -b, -1, -2, -3, -4,
 		 options to select only the left,  right,  front,  back	 chan-
 		 nel(s)	 or specific channel for the output instead of averag-
-		 ing the channels.  The -l, -r, -f, and	 -b  options  will  do
-		 averaging  in	quad-channel files so select the exact channel
-		 to prevent this.
+		 ing the channels.  The -l, and -r options will	 do  averaging
+		 in  quad-channel files so select the exact channel to prevent
+		 this.
 
 		 The avg effect can also be invoked with up to 16  double-pre-
-		 cision	 numbers,  which  specify the proportion of each input
-		 channel that is to be mixed into  each	 output	 channel.   In
-		 two-channel  mode, 4 numbers are given: l->l, l->r, r->l, and
-		 r->r, respectively.  In four-channel mode, the first  4  num-
-		 bers  give the proportions for the left-front output channel,
-		 as follows: lf->lf, rf->lf, lb->lf, and rb->rf.  The  next  4
-		 give the right-front output in the same order, then left-back
-		 and right-back.
+		 cision	 numbers,  which  specify the proportion (0.0 = 0% and
+		 1.0 = 100%) of each input channel that is to  be  mixed  into
+		 each  output  channel.	  In  two-channel  mode, 4 numbers are
+		 given: l->l, l->r, r->l, and r->r,  respectively.   In	 four-
+		 channel  mode,	 the  first 4 numbers give the proportions for
+		 the left-front output channel, as  follows:  lf->lf,  rf->lf,
+		 lb->lf,  and  rb->rf.	The next 4 give the right-front output
+		 in the same order, then left-back and right-back.
 
 		 It is also possible to use the 16 numbers to expand or reduce
-		 the  channel  count;  just  specify  0	 for  unused channels.
-		 Finally, if fewer than 4 numbers are given,  certain  special
-		 abbreviations	may  be	 invoked;  see	the  source  code  for
-		 details.
+		 the channel count; just specify 0 for unused channels.
 
+		 Finally, certain reduced combination of numbers can be speci-
+		 fied for certain input/output channel combinations.
+
+
+		 In Ch	Out Ch Num Mappings
+		 _____	______ ___ _____________________________
+		   2	  1	2   l->l, r->l
+		   2	  2	1   adjust balance
+		   4	  1	4   lf->l, rf->l, lb->l, rb-l
+		   4	  2	2   lf->l&rf->r, lb->l&rb->r
+		   4	  4	1   adjust balance
+		   4	  4	2   front balance, back balance
+
+
        band [ -n ] center [ width ]
 		 Apply a band-pass filter.  The frequency response drops loga-
 		 rithmically around the center frequency.  The width gives the
@@ -646,10 +657,10 @@
 		 hh:mm:ss.frac	format.	 To specify using sample counts, spec-
 		 ify the number of samples and append the letter  ’s’  to  the
 		 sample count (for example 8000s).
-		 An optional type can be specified to change the type of enve-
-		 lope.	Choices are q for quarter of a sinewave, h for half  a
-		 sinewave,  t  for  linear slope, l for logarithmic, and p for
-		 inverted parabola.  The default is a linear slope.
+		 An  optional  type  can  be  specified	 to change the type of
+		 envelope.  Choices are q for quarter of  a  sinewave,	h  for
+		 half a sinewave, t for linear slope, l for logarithmic, and p
+		 for inverted parabola.	 The default is a linear slope.
 
        filter [ low ]-[ high ] [ window-len [ beta ] ]
 		 Apply a Sinc-windowed lowpass, highpass, or  bandpass	filter
--- a/src/handlers.c
+++ b/src/handlers.c
@@ -340,7 +340,7 @@
         st_slstartread, st_rawread, st_rawstopread,
         st_slstartwrite, st_rawwrite, st_rawstopwrite, st_format_nothing_seek},
     {smpnames, ST_FILE_STEREO | ST_FILE_LOOPS | ST_FILE_SEEK,
-        st_smpstartread, st_smpread, st_format_nothing,
+        st_smpstartread, st_smpread, st_smpstopread,
         st_smpstartwrite, st_smpwrite, st_smpstopwrite, st_smpseek},
     {sndtnames, ST_FILE_STEREO | ST_FILE_SEEK,
         st_sndtstartread, st_rawread, st_rawstopread,
--- a/src/st_i.h
+++ b/src/st_i.h
@@ -279,6 +279,7 @@
 
 int st_smpstartread(ft_t ft);
 st_ssize_t st_smpread(ft_t ft, st_sample_t *buf, st_ssize_t len);
+int st_smpstopread(ft_t ft);
 int st_smpstartwrite(ft_t ft);
 st_ssize_t st_smpwrite(ft_t ft, st_sample_t *buf, st_ssize_t len);
 int st_smpstopwrite(ft_t ft);
--- a/src/wav.c
+++ b/src/wav.c
@@ -1086,9 +1086,11 @@
     if (wav->samples) free(wav->samples);
     if (wav->iCoefs) free(wav->iCoefs);
 
+    if (wav->comment) free(ct->comment);
+
     switch (ft->info.encoding)
     {
-#ifdef ENABLEGSM
+#ifdef ENABLE_GSM
     case ST_ENCODING_GSM:
         wavgsmdestroy(ft);
         break;
@@ -1300,7 +1302,7 @@
             wBitsPerSample = 32;
             if (ft->info.encoding != ST_ENCODING_SIGN2)
             {
-                st_warn("Do not support %s with 16-bit data.  Forcing to Signed.",st_encodings_str[(unsigned char)ft->info.encoding]);
+                st_warn("Do not support %s with 32-bit data.  Forcing to Signed.",st_encodings_str[(unsigned char)ft->info.encoding]);
                 ft->info.encoding = ST_ENCODING_SIGN2;
             }