| 1 |
Praats/external/flac/READ_ME.TXT |
| 2 |
Paul Boersma, 29 December 2025 |
| 3 |
|
| 4 |
This file describes the adaptations to the FLAC 1.5.0 sources |
| 5 |
that are needed to make them compatible with Praat. |
| 6 |
|
| 7 |
The FLAC sources are distributed over multiple folders, which are in different deep |
| 8 |
branches of the FLAC root folder, as listed below. We flatten this hierarchy as shown. |
| 9 |
|
| 10 |
flac-1.5.0 |
| 11 |
config.cmake.h.in -> flac_config.h BUT COMPLETELY CHANGED |
| 12 |
include |
| 13 |
FLAC |
| 14 |
all.h -> UNUSED |
| 15 |
assert.h -> flac_FLAC_assert.h |
| 16 |
callback.h -> flac_FLAC_callback.h |
| 17 |
export.h -> flac_FLAC_export.h |
| 18 |
format.h -> flac_FLAC_format.h |
| 19 |
metadata.h -> flac_FLAC_metadata.h |
| 20 |
ordinals.h -> flac_FLAC_ordinals.h |
| 21 |
stream_decoder.h -> flac_FLAC_stream_decoder.h |
| 22 |
stream_encoder.h -> flac_FLAC_stream_encoder.h |
| 23 |
share |
| 24 |
alloc.h -> flac_share_alloc.h |
| 25 |
compat.h -> flac_share_compat.h |
| 26 |
endswap.h -> flac_share_endswap.h |
| 27 |
macros.h -> flac_share_macros.h |
| 28 |
private.h -> flac_share_private.h |
| 29 |
safe_str.h -> flac_share_safe_str.h |
| 30 |
win_utf8_io.h -> flac_share_win_utf8_io.h |
| 31 |
src |
| 32 |
libFLAC |
| 33 |
bitmath.c -> flac_bitmath.c |
| 34 |
bitreader.c -> flac_bitreader.c |
| 35 |
bitwriter.c -> flac_bitwriter.c |
| 36 |
cpu.c -> flac_cpu.c |
| 37 |
crc.c -> flac_crc.c |
| 38 |
deduplication |
| 39 |
bitreader_read_rice_signed_block.c -> flac_deduplication_bitreader_read_rice_signed_block_c.h |
| 40 |
bitreader_lpc_compute_autocorrelation_intrin.c -> flac_deduplication_lpc_compute_autocorrelation_intrin_c.h |
| 41 |
fixed.c -> flac_fixed.c |
| 42 |
float.c -> flac_float.c |
| 43 |
format.c -> flac_format.c |
| 44 |
include |
| 45 |
private |
| 46 |
all.h -> UNUSED |
| 47 |
bitmath.h -> flac_private_bitmath.h |
| 48 |
bitreader.h -> flac_private_bitreader.h |
| 49 |
bitwriter.h -> flac_private_bitwriter.h |
| 50 |
cpu.h -> flac_private_cpu.h |
| 51 |
crc.h -> flac_private_crc.h |
| 52 |
fixed.h -> flac_private_fixed.h |
| 53 |
float.h -> flac_private_float.h |
| 54 |
format.h -> flac_private_format.h |
| 55 |
lpc.h -> flac_private_lpc.h |
| 56 |
macros.h -> flac_private_macros.h |
| 57 |
md5.h -> flac_private_md5.h |
| 58 |
memory.h -> flac_private_memory.h |
| 59 |
metadata.h -> flac_private_metadata.h |
| 60 |
ogg_decoder_aspect.h -> UNUSED |
| 61 |
ogg_encoder_aspect.h -> UNUSED |
| 62 |
ogg_helper.h -> UNUSED |
| 63 |
ogg_mapping.h -> UNUSED |
| 64 |
stream_encoder_framing.h -> flac_private_stream_encoder_framing.h |
| 65 |
stream_encoder.h -> flac_private_stream_encoder.h |
| 66 |
window.h -> flac_private_window.h |
| 67 |
protected |
| 68 |
all.h -> UNUSED |
| 69 |
stream_decoder.h -> flac_protected_stream_decoder.h |
| 70 |
stream_encoder.h -> flac_protected_stream_encoder.h |
| 71 |
lpc.c -> flac_lpc.c |
| 72 |
md5.c -> flac_md5.c |
| 73 |
memory.c -> flac_memory.c |
| 74 |
metadata_iterators.c -> flac_metadata_iterators.c |
| 75 |
metadata_object.c -> flac_metadata_object.c |
| 76 |
ogg_decoder_aspect.c -> flac_ogg_decoder_aspect.c |
| 77 |
ogg_encoder_aspect.c -> flac_ogg_encoder_aspect.c |
| 78 |
ogg_helper.c -> flac_ogg_helper.c |
| 79 |
ogg_mapping.c -> flac_ogg_mapping.c |
| 80 |
stream_decoder.c -> flac_stream_decoder.c |
| 81 |
stream_encoder.c -> flac_stream_encoder.c |
| 82 |
stream_encoder_framing.c -> flac_stream_encoder_framing.c |
| 83 |
window.c -> flac_window.c |
| 84 |
share |
| 85 |
win_utf8_io |
| 86 |
win_utf8_io.c -> flac_share_win_utf8_io.c |
| 87 |
|
| 88 |
All these files are put into the single external/flac source folder. |
| 89 |
The #include statements are flattened, e.g. |
| 90 |
#include private/float.h becomes #include flac_private_float.h. |
| 91 |
|
| 92 |
Any Praat-specific declarations should go in flac_config.h, |
| 93 |
so we have to #include flac_config.h in most *.c files. |
| 94 |
Including the config file is done in FLAC inside #if HAVE_CONFIG_H, |
| 95 |
just as in many other libraries. This is appropriate for libraries that are compiled |
| 96 |
separately, but not for libraries that are included in a larger project as source code. |
| 97 |
So we remove all instances of #if HAVE_CONFIG_H. Specifically, we replace |
| 98 |
|
| 99 |
#if HAVE_CONFIG_H |
| 100 |
# include <config.h> |
| 101 |
#endif |
| 102 |
|
| 103 |
with |
| 104 |
|
| 105 |
//ppgb #if HAVE_CONFIG_H |
| 106 |
#include "flac_config.h" |
| 107 |
//ppgb #endif |
| 108 |
|
| 109 |
in all *.c files. |
| 110 |
|
| 111 |
We have #ifdef NDEBUG in flac_FLAC_assert.h. That is fine, because Praat wants to keep |
| 112 |
assertions in its code. |
| 113 |
|
| 114 |
flac_FLAC_stream_decoder.h: |
| 115 |
|
| 116 |
typedef struct { |
| 117 |
struct FLAC__StreamDecoderProtected *protected_; /* avoid the C++ keyword 'protected' */ |
| 118 |
struct FLAC__StreamDecoderPrivate *private_; /* avoid the C++ keyword 'private' */ |
| 119 |
} FLAC__StreamDecoder; |
| 120 |
|
| 121 |
into |
| 122 |
|
| 123 |
typedef struct FLAC__StreamDecoder { //ppgb 20071120 |
| 124 |
struct FLAC__StreamDecoderProtected *protected_; /* avoid the C++ keyword 'protected' */ |
| 125 |
struct FLAC__StreamDecoderPrivate *private_; /* avoid the C++ keyword 'private' */ |
| 126 |
} FLAC__StreamDecoder; |
| 127 |
|
| 128 |
flac_FLAC_stream_encoder.h: |
| 129 |
|
| 130 |
typedef struct { |
| 131 |
struct FLAC__StreamEncoderProtected *protected_; /* avoid the C++ keyword 'protected' */ |
| 132 |
struct FLAC__StreamEncoderPrivate *private_; /* avoid the C++ keyword 'private' */ |
| 133 |
} FLAC__StreamEncoder; |
| 134 |
|
| 135 |
into |
| 136 |
|
| 137 |
typedef struct FLAC__StreamEncoder { //ppgb 20071120 |
| 138 |
struct FLAC__StreamEncoderProtected *protected_; /* avoid the C++ keyword 'protected' */ |
| 139 |
struct FLAC__StreamEncoderPrivate *private_; /* avoid the C++ keyword 'private' */ |
| 140 |
} FLAC__StreamEncoder; |
| 141 |
|
| 142 |
Before #including any FLAC header files, do |
| 143 |
|
| 144 |
#define FLAC__NO_DLL |
| 145 |
|
| 146 |
Put #ifdef _WIN32 around flac_share_win_utf8_io.c. |
| 147 |
|
| 148 |
Replace all occurrences of |
| 149 |
#if WORDS_BIGENDIAN |
| 150 |
with |
| 151 |
#if __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__ |
| 152 |
|
| 153 |
To minimize warnings, do something to |
| 154 |
#ifdef HAVE_STDINT_H |
| 155 |
such as replacing it with |
| 156 |
#if HAVE_STDINT_H |