annotate win64-mingw/include/FLAC/all.h @ 136:ce0478b62770

Add Capnp and KJ builds for Win32
author Chris Cannam <cannam@all-day-breakfast.com>
date Wed, 26 Oct 2016 13:24:45 +0100
parents c9cf28b398fb
children
rev   line source
cannam@120 1 /* libFLAC - Free Lossless Audio Codec library
cannam@120 2 * Copyright (C) 2000,2001,2002,2003,2004,2005,2006,2007 Josh Coalson
cannam@120 3 *
cannam@120 4 * Redistribution and use in source and binary forms, with or without
cannam@120 5 * modification, are permitted provided that the following conditions
cannam@120 6 * are met:
cannam@120 7 *
cannam@120 8 * - Redistributions of source code must retain the above copyright
cannam@120 9 * notice, this list of conditions and the following disclaimer.
cannam@120 10 *
cannam@120 11 * - Redistributions in binary form must reproduce the above copyright
cannam@120 12 * notice, this list of conditions and the following disclaimer in the
cannam@120 13 * documentation and/or other materials provided with the distribution.
cannam@120 14 *
cannam@120 15 * - Neither the name of the Xiph.org Foundation nor the names of its
cannam@120 16 * contributors may be used to endorse or promote products derived from
cannam@120 17 * this software without specific prior written permission.
cannam@120 18 *
cannam@120 19 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
cannam@120 20 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
cannam@120 21 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
cannam@120 22 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR
cannam@120 23 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
cannam@120 24 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
cannam@120 25 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
cannam@120 26 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
cannam@120 27 * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
cannam@120 28 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
cannam@120 29 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
cannam@120 30 */
cannam@120 31
cannam@120 32 #ifndef FLAC__ALL_H
cannam@120 33 #define FLAC__ALL_H
cannam@120 34
cannam@120 35 #include "export.h"
cannam@120 36
cannam@120 37 #include "assert.h"
cannam@120 38 #include "callback.h"
cannam@120 39 #include "format.h"
cannam@120 40 #include "metadata.h"
cannam@120 41 #include "ordinals.h"
cannam@120 42 #include "stream_decoder.h"
cannam@120 43 #include "stream_encoder.h"
cannam@120 44
cannam@120 45 /** \mainpage
cannam@120 46 *
cannam@120 47 * \section intro Introduction
cannam@120 48 *
cannam@120 49 * This is the documentation for the FLAC C and C++ APIs. It is
cannam@120 50 * highly interconnected; this introduction should give you a top
cannam@120 51 * level idea of the structure and how to find the information you
cannam@120 52 * need. As a prerequisite you should have at least a basic
cannam@120 53 * knowledge of the FLAC format, documented
cannam@120 54 * <A HREF="../format.html">here</A>.
cannam@120 55 *
cannam@120 56 * \section c_api FLAC C API
cannam@120 57 *
cannam@120 58 * The FLAC C API is the interface to libFLAC, a set of structures
cannam@120 59 * describing the components of FLAC streams, and functions for
cannam@120 60 * encoding and decoding streams, as well as manipulating FLAC
cannam@120 61 * metadata in files. The public include files will be installed
cannam@120 62 * in your include area (for example /usr/include/FLAC/...).
cannam@120 63 *
cannam@120 64 * By writing a little code and linking against libFLAC, it is
cannam@120 65 * relatively easy to add FLAC support to another program. The
cannam@120 66 * library is licensed under <A HREF="../license.html">Xiph's BSD license</A>.
cannam@120 67 * Complete source code of libFLAC as well as the command-line
cannam@120 68 * encoder and plugins is available and is a useful source of
cannam@120 69 * examples.
cannam@120 70 *
cannam@120 71 * Aside from encoders and decoders, libFLAC provides a powerful
cannam@120 72 * metadata interface for manipulating metadata in FLAC files. It
cannam@120 73 * allows the user to add, delete, and modify FLAC metadata blocks
cannam@120 74 * and it can automatically take advantage of PADDING blocks to avoid
cannam@120 75 * rewriting the entire FLAC file when changing the size of the
cannam@120 76 * metadata.
cannam@120 77 *
cannam@120 78 * libFLAC usually only requires the standard C library and C math
cannam@120 79 * library. In particular, threading is not used so there is no
cannam@120 80 * dependency on a thread library. However, libFLAC does not use
cannam@120 81 * global variables and should be thread-safe.
cannam@120 82 *
cannam@120 83 * libFLAC also supports encoding to and decoding from Ogg FLAC.
cannam@120 84 * However the metadata editing interfaces currently have limited
cannam@120 85 * read-only support for Ogg FLAC files.
cannam@120 86 *
cannam@120 87 * \section cpp_api FLAC C++ API
cannam@120 88 *
cannam@120 89 * The FLAC C++ API is a set of classes that encapsulate the
cannam@120 90 * structures and functions in libFLAC. They provide slightly more
cannam@120 91 * functionality with respect to metadata but are otherwise
cannam@120 92 * equivalent. For the most part, they share the same usage as
cannam@120 93 * their counterparts in libFLAC, and the FLAC C API documentation
cannam@120 94 * can be used as a supplement. The public include files
cannam@120 95 * for the C++ API will be installed in your include area (for
cannam@120 96 * example /usr/include/FLAC++/...).
cannam@120 97 *
cannam@120 98 * libFLAC++ is also licensed under
cannam@120 99 * <A HREF="../license.html">Xiph's BSD license</A>.
cannam@120 100 *
cannam@120 101 * \section getting_started Getting Started
cannam@120 102 *
cannam@120 103 * A good starting point for learning the API is to browse through
cannam@120 104 * the <A HREF="modules.html">modules</A>. Modules are logical
cannam@120 105 * groupings of related functions or classes, which correspond roughly
cannam@120 106 * to header files or sections of header files. Each module includes a
cannam@120 107 * detailed description of the general usage of its functions or
cannam@120 108 * classes.
cannam@120 109 *
cannam@120 110 * From there you can go on to look at the documentation of
cannam@120 111 * individual functions. You can see different views of the individual
cannam@120 112 * functions through the links in top bar across this page.
cannam@120 113 *
cannam@120 114 * If you prefer a more hands-on approach, you can jump right to some
cannam@120 115 * <A HREF="../documentation_example_code.html">example code</A>.
cannam@120 116 *
cannam@120 117 * \section porting_guide Porting Guide
cannam@120 118 *
cannam@120 119 * Starting with FLAC 1.1.3 a \link porting Porting Guide \endlink
cannam@120 120 * has been introduced which gives detailed instructions on how to
cannam@120 121 * port your code to newer versions of FLAC.
cannam@120 122 *
cannam@120 123 * \section embedded_developers Embedded Developers
cannam@120 124 *
cannam@120 125 * libFLAC has grown larger over time as more functionality has been
cannam@120 126 * included, but much of it may be unnecessary for a particular embedded
cannam@120 127 * implementation. Unused parts may be pruned by some simple editing of
cannam@120 128 * src/libFLAC/Makefile.am. In general, the decoders, encoders, and
cannam@120 129 * metadata interface are all independent from each other.
cannam@120 130 *
cannam@120 131 * It is easiest to just describe the dependencies:
cannam@120 132 *
cannam@120 133 * - All modules depend on the \link flac_format Format \endlink module.
cannam@120 134 * - The decoders and encoders depend on the bitbuffer.
cannam@120 135 * - The decoder is independent of the encoder. The encoder uses the
cannam@120 136 * decoder because of the verify feature, but this can be removed if
cannam@120 137 * not needed.
cannam@120 138 * - Parts of the metadata interface require the stream decoder (but not
cannam@120 139 * the encoder).
cannam@120 140 * - Ogg support is selectable through the compile time macro
cannam@120 141 * \c FLAC__HAS_OGG.
cannam@120 142 *
cannam@120 143 * For example, if your application only requires the stream decoder, no
cannam@120 144 * encoder, and no metadata interface, you can remove the stream encoder
cannam@120 145 * and the metadata interface, which will greatly reduce the size of the
cannam@120 146 * library.
cannam@120 147 *
cannam@120 148 * Also, there are several places in the libFLAC code with comments marked
cannam@120 149 * with "OPT:" where a #define can be changed to enable code that might be
cannam@120 150 * faster on a specific platform. Experimenting with these can yield faster
cannam@120 151 * binaries.
cannam@120 152 */
cannam@120 153
cannam@120 154 /** \defgroup porting Porting Guide for New Versions
cannam@120 155 *
cannam@120 156 * This module describes differences in the library interfaces from
cannam@120 157 * version to version. It assists in the porting of code that uses
cannam@120 158 * the libraries to newer versions of FLAC.
cannam@120 159 *
cannam@120 160 * One simple facility for making porting easier that has been added
cannam@120 161 * in FLAC 1.1.3 is a set of \c #defines in \c export.h of each
cannam@120 162 * library's includes (e.g. \c include/FLAC/export.h). The
cannam@120 163 * \c #defines mirror the libraries'
cannam@120 164 * <A HREF="http://www.gnu.org/software/libtool/manual.html#Libtool-versioning">libtool version numbers</A>,
cannam@120 165 * e.g. in libFLAC there are \c FLAC_API_VERSION_CURRENT,
cannam@120 166 * \c FLAC_API_VERSION_REVISION, and \c FLAC_API_VERSION_AGE.
cannam@120 167 * These can be used to support multiple versions of an API during the
cannam@120 168 * transition phase, e.g.
cannam@120 169 *
cannam@120 170 * \code
cannam@120 171 * #if !defined(FLAC_API_VERSION_CURRENT) || FLAC_API_VERSION_CURRENT <= 7
cannam@120 172 * legacy code
cannam@120 173 * #else
cannam@120 174 * new code
cannam@120 175 * #endif
cannam@120 176 * \endcode
cannam@120 177 *
cannam@120 178 * The the source will work for multiple versions and the legacy code can
cannam@120 179 * easily be removed when the transition is complete.
cannam@120 180 *
cannam@120 181 * Another available symbol is FLAC_API_SUPPORTS_OGG_FLAC (defined in
cannam@120 182 * include/FLAC/export.h), which can be used to determine whether or not
cannam@120 183 * the library has been compiled with support for Ogg FLAC. This is
cannam@120 184 * simpler than trying to call an Ogg init function and catching the
cannam@120 185 * error.
cannam@120 186 */
cannam@120 187
cannam@120 188 /** \defgroup porting_1_1_2_to_1_1_3 Porting from FLAC 1.1.2 to 1.1.3
cannam@120 189 * \ingroup porting
cannam@120 190 *
cannam@120 191 * \brief
cannam@120 192 * This module describes porting from FLAC 1.1.2 to FLAC 1.1.3.
cannam@120 193 *
cannam@120 194 * The main change between the APIs in 1.1.2 and 1.1.3 is that they have
cannam@120 195 * been simplified. First, libOggFLAC has been merged into libFLAC and
cannam@120 196 * libOggFLAC++ has been merged into libFLAC++. Second, both the three
cannam@120 197 * decoding layers and three encoding layers have been merged into a
cannam@120 198 * single stream decoder and stream encoder. That is, the functionality
cannam@120 199 * of FLAC__SeekableStreamDecoder and FLAC__FileDecoder has been merged
cannam@120 200 * into FLAC__StreamDecoder, and FLAC__SeekableStreamEncoder and
cannam@120 201 * FLAC__FileEncoder into FLAC__StreamEncoder. Only the
cannam@120 202 * FLAC__StreamDecoder and FLAC__StreamEncoder remain. What this means
cannam@120 203 * is there is now a single API that can be used to encode or decode
cannam@120 204 * streams to/from native FLAC or Ogg FLAC and the single API can work
cannam@120 205 * on both seekable and non-seekable streams.
cannam@120 206 *
cannam@120 207 * Instead of creating an encoder or decoder of a certain layer, now the
cannam@120 208 * client will always create a FLAC__StreamEncoder or
cannam@120 209 * FLAC__StreamDecoder. The old layers are now differentiated by the
cannam@120 210 * initialization function. For example, for the decoder,
cannam@120 211 * FLAC__stream_decoder_init() has been replaced by
cannam@120 212 * FLAC__stream_decoder_init_stream(). This init function takes
cannam@120 213 * callbacks for the I/O, and the seeking callbacks are optional. This
cannam@120 214 * allows the client to use the same object for seekable and
cannam@120 215 * non-seekable streams. For decoding a FLAC file directly, the client
cannam@120 216 * can use FLAC__stream_decoder_init_file() and pass just a filename
cannam@120 217 * and fewer callbacks; most of the other callbacks are supplied
cannam@120 218 * internally. For situations where fopen()ing by filename is not
cannam@120 219 * possible (e.g. Unicode filenames on Windows) the client can instead
cannam@120 220 * open the file itself and supply the FILE* to
cannam@120 221 * FLAC__stream_decoder_init_FILE(). The init functions now returns a
cannam@120 222 * FLAC__StreamDecoderInitStatus instead of FLAC__StreamDecoderState.
cannam@120 223 * Since the callbacks and client data are now passed to the init
cannam@120 224 * function, the FLAC__stream_decoder_set_*_callback() functions and
cannam@120 225 * FLAC__stream_decoder_set_client_data() are no longer needed. The
cannam@120 226 * rest of the calls to the decoder are the same as before.
cannam@120 227 *
cannam@120 228 * There are counterpart init functions for Ogg FLAC, e.g.
cannam@120 229 * FLAC__stream_decoder_init_ogg_stream(). All the rest of the calls
cannam@120 230 * and callbacks are the same as for native FLAC.
cannam@120 231 *
cannam@120 232 * As an example, in FLAC 1.1.2 a seekable stream decoder would have
cannam@120 233 * been set up like so:
cannam@120 234 *
cannam@120 235 * \code
cannam@120 236 * FLAC__SeekableStreamDecoder *decoder = FLAC__seekable_stream_decoder_new();
cannam@120 237 * if(decoder == NULL) do_something;
cannam@120 238 * FLAC__seekable_stream_decoder_set_md5_checking(decoder, true);
cannam@120 239 * [... other settings ...]
cannam@120 240 * FLAC__seekable_stream_decoder_set_read_callback(decoder, my_read_callback);
cannam@120 241 * FLAC__seekable_stream_decoder_set_seek_callback(decoder, my_seek_callback);
cannam@120 242 * FLAC__seekable_stream_decoder_set_tell_callback(decoder, my_tell_callback);
cannam@120 243 * FLAC__seekable_stream_decoder_set_length_callback(decoder, my_length_callback);
cannam@120 244 * FLAC__seekable_stream_decoder_set_eof_callback(decoder, my_eof_callback);
cannam@120 245 * FLAC__seekable_stream_decoder_set_write_callback(decoder, my_write_callback);
cannam@120 246 * FLAC__seekable_stream_decoder_set_metadata_callback(decoder, my_metadata_callback);
cannam@120 247 * FLAC__seekable_stream_decoder_set_error_callback(decoder, my_error_callback);
cannam@120 248 * FLAC__seekable_stream_decoder_set_client_data(decoder, my_client_data);
cannam@120 249 * if(FLAC__seekable_stream_decoder_init(decoder) != FLAC__SEEKABLE_STREAM_DECODER_OK) do_something;
cannam@120 250 * \endcode
cannam@120 251 *
cannam@120 252 * In FLAC 1.1.3 it is like this:
cannam@120 253 *
cannam@120 254 * \code
cannam@120 255 * FLAC__StreamDecoder *decoder = FLAC__stream_decoder_new();
cannam@120 256 * if(decoder == NULL) do_something;
cannam@120 257 * FLAC__stream_decoder_set_md5_checking(decoder, true);
cannam@120 258 * [... other settings ...]
cannam@120 259 * if(FLAC__stream_decoder_init_stream(
cannam@120 260 * decoder,
cannam@120 261 * my_read_callback,
cannam@120 262 * my_seek_callback, // or NULL
cannam@120 263 * my_tell_callback, // or NULL
cannam@120 264 * my_length_callback, // or NULL
cannam@120 265 * my_eof_callback, // or NULL
cannam@120 266 * my_write_callback,
cannam@120 267 * my_metadata_callback, // or NULL
cannam@120 268 * my_error_callback,
cannam@120 269 * my_client_data
cannam@120 270 * ) != FLAC__STREAM_DECODER_INIT_STATUS_OK) do_something;
cannam@120 271 * \endcode
cannam@120 272 *
cannam@120 273 * or you could do;
cannam@120 274 *
cannam@120 275 * \code
cannam@120 276 * [...]
cannam@120 277 * FILE *file = fopen("somefile.flac","rb");
cannam@120 278 * if(file == NULL) do_somthing;
cannam@120 279 * if(FLAC__stream_decoder_init_FILE(
cannam@120 280 * decoder,
cannam@120 281 * file,
cannam@120 282 * my_write_callback,
cannam@120 283 * my_metadata_callback, // or NULL
cannam@120 284 * my_error_callback,
cannam@120 285 * my_client_data
cannam@120 286 * ) != FLAC__STREAM_DECODER_INIT_STATUS_OK) do_something;
cannam@120 287 * \endcode
cannam@120 288 *
cannam@120 289 * or just:
cannam@120 290 *
cannam@120 291 * \code
cannam@120 292 * [...]
cannam@120 293 * if(FLAC__stream_decoder_init_file(
cannam@120 294 * decoder,
cannam@120 295 * "somefile.flac",
cannam@120 296 * my_write_callback,
cannam@120 297 * my_metadata_callback, // or NULL
cannam@120 298 * my_error_callback,
cannam@120 299 * my_client_data
cannam@120 300 * ) != FLAC__STREAM_DECODER_INIT_STATUS_OK) do_something;
cannam@120 301 * \endcode
cannam@120 302 *
cannam@120 303 * Another small change to the decoder is in how it handles unparseable
cannam@120 304 * streams. Before, when the decoder found an unparseable stream
cannam@120 305 * (reserved for when the decoder encounters a stream from a future
cannam@120 306 * encoder that it can't parse), it changed the state to
cannam@120 307 * \c FLAC__STREAM_DECODER_UNPARSEABLE_STREAM. Now the decoder instead
cannam@120 308 * drops sync and calls the error callback with a new error code
cannam@120 309 * \c FLAC__STREAM_DECODER_ERROR_STATUS_UNPARSEABLE_STREAM. This is
cannam@120 310 * more robust. If your error callback does not discriminate on the the
cannam@120 311 * error state, your code does not need to be changed.
cannam@120 312 *
cannam@120 313 * The encoder now has a new setting:
cannam@120 314 * FLAC__stream_encoder_set_apodization(). This is for setting the
cannam@120 315 * method used to window the data before LPC analysis. You only need to
cannam@120 316 * add a call to this function if the default is not suitable. There
cannam@120 317 * are also two new convenience functions that may be useful:
cannam@120 318 * FLAC__metadata_object_cuesheet_calculate_cddb_id() and
cannam@120 319 * FLAC__metadata_get_cuesheet().
cannam@120 320 *
cannam@120 321 * The \a bytes parameter to FLAC__StreamDecoderReadCallback,
cannam@120 322 * FLAC__StreamEncoderReadCallback, and FLAC__StreamEncoderWriteCallback
cannam@120 323 * is now \c size_t instead of \c unsigned.
cannam@120 324 */
cannam@120 325
cannam@120 326 /** \defgroup porting_1_1_3_to_1_1_4 Porting from FLAC 1.1.3 to 1.1.4
cannam@120 327 * \ingroup porting
cannam@120 328 *
cannam@120 329 * \brief
cannam@120 330 * This module describes porting from FLAC 1.1.3 to FLAC 1.1.4.
cannam@120 331 *
cannam@120 332 * There were no changes to any of the interfaces from 1.1.3 to 1.1.4.
cannam@120 333 * There was a slight change in the implementation of
cannam@120 334 * FLAC__stream_encoder_set_metadata(); the function now makes a copy
cannam@120 335 * of the \a metadata array of pointers so the client no longer needs
cannam@120 336 * to maintain it after the call. The objects themselves that are
cannam@120 337 * pointed to by the array are still not copied though and must be
cannam@120 338 * maintained until the call to FLAC__stream_encoder_finish().
cannam@120 339 */
cannam@120 340
cannam@120 341 /** \defgroup porting_1_1_4_to_1_2_0 Porting from FLAC 1.1.4 to 1.2.0
cannam@120 342 * \ingroup porting
cannam@120 343 *
cannam@120 344 * \brief
cannam@120 345 * This module describes porting from FLAC 1.1.4 to FLAC 1.2.0.
cannam@120 346 *
cannam@120 347 * There were only very minor changes to the interfaces from 1.1.4 to 1.2.0.
cannam@120 348 * In libFLAC, \c FLAC__format_sample_rate_is_subset() was added.
cannam@120 349 * In libFLAC++, \c FLAC::Decoder::Stream::get_decode_position() was added.
cannam@120 350 *
cannam@120 351 * Finally, value of the constant \c FLAC__FRAME_HEADER_RESERVED_LEN
cannam@120 352 * has changed to reflect the conversion of one of the reserved bits
cannam@120 353 * into active use. It used to be \c 2 and now is \c 1. However the
cannam@120 354 * FLAC frame header length has not changed, so to skip the proper
cannam@120 355 * number of bits, use \c FLAC__FRAME_HEADER_RESERVED_LEN +
cannam@120 356 * \c FLAC__FRAME_HEADER_BLOCKING_STRATEGY_LEN
cannam@120 357 */
cannam@120 358
cannam@120 359 /** \defgroup flac FLAC C API
cannam@120 360 *
cannam@120 361 * The FLAC C API is the interface to libFLAC, a set of structures
cannam@120 362 * describing the components of FLAC streams, and functions for
cannam@120 363 * encoding and decoding streams, as well as manipulating FLAC
cannam@120 364 * metadata in files.
cannam@120 365 *
cannam@120 366 * You should start with the format components as all other modules
cannam@120 367 * are dependent on it.
cannam@120 368 */
cannam@120 369
cannam@120 370 #endif