mirror of
https://gitee.com/openharmony/third_party_libsnd
synced 2024-11-23 09:59:54 +00:00
Move peak_loc field of SF_PRIVATE struct to PEAK_CHUNK struct.
This commit is contained in:
parent
202acea872
commit
53c996b794
13
ChangeLog
13
ChangeLog
@ -1,3 +1,16 @@
|
||||
2005-07-21 Erik de Castro Lopo <erikd AT mega-nerd DOT com>
|
||||
|
||||
* src/common.h
|
||||
Move the peak_loc field of SF_PRIVATE to the PEAK_CHUNK struct.
|
||||
|
||||
* src/aiff.c src/caf.c src/wav.c
|
||||
Fix knock on effects from above.
|
||||
|
||||
2005-07-19 Erik de Castro Lopo <erikd AT mega-nerd DOT com>
|
||||
|
||||
* src/wav.c
|
||||
Prevent files with unknown chunks from being opened read/write.
|
||||
|
||||
2005-07-14 Erik de Castro Lopo <erikd AT mega-nerd DOT com>
|
||||
|
||||
* src/flac.c
|
||||
|
@ -215,7 +215,7 @@ aiff_open (SF_PRIVATE *psf)
|
||||
if (psf->pchunk == NULL)
|
||||
return SFE_MALLOC_FAILED ;
|
||||
psf->has_peak = SF_TRUE ;
|
||||
psf->peak_loc = SF_PEAK_START ;
|
||||
psf->pchunk->peak_loc = SF_PEAK_START ;
|
||||
} ;
|
||||
|
||||
if (psf->mode != SFM_RDWR || psf->filelength < 40)
|
||||
@ -1066,7 +1066,7 @@ aiff_write_header (SF_PRIVATE *psf, int calc_length)
|
||||
if (psf->str_flags & SF_STR_LOCATE_START)
|
||||
aiff_write_strings (psf, SF_STR_LOCATE_START) ;
|
||||
|
||||
if (psf->has_peak && psf->peak_loc == SF_PEAK_START)
|
||||
if (psf->has_peak && psf->pchunk->peak_loc == SF_PEAK_START)
|
||||
{ psf_binheader_writef (psf, "Em4", PEAK_MARKER,
|
||||
sizeof (PEAK_CHUNK) + psf->sf.channels * sizeof (PEAK_POS)) ;
|
||||
psf_binheader_writef (psf, "E44", 1, time (NULL)) ;
|
||||
@ -1103,7 +1103,7 @@ aiff_write_tailer (SF_PRIVATE *psf)
|
||||
|
||||
psf->dataend = psf_fseek (psf, 0, SEEK_END) ;
|
||||
|
||||
if (psf->has_peak && psf->peak_loc == SF_PEAK_END)
|
||||
if (psf->has_peak && psf->pchunk->peak_loc == SF_PEAK_END)
|
||||
{ psf_binheader_writef (psf, "Em4", PEAK_MARKER,
|
||||
sizeof (PEAK_CHUNK) + psf->sf.channels * sizeof (PEAK_POS)) ;
|
||||
psf_binheader_writef (psf, "E44", 1, time (NULL)) ;
|
||||
|
@ -130,7 +130,7 @@ caf_open (SF_PRIVATE *psf)
|
||||
if (psf->pchunk == NULL)
|
||||
return SFE_MALLOC_FAILED ;
|
||||
psf->has_peak = SF_TRUE ;
|
||||
psf->peak_loc = SF_PEAK_START ;
|
||||
psf->pchunk->peak_loc = SF_PEAK_START ;
|
||||
} ;
|
||||
|
||||
if ((error = caf_write_header (psf, SF_FALSE)) != 0)
|
||||
@ -504,7 +504,7 @@ caf_write_header (SF_PRIVATE *psf, int calc_length)
|
||||
if (psf->str_flags & SF_STR_LOCATE_START)
|
||||
caf_write_strings (psf, SF_STR_LOCATE_START) ;
|
||||
|
||||
if (psf->has_peak && psf->peak_loc == SF_PEAK_START)
|
||||
if (psf->has_peak && psf->pchunk->peak_loc == SF_PEAK_START)
|
||||
{ psf_binheader_writef (psf, "em4", PEAK_MARKER,
|
||||
sizeof (PEAK_CHUNK) + psf->sf.channels * sizeof (PEAK_POS)) ;
|
||||
psf_binheader_writef (psf, "e44", 1, time (NULL)) ;
|
||||
|
@ -136,7 +136,9 @@ typedef struct
|
||||
} PEAK_POS ;
|
||||
|
||||
typedef struct
|
||||
{ unsigned int version ; /* version of the PEAK chunk */
|
||||
{ int peak_loc ; /* Write a PEAK chunk at the start or end of the file? */
|
||||
|
||||
unsigned int version ; /* version of the PEAK chunk */
|
||||
unsigned int timestamp ; /* secs since 1/1/1970 */
|
||||
#if HAVE_FLEXIBLE_ARRAY
|
||||
/* the per channel peak info */
|
||||
@ -240,7 +242,6 @@ typedef struct sf_private_tag
|
||||
|
||||
int have_written ; /* Has a single write been done to the file? */
|
||||
int has_peak ; /* Has a PEAK chunk (AIFF and WAVE) been read? */
|
||||
int peak_loc ; /* Write a PEAK chunk at the start or end of the file? */
|
||||
PEAK_CHUNK *pchunk ;
|
||||
|
||||
/* Loop Info */
|
||||
|
10
src/wav.c
10
src/wav.c
@ -190,7 +190,7 @@ wav_open (SF_PRIVATE *psf)
|
||||
if (psf->pchunk == NULL)
|
||||
return SFE_MALLOC_FAILED ;
|
||||
psf->has_peak = SF_TRUE ;
|
||||
psf->peak_loc = SF_PEAK_START ;
|
||||
psf->pchunk->peak_loc = SF_PEAK_START ;
|
||||
} ;
|
||||
|
||||
psf->write_header = (format == SF_FORMAT_WAV) ? wav_write_header : wavex_write_header ;
|
||||
@ -424,7 +424,7 @@ wav_read_header (SF_PRIVATE *psf, int *blockalign, int *framesperblock)
|
||||
} ;
|
||||
|
||||
psf->has_peak = SF_TRUE ; /* Found PEAK chunk. */
|
||||
psf->peak_loc = ((parsestage & HAVE_data) == 0) ? SF_PEAK_START : SF_PEAK_END ;
|
||||
psf->pchunk->peak_loc = ((parsestage & HAVE_data) == 0) ? SF_PEAK_START : SF_PEAK_END ;
|
||||
break ;
|
||||
|
||||
case cue_MARKER :
|
||||
@ -792,7 +792,7 @@ wav_write_header (SF_PRIVATE *psf, int calc_length)
|
||||
if (psf->str_flags & SF_STR_LOCATE_START)
|
||||
wav_write_strings (psf, SF_STR_LOCATE_START) ;
|
||||
|
||||
if (psf->has_peak && psf->peak_loc == SF_PEAK_START)
|
||||
if (psf->has_peak && psf->pchunk->peak_loc == SF_PEAK_START)
|
||||
{ psf_binheader_writef (psf, "em4", PEAK_MARKER,
|
||||
sizeof (PEAK_CHUNK) + psf->sf.channels * sizeof (PEAK_POS)) ;
|
||||
psf_binheader_writef (psf, "e44", 1, time (NULL)) ;
|
||||
@ -969,7 +969,7 @@ wavex_write_header (SF_PRIVATE *psf, int calc_length)
|
||||
if (psf->str_flags & SF_STR_LOCATE_START)
|
||||
wav_write_strings (psf, SF_STR_LOCATE_START) ;
|
||||
|
||||
if (psf->has_peak && psf->peak_loc == SF_PEAK_START)
|
||||
if (psf->has_peak && psf->pchunk->peak_loc == SF_PEAK_START)
|
||||
{ psf_binheader_writef (psf, "em4", PEAK_MARKER,
|
||||
sizeof (PEAK_CHUNK) + psf->sf.channels * sizeof (PEAK_POS)) ;
|
||||
psf_binheader_writef (psf, "e44", 1, time (NULL)) ;
|
||||
@ -1005,7 +1005,7 @@ wav_write_tailer (SF_PRIVATE *psf)
|
||||
psf->dataend = psf_fseek (psf, 0, SEEK_END) ;
|
||||
|
||||
/* Add a PEAK chunk if requested. */
|
||||
if (psf->has_peak && psf->peak_loc == SF_PEAK_END)
|
||||
if (psf->has_peak && psf->pchunk->peak_loc == SF_PEAK_END)
|
||||
{ psf_binheader_writef (psf, "em4", PEAK_MARKER,
|
||||
sizeof (PEAK_CHUNK) + psf->sf.channels * sizeof (PEAK_POS)) ;
|
||||
psf_binheader_writef (psf, "e44", 1, time (NULL)) ;
|
||||
|
Loading…
Reference in New Issue
Block a user