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