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