Initialize the decoder instance to decode native FLAC streams.
This flavor of initialization sets up the decoder to decode from a
native FLAC stream. I/O is performed via callbacks to the client.
For decoding from a plain file via filename or open FILE*,
FLAC__stream_decoder_init_file() and FLAC__stream_decoder_init_FILE()
provide a simpler interface.
This function 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.
\param read_callback See FLAC__StreamDecoderReadCallback. This
pointer must not be \c NULL.
\param seek_callback See FLAC__StreamDecoderSeekCallback. This
pointer may be \c NULL if seeking is not
supported. If \a seek_callback is not \c NULL then a
\a tell_callback, \a length_callback, and \a eof_callback must also be supplied.
Alternatively, a dummy seek callback that just
returns \c FLAC__STREAM_DECODER_SEEK_STATUS_UNSUPPORTED
may also be supplied, all though this is slightly
less efficient for the decoder.
\param tell_callback See FLAC__StreamDecoderTellCallback. This
pointer may be \c NULL if not supported by the client. If
\a seek_callback is not \c NULL then a
\a tell_callback must also be supplied.
Alternatively, a dummy tell callback that just
returns \c FLAC__STREAM_DECODER_TELL_STATUS_UNSUPPORTED
may also be supplied, all though this is slightly
less efficient for the decoder.
\param length_callback See FLAC__StreamDecoderLengthCallback. This
pointer may be \c NULL if not supported by the client. If
\a seek_callback is not \c NULL then a
\a length_callback must also be supplied.
Alternatively, a dummy length callback that just
returns \c FLAC__STREAM_DECODER_LENGTH_STATUS_UNSUPPORTED
may also be supplied, all though this is slightly
less efficient for the decoder.
\param eof_callback See FLAC__StreamDecoderEofCallback. This
pointer may be \c NULL if not supported by the client. If
\a seek_callback is not \c NULL then a
\a eof_callback must also be supplied.
Alternatively, a dummy length callback that just
returns \c false
may also be supplied, all though this is slightly
less efficient for the decoder.
\param write_callback See FLAC__StreamDecoderWriteCallback. This
pointer must not be \c NULL.
\param metadata_callback See FLAC__StreamDecoderMetadataCallback. This
pointer may be \c NULL if the callback is not
desired.
\param error_callback See FLAC__StreamDecoderErrorCallback. This
pointer must not be \c NULL.
\param client_data This value will be supplied to callbacks in their
\a client_data argument.
\assert
\code decoder != NULL \endcode
\retval FLAC__StreamDecoderInitStatus
\c FLAC__STREAM_DECODER_INIT_STATUS_OK if initialization was successful;
see FLAC__StreamDecoderInitStatus for the meanings of other return values.
Initialize the decoder instance to decode native FLAC streams.
This flavor of initialization sets up the decoder to decode from a native FLAC stream. I/O is performed via callbacks to the client. For decoding from a plain file via filename or open FILE*, FLAC__stream_decoder_init_file() and FLAC__stream_decoder_init_FILE() provide a simpler interface.
This function 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. \param read_callback See FLAC__StreamDecoderReadCallback. This pointer must not be \c NULL. \param seek_callback See FLAC__StreamDecoderSeekCallback. This pointer may be \c NULL if seeking is not supported. If \a seek_callback is not \c NULL then a \a tell_callback, \a length_callback, and \a eof_callback must also be supplied. Alternatively, a dummy seek callback that just returns \c FLAC__STREAM_DECODER_SEEK_STATUS_UNSUPPORTED may also be supplied, all though this is slightly less efficient for the decoder. \param tell_callback See FLAC__StreamDecoderTellCallback. This pointer may be \c NULL if not supported by the client. If \a seek_callback is not \c NULL then a \a tell_callback must also be supplied. Alternatively, a dummy tell callback that just returns \c FLAC__STREAM_DECODER_TELL_STATUS_UNSUPPORTED may also be supplied, all though this is slightly less efficient for the decoder. \param length_callback See FLAC__StreamDecoderLengthCallback. This pointer may be \c NULL if not supported by the client. If \a seek_callback is not \c NULL then a \a length_callback must also be supplied. Alternatively, a dummy length callback that just returns \c FLAC__STREAM_DECODER_LENGTH_STATUS_UNSUPPORTED may also be supplied, all though this is slightly less efficient for the decoder. \param eof_callback See FLAC__StreamDecoderEofCallback. This pointer may be \c NULL if not supported by the client. If \a seek_callback is not \c NULL then a \a eof_callback must also be supplied. Alternatively, a dummy length callback that just returns \c false may also be supplied, all though this is slightly less efficient for the decoder. \param write_callback See FLAC__StreamDecoderWriteCallback. This pointer must not be \c NULL. \param metadata_callback See FLAC__StreamDecoderMetadataCallback. This pointer may be \c NULL if the callback is not desired. \param error_callback See FLAC__StreamDecoderErrorCallback. This pointer must not be \c NULL. \param client_data This value will be supplied to callbacks in their \a client_data argument. \assert \code decoder != NULL \endcode \retval FLAC__StreamDecoderInitStatus \c FLAC__STREAM_DECODER_INIT_STATUS_OK if initialization was successful; see FLAC__StreamDecoderInitStatus for the meanings of other return values.