shithub: sox

Download patch

ref: ff59604fd34c3228bd6fc4cf883d0167045726b9
parent: dfdca3cec4e6fb7c79e47abfee1f23d6da3f0d48
author: robs <robs>
date: Thu Jun 4 12:31:54 EDT 2009

Fix not outputing GSM-in-wav when input is GSM-in-wav

--- a/ChangeLog
+++ b/ChangeLog
@@ -70,6 +70,7 @@
   o Fix [2404566] segfault when converting from MS ADPCM wav file.  (robs)
   o Fix slight FLAC seek inaccuracy e.g. when using `trim' effect.  (robs)
   o Fix mp3 decode sometimes being up to a block short.  (robs)
+  o Fix not outputing GSM-in-wav when input is GSM-in-wav.  (robs)
 
 Audio device drivers:
 
--- a/src/formats.c
+++ b/src/formats.c
@@ -143,7 +143,7 @@
 };
 
 assert_static(array_length(sox_encodings_info) == SOX_ENCODINGS,
-    SIZE_MISMATCH_BETWEEN_sox_encodings_t_AND_sox_encodings_info);
+    SIZE_MISMATCH_BETWEEN_sox_encoding_t_AND_sox_encodings_info);
 
 unsigned sox_precision(sox_encoding_t encoding, unsigned bits_per_sample)
 {
@@ -572,9 +572,12 @@
     return sox_false;
   while ((e = enc_arg(sox_encoding_t))) {
     if (e == encoding->encoding) {
-      while ((s = enc_arg(unsigned)))
+      sox_bool has_bits;
+      for (has_bits = sox_false; (s = enc_arg(unsigned)); has_bits = sox_true)
         if (s == encoding->bits_per_sample)
           return sox_true;
+      if (!has_bits && !encoding->bits_per_sample)
+        return sox_true;
       break;
     }
     while (enc_arg(unsigned));
--- a/src/mp3.c
+++ b/src/mp3.c
@@ -648,7 +648,7 @@
 {
   static char const * const names[] = {"mp3", "mp2", "audio/mpeg", NULL};
   static unsigned const write_encodings[] = {
-    SOX_ENCODING_GSM, 0, 0};
+    SOX_ENCODING_MP3, 0, 0};
   static sox_format_handler_t const handler = {SOX_LIB_VERSION_CODE,
     "MPEG Layer 3 lossy audio compression", names, 0,
     startread, sox_mp3read, stopread,