mirror of
https://gitee.com/openharmony/third_party_libsnd
synced 2024-11-23 01:49:53 +00:00
mpeg: Disable experimental writing MPEG subformats in WAV
This commit is contained in:
parent
4b8209e650
commit
d1c87ec1c7
10
src/wav.c
10
src/wav.c
@ -207,6 +207,14 @@ wav_open (SF_PRIVATE *psf)
|
||||
psf->sf.frames = 0 ;
|
||||
} ;
|
||||
|
||||
#if (ENABLE_EXPERIMENTAL_CODE == 0)
|
||||
/* For now, don't support writing MPEGLAYER3 WAVs, as we can't guarentee that
|
||||
** such a file written by libsndfile would have the same length when opened again.
|
||||
*/
|
||||
if (subformat == SF_FORMAT_MPEG_LAYER_III)
|
||||
return SFE_UNSUPPORTED_ENCODING ;
|
||||
#endif
|
||||
|
||||
if (subformat == SF_FORMAT_IMA_ADPCM || subformat == SF_FORMAT_MS_ADPCM)
|
||||
{ blockalign = wavlike_srate2blocksize (psf->sf.samplerate * psf->sf.channels) ;
|
||||
framesperblock = -1 ; /* Corrected later. */
|
||||
@ -944,6 +952,7 @@ wav_write_fmt_chunk (SF_PRIVATE *psf)
|
||||
add_fact_chunk = SF_TRUE ;
|
||||
break ;
|
||||
|
||||
#if (ENABLE_EXPERIMENTAL_CODE == 0)
|
||||
case SF_FORMAT_MPEG_LAYER_III :
|
||||
{ int bytespersec, blockalign, flags, blocksize, samplesperblock, codecdelay ;
|
||||
|
||||
@ -994,6 +1003,7 @@ wav_write_fmt_chunk (SF_PRIVATE *psf)
|
||||
|
||||
add_fact_chunk = SF_TRUE ;
|
||||
break ;
|
||||
#endif
|
||||
|
||||
default : return SFE_UNIMPLEMENTED ;
|
||||
} ;
|
||||
|
@ -126,6 +126,11 @@ format_combo_test (void)
|
||||
subtype_fmt_info.format == SF_FORMAT_MPEG_LAYER_II)
|
||||
continue ;
|
||||
|
||||
/* MPEG Layer III in WAV is decode only currently */
|
||||
if (subtype_fmt_info.format == SF_FORMAT_MPEG_LAYER_III &&
|
||||
major_fmt_info.format == SF_FORMAT_WAV)
|
||||
continue ;
|
||||
|
||||
snprintf (filename, sizeof (filename), "format-check.%s", major_fmt_info.extension) ;
|
||||
|
||||
sndfile = sf_open (filename, SFM_WRITE, &info) ;
|
||||
|
Loading…
Reference in New Issue
Block a user