mirror of
https://gitee.com/openharmony/third_party_libsnd
synced 2024-11-23 09:59:54 +00:00
Apply similar fix from writing float data to AIFF files without a peak chunk.
This commit is contained in:
parent
8007b31250
commit
a6f3f957c4
@ -7,9 +7,12 @@
|
||||
Add header_shrink_test from Axel Roebel.
|
||||
|
||||
* src/wav.c
|
||||
Add fix from Axel Roebel for writing files with float data but no peak
|
||||
Add fix from Axel Roebel for writing files with float data but no peak
|
||||
chunk (ie peak chunk gets removed after the file is opened).
|
||||
|
||||
|
||||
* src/aiff.c tests/header_test.tpl
|
||||
Apply similar fix to above for AIFF files.
|
||||
|
||||
2007-12-16 Erik de Castro Lopo <erikd AT mega-nerd DOT com>
|
||||
|
||||
* src/ogg.c
|
||||
|
10
src/aiff.c
10
src/aiff.c
@ -996,7 +996,7 @@ aiff_write_header (SF_PRIVATE *psf, int calc_length)
|
||||
AIFF_PRIVATE *paiff ;
|
||||
unsigned char comm_sample_rate [10], comm_zero_bytes [2] = { 0, 0 } ;
|
||||
unsigned int comm_type, comm_size, comm_encoding, comm_frames ;
|
||||
int k, endian ;
|
||||
int k, endian, has_data = SF_FALSE ;
|
||||
short bit_width ;
|
||||
|
||||
if ((paiff = psf->container_data) == NULL)
|
||||
@ -1004,6 +1004,9 @@ aiff_write_header (SF_PRIVATE *psf, int calc_length)
|
||||
|
||||
current = psf_ftell (psf) ;
|
||||
|
||||
if (current > psf->dataoffset)
|
||||
has_data = SF_TRUE ;
|
||||
|
||||
if (calc_length)
|
||||
{ psf->filelength = psf_get_filelen (psf) ;
|
||||
|
||||
@ -1282,9 +1285,12 @@ aiff_write_header (SF_PRIVATE *psf, int calc_length)
|
||||
if (psf->error)
|
||||
return psf->error ;
|
||||
|
||||
if (has_data && psf->dataoffset != psf->headindex)
|
||||
return psf->error = SFE_INTERNAL ;
|
||||
|
||||
psf->dataoffset = psf->headindex ;
|
||||
|
||||
if (current < psf->dataoffset)
|
||||
if (! has_data)
|
||||
psf_fseek (psf, psf->dataoffset, SEEK_SET) ;
|
||||
else if (current > 0)
|
||||
psf_fseek (psf, current, SEEK_SET) ;
|
||||
|
@ -85,9 +85,7 @@ main (int argc, char *argv [])
|
||||
update_seek_int_test ("header_int.wav", SF_FORMAT_WAV) ;
|
||||
update_seek_float_test ("header_float.wav", SF_FORMAT_WAV) ;
|
||||
update_seek_double_test ("header_double.wav", SF_FORMAT_WAV) ;
|
||||
|
||||
header_shrink_test ("header_shrink.wav", SF_FORMAT_WAV) ;
|
||||
|
||||
extra_header_test ("extra.wav", SF_FORMAT_WAV) ;
|
||||
test_count++ ;
|
||||
} ;
|
||||
@ -98,6 +96,7 @@ main (int argc, char *argv [])
|
||||
update_seek_int_test ("header_int.aiff", SF_FORMAT_AIFF) ;
|
||||
update_seek_float_test ("header_float.aiff", SF_FORMAT_AIFF) ;
|
||||
update_seek_double_test ("header_double.aiff", SF_FORMAT_AIFF) ;
|
||||
header_shrink_test ("header_shrink.wav", SF_FORMAT_AIFF) ;
|
||||
extra_header_test ("extra.aiff", SF_FORMAT_AIFF) ;
|
||||
test_count++ ;
|
||||
} ;
|
||||
|
Loading…
Reference in New Issue
Block a user