VisualC/external/include/FLAC/stream_decoder.h
changeset 556 2686e67b59fd
parent 532 b8e8ae4852b2
child 748 5515b36f95ed
child 937 3797c39725bf
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/VisualC/external/include/FLAC/stream_decoder.h	Mon Jan 09 04:20:54 2012 -0500
     1.3 @@ -0,0 +1,1559 @@
     1.4 +/* libFLAC - Free Lossless Audio Codec library
     1.5 + * Copyright (C) 2000,2001,2002,2003,2004,2005,2006,2007  Josh Coalson
     1.6 + *
     1.7 + * Redistribution and use in source and binary forms, with or without
     1.8 + * modification, are permitted provided that the following conditions
     1.9 + * are met:
    1.10 + *
    1.11 + * - Redistributions of source code must retain the above copyright
    1.12 + * notice, this list of conditions and the following disclaimer.
    1.13 + *
    1.14 + * - Redistributions in binary form must reproduce the above copyright
    1.15 + * notice, this list of conditions and the following disclaimer in the
    1.16 + * documentation and/or other materials provided with the distribution.
    1.17 + *
    1.18 + * - Neither the name of the Xiph.org Foundation nor the names of its
    1.19 + * contributors may be used to endorse or promote products derived from
    1.20 + * this software without specific prior written permission.
    1.21 + *
    1.22 + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
    1.23 + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
    1.24 + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
    1.25 + * A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR
    1.26 + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
    1.27 + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
    1.28 + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
    1.29 + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
    1.30 + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
    1.31 + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
    1.32 + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
    1.33 + */
    1.34 +
    1.35 +#ifndef FLAC__STREAM_DECODER_H
    1.36 +#define FLAC__STREAM_DECODER_H
    1.37 +
    1.38 +#include <stdio.h> /* for FILE */
    1.39 +#include "export.h"
    1.40 +#include "format.h"
    1.41 +
    1.42 +#ifdef __cplusplus
    1.43 +extern "C" {
    1.44 +#endif
    1.45 +
    1.46 +
    1.47 +/** \file include/FLAC/stream_decoder.h
    1.48 + *
    1.49 + *  \brief
    1.50 + *  This module contains the functions which implement the stream
    1.51 + *  decoder.
    1.52 + *
    1.53 + *  See the detailed documentation in the
    1.54 + *  \link flac_stream_decoder stream decoder \endlink module.
    1.55 + */
    1.56 +
    1.57 +/** \defgroup flac_decoder FLAC/ \*_decoder.h: decoder interfaces
    1.58 + *  \ingroup flac
    1.59 + *
    1.60 + *  \brief
    1.61 + *  This module describes the decoder layers provided by libFLAC.
    1.62 + *
    1.63 + * The stream decoder can be used to decode complete streams either from
    1.64 + * the client via callbacks, or directly from a file, depending on how
    1.65 + * it is initialized.  When decoding via callbacks, the client provides
    1.66 + * callbacks for reading FLAC data and writing decoded samples, and
    1.67 + * handling metadata and errors.  If the client also supplies seek-related
    1.68 + * callback, the decoder function for sample-accurate seeking within the
    1.69 + * FLAC input is also available.  When decoding from a file, the client
    1.70 + * needs only supply a filename or open \c FILE* and write/metadata/error
    1.71 + * callbacks; the rest of the callbacks are supplied internally.  For more
    1.72 + * info see the \link flac_stream_decoder stream decoder \endlink module.
    1.73 + */
    1.74 +
    1.75 +/** \defgroup flac_stream_decoder FLAC/stream_decoder.h: stream decoder interface
    1.76 + *  \ingroup flac_decoder
    1.77 + *
    1.78 + *  \brief
    1.79 + *  This module contains the functions which implement the stream
    1.80 + *  decoder.
    1.81 + *
    1.82 + * The stream decoder can decode native FLAC, and optionally Ogg FLAC
    1.83 + * (check FLAC_API_SUPPORTS_OGG_FLAC) streams and files.
    1.84 + *
    1.85 + * The basic usage of this decoder is as follows:
    1.86 + * - The program creates an instance of a decoder using
    1.87 + *   FLAC__stream_decoder_new().
    1.88 + * - The program overrides the default settings using
    1.89 + *   FLAC__stream_decoder_set_*() functions.
    1.90 + * - The program initializes the instance to validate the settings and
    1.91 + *   prepare for decoding using
    1.92 + *   - FLAC__stream_decoder_init_stream() or FLAC__stream_decoder_init_FILE()
    1.93 + *     or FLAC__stream_decoder_init_file() for native FLAC,
    1.94 + *   - FLAC__stream_decoder_init_ogg_stream() or FLAC__stream_decoder_init_ogg_FILE()
    1.95 + *     or FLAC__stream_decoder_init_ogg_file() for Ogg FLAC
    1.96 + * - The program calls the FLAC__stream_decoder_process_*() functions
    1.97 + *   to decode data, which subsequently calls the callbacks.
    1.98 + * - The program finishes the decoding with FLAC__stream_decoder_finish(),
    1.99 + *   which flushes the input and output and resets the decoder to the
   1.100 + *   uninitialized state.
   1.101 + * - The instance may be used again or deleted with
   1.102 + *   FLAC__stream_decoder_delete().
   1.103 + *
   1.104 + * In more detail, the program will create a new instance by calling
   1.105 + * FLAC__stream_decoder_new(), then call FLAC__stream_decoder_set_*()
   1.106 + * functions to override the default decoder options, and call
   1.107 + * one of the FLAC__stream_decoder_init_*() functions.
   1.108 + *
   1.109 + * There are three initialization functions for native FLAC, one for
   1.110 + * setting up the decoder to decode FLAC data from the client via
   1.111 + * callbacks, and two for decoding directly from a FLAC file.
   1.112 + *
   1.113 + * For decoding via callbacks, use FLAC__stream_decoder_init_stream().
   1.114 + * You must also supply several callbacks for handling I/O.  Some (like
   1.115 + * seeking) are optional, depending on the capabilities of the input.
   1.116 + *
   1.117 + * For decoding directly from a file, use FLAC__stream_decoder_init_FILE()
   1.118 + * or FLAC__stream_decoder_init_file().  Then you must only supply an open
   1.119 + * \c FILE* or filename and fewer callbacks; the decoder will handle
   1.120 + * the other callbacks internally.
   1.121 + *
   1.122 + * There are three similarly-named init functions for decoding from Ogg
   1.123 + * FLAC streams.  Check \c FLAC_API_SUPPORTS_OGG_FLAC to find out if the
   1.124 + * library has been built with Ogg support.
   1.125 + *
   1.126 + * Once the decoder is initialized, your program will call one of several
   1.127 + * functions to start the decoding process:
   1.128 + *
   1.129 + * - FLAC__stream_decoder_process_single() - Tells the decoder to process at
   1.130 + *   most one metadata block or audio frame and return, calling either the
   1.131 + *   metadata callback or write callback, respectively, once.  If the decoder
   1.132 + *   loses sync it will return with only the error callback being called.
   1.133 + * - FLAC__stream_decoder_process_until_end_of_metadata() - Tells the decoder
   1.134 + *   to process the stream from the current location and stop upon reaching
   1.135 + *   the first audio frame.  The client will get one metadata, write, or error
   1.136 + *   callback per metadata block, audio frame, or sync error, respectively.
   1.137 + * - FLAC__stream_decoder_process_until_end_of_stream() - Tells the decoder
   1.138 + *   to process the stream from the current location until the read callback
   1.139 + *   returns FLAC__STREAM_DECODER_READ_STATUS_END_OF_STREAM or
   1.140 + *   FLAC__STREAM_DECODER_READ_STATUS_ABORT.  The client will get one metadata,
   1.141 + *   write, or error callback per metadata block, audio frame, or sync error,
   1.142 + *   respectively.
   1.143 + *
   1.144 + * When the decoder has finished decoding (normally or through an abort),
   1.145 + * the instance is finished by calling FLAC__stream_decoder_finish(), which
   1.146 + * ensures the decoder is in the correct state and frees memory.  Then the
   1.147 + * instance may be deleted with FLAC__stream_decoder_delete() or initialized
   1.148 + * again to decode another stream.
   1.149 + *
   1.150 + * Seeking is exposed through the FLAC__stream_decoder_seek_absolute() method.
   1.151 + * At any point after the stream decoder has been initialized, the client can
   1.152 + * call this function to seek to an exact sample within the stream.
   1.153 + * Subsequently, the first time the write callback is called it will be
   1.154 + * passed a (possibly partial) block starting at that sample.
   1.155 + *
   1.156 + * If the client cannot seek via the callback interface provided, but still
   1.157 + * has another way of seeking, it can flush the decoder using
   1.158 + * FLAC__stream_decoder_flush() and start feeding data from the new position
   1.159 + * through the read callback.
   1.160 + *
   1.161 + * The stream decoder also provides MD5 signature checking.  If this is
   1.162 + * turned on before initialization, FLAC__stream_decoder_finish() will
   1.163 + * report when the decoded MD5 signature does not match the one stored
   1.164 + * in the STREAMINFO block.  MD5 checking is automatically turned off
   1.165 + * (until the next FLAC__stream_decoder_reset()) if there is no signature
   1.166 + * in the STREAMINFO block or when a seek is attempted.
   1.167 + *
   1.168 + * The FLAC__stream_decoder_set_metadata_*() functions deserve special
   1.169 + * attention.  By default, the decoder only calls the metadata_callback for
   1.170 + * the STREAMINFO block.  These functions allow you to tell the decoder
   1.171 + * explicitly which blocks to parse and return via the metadata_callback
   1.172 + * and/or which to skip.  Use a FLAC__stream_decoder_set_metadata_respond_all(),
   1.173 + * FLAC__stream_decoder_set_metadata_ignore() ... or FLAC__stream_decoder_set_metadata_ignore_all(),
   1.174 + * FLAC__stream_decoder_set_metadata_respond() ... sequence to exactly specify
   1.175 + * which blocks to return.  Remember that metadata blocks can potentially
   1.176 + * be big (for example, cover art) so filtering out the ones you don't
   1.177 + * use can reduce the memory requirements of the decoder.  Also note the
   1.178 + * special forms FLAC__stream_decoder_set_metadata_respond_application(id)
   1.179 + * and FLAC__stream_decoder_set_metadata_ignore_application(id) for
   1.180 + * filtering APPLICATION blocks based on the application ID.
   1.181 + *
   1.182 + * STREAMINFO and SEEKTABLE blocks are always parsed and used internally, but
   1.183 + * they still can legally be filtered from the metadata_callback.
   1.184 + *
   1.185 + * \note
   1.186 + * The "set" functions may only be called when the decoder is in the
   1.187 + * state FLAC__STREAM_DECODER_UNINITIALIZED, i.e. after
   1.188 + * FLAC__stream_decoder_new() or FLAC__stream_decoder_finish(), but
   1.189 + * before FLAC__stream_decoder_init_*().  If this is the case they will
   1.190 + * return \c true, otherwise \c false.
   1.191 + *
   1.192 + * \note
   1.193 + * FLAC__stream_decoder_finish() resets all settings to the constructor
   1.194 + * defaults, including the callbacks.
   1.195 + *
   1.196 + * \{
   1.197 + */
   1.198 +
   1.199 +
   1.200 +/** State values for a FLAC__StreamDecoder
   1.201 + *
   1.202 + * The decoder's state can be obtained by calling FLAC__stream_decoder_get_state().
   1.203 + */
   1.204 +typedef enum {
   1.205 +
   1.206 +	FLAC__STREAM_DECODER_SEARCH_FOR_METADATA = 0,
   1.207 +	/**< The decoder is ready to search for metadata. */
   1.208 +
   1.209 +	FLAC__STREAM_DECODER_READ_METADATA,
   1.210 +	/**< The decoder is ready to or is in the process of reading metadata. */
   1.211 +
   1.212 +	FLAC__STREAM_DECODER_SEARCH_FOR_FRAME_SYNC,
   1.213 +	/**< The decoder is ready to or is in the process of searching for the
   1.214 +	 * frame sync code.
   1.215 +	 */
   1.216 +
   1.217 +	FLAC__STREAM_DECODER_READ_FRAME,
   1.218 +	/**< The decoder is ready to or is in the process of reading a frame. */
   1.219 +
   1.220 +	FLAC__STREAM_DECODER_END_OF_STREAM,
   1.221 +	/**< The decoder has reached the end of the stream. */
   1.222 +
   1.223 +	FLAC__STREAM_DECODER_OGG_ERROR,
   1.224 +	/**< An error occurred in the underlying Ogg layer.  */
   1.225 +
   1.226 +	FLAC__STREAM_DECODER_SEEK_ERROR,
   1.227 +	/**< An error occurred while seeking.  The decoder must be flushed
   1.228 +	 * with FLAC__stream_decoder_flush() or reset with
   1.229 +	 * FLAC__stream_decoder_reset() before decoding can continue.
   1.230 +	 */
   1.231 +
   1.232 +	FLAC__STREAM_DECODER_ABORTED,
   1.233 +	/**< The decoder was aborted by the read callback. */
   1.234 +
   1.235 +	FLAC__STREAM_DECODER_MEMORY_ALLOCATION_ERROR,
   1.236 +	/**< An error occurred allocating memory.  The decoder is in an invalid
   1.237 +	 * state and can no longer be used.
   1.238 +	 */
   1.239 +
   1.240 +	FLAC__STREAM_DECODER_UNINITIALIZED
   1.241 +	/**< The decoder is in the uninitialized state; one of the
   1.242 +	 * FLAC__stream_decoder_init_*() functions must be called before samples
   1.243 +	 * can be processed.
   1.244 +	 */
   1.245 +
   1.246 +} FLAC__StreamDecoderState;
   1.247 +
   1.248 +/** Maps a FLAC__StreamDecoderState to a C string.
   1.249 + *
   1.250 + *  Using a FLAC__StreamDecoderState as the index to this array
   1.251 + *  will give the string equivalent.  The contents should not be modified.
   1.252 + */
   1.253 +extern FLAC_API const char * const FLAC__StreamDecoderStateString[];
   1.254 +
   1.255 +
   1.256 +/** Possible return values for the FLAC__stream_decoder_init_*() functions.
   1.257 + */
   1.258 +typedef enum {
   1.259 +
   1.260 +	FLAC__STREAM_DECODER_INIT_STATUS_OK = 0,
   1.261 +	/**< Initialization was successful. */
   1.262 +
   1.263 +	FLAC__STREAM_DECODER_INIT_STATUS_UNSUPPORTED_CONTAINER,
   1.264 +	/**< The library was not compiled with support for the given container
   1.265 +	 * format.
   1.266 +	 */
   1.267 +
   1.268 +	FLAC__STREAM_DECODER_INIT_STATUS_INVALID_CALLBACKS,
   1.269 +	/**< A required callback was not supplied. */
   1.270 +
   1.271 +	FLAC__STREAM_DECODER_INIT_STATUS_MEMORY_ALLOCATION_ERROR,
   1.272 +	/**< An error occurred allocating memory. */
   1.273 +
   1.274 +	FLAC__STREAM_DECODER_INIT_STATUS_ERROR_OPENING_FILE,
   1.275 +	/**< fopen() failed in FLAC__stream_decoder_init_file() or
   1.276 +	 * FLAC__stream_decoder_init_ogg_file(). */
   1.277 +
   1.278 +	FLAC__STREAM_DECODER_INIT_STATUS_ALREADY_INITIALIZED
   1.279 +	/**< FLAC__stream_decoder_init_*() was called when the decoder was
   1.280 +	 * already initialized, usually because
   1.281 +	 * FLAC__stream_decoder_finish() was not called.
   1.282 +	 */
   1.283 +
   1.284 +} FLAC__StreamDecoderInitStatus;
   1.285 +
   1.286 +/** Maps a FLAC__StreamDecoderInitStatus to a C string.
   1.287 + *
   1.288 + *  Using a FLAC__StreamDecoderInitStatus as the index to this array
   1.289 + *  will give the string equivalent.  The contents should not be modified.
   1.290 + */
   1.291 +extern FLAC_API const char * const FLAC__StreamDecoderInitStatusString[];
   1.292 +
   1.293 +
   1.294 +/** Return values for the FLAC__StreamDecoder read callback.
   1.295 + */
   1.296 +typedef enum {
   1.297 +
   1.298 +	FLAC__STREAM_DECODER_READ_STATUS_CONTINUE,
   1.299 +	/**< The read was OK and decoding can continue. */
   1.300 +
   1.301 +	FLAC__STREAM_DECODER_READ_STATUS_END_OF_STREAM,
   1.302 +	/**< The read was attempted while at the end of the stream.  Note that
   1.303 +	 * the client must only return this value when the read callback was
   1.304 +	 * called when already at the end of the stream.  Otherwise, if the read
   1.305 +	 * itself moves to the end of the stream, the client should still return
   1.306 +	 * the data and \c FLAC__STREAM_DECODER_READ_STATUS_CONTINUE, and then on
   1.307 +	 * the next read callback it should return
   1.308 +	 * \c FLAC__STREAM_DECODER_READ_STATUS_END_OF_STREAM with a byte count
   1.309 +	 * of \c 0.
   1.310 +	 */
   1.311 +
   1.312 +	FLAC__STREAM_DECODER_READ_STATUS_ABORT
   1.313 +	/**< An unrecoverable error occurred.  The decoder will return from the process call. */
   1.314 +
   1.315 +} FLAC__StreamDecoderReadStatus;
   1.316 +
   1.317 +/** Maps a FLAC__StreamDecoderReadStatus to a C string.
   1.318 + *
   1.319 + *  Using a FLAC__StreamDecoderReadStatus as the index to this array
   1.320 + *  will give the string equivalent.  The contents should not be modified.
   1.321 + */
   1.322 +extern FLAC_API const char * const FLAC__StreamDecoderReadStatusString[];
   1.323 +
   1.324 +
   1.325 +/** Return values for the FLAC__StreamDecoder seek callback.
   1.326 + */
   1.327 +typedef enum {
   1.328 +
   1.329 +	FLAC__STREAM_DECODER_SEEK_STATUS_OK,
   1.330 +	/**< The seek was OK and decoding can continue. */
   1.331 +
   1.332 +	FLAC__STREAM_DECODER_SEEK_STATUS_ERROR,
   1.333 +	/**< An unrecoverable error occurred.  The decoder will return from the process call. */
   1.334 +
   1.335 +	FLAC__STREAM_DECODER_SEEK_STATUS_UNSUPPORTED
   1.336 +	/**< Client does not support seeking. */
   1.337 +
   1.338 +} FLAC__StreamDecoderSeekStatus;
   1.339 +
   1.340 +/** Maps a FLAC__StreamDecoderSeekStatus to a C string.
   1.341 + *
   1.342 + *  Using a FLAC__StreamDecoderSeekStatus as the index to this array
   1.343 + *  will give the string equivalent.  The contents should not be modified.
   1.344 + */
   1.345 +extern FLAC_API const char * const FLAC__StreamDecoderSeekStatusString[];
   1.346 +
   1.347 +
   1.348 +/** Return values for the FLAC__StreamDecoder tell callback.
   1.349 + */
   1.350 +typedef enum {
   1.351 +
   1.352 +	FLAC__STREAM_DECODER_TELL_STATUS_OK,
   1.353 +	/**< The tell was OK and decoding can continue. */
   1.354 +
   1.355 +	FLAC__STREAM_DECODER_TELL_STATUS_ERROR,
   1.356 +	/**< An unrecoverable error occurred.  The decoder will return from the process call. */
   1.357 +
   1.358 +	FLAC__STREAM_DECODER_TELL_STATUS_UNSUPPORTED
   1.359 +	/**< Client does not support telling the position. */
   1.360 +
   1.361 +} FLAC__StreamDecoderTellStatus;
   1.362 +
   1.363 +/** Maps a FLAC__StreamDecoderTellStatus to a C string.
   1.364 + *
   1.365 + *  Using a FLAC__StreamDecoderTellStatus as the index to this array
   1.366 + *  will give the string equivalent.  The contents should not be modified.
   1.367 + */
   1.368 +extern FLAC_API const char * const FLAC__StreamDecoderTellStatusString[];
   1.369 +
   1.370 +
   1.371 +/** Return values for the FLAC__StreamDecoder length callback.
   1.372 + */
   1.373 +typedef enum {
   1.374 +
   1.375 +	FLAC__STREAM_DECODER_LENGTH_STATUS_OK,
   1.376 +	/**< The length call was OK and decoding can continue. */
   1.377 +
   1.378 +	FLAC__STREAM_DECODER_LENGTH_STATUS_ERROR,
   1.379 +	/**< An unrecoverable error occurred.  The decoder will return from the process call. */
   1.380 +
   1.381 +	FLAC__STREAM_DECODER_LENGTH_STATUS_UNSUPPORTED
   1.382 +	/**< Client does not support reporting the length. */
   1.383 +
   1.384 +} FLAC__StreamDecoderLengthStatus;
   1.385 +
   1.386 +/** Maps a FLAC__StreamDecoderLengthStatus to a C string.
   1.387 + *
   1.388 + *  Using a FLAC__StreamDecoderLengthStatus as the index to this array
   1.389 + *  will give the string equivalent.  The contents should not be modified.
   1.390 + */
   1.391 +extern FLAC_API const char * const FLAC__StreamDecoderLengthStatusString[];
   1.392 +
   1.393 +
   1.394 +/** Return values for the FLAC__StreamDecoder write callback.
   1.395 + */
   1.396 +typedef enum {
   1.397 +
   1.398 +	FLAC__STREAM_DECODER_WRITE_STATUS_CONTINUE,
   1.399 +	/**< The write was OK and decoding can continue. */
   1.400 +
   1.401 +	FLAC__STREAM_DECODER_WRITE_STATUS_ABORT
   1.402 +	/**< An unrecoverable error occurred.  The decoder will return from the process call. */
   1.403 +
   1.404 +} FLAC__StreamDecoderWriteStatus;
   1.405 +
   1.406 +/** Maps a FLAC__StreamDecoderWriteStatus to a C string.
   1.407 + *
   1.408 + *  Using a FLAC__StreamDecoderWriteStatus as the index to this array
   1.409 + *  will give the string equivalent.  The contents should not be modified.
   1.410 + */
   1.411 +extern FLAC_API const char * const FLAC__StreamDecoderWriteStatusString[];
   1.412 +
   1.413 +
   1.414 +/** Possible values passed back to the FLAC__StreamDecoder error callback.
   1.415 + *  \c FLAC__STREAM_DECODER_ERROR_STATUS_LOST_SYNC is the generic catch-
   1.416 + *  all.  The rest could be caused by bad sync (false synchronization on
   1.417 + *  data that is not the start of a frame) or corrupted data.  The error
   1.418 + *  itself is the decoder's best guess at what happened assuming a correct
   1.419 + *  sync.  For example \c FLAC__STREAM_DECODER_ERROR_STATUS_BAD_HEADER
   1.420 + *  could be caused by a correct sync on the start of a frame, but some
   1.421 + *  data in the frame header was corrupted.  Or it could be the result of
   1.422 + *  syncing on a point the stream that looked like the starting of a frame
   1.423 + *  but was not.  \c FLAC__STREAM_DECODER_ERROR_STATUS_UNPARSEABLE_STREAM
   1.424 + *  could be because the decoder encountered a valid frame made by a future
   1.425 + *  version of the encoder which it cannot parse, or because of a false
   1.426 + *  sync making it appear as though an encountered frame was generated by
   1.427 + *  a future encoder.
   1.428 + */
   1.429 +typedef enum {
   1.430 +
   1.431 +	FLAC__STREAM_DECODER_ERROR_STATUS_LOST_SYNC,
   1.432 +	/**< An error in the stream caused the decoder to lose synchronization. */
   1.433 +
   1.434 +	FLAC__STREAM_DECODER_ERROR_STATUS_BAD_HEADER,
   1.435 +	/**< The decoder encountered a corrupted frame header. */
   1.436 +
   1.437 +	FLAC__STREAM_DECODER_ERROR_STATUS_FRAME_CRC_MISMATCH,
   1.438 +	/**< The frame's data did not match the CRC in the footer. */
   1.439 +
   1.440 +	FLAC__STREAM_DECODER_ERROR_STATUS_UNPARSEABLE_STREAM
   1.441 +	/**< The decoder encountered reserved fields in use in the stream. */
   1.442 +
   1.443 +} FLAC__StreamDecoderErrorStatus;
   1.444 +
   1.445 +/** Maps a FLAC__StreamDecoderErrorStatus to a C string.
   1.446 + *
   1.447 + *  Using a FLAC__StreamDecoderErrorStatus as the index to this array
   1.448 + *  will give the string equivalent.  The contents should not be modified.
   1.449 + */
   1.450 +extern FLAC_API const char * const FLAC__StreamDecoderErrorStatusString[];
   1.451 +
   1.452 +
   1.453 +/***********************************************************************
   1.454 + *
   1.455 + * class FLAC__StreamDecoder
   1.456 + *
   1.457 + ***********************************************************************/
   1.458 +
   1.459 +struct FLAC__StreamDecoderProtected;
   1.460 +struct FLAC__StreamDecoderPrivate;
   1.461 +/** The opaque structure definition for the stream decoder type.
   1.462 + *  See the \link flac_stream_decoder stream decoder module \endlink
   1.463 + *  for a detailed description.
   1.464 + */
   1.465 +typedef struct {
   1.466 +	struct FLAC__StreamDecoderProtected *protected_; /* avoid the C++ keyword 'protected' */
   1.467 +	struct FLAC__StreamDecoderPrivate *private_; /* avoid the C++ keyword 'private' */
   1.468 +} FLAC__StreamDecoder;
   1.469 +
   1.470 +/** Signature for the read callback.
   1.471 + *
   1.472 + *  A function pointer matching this signature must be passed to
   1.473 + *  FLAC__stream_decoder_init*_stream(). The supplied function will be
   1.474 + *  called when the decoder needs more input data.  The address of the
   1.475 + *  buffer to be filled is supplied, along with the number of bytes the
   1.476 + *  buffer can hold.  The callback may choose to supply less data and
   1.477 + *  modify the byte count but must be careful not to overflow the buffer.
   1.478 + *  The callback then returns a status code chosen from
   1.479 + *  FLAC__StreamDecoderReadStatus.
   1.480 + *
   1.481 + * Here is an example of a read callback for stdio streams:
   1.482 + * \code
   1.483 + * FLAC__StreamDecoderReadStatus read_cb(const FLAC__StreamDecoder *decoder, FLAC__byte buffer[], size_t *bytes, void *client_data)
   1.484 + * {
   1.485 + *   FILE *file = ((MyClientData*)client_data)->file;
   1.486 + *   if(*bytes > 0) {
   1.487 + *     *bytes = fread(buffer, sizeof(FLAC__byte), *bytes, file);
   1.488 + *     if(ferror(file))
   1.489 + *       return FLAC__STREAM_DECODER_READ_STATUS_ABORT;
   1.490 + *     else if(*bytes == 0)
   1.491 + *       return FLAC__STREAM_DECODER_READ_STATUS_END_OF_STREAM;
   1.492 + *     else
   1.493 + *       return FLAC__STREAM_DECODER_READ_STATUS_CONTINUE;
   1.494 + *   }
   1.495 + *   else
   1.496 + *     return FLAC__STREAM_DECODER_READ_STATUS_ABORT;
   1.497 + * }
   1.498 + * \endcode
   1.499 + *
   1.500 + * \note In general, FLAC__StreamDecoder functions which change the
   1.501 + * state should not be called on the \a decoder while in the callback.
   1.502 + *
   1.503 + * \param  decoder  The decoder instance calling the callback.
   1.504 + * \param  buffer   A pointer to a location for the callee to store
   1.505 + *                  data to be decoded.
   1.506 + * \param  bytes    A pointer to the size of the buffer.  On entry
   1.507 + *                  to the callback, it contains the maximum number
   1.508 + *                  of bytes that may be stored in \a buffer.  The
   1.509 + *                  callee must set it to the actual number of bytes
   1.510 + *                  stored (0 in case of error or end-of-stream) before
   1.511 + *                  returning.
   1.512 + * \param  client_data  The callee's client data set through
   1.513 + *                      FLAC__stream_decoder_init_*().
   1.514 + * \retval FLAC__StreamDecoderReadStatus
   1.515 + *    The callee's return status.  Note that the callback should return
   1.516 + *    \c FLAC__STREAM_DECODER_READ_STATUS_END_OF_STREAM if and only if
   1.517 + *    zero bytes were read and there is no more data to be read.
   1.518 + */
   1.519 +typedef FLAC__StreamDecoderReadStatus (*FLAC__StreamDecoderReadCallback)(const FLAC__StreamDecoder *decoder, FLAC__byte buffer[], size_t *bytes, void *client_data);
   1.520 +
   1.521 +/** Signature for the seek callback.
   1.522 + *
   1.523 + *  A function pointer matching this signature may be passed to
   1.524 + *  FLAC__stream_decoder_init*_stream().  The supplied function will be
   1.525 + *  called when the decoder needs to seek the input stream.  The decoder
   1.526 + *  will pass the absolute byte offset to seek to, 0 meaning the
   1.527 + *  beginning of the stream.
   1.528 + *
   1.529 + * Here is an example of a seek callback for stdio streams:
   1.530 + * \code
   1.531 + * FLAC__StreamDecoderSeekStatus seek_cb(const FLAC__StreamDecoder *decoder, FLAC__uint64 absolute_byte_offset, void *client_data)
   1.532 + * {
   1.533 + *   FILE *file = ((MyClientData*)client_data)->file;
   1.534 + *   if(file == stdin)
   1.535 + *     return FLAC__STREAM_DECODER_SEEK_STATUS_UNSUPPORTED;
   1.536 + *   else if(fseeko(file, (off_t)absolute_byte_offset, SEEK_SET) < 0)
   1.537 + *     return FLAC__STREAM_DECODER_SEEK_STATUS_ERROR;
   1.538 + *   else
   1.539 + *     return FLAC__STREAM_DECODER_SEEK_STATUS_OK;
   1.540 + * }
   1.541 + * \endcode
   1.542 + *
   1.543 + * \note In general, FLAC__StreamDecoder functions which change the
   1.544 + * state should not be called on the \a decoder while in the callback.
   1.545 + *
   1.546 + * \param  decoder  The decoder instance calling the callback.
   1.547 + * \param  absolute_byte_offset  The offset from the beginning of the stream
   1.548 + *                               to seek to.
   1.549 + * \param  client_data  The callee's client data set through
   1.550 + *                      FLAC__stream_decoder_init_*().
   1.551 + * \retval FLAC__StreamDecoderSeekStatus
   1.552 + *    The callee's return status.
   1.553 + */
   1.554 +typedef FLAC__StreamDecoderSeekStatus (*FLAC__StreamDecoderSeekCallback)(const FLAC__StreamDecoder *decoder, FLAC__uint64 absolute_byte_offset, void *client_data);
   1.555 +
   1.556 +/** Signature for the tell callback.
   1.557 + *
   1.558 + *  A function pointer matching this signature may be passed to
   1.559 + *  FLAC__stream_decoder_init*_stream().  The supplied function will be
   1.560 + *  called when the decoder wants to know the current position of the
   1.561 + *  stream.  The callback should return the byte offset from the
   1.562 + *  beginning of the stream.
   1.563 + *
   1.564 + * Here is an example of a tell callback for stdio streams:
   1.565 + * \code
   1.566 + * FLAC__StreamDecoderTellStatus tell_cb(const FLAC__StreamDecoder *decoder, FLAC__uint64 *absolute_byte_offset, void *client_data)
   1.567 + * {
   1.568 + *   FILE *file = ((MyClientData*)client_data)->file;
   1.569 + *   off_t pos;
   1.570 + *   if(file == stdin)
   1.571 + *     return FLAC__STREAM_DECODER_TELL_STATUS_UNSUPPORTED;
   1.572 + *   else if((pos = ftello(file)) < 0)
   1.573 + *     return FLAC__STREAM_DECODER_TELL_STATUS_ERROR;
   1.574 + *   else {
   1.575 + *     *absolute_byte_offset = (FLAC__uint64)pos;
   1.576 + *     return FLAC__STREAM_DECODER_TELL_STATUS_OK;
   1.577 + *   }
   1.578 + * }
   1.579 + * \endcode
   1.580 + *
   1.581 + * \note In general, FLAC__StreamDecoder functions which change the
   1.582 + * state should not be called on the \a decoder while in the callback.
   1.583 + *
   1.584 + * \param  decoder  The decoder instance calling the callback.
   1.585 + * \param  absolute_byte_offset  A pointer to storage for the current offset
   1.586 + *                               from the beginning of the stream.
   1.587 + * \param  client_data  The callee's client data set through
   1.588 + *                      FLAC__stream_decoder_init_*().
   1.589 + * \retval FLAC__StreamDecoderTellStatus
   1.590 + *    The callee's return status.
   1.591 + */
   1.592 +typedef FLAC__StreamDecoderTellStatus (*FLAC__StreamDecoderTellCallback)(const FLAC__StreamDecoder *decoder, FLAC__uint64 *absolute_byte_offset, void *client_data);
   1.593 +
   1.594 +/** Signature for the length callback.
   1.595 + *
   1.596 + *  A function pointer matching this signature may be passed to
   1.597 + *  FLAC__stream_decoder_init*_stream().  The supplied function will be
   1.598 + *  called when the decoder wants to know the total length of the stream
   1.599 + *  in bytes.
   1.600 + *
   1.601 + * Here is an example of a length callback for stdio streams:
   1.602 + * \code
   1.603 + * FLAC__StreamDecoderLengthStatus length_cb(const FLAC__StreamDecoder *decoder, FLAC__uint64 *stream_length, void *client_data)
   1.604 + * {
   1.605 + *   FILE *file = ((MyClientData*)client_data)->file;
   1.606 + *   struct stat filestats;
   1.607 + *
   1.608 + *   if(file == stdin)
   1.609 + *     return FLAC__STREAM_DECODER_LENGTH_STATUS_UNSUPPORTED;
   1.610 + *   else if(fstat(fileno(file), &filestats) != 0)
   1.611 + *     return FLAC__STREAM_DECODER_LENGTH_STATUS_ERROR;
   1.612 + *   else {
   1.613 + *     *stream_length = (FLAC__uint64)filestats.st_size;
   1.614 + *     return FLAC__STREAM_DECODER_LENGTH_STATUS_OK;
   1.615 + *   }
   1.616 + * }
   1.617 + * \endcode
   1.618 + *
   1.619 + * \note In general, FLAC__StreamDecoder functions which change the
   1.620 + * state should not be called on the \a decoder while in the callback.
   1.621 + *
   1.622 + * \param  decoder  The decoder instance calling the callback.
   1.623 + * \param  stream_length  A pointer to storage for the length of the stream
   1.624 + *                        in bytes.
   1.625 + * \param  client_data  The callee's client data set through
   1.626 + *                      FLAC__stream_decoder_init_*().
   1.627 + * \retval FLAC__StreamDecoderLengthStatus
   1.628 + *    The callee's return status.
   1.629 + */
   1.630 +typedef FLAC__StreamDecoderLengthStatus (*FLAC__StreamDecoderLengthCallback)(const FLAC__StreamDecoder *decoder, FLAC__uint64 *stream_length, void *client_data);
   1.631 +
   1.632 +/** Signature for the EOF callback.
   1.633 + *
   1.634 + *  A function pointer matching this signature may be passed to
   1.635 + *  FLAC__stream_decoder_init*_stream().  The supplied function will be
   1.636 + *  called when the decoder needs to know if the end of the stream has
   1.637 + *  been reached.
   1.638 + *
   1.639 + * Here is an example of a EOF callback for stdio streams:
   1.640 + * FLAC__bool eof_cb(const FLAC__StreamDecoder *decoder, void *client_data)
   1.641 + * \code
   1.642 + * {
   1.643 + *   FILE *file = ((MyClientData*)client_data)->file;
   1.644 + *   return feof(file)? true : false;
   1.645 + * }
   1.646 + * \endcode
   1.647 + *
   1.648 + * \note In general, FLAC__StreamDecoder functions which change the
   1.649 + * state should not be called on the \a decoder while in the callback.
   1.650 + *
   1.651 + * \param  decoder  The decoder instance calling the callback.
   1.652 + * \param  client_data  The callee's client data set through
   1.653 + *                      FLAC__stream_decoder_init_*().
   1.654 + * \retval FLAC__bool
   1.655 + *    \c true if the currently at the end of the stream, else \c false.
   1.656 + */
   1.657 +typedef FLAC__bool (*FLAC__StreamDecoderEofCallback)(const FLAC__StreamDecoder *decoder, void *client_data);
   1.658 +
   1.659 +/** Signature for the write callback.
   1.660 + *
   1.661 + *  A function pointer matching this signature must be passed to one of
   1.662 + *  the FLAC__stream_decoder_init_*() functions.
   1.663 + *  The supplied function will be called when the decoder has decoded a
   1.664 + *  single audio frame.  The decoder will pass the frame metadata as well
   1.665 + *  as an array of pointers (one for each channel) pointing to the
   1.666 + *  decoded audio.
   1.667 + *
   1.668 + * \note In general, FLAC__StreamDecoder functions which change the
   1.669 + * state should not be called on the \a decoder while in the callback.
   1.670 + *
   1.671 + * \param  decoder  The decoder instance calling the callback.
   1.672 + * \param  frame    The description of the decoded frame.  See
   1.673 + *                  FLAC__Frame.
   1.674 + * \param  buffer   An array of pointers to decoded channels of data.
   1.675 + *                  Each pointer will point to an array of signed
   1.676 + *                  samples of length \a frame->header.blocksize.
   1.677 + *                  Channels will be ordered according to the FLAC
   1.678 + *                  specification; see the documentation for the
   1.679 + *                  <A HREF="../format.html#frame_header">frame header</A>.
   1.680 + * \param  client_data  The callee's client data set through
   1.681 + *                      FLAC__stream_decoder_init_*().
   1.682 + * \retval FLAC__StreamDecoderWriteStatus
   1.683 + *    The callee's return status.
   1.684 + */
   1.685 +typedef FLAC__StreamDecoderWriteStatus (*FLAC__StreamDecoderWriteCallback)(const FLAC__StreamDecoder *decoder, const FLAC__Frame *frame, const FLAC__int32 * const buffer[], void *client_data);
   1.686 +
   1.687 +/** Signature for the metadata callback.
   1.688 + *
   1.689 + *  A function pointer matching this signature must be passed to one of
   1.690 + *  the FLAC__stream_decoder_init_*() functions.
   1.691 + *  The supplied function will be called when the decoder has decoded a
   1.692 + *  metadata block.  In a valid FLAC file there will always be one
   1.693 + *  \c STREAMINFO block, followed by zero or more other metadata blocks.
   1.694 + *  These will be supplied by the decoder in the same order as they
   1.695 + *  appear in the stream and always before the first audio frame (i.e.
   1.696 + *  write callback).  The metadata block that is passed in must not be
   1.697 + *  modified, and it doesn't live beyond the callback, so you should make
   1.698 + *  a copy of it with FLAC__metadata_object_clone() if you will need it
   1.699 + *  elsewhere.  Since metadata blocks can potentially be large, by
   1.700 + *  default the decoder only calls the metadata callback for the
   1.701 + *  \c STREAMINFO block; you can instruct the decoder to pass or filter
   1.702 + *  other blocks with FLAC__stream_decoder_set_metadata_*() calls.
   1.703 + *
   1.704 + * \note In general, FLAC__StreamDecoder functions which change the
   1.705 + * state should not be called on the \a decoder while in the callback.
   1.706 + *
   1.707 + * \param  decoder  The decoder instance calling the callback.
   1.708 + * \param  metadata The decoded metadata block.
   1.709 + * \param  client_data  The callee's client data set through
   1.710 + *                      FLAC__stream_decoder_init_*().
   1.711 + */
   1.712 +typedef void (*FLAC__StreamDecoderMetadataCallback)(const FLAC__StreamDecoder *decoder, const FLAC__StreamMetadata *metadata, void *client_data);
   1.713 +
   1.714 +/** Signature for the error callback.
   1.715 + *
   1.716 + *  A function pointer matching this signature must be passed to one of
   1.717 + *  the FLAC__stream_decoder_init_*() functions.
   1.718 + *  The supplied function will be called whenever an error occurs during
   1.719 + *  decoding.
   1.720 + *
   1.721 + * \note In general, FLAC__StreamDecoder functions which change the
   1.722 + * state should not be called on the \a decoder while in the callback.
   1.723 + *
   1.724 + * \param  decoder  The decoder instance calling the callback.
   1.725 + * \param  status   The error encountered by the decoder.
   1.726 + * \param  client_data  The callee's client data set through
   1.727 + *                      FLAC__stream_decoder_init_*().
   1.728 + */
   1.729 +typedef void (*FLAC__StreamDecoderErrorCallback)(const FLAC__StreamDecoder *decoder, FLAC__StreamDecoderErrorStatus status, void *client_data);
   1.730 +
   1.731 +
   1.732 +/***********************************************************************
   1.733 + *
   1.734 + * Class constructor/destructor
   1.735 + *
   1.736 + ***********************************************************************/
   1.737 +
   1.738 +/** Create a new stream decoder instance.  The instance is created with
   1.739 + *  default settings; see the individual FLAC__stream_decoder_set_*()
   1.740 + *  functions for each setting's default.
   1.741 + *
   1.742 + * \retval FLAC__StreamDecoder*
   1.743 + *    \c NULL if there was an error allocating memory, else the new instance.
   1.744 + */
   1.745 +FLAC_API FLAC__StreamDecoder *FLAC__stream_decoder_new(void);
   1.746 +
   1.747 +/** Free a decoder instance.  Deletes the object pointed to by \a decoder.
   1.748 + *
   1.749 + * \param decoder  A pointer to an existing decoder.
   1.750 + * \assert
   1.751 + *    \code decoder != NULL \endcode
   1.752 + */
   1.753 +FLAC_API void FLAC__stream_decoder_delete(FLAC__StreamDecoder *decoder);
   1.754 +
   1.755 +
   1.756 +/***********************************************************************
   1.757 + *
   1.758 + * Public class method prototypes
   1.759 + *
   1.760 + ***********************************************************************/
   1.761 +
   1.762 +/** Set the serial number for the FLAC stream within the Ogg container.
   1.763 + *  The default behavior is to use the serial number of the first Ogg
   1.764 + *  page.  Setting a serial number here will explicitly specify which
   1.765 + *  stream is to be decoded.
   1.766 + *
   1.767 + * \note
   1.768 + * This does not need to be set for native FLAC decoding.
   1.769 + *
   1.770 + * \default \c use serial number of first page
   1.771 + * \param  decoder        A decoder instance to set.
   1.772 + * \param  serial_number  See above.
   1.773 + * \assert
   1.774 + *    \code decoder != NULL \endcode
   1.775 + * \retval FLAC__bool
   1.776 + *    \c false if the decoder is already initialized, else \c true.
   1.777 + */
   1.778 +FLAC_API FLAC__bool FLAC__stream_decoder_set_ogg_serial_number(FLAC__StreamDecoder *decoder, long serial_number);
   1.779 +
   1.780 +/** Set the "MD5 signature checking" flag.  If \c true, the decoder will
   1.781 + *  compute the MD5 signature of the unencoded audio data while decoding
   1.782 + *  and compare it to the signature from the STREAMINFO block, if it
   1.783 + *  exists, during FLAC__stream_decoder_finish().
   1.784 + *
   1.785 + *  MD5 signature checking will be turned off (until the next
   1.786 + *  FLAC__stream_decoder_reset()) if there is no signature in the
   1.787 + *  STREAMINFO block or when a seek is attempted.
   1.788 + *
   1.789 + *  Clients that do not use the MD5 check should leave this off to speed
   1.790 + *  up decoding.
   1.791 + *
   1.792 + * \default \c false
   1.793 + * \param  decoder  A decoder instance to set.
   1.794 + * \param  value    Flag value (see above).
   1.795 + * \assert
   1.796 + *    \code decoder != NULL \endcode
   1.797 + * \retval FLAC__bool
   1.798 + *    \c false if the decoder is already initialized, else \c true.
   1.799 + */
   1.800 +FLAC_API FLAC__bool FLAC__stream_decoder_set_md5_checking(FLAC__StreamDecoder *decoder, FLAC__bool value);
   1.801 +
   1.802 +/** Direct the decoder to pass on all metadata blocks of type \a type.
   1.803 + *
   1.804 + * \default By default, only the \c STREAMINFO block is returned via the
   1.805 + *          metadata callback.
   1.806 + * \param  decoder  A decoder instance to set.
   1.807 + * \param  type     See above.
   1.808 + * \assert
   1.809 + *    \code decoder != NULL \endcode
   1.810 + *    \a type is valid
   1.811 + * \retval FLAC__bool
   1.812 + *    \c false if the decoder is already initialized, else \c true.
   1.813 + */
   1.814 +FLAC_API FLAC__bool FLAC__stream_decoder_set_metadata_respond(FLAC__StreamDecoder *decoder, FLAC__MetadataType type);
   1.815 +
   1.816 +/** Direct the decoder to pass on all APPLICATION metadata blocks of the
   1.817 + *  given \a id.
   1.818 + *
   1.819 + * \default By default, only the \c STREAMINFO block is returned via the
   1.820 + *          metadata callback.
   1.821 + * \param  decoder  A decoder instance to set.
   1.822 + * \param  id       See above.
   1.823 + * \assert
   1.824 + *    \code decoder != NULL \endcode
   1.825 + *    \code id != NULL \endcode
   1.826 + * \retval FLAC__bool
   1.827 + *    \c false if the decoder is already initialized, else \c true.
   1.828 + */
   1.829 +FLAC_API FLAC__bool FLAC__stream_decoder_set_metadata_respond_application(FLAC__StreamDecoder *decoder, const FLAC__byte id[4]);
   1.830 +
   1.831 +/** Direct the decoder to pass on all metadata blocks of any type.
   1.832 + *
   1.833 + * \default By default, only the \c STREAMINFO block is returned via the
   1.834 + *          metadata callback.
   1.835 + * \param  decoder  A decoder instance to set.
   1.836 + * \assert
   1.837 + *    \code decoder != NULL \endcode
   1.838 + * \retval FLAC__bool
   1.839 + *    \c false if the decoder is already initialized, else \c true.
   1.840 + */
   1.841 +FLAC_API FLAC__bool FLAC__stream_decoder_set_metadata_respond_all(FLAC__StreamDecoder *decoder);
   1.842 +
   1.843 +/** Direct the decoder to filter out all metadata blocks of type \a type.
   1.844 + *
   1.845 + * \default By default, only the \c STREAMINFO block is returned via the
   1.846 + *          metadata callback.
   1.847 + * \param  decoder  A decoder instance to set.
   1.848 + * \param  type     See above.
   1.849 + * \assert
   1.850 + *    \code decoder != NULL \endcode
   1.851 + *    \a type is valid
   1.852 + * \retval FLAC__bool
   1.853 + *    \c false if the decoder is already initialized, else \c true.
   1.854 + */
   1.855 +FLAC_API FLAC__bool FLAC__stream_decoder_set_metadata_ignore(FLAC__StreamDecoder *decoder, FLAC__MetadataType type);
   1.856 +
   1.857 +/** Direct the decoder to filter out all APPLICATION metadata blocks of
   1.858 + *  the given \a id.
   1.859 + *
   1.860 + * \default By default, only the \c STREAMINFO block is returned via the
   1.861 + *          metadata callback.
   1.862 + * \param  decoder  A decoder instance to set.
   1.863 + * \param  id       See above.
   1.864 + * \assert
   1.865 + *    \code decoder != NULL \endcode
   1.866 + *    \code id != NULL \endcode
   1.867 + * \retval FLAC__bool
   1.868 + *    \c false if the decoder is already initialized, else \c true.
   1.869 + */
   1.870 +FLAC_API FLAC__bool FLAC__stream_decoder_set_metadata_ignore_application(FLAC__StreamDecoder *decoder, const FLAC__byte id[4]);
   1.871 +
   1.872 +/** Direct the decoder to filter out all metadata blocks of any type.
   1.873 + *
   1.874 + * \default By default, only the \c STREAMINFO block is returned via the
   1.875 + *          metadata callback.
   1.876 + * \param  decoder  A decoder instance to set.
   1.877 + * \assert
   1.878 + *    \code decoder != NULL \endcode
   1.879 + * \retval FLAC__bool
   1.880 + *    \c false if the decoder is already initialized, else \c true.
   1.881 + */
   1.882 +FLAC_API FLAC__bool FLAC__stream_decoder_set_metadata_ignore_all(FLAC__StreamDecoder *decoder);
   1.883 +
   1.884 +/** Get the current decoder state.
   1.885 + *
   1.886 + * \param  decoder  A decoder instance to query.
   1.887 + * \assert
   1.888 + *    \code decoder != NULL \endcode
   1.889 + * \retval FLAC__StreamDecoderState
   1.890 + *    The current decoder state.
   1.891 + */
   1.892 +FLAC_API FLAC__StreamDecoderState FLAC__stream_decoder_get_state(const FLAC__StreamDecoder *decoder);
   1.893 +
   1.894 +/** Get the current decoder state as a C string.
   1.895 + *
   1.896 + * \param  decoder  A decoder instance to query.
   1.897 + * \assert
   1.898 + *    \code decoder != NULL \endcode
   1.899 + * \retval const char *
   1.900 + *    The decoder state as a C string.  Do not modify the contents.
   1.901 + */
   1.902 +FLAC_API const char *FLAC__stream_decoder_get_resolved_state_string(const FLAC__StreamDecoder *decoder);
   1.903 +
   1.904 +/** Get the "MD5 signature checking" flag.
   1.905 + *  This is the value of the setting, not whether or not the decoder is
   1.906 + *  currently checking the MD5 (remember, it can be turned off automatically
   1.907 + *  by a seek).  When the decoder is reset the flag will be restored to the
   1.908 + *  value returned by this function.
   1.909 + *
   1.910 + * \param  decoder  A decoder instance to query.
   1.911 + * \assert
   1.912 + *    \code decoder != NULL \endcode
   1.913 + * \retval FLAC__bool
   1.914 + *    See above.
   1.915 + */
   1.916 +FLAC_API FLAC__bool FLAC__stream_decoder_get_md5_checking(const FLAC__StreamDecoder *decoder);
   1.917 +
   1.918 +/** Get the total number of samples in the stream being decoded.
   1.919 + *  Will only be valid after decoding has started and will contain the
   1.920 + *  value from the \c STREAMINFO block.  A value of \c 0 means "unknown".
   1.921 + *
   1.922 + * \param  decoder  A decoder instance to query.
   1.923 + * \assert
   1.924 + *    \code decoder != NULL \endcode
   1.925 + * \retval unsigned
   1.926 + *    See above.
   1.927 + */
   1.928 +FLAC_API FLAC__uint64 FLAC__stream_decoder_get_total_samples(const FLAC__StreamDecoder *decoder);
   1.929 +
   1.930 +/** Get the current number of channels in the stream being decoded.
   1.931 + *  Will only be valid after decoding has started and will contain the
   1.932 + *  value from the most recently decoded frame header.
   1.933 + *
   1.934 + * \param  decoder  A decoder instance to query.
   1.935 + * \assert
   1.936 + *    \code decoder != NULL \endcode
   1.937 + * \retval unsigned
   1.938 + *    See above.
   1.939 + */
   1.940 +FLAC_API unsigned FLAC__stream_decoder_get_channels(const FLAC__StreamDecoder *decoder);
   1.941 +
   1.942 +/** Get the current channel assignment in the stream being decoded.
   1.943 + *  Will only be valid after decoding has started and will contain the
   1.944 + *  value from the most recently decoded frame header.
   1.945 + *
   1.946 + * \param  decoder  A decoder instance to query.
   1.947 + * \assert
   1.948 + *    \code decoder != NULL \endcode
   1.949 + * \retval FLAC__ChannelAssignment
   1.950 + *    See above.
   1.951 + */
   1.952 +FLAC_API FLAC__ChannelAssignment FLAC__stream_decoder_get_channel_assignment(const FLAC__StreamDecoder *decoder);
   1.953 +
   1.954 +/** Get the current sample resolution in the stream being decoded.
   1.955 + *  Will only be valid after decoding has started and will contain the
   1.956 + *  value from the most recently decoded frame header.
   1.957 + *
   1.958 + * \param  decoder  A decoder instance to query.
   1.959 + * \assert
   1.960 + *    \code decoder != NULL \endcode
   1.961 + * \retval unsigned
   1.962 + *    See above.
   1.963 + */
   1.964 +FLAC_API unsigned FLAC__stream_decoder_get_bits_per_sample(const FLAC__StreamDecoder *decoder);
   1.965 +
   1.966 +/** Get the current sample rate in Hz of the stream being decoded.
   1.967 + *  Will only be valid after decoding has started and will contain the
   1.968 + *  value from the most recently decoded frame header.
   1.969 + *
   1.970 + * \param  decoder  A decoder instance to query.
   1.971 + * \assert
   1.972 + *    \code decoder != NULL \endcode
   1.973 + * \retval unsigned
   1.974 + *    See above.
   1.975 + */
   1.976 +FLAC_API unsigned FLAC__stream_decoder_get_sample_rate(const FLAC__StreamDecoder *decoder);
   1.977 +
   1.978 +/** Get the current blocksize of the stream being decoded.
   1.979 + *  Will only be valid after decoding has started and will contain the
   1.980 + *  value from the most recently decoded frame header.
   1.981 + *
   1.982 + * \param  decoder  A decoder instance to query.
   1.983 + * \assert
   1.984 + *    \code decoder != NULL \endcode
   1.985 + * \retval unsigned
   1.986 + *    See above.
   1.987 + */
   1.988 +FLAC_API unsigned FLAC__stream_decoder_get_blocksize(const FLAC__StreamDecoder *decoder);
   1.989 +
   1.990 +/** Returns the decoder's current read position within the stream.
   1.991 + *  The position is the byte offset from the start of the stream.
   1.992 + *  Bytes before this position have been fully decoded.  Note that
   1.993 + *  there may still be undecoded bytes in the decoder's read FIFO.
   1.994 + *  The returned position is correct even after a seek.
   1.995 + *
   1.996 + *  \warning This function currently only works for native FLAC,
   1.997 + *           not Ogg FLAC streams.
   1.998 + *
   1.999 + * \param  decoder   A decoder instance to query.
  1.1000 + * \param  position  Address at which to return the desired position.
  1.1001 + * \assert
  1.1002 + *    \code decoder != NULL \endcode
  1.1003 + *    \code position != NULL \endcode
  1.1004 + * \retval FLAC__bool
  1.1005 + *    \c true if successful, \c false if the stream is not native FLAC,
  1.1006 + *    or there was an error from the 'tell' callback or it returned
  1.1007 + *    \c FLAC__STREAM_DECODER_TELL_STATUS_UNSUPPORTED.
  1.1008 + */
  1.1009 +FLAC_API FLAC__bool FLAC__stream_decoder_get_decode_position(const FLAC__StreamDecoder *decoder, FLAC__uint64 *position);
  1.1010 +
  1.1011 +/** Initialize the decoder instance to decode native FLAC streams.
  1.1012 + *
  1.1013 + *  This flavor of initialization sets up the decoder to decode from a
  1.1014 + *  native FLAC stream. I/O is performed via callbacks to the client.
  1.1015 + *  For decoding from a plain file via filename or open FILE*,
  1.1016 + *  FLAC__stream_decoder_init_file() and FLAC__stream_decoder_init_FILE()
  1.1017 + *  provide a simpler interface.
  1.1018 + *
  1.1019 + *  This function should be called after FLAC__stream_decoder_new() and
  1.1020 + *  FLAC__stream_decoder_set_*() but before any of the
  1.1021 + *  FLAC__stream_decoder_process_*() functions.  Will set and return the
  1.1022 + *  decoder state, which will be FLAC__STREAM_DECODER_SEARCH_FOR_METADATA
  1.1023 + *  if initialization succeeded.
  1.1024 + *
  1.1025 + * \param  decoder            An uninitialized decoder instance.
  1.1026 + * \param  read_callback      See FLAC__StreamDecoderReadCallback.  This
  1.1027 + *                            pointer must not be \c NULL.
  1.1028 + * \param  seek_callback      See FLAC__StreamDecoderSeekCallback.  This
  1.1029 + *                            pointer may be \c NULL if seeking is not
  1.1030 + *                            supported.  If \a seek_callback is not \c NULL then a
  1.1031 + *                            \a tell_callback, \a length_callback, and \a eof_callback must also be supplied.
  1.1032 + *                            Alternatively, a dummy seek callback that just
  1.1033 + *                            returns \c FLAC__STREAM_DECODER_SEEK_STATUS_UNSUPPORTED
  1.1034 + *                            may also be supplied, all though this is slightly
  1.1035 + *                            less efficient for the decoder.
  1.1036 + * \param  tell_callback      See FLAC__StreamDecoderTellCallback.  This
  1.1037 + *                            pointer may be \c NULL if not supported by the client.  If
  1.1038 + *                            \a seek_callback is not \c NULL then a
  1.1039 + *                            \a tell_callback must also be supplied.
  1.1040 + *                            Alternatively, a dummy tell callback that just
  1.1041 + *                            returns \c FLAC__STREAM_DECODER_TELL_STATUS_UNSUPPORTED
  1.1042 + *                            may also be supplied, all though this is slightly
  1.1043 + *                            less efficient for the decoder.
  1.1044 + * \param  length_callback    See FLAC__StreamDecoderLengthCallback.  This
  1.1045 + *                            pointer may be \c NULL if not supported by the client.  If
  1.1046 + *                            \a seek_callback is not \c NULL then a
  1.1047 + *                            \a length_callback must also be supplied.
  1.1048 + *                            Alternatively, a dummy length callback that just
  1.1049 + *                            returns \c FLAC__STREAM_DECODER_LENGTH_STATUS_UNSUPPORTED
  1.1050 + *                            may also be supplied, all though this is slightly
  1.1051 + *                            less efficient for the decoder.
  1.1052 + * \param  eof_callback       See FLAC__StreamDecoderEofCallback.  This
  1.1053 + *                            pointer may be \c NULL if not supported by the client.  If
  1.1054 + *                            \a seek_callback is not \c NULL then a
  1.1055 + *                            \a eof_callback must also be supplied.
  1.1056 + *                            Alternatively, a dummy length callback that just
  1.1057 + *                            returns \c false
  1.1058 + *                            may also be supplied, all though this is slightly
  1.1059 + *                            less efficient for the decoder.
  1.1060 + * \param  write_callback     See FLAC__StreamDecoderWriteCallback.  This
  1.1061 + *                            pointer must not be \c NULL.
  1.1062 + * \param  metadata_callback  See FLAC__StreamDecoderMetadataCallback.  This
  1.1063 + *                            pointer may be \c NULL if the callback is not
  1.1064 + *                            desired.
  1.1065 + * \param  error_callback     See FLAC__StreamDecoderErrorCallback.  This
  1.1066 + *                            pointer must not be \c NULL.
  1.1067 + * \param  client_data        This value will be supplied to callbacks in their
  1.1068 + *                            \a client_data argument.
  1.1069 + * \assert
  1.1070 + *    \code decoder != NULL \endcode
  1.1071 + * \retval FLAC__StreamDecoderInitStatus
  1.1072 + *    \c FLAC__STREAM_DECODER_INIT_STATUS_OK if initialization was successful;
  1.1073 + *    see FLAC__StreamDecoderInitStatus for the meanings of other return values.
  1.1074 + */
  1.1075 +FLAC_API FLAC__StreamDecoderInitStatus FLAC__stream_decoder_init_stream(
  1.1076 +	FLAC__StreamDecoder *decoder,
  1.1077 +	FLAC__StreamDecoderReadCallback read_callback,
  1.1078 +	FLAC__StreamDecoderSeekCallback seek_callback,
  1.1079 +	FLAC__StreamDecoderTellCallback tell_callback,
  1.1080 +	FLAC__StreamDecoderLengthCallback length_callback,
  1.1081 +	FLAC__StreamDecoderEofCallback eof_callback,
  1.1082 +	FLAC__StreamDecoderWriteCallback write_callback,
  1.1083 +	FLAC__StreamDecoderMetadataCallback metadata_callback,
  1.1084 +	FLAC__StreamDecoderErrorCallback error_callback,
  1.1085 +	void *client_data
  1.1086 +);
  1.1087 +
  1.1088 +/** Initialize the decoder instance to decode Ogg FLAC streams.
  1.1089 + *
  1.1090 + *  This flavor of initialization sets up the decoder to decode from a
  1.1091 + *  FLAC stream in an Ogg container. I/O is performed via callbacks to the
  1.1092 + *  client.  For decoding from a plain file via filename or open FILE*,
  1.1093 + *  FLAC__stream_decoder_init_ogg_file() and FLAC__stream_decoder_init_ogg_FILE()
  1.1094 + *  provide a simpler interface.
  1.1095 + *
  1.1096 + *  This function should be called after FLAC__stream_decoder_new() and
  1.1097 + *  FLAC__stream_decoder_set_*() but before any of the
  1.1098 + *  FLAC__stream_decoder_process_*() functions.  Will set and return the
  1.1099 + *  decoder state, which will be FLAC__STREAM_DECODER_SEARCH_FOR_METADATA
  1.1100 + *  if initialization succeeded.
  1.1101 + *
  1.1102 + *  \note Support for Ogg FLAC in the library is optional.  If this
  1.1103 + *  library has been built without support for Ogg FLAC, this function
  1.1104 + *  will return \c FLAC__STREAM_DECODER_INIT_STATUS_UNSUPPORTED_CONTAINER.
  1.1105 + *
  1.1106 + * \param  decoder            An uninitialized decoder instance.
  1.1107 + * \param  read_callback      See FLAC__StreamDecoderReadCallback.  This
  1.1108 + *                            pointer must not be \c NULL.
  1.1109 + * \param  seek_callback      See FLAC__StreamDecoderSeekCallback.  This
  1.1110 + *                            pointer may be \c NULL if seeking is not
  1.1111 + *                            supported.  If \a seek_callback is not \c NULL then a
  1.1112 + *                            \a tell_callback, \a length_callback, and \a eof_callback must also be supplied.
  1.1113 + *                            Alternatively, a dummy seek callback that just
  1.1114 + *                            returns \c FLAC__STREAM_DECODER_SEEK_STATUS_UNSUPPORTED
  1.1115 + *                            may also be supplied, all though this is slightly
  1.1116 + *                            less efficient for the decoder.
  1.1117 + * \param  tell_callback      See FLAC__StreamDecoderTellCallback.  This
  1.1118 + *                            pointer may be \c NULL if not supported by the client.  If
  1.1119 + *                            \a seek_callback is not \c NULL then a
  1.1120 + *                            \a tell_callback must also be supplied.
  1.1121 + *                            Alternatively, a dummy tell callback that just
  1.1122 + *                            returns \c FLAC__STREAM_DECODER_TELL_STATUS_UNSUPPORTED
  1.1123 + *                            may also be supplied, all though this is slightly
  1.1124 + *                            less efficient for the decoder.
  1.1125 + * \param  length_callback    See FLAC__StreamDecoderLengthCallback.  This
  1.1126 + *                            pointer may be \c NULL if not supported by the client.  If
  1.1127 + *                            \a seek_callback is not \c NULL then a
  1.1128 + *                            \a length_callback must also be supplied.
  1.1129 + *                            Alternatively, a dummy length callback that just
  1.1130 + *                            returns \c FLAC__STREAM_DECODER_LENGTH_STATUS_UNSUPPORTED
  1.1131 + *                            may also be supplied, all though this is slightly
  1.1132 + *                            less efficient for the decoder.
  1.1133 + * \param  eof_callback       See FLAC__StreamDecoderEofCallback.  This
  1.1134 + *                            pointer may be \c NULL if not supported by the client.  If
  1.1135 + *                            \a seek_callback is not \c NULL then a
  1.1136 + *                            \a eof_callback must also be supplied.
  1.1137 + *                            Alternatively, a dummy length callback that just
  1.1138 + *                            returns \c false
  1.1139 + *                            may also be supplied, all though this is slightly
  1.1140 + *                            less efficient for the decoder.
  1.1141 + * \param  write_callback     See FLAC__StreamDecoderWriteCallback.  This
  1.1142 + *                            pointer must not be \c NULL.
  1.1143 + * \param  metadata_callback  See FLAC__StreamDecoderMetadataCallback.  This
  1.1144 + *                            pointer may be \c NULL if the callback is not
  1.1145 + *                            desired.
  1.1146 + * \param  error_callback     See FLAC__StreamDecoderErrorCallback.  This
  1.1147 + *                            pointer must not be \c NULL.
  1.1148 + * \param  client_data        This value will be supplied to callbacks in their
  1.1149 + *                            \a client_data argument.
  1.1150 + * \assert
  1.1151 + *    \code decoder != NULL \endcode
  1.1152 + * \retval FLAC__StreamDecoderInitStatus
  1.1153 + *    \c FLAC__STREAM_DECODER_INIT_STATUS_OK if initialization was successful;
  1.1154 + *    see FLAC__StreamDecoderInitStatus for the meanings of other return values.
  1.1155 + */
  1.1156 +FLAC_API FLAC__StreamDecoderInitStatus FLAC__stream_decoder_init_ogg_stream(
  1.1157 +	FLAC__StreamDecoder *decoder,
  1.1158 +	FLAC__StreamDecoderReadCallback read_callback,
  1.1159 +	FLAC__StreamDecoderSeekCallback seek_callback,
  1.1160 +	FLAC__StreamDecoderTellCallback tell_callback,
  1.1161 +	FLAC__StreamDecoderLengthCallback length_callback,
  1.1162 +	FLAC__StreamDecoderEofCallback eof_callback,
  1.1163 +	FLAC__StreamDecoderWriteCallback write_callback,
  1.1164 +	FLAC__StreamDecoderMetadataCallback metadata_callback,
  1.1165 +	FLAC__StreamDecoderErrorCallback error_callback,
  1.1166 +	void *client_data
  1.1167 +);
  1.1168 +
  1.1169 +/** Initialize the decoder instance to decode native FLAC files.
  1.1170 + *
  1.1171 + *  This flavor of initialization sets up the decoder to decode from a
  1.1172 + *  plain native FLAC file.  For non-stdio streams, you must use
  1.1173 + *  FLAC__stream_decoder_init_stream() and provide callbacks for the I/O.
  1.1174 + *
  1.1175 + *  This function should be called after FLAC__stream_decoder_new() and
  1.1176 + *  FLAC__stream_decoder_set_*() but before any of the
  1.1177 + *  FLAC__stream_decoder_process_*() functions.  Will set and return the
  1.1178 + *  decoder state, which will be FLAC__STREAM_DECODER_SEARCH_FOR_METADATA
  1.1179 + *  if initialization succeeded.
  1.1180 + *
  1.1181 + * \param  decoder            An uninitialized decoder instance.
  1.1182 + * \param  file               An open FLAC file.  The file should have been
  1.1183 + *                            opened with mode \c "rb" and rewound.  The file
  1.1184 + *                            becomes owned by the decoder and should not be
  1.1185 + *                            manipulated by the client while decoding.
  1.1186 + *                            Unless \a file is \c stdin, it will be closed
  1.1187 + *                            when FLAC__stream_decoder_finish() is called.
  1.1188 + *                            Note however that seeking will not work when
  1.1189 + *                            decoding from \c stdout since it is not seekable.
  1.1190 + * \param  write_callback     See FLAC__StreamDecoderWriteCallback.  This
  1.1191 + *                            pointer must not be \c NULL.
  1.1192 + * \param  metadata_callback  See FLAC__StreamDecoderMetadataCallback.  This
  1.1193 + *                            pointer may be \c NULL if the callback is not
  1.1194 + *                            desired.
  1.1195 + * \param  error_callback     See FLAC__StreamDecoderErrorCallback.  This
  1.1196 + *                            pointer must not be \c NULL.
  1.1197 + * \param  client_data        This value will be supplied to callbacks in their
  1.1198 + *                            \a client_data argument.
  1.1199 + * \assert
  1.1200 + *    \code decoder != NULL \endcode
  1.1201 + *    \code file != NULL \endcode
  1.1202 + * \retval FLAC__StreamDecoderInitStatus
  1.1203 + *    \c FLAC__STREAM_DECODER_INIT_STATUS_OK if initialization was successful;
  1.1204 + *    see FLAC__StreamDecoderInitStatus for the meanings of other return values.
  1.1205 + */
  1.1206 +FLAC_API FLAC__StreamDecoderInitStatus FLAC__stream_decoder_init_FILE(
  1.1207 +	FLAC__StreamDecoder *decoder,
  1.1208 +	FILE *file,
  1.1209 +	FLAC__StreamDecoderWriteCallback write_callback,
  1.1210 +	FLAC__StreamDecoderMetadataCallback metadata_callback,
  1.1211 +	FLAC__StreamDecoderErrorCallback error_callback,
  1.1212 +	void *client_data
  1.1213 +);
  1.1214 +
  1.1215 +/** Initialize the decoder instance to decode Ogg FLAC files.
  1.1216 + *
  1.1217 + *  This flavor of initialization sets up the decoder to decode from a
  1.1218 + *  plain Ogg FLAC file.  For non-stdio streams, you must use
  1.1219 + *  FLAC__stream_decoder_init_ogg_stream() and provide callbacks for the I/O.
  1.1220 + *
  1.1221 + *  This function should be called after FLAC__stream_decoder_new() and
  1.1222 + *  FLAC__stream_decoder_set_*() but before any of the
  1.1223 + *  FLAC__stream_decoder_process_*() functions.  Will set and return the
  1.1224 + *  decoder state, which will be FLAC__STREAM_DECODER_SEARCH_FOR_METADATA
  1.1225 + *  if initialization succeeded.
  1.1226 + *
  1.1227 + *  \note Support for Ogg FLAC in the library is optional.  If this
  1.1228 + *  library has been built without support for Ogg FLAC, this function
  1.1229 + *  will return \c FLAC__STREAM_DECODER_INIT_STATUS_UNSUPPORTED_CONTAINER.
  1.1230 + *
  1.1231 + * \param  decoder            An uninitialized decoder instance.
  1.1232 + * \param  file               An open FLAC file.  The file should have been
  1.1233 + *                            opened with mode \c "rb" and rewound.  The file
  1.1234 + *                            becomes owned by the decoder and should not be
  1.1235 + *                            manipulated by the client while decoding.
  1.1236 + *                            Unless \a file is \c stdin, it will be closed
  1.1237 + *                            when FLAC__stream_decoder_finish() is called.
  1.1238 + *                            Note however that seeking will not work when
  1.1239 + *                            decoding from \c stdout since it is not seekable.
  1.1240 + * \param  write_callback     See FLAC__StreamDecoderWriteCallback.  This
  1.1241 + *                            pointer must not be \c NULL.
  1.1242 + * \param  metadata_callback  See FLAC__StreamDecoderMetadataCallback.  This
  1.1243 + *                            pointer may be \c NULL if the callback is not
  1.1244 + *                            desired.
  1.1245 + * \param  error_callback     See FLAC__StreamDecoderErrorCallback.  This
  1.1246 + *                            pointer must not be \c NULL.
  1.1247 + * \param  client_data        This value will be supplied to callbacks in their
  1.1248 + *                            \a client_data argument.
  1.1249 + * \assert
  1.1250 + *    \code decoder != NULL \endcode
  1.1251 + *    \code file != NULL \endcode
  1.1252 + * \retval FLAC__StreamDecoderInitStatus
  1.1253 + *    \c FLAC__STREAM_DECODER_INIT_STATUS_OK if initialization was successful;
  1.1254 + *    see FLAC__StreamDecoderInitStatus for the meanings of other return values.
  1.1255 + */
  1.1256 +FLAC_API FLAC__StreamDecoderInitStatus FLAC__stream_decoder_init_ogg_FILE(
  1.1257 +	FLAC__StreamDecoder *decoder,
  1.1258 +	FILE *file,
  1.1259 +	FLAC__StreamDecoderWriteCallback write_callback,
  1.1260 +	FLAC__StreamDecoderMetadataCallback metadata_callback,
  1.1261 +	FLAC__StreamDecoderErrorCallback error_callback,
  1.1262 +	void *client_data
  1.1263 +);
  1.1264 +
  1.1265 +/** Initialize the decoder instance to decode native FLAC files.
  1.1266 + *
  1.1267 + *  This flavor of initialization sets up the decoder to decode from a plain
  1.1268 + *  native FLAC file.  If POSIX fopen() semantics are not sufficient, (for
  1.1269 + *  example, with Unicode filenames on Windows), you must use
  1.1270 + *  FLAC__stream_decoder_init_FILE(), or FLAC__stream_decoder_init_stream()
  1.1271 + *  and provide callbacks for the I/O.
  1.1272 + *
  1.1273 + *  This function should be called after FLAC__stream_decoder_new() and
  1.1274 + *  FLAC__stream_decoder_set_*() but before any of the
  1.1275 + *  FLAC__stream_decoder_process_*() functions.  Will set and return the
  1.1276 + *  decoder state, which will be FLAC__STREAM_DECODER_SEARCH_FOR_METADATA
  1.1277 + *  if initialization succeeded.
  1.1278 + *
  1.1279 + * \param  decoder            An uninitialized decoder instance.
  1.1280 + * \param  filename           The name of the file to decode from.  The file will
  1.1281 + *                            be opened with fopen().  Use \c NULL to decode from
  1.1282 + *                            \c stdin.  Note that \c stdin is not seekable.
  1.1283 + * \param  write_callback     See FLAC__StreamDecoderWriteCallback.  This
  1.1284 + *                            pointer must not be \c NULL.
  1.1285 + * \param  metadata_callback  See FLAC__StreamDecoderMetadataCallback.  This
  1.1286 + *                            pointer may be \c NULL if the callback is not
  1.1287 + *                            desired.
  1.1288 + * \param  error_callback     See FLAC__StreamDecoderErrorCallback.  This
  1.1289 + *                            pointer must not be \c NULL.
  1.1290 + * \param  client_data        This value will be supplied to callbacks in their
  1.1291 + *                            \a client_data argument.
  1.1292 + * \assert
  1.1293 + *    \code decoder != NULL \endcode
  1.1294 + * \retval FLAC__StreamDecoderInitStatus
  1.1295 + *    \c FLAC__STREAM_DECODER_INIT_STATUS_OK if initialization was successful;
  1.1296 + *    see FLAC__StreamDecoderInitStatus for the meanings of other return values.
  1.1297 + */
  1.1298 +FLAC_API FLAC__StreamDecoderInitStatus FLAC__stream_decoder_init_file(
  1.1299 +	FLAC__StreamDecoder *decoder,
  1.1300 +	const char *filename,
  1.1301 +	FLAC__StreamDecoderWriteCallback write_callback,
  1.1302 +	FLAC__StreamDecoderMetadataCallback metadata_callback,
  1.1303 +	FLAC__StreamDecoderErrorCallback error_callback,
  1.1304 +	void *client_data
  1.1305 +);
  1.1306 +
  1.1307 +/** Initialize the decoder instance to decode Ogg FLAC files.
  1.1308 + *
  1.1309 + *  This flavor of initialization sets up the decoder to decode from a plain
  1.1310 + *  Ogg FLAC file.  If POSIX fopen() semantics are not sufficient, (for
  1.1311 + *  example, with Unicode filenames on Windows), you must use
  1.1312 + *  FLAC__stream_decoder_init_ogg_FILE(), or FLAC__stream_decoder_init_ogg_stream()
  1.1313 + *  and provide callbacks for the I/O.
  1.1314 + *
  1.1315 + *  This function should be called after FLAC__stream_decoder_new() and
  1.1316 + *  FLAC__stream_decoder_set_*() but before any of the
  1.1317 + *  FLAC__stream_decoder_process_*() functions.  Will set and return the
  1.1318 + *  decoder state, which will be FLAC__STREAM_DECODER_SEARCH_FOR_METADATA
  1.1319 + *  if initialization succeeded.
  1.1320 + *
  1.1321 + *  \note Support for Ogg FLAC in the library is optional.  If this
  1.1322 + *  library has been built without support for Ogg FLAC, this function
  1.1323 + *  will return \c FLAC__STREAM_DECODER_INIT_STATUS_UNSUPPORTED_CONTAINER.
  1.1324 + *
  1.1325 + * \param  decoder            An uninitialized decoder instance.
  1.1326 + * \param  filename           The name of the file to decode from.  The file will
  1.1327 + *                            be opened with fopen().  Use \c NULL to decode from
  1.1328 + *                            \c stdin.  Note that \c stdin is not seekable.
  1.1329 + * \param  write_callback     See FLAC__StreamDecoderWriteCallback.  This
  1.1330 + *                            pointer must not be \c NULL.
  1.1331 + * \param  metadata_callback  See FLAC__StreamDecoderMetadataCallback.  This
  1.1332 + *                            pointer may be \c NULL if the callback is not
  1.1333 + *                            desired.
  1.1334 + * \param  error_callback     See FLAC__StreamDecoderErrorCallback.  This
  1.1335 + *                            pointer must not be \c NULL.
  1.1336 + * \param  client_data        This value will be supplied to callbacks in their
  1.1337 + *                            \a client_data argument.
  1.1338 + * \assert
  1.1339 + *    \code decoder != NULL \endcode
  1.1340 + * \retval FLAC__StreamDecoderInitStatus
  1.1341 + *    \c FLAC__STREAM_DECODER_INIT_STATUS_OK if initialization was successful;
  1.1342 + *    see FLAC__StreamDecoderInitStatus for the meanings of other return values.
  1.1343 + */
  1.1344 +FLAC_API FLAC__StreamDecoderInitStatus FLAC__stream_decoder_init_ogg_file(
  1.1345 +	FLAC__StreamDecoder *decoder,
  1.1346 +	const char *filename,
  1.1347 +	FLAC__StreamDecoderWriteCallback write_callback,
  1.1348 +	FLAC__StreamDecoderMetadataCallback metadata_callback,
  1.1349 +	FLAC__StreamDecoderErrorCallback error_callback,
  1.1350 +	void *client_data
  1.1351 +);
  1.1352 +
  1.1353 +/** Finish the decoding process.
  1.1354 + *  Flushes the decoding buffer, releases resources, resets the decoder
  1.1355 + *  settings to their defaults, and returns the decoder state to
  1.1356 + *  FLAC__STREAM_DECODER_UNINITIALIZED.
  1.1357 + *
  1.1358 + *  In the event of a prematurely-terminated decode, it is not strictly
  1.1359 + *  necessary to call this immediately before FLAC__stream_decoder_delete()
  1.1360 + *  but it is good practice to match every FLAC__stream_decoder_init_*()
  1.1361 + *  with a FLAC__stream_decoder_finish().
  1.1362 + *
  1.1363 + * \param  decoder  An uninitialized decoder instance.
  1.1364 + * \assert
  1.1365 + *    \code decoder != NULL \endcode
  1.1366 + * \retval FLAC__bool
  1.1367 + *    \c false if MD5 checking is on AND a STREAMINFO block was available
  1.1368 + *    AND the MD5 signature in the STREAMINFO block was non-zero AND the
  1.1369 + *    signature does not match the one computed by the decoder; else
  1.1370 + *    \c true.
  1.1371 + */
  1.1372 +FLAC_API FLAC__bool FLAC__stream_decoder_finish(FLAC__StreamDecoder *decoder);
  1.1373 +
  1.1374 +/** Flush the stream input.
  1.1375 + *  The decoder's input buffer will be cleared and the state set to
  1.1376 + *  \c FLAC__STREAM_DECODER_SEARCH_FOR_FRAME_SYNC.  This will also turn
  1.1377 + *  off MD5 checking.
  1.1378 + *
  1.1379 + * \param  decoder  A decoder instance.
  1.1380 + * \assert
  1.1381 + *    \code decoder != NULL \endcode
  1.1382 + * \retval FLAC__bool
  1.1383 + *    \c true if successful, else \c false if a memory allocation
  1.1384 + *    error occurs (in which case the state will be set to
  1.1385 + *    \c FLAC__STREAM_DECODER_MEMORY_ALLOCATION_ERROR).
  1.1386 + */
  1.1387 +FLAC_API FLAC__bool FLAC__stream_decoder_flush(FLAC__StreamDecoder *decoder);
  1.1388 +
  1.1389 +/** Reset the decoding process.
  1.1390 + *  The decoder's input buffer will be cleared and the state set to
  1.1391 + *  \c FLAC__STREAM_DECODER_SEARCH_FOR_METADATA.  This is similar to
  1.1392 + *  FLAC__stream_decoder_finish() except that the settings are
  1.1393 + *  preserved; there is no need to call FLAC__stream_decoder_init_*()
  1.1394 + *  before decoding again.  MD5 checking will be restored to its original
  1.1395 + *  setting.
  1.1396 + *
  1.1397 + *  If the decoder is seekable, or was initialized with
  1.1398 + *  FLAC__stream_decoder_init*_FILE() or FLAC__stream_decoder_init*_file(),
  1.1399 + *  the decoder will also attempt to seek to the beginning of the file.
  1.1400 + *  If this rewind fails, this function will return \c false.  It follows
  1.1401 + *  that FLAC__stream_decoder_reset() cannot be used when decoding from
  1.1402 + *  \c stdin.
  1.1403 + *
  1.1404 + *  If the decoder was initialized with FLAC__stream_encoder_init*_stream()
  1.1405 + *  and is not seekable (i.e. no seek callback was provided or the seek
  1.1406 + *  callback returns \c FLAC__STREAM_DECODER_SEEK_STATUS_UNSUPPORTED), it
  1.1407 + *  is the duty of the client to start feeding data from the beginning of
  1.1408 + *  the stream on the next FLAC__stream_decoder_process() or
  1.1409 + *  FLAC__stream_decoder_process_interleaved() call.
  1.1410 + *
  1.1411 + * \param  decoder  A decoder instance.
  1.1412 + * \assert
  1.1413 + *    \code decoder != NULL \endcode
  1.1414 + * \retval FLAC__bool
  1.1415 + *    \c true if successful, else \c false if a memory allocation occurs
  1.1416 + *    (in which case the state will be set to
  1.1417 + *    \c FLAC__STREAM_DECODER_MEMORY_ALLOCATION_ERROR) or a seek error
  1.1418 + *    occurs (the state will be unchanged).
  1.1419 + */
  1.1420 +FLAC_API FLAC__bool FLAC__stream_decoder_reset(FLAC__StreamDecoder *decoder);
  1.1421 +
  1.1422 +/** Decode one metadata block or audio frame.
  1.1423 + *  This version instructs the decoder to decode a either a single metadata
  1.1424 + *  block or a single frame and stop, unless the callbacks return a fatal
  1.1425 + *  error or the read callback returns
  1.1426 + *  \c FLAC__STREAM_DECODER_READ_STATUS_END_OF_STREAM.
  1.1427 + *
  1.1428 + *  As the decoder needs more input it will call the read callback.
  1.1429 + *  Depending on what was decoded, the metadata or write callback will be
  1.1430 + *  called with the decoded metadata block or audio frame.
  1.1431 + *
  1.1432 + *  Unless there is a fatal read error or end of stream, this function
  1.1433 + *  will return once one whole frame is decoded.  In other words, if the
  1.1434 + *  stream is not synchronized or points to a corrupt frame header, the
  1.1435 + *  decoder will continue to try and resync until it gets to a valid
  1.1436 + *  frame, then decode one frame, then return.  If the decoder points to
  1.1437 + *  a frame whose frame CRC in the frame footer does not match the
  1.1438 + *  computed frame CRC, this function will issue a
  1.1439 + *  FLAC__STREAM_DECODER_ERROR_STATUS_FRAME_CRC_MISMATCH error to the
  1.1440 + *  error callback, and return, having decoded one complete, although
  1.1441 + *  corrupt, frame.  (Such corrupted frames are sent as silence of the
  1.1442 + *  correct length to the write callback.)
  1.1443 + *
  1.1444 + * \param  decoder  An initialized decoder instance.
  1.1445 + * \assert
  1.1446 + *    \code decoder != NULL \endcode
  1.1447 + * \retval FLAC__bool
  1.1448 + *    \c false if any fatal read, write, or memory allocation error
  1.1449 + *    occurred (meaning decoding must stop), else \c true; for more
  1.1450 + *    information about the decoder, check the decoder state with
  1.1451 + *    FLAC__stream_decoder_get_state().
  1.1452 + */
  1.1453 +FLAC_API FLAC__bool FLAC__stream_decoder_process_single(FLAC__StreamDecoder *decoder);
  1.1454 +
  1.1455 +/** Decode until the end of the metadata.
  1.1456 + *  This version instructs the decoder to decode from the current position
  1.1457 + *  and continue until all the metadata has been read, or until the
  1.1458 + *  callbacks return a fatal error or the read callback returns
  1.1459 + *  \c FLAC__STREAM_DECODER_READ_STATUS_END_OF_STREAM.
  1.1460 + *
  1.1461 + *  As the decoder needs more input it will call the read callback.
  1.1462 + *  As each metadata block is decoded, the metadata callback will be called
  1.1463 + *  with the decoded metadata.
  1.1464 + *
  1.1465 + * \param  decoder  An initialized decoder instance.
  1.1466 + * \assert
  1.1467 + *    \code decoder != NULL \endcode
  1.1468 + * \retval FLAC__bool
  1.1469 + *    \c false if any fatal read, write, or memory allocation error
  1.1470 + *    occurred (meaning decoding must stop), else \c true; for more
  1.1471 + *    information about the decoder, check the decoder state with
  1.1472 + *    FLAC__stream_decoder_get_state().
  1.1473 + */
  1.1474 +FLAC_API FLAC__bool FLAC__stream_decoder_process_until_end_of_metadata(FLAC__StreamDecoder *decoder);
  1.1475 +
  1.1476 +/** Decode until the end of the stream.
  1.1477 + *  This version instructs the decoder to decode from the current position
  1.1478 + *  and continue until the end of stream (the read callback returns
  1.1479 + *  \c FLAC__STREAM_DECODER_READ_STATUS_END_OF_STREAM), or until the
  1.1480 + *  callbacks return a fatal error.
  1.1481 + *
  1.1482 + *  As the decoder needs more input it will call the read callback.
  1.1483 + *  As each metadata block and frame is decoded, the metadata or write
  1.1484 + *  callback will be called with the decoded metadata or frame.
  1.1485 + *
  1.1486 + * \param  decoder  An initialized decoder instance.
  1.1487 + * \assert
  1.1488 + *    \code decoder != NULL \endcode
  1.1489 + * \retval FLAC__bool
  1.1490 + *    \c false if any fatal read, write, or memory allocation error
  1.1491 + *    occurred (meaning decoding must stop), else \c true; for more
  1.1492 + *    information about the decoder, check the decoder state with
  1.1493 + *    FLAC__stream_decoder_get_state().
  1.1494 + */
  1.1495 +FLAC_API FLAC__bool FLAC__stream_decoder_process_until_end_of_stream(FLAC__StreamDecoder *decoder);
  1.1496 +
  1.1497 +/** Skip one audio frame.
  1.1498 + *  This version instructs the decoder to 'skip' a single frame and stop,
  1.1499 + *  unless the callbacks return a fatal error or the read callback returns
  1.1500 + *  \c FLAC__STREAM_DECODER_READ_STATUS_END_OF_STREAM.
  1.1501 + *
  1.1502 + *  The decoding flow is the same as what occurs when
  1.1503 + *  FLAC__stream_decoder_process_single() is called to process an audio
  1.1504 + *  frame, except that this function does not decode the parsed data into
  1.1505 + *  PCM or call the write callback.  The integrity of the frame is still
  1.1506 + *  checked the same way as in the other process functions.
  1.1507 + *
  1.1508 + *  This function will return once one whole frame is skipped, in the
  1.1509 + *  same way that FLAC__stream_decoder_process_single() will return once
  1.1510 + *  one whole frame is decoded.
  1.1511 + *
  1.1512 + *  This function can be used in more quickly determining FLAC frame
  1.1513 + *  boundaries when decoding of the actual data is not needed, for
  1.1514 + *  example when an application is separating a FLAC stream into frames
  1.1515 + *  for editing or storing in a container.  To do this, the application
  1.1516 + *  can use FLAC__stream_decoder_skip_single_frame() to quickly advance
  1.1517 + *  to the next frame, then use
  1.1518 + *  FLAC__stream_decoder_get_decode_position() to find the new frame
  1.1519 + *  boundary.
  1.1520 + *
  1.1521 + *  This function should only be called when the stream has advanced
  1.1522 + *  past all the metadata, otherwise it will return \c false.
  1.1523 + *
  1.1524 + * \param  decoder  An initialized decoder instance not in a metadata
  1.1525 + *                  state.
  1.1526 + * \assert
  1.1527 + *    \code decoder != NULL \endcode
  1.1528 + * \retval FLAC__bool
  1.1529 + *    \c false if any fatal read, write, or memory allocation error
  1.1530 + *    occurred (meaning decoding must stop), or if the decoder
  1.1531 + *    is in the FLAC__STREAM_DECODER_SEARCH_FOR_METADATA or
  1.1532 + *    FLAC__STREAM_DECODER_READ_METADATA state, else \c true; for more
  1.1533 + *    information about the decoder, check the decoder state with
  1.1534 + *    FLAC__stream_decoder_get_state().
  1.1535 + */
  1.1536 +FLAC_API FLAC__bool FLAC__stream_decoder_skip_single_frame(FLAC__StreamDecoder *decoder);
  1.1537 +
  1.1538 +/** Flush the input and seek to an absolute sample.
  1.1539 + *  Decoding will resume at the given sample.  Note that because of
  1.1540 + *  this, the next write callback may contain a partial block.  The
  1.1541 + *  client must support seeking the input or this function will fail
  1.1542 + *  and return \c false.  Furthermore, if the decoder state is
  1.1543 + *  \c FLAC__STREAM_DECODER_SEEK_ERROR, then the decoder must be flushed
  1.1544 + *  with FLAC__stream_decoder_flush() or reset with
  1.1545 + *  FLAC__stream_decoder_reset() before decoding can continue.
  1.1546 + *
  1.1547 + * \param  decoder  A decoder instance.
  1.1548 + * \param  sample   The target sample number to seek to.
  1.1549 + * \assert
  1.1550 + *    \code decoder != NULL \endcode
  1.1551 + * \retval FLAC__bool
  1.1552 + *    \c true if successful, else \c false.
  1.1553 + */
  1.1554 +FLAC_API FLAC__bool FLAC__stream_decoder_seek_absolute(FLAC__StreamDecoder *decoder, FLAC__uint64 sample);
  1.1555 +
  1.1556 +/* \} */
  1.1557 +
  1.1558 +#ifdef __cplusplus
  1.1559 +}
  1.1560 +#endif
  1.1561 +
  1.1562 +#endif