mirror of
https://gitee.com/openharmony/third_party_libsnd
synced 2024-11-23 01:49:53 +00:00
Rename SF_FORMAT_MP3 to SF_FORMAT_MPEG
This commit is contained in:
parent
d2c836d732
commit
dae19b9502
@ -71,7 +71,7 @@ enum
|
|||||||
SF_FORMAT_OGG = 0x200000, /* Xiph OGG container */
|
SF_FORMAT_OGG = 0x200000, /* Xiph OGG container */
|
||||||
SF_FORMAT_MPC2K = 0x210000, /* Akai MPC 2000 sampler */
|
SF_FORMAT_MPC2K = 0x210000, /* Akai MPC 2000 sampler */
|
||||||
SF_FORMAT_RF64 = 0x220000, /* RF64 WAV file */
|
SF_FORMAT_RF64 = 0x220000, /* RF64 WAV file */
|
||||||
SF_FORMAT_MP3 = 0x230000, /* So-called MP3 file. */
|
SF_FORMAT_MPEG = 0x230000, /* MPEG-1/2 audio stream */
|
||||||
|
|
||||||
/* Subtypes from here on. */
|
/* Subtypes from here on. */
|
||||||
|
|
||||||
|
@ -1572,7 +1572,7 @@ str_of_major_format (int format)
|
|||||||
CASE_NAME (SF_FORMAT_CAF) ;
|
CASE_NAME (SF_FORMAT_CAF) ;
|
||||||
CASE_NAME (SF_FORMAT_WVE) ;
|
CASE_NAME (SF_FORMAT_WVE) ;
|
||||||
CASE_NAME (SF_FORMAT_OGG) ;
|
CASE_NAME (SF_FORMAT_OGG) ;
|
||||||
CASE_NAME (SF_FORMAT_MP3) ;
|
CASE_NAME (SF_FORMAT_MPEG) ;
|
||||||
default :
|
default :
|
||||||
break ;
|
break ;
|
||||||
} ;
|
} ;
|
||||||
|
@ -41,8 +41,8 @@
|
|||||||
** This file is concerned only with the most common case of MPEG Layer III
|
** This file is concerned only with the most common case of MPEG Layer III
|
||||||
** audio without a container but with the additional metadata standards.
|
** audio without a container but with the additional metadata standards.
|
||||||
**
|
**
|
||||||
** For the purposes of libsndfile, the major format of SF_FORMAT_MP3 means the
|
** For the purposes of libsndfile, the major format of SF_FORMAT_MPEG means the
|
||||||
** following assumptions. A file of major format type SF_FORMAT_MP3:
|
** following assumptions. A file of major format type SF_FORMAT_MPEG:
|
||||||
** - Contains only layer III audio frames (SF_FORMAT_MPEG_LAYER_III)
|
** - Contains only layer III audio frames (SF_FORMAT_MPEG_LAYER_III)
|
||||||
** - All MPEG frames contained in the file have the same channel count
|
** - All MPEG frames contained in the file have the same channel count
|
||||||
** - All MPEG frames contained in the file have the same samplerate
|
** - All MPEG frames contained in the file have the same samplerate
|
||||||
|
@ -962,7 +962,7 @@ sf_format_check (const SF_INFO *info)
|
|||||||
return 1 ;
|
return 1 ;
|
||||||
break ;
|
break ;
|
||||||
|
|
||||||
case SF_FORMAT_MP3 :
|
case SF_FORMAT_MPEG :
|
||||||
if (info->channels > 2)
|
if (info->channels > 2)
|
||||||
return 0 ;
|
return 0 ;
|
||||||
if (endian != SF_ENDIAN_FILE)
|
if (endian != SF_ENDIAN_FILE)
|
||||||
@ -2760,7 +2760,7 @@ format_from_extension (SF_PRIVATE *psf)
|
|||||||
* MPEG streams are quite tollerate of crap. If we couldn't identify a
|
* MPEG streams are quite tollerate of crap. If we couldn't identify a
|
||||||
* MP3 stream, but it has a .mp3 extension, let libmpg123 have a try.
|
* MP3 stream, but it has a .mp3 extension, let libmpg123 have a try.
|
||||||
*/
|
*/
|
||||||
format = SF_FORMAT_MP3 ;
|
format = SF_FORMAT_MPEG ;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* For RAW files, make sure the dataoffset if set correctly. */
|
/* For RAW files, make sure the dataoffset if set correctly. */
|
||||||
@ -2876,7 +2876,7 @@ retry:
|
|||||||
(buffer [0] & MAKE_MARKER (0, 0x06, 0, 0)) != MAKE_MARKER (0, 0, 0, 0) && /* Valid layer description */
|
(buffer [0] & MAKE_MARKER (0, 0x06, 0, 0)) != MAKE_MARKER (0, 0, 0, 0) && /* Valid layer description */
|
||||||
(buffer [0] & MAKE_MARKER (0, 0, 0xF0, 0)) != MAKE_MARKER (0, 0, 0xF0, 0) && /* Valid bitrate */
|
(buffer [0] & MAKE_MARKER (0, 0, 0xF0, 0)) != MAKE_MARKER (0, 0, 0xF0, 0) && /* Valid bitrate */
|
||||||
(buffer [0] & MAKE_MARKER (0, 0, 0x0C, 0)) != MAKE_MARKER (0, 0, 0x0C, 0)) /* Valid samplerate */
|
(buffer [0] & MAKE_MARKER (0, 0, 0x0C, 0)) != MAKE_MARKER (0, 0, 0x0C, 0)) /* Valid samplerate */
|
||||||
return SF_FORMAT_MP3 ;
|
return SF_FORMAT_MPEG ;
|
||||||
|
|
||||||
if (buffer [0] == MAKE_MARKER ('I', 'D', '3', 2) || buffer [0] == MAKE_MARKER ('I', 'D', '3', 3)
|
if (buffer [0] == MAKE_MARKER ('I', 'D', '3', 2) || buffer [0] == MAKE_MARKER ('I', 'D', '3', 3)
|
||||||
|| buffer [0] == MAKE_MARKER ('I', 'D', '3', 4))
|
|| buffer [0] == MAKE_MARKER ('I', 'D', '3', 4))
|
||||||
@ -2885,7 +2885,7 @@ retry:
|
|||||||
/* Guess MP3, try and open it as such. Allows libmpg123 to parse the ID3v2 headers */
|
/* Guess MP3, try and open it as such. Allows libmpg123 to parse the ID3v2 headers */
|
||||||
if (psf->file.mode == SFM_READ)
|
if (psf->file.mode == SFM_READ)
|
||||||
{ if (mp3_open (psf) == 0)
|
{ if (mp3_open (psf) == 0)
|
||||||
return SF_FORMAT_MP3 | ((~SF_FORMAT_TYPEMASK) & psf->sf.format) ;
|
return SF_FORMAT_MPEG | ((~SF_FORMAT_TYPEMASK) & psf->sf.format) ;
|
||||||
else if (psf->codec_close)
|
else if (psf->codec_close)
|
||||||
psf->codec_close (psf) ;
|
psf->codec_close (psf) ;
|
||||||
} ;
|
} ;
|
||||||
@ -3269,7 +3269,7 @@ psf_open_file (SF_PRIVATE *psf, SF_INFO *sfinfo)
|
|||||||
error = mpc2k_open (psf) ;
|
error = mpc2k_open (psf) ;
|
||||||
break ;
|
break ;
|
||||||
|
|
||||||
case SF_FORMAT_MP3 :
|
case SF_FORMAT_MPEG :
|
||||||
error = mp3_open (psf) ;
|
error = mp3_open (psf) ;
|
||||||
break ;
|
break ;
|
||||||
|
|
||||||
@ -3293,7 +3293,7 @@ psf_open_file (SF_PRIVATE *psf, SF_INFO *sfinfo)
|
|||||||
/* Actual embedded files. */
|
/* Actual embedded files. */
|
||||||
break ;
|
break ;
|
||||||
|
|
||||||
case SF_FORMAT_MP3 :
|
case SF_FORMAT_MPEG :
|
||||||
case SF_FORMAT_FLAC :
|
case SF_FORMAT_FLAC :
|
||||||
/* Flac with an ID3v2 header? */
|
/* Flac with an ID3v2 header? */
|
||||||
break ;
|
break ;
|
||||||
|
@ -223,7 +223,7 @@ main (int argc, char *argv [])
|
|||||||
|
|
||||||
if (all_tests || strcmp (argv [1], "mpeg") == 0)
|
if (all_tests || strcmp (argv [1], "mpeg") == 0)
|
||||||
{ if (HAVE_MPEG)
|
{ if (HAVE_MPEG)
|
||||||
{ compression_size_test (SF_FORMAT_MP3 | SF_FORMAT_MPEG_LAYER_III, "mpeg.mp3") ;
|
{ compression_size_test (SF_FORMAT_MPEG | SF_FORMAT_MPEG_LAYER_III, "mpeg.mp3") ;
|
||||||
tests ++ ;
|
tests ++ ;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -128,7 +128,7 @@ main (int argc, char *argv [])
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if HAVE_MPEG
|
#if HAVE_MPEG
|
||||||
float_scaled_test ("mpeg.mp3", allow_exit, SF_FALSE, SF_FORMAT_MP3 | SF_FORMAT_MPEG_LAYER_III, -52.0) ;
|
float_scaled_test ("mpeg.mp3", allow_exit, SF_FALSE, SF_FORMAT_MPEG | SF_FORMAT_MPEG_LAYER_III, -52.0) ;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
float_scaled_test ("replace_float.raw", allow_exit, SF_TRUE, SF_ENDIAN_LITTLE | SF_FORMAT_RAW | SF_FORMAT_FLOAT, -163.0) ;
|
float_scaled_test ("replace_float.raw", allow_exit, SF_TRUE, SF_ENDIAN_LITTLE | SF_FORMAT_RAW | SF_FORMAT_FLOAT, -163.0) ;
|
||||||
@ -190,7 +190,7 @@ main (int argc, char *argv [])
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if HAVE_MPEG
|
#if HAVE_MPEG
|
||||||
double_scaled_test ("mpeg.mp3", allow_exit, SF_FALSE, SF_FORMAT_MP3 | SF_FORMAT_MPEG_LAYER_III, -52.0) ;
|
double_scaled_test ("mpeg.mp3", allow_exit, SF_FALSE, SF_FORMAT_MPEG | SF_FORMAT_MPEG_LAYER_III, -52.0) ;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
double_scaled_test ("replace_double.raw", allow_exit, SF_TRUE, SF_FORMAT_RAW | SF_FORMAT_DOUBLE, -201.0) ;
|
double_scaled_test ("replace_double.raw", allow_exit, SF_TRUE, SF_FORMAT_RAW | SF_FORMAT_DOUBLE, -201.0) ;
|
||||||
|
@ -68,7 +68,7 @@ mp3_short_test (void)
|
|||||||
memset (&sfinfo, 0, sizeof (sfinfo)) ;
|
memset (&sfinfo, 0, sizeof (sfinfo)) ;
|
||||||
|
|
||||||
/* Set up output file type. */
|
/* Set up output file type. */
|
||||||
sfinfo.format = SF_FORMAT_MP3 | SF_FORMAT_MPEG_LAYER_III ;
|
sfinfo.format = SF_FORMAT_MPEG | SF_FORMAT_MPEG_LAYER_III ;
|
||||||
sfinfo.channels = 1 ;
|
sfinfo.channels = 1 ;
|
||||||
sfinfo.samplerate = SAMPLE_RATE ;
|
sfinfo.samplerate = SAMPLE_RATE ;
|
||||||
|
|
||||||
@ -126,7 +126,7 @@ mp3_int_test (void)
|
|||||||
memset (&sfinfo, 0, sizeof (sfinfo)) ;
|
memset (&sfinfo, 0, sizeof (sfinfo)) ;
|
||||||
|
|
||||||
/* Set up output file type. */
|
/* Set up output file type. */
|
||||||
sfinfo.format = SF_FORMAT_MP3 | SF_FORMAT_MPEG_LAYER_III ;
|
sfinfo.format = SF_FORMAT_MPEG | SF_FORMAT_MPEG_LAYER_III ;
|
||||||
sfinfo.channels = 1 ;
|
sfinfo.channels = 1 ;
|
||||||
sfinfo.samplerate = SAMPLE_RATE ;
|
sfinfo.samplerate = SAMPLE_RATE ;
|
||||||
|
|
||||||
@ -175,7 +175,7 @@ mp3_float_test (void)
|
|||||||
memset (&sfinfo, 0, sizeof (sfinfo)) ;
|
memset (&sfinfo, 0, sizeof (sfinfo)) ;
|
||||||
|
|
||||||
/* Set up output file type. */
|
/* Set up output file type. */
|
||||||
sfinfo.format = SF_FORMAT_MP3 | SF_FORMAT_MPEG_LAYER_III ;
|
sfinfo.format = SF_FORMAT_MPEG | SF_FORMAT_MPEG_LAYER_III ;
|
||||||
sfinfo.channels = 1 ;
|
sfinfo.channels = 1 ;
|
||||||
sfinfo.samplerate = SAMPLE_RATE ;
|
sfinfo.samplerate = SAMPLE_RATE ;
|
||||||
|
|
||||||
@ -224,7 +224,7 @@ mp3_double_test (void)
|
|||||||
memset (&sfinfo, 0, sizeof (sfinfo)) ;
|
memset (&sfinfo, 0, sizeof (sfinfo)) ;
|
||||||
|
|
||||||
/* Set up output file type. */
|
/* Set up output file type. */
|
||||||
sfinfo.format = SF_FORMAT_MP3 | SF_FORMAT_MPEG_LAYER_III ;
|
sfinfo.format = SF_FORMAT_MPEG | SF_FORMAT_MPEG_LAYER_III ;
|
||||||
sfinfo.channels = 1 ;
|
sfinfo.channels = 1 ;
|
||||||
sfinfo.samplerate = SAMPLE_RATE ;
|
sfinfo.samplerate = SAMPLE_RATE ;
|
||||||
|
|
||||||
@ -339,7 +339,7 @@ main (void)
|
|||||||
mp3_float_test () ;
|
mp3_float_test () ;
|
||||||
mp3_double_test () ;
|
mp3_double_test () ;
|
||||||
|
|
||||||
mp3_stereo_seek_test ("mpeg_seek.mp3", SF_FORMAT_MP3 | SF_FORMAT_MPEG_LAYER_III) ;
|
mp3_stereo_seek_test ("mpeg_seek.mp3", SF_FORMAT_MPEG | SF_FORMAT_MPEG_LAYER_III) ;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
puts (" No MPEG tests because mpg123/lame support was not compiled in.") ;
|
puts (" No MPEG tests because mpg123/lame support was not compiled in.") ;
|
||||||
|
@ -117,7 +117,7 @@ main (int argc, char *argv [])
|
|||||||
|
|
||||||
if (do_all || ! strcmp (argv [1], "mpeg"))
|
if (do_all || ! strcmp (argv [1], "mpeg"))
|
||||||
{ if (HAVE_MPEG)
|
{ if (HAVE_MPEG)
|
||||||
string_start_test ("mpeg.mp3", SF_FORMAT_MP3 | SF_FORMAT_MPEG_LAYER_III) ;
|
string_start_test ("mpeg.mp3", SF_FORMAT_MPEG | SF_FORMAT_MPEG_LAYER_III) ;
|
||||||
else
|
else
|
||||||
puts (" No MP3 tests because MPEG support was not compiled in.") ;
|
puts (" No MP3 tests because MPEG support was not compiled in.") ;
|
||||||
test_count++ ;
|
test_count++ ;
|
||||||
@ -384,7 +384,7 @@ string_start_test (const char *filename, int formattype)
|
|||||||
break ;
|
break ;
|
||||||
|
|
||||||
case SF_FORMAT_OGG | SF_FORMAT_VORBIS :
|
case SF_FORMAT_OGG | SF_FORMAT_VORBIS :
|
||||||
case SF_FORMAT_MP3 | SF_FORMAT_MPEG_LAYER_III :
|
case SF_FORMAT_MPEG | SF_FORMAT_MPEG_LAYER_III :
|
||||||
break ;
|
break ;
|
||||||
|
|
||||||
default :
|
default :
|
||||||
@ -403,7 +403,7 @@ string_start_test (const char *filename, int formattype)
|
|||||||
sf_set_string (file, SF_STR_COMMENT, comment) ;
|
sf_set_string (file, SF_STR_COMMENT, comment) ;
|
||||||
sf_set_string (file, SF_STR_ALBUM, album) ;
|
sf_set_string (file, SF_STR_ALBUM, album) ;
|
||||||
sf_set_string (file, SF_STR_LICENSE, license) ;
|
sf_set_string (file, SF_STR_LICENSE, license) ;
|
||||||
if (typemajor == SF_FORMAT_MP3)
|
if (typemajor == SF_FORMAT_MPEG)
|
||||||
{ sf_set_string (file, SF_STR_GENRE, id3v1_genre) ;
|
{ sf_set_string (file, SF_STR_GENRE, id3v1_genre) ;
|
||||||
sf_set_string (file, SF_STR_DATE, year) ;
|
sf_set_string (file, SF_STR_DATE, year) ;
|
||||||
}
|
}
|
||||||
@ -432,7 +432,7 @@ string_start_test (const char *filename, int formattype)
|
|||||||
printf (" Bad filename : %s\n", cptr) ;
|
printf (" Bad filename : %s\n", cptr) ;
|
||||||
} ;
|
} ;
|
||||||
|
|
||||||
if (typemajor != SF_FORMAT_MP3)
|
if (typemajor != SF_FORMAT_MPEG)
|
||||||
{ cptr = sf_get_string (file, SF_STR_COPYRIGHT) ;
|
{ cptr = sf_get_string (file, SF_STR_COPYRIGHT) ;
|
||||||
if (cptr == NULL || strcmp (copyright, cptr) != 0)
|
if (cptr == NULL || strcmp (copyright, cptr) != 0)
|
||||||
{ if (errors++ == 0)
|
{ if (errors++ == 0)
|
||||||
@ -454,7 +454,7 @@ string_start_test (const char *filename, int formattype)
|
|||||||
} ;
|
} ;
|
||||||
} ;
|
} ;
|
||||||
|
|
||||||
if (typemajor == SF_FORMAT_MP3)
|
if (typemajor == SF_FORMAT_MPEG)
|
||||||
{ cptr = sf_get_string (file, SF_STR_GENRE) ;
|
{ cptr = sf_get_string (file, SF_STR_GENRE) ;
|
||||||
if (cptr == NULL || strcmp (id3v1_genre, cptr) != 0)
|
if (cptr == NULL || strcmp (id3v1_genre, cptr) != 0)
|
||||||
{ if (errors++ == 0)
|
{ if (errors++ == 0)
|
||||||
@ -482,7 +482,7 @@ string_start_test (const char *filename, int formattype)
|
|||||||
/* not supported */
|
/* not supported */
|
||||||
break ;
|
break ;
|
||||||
|
|
||||||
case SF_FORMAT_MP3 :
|
case SF_FORMAT_MPEG :
|
||||||
/* id3 only supports years */
|
/* id3 only supports years */
|
||||||
cptr = sf_get_string (file, SF_STR_DATE) ;
|
cptr = sf_get_string (file, SF_STR_DATE) ;
|
||||||
if (cptr == NULL || strcmp (year, cptr) != 0)
|
if (cptr == NULL || strcmp (year, cptr) != 0)
|
||||||
@ -515,7 +515,7 @@ string_start_test (const char *filename, int formattype)
|
|||||||
{ case SF_FORMAT_WAV :
|
{ case SF_FORMAT_WAV :
|
||||||
case SF_FORMAT_AIFF :
|
case SF_FORMAT_AIFF :
|
||||||
case SF_FORMAT_RF64 :
|
case SF_FORMAT_RF64 :
|
||||||
case SF_FORMAT_MP3 :
|
case SF_FORMAT_MPEG :
|
||||||
/* not supported */
|
/* not supported */
|
||||||
break ;
|
break ;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user