diff options
author | Max Kellermann <max@duempel.org> | 2009-11-11 18:08:22 +0100 |
---|---|---|
committer | Max Kellermann <max@duempel.org> | 2009-11-11 18:08:22 +0100 |
commit | 183725733a929e433c584d5c02016e0d299ced7a (patch) | |
tree | 3a30cfb22412597ed429bc02e49cee7592a630ae /src/decoder/flac_compat.h | |
parent | 3c1bacbdbc9de48575755f2fc5435afee24531cd (diff) | |
download | mpd-183725733a929e433c584d5c02016e0d299ced7a.tar.gz mpd-183725733a929e433c584d5c02016e0d299ced7a.tar.xz mpd-183725733a929e433c584d5c02016e0d299ced7a.zip |
decoder/flac: emulate FLAC__stream_decoder_init_stream()
Remove the wrapper flac_init().
Diffstat (limited to '')
-rw-r--r-- | src/decoder/flac_compat.h | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/src/decoder/flac_compat.h b/src/decoder/flac_compat.h index 785e8b293..61d2c55e8 100644 --- a/src/decoder/flac_compat.h +++ b/src/decoder/flac_compat.h @@ -67,6 +67,38 @@ typedef unsigned flac_read_status_size_t; #define FLAC__STREAM_DECODER_LENGTH_STATUS_ERROR FLAC__SEEKABLE_STREAM_DECODER_LENGTH_STATUS_ERROR #define FLAC__STREAM_DECODER_LENGTH_STATUS_UNSUPPORTED FLAC__SEEKABLE_STREAM_DECODER_LENGTH_STATUS_ERROR +typedef enum { + FLAC__STREAM_DECODER_INIT_STATUS_OK, + FLAC__STREAM_DECODER_INIT_STATUS_ERROR, +} FLAC__StreamDecoderInitStatus; + +static inline FLAC__StreamDecoderInitStatus +FLAC__stream_decoder_init_stream(FLAC__SeekableStreamDecoder *decoder, + FLAC__SeekableStreamDecoderReadCallback read_cb, + FLAC__SeekableStreamDecoderSeekCallback seek_cb, + FLAC__SeekableStreamDecoderTellCallback tell_cb, + FLAC__SeekableStreamDecoderLengthCallback length_cb, + FLAC__SeekableStreamDecoderEofCallback eof_cb, + FLAC__SeekableStreamDecoderWriteCallback write_cb, + FLAC__SeekableStreamDecoderMetadataCallback metadata_cb, + FLAC__SeekableStreamDecoderErrorCallback error_cb, + void *data) +{ + return FLAC__seekable_stream_decoder_set_read_callback(decoder, read_cb) && + FLAC__seekable_stream_decoder_set_seek_callback(decoder, seek_cb) && + FLAC__seekable_stream_decoder_set_tell_callback(decoder, tell_cb) && + FLAC__seekable_stream_decoder_set_length_callback(decoder, length_cb) && + FLAC__seekable_stream_decoder_set_eof_callback(decoder, eof_cb) && + FLAC__seekable_stream_decoder_set_write_callback(decoder, write_cb) && + FLAC__seekable_stream_decoder_set_metadata_callback(decoder, metadata_cb) && + FLAC__seekable_stream_decoder_set_metadata_respond(decoder, FLAC__METADATA_TYPE_VORBIS_COMMENT) && + FLAC__seekable_stream_decoder_set_error_callback(decoder, error_cb) && + FLAC__seekable_stream_decoder_set_client_data(decoder, data) && + FLAC__seekable_stream_decoder_init(decoder) == FLAC__SEEKABLE_STREAM_DECODER_OK + ? FLAC__STREAM_DECODER_INIT_STATUS_OK + : FLAC__STREAM_DECODER_INIT_STATUS_ERROR; +} + #else /* FLAC_API_VERSION_CURRENT > 7 */ # include <FLAC/stream_decoder.h> |