shithub: sox

Download patch

ref: c03d444e53b9920b9ada2acf658775dc518cfc21
parent: 1b0c79606d4290497c491b576c4cf279065f01b6
author: cbagwell <cbagwell>
date: Tue Nov 17 17:12:08 EST 2009

Fix writing 24-bit PAF files and possibly other libsndfile formats that
depend on get_filelen() behavior.

--- a/ChangeLog
+++ b/ChangeLog
@@ -40,6 +40,8 @@
   o CVSD encode/decode speed-ups.  (Kimberly Rockwell, P. Chaintreuil)
   o Add ability to select MP3 compression parameters.  (Jim Harkins)
   o Now writes out ID3-tags in MP3 files.  (Doug Cook)
+  o Fix failed writing 24-bit PAF files (and possibly other libsndfile
+    based formats).  (cbagwell)
 
 Audio device drivers:
 
--- a/src/sndfile.c
+++ b/src/sndfile.c
@@ -230,6 +230,11 @@
 
 static sf_count_t vio_get_filelen(void *user_data)
 {
+  sox_format_t *ft = (sox_format_t *)user_data;
+
+  /* lsf excepts unbuffered I/O behavior for get_filelen() so force that */
+  fflush(ft->fp);
+
   return lsx_filelength((sox_format_t *)user_data);
 }