VisualC/external/include/FLAC/stream_decoder.h
author Sam Lantinga <slouken@libsdl.org>
Mon, 09 Jan 2012 04:20:54 -0500
changeset 556 2686e67b59fd
parent 532 VisualC/flac/include/FLAC/stream_decoder.h@b8e8ae4852b2
child 748 5515b36f95ed
child 937 3797c39725bf
permissions -rw-r--r--
Moved external libraries into the "external" directory and added x64 build configuration.
     1 /* libFLAC - Free Lossless Audio Codec library
     2  * Copyright (C) 2000,2001,2002,2003,2004,2005,2006,2007  Josh Coalson
     3  *
     4  * Redistribution and use in source and binary forms, with or without
     5  * modification, are permitted provided that the following conditions
     6  * are met:
     7  *
     8  * - Redistributions of source code must retain the above copyright
     9  * notice, this list of conditions and the following disclaimer.
    10  *
    11  * - Redistributions in binary form must reproduce the above copyright
    12  * notice, this list of conditions and the following disclaimer in the
    13  * documentation and/or other materials provided with the distribution.
    14  *
    15  * - Neither the name of the Xiph.org Foundation nor the names of its
    16  * contributors may be used to endorse or promote products derived from
    17  * this software without specific prior written permission.
    18  *
    19  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
    20  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
    21  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
    22  * A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR
    23  * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
    24  * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
    25  * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
    26  * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
    27  * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
    28  * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
    29  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
    30  */
    31 
    32 #ifndef FLAC__STREAM_DECODER_H
    33 #define FLAC__STREAM_DECODER_H
    34 
    35 #include <stdio.h> /* for FILE */
    36 #include "export.h"
    37 #include "format.h"
    38 
    39 #ifdef __cplusplus
    40 extern "C" {
    41 #endif
    42 
    43 
    44 /** \file include/FLAC/stream_decoder.h
    45  *
    46  *  \brief
    47  *  This module contains the functions which implement the stream
    48  *  decoder.
    49  *
    50  *  See the detailed documentation in the
    51  *  \link flac_stream_decoder stream decoder \endlink module.
    52  */
    53 
    54 /** \defgroup flac_decoder FLAC/ \*_decoder.h: decoder interfaces
    55  *  \ingroup flac
    56  *
    57  *  \brief
    58  *  This module describes the decoder layers provided by libFLAC.
    59  *
    60  * The stream decoder can be used to decode complete streams either from
    61  * the client via callbacks, or directly from a file, depending on how
    62  * it is initialized.  When decoding via callbacks, the client provides
    63  * callbacks for reading FLAC data and writing decoded samples, and
    64  * handling metadata and errors.  If the client also supplies seek-related
    65  * callback, the decoder function for sample-accurate seeking within the
    66  * FLAC input is also available.  When decoding from a file, the client
    67  * needs only supply a filename or open \c FILE* and write/metadata/error
    68  * callbacks; the rest of the callbacks are supplied internally.  For more
    69  * info see the \link flac_stream_decoder stream decoder \endlink module.
    70  */
    71 
    72 /** \defgroup flac_stream_decoder FLAC/stream_decoder.h: stream decoder interface
    73  *  \ingroup flac_decoder
    74  *
    75  *  \brief
    76  *  This module contains the functions which implement the stream
    77  *  decoder.
    78  *
    79  * The stream decoder can decode native FLAC, and optionally Ogg FLAC
    80  * (check FLAC_API_SUPPORTS_OGG_FLAC) streams and files.
    81  *
    82  * The basic usage of this decoder is as follows:
    83  * - The program creates an instance of a decoder using
    84  *   FLAC__stream_decoder_new().
    85  * - The program overrides the default settings using
    86  *   FLAC__stream_decoder_set_*() functions.
    87  * - The program initializes the instance to validate the settings and
    88  *   prepare for decoding using
    89  *   - FLAC__stream_decoder_init_stream() or FLAC__stream_decoder_init_FILE()
    90  *     or FLAC__stream_decoder_init_file() for native FLAC,
    91  *   - FLAC__stream_decoder_init_ogg_stream() or FLAC__stream_decoder_init_ogg_FILE()
    92  *     or FLAC__stream_decoder_init_ogg_file() for Ogg FLAC
    93  * - The program calls the FLAC__stream_decoder_process_*() functions
    94  *   to decode data, which subsequently calls the callbacks.
    95  * - The program finishes the decoding with FLAC__stream_decoder_finish(),
    96  *   which flushes the input and output and resets the decoder to the
    97  *   uninitialized state.
    98  * - The instance may be used again or deleted with
    99  *   FLAC__stream_decoder_delete().
   100  *
   101  * In more detail, the program will create a new instance by calling
   102  * FLAC__stream_decoder_new(), then call FLAC__stream_decoder_set_*()
   103  * functions to override the default decoder options, and call
   104  * one of the FLAC__stream_decoder_init_*() functions.
   105  *
   106  * There are three initialization functions for native FLAC, one for
   107  * setting up the decoder to decode FLAC data from the client via
   108  * callbacks, and two for decoding directly from a FLAC file.
   109  *
   110  * For decoding via callbacks, use FLAC__stream_decoder_init_stream().
   111  * You must also supply several callbacks for handling I/O.  Some (like
   112  * seeking) are optional, depending on the capabilities of the input.
   113  *
   114  * For decoding directly from a file, use FLAC__stream_decoder_init_FILE()
   115  * or FLAC__stream_decoder_init_file().  Then you must only supply an open
   116  * \c FILE* or filename and fewer callbacks; the decoder will handle
   117  * the other callbacks internally.
   118  *
   119  * There are three similarly-named init functions for decoding from Ogg
   120  * FLAC streams.  Check \c FLAC_API_SUPPORTS_OGG_FLAC to find out if the
   121  * library has been built with Ogg support.
   122  *
   123  * Once the decoder is initialized, your program will call one of several
   124  * functions to start the decoding process:
   125  *
   126  * - FLAC__stream_decoder_process_single() - Tells the decoder to process at
   127  *   most one metadata block or audio frame and return, calling either the
   128  *   metadata callback or write callback, respectively, once.  If the decoder
   129  *   loses sync it will return with only the error callback being called.
   130  * - FLAC__stream_decoder_process_until_end_of_metadata() - Tells the decoder
   131  *   to process the stream from the current location and stop upon reaching
   132  *   the first audio frame.  The client will get one metadata, write, or error
   133  *   callback per metadata block, audio frame, or sync error, respectively.
   134  * - FLAC__stream_decoder_process_until_end_of_stream() - Tells the decoder
   135  *   to process the stream from the current location until the read callback
   136  *   returns FLAC__STREAM_DECODER_READ_STATUS_END_OF_STREAM or
   137  *   FLAC__STREAM_DECODER_READ_STATUS_ABORT.  The client will get one metadata,
   138  *   write, or error callback per metadata block, audio frame, or sync error,
   139  *   respectively.
   140  *
   141  * When the decoder has finished decoding (normally or through an abort),
   142  * the instance is finished by calling FLAC__stream_decoder_finish(), which
   143  * ensures the decoder is in the correct state and frees memory.  Then the
   144  * instance may be deleted with FLAC__stream_decoder_delete() or initialized
   145  * again to decode another stream.
   146  *
   147  * Seeking is exposed through the FLAC__stream_decoder_seek_absolute() method.
   148  * At any point after the stream decoder has been initialized, the client can
   149  * call this function to seek to an exact sample within the stream.
   150  * Subsequently, the first time the write callback is called it will be
   151  * passed a (possibly partial) block starting at that sample.
   152  *
   153  * If the client cannot seek via the callback interface provided, but still
   154  * has another way of seeking, it can flush the decoder using
   155  * FLAC__stream_decoder_flush() and start feeding data from the new position
   156  * through the read callback.
   157  *
   158  * The stream decoder also provides MD5 signature checking.  If this is
   159  * turned on before initialization, FLAC__stream_decoder_finish() will
   160  * report when the decoded MD5 signature does not match the one stored
   161  * in the STREAMINFO block.  MD5 checking is automatically turned off
   162  * (until the next FLAC__stream_decoder_reset()) if there is no signature
   163  * in the STREAMINFO block or when a seek is attempted.
   164  *
   165  * The FLAC__stream_decoder_set_metadata_*() functions deserve special
   166  * attention.  By default, the decoder only calls the metadata_callback for
   167  * the STREAMINFO block.  These functions allow you to tell the decoder
   168  * explicitly which blocks to parse and return via the metadata_callback
   169  * and/or which to skip.  Use a FLAC__stream_decoder_set_metadata_respond_all(),
   170  * FLAC__stream_decoder_set_metadata_ignore() ... or FLAC__stream_decoder_set_metadata_ignore_all(),
   171  * FLAC__stream_decoder_set_metadata_respond() ... sequence to exactly specify
   172  * which blocks to return.  Remember that metadata blocks can potentially
   173  * be big (for example, cover art) so filtering out the ones you don't
   174  * use can reduce the memory requirements of the decoder.  Also note the
   175  * special forms FLAC__stream_decoder_set_metadata_respond_application(id)
   176  * and FLAC__stream_decoder_set_metadata_ignore_application(id) for
   177  * filtering APPLICATION blocks based on the application ID.
   178  *
   179  * STREAMINFO and SEEKTABLE blocks are always parsed and used internally, but
   180  * they still can legally be filtered from the metadata_callback.
   181  *
   182  * \note
   183  * The "set" functions may only be called when the decoder is in the
   184  * state FLAC__STREAM_DECODER_UNINITIALIZED, i.e. after
   185  * FLAC__stream_decoder_new() or FLAC__stream_decoder_finish(), but
   186  * before FLAC__stream_decoder_init_*().  If this is the case they will
   187  * return \c true, otherwise \c false.
   188  *
   189  * \note
   190  * FLAC__stream_decoder_finish() resets all settings to the constructor
   191  * defaults, including the callbacks.
   192  *
   193  * \{
   194  */
   195 
   196 
   197 /** State values for a FLAC__StreamDecoder
   198  *
   199  * The decoder's state can be obtained by calling FLAC__stream_decoder_get_state().
   200  */
   201 typedef enum {
   202 
   203 	FLAC__STREAM_DECODER_SEARCH_FOR_METADATA = 0,
   204 	/**< The decoder is ready to search for metadata. */
   205 
   206 	FLAC__STREAM_DECODER_READ_METADATA,
   207 	/**< The decoder is ready to or is in the process of reading metadata. */
   208 
   209 	FLAC__STREAM_DECODER_SEARCH_FOR_FRAME_SYNC,
   210 	/**< The decoder is ready to or is in the process of searching for the
   211 	 * frame sync code.
   212 	 */
   213 
   214 	FLAC__STREAM_DECODER_READ_FRAME,
   215 	/**< The decoder is ready to or is in the process of reading a frame. */
   216 
   217 	FLAC__STREAM_DECODER_END_OF_STREAM,
   218 	/**< The decoder has reached the end of the stream. */
   219 
   220 	FLAC__STREAM_DECODER_OGG_ERROR,
   221 	/**< An error occurred in the underlying Ogg layer.  */
   222 
   223 	FLAC__STREAM_DECODER_SEEK_ERROR,
   224 	/**< An error occurred while seeking.  The decoder must be flushed
   225 	 * with FLAC__stream_decoder_flush() or reset with
   226 	 * FLAC__stream_decoder_reset() before decoding can continue.
   227 	 */
   228 
   229 	FLAC__STREAM_DECODER_ABORTED,
   230 	/**< The decoder was aborted by the read callback. */
   231 
   232 	FLAC__STREAM_DECODER_MEMORY_ALLOCATION_ERROR,
   233 	/**< An error occurred allocating memory.  The decoder is in an invalid
   234 	 * state and can no longer be used.
   235 	 */
   236 
   237 	FLAC__STREAM_DECODER_UNINITIALIZED
   238 	/**< The decoder is in the uninitialized state; one of the
   239 	 * FLAC__stream_decoder_init_*() functions must be called before samples
   240 	 * can be processed.
   241 	 */
   242 
   243 } FLAC__StreamDecoderState;
   244 
   245 /** Maps a FLAC__StreamDecoderState to a C string.
   246  *
   247  *  Using a FLAC__StreamDecoderState as the index to this array
   248  *  will give the string equivalent.  The contents should not be modified.
   249  */
   250 extern FLAC_API const char * const FLAC__StreamDecoderStateString[];
   251 
   252 
   253 /** Possible return values for the FLAC__stream_decoder_init_*() functions.
   254  */
   255 typedef enum {
   256 
   257 	FLAC__STREAM_DECODER_INIT_STATUS_OK = 0,
   258 	/**< Initialization was successful. */
   259 
   260 	FLAC__STREAM_DECODER_INIT_STATUS_UNSUPPORTED_CONTAINER,
   261 	/**< The library was not compiled with support for the given container
   262 	 * format.
   263 	 */
   264 
   265 	FLAC__STREAM_DECODER_INIT_STATUS_INVALID_CALLBACKS,
   266 	/**< A required callback was not supplied. */
   267 
   268 	FLAC__STREAM_DECODER_INIT_STATUS_MEMORY_ALLOCATION_ERROR,
   269 	/**< An error occurred allocating memory. */
   270 
   271 	FLAC__STREAM_DECODER_INIT_STATUS_ERROR_OPENING_FILE,
   272 	/**< fopen() failed in FLAC__stream_decoder_init_file() or
   273 	 * FLAC__stream_decoder_init_ogg_file(). */
   274 
   275 	FLAC__STREAM_DECODER_INIT_STATUS_ALREADY_INITIALIZED
   276 	/**< FLAC__stream_decoder_init_*() was called when the decoder was
   277 	 * already initialized, usually because
   278 	 * FLAC__stream_decoder_finish() was not called.
   279 	 */
   280 
   281 } FLAC__StreamDecoderInitStatus;
   282 
   283 /** Maps a FLAC__StreamDecoderInitStatus to a C string.
   284  *
   285  *  Using a FLAC__StreamDecoderInitStatus as the index to this array
   286  *  will give the string equivalent.  The contents should not be modified.
   287  */
   288 extern FLAC_API const char * const FLAC__StreamDecoderInitStatusString[];
   289 
   290 
   291 /** Return values for the FLAC__StreamDecoder read callback.
   292  */
   293 typedef enum {
   294 
   295 	FLAC__STREAM_DECODER_READ_STATUS_CONTINUE,
   296 	/**< The read was OK and decoding can continue. */
   297 
   298 	FLAC__STREAM_DECODER_READ_STATUS_END_OF_STREAM,
   299 	/**< The read was attempted while at the end of the stream.  Note that
   300 	 * the client must only return this value when the read callback was
   301 	 * called when already at the end of the stream.  Otherwise, if the read
   302 	 * itself moves to the end of the stream, the client should still return
   303 	 * the data and \c FLAC__STREAM_DECODER_READ_STATUS_CONTINUE, and then on
   304 	 * the next read callback it should return
   305 	 * \c FLAC__STREAM_DECODER_READ_STATUS_END_OF_STREAM with a byte count
   306 	 * of \c 0.
   307 	 */
   308 
   309 	FLAC__STREAM_DECODER_READ_STATUS_ABORT
   310 	/**< An unrecoverable error occurred.  The decoder will return from the process call. */
   311 
   312 } FLAC__StreamDecoderReadStatus;
   313 
   314 /** Maps a FLAC__StreamDecoderReadStatus to a C string.
   315  *
   316  *  Using a FLAC__StreamDecoderReadStatus as the index to this array
   317  *  will give the string equivalent.  The contents should not be modified.
   318  */
   319 extern FLAC_API const char * const FLAC__StreamDecoderReadStatusString[];
   320 
   321 
   322 /** Return values for the FLAC__StreamDecoder seek callback.
   323  */
   324 typedef enum {
   325 
   326 	FLAC__STREAM_DECODER_SEEK_STATUS_OK,
   327 	/**< The seek was OK and decoding can continue. */
   328 
   329 	FLAC__STREAM_DECODER_SEEK_STATUS_ERROR,
   330 	/**< An unrecoverable error occurred.  The decoder will return from the process call. */
   331 
   332 	FLAC__STREAM_DECODER_SEEK_STATUS_UNSUPPORTED
   333 	/**< Client does not support seeking. */
   334 
   335 } FLAC__StreamDecoderSeekStatus;
   336 
   337 /** Maps a FLAC__StreamDecoderSeekStatus to a C string.
   338  *
   339  *  Using a FLAC__StreamDecoderSeekStatus as the index to this array
   340  *  will give the string equivalent.  The contents should not be modified.
   341  */
   342 extern FLAC_API const char * const FLAC__StreamDecoderSeekStatusString[];
   343 
   344 
   345 /** Return values for the FLAC__StreamDecoder tell callback.
   346  */
   347 typedef enum {
   348 
   349 	FLAC__STREAM_DECODER_TELL_STATUS_OK,
   350 	/**< The tell was OK and decoding can continue. */
   351 
   352 	FLAC__STREAM_DECODER_TELL_STATUS_ERROR,
   353 	/**< An unrecoverable error occurred.  The decoder will return from the process call. */
   354 
   355 	FLAC__STREAM_DECODER_TELL_STATUS_UNSUPPORTED
   356 	/**< Client does not support telling the position. */
   357 
   358 } FLAC__StreamDecoderTellStatus;
   359 
   360 /** Maps a FLAC__StreamDecoderTellStatus to a C string.
   361  *
   362  *  Using a FLAC__StreamDecoderTellStatus as the index to this array
   363  *  will give the string equivalent.  The contents should not be modified.
   364  */
   365 extern FLAC_API const char * const FLAC__StreamDecoderTellStatusString[];
   366 
   367 
   368 /** Return values for the FLAC__StreamDecoder length callback.
   369  */
   370 typedef enum {
   371 
   372 	FLAC__STREAM_DECODER_LENGTH_STATUS_OK,
   373 	/**< The length call was OK and decoding can continue. */
   374 
   375 	FLAC__STREAM_DECODER_LENGTH_STATUS_ERROR,
   376 	/**< An unrecoverable error occurred.  The decoder will return from the process call. */
   377 
   378 	FLAC__STREAM_DECODER_LENGTH_STATUS_UNSUPPORTED
   379 	/**< Client does not support reporting the length. */
   380 
   381 } FLAC__StreamDecoderLengthStatus;
   382 
   383 /** Maps a FLAC__StreamDecoderLengthStatus to a C string.
   384  *
   385  *  Using a FLAC__StreamDecoderLengthStatus as the index to this array
   386  *  will give the string equivalent.  The contents should not be modified.
   387  */
   388 extern FLAC_API const char * const FLAC__StreamDecoderLengthStatusString[];
   389 
   390 
   391 /** Return values for the FLAC__StreamDecoder write callback.
   392  */
   393 typedef enum {
   394 
   395 	FLAC__STREAM_DECODER_WRITE_STATUS_CONTINUE,
   396 	/**< The write was OK and decoding can continue. */
   397 
   398 	FLAC__STREAM_DECODER_WRITE_STATUS_ABORT
   399 	/**< An unrecoverable error occurred.  The decoder will return from the process call. */
   400 
   401 } FLAC__StreamDecoderWriteStatus;
   402 
   403 /** Maps a FLAC__StreamDecoderWriteStatus to a C string.
   404  *
   405  *  Using a FLAC__StreamDecoderWriteStatus as the index to this array
   406  *  will give the string equivalent.  The contents should not be modified.
   407  */
   408 extern FLAC_API const char * const FLAC__StreamDecoderWriteStatusString[];
   409 
   410 
   411 /** Possible values passed back to the FLAC__StreamDecoder error callback.
   412  *  \c FLAC__STREAM_DECODER_ERROR_STATUS_LOST_SYNC is the generic catch-
   413  *  all.  The rest could be caused by bad sync (false synchronization on
   414  *  data that is not the start of a frame) or corrupted data.  The error
   415  *  itself is the decoder's best guess at what happened assuming a correct
   416  *  sync.  For example \c FLAC__STREAM_DECODER_ERROR_STATUS_BAD_HEADER
   417  *  could be caused by a correct sync on the start of a frame, but some
   418  *  data in the frame header was corrupted.  Or it could be the result of
   419  *  syncing on a point the stream that looked like the starting of a frame
   420  *  but was not.  \c FLAC__STREAM_DECODER_ERROR_STATUS_UNPARSEABLE_STREAM
   421  *  could be because the decoder encountered a valid frame made by a future
   422  *  version of the encoder which it cannot parse, or because of a false
   423  *  sync making it appear as though an encountered frame was generated by
   424  *  a future encoder.
   425  */
   426 typedef enum {
   427 
   428 	FLAC__STREAM_DECODER_ERROR_STATUS_LOST_SYNC,
   429 	/**< An error in the stream caused the decoder to lose synchronization. */
   430 
   431 	FLAC__STREAM_DECODER_ERROR_STATUS_BAD_HEADER,
   432 	/**< The decoder encountered a corrupted frame header. */
   433 
   434 	FLAC__STREAM_DECODER_ERROR_STATUS_FRAME_CRC_MISMATCH,
   435 	/**< The frame's data did not match the CRC in the footer. */
   436 
   437 	FLAC__STREAM_DECODER_ERROR_STATUS_UNPARSEABLE_STREAM
   438 	/**< The decoder encountered reserved fields in use in the stream. */
   439 
   440 } FLAC__StreamDecoderErrorStatus;
   441 
   442 /** Maps a FLAC__StreamDecoderErrorStatus to a C string.
   443  *
   444  *  Using a FLAC__StreamDecoderErrorStatus as the index to this array
   445  *  will give the string equivalent.  The contents should not be modified.
   446  */
   447 extern FLAC_API const char * const FLAC__StreamDecoderErrorStatusString[];
   448 
   449 
   450 /***********************************************************************
   451  *
   452  * class FLAC__StreamDecoder
   453  *
   454  ***********************************************************************/
   455 
   456 struct FLAC__StreamDecoderProtected;
   457 struct FLAC__StreamDecoderPrivate;
   458 /** The opaque structure definition for the stream decoder type.
   459  *  See the \link flac_stream_decoder stream decoder module \endlink
   460  *  for a detailed description.
   461  */
   462 typedef struct {
   463 	struct FLAC__StreamDecoderProtected *protected_; /* avoid the C++ keyword 'protected' */
   464 	struct FLAC__StreamDecoderPrivate *private_; /* avoid the C++ keyword 'private' */
   465 } FLAC__StreamDecoder;
   466 
   467 /** Signature for the read callback.
   468  *
   469  *  A function pointer matching this signature must be passed to
   470  *  FLAC__stream_decoder_init*_stream(). The supplied function will be
   471  *  called when the decoder needs more input data.  The address of the
   472  *  buffer to be filled is supplied, along with the number of bytes the
   473  *  buffer can hold.  The callback may choose to supply less data and
   474  *  modify the byte count but must be careful not to overflow the buffer.
   475  *  The callback then returns a status code chosen from
   476  *  FLAC__StreamDecoderReadStatus.
   477  *
   478  * Here is an example of a read callback for stdio streams:
   479  * \code
   480  * FLAC__StreamDecoderReadStatus read_cb(const FLAC__StreamDecoder *decoder, FLAC__byte buffer[], size_t *bytes, void *client_data)
   481  * {
   482  *   FILE *file = ((MyClientData*)client_data)->file;
   483  *   if(*bytes > 0) {
   484  *     *bytes = fread(buffer, sizeof(FLAC__byte), *bytes, file);
   485  *     if(ferror(file))
   486  *       return FLAC__STREAM_DECODER_READ_STATUS_ABORT;
   487  *     else if(*bytes == 0)
   488  *       return FLAC__STREAM_DECODER_READ_STATUS_END_OF_STREAM;
   489  *     else
   490  *       return FLAC__STREAM_DECODER_READ_STATUS_CONTINUE;
   491  *   }
   492  *   else
   493  *     return FLAC__STREAM_DECODER_READ_STATUS_ABORT;
   494  * }
   495  * \endcode
   496  *
   497  * \note In general, FLAC__StreamDecoder functions which change the
   498  * state should not be called on the \a decoder while in the callback.
   499  *
   500  * \param  decoder  The decoder instance calling the callback.
   501  * \param  buffer   A pointer to a location for the callee to store
   502  *                  data to be decoded.
   503  * \param  bytes    A pointer to the size of the buffer.  On entry
   504  *                  to the callback, it contains the maximum number
   505  *                  of bytes that may be stored in \a buffer.  The
   506  *                  callee must set it to the actual number of bytes
   507  *                  stored (0 in case of error or end-of-stream) before
   508  *                  returning.
   509  * \param  client_data  The callee's client data set through
   510  *                      FLAC__stream_decoder_init_*().
   511  * \retval FLAC__StreamDecoderReadStatus
   512  *    The callee's return status.  Note that the callback should return
   513  *    \c FLAC__STREAM_DECODER_READ_STATUS_END_OF_STREAM if and only if
   514  *    zero bytes were read and there is no more data to be read.
   515  */
   516 typedef FLAC__StreamDecoderReadStatus (*FLAC__StreamDecoderReadCallback)(const FLAC__StreamDecoder *decoder, FLAC__byte buffer[], size_t *bytes, void *client_data);
   517 
   518 /** Signature for the seek callback.
   519  *
   520  *  A function pointer matching this signature may be passed to
   521  *  FLAC__stream_decoder_init*_stream().  The supplied function will be
   522  *  called when the decoder needs to seek the input stream.  The decoder
   523  *  will pass the absolute byte offset to seek to, 0 meaning the
   524  *  beginning of the stream.
   525  *
   526  * Here is an example of a seek callback for stdio streams:
   527  * \code
   528  * FLAC__StreamDecoderSeekStatus seek_cb(const FLAC__StreamDecoder *decoder, FLAC__uint64 absolute_byte_offset, void *client_data)
   529  * {
   530  *   FILE *file = ((MyClientData*)client_data)->file;
   531  *   if(file == stdin)
   532  *     return FLAC__STREAM_DECODER_SEEK_STATUS_UNSUPPORTED;
   533  *   else if(fseeko(file, (off_t)absolute_byte_offset, SEEK_SET) < 0)
   534  *     return FLAC__STREAM_DECODER_SEEK_STATUS_ERROR;
   535  *   else
   536  *     return FLAC__STREAM_DECODER_SEEK_STATUS_OK;
   537  * }
   538  * \endcode
   539  *
   540  * \note In general, FLAC__StreamDecoder functions which change the
   541  * state should not be called on the \a decoder while in the callback.
   542  *
   543  * \param  decoder  The decoder instance calling the callback.
   544  * \param  absolute_byte_offset  The offset from the beginning of the stream
   545  *                               to seek to.
   546  * \param  client_data  The callee's client data set through
   547  *                      FLAC__stream_decoder_init_*().
   548  * \retval FLAC__StreamDecoderSeekStatus
   549  *    The callee's return status.
   550  */
   551 typedef FLAC__StreamDecoderSeekStatus (*FLAC__StreamDecoderSeekCallback)(const FLAC__StreamDecoder *decoder, FLAC__uint64 absolute_byte_offset, void *client_data);
   552 
   553 /** Signature for the tell callback.
   554  *
   555  *  A function pointer matching this signature may be passed to
   556  *  FLAC__stream_decoder_init*_stream().  The supplied function will be
   557  *  called when the decoder wants to know the current position of the
   558  *  stream.  The callback should return the byte offset from the
   559  *  beginning of the stream.
   560  *
   561  * Here is an example of a tell callback for stdio streams:
   562  * \code
   563  * FLAC__StreamDecoderTellStatus tell_cb(const FLAC__StreamDecoder *decoder, FLAC__uint64 *absolute_byte_offset, void *client_data)
   564  * {
   565  *   FILE *file = ((MyClientData*)client_data)->file;
   566  *   off_t pos;
   567  *   if(file == stdin)
   568  *     return FLAC__STREAM_DECODER_TELL_STATUS_UNSUPPORTED;
   569  *   else if((pos = ftello(file)) < 0)
   570  *     return FLAC__STREAM_DECODER_TELL_STATUS_ERROR;
   571  *   else {
   572  *     *absolute_byte_offset = (FLAC__uint64)pos;
   573  *     return FLAC__STREAM_DECODER_TELL_STATUS_OK;
   574  *   }
   575  * }
   576  * \endcode
   577  *
   578  * \note In general, FLAC__StreamDecoder functions which change the
   579  * state should not be called on the \a decoder while in the callback.
   580  *
   581  * \param  decoder  The decoder instance calling the callback.
   582  * \param  absolute_byte_offset  A pointer to storage for the current offset
   583  *                               from the beginning of the stream.
   584  * \param  client_data  The callee's client data set through
   585  *                      FLAC__stream_decoder_init_*().
   586  * \retval FLAC__StreamDecoderTellStatus
   587  *    The callee's return status.
   588  */
   589 typedef FLAC__StreamDecoderTellStatus (*FLAC__StreamDecoderTellCallback)(const FLAC__StreamDecoder *decoder, FLAC__uint64 *absolute_byte_offset, void *client_data);
   590 
   591 /** Signature for the length callback.
   592  *
   593  *  A function pointer matching this signature may be passed to
   594  *  FLAC__stream_decoder_init*_stream().  The supplied function will be
   595  *  called when the decoder wants to know the total length of the stream
   596  *  in bytes.
   597  *
   598  * Here is an example of a length callback for stdio streams:
   599  * \code
   600  * FLAC__StreamDecoderLengthStatus length_cb(const FLAC__StreamDecoder *decoder, FLAC__uint64 *stream_length, void *client_data)
   601  * {
   602  *   FILE *file = ((MyClientData*)client_data)->file;
   603  *   struct stat filestats;
   604  *
   605  *   if(file == stdin)
   606  *     return FLAC__STREAM_DECODER_LENGTH_STATUS_UNSUPPORTED;
   607  *   else if(fstat(fileno(file), &filestats) != 0)
   608  *     return FLAC__STREAM_DECODER_LENGTH_STATUS_ERROR;
   609  *   else {
   610  *     *stream_length = (FLAC__uint64)filestats.st_size;
   611  *     return FLAC__STREAM_DECODER_LENGTH_STATUS_OK;
   612  *   }
   613  * }
   614  * \endcode
   615  *
   616  * \note In general, FLAC__StreamDecoder functions which change the
   617  * state should not be called on the \a decoder while in the callback.
   618  *
   619  * \param  decoder  The decoder instance calling the callback.
   620  * \param  stream_length  A pointer to storage for the length of the stream
   621  *                        in bytes.
   622  * \param  client_data  The callee's client data set through
   623  *                      FLAC__stream_decoder_init_*().
   624  * \retval FLAC__StreamDecoderLengthStatus
   625  *    The callee's return status.
   626  */
   627 typedef FLAC__StreamDecoderLengthStatus (*FLAC__StreamDecoderLengthCallback)(const FLAC__StreamDecoder *decoder, FLAC__uint64 *stream_length, void *client_data);
   628 
   629 /** Signature for the EOF callback.
   630  *
   631  *  A function pointer matching this signature may be passed to
   632  *  FLAC__stream_decoder_init*_stream().  The supplied function will be
   633  *  called when the decoder needs to know if the end of the stream has
   634  *  been reached.
   635  *
   636  * Here is an example of a EOF callback for stdio streams:
   637  * FLAC__bool eof_cb(const FLAC__StreamDecoder *decoder, void *client_data)
   638  * \code
   639  * {
   640  *   FILE *file = ((MyClientData*)client_data)->file;
   641  *   return feof(file)? true : false;
   642  * }
   643  * \endcode
   644  *
   645  * \note In general, FLAC__StreamDecoder functions which change the
   646  * state should not be called on the \a decoder while in the callback.
   647  *
   648  * \param  decoder  The decoder instance calling the callback.
   649  * \param  client_data  The callee's client data set through
   650  *                      FLAC__stream_decoder_init_*().
   651  * \retval FLAC__bool
   652  *    \c true if the currently at the end of the stream, else \c false.
   653  */
   654 typedef FLAC__bool (*FLAC__StreamDecoderEofCallback)(const FLAC__StreamDecoder *decoder, void *client_data);
   655 
   656 /** Signature for the write callback.
   657  *
   658  *  A function pointer matching this signature must be passed to one of
   659  *  the FLAC__stream_decoder_init_*() functions.
   660  *  The supplied function will be called when the decoder has decoded a
   661  *  single audio frame.  The decoder will pass the frame metadata as well
   662  *  as an array of pointers (one for each channel) pointing to the
   663  *  decoded audio.
   664  *
   665  * \note In general, FLAC__StreamDecoder functions which change the
   666  * state should not be called on the \a decoder while in the callback.
   667  *
   668  * \param  decoder  The decoder instance calling the callback.
   669  * \param  frame    The description of the decoded frame.  See
   670  *                  FLAC__Frame.
   671  * \param  buffer   An array of pointers to decoded channels of data.
   672  *                  Each pointer will point to an array of signed
   673  *                  samples of length \a frame->header.blocksize.
   674  *                  Channels will be ordered according to the FLAC
   675  *                  specification; see the documentation for the
   676  *                  <A HREF="../format.html#frame_header">frame header</A>.
   677  * \param  client_data  The callee's client data set through
   678  *                      FLAC__stream_decoder_init_*().
   679  * \retval FLAC__StreamDecoderWriteStatus
   680  *    The callee's return status.
   681  */
   682 typedef FLAC__StreamDecoderWriteStatus (*FLAC__StreamDecoderWriteCallback)(const FLAC__StreamDecoder *decoder, const FLAC__Frame *frame, const FLAC__int32 * const buffer[], void *client_data);
   683 
   684 /** Signature for the metadata callback.
   685  *
   686  *  A function pointer matching this signature must be passed to one of
   687  *  the FLAC__stream_decoder_init_*() functions.
   688  *  The supplied function will be called when the decoder has decoded a
   689  *  metadata block.  In a valid FLAC file there will always be one
   690  *  \c STREAMINFO block, followed by zero or more other metadata blocks.
   691  *  These will be supplied by the decoder in the same order as they
   692  *  appear in the stream and always before the first audio frame (i.e.
   693  *  write callback).  The metadata block that is passed in must not be
   694  *  modified, and it doesn't live beyond the callback, so you should make
   695  *  a copy of it with FLAC__metadata_object_clone() if you will need it
   696  *  elsewhere.  Since metadata blocks can potentially be large, by
   697  *  default the decoder only calls the metadata callback for the
   698  *  \c STREAMINFO block; you can instruct the decoder to pass or filter
   699  *  other blocks with FLAC__stream_decoder_set_metadata_*() calls.
   700  *
   701  * \note In general, FLAC__StreamDecoder functions which change the
   702  * state should not be called on the \a decoder while in the callback.
   703  *
   704  * \param  decoder  The decoder instance calling the callback.
   705  * \param  metadata The decoded metadata block.
   706  * \param  client_data  The callee's client data set through
   707  *                      FLAC__stream_decoder_init_*().
   708  */
   709 typedef void (*FLAC__StreamDecoderMetadataCallback)(const FLAC__StreamDecoder *decoder, const FLAC__StreamMetadata *metadata, void *client_data);
   710 
   711 /** Signature for the error callback.
   712  *
   713  *  A function pointer matching this signature must be passed to one of
   714  *  the FLAC__stream_decoder_init_*() functions.
   715  *  The supplied function will be called whenever an error occurs during
   716  *  decoding.
   717  *
   718  * \note In general, FLAC__StreamDecoder functions which change the
   719  * state should not be called on the \a decoder while in the callback.
   720  *
   721  * \param  decoder  The decoder instance calling the callback.
   722  * \param  status   The error encountered by the decoder.
   723  * \param  client_data  The callee's client data set through
   724  *                      FLAC__stream_decoder_init_*().
   725  */
   726 typedef void (*FLAC__StreamDecoderErrorCallback)(const FLAC__StreamDecoder *decoder, FLAC__StreamDecoderErrorStatus status, void *client_data);
   727 
   728 
   729 /***********************************************************************
   730  *
   731  * Class constructor/destructor
   732  *
   733  ***********************************************************************/
   734 
   735 /** Create a new stream decoder instance.  The instance is created with
   736  *  default settings; see the individual FLAC__stream_decoder_set_*()
   737  *  functions for each setting's default.
   738  *
   739  * \retval FLAC__StreamDecoder*
   740  *    \c NULL if there was an error allocating memory, else the new instance.
   741  */
   742 FLAC_API FLAC__StreamDecoder *FLAC__stream_decoder_new(void);
   743 
   744 /** Free a decoder instance.  Deletes the object pointed to by \a decoder.
   745  *
   746  * \param decoder  A pointer to an existing decoder.
   747  * \assert
   748  *    \code decoder != NULL \endcode
   749  */
   750 FLAC_API void FLAC__stream_decoder_delete(FLAC__StreamDecoder *decoder);
   751 
   752 
   753 /***********************************************************************
   754  *
   755  * Public class method prototypes
   756  *
   757  ***********************************************************************/
   758 
   759 /** Set the serial number for the FLAC stream within the Ogg container.
   760  *  The default behavior is to use the serial number of the first Ogg
   761  *  page.  Setting a serial number here will explicitly specify which
   762  *  stream is to be decoded.
   763  *
   764  * \note
   765  * This does not need to be set for native FLAC decoding.
   766  *
   767  * \default \c use serial number of first page
   768  * \param  decoder        A decoder instance to set.
   769  * \param  serial_number  See above.
   770  * \assert
   771  *    \code decoder != NULL \endcode
   772  * \retval FLAC__bool
   773  *    \c false if the decoder is already initialized, else \c true.
   774  */
   775 FLAC_API FLAC__bool FLAC__stream_decoder_set_ogg_serial_number(FLAC__StreamDecoder *decoder, long serial_number);
   776 
   777 /** Set the "MD5 signature checking" flag.  If \c true, the decoder will
   778  *  compute the MD5 signature of the unencoded audio data while decoding
   779  *  and compare it to the signature from the STREAMINFO block, if it
   780  *  exists, during FLAC__stream_decoder_finish().
   781  *
   782  *  MD5 signature checking will be turned off (until the next
   783  *  FLAC__stream_decoder_reset()) if there is no signature in the
   784  *  STREAMINFO block or when a seek is attempted.
   785  *
   786  *  Clients that do not use the MD5 check should leave this off to speed
   787  *  up decoding.
   788  *
   789  * \default \c false
   790  * \param  decoder  A decoder instance to set.
   791  * \param  value    Flag value (see above).
   792  * \assert
   793  *    \code decoder != NULL \endcode
   794  * \retval FLAC__bool
   795  *    \c false if the decoder is already initialized, else \c true.
   796  */
   797 FLAC_API FLAC__bool FLAC__stream_decoder_set_md5_checking(FLAC__StreamDecoder *decoder, FLAC__bool value);
   798 
   799 /** Direct the decoder to pass on all metadata blocks of type \a type.
   800  *
   801  * \default By default, only the \c STREAMINFO block is returned via the
   802  *          metadata callback.
   803  * \param  decoder  A decoder instance to set.
   804  * \param  type     See above.
   805  * \assert
   806  *    \code decoder != NULL \endcode
   807  *    \a type is valid
   808  * \retval FLAC__bool
   809  *    \c false if the decoder is already initialized, else \c true.
   810  */
   811 FLAC_API FLAC__bool FLAC__stream_decoder_set_metadata_respond(FLAC__StreamDecoder *decoder, FLAC__MetadataType type);
   812 
   813 /** Direct the decoder to pass on all APPLICATION metadata blocks of the
   814  *  given \a id.
   815  *
   816  * \default By default, only the \c STREAMINFO block is returned via the
   817  *          metadata callback.
   818  * \param  decoder  A decoder instance to set.
   819  * \param  id       See above.
   820  * \assert
   821  *    \code decoder != NULL \endcode
   822  *    \code id != NULL \endcode
   823  * \retval FLAC__bool
   824  *    \c false if the decoder is already initialized, else \c true.
   825  */
   826 FLAC_API FLAC__bool FLAC__stream_decoder_set_metadata_respond_application(FLAC__StreamDecoder *decoder, const FLAC__byte id[4]);
   827 
   828 /** Direct the decoder to pass on all metadata blocks of any type.
   829  *
   830  * \default By default, only the \c STREAMINFO block is returned via the
   831  *          metadata callback.
   832  * \param  decoder  A decoder instance to set.
   833  * \assert
   834  *    \code decoder != NULL \endcode
   835  * \retval FLAC__bool
   836  *    \c false if the decoder is already initialized, else \c true.
   837  */
   838 FLAC_API FLAC__bool FLAC__stream_decoder_set_metadata_respond_all(FLAC__StreamDecoder *decoder);
   839 
   840 /** Direct the decoder to filter out all metadata blocks of type \a type.
   841  *
   842  * \default By default, only the \c STREAMINFO block is returned via the
   843  *          metadata callback.
   844  * \param  decoder  A decoder instance to set.
   845  * \param  type     See above.
   846  * \assert
   847  *    \code decoder != NULL \endcode
   848  *    \a type is valid
   849  * \retval FLAC__bool
   850  *    \c false if the decoder is already initialized, else \c true.
   851  */
   852 FLAC_API FLAC__bool FLAC__stream_decoder_set_metadata_ignore(FLAC__StreamDecoder *decoder, FLAC__MetadataType type);
   853 
   854 /** Direct the decoder to filter out all APPLICATION metadata blocks of
   855  *  the given \a id.
   856  *
   857  * \default By default, only the \c STREAMINFO block is returned via the
   858  *          metadata callback.
   859  * \param  decoder  A decoder instance to set.
   860  * \param  id       See above.
   861  * \assert
   862  *    \code decoder != NULL \endcode
   863  *    \code id != NULL \endcode
   864  * \retval FLAC__bool
   865  *    \c false if the decoder is already initialized, else \c true.
   866  */
   867 FLAC_API FLAC__bool FLAC__stream_decoder_set_metadata_ignore_application(FLAC__StreamDecoder *decoder, const FLAC__byte id[4]);
   868 
   869 /** Direct the decoder to filter out all metadata blocks of any type.
   870  *
   871  * \default By default, only the \c STREAMINFO block is returned via the
   872  *          metadata callback.
   873  * \param  decoder  A decoder instance to set.
   874  * \assert
   875  *    \code decoder != NULL \endcode
   876  * \retval FLAC__bool
   877  *    \c false if the decoder is already initialized, else \c true.
   878  */
   879 FLAC_API FLAC__bool FLAC__stream_decoder_set_metadata_ignore_all(FLAC__StreamDecoder *decoder);
   880 
   881 /** Get the current decoder state.
   882  *
   883  * \param  decoder  A decoder instance to query.
   884  * \assert
   885  *    \code decoder != NULL \endcode
   886  * \retval FLAC__StreamDecoderState
   887  *    The current decoder state.
   888  */
   889 FLAC_API FLAC__StreamDecoderState FLAC__stream_decoder_get_state(const FLAC__StreamDecoder *decoder);
   890 
   891 /** Get the current decoder state as a C string.
   892  *
   893  * \param  decoder  A decoder instance to query.
   894  * \assert
   895  *    \code decoder != NULL \endcode
   896  * \retval const char *
   897  *    The decoder state as a C string.  Do not modify the contents.
   898  */
   899 FLAC_API const char *FLAC__stream_decoder_get_resolved_state_string(const FLAC__StreamDecoder *decoder);
   900 
   901 /** Get the "MD5 signature checking" flag.
   902  *  This is the value of the setting, not whether or not the decoder is
   903  *  currently checking the MD5 (remember, it can be turned off automatically
   904  *  by a seek).  When the decoder is reset the flag will be restored to the
   905  *  value returned by this function.
   906  *
   907  * \param  decoder  A decoder instance to query.
   908  * \assert
   909  *    \code decoder != NULL \endcode
   910  * \retval FLAC__bool
   911  *    See above.
   912  */
   913 FLAC_API FLAC__bool FLAC__stream_decoder_get_md5_checking(const FLAC__StreamDecoder *decoder);
   914 
   915 /** Get the total number of samples in the stream being decoded.
   916  *  Will only be valid after decoding has started and will contain the
   917  *  value from the \c STREAMINFO block.  A value of \c 0 means "unknown".
   918  *
   919  * \param  decoder  A decoder instance to query.
   920  * \assert
   921  *    \code decoder != NULL \endcode
   922  * \retval unsigned
   923  *    See above.
   924  */
   925 FLAC_API FLAC__uint64 FLAC__stream_decoder_get_total_samples(const FLAC__StreamDecoder *decoder);
   926 
   927 /** Get the current number of channels in the stream being decoded.
   928  *  Will only be valid after decoding has started and will contain the
   929  *  value from the most recently decoded frame header.
   930  *
   931  * \param  decoder  A decoder instance to query.
   932  * \assert
   933  *    \code decoder != NULL \endcode
   934  * \retval unsigned
   935  *    See above.
   936  */
   937 FLAC_API unsigned FLAC__stream_decoder_get_channels(const FLAC__StreamDecoder *decoder);
   938 
   939 /** Get the current channel assignment in the stream being decoded.
   940  *  Will only be valid after decoding has started and will contain the
   941  *  value from the most recently decoded frame header.
   942  *
   943  * \param  decoder  A decoder instance to query.
   944  * \assert
   945  *    \code decoder != NULL \endcode
   946  * \retval FLAC__ChannelAssignment
   947  *    See above.
   948  */
   949 FLAC_API FLAC__ChannelAssignment FLAC__stream_decoder_get_channel_assignment(const FLAC__StreamDecoder *decoder);
   950 
   951 /** Get the current sample resolution in the stream being decoded.
   952  *  Will only be valid after decoding has started and will contain the
   953  *  value from the most recently decoded frame header.
   954  *
   955  * \param  decoder  A decoder instance to query.
   956  * \assert
   957  *    \code decoder != NULL \endcode
   958  * \retval unsigned
   959  *    See above.
   960  */
   961 FLAC_API unsigned FLAC__stream_decoder_get_bits_per_sample(const FLAC__StreamDecoder *decoder);
   962 
   963 /** Get the current sample rate in Hz of the stream being decoded.
   964  *  Will only be valid after decoding has started and will contain the
   965  *  value from the most recently decoded frame header.
   966  *
   967  * \param  decoder  A decoder instance to query.
   968  * \assert
   969  *    \code decoder != NULL \endcode
   970  * \retval unsigned
   971  *    See above.
   972  */
   973 FLAC_API unsigned FLAC__stream_decoder_get_sample_rate(const FLAC__StreamDecoder *decoder);
   974 
   975 /** Get the current blocksize of the stream being decoded.
   976  *  Will only be valid after decoding has started and will contain the
   977  *  value from the most recently decoded frame header.
   978  *
   979  * \param  decoder  A decoder instance to query.
   980  * \assert
   981  *    \code decoder != NULL \endcode
   982  * \retval unsigned
   983  *    See above.
   984  */
   985 FLAC_API unsigned FLAC__stream_decoder_get_blocksize(const FLAC__StreamDecoder *decoder);
   986 
   987 /** Returns the decoder's current read position within the stream.
   988  *  The position is the byte offset from the start of the stream.
   989  *  Bytes before this position have been fully decoded.  Note that
   990  *  there may still be undecoded bytes in the decoder's read FIFO.
   991  *  The returned position is correct even after a seek.
   992  *
   993  *  \warning This function currently only works for native FLAC,
   994  *           not Ogg FLAC streams.
   995  *
   996  * \param  decoder   A decoder instance to query.
   997  * \param  position  Address at which to return the desired position.
   998  * \assert
   999  *    \code decoder != NULL \endcode
  1000  *    \code position != NULL \endcode
  1001  * \retval FLAC__bool
  1002  *    \c true if successful, \c false if the stream is not native FLAC,
  1003  *    or there was an error from the 'tell' callback or it returned
  1004  *    \c FLAC__STREAM_DECODER_TELL_STATUS_UNSUPPORTED.
  1005  */
  1006 FLAC_API FLAC__bool FLAC__stream_decoder_get_decode_position(const FLAC__StreamDecoder *decoder, FLAC__uint64 *position);
  1007 
  1008 /** Initialize the decoder instance to decode native FLAC streams.
  1009  *
  1010  *  This flavor of initialization sets up the decoder to decode from a
  1011  *  native FLAC stream. I/O is performed via callbacks to the client.
  1012  *  For decoding from a plain file via filename or open FILE*,
  1013  *  FLAC__stream_decoder_init_file() and FLAC__stream_decoder_init_FILE()
  1014  *  provide a simpler interface.
  1015  *
  1016  *  This function should be called after FLAC__stream_decoder_new() and
  1017  *  FLAC__stream_decoder_set_*() but before any of the
  1018  *  FLAC__stream_decoder_process_*() functions.  Will set and return the
  1019  *  decoder state, which will be FLAC__STREAM_DECODER_SEARCH_FOR_METADATA
  1020  *  if initialization succeeded.
  1021  *
  1022  * \param  decoder            An uninitialized decoder instance.
  1023  * \param  read_callback      See FLAC__StreamDecoderReadCallback.  This
  1024  *                            pointer must not be \c NULL.
  1025  * \param  seek_callback      See FLAC__StreamDecoderSeekCallback.  This
  1026  *                            pointer may be \c NULL if seeking is not
  1027  *                            supported.  If \a seek_callback is not \c NULL then a
  1028  *                            \a tell_callback, \a length_callback, and \a eof_callback must also be supplied.
  1029  *                            Alternatively, a dummy seek callback that just
  1030  *                            returns \c FLAC__STREAM_DECODER_SEEK_STATUS_UNSUPPORTED
  1031  *                            may also be supplied, all though this is slightly
  1032  *                            less efficient for the decoder.
  1033  * \param  tell_callback      See FLAC__StreamDecoderTellCallback.  This
  1034  *                            pointer may be \c NULL if not supported by the client.  If
  1035  *                            \a seek_callback is not \c NULL then a
  1036  *                            \a tell_callback must also be supplied.
  1037  *                            Alternatively, a dummy tell callback that just
  1038  *                            returns \c FLAC__STREAM_DECODER_TELL_STATUS_UNSUPPORTED
  1039  *                            may also be supplied, all though this is slightly
  1040  *                            less efficient for the decoder.
  1041  * \param  length_callback    See FLAC__StreamDecoderLengthCallback.  This
  1042  *                            pointer may be \c NULL if not supported by the client.  If
  1043  *                            \a seek_callback is not \c NULL then a
  1044  *                            \a length_callback must also be supplied.
  1045  *                            Alternatively, a dummy length callback that just
  1046  *                            returns \c FLAC__STREAM_DECODER_LENGTH_STATUS_UNSUPPORTED
  1047  *                            may also be supplied, all though this is slightly
  1048  *                            less efficient for the decoder.
  1049  * \param  eof_callback       See FLAC__StreamDecoderEofCallback.  This
  1050  *                            pointer may be \c NULL if not supported by the client.  If
  1051  *                            \a seek_callback is not \c NULL then a
  1052  *                            \a eof_callback must also be supplied.
  1053  *                            Alternatively, a dummy length callback that just
  1054  *                            returns \c false
  1055  *                            may also be supplied, all though this is slightly
  1056  *                            less efficient for the decoder.
  1057  * \param  write_callback     See FLAC__StreamDecoderWriteCallback.  This
  1058  *                            pointer must not be \c NULL.
  1059  * \param  metadata_callback  See FLAC__StreamDecoderMetadataCallback.  This
  1060  *                            pointer may be \c NULL if the callback is not
  1061  *                            desired.
  1062  * \param  error_callback     See FLAC__StreamDecoderErrorCallback.  This
  1063  *                            pointer must not be \c NULL.
  1064  * \param  client_data        This value will be supplied to callbacks in their
  1065  *                            \a client_data argument.
  1066  * \assert
  1067  *    \code decoder != NULL \endcode
  1068  * \retval FLAC__StreamDecoderInitStatus
  1069  *    \c FLAC__STREAM_DECODER_INIT_STATUS_OK if initialization was successful;
  1070  *    see FLAC__StreamDecoderInitStatus for the meanings of other return values.
  1071  */
  1072 FLAC_API FLAC__StreamDecoderInitStatus FLAC__stream_decoder_init_stream(
  1073 	FLAC__StreamDecoder *decoder,
  1074 	FLAC__StreamDecoderReadCallback read_callback,
  1075 	FLAC__StreamDecoderSeekCallback seek_callback,
  1076 	FLAC__StreamDecoderTellCallback tell_callback,
  1077 	FLAC__StreamDecoderLengthCallback length_callback,
  1078 	FLAC__StreamDecoderEofCallback eof_callback,
  1079 	FLAC__StreamDecoderWriteCallback write_callback,
  1080 	FLAC__StreamDecoderMetadataCallback metadata_callback,
  1081 	FLAC__StreamDecoderErrorCallback error_callback,
  1082 	void *client_data
  1083 );
  1084 
  1085 /** Initialize the decoder instance to decode Ogg FLAC streams.
  1086  *
  1087  *  This flavor of initialization sets up the decoder to decode from a
  1088  *  FLAC stream in an Ogg container. I/O is performed via callbacks to the
  1089  *  client.  For decoding from a plain file via filename or open FILE*,
  1090  *  FLAC__stream_decoder_init_ogg_file() and FLAC__stream_decoder_init_ogg_FILE()
  1091  *  provide a simpler interface.
  1092  *
  1093  *  This function should be called after FLAC__stream_decoder_new() and
  1094  *  FLAC__stream_decoder_set_*() but before any of the
  1095  *  FLAC__stream_decoder_process_*() functions.  Will set and return the
  1096  *  decoder state, which will be FLAC__STREAM_DECODER_SEARCH_FOR_METADATA
  1097  *  if initialization succeeded.
  1098  *
  1099  *  \note Support for Ogg FLAC in the library is optional.  If this
  1100  *  library has been built without support for Ogg FLAC, this function
  1101  *  will return \c FLAC__STREAM_DECODER_INIT_STATUS_UNSUPPORTED_CONTAINER.
  1102  *
  1103  * \param  decoder            An uninitialized decoder instance.
  1104  * \param  read_callback      See FLAC__StreamDecoderReadCallback.  This
  1105  *                            pointer must not be \c NULL.
  1106  * \param  seek_callback      See FLAC__StreamDecoderSeekCallback.  This
  1107  *                            pointer may be \c NULL if seeking is not
  1108  *                            supported.  If \a seek_callback is not \c NULL then a
  1109  *                            \a tell_callback, \a length_callback, and \a eof_callback must also be supplied.
  1110  *                            Alternatively, a dummy seek callback that just
  1111  *                            returns \c FLAC__STREAM_DECODER_SEEK_STATUS_UNSUPPORTED
  1112  *                            may also be supplied, all though this is slightly
  1113  *                            less efficient for the decoder.
  1114  * \param  tell_callback      See FLAC__StreamDecoderTellCallback.  This
  1115  *                            pointer may be \c NULL if not supported by the client.  If
  1116  *                            \a seek_callback is not \c NULL then a
  1117  *                            \a tell_callback must also be supplied.
  1118  *                            Alternatively, a dummy tell callback that just
  1119  *                            returns \c FLAC__STREAM_DECODER_TELL_STATUS_UNSUPPORTED
  1120  *                            may also be supplied, all though this is slightly
  1121  *                            less efficient for the decoder.
  1122  * \param  length_callback    See FLAC__StreamDecoderLengthCallback.  This
  1123  *                            pointer may be \c NULL if not supported by the client.  If
  1124  *                            \a seek_callback is not \c NULL then a
  1125  *                            \a length_callback must also be supplied.
  1126  *                            Alternatively, a dummy length callback that just
  1127  *                            returns \c FLAC__STREAM_DECODER_LENGTH_STATUS_UNSUPPORTED
  1128  *                            may also be supplied, all though this is slightly
  1129  *                            less efficient for the decoder.
  1130  * \param  eof_callback       See FLAC__StreamDecoderEofCallback.  This
  1131  *                            pointer may be \c NULL if not supported by the client.  If
  1132  *                            \a seek_callback is not \c NULL then a
  1133  *                            \a eof_callback must also be supplied.
  1134  *                            Alternatively, a dummy length callback that just
  1135  *                            returns \c false
  1136  *                            may also be supplied, all though this is slightly
  1137  *                            less efficient for the decoder.
  1138  * \param  write_callback     See FLAC__StreamDecoderWriteCallback.  This
  1139  *                            pointer must not be \c NULL.
  1140  * \param  metadata_callback  See FLAC__StreamDecoderMetadataCallback.  This
  1141  *                            pointer may be \c NULL if the callback is not
  1142  *                            desired.
  1143  * \param  error_callback     See FLAC__StreamDecoderErrorCallback.  This
  1144  *                            pointer must not be \c NULL.
  1145  * \param  client_data        This value will be supplied to callbacks in their
  1146  *                            \a client_data argument.
  1147  * \assert
  1148  *    \code decoder != NULL \endcode
  1149  * \retval FLAC__StreamDecoderInitStatus
  1150  *    \c FLAC__STREAM_DECODER_INIT_STATUS_OK if initialization was successful;
  1151  *    see FLAC__StreamDecoderInitStatus for the meanings of other return values.
  1152  */
  1153 FLAC_API FLAC__StreamDecoderInitStatus FLAC__stream_decoder_init_ogg_stream(
  1154 	FLAC__StreamDecoder *decoder,
  1155 	FLAC__StreamDecoderReadCallback read_callback,
  1156 	FLAC__StreamDecoderSeekCallback seek_callback,
  1157 	FLAC__StreamDecoderTellCallback tell_callback,
  1158 	FLAC__StreamDecoderLengthCallback length_callback,
  1159 	FLAC__StreamDecoderEofCallback eof_callback,
  1160 	FLAC__StreamDecoderWriteCallback write_callback,
  1161 	FLAC__StreamDecoderMetadataCallback metadata_callback,
  1162 	FLAC__StreamDecoderErrorCallback error_callback,
  1163 	void *client_data
  1164 );
  1165 
  1166 /** Initialize the decoder instance to decode native FLAC files.
  1167  *
  1168  *  This flavor of initialization sets up the decoder to decode from a
  1169  *  plain native FLAC file.  For non-stdio streams, you must use
  1170  *  FLAC__stream_decoder_init_stream() and provide callbacks for the I/O.
  1171  *
  1172  *  This function should be called after FLAC__stream_decoder_new() and
  1173  *  FLAC__stream_decoder_set_*() but before any of the
  1174  *  FLAC__stream_decoder_process_*() functions.  Will set and return the
  1175  *  decoder state, which will be FLAC__STREAM_DECODER_SEARCH_FOR_METADATA
  1176  *  if initialization succeeded.
  1177  *
  1178  * \param  decoder            An uninitialized decoder instance.
  1179  * \param  file               An open FLAC file.  The file should have been
  1180  *                            opened with mode \c "rb" and rewound.  The file
  1181  *                            becomes owned by the decoder and should not be
  1182  *                            manipulated by the client while decoding.
  1183  *                            Unless \a file is \c stdin, it will be closed
  1184  *                            when FLAC__stream_decoder_finish() is called.
  1185  *                            Note however that seeking will not work when
  1186  *                            decoding from \c stdout since it is not seekable.
  1187  * \param  write_callback     See FLAC__StreamDecoderWriteCallback.  This
  1188  *                            pointer must not be \c NULL.
  1189  * \param  metadata_callback  See FLAC__StreamDecoderMetadataCallback.  This
  1190  *                            pointer may be \c NULL if the callback is not
  1191  *                            desired.
  1192  * \param  error_callback     See FLAC__StreamDecoderErrorCallback.  This
  1193  *                            pointer must not be \c NULL.
  1194  * \param  client_data        This value will be supplied to callbacks in their
  1195  *                            \a client_data argument.
  1196  * \assert
  1197  *    \code decoder != NULL \endcode
  1198  *    \code file != NULL \endcode
  1199  * \retval FLAC__StreamDecoderInitStatus
  1200  *    \c FLAC__STREAM_DECODER_INIT_STATUS_OK if initialization was successful;
  1201  *    see FLAC__StreamDecoderInitStatus for the meanings of other return values.
  1202  */
  1203 FLAC_API FLAC__StreamDecoderInitStatus FLAC__stream_decoder_init_FILE(
  1204 	FLAC__StreamDecoder *decoder,
  1205 	FILE *file,
  1206 	FLAC__StreamDecoderWriteCallback write_callback,
  1207 	FLAC__StreamDecoderMetadataCallback metadata_callback,
  1208 	FLAC__StreamDecoderErrorCallback error_callback,
  1209 	void *client_data
  1210 );
  1211 
  1212 /** Initialize the decoder instance to decode Ogg FLAC files.
  1213  *
  1214  *  This flavor of initialization sets up the decoder to decode from a
  1215  *  plain Ogg FLAC file.  For non-stdio streams, you must use
  1216  *  FLAC__stream_decoder_init_ogg_stream() and provide callbacks for the I/O.
  1217  *
  1218  *  This function should be called after FLAC__stream_decoder_new() and
  1219  *  FLAC__stream_decoder_set_*() but before any of the
  1220  *  FLAC__stream_decoder_process_*() functions.  Will set and return the
  1221  *  decoder state, which will be FLAC__STREAM_DECODER_SEARCH_FOR_METADATA
  1222  *  if initialization succeeded.
  1223  *
  1224  *  \note Support for Ogg FLAC in the library is optional.  If this
  1225  *  library has been built without support for Ogg FLAC, this function
  1226  *  will return \c FLAC__STREAM_DECODER_INIT_STATUS_UNSUPPORTED_CONTAINER.
  1227  *
  1228  * \param  decoder            An uninitialized decoder instance.
  1229  * \param  file               An open FLAC file.  The file should have been
  1230  *                            opened with mode \c "rb" and rewound.  The file
  1231  *                            becomes owned by the decoder and should not be
  1232  *                            manipulated by the client while decoding.
  1233  *                            Unless \a file is \c stdin, it will be closed
  1234  *                            when FLAC__stream_decoder_finish() is called.
  1235  *                            Note however that seeking will not work when
  1236  *                            decoding from \c stdout since it is not seekable.
  1237  * \param  write_callback     See FLAC__StreamDecoderWriteCallback.  This
  1238  *                            pointer must not be \c NULL.
  1239  * \param  metadata_callback  See FLAC__StreamDecoderMetadataCallback.  This
  1240  *                            pointer may be \c NULL if the callback is not
  1241  *                            desired.
  1242  * \param  error_callback     See FLAC__StreamDecoderErrorCallback.  This
  1243  *                            pointer must not be \c NULL.
  1244  * \param  client_data        This value will be supplied to callbacks in their
  1245  *                            \a client_data argument.
  1246  * \assert
  1247  *    \code decoder != NULL \endcode
  1248  *    \code file != NULL \endcode
  1249  * \retval FLAC__StreamDecoderInitStatus
  1250  *    \c FLAC__STREAM_DECODER_INIT_STATUS_OK if initialization was successful;
  1251  *    see FLAC__StreamDecoderInitStatus for the meanings of other return values.
  1252  */
  1253 FLAC_API FLAC__StreamDecoderInitStatus FLAC__stream_decoder_init_ogg_FILE(
  1254 	FLAC__StreamDecoder *decoder,
  1255 	FILE *file,
  1256 	FLAC__StreamDecoderWriteCallback write_callback,
  1257 	FLAC__StreamDecoderMetadataCallback metadata_callback,
  1258 	FLAC__StreamDecoderErrorCallback error_callback,
  1259 	void *client_data
  1260 );
  1261 
  1262 /** Initialize the decoder instance to decode native FLAC files.
  1263  *
  1264  *  This flavor of initialization sets up the decoder to decode from a plain
  1265  *  native FLAC file.  If POSIX fopen() semantics are not sufficient, (for
  1266  *  example, with Unicode filenames on Windows), you must use
  1267  *  FLAC__stream_decoder_init_FILE(), or FLAC__stream_decoder_init_stream()
  1268  *  and provide callbacks for the I/O.
  1269  *
  1270  *  This function should be called after FLAC__stream_decoder_new() and
  1271  *  FLAC__stream_decoder_set_*() but before any of the
  1272  *  FLAC__stream_decoder_process_*() functions.  Will set and return the
  1273  *  decoder state, which will be FLAC__STREAM_DECODER_SEARCH_FOR_METADATA
  1274  *  if initialization succeeded.
  1275  *
  1276  * \param  decoder            An uninitialized decoder instance.
  1277  * \param  filename           The name of the file to decode from.  The file will
  1278  *                            be opened with fopen().  Use \c NULL to decode from
  1279  *                            \c stdin.  Note that \c stdin is not seekable.
  1280  * \param  write_callback     See FLAC__StreamDecoderWriteCallback.  This
  1281  *                            pointer must not be \c NULL.
  1282  * \param  metadata_callback  See FLAC__StreamDecoderMetadataCallback.  This
  1283  *                            pointer may be \c NULL if the callback is not
  1284  *                            desired.
  1285  * \param  error_callback     See FLAC__StreamDecoderErrorCallback.  This
  1286  *                            pointer must not be \c NULL.
  1287  * \param  client_data        This value will be supplied to callbacks in their
  1288  *                            \a client_data argument.
  1289  * \assert
  1290  *    \code decoder != NULL \endcode
  1291  * \retval FLAC__StreamDecoderInitStatus
  1292  *    \c FLAC__STREAM_DECODER_INIT_STATUS_OK if initialization was successful;
  1293  *    see FLAC__StreamDecoderInitStatus for the meanings of other return values.
  1294  */
  1295 FLAC_API FLAC__StreamDecoderInitStatus FLAC__stream_decoder_init_file(
  1296 	FLAC__StreamDecoder *decoder,
  1297 	const char *filename,
  1298 	FLAC__StreamDecoderWriteCallback write_callback,
  1299 	FLAC__StreamDecoderMetadataCallback metadata_callback,
  1300 	FLAC__StreamDecoderErrorCallback error_callback,
  1301 	void *client_data
  1302 );
  1303 
  1304 /** Initialize the decoder instance to decode Ogg FLAC files.
  1305  *
  1306  *  This flavor of initialization sets up the decoder to decode from a plain
  1307  *  Ogg FLAC file.  If POSIX fopen() semantics are not sufficient, (for
  1308  *  example, with Unicode filenames on Windows), you must use
  1309  *  FLAC__stream_decoder_init_ogg_FILE(), or FLAC__stream_decoder_init_ogg_stream()
  1310  *  and provide callbacks for the I/O.
  1311  *
  1312  *  This function should be called after FLAC__stream_decoder_new() and
  1313  *  FLAC__stream_decoder_set_*() but before any of the
  1314  *  FLAC__stream_decoder_process_*() functions.  Will set and return the
  1315  *  decoder state, which will be FLAC__STREAM_DECODER_SEARCH_FOR_METADATA
  1316  *  if initialization succeeded.
  1317  *
  1318  *  \note Support for Ogg FLAC in the library is optional.  If this
  1319  *  library has been built without support for Ogg FLAC, this function
  1320  *  will return \c FLAC__STREAM_DECODER_INIT_STATUS_UNSUPPORTED_CONTAINER.
  1321  *
  1322  * \param  decoder            An uninitialized decoder instance.
  1323  * \param  filename           The name of the file to decode from.  The file will
  1324  *                            be opened with fopen().  Use \c NULL to decode from
  1325  *                            \c stdin.  Note that \c stdin is not seekable.
  1326  * \param  write_callback     See FLAC__StreamDecoderWriteCallback.  This
  1327  *                            pointer must not be \c NULL.
  1328  * \param  metadata_callback  See FLAC__StreamDecoderMetadataCallback.  This
  1329  *                            pointer may be \c NULL if the callback is not
  1330  *                            desired.
  1331  * \param  error_callback     See FLAC__StreamDecoderErrorCallback.  This
  1332  *                            pointer must not be \c NULL.
  1333  * \param  client_data        This value will be supplied to callbacks in their
  1334  *                            \a client_data argument.
  1335  * \assert
  1336  *    \code decoder != NULL \endcode
  1337  * \retval FLAC__StreamDecoderInitStatus
  1338  *    \c FLAC__STREAM_DECODER_INIT_STATUS_OK if initialization was successful;
  1339  *    see FLAC__StreamDecoderInitStatus for the meanings of other return values.
  1340  */
  1341 FLAC_API FLAC__StreamDecoderInitStatus FLAC__stream_decoder_init_ogg_file(
  1342 	FLAC__StreamDecoder *decoder,
  1343 	const char *filename,
  1344 	FLAC__StreamDecoderWriteCallback write_callback,
  1345 	FLAC__StreamDecoderMetadataCallback metadata_callback,
  1346 	FLAC__StreamDecoderErrorCallback error_callback,
  1347 	void *client_data
  1348 );
  1349 
  1350 /** Finish the decoding process.
  1351  *  Flushes the decoding buffer, releases resources, resets the decoder
  1352  *  settings to their defaults, and returns the decoder state to
  1353  *  FLAC__STREAM_DECODER_UNINITIALIZED.
  1354  *
  1355  *  In the event of a prematurely-terminated decode, it is not strictly
  1356  *  necessary to call this immediately before FLAC__stream_decoder_delete()
  1357  *  but it is good practice to match every FLAC__stream_decoder_init_*()
  1358  *  with a FLAC__stream_decoder_finish().
  1359  *
  1360  * \param  decoder  An uninitialized decoder instance.
  1361  * \assert
  1362  *    \code decoder != NULL \endcode
  1363  * \retval FLAC__bool
  1364  *    \c false if MD5 checking is on AND a STREAMINFO block was available
  1365  *    AND the MD5 signature in the STREAMINFO block was non-zero AND the
  1366  *    signature does not match the one computed by the decoder; else
  1367  *    \c true.
  1368  */
  1369 FLAC_API FLAC__bool FLAC__stream_decoder_finish(FLAC__StreamDecoder *decoder);
  1370 
  1371 /** Flush the stream input.
  1372  *  The decoder's input buffer will be cleared and the state set to
  1373  *  \c FLAC__STREAM_DECODER_SEARCH_FOR_FRAME_SYNC.  This will also turn
  1374  *  off MD5 checking.
  1375  *
  1376  * \param  decoder  A decoder instance.
  1377  * \assert
  1378  *    \code decoder != NULL \endcode
  1379  * \retval FLAC__bool
  1380  *    \c true if successful, else \c false if a memory allocation
  1381  *    error occurs (in which case the state will be set to
  1382  *    \c FLAC__STREAM_DECODER_MEMORY_ALLOCATION_ERROR).
  1383  */
  1384 FLAC_API FLAC__bool FLAC__stream_decoder_flush(FLAC__StreamDecoder *decoder);
  1385 
  1386 /** Reset the decoding process.
  1387  *  The decoder's input buffer will be cleared and the state set to
  1388  *  \c FLAC__STREAM_DECODER_SEARCH_FOR_METADATA.  This is similar to
  1389  *  FLAC__stream_decoder_finish() except that the settings are
  1390  *  preserved; there is no need to call FLAC__stream_decoder_init_*()
  1391  *  before decoding again.  MD5 checking will be restored to its original
  1392  *  setting.
  1393  *
  1394  *  If the decoder is seekable, or was initialized with
  1395  *  FLAC__stream_decoder_init*_FILE() or FLAC__stream_decoder_init*_file(),
  1396  *  the decoder will also attempt to seek to the beginning of the file.
  1397  *  If this rewind fails, this function will return \c false.  It follows
  1398  *  that FLAC__stream_decoder_reset() cannot be used when decoding from
  1399  *  \c stdin.
  1400  *
  1401  *  If the decoder was initialized with FLAC__stream_encoder_init*_stream()
  1402  *  and is not seekable (i.e. no seek callback was provided or the seek
  1403  *  callback returns \c FLAC__STREAM_DECODER_SEEK_STATUS_UNSUPPORTED), it
  1404  *  is the duty of the client to start feeding data from the beginning of
  1405  *  the stream on the next FLAC__stream_decoder_process() or
  1406  *  FLAC__stream_decoder_process_interleaved() call.
  1407  *
  1408  * \param  decoder  A decoder instance.
  1409  * \assert
  1410  *    \code decoder != NULL \endcode
  1411  * \retval FLAC__bool
  1412  *    \c true if successful, else \c false if a memory allocation occurs
  1413  *    (in which case the state will be set to
  1414  *    \c FLAC__STREAM_DECODER_MEMORY_ALLOCATION_ERROR) or a seek error
  1415  *    occurs (the state will be unchanged).
  1416  */
  1417 FLAC_API FLAC__bool FLAC__stream_decoder_reset(FLAC__StreamDecoder *decoder);
  1418 
  1419 /** Decode one metadata block or audio frame.
  1420  *  This version instructs the decoder to decode a either a single metadata
  1421  *  block or a single frame and stop, unless the callbacks return a fatal
  1422  *  error or the read callback returns
  1423  *  \c FLAC__STREAM_DECODER_READ_STATUS_END_OF_STREAM.
  1424  *
  1425  *  As the decoder needs more input it will call the read callback.
  1426  *  Depending on what was decoded, the metadata or write callback will be
  1427  *  called with the decoded metadata block or audio frame.
  1428  *
  1429  *  Unless there is a fatal read error or end of stream, this function
  1430  *  will return once one whole frame is decoded.  In other words, if the
  1431  *  stream is not synchronized or points to a corrupt frame header, the
  1432  *  decoder will continue to try and resync until it gets to a valid
  1433  *  frame, then decode one frame, then return.  If the decoder points to
  1434  *  a frame whose frame CRC in the frame footer does not match the
  1435  *  computed frame CRC, this function will issue a
  1436  *  FLAC__STREAM_DECODER_ERROR_STATUS_FRAME_CRC_MISMATCH error to the
  1437  *  error callback, and return, having decoded one complete, although
  1438  *  corrupt, frame.  (Such corrupted frames are sent as silence of the
  1439  *  correct length to the write callback.)
  1440  *
  1441  * \param  decoder  An initialized decoder instance.
  1442  * \assert
  1443  *    \code decoder != NULL \endcode
  1444  * \retval FLAC__bool
  1445  *    \c false if any fatal read, write, or memory allocation error
  1446  *    occurred (meaning decoding must stop), else \c true; for more
  1447  *    information about the decoder, check the decoder state with
  1448  *    FLAC__stream_decoder_get_state().
  1449  */
  1450 FLAC_API FLAC__bool FLAC__stream_decoder_process_single(FLAC__StreamDecoder *decoder);
  1451 
  1452 /** Decode until the end of the metadata.
  1453  *  This version instructs the decoder to decode from the current position
  1454  *  and continue until all the metadata has been read, or until the
  1455  *  callbacks return a fatal error or the read callback returns
  1456  *  \c FLAC__STREAM_DECODER_READ_STATUS_END_OF_STREAM.
  1457  *
  1458  *  As the decoder needs more input it will call the read callback.
  1459  *  As each metadata block is decoded, the metadata callback will be called
  1460  *  with the decoded metadata.
  1461  *
  1462  * \param  decoder  An initialized decoder instance.
  1463  * \assert
  1464  *    \code decoder != NULL \endcode
  1465  * \retval FLAC__bool
  1466  *    \c false if any fatal read, write, or memory allocation error
  1467  *    occurred (meaning decoding must stop), else \c true; for more
  1468  *    information about the decoder, check the decoder state with
  1469  *    FLAC__stream_decoder_get_state().
  1470  */
  1471 FLAC_API FLAC__bool FLAC__stream_decoder_process_until_end_of_metadata(FLAC__StreamDecoder *decoder);
  1472 
  1473 /** Decode until the end of the stream.
  1474  *  This version instructs the decoder to decode from the current position
  1475  *  and continue until the end of stream (the read callback returns
  1476  *  \c FLAC__STREAM_DECODER_READ_STATUS_END_OF_STREAM), or until the
  1477  *  callbacks return a fatal error.
  1478  *
  1479  *  As the decoder needs more input it will call the read callback.
  1480  *  As each metadata block and frame is decoded, the metadata or write
  1481  *  callback will be called with the decoded metadata or frame.
  1482  *
  1483  * \param  decoder  An initialized decoder instance.
  1484  * \assert
  1485  *    \code decoder != NULL \endcode
  1486  * \retval FLAC__bool
  1487  *    \c false if any fatal read, write, or memory allocation error
  1488  *    occurred (meaning decoding must stop), else \c true; for more
  1489  *    information about the decoder, check the decoder state with
  1490  *    FLAC__stream_decoder_get_state().
  1491  */
  1492 FLAC_API FLAC__bool FLAC__stream_decoder_process_until_end_of_stream(FLAC__StreamDecoder *decoder);
  1493 
  1494 /** Skip one audio frame.
  1495  *  This version instructs the decoder to 'skip' a single frame and stop,
  1496  *  unless the callbacks return a fatal error or the read callback returns
  1497  *  \c FLAC__STREAM_DECODER_READ_STATUS_END_OF_STREAM.
  1498  *
  1499  *  The decoding flow is the same as what occurs when
  1500  *  FLAC__stream_decoder_process_single() is called to process an audio
  1501  *  frame, except that this function does not decode the parsed data into
  1502  *  PCM or call the write callback.  The integrity of the frame is still
  1503  *  checked the same way as in the other process functions.
  1504  *
  1505  *  This function will return once one whole frame is skipped, in the
  1506  *  same way that FLAC__stream_decoder_process_single() will return once
  1507  *  one whole frame is decoded.
  1508  *
  1509  *  This function can be used in more quickly determining FLAC frame
  1510  *  boundaries when decoding of the actual data is not needed, for
  1511  *  example when an application is separating a FLAC stream into frames
  1512  *  for editing or storing in a container.  To do this, the application
  1513  *  can use FLAC__stream_decoder_skip_single_frame() to quickly advance
  1514  *  to the next frame, then use
  1515  *  FLAC__stream_decoder_get_decode_position() to find the new frame
  1516  *  boundary.
  1517  *
  1518  *  This function should only be called when the stream has advanced
  1519  *  past all the metadata, otherwise it will return \c false.
  1520  *
  1521  * \param  decoder  An initialized decoder instance not in a metadata
  1522  *                  state.
  1523  * \assert
  1524  *    \code decoder != NULL \endcode
  1525  * \retval FLAC__bool
  1526  *    \c false if any fatal read, write, or memory allocation error
  1527  *    occurred (meaning decoding must stop), or if the decoder
  1528  *    is in the FLAC__STREAM_DECODER_SEARCH_FOR_METADATA or
  1529  *    FLAC__STREAM_DECODER_READ_METADATA state, else \c true; for more
  1530  *    information about the decoder, check the decoder state with
  1531  *    FLAC__stream_decoder_get_state().
  1532  */
  1533 FLAC_API FLAC__bool FLAC__stream_decoder_skip_single_frame(FLAC__StreamDecoder *decoder);
  1534 
  1535 /** Flush the input and seek to an absolute sample.
  1536  *  Decoding will resume at the given sample.  Note that because of
  1537  *  this, the next write callback may contain a partial block.  The
  1538  *  client must support seeking the input or this function will fail
  1539  *  and return \c false.  Furthermore, if the decoder state is
  1540  *  \c FLAC__STREAM_DECODER_SEEK_ERROR, then the decoder must be flushed
  1541  *  with FLAC__stream_decoder_flush() or reset with
  1542  *  FLAC__stream_decoder_reset() before decoding can continue.
  1543  *
  1544  * \param  decoder  A decoder instance.
  1545  * \param  sample   The target sample number to seek to.
  1546  * \assert
  1547  *    \code decoder != NULL \endcode
  1548  * \retval FLAC__bool
  1549  *    \c true if successful, else \c false.
  1550  */
  1551 FLAC_API FLAC__bool FLAC__stream_decoder_seek_absolute(FLAC__StreamDecoder *decoder, FLAC__uint64 sample);
  1552 
  1553 /* \} */
  1554 
  1555 #ifdef __cplusplus
  1556 }
  1557 #endif
  1558 
  1559 #endif