📄 stream_decoder.h
字号:
*/FLAC_API FLAC__bool FLAC__stream_decoder_set_metadata_ignore_application(FLAC__StreamDecoder *decoder, const FLAC__byte id[4]);/** Direct the decoder to filter out all metadata blocks of any type. * * \default By default, only the \c STREAMINFO block is returned via the * metadata callback. * \param decoder A decoder instance to set. * \assert * \code decoder != NULL \endcode * \retval FLAC__bool * \c false if the decoder is already initialized, else \c true. */FLAC_API FLAC__bool FLAC__stream_decoder_set_metadata_ignore_all(FLAC__StreamDecoder *decoder);/** Get the current decoder state. * * \param decoder A decoder instance to query. * \assert * \code decoder != NULL \endcode * \retval FLAC__StreamDecoderState * The current decoder state. */FLAC_API FLAC__StreamDecoderState FLAC__stream_decoder_get_state(const FLAC__StreamDecoder *decoder);/** Get the current decoder state as a C string. * * \param decoder A decoder instance to query. * \assert * \code decoder != NULL \endcode * \retval const char * * The decoder state as a C string. Do not modify the contents. */FLAC_API const char *FLAC__stream_decoder_get_resolved_state_string(const FLAC__StreamDecoder *decoder);/** Get the current number of channels in the stream being decoded. * Will only be valid after decoding has started and will contain the * value from the most recently decoded frame header. * * \param decoder A decoder instance to query. * \assert * \code decoder != NULL \endcode * \retval unsigned * See above. */FLAC_API unsigned FLAC__stream_decoder_get_channels(const FLAC__StreamDecoder *decoder);/** Get the current channel assignment in the stream being decoded. * Will only be valid after decoding has started and will contain the * value from the most recently decoded frame header. * * \param decoder A decoder instance to query. * \assert * \code decoder != NULL \endcode * \retval FLAC__ChannelAssignment * See above. */FLAC_API FLAC__ChannelAssignment FLAC__stream_decoder_get_channel_assignment(const FLAC__StreamDecoder *decoder);/** Get the current sample resolution in the stream being decoded. * Will only be valid after decoding has started and will contain the * value from the most recently decoded frame header. * * \param decoder A decoder instance to query. * \assert * \code decoder != NULL \endcode * \retval unsigned * See above. */FLAC_API unsigned FLAC__stream_decoder_get_bits_per_sample(const FLAC__StreamDecoder *decoder);/** Get the current sample rate in Hz of the stream being decoded. * Will only be valid after decoding has started and will contain the * value from the most recently decoded frame header. * * \param decoder A decoder instance to query. * \assert * \code decoder != NULL \endcode * \retval unsigned * See above. */FLAC_API unsigned FLAC__stream_decoder_get_sample_rate(const FLAC__StreamDecoder *decoder);/** Get the current blocksize of the stream being decoded. * Will only be valid after decoding has started and will contain the * value from the most recently decoded frame header. * * \param decoder A decoder instance to query. * \assert * \code decoder != NULL \endcode * \retval unsigned * See above. */FLAC_API unsigned FLAC__stream_decoder_get_blocksize(const FLAC__StreamDecoder *decoder);/** Initialize the decoder instance. * Should be called after FLAC__stream_decoder_new() and * FLAC__stream_decoder_set_*() but before any of the * FLAC__stream_decoder_process_*() functions. Will set and return the * decoder state, which will be FLAC__STREAM_DECODER_SEARCH_FOR_METADATA * if initialization succeeded. * * \param decoder An uninitialized decoder instance. * \assert * \code decoder != NULL \endcode * \retval FLAC__StreamDecoderState * \c FLAC__STREAM_DECODER_SEARCH_FOR_METADATA if initialization was * successful; see FLAC__StreamDecoderState for the meanings of other * return values. */FLAC_API FLAC__StreamDecoderState FLAC__stream_decoder_init(FLAC__StreamDecoder *decoder);/** Finish the decoding process. * Flushes the decoding buffer, releases resources, resets the decoder * settings to their defaults, and returns the decoder state to * FLAC__STREAM_DECODER_UNINITIALIZED. * * In the event of a prematurely-terminated decode, it is not strictly * necessary to call this immediately before FLAC__stream_decoder_delete() * but it is good practice to match every FLAC__stream_decoder_init() * with a FLAC__stream_decoder_finish(). * * \param decoder An uninitialized decoder instance. * \assert * \code decoder != NULL \endcode */FLAC_API void FLAC__stream_decoder_finish(FLAC__StreamDecoder *decoder);/** Flush the stream input. * The decoder's input buffer will be cleared and the state set to * \c FLAC__STREAM_DECODER_SEARCH_FOR_FRAME_SYNC. * * \param decoder A decoder instance. * \assert * \code decoder != NULL \endcode * \retval FLAC__bool * \c true if successful, else \c false if a memory allocation * error occurs. */FLAC_API FLAC__bool FLAC__stream_decoder_flush(FLAC__StreamDecoder *decoder);/** Reset the decoding process. * The decoder's input buffer will be cleared and the state set to * \c FLAC__STREAM_DECODER_SEARCH_FOR_METADATA. This is similar to * FLAC__stream_decoder_finish() except that the settings are * preserved; there is no need to call FLAC__stream_decoder_init() * before decoding again. * * \param decoder A decoder instance. * \assert * \code decoder != NULL \endcode * \retval FLAC__bool * \c true if successful, else \c false if a memory allocation * error occurs. */FLAC_API FLAC__bool FLAC__stream_decoder_reset(FLAC__StreamDecoder *decoder);/** Decode one metadata block or audio frame. * This version instructs the decoder to decode a either a single metadata * block or a single frame and stop, unless the callbacks return a fatal * error or the read callback returns * \c FLAC__STREAM_DECODER_READ_STATUS_END_OF_STREAM. * * As the decoder needs more input it will call the read callback. * Depending on what was decoded, the metadata or write callback will be * called with the decoded metadata block or audio frame, unless an error * occurred. If the decoder loses sync it will call the error callback * instead. * * Unless there is a fatal read error or end of stream, this function * will return once one whole frame is decoded. In other words, if the * stream is not synchronized or points to a corrupt frame header, the * decoder will continue to try and resync until it gets to a valid * frame, then decode one frame, then return. If the decoder points to * frame whose frame CRC in the frame footer does not match the * computed frame CRC, this function will issue a * FLAC__STREAM_DECODER_ERROR_STATUS_FRAME_CRC_MISMATCH error to the * error callback, and return, having decoded one complete, although * corrupt, frame. (Such corrupted frames are sent as silence of the * correct length to the write callback.) * * \param decoder An initialized decoder instance. * \assert * \code decoder != NULL \endcode * \retval FLAC__bool * \c false if any read or write error occurred (except * \c FLAC__STREAM_DECODER_ERROR_STATUS_LOST_SYNC), else \c true; * in any case, check the decoder state with * FLAC__stream_decoder_get_state() to see what went wrong or to * check for lost synchronization (a sign of stream corruption). */FLAC_API FLAC__bool FLAC__stream_decoder_process_single(FLAC__StreamDecoder *decoder);/** Decode until the end of the metadata. * This version instructs the decoder to decode from the current position * and continue until all the metadata has been read, or until the * callbacks return a fatal error or the read callback returns * \c FLAC__STREAM_DECODER_READ_STATUS_END_OF_STREAM. * * As the decoder needs more input it will call the read callback. * As each metadata block is decoded, the metadata callback will be called * with the decoded metadata. If the decoder loses sync it will call the * error callback. * * \param decoder An initialized decoder instance. * \assert * \code decoder != NULL \endcode * \retval FLAC__bool * \c false if any read or write error occurred (except * \c FLAC__STREAM_DECODER_ERROR_STATUS_LOST_SYNC), else \c true; * in any case, check the decoder state with * FLAC__stream_decoder_get_state() to see what went wrong or to * check for lost synchronization (a sign of stream corruption). */FLAC_API FLAC__bool FLAC__stream_decoder_process_until_end_of_metadata(FLAC__StreamDecoder *decoder);/** Decode until the end of the stream. * This version instructs the decoder to decode from the current position * and continue until the end of stream (the read callback returns * \c FLAC__STREAM_DECODER_READ_STATUS_END_OF_STREAM), or until the * callbacks return a fatal error. * * As the decoder needs more input it will call the read callback. * As each metadata block and frame is decoded, the metadata or write * callback will be called with the decoded metadata or frame. If the * decoder loses sync it will call the error callback. * * \param decoder An initialized decoder instance. * \assert * \code decoder != NULL \endcode * \retval FLAC__bool * \c false if any read or write error occurred (except * \c FLAC__STREAM_DECODER_ERROR_STATUS_LOST_SYNC), else \c true; * in any case, check the decoder state with * FLAC__stream_decoder_get_state() to see what went wrong or to * check for lost synchronization (a sign of stream corruption). */FLAC_API FLAC__bool FLAC__stream_decoder_process_until_end_of_stream(FLAC__StreamDecoder *decoder);/** Skip one audio frame. * This version instructs the decoder to 'skip' a single frame and stop, * unless the callbacks return a fatal error or the read callback returns * \c FLAC__STREAM_DECODER_READ_STATUS_END_OF_STREAM. * * The decoding flow is the same as what occurs when * FLAC__stream_decoder_process_single() is called to process an audio * frame, except that this function does not decode the parsed data into * PCM or call the write callback. The integrity of the frame is still * checked the same way as in the other process functions. * * This function will return once one whole frame is skipped, in the * same way that FLAC__stream_decoder_process_single() will return once * one whole frame is decoded. * * This function, when used from the higher FLAC__SeekableStreamDecoder * layer, can be used in more quickly determining FLAC frame boundaries * when decoding of the actual data is not needed, for example when an * application is separating a FLAC stream into frames for editing or * storing in a container. To do this, the application can use * FLAC__seekable_stream_decoder_skip_single_frame() to quickly advance * to the next frame, then use * FLAC__seekable_stream_decoder_get_decode_position() to find the new * frame boundary. * * This function should only be called when the stream has advanced * past all the metadata, otherwise it will return \c false. * * \param decoder An initialized decoder instance not in a metadata * state. * \assert * \code decoder != NULL \endcode * \retval FLAC__bool * \c false if any read or write error occurred (except * \c FLAC__STREAM_DECODER_ERROR_STATUS_LOST_SYNC), or if the decoder * is in the FLAC__STREAM_DECODER_SEARCH_FOR_METADATA or * FLAC__STREAM_DECODER_READ_METADATA state, else \c true; * in any case, check the decoder state with * FLAC__stream_decoder_get_state() to see what went wrong or to * check for lost synchronization (a sign of stream corruption). */FLAC_API FLAC__bool FLAC__stream_decoder_skip_single_frame(FLAC__StreamDecoder *decoder);/* \} */#ifdef __cplusplus}#endif#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -