diff --git a/ThirdParty/flac/README.md b/ThirdParty/flac/README.md index 764c973f7..4b865b193 100644 --- a/ThirdParty/flac/README.md +++ b/ThirdParty/flac/README.md @@ -10,9 +10,9 @@ And some minor tweaks with `install_name_tool -id` to make sure that the resulting libFLAC.12.dylib referred to itself with @rpath and not full paths of the build directory, and imported libogg.0.dylib with an @rpath. -Version 1.3.3-235-g772efde6 was used from the following repository: +Version 1.4.1 was used from the official source code download: -https://github.com/xiph/flac.git +https://downloads.xiph.org/releases/flac/flac-1.4.1.tar.xz x86_64 and arm64 were built separately, to allow for intrinsic functions to be used for x86_64. diff --git a/ThirdParty/flac/include/FLAC/FLAC_assert.h b/ThirdParty/flac/include/FLAC/FLAC_assert.h index 55b34777b..aee23c8c0 100644 --- a/ThirdParty/flac/include/FLAC/FLAC_assert.h +++ b/ThirdParty/flac/include/FLAC/FLAC_assert.h @@ -1,6 +1,6 @@ /* libFLAC - Free Lossless Audio Codec library * Copyright (C) 2001-2009 Josh Coalson - * Copyright (C) 2011-2016 Xiph.Org Foundation + * Copyright (C) 2011-2022 Xiph.Org Foundation * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions diff --git a/ThirdParty/flac/include/FLAC/all.h b/ThirdParty/flac/include/FLAC/all.h index 9d5c88a05..0c60249e8 100644 --- a/ThirdParty/flac/include/FLAC/all.h +++ b/ThirdParty/flac/include/FLAC/all.h @@ -1,6 +1,6 @@ /* libFLAC - Free Lossless Audio Codec library * Copyright (C) 2000-2009 Josh Coalson - * Copyright (C) 2011-2016 Xiph.Org Foundation + * Copyright (C) 2011-2022 Xiph.Org Foundation * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -357,6 +357,85 @@ * \c FLAC__FRAME_HEADER_BLOCKING_STRATEGY_LEN */ +/** \defgroup porting_1_3_4_to_1_4_0 Porting from FLAC 1.3.4 to 1.4.0 + * \ingroup porting + * + * \brief + * This module describes porting from FLAC 1.3.4 to FLAC 1.4.0. + * + * \section porting_1_3_4_to_1_4_0_summary Summary + * + * Between FLAC 1.3.4 and FLAC 1.4.0, there have four breaking changes + * - the function get_client_data_from_decoder has been renamed to + * FLAC__get_decoder_client_data + * - some data types in the FLAC__Frame struct have changed + * - all functions resizing metadata blocks now return the object + * untouched if memory allocation fails, whereas previously the + * handling varied and was more or less undefined + * - all functions accepting a filename now take UTF-8 encoded filenames + * on Windows instead of filenames in the current codepage + * + * Furthermore, there have been the following additions + * - the functions FLAC__stream_encoder_set_limit_min_bitrate, + * FLAC__stream_encoder_get_limit_min_bitrate, + * FLAC::encoder::file::set_limit_min_bitrate() and + * FLAC::encoder::file::get_limit_min_bitrate() have been added + * - Added FLAC__STREAM_DECODER_ERROR_STATUS_BAD_METADATA to the + * FLAC__StreamDecoderErrorStatus enum + * + * \section porting_1_3_4_to_1_4_0_breaking Breaking changes + * + * The function \b get_client_data_from_decoder was added in FLAC 1.3.3 + * but did not follow the API naming convention and was not properly + * exported. The function is now renamed and properly integrated as + * FLAC__stream_decoder_get_client_data + * + * To accomodate encoding and decoding 32-bit int PCM, some data types + * in the \b FLAC__frame struct were changed. Specifically, warmup + * in both the FLAC__Subframe_Fixed struc and the FLAC__Subframe_LPC + * struct is changed from FLAC__int32 to FLAC__int64. Also, value + * in the FLAC__Subframe_Constant is changed from FLAC__int32 to + * FLAC__int64. Finally, in FLAC__Subframe_Verbatim struct data is + * changes from a FLAC__int32 array to a union containing a FLAC__int32 + * array and a FLAC__int64 array. Also, a new member is added, + * data_type, which clarifies whether the FLAC__int32 or FLAC__int64 + * array is in use. + * + * Furthermore, the following functions now return the object untouched + * if memory allocation fails, whereas previously the handling varied + * and was more or less undefined + * + * - FLAC__metadata_object_seektable_resize_points + * - FLAC__metadata_object_vorbiscomment_resize_comments + * - FLAC__metadata_object_cuesheet_track_resize_indices + * - FLAC__metadata_object_cuesheet_resize_tracks + * + * The last breaking change is that all API functions taking a filename + * as an argument now, on Windows, must be supplied with that filename + * in the UTF-8 character encoding instead of using the current code + * page. libFLAC internally translates these UTF-8 encoded filenames to + * an appropriate representation to use with _wfopen. On all other + * systems, filename is passed to fopen without any translation, as it + * in libFLAC 1.3.4 and earlier. + * + * \section porting_1_3_4_to_1_4_0_additions Additions + * + * To aid in creating properly streamable FLAC files, a set of functions + * was added to make it possible to enfore a minimum bitrate to files + * created through libFLAC's stream_encoder.h interface. With this + * function enabled the resulting FLAC files have a minimum bitrate of + * 1bit/sample independent of the number of channels, i.e. 48kbit/s for + * 48kHz. This can be beneficial for streaming, as very low bitrates for + * silent sections compressed with 'constant' subframes can result in a + * bitrate of 1kbit/s, creating problems with clients that aren't aware + * of this possibility and buffer too much data. + * + * Finally, FLAC__STREAM_DECODER_ERROR_STATUS_BAD_METADATA was added to + * the FLAC__StreamDecoderErrorStatus enum to signal that the decoder + * encountered unreadable metadata. + * + */ + /** \defgroup flac FLAC C API * * The FLAC C API is the interface to libFLAC, a set of structures diff --git a/ThirdParty/flac/include/FLAC/callback.h b/ThirdParty/flac/include/FLAC/callback.h index 38e23002b..d00878b6c 100644 --- a/ThirdParty/flac/include/FLAC/callback.h +++ b/ThirdParty/flac/include/FLAC/callback.h @@ -1,6 +1,6 @@ /* libFLAC - Free Lossless Audio Codec library * Copyright (C) 2004-2009 Josh Coalson - * Copyright (C) 2011-2016 Xiph.Org Foundation + * Copyright (C) 2011-2022 Xiph.Org Foundation * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -168,12 +168,12 @@ typedef int (*FLAC__IOCallback_Close) (FLAC__IOHandle handle); * a data source is not seekable by setting the \a seek field to \c NULL. */ typedef struct { - FLAC__IOCallback_Read read; - FLAC__IOCallback_Write write; - FLAC__IOCallback_Seek seek; - FLAC__IOCallback_Tell tell; - FLAC__IOCallback_Eof eof; - FLAC__IOCallback_Close close; + FLAC__IOCallback_Read read; /**< See FLAC__IOCallbacks */ + FLAC__IOCallback_Write write; /**< See FLAC__IOCallbacks */ + FLAC__IOCallback_Seek seek; /**< See FLAC__IOCallbacks */ + FLAC__IOCallback_Tell tell; /**< See FLAC__IOCallbacks */ + FLAC__IOCallback_Eof eof; /**< See FLAC__IOCallbacks */ + FLAC__IOCallback_Close close; /**< See FLAC__IOCallbacks */ } FLAC__IOCallbacks; /* \} */ diff --git a/ThirdParty/flac/include/FLAC/export.h b/ThirdParty/flac/include/FLAC/export.h index 70b200db8..983f13b18 100644 --- a/ThirdParty/flac/include/FLAC/export.h +++ b/ThirdParty/flac/include/FLAC/export.h @@ -1,6 +1,6 @@ /* libFLAC - Free Lossless Audio Codec library * Copyright (C) 2000-2009 Josh Coalson - * Copyright (C) 2011-2016 Xiph.Org Foundation + * Copyright (C) 2011-2022 Xiph.Org Foundation * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -49,13 +49,24 @@ * This module contains \#defines and symbols for exporting function * calls, and providing version information and compiled-in features. * - * If you are compiling with MSVC and will link to the static library - * (libFLAC.lib) you should define FLAC__NO_DLL in your project to - * make sure the symbols are exported properly. + * If you are compiling for Windows (with Visual Studio or MinGW for + * example) and will link to the static library (libFLAC++.lib) you + * should define FLAC__NO_DLL in your project to make sure the symbols + * are exported properly. * * \{ */ +/** This \#define is used internally in libFLAC and its headers to make + * sure the correct symbols are exported when working with shared + * libraries. On Windows, this \#define is set to __declspec(dllexport) + * when compiling libFLAC into a library and to __declspec(dllimport) + * when the headers are used to link to that DLL. On non-Windows systems + * it is used to set symbol visibility. + * + * Because of this, the define FLAC__NO_DLL must be defined when linking + * to libFLAC statically or linking will fail. + */ /* This has grown quite complicated. FLAC__NO_DLL is used by MSVC sln * files and CMake, which build either static or shared. autotools can * build static, shared or **both**. Therefore, DLL_EXPORT, which is set diff --git a/ThirdParty/flac/include/FLAC/format.h b/ThirdParty/flac/include/FLAC/format.h index 3e8d7e55e..99d637f05 100644 --- a/ThirdParty/flac/include/FLAC/format.h +++ b/ThirdParty/flac/include/FLAC/format.h @@ -1,6 +1,6 @@ /* libFLAC - Free Lossless Audio Codec library * Copyright (C) 2000-2009 Josh Coalson - * Copyright (C) 2011-2016 Xiph.Org Foundation + * Copyright (C) 2011-2022 Xiph.Org Foundation * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -120,8 +120,7 @@ extern "C" { #define FLAC__REFERENCE_CODEC_MAX_BITS_PER_SAMPLE (32u) /** The maximum sample rate permitted by the format. The value is - * ((2 ^ 16) - 1) * 10; see FLAC format - * as to why. + * ((2 ^ 20) - 1) */ #define FLAC__MAX_SAMPLE_RATE (1048575u) @@ -839,7 +838,7 @@ typedef struct { /** FLAC metadata block structure. (c.f. format specification) */ -typedef struct { +typedef struct FLAC__StreamMetadata { FLAC__MetadataType type; /**< The type of the metadata block; used determine which member of the * \a data union to dereference. If type >= FLAC__METADATA_TYPE_UNDEFINED diff --git a/ThirdParty/flac/include/FLAC/metadata.h b/ThirdParty/flac/include/FLAC/metadata.h index 4c67b87f6..bf1bffe4f 100644 --- a/ThirdParty/flac/include/FLAC/metadata.h +++ b/ThirdParty/flac/include/FLAC/metadata.h @@ -1,6 +1,6 @@ /* libFLAC - Free Lossless Audio Codec library * Copyright (C) 2001-2009 Josh Coalson - * Copyright (C) 2011-2016 Xiph.Org Foundation + * Copyright (C) 2011-2022 Xiph.Org Foundation * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -134,6 +134,11 @@ extern "C" { * STREAMINFO, VORBIS_COMMENT, CUESHEET, and PICTURE blocks, requiring * only a filename. * + * On Windows, filename must be a UTF-8 encoded filename, which libFLAC + * internally translates to an appropriate representation to use with + * _wfopen. On all other systems, filename is passed to fopen without + * any translation. + * * They try to skip any ID3v2 tag at the head of the file. * * \{ @@ -387,6 +392,11 @@ FLAC_API FLAC__Metadata_SimpleIteratorStatus FLAC__metadata_simple_iterator_stat /** Initialize the iterator to point to the first metadata block in the * given FLAC file. * + * On Windows, filename must be a UTF-8 encoded filename, which libFLAC + * internally translates to an appropriate representation to use with + * _wfopen. On all other systems, filename is passed to fopen without + * any translation. + * * \param iterator A pointer to an existing iterator. * \param filename The path to the FLAC file. * \param read_only If \c true, the FLAC file will be opened @@ -819,6 +829,11 @@ FLAC_API void FLAC__metadata_chain_delete(FLAC__Metadata_Chain *chain); FLAC_API FLAC__Metadata_ChainStatus FLAC__metadata_chain_status(FLAC__Metadata_Chain *chain); /** Read all metadata from a FLAC file into the chain. + * + * On Windows, filename must be a UTF-8 encoded filename, which libFLAC + * internally translates to an appropriate representation to use with + * _wfopen. On all other systems, filename is passed to fopen without + * any translation. * * \param chain A pointer to an existing chain. * \param filename The path to the FLAC file to read. @@ -833,6 +848,11 @@ FLAC_API FLAC__Metadata_ChainStatus FLAC__metadata_chain_status(FLAC__Metadata_C FLAC_API FLAC__bool FLAC__metadata_chain_read(FLAC__Metadata_Chain *chain, const char *filename); /** Read all metadata from an Ogg FLAC file into the chain. + * + * On Windows, filename must be a UTF-8 encoded filename, which libFLAC + * internally translates to an appropriate representation to use with + * _wfopen. On all other systems, filename is passed to fopen without + * any translation. * * \note Ogg FLAC metadata data writing is not supported yet and * FLAC__metadata_chain_write() will fail. @@ -1378,7 +1398,8 @@ FLAC_API FLAC__bool FLAC__metadata_object_application_set_data(FLAC__StreamMetad /** Resize the seekpoint array. * * If the size shrinks, elements will truncated; if it grows, new placeholder - * points will be added to the end. + * points will be added to the end. If this function returns false, the + * object is left untouched. * * \param object A pointer to an existing SEEKTABLE object. * \param new_num_points The desired length of the array; may be \c 0. @@ -1591,7 +1612,8 @@ FLAC_API FLAC__bool FLAC__metadata_object_vorbiscomment_set_vendor_string(FLAC__ /** Resize the comment array. * * If the size shrinks, elements will truncated; if it grows, new empty - * fields will be added to the end. + * fields will be added to the end. If this function returns false, the + * object is left untouched. * * \param object A pointer to an existing VORBIS_COMMENT object. * \param new_num_comments The desired length of the array; may be \c 0. @@ -1871,7 +1893,8 @@ FLAC_API void FLAC__metadata_object_cuesheet_track_delete(FLAC__StreamMetadata_C /** Resize a track's index point array. * * If the size shrinks, elements will truncated; if it grows, new blank - * indices will be added to the end. + * indices will be added to the end. If this function returns false, the + * track object is left untouched. * * \param object A pointer to an existing CUESHEET object. * \param track_num The index of the track to modify. NOTE: this is not @@ -1957,7 +1980,8 @@ FLAC_API FLAC__bool FLAC__metadata_object_cuesheet_track_delete_index(FLAC__Stre /** Resize the track array. * * If the size shrinks, elements will truncated; if it grows, new blank - * tracks will be added to the end. + * tracks will be added to the end. If this function returns false, the + * object is left untouched. * * \param object A pointer to an existing CUESHEET object. * \param new_num_tracks The desired length of the array; may be \c 0. diff --git a/ThirdParty/flac/include/FLAC/ordinals.h b/ThirdParty/flac/include/FLAC/ordinals.h index 75b830d65..77757d660 100644 --- a/ThirdParty/flac/include/FLAC/ordinals.h +++ b/ThirdParty/flac/include/FLAC/ordinals.h @@ -1,6 +1,6 @@ /* libFLAC - Free Lossless Audio Codec library * Copyright (C) 2000-2009 Josh Coalson - * Copyright (C) 2011-2016 Xiph.Org Foundation + * Copyright (C) 2011-2022 Xiph.Org Foundation * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions diff --git a/ThirdParty/flac/include/FLAC/stream_decoder.h b/ThirdParty/flac/include/FLAC/stream_decoder.h index 533ad192f..2d285aecd 100644 --- a/ThirdParty/flac/include/FLAC/stream_decoder.h +++ b/ThirdParty/flac/include/FLAC/stream_decoder.h @@ -1,6 +1,6 @@ /* libFLAC - Free Lossless Audio Codec library * Copyright (C) 2000-2009 Josh Coalson - * Copyright (C) 2011-2016 Xiph.Org Foundation + * Copyright (C) 2011-2022 Xiph.Org Foundation * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -1285,8 +1285,9 @@ FLAC_API FLAC__StreamDecoderInitStatus FLAC__stream_decoder_init_ogg_FILE( * and provide callbacks for the I/O. * * On Windows, filename must be a UTF-8 encoded filename, which libFLAC - * internally translates to a appropriate representation to use with - * _wfopen + * internally translates to an appropriate representation to use with + * _wfopen. On all other systems, filename is passed to fopen without + * any translation. * * This function should be called after FLAC__stream_decoder_new() and * FLAC__stream_decoder_set_*() but before any of the @@ -1330,8 +1331,9 @@ FLAC_API FLAC__StreamDecoderInitStatus FLAC__stream_decoder_init_file( * and provide callbacks for the I/O. * * On Windows, filename must be a UTF-8 encoded filename, which libFLAC - * internally translates to a appropriate representation to use with - * _wfopen + * internally translates to an appropriate representation to use with + * _wfopen. On all other systems, filename is passed to fopen without + * any translation. * * This function should be called after FLAC__stream_decoder_new() and * FLAC__stream_decoder_set_*() but before any of the diff --git a/ThirdParty/flac/include/FLAC/stream_encoder.h b/ThirdParty/flac/include/FLAC/stream_encoder.h index de66de549..1d7bd258f 100644 --- a/ThirdParty/flac/include/FLAC/stream_encoder.h +++ b/ThirdParty/flac/include/FLAC/stream_encoder.h @@ -1,6 +1,6 @@ /* libFLAC - Free Lossless Audio Codec library * Copyright (C) 2000-2009 Josh Coalson - * Copyright (C) 2011-2016 Xiph.Org Foundation + * Copyright (C) 2011-2022 Xiph.Org Foundation * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -311,8 +311,7 @@ typedef enum { FLAC__STREAM_ENCODER_INIT_STATUS_INVALID_BITS_PER_SAMPLE, /**< The encoder has an invalid setting for bits-per-sample. - * FLAC supports 4-32 bps but the reference encoder currently supports - * only up to 24 bps. + * FLAC supports 4-32 bps. */ FLAC__STREAM_ENCODER_INIT_STATUS_INVALID_SAMPLE_RATE, @@ -843,15 +842,15 @@ FLAC_API FLAC__bool FLAC__stream_encoder_set_sample_rate(FLAC__StreamEncoder *en * max residual partition order * rice parameter search dist * - * 0 false false tukey(0.5) 0 0 false false false 0 3 0 - * 1 true true tukey(0.5) 0 0 false false false 0 3 0 - * 2 true false tukey(0.5) 0 0 false false false 0 3 0 - * 3 false false tukey(0.5) 6 0 false false false 0 4 0 - * 4 true true tukey(0.5) 8 0 false false false 0 4 0 - * 5 true false tukey(0.5) 8 0 false false false 0 5 0 - * 6 true false tukey(0.5);partial_tukey(2) 8 0 false false false 0 6 0 - * 7 true false tukey(0.5);partial_tukey(2) 12 0 false false false 0 6 0 - * 8 true false tukey(0.5);partial_tukey(2);punchout_tukey(3) 12 0 false false false 0 6 0 + * 0 false false tukey(0.5) 0 0 false false false 0 3 0 + * 1 true true tukey(0.5) 0 0 false false false 0 3 0 + * 2 true false tukey(0.5) 0 0 false false false 0 3 0 + * 3 false false tukey(0.5) 6 0 false false false 0 4 0 + * 4 true true tukey(0.5) 8 0 false false false 0 4 0 + * 5 true false tukey(0.5) 8 0 false false false 0 5 0 + * 6 true false subdivide_tukey(2) 8 0 false false false 0 6 0 + * 7 true false subdivide_tukey(2) 12 0 false false false 0 6 0 + * 8 true false subdivide_tukey(2) 12 0 false false false 0 6 0 * * * \default \c 5 @@ -921,7 +920,7 @@ FLAC_API FLAC__bool FLAC__stream_encoder_set_loose_mid_side_stereo(FLAC__StreamE * \c blackman, \c blackman_harris_4term_92db, \c connes, \c flattop, * \c gauss(STDDEV), \c hamming, \c hann, \c kaiser_bessel, \c nuttall, * \c rectangle, \c triangle, \c tukey(P), \c partial_tukey(n[/ov[/P]]), - * \c punchout_tukey(n[/ov[/P]]), \c welch. + * \c punchout_tukey(n[/ov[/P]]), \c subdivide_tukey(n[/P]), \c welch. * * For \c gauss(STDDEV), STDDEV specifies the standard deviation * (0