Update of /cvsroot/audacity/lib-src/libsndfile/src
In directory sc8-pr-cvs11.sourceforge.net:/tmp/cvs-serv18372

Modified Files:
        wav.c 
Log Message:
Fix problem reading wav files with bext chunk.

Index: wav.c
===================================================================
RCS file: /cvsroot/audacity/lib-src/libsndfile/src/wav.c,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -d -r1.12 -r1.13
--- wav.c       23 May 2006 22:07:41 -0000      1.12
+++ wav.c       14 Apr 2007 06:46:02 -0000      1.13
@@ -1555,6 +1555,11 @@
        return 0 ;
 } /* wav_read_acid_chunk */
 
+#if 0
+/* LLL
+|| This is the original 1.16 function.  It was replaced with the 1.18
+|| function to correct a critter when dealing with coding history.
+*/
 int
 wav_read_bext_chunk (SF_PRIVATE *psf, unsigned int chunksize)
 {
@@ -1594,6 +1599,47 @@
 
        return 0 ;
 } /* wav_read_bext_chunk */
+#endif
+
+int
+wav_read_bext_chunk (SF_PRIVATE *psf, unsigned int chunksize)
+{
+       SF_BROADCAST_INFO* b ;
+       unsigned int bytes = 0 ;
+
+       if ((psf->broadcast_info = calloc (1, sizeof (SF_BROADCAST_INFO))) == 
NULL)
+       {       psf->error = SFE_MALLOC_FAILED ;
+               return psf->error ;
+               } ;
+
+       b = psf->broadcast_info ;
+
+       bytes += psf_binheader_readf (psf, "b", b->description, sizeof 
(b->description)) ;
+       bytes += psf_binheader_readf (psf, "b", b->originator, sizeof 
(b->originator)) ;
+       bytes += psf_binheader_readf (psf, "b", b->originator_reference, sizeof 
(b->originator_reference)) ;
+       bytes += psf_binheader_readf (psf, "b", b->origination_date, sizeof 
(b->origination_date)) ;
+       bytes += psf_binheader_readf (psf, "b", b->origination_time, sizeof 
(b->origination_time)) ;
+       bytes += psf_binheader_readf (psf, "442", &b->time_reference_low, 
&b->time_reference_high, &b->version) ;
+       bytes += psf_binheader_readf (psf, "bj", &b->umid, sizeof (b->umid), 
190) ;
+
+       if (chunksize > WAV_BEXT_CHUNK_SIZE)
+       {       /* File has coding history data. */
+
+               b->coding_history_size = chunksize - WAV_BEXT_CHUNK_SIZE ;
+
+               if (b->coding_history_size > SIGNED_SIZEOF (b->coding_history))
+                       b->coding_history_size = SIGNED_SIZEOF 
(b->coding_history) ;
+
+               /* We do not parse the coding history */
+               bytes += psf_binheader_readf (psf, "b", b->coding_history, 
b->coding_history_size) ;
+               b->coding_history [sizeof (b->coding_history) - 1] = 0 ;
+               } ;
+
+       if (bytes < chunksize)
+               psf_binheader_readf (psf, "j", chunksize - bytes) ;
+
+       return 0 ;
+} /* wav_read_bext_chunk */
 
 static int
 wav_write_bext_chunk (SF_PRIVATE *psf)


-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Audacity-cvs mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/audacity-cvs

Reply via email to