View | Details | Raw Unified
Collapse All | Expand All

(-) scummvm-0.9.0/configure (-5 / +5 lines)
 Lines 1076-1090    Link Here 
if test "$_flac" = auto ; then
if test "$_flac" = auto ; then
	_flac=no
	_flac=no
	cat > $TMPC << EOF
	cat > $TMPC << EOF
#include <FLAC/seekable_stream_decoder.h>
#include <FLAC/format.h>
int main(void) { FLAC__seekable_stream_decoder_init( 0 ); return 0; }
int main(void) { return FLAC__STREAM_SYNC_LEN >> 30; /* guaranteed to be 0 */ }
EOF
EOF
	cc_check $LDFLAGS $CXXFLAGS $FLAC_CFLAGS $FLAC_LIBS \
	cc_check $LDFLAGS $CXXFLAGS $FLAC_CFLAGS $FLAC_LIBS $OGG_CFLAGS $OGG_LIBS \
	-lFLAC -lm && _flac=yes
	-lFLAC -logg -lm && _flac=yes
fi
fi
if test "$_flac" = yes ; then
if test "$_flac" = yes ; then
	_def_flac='#define USE_FLAC'
	_def_flac='#define USE_FLAC'
	LIBS="$LIBS $FLAC_LIBS -lFLAC"
	LIBS="$LIBS $FLAC_LIBS $OGG_LIBS -lFLAC -logg"
	INCLUDES="$INCLUDES $FLAC_CFLAGS"
	INCLUDES="$INCLUDES $FLAC_CFLAGS"
else
else
	_def_flac='#undef USE_FLAC'
	_def_flac='#undef USE_FLAC'
(-) scummvm-0.9.0/sound/flac.cpp (-16 / +210 lines)
 Lines 31-37    Link Here 
#include "sound/audiocd.h"
#include "sound/audiocd.h"
#define FLAC__NO_DLL // that MS-magic gave me headaches - just link the library you like
#define FLAC__NO_DLL // that MS-magic gave me headaches - just link the library you like
#include <FLAC/export.h>
// check if we have FLAC >= 1.1.3; LEGACY_FLAC code can be removed once FLAC-1.1.3 propagates everywhere
#if !defined(FLAC_API_VERSION_CURRENT) || FLAC_API_VERSION_CURRENT < 8
#define LEGACY_FLAC
#else
#undef LEGACY_FLAC
#endif
#ifdef LEGACY_FLAC
#include <FLAC/seekable_stream_decoder.h>
#include <FLAC/seekable_stream_decoder.h>
#else
#include <FLAC/stream_decoder.h>
#endif
using Common::File;
using Common::File;
 Lines 67-73    Link Here 
	const FLAC__StreamMetadata_StreamInfo& getStreamInfo() const {return _streaminfo;}
	const FLAC__StreamMetadata_StreamInfo& getStreamInfo() const {return _streaminfo;}
#ifdef LEGACY_FLAC
	inline FLAC__SeekableStreamDecoderState getState() const;
	inline FLAC__SeekableStreamDecoderState getState() const;
#else
	inline FLAC__StreamDecoderState getState() const;
#endif
	inline FLAC__StreamDecoderState getStreamDecoderState() const;
	inline FLAC__StreamDecoderState getStreamDecoderState() const;
 Lines 81-98    Link Here 
	inline void setLastSample(FLAC__uint64 absoluteSample);
	inline void setLastSample(FLAC__uint64 absoluteSample);
protected:
protected:
#ifdef LEGACY_FLAC
	inline ::FLAC__SeekableStreamDecoderReadStatus callbackRead(FLAC__byte buffer[], uint *bytes);
	inline ::FLAC__SeekableStreamDecoderReadStatus callbackRead(FLAC__byte buffer[], uint *bytes);
	inline ::FLAC__SeekableStreamDecoderSeekStatus callbackSeek(FLAC__uint64 absoluteByteOffset);
	inline ::FLAC__SeekableStreamDecoderSeekStatus callbackSeek(FLAC__uint64 absoluteByteOffset);
	inline ::FLAC__SeekableStreamDecoderTellStatus callbackTell(FLAC__uint64 *absoluteByteOffset);
	inline ::FLAC__SeekableStreamDecoderTellStatus callbackTell(FLAC__uint64 *absoluteByteOffset);
	inline ::FLAC__SeekableStreamDecoderLengthStatus callbackLength(FLAC__uint64 *streamLength);
	inline ::FLAC__SeekableStreamDecoderLengthStatus callbackLength(FLAC__uint64 *streamLength);
#else
	inline ::FLAC__StreamDecoderReadStatus callbackRead(FLAC__byte buffer[], size_t *bytes);
	inline ::FLAC__StreamDecoderSeekStatus callbackSeek(FLAC__uint64 absoluteByteOffset);
	inline ::FLAC__StreamDecoderTellStatus callbackTell(FLAC__uint64 *absoluteByteOffset);
	inline ::FLAC__StreamDecoderLengthStatus callbackLength(FLAC__uint64 *streamLength);
#endif
	inline bool callbackEOF();
	inline bool callbackEOF();
	inline ::FLAC__StreamDecoderWriteStatus callbackWrite(const ::FLAC__Frame *frame, const FLAC__int32 * const buffer[]);
	inline ::FLAC__StreamDecoderWriteStatus callbackWrite(const ::FLAC__Frame *frame, const FLAC__int32 * const buffer[]);
	inline void callbackMetadata(const ::FLAC__StreamMetadata *metadata);
	inline void callbackMetadata(const ::FLAC__StreamMetadata *metadata);
	inline void callbackError(::FLAC__StreamDecoderErrorStatus status);
	inline void callbackError(::FLAC__StreamDecoderErrorStatus status);
#ifdef LEGACY_FLAC
	::FLAC__SeekableStreamDecoder *_decoder;
	::FLAC__SeekableStreamDecoder *_decoder;
#else
	::FLAC__StreamDecoder *_decoder;
#endif
private:
private:
#ifdef LEGACY_FLAC
	static ::FLAC__SeekableStreamDecoderReadStatus callWrapRead(const ::FLAC__SeekableStreamDecoder *decoder, FLAC__byte buffer[], uint *bytes, void *clientData);
	static ::FLAC__SeekableStreamDecoderReadStatus callWrapRead(const ::FLAC__SeekableStreamDecoder *decoder, FLAC__byte buffer[], uint *bytes, void *clientData);
	static ::FLAC__SeekableStreamDecoderSeekStatus callWrapSeek(const ::FLAC__SeekableStreamDecoder *decoder, FLAC__uint64 absoluteByteOffset, void *clientData);
	static ::FLAC__SeekableStreamDecoderSeekStatus callWrapSeek(const ::FLAC__SeekableStreamDecoder *decoder, FLAC__uint64 absoluteByteOffset, void *clientData);
	static ::FLAC__SeekableStreamDecoderTellStatus callWrapTell(const ::FLAC__SeekableStreamDecoder *decoder, FLAC__uint64 *absoluteByteOffset, void *clientData);
	static ::FLAC__SeekableStreamDecoderTellStatus callWrapTell(const ::FLAC__SeekableStreamDecoder *decoder, FLAC__uint64 *absoluteByteOffset, void *clientData);
 Lines 101-106    Link Here 
	static ::FLAC__StreamDecoderWriteStatus callWrapWrite(const ::FLAC__SeekableStreamDecoder *decoder, const ::FLAC__Frame *frame, const FLAC__int32 * const buffer[], void *clientData);
	static ::FLAC__StreamDecoderWriteStatus callWrapWrite(const ::FLAC__SeekableStreamDecoder *decoder, const ::FLAC__Frame *frame, const FLAC__int32 * const buffer[], void *clientData);
	static void callWrapMetadata(const ::FLAC__SeekableStreamDecoder *decoder, const ::FLAC__StreamMetadata *metadata, void *clientData);
	static void callWrapMetadata(const ::FLAC__SeekableStreamDecoder *decoder, const ::FLAC__StreamMetadata *metadata, void *clientData);
	static void callWrapError(const ::FLAC__SeekableStreamDecoder *decoder, ::FLAC__StreamDecoderErrorStatus status, void *clientData);
	static void callWrapError(const ::FLAC__SeekableStreamDecoder *decoder, ::FLAC__StreamDecoderErrorStatus status, void *clientData);
#else
	static ::FLAC__StreamDecoderReadStatus callWrapRead(const ::FLAC__StreamDecoder *decoder, FLAC__byte buffer[], size_t *bytes, void *clientData);
	static ::FLAC__StreamDecoderSeekStatus callWrapSeek(const ::FLAC__StreamDecoder *decoder, FLAC__uint64 absoluteByteOffset, void *clientData);
	static ::FLAC__StreamDecoderTellStatus callWrapTell(const ::FLAC__StreamDecoder *decoder, FLAC__uint64 *absoluteByteOffset, void *clientData);
	static ::FLAC__StreamDecoderLengthStatus callWrapLength(const ::FLAC__StreamDecoder *decoder, FLAC__uint64 *streamLength, void *clientData);
	static FLAC__bool callWrapEOF(const ::FLAC__StreamDecoder *decoder, void *clientData);
	static ::FLAC__StreamDecoderWriteStatus callWrapWrite(const ::FLAC__StreamDecoder *decoder, const ::FLAC__Frame *frame, const FLAC__int32 * const buffer[], void *clientData);
	static void callWrapMetadata(const ::FLAC__StreamDecoder *decoder, const ::FLAC__StreamMetadata *metadata, void *clientData);
	static void callWrapError(const ::FLAC__StreamDecoder *decoder, ::FLAC__StreamDecoderErrorStatus status, void *clientData);
#endif
	// Private and undefined so you can't use them:
	// Private and undefined so you can't use them:
	FlacInputStream(const FlacInputStream &);
	FlacInputStream(const FlacInputStream &);
	void operator=(const FlacInputStream &);
	void operator=(const FlacInputStream &);
 Lines 157-163    Link Here 
};
};
FlacInputStream::FlacInputStream(File *sourceFile, const uint32 fileStart)
FlacInputStream::FlacInputStream(File *sourceFile, const uint32 fileStart)
			:	_decoder(::FLAC__seekable_stream_decoder_new()), _firstSample(0), _lastSample(0),
#ifdef LEGACY_FLAC
			:	_decoder(::FLAC__seekable_stream_decoder_new()),
#else
			:	_decoder(::FLAC__stream_decoder_new()),
#endif
				_firstSample(0), _lastSample(0),
				_outBuffer(NULL), _requestedSamples(0), _lastSampleWritten(true),
				_outBuffer(NULL), _requestedSamples(0), _lastSampleWritten(true),
				_methodConvertBuffers(&FlacInputStream::convertBuffersGeneric)
				_methodConvertBuffers(&FlacInputStream::convertBuffersGeneric)
{
{
 Lines 178-184    Link Here 
}
}
FlacInputStream::FlacInputStream(File *sourceFile, const uint32 fileStart, const uint32 fileStop)
FlacInputStream::FlacInputStream(File *sourceFile, const uint32 fileStart, const uint32 fileStop)
			:	_decoder(::FLAC__seekable_stream_decoder_new()), _firstSample(0), _lastSample(0),
#ifdef LEGACY_FLAC
			:	_decoder(::FLAC__seekable_stream_decoder_new()),
#else
			:	_decoder(::FLAC__stream_decoder_new()),
#endif
				_firstSample(0), _lastSample(0),
				_outBuffer(NULL), _requestedSamples(0), _lastSampleWritten(true),
				_outBuffer(NULL), _requestedSamples(0), _lastSampleWritten(true),
				_methodConvertBuffers(&FlacInputStream::convertBuffersGeneric)
				_methodConvertBuffers(&FlacInputStream::convertBuffersGeneric)
{
{
 Lines 201-208    Link Here 
FlacInputStream::~FlacInputStream() {
FlacInputStream::~FlacInputStream() {
	if (_decoder != NULL) {
	if (_decoder != NULL) {
#ifdef LEGACY_FLAC
		(void) ::FLAC__seekable_stream_decoder_finish(_decoder);
		(void) ::FLAC__seekable_stream_decoder_finish(_decoder);
		::FLAC__seekable_stream_decoder_delete(_decoder);
		::FLAC__seekable_stream_decoder_delete(_decoder);
#else
		(void) ::FLAC__stream_decoder_finish(_decoder);
		::FLAC__stream_decoder_delete(_decoder);
#endif
	}
	}
	if (_preBuffer.bufData != NULL)
	if (_preBuffer.bufData != NULL)
		delete[] _preBuffer.bufData;
		delete[] _preBuffer.bufData;
 Lines 210-223    Link Here 
	_fileInfo.fileHandle->decRef();
	_fileInfo.fileHandle->decRef();
}
}
inline FLAC__SeekableStreamDecoderState FlacInputStream::getState() const {
#ifdef LEGACY_FLAC
inline FLAC__SeekableStreamDecoderState FlacInputStream::getState() const
#else
inline FLAC__StreamDecoderState FlacInputStream::getState() const
#endif
{
	assert(isValid());
	assert(isValid());
#ifdef LEGACY_FLAC
	return ::FLAC__seekable_stream_decoder_get_state(_decoder);
	return ::FLAC__seekable_stream_decoder_get_state(_decoder);
#else
	return ::FLAC__stream_decoder_get_state(_decoder);
#endif
}
}
inline FLAC__StreamDecoderState FlacInputStream::getStreamDecoderState() const {
inline FLAC__StreamDecoderState FlacInputStream::getStreamDecoderState() const {
	assert(isValid());
	assert(isValid());
#ifdef LEGACY_FLAC
	return ::FLAC__seekable_stream_decoder_get_stream_decoder_state(_decoder);
	return ::FLAC__seekable_stream_decoder_get_stream_decoder_state(_decoder);
#else
	return ::FLAC__stream_decoder_get_state(_decoder);
#endif
}
}
bool FlacInputStream::init() {
bool FlacInputStream::init() {
 Lines 229-234    Link Here 
	_lastSampleWritten = false;
	_lastSampleWritten = false;
	_methodConvertBuffers = &FlacInputStream::convertBuffersGeneric;
	_methodConvertBuffers = &FlacInputStream::convertBuffersGeneric;
#ifdef LEGACY_FLAC
	::FLAC__seekable_stream_decoder_set_read_callback(_decoder, &FlacInputStream::callWrapRead);
	::FLAC__seekable_stream_decoder_set_read_callback(_decoder, &FlacInputStream::callWrapRead);
	::FLAC__seekable_stream_decoder_set_seek_callback(_decoder, &FlacInputStream::callWrapSeek);
	::FLAC__seekable_stream_decoder_set_seek_callback(_decoder, &FlacInputStream::callWrapSeek);
	::FLAC__seekable_stream_decoder_set_tell_callback(_decoder, &FlacInputStream::callWrapTell);
	::FLAC__seekable_stream_decoder_set_tell_callback(_decoder, &FlacInputStream::callWrapTell);
 Lines 247-252    Link Here 
			}
			}
		}
		}
	}
	}
#else
	if (::FLAC__stream_decoder_init_stream(
		_decoder,
		&FlacInputStream::callWrapRead, 
		&FlacInputStream::callWrapSeek, 
		&FlacInputStream::callWrapTell, 
		&FlacInputStream::callWrapLength, 
		&FlacInputStream::callWrapEOF, 
		&FlacInputStream::callWrapWrite, 
		&FlacInputStream::callWrapMetadata, 
		&FlacInputStream::callWrapError, 
		(void*)this
	) == FLAC__STREAM_DECODER_INIT_STATUS_OK) {
		if (processUntilEndOfMetadata() && _streaminfo.channels > 0) {
			if (_firstSample == 0 || 0 != ::FLAC__stream_decoder_seek_absolute(_decoder, _firstSample)) {
				// FLAC__StreamDecoderState state = getStreamDecoderState();
				return true; // no error occured
			}
		}
	}
#endif
	warning("FlacInputStream: could not create an Audiostream from File %s", _fileInfo.fileHandle->name());
	warning("FlacInputStream: could not create an Audiostream from File %s", _fileInfo.fileHandle->name());
	return false;
	return false;
 Lines 255-282    Link Here 
bool FlacInputStream::finish() {
bool FlacInputStream::finish() {
	assert(isValid());
	assert(isValid());
	deleteBuffer();
	deleteBuffer();
#ifdef LEGACY_FLAC
	return 0 != ::FLAC__seekable_stream_decoder_finish(_decoder);
	return 0 != ::FLAC__seekable_stream_decoder_finish(_decoder);
#else
	return 0 != ::FLAC__stream_decoder_finish(_decoder);
#endif
}
}
bool FlacInputStream::flush() {
bool FlacInputStream::flush() {
	assert(isValid());
	assert(isValid());
	flushBuffer();
	flushBuffer();
#ifdef LEGACY_FLAC
	return 0 != ::FLAC__seekable_stream_decoder_flush(_decoder);
	return 0 != ::FLAC__seekable_stream_decoder_flush(_decoder);
#else
	return 0 != ::FLAC__stream_decoder_flush(_decoder);
#endif
}
}
inline bool FlacInputStream::processSingleBlock() {
inline bool FlacInputStream::processSingleBlock() {
	assert(isValid());
	assert(isValid());
#ifdef LEGACY_FLAC
	return 0 != ::FLAC__seekable_stream_decoder_process_single(_decoder);
	return 0 != ::FLAC__seekable_stream_decoder_process_single(_decoder);
#else
	return 0 != ::FLAC__stream_decoder_process_single(_decoder);
#endif
}
}
inline bool FlacInputStream::processUntilEndOfMetadata() {
inline bool FlacInputStream::processUntilEndOfMetadata() {
	assert(isValid());
	assert(isValid());
#ifdef LEGACY_FLAC
	return 0 != ::FLAC__seekable_stream_decoder_process_until_end_of_metadata(_decoder);
	return 0 != ::FLAC__seekable_stream_decoder_process_until_end_of_metadata(_decoder);
#else
	return 0 != ::FLAC__stream_decoder_process_until_end_of_metadata(_decoder);
#endif
}
}
bool FlacInputStream::seekAbsolute(FLAC__uint64 sample) {
bool FlacInputStream::seekAbsolute(FLAC__uint64 sample) {
	assert(isValid());
	assert(isValid());
#ifdef LEGACY_FLAC
	const bool result = (0 != ::FLAC__seekable_stream_decoder_seek_absolute(_decoder, sample));
	const bool result = (0 != ::FLAC__seekable_stream_decoder_seek_absolute(_decoder, sample));
#else
	const bool result = (0 != ::FLAC__stream_decoder_seek_absolute(_decoder, sample));
#endif
	if (result) {
	if (result) {
		flushBuffer();
		flushBuffer();
		_lastSampleWritten = (_lastSample != 0 && sample >= _lastSample); // only set if we are SURE
		_lastSampleWritten = (_lastSample != 0 && sample >= _lastSample); // only set if we are SURE
 Lines 349-359    Link Here 
	return decoderOk ? samples : -1;
	return decoderOk ? samples : -1;
}
}
inline ::FLAC__SeekableStreamDecoderReadStatus FlacInputStream::callbackRead(FLAC__byte buffer[], uint *bytes) {
#ifdef LEGACY_FLAC
inline ::FLAC__SeekableStreamDecoderReadStatus FlacInputStream::callbackRead(FLAC__byte buffer[], uint *bytes)
#else
inline ::FLAC__StreamDecoderReadStatus FlacInputStream::callbackRead(FLAC__byte buffer[], size_t *bytes)
#endif
{
	assert(_fileInfo.fileHandle != NULL);
	assert(_fileInfo.fileHandle != NULL);
	if (*bytes == 0)
	if (*bytes == 0)
#ifdef LEGACY_FLAC
		return FLAC__SEEKABLE_STREAM_DECODER_READ_STATUS_ERROR; /* abort to avoid a deadlock */
		return FLAC__SEEKABLE_STREAM_DECODER_READ_STATUS_ERROR; /* abort to avoid a deadlock */
#else
		return FLAC__STREAM_DECODER_READ_STATUS_ABORT; /* abort to avoid a deadlock */
#endif
	const uint32 length = MIN(_fileInfo.fileEndPos - _fileInfo.filePos, static_cast<uint32>(*bytes));
	const uint32 length = MIN(_fileInfo.fileEndPos - _fileInfo.filePos, static_cast<uint32>(*bytes));
 Lines 361-371    Link Here 
	const uint32 bytesRead = _fileInfo.fileHandle->read(buffer, length);
	const uint32 bytesRead = _fileInfo.fileHandle->read(buffer, length);
	if (bytesRead == 0 && _fileInfo.fileHandle->ioFailed())
	if (bytesRead == 0 && _fileInfo.fileHandle->ioFailed())
#ifdef LEGACY_FLAC
		return FLAC__SEEKABLE_STREAM_DECODER_READ_STATUS_ERROR;
		return FLAC__SEEKABLE_STREAM_DECODER_READ_STATUS_ERROR;
#else
		return FLAC__STREAM_DECODER_READ_STATUS_ABORT;
#endif
	_fileInfo.filePos += bytesRead;
	_fileInfo.filePos += bytesRead;
	*bytes = static_cast<uint>(bytesRead);
	*bytes = static_cast<uint>(bytesRead);
#ifdef LEGACY_FLAC
	return FLAC__SEEKABLE_STREAM_DECODER_READ_STATUS_OK;
	return FLAC__SEEKABLE_STREAM_DECODER_READ_STATUS_OK;
#else
	return FLAC__STREAM_DECODER_READ_STATUS_CONTINUE;
#endif
}
}
inline void FlacInputStream::setLastSample(FLAC__uint64 absoluteSample) {
inline void FlacInputStream::setLastSample(FLAC__uint64 absoluteSample) {
 Lines 637-666    Link Here 
	return FLAC__STREAM_DECODER_WRITE_STATUS_CONTINUE;
	return FLAC__STREAM_DECODER_WRITE_STATUS_CONTINUE;
}
}
inline ::FLAC__SeekableStreamDecoderSeekStatus FlacInputStream::callbackSeek(FLAC__uint64 absoluteByteOffset) {
#ifdef LEGACY_FLAC
inline ::FLAC__SeekableStreamDecoderSeekStatus FlacInputStream::callbackSeek(FLAC__uint64 absoluteByteOffset)
#else
inline ::FLAC__StreamDecoderSeekStatus FlacInputStream::callbackSeek(FLAC__uint64 absoluteByteOffset)
#endif
{
    FLAC__uint64 newPos = absoluteByteOffset + _fileInfo.fileStartPos;
    FLAC__uint64 newPos = absoluteByteOffset + _fileInfo.fileStartPos;
	const bool result = (newPos < _fileInfo.fileEndPos);
	const bool result = (newPos < _fileInfo.fileEndPos);
	if (result)
	if (result)
		_fileInfo.filePos = static_cast<uint32>(newPos);
		_fileInfo.filePos = static_cast<uint32>(newPos);
#ifdef LEGACY_FLAC
	return result ? FLAC__SEEKABLE_STREAM_DECODER_SEEK_STATUS_OK : FLAC__SEEKABLE_STREAM_DECODER_SEEK_STATUS_ERROR;
	return result ? FLAC__SEEKABLE_STREAM_DECODER_SEEK_STATUS_OK : FLAC__SEEKABLE_STREAM_DECODER_SEEK_STATUS_ERROR;
#else
	return result ? FLAC__STREAM_DECODER_SEEK_STATUS_OK : FLAC__STREAM_DECODER_SEEK_STATUS_ERROR;
#endif
}
}
inline ::FLAC__SeekableStreamDecoderTellStatus FlacInputStream::callbackTell(FLAC__uint64 *absoluteByteOffset) {
#ifdef LEGACY_FLAC
inline ::FLAC__SeekableStreamDecoderTellStatus FlacInputStream::callbackTell(FLAC__uint64 *absoluteByteOffset)
#else
inline ::FLAC__StreamDecoderTellStatus FlacInputStream::callbackTell(FLAC__uint64 *absoluteByteOffset)
#endif
{
	/*if ()
	/*if ()
		return FLAC__SEEKABLE_STREAM_DECODER_TELL_STATUS_ERROR;*/
		return FLAC__SEEKABLE_STREAM_DECODER_TELL_STATUS_ERROR;*/
	*absoluteByteOffset = static_cast<FLAC__uint64>(_fileInfo.filePos-_fileInfo.fileStartPos);
	*absoluteByteOffset = static_cast<FLAC__uint64>(_fileInfo.filePos-_fileInfo.fileStartPos);
#ifdef LEGACY_FLAC
	return FLAC__SEEKABLE_STREAM_DECODER_TELL_STATUS_OK;
	return FLAC__SEEKABLE_STREAM_DECODER_TELL_STATUS_OK;
#else
	return FLAC__STREAM_DECODER_TELL_STATUS_OK;
#endif
}
}
inline ::FLAC__SeekableStreamDecoderLengthStatus FlacInputStream::callbackLength(FLAC__uint64 *streamLength) {
#ifdef LEGACY_FLAC
inline ::FLAC__SeekableStreamDecoderLengthStatus FlacInputStream::callbackLength(FLAC__uint64 *streamLength)
#else
inline ::FLAC__StreamDecoderLengthStatus FlacInputStream::callbackLength(FLAC__uint64 *streamLength)
#endif
{
	if (_fileInfo.fileStartPos > _fileInfo.fileEndPos)
	if (_fileInfo.fileStartPos > _fileInfo.fileEndPos)
#ifdef LEGACY_FLAC
		return FLAC__SEEKABLE_STREAM_DECODER_LENGTH_STATUS_ERROR;
		return FLAC__SEEKABLE_STREAM_DECODER_LENGTH_STATUS_ERROR;
#else
		return FLAC__STREAM_DECODER_LENGTH_STATUS_ERROR;
#endif
	*streamLength = static_cast<FLAC__uint64>(_fileInfo.fileEndPos - _fileInfo.fileStartPos);
	*streamLength = static_cast<FLAC__uint64>(_fileInfo.fileEndPos - _fileInfo.fileStartPos);
#ifdef LEGACY_FLAC
	return FLAC__SEEKABLE_STREAM_DECODER_LENGTH_STATUS_OK;
	return FLAC__SEEKABLE_STREAM_DECODER_LENGTH_STATUS_OK;
#else
	return FLAC__STREAM_DECODER_LENGTH_STATUS_OK;
#endif
}
}
inline bool FlacInputStream::callbackEOF() {
inline bool FlacInputStream::callbackEOF() {
 Lines 682-737    Link Here 
}
}
/* Static Callback Wrappers */
/* Static Callback Wrappers */
::FLAC__SeekableStreamDecoderReadStatus FlacInputStream::callWrapRead(const ::FLAC__SeekableStreamDecoder *decoder, FLAC__byte buffer[], uint *bytes, void *clientData) {
#ifdef LEGACY_FLAC
::FLAC__SeekableStreamDecoderReadStatus FlacInputStream::callWrapRead(const ::FLAC__SeekableStreamDecoder *decoder, FLAC__byte buffer[], uint *bytes, void *clientData)
#else
::FLAC__StreamDecoderReadStatus FlacInputStream::callWrapRead(const ::FLAC__StreamDecoder *decoder, FLAC__byte buffer[], size_t *bytes, void *clientData)
#endif
{
	assert(0 != clientData);
	assert(0 != clientData);
	FlacInputStream *instance = reinterpret_cast<FlacInputStream *>(clientData);
	FlacInputStream *instance = reinterpret_cast<FlacInputStream *>(clientData);
	assert(0 != instance);
	assert(0 != instance);
	return instance->callbackRead(buffer, bytes);
	return instance->callbackRead(buffer, bytes);
}
}
::FLAC__SeekableStreamDecoderSeekStatus FlacInputStream::callWrapSeek(const ::FLAC__SeekableStreamDecoder *decoder, FLAC__uint64 absoluteByteOffset, void *clientData) {
#ifdef LEGACY_FLAC
::FLAC__SeekableStreamDecoderSeekStatus FlacInputStream::callWrapSeek(const ::FLAC__SeekableStreamDecoder *decoder, FLAC__uint64 absoluteByteOffset, void *clientData)
#else
::FLAC__StreamDecoderSeekStatus FlacInputStream::callWrapSeek(const ::FLAC__StreamDecoder *decoder, FLAC__uint64 absoluteByteOffset, void *clientData)
#endif
{
	assert(0 != clientData);
	assert(0 != clientData);
	FlacInputStream *instance = reinterpret_cast<FlacInputStream *>(clientData);
	FlacInputStream *instance = reinterpret_cast<FlacInputStream *>(clientData);
	assert(0 != instance);
	assert(0 != instance);
	return instance->callbackSeek(absoluteByteOffset);
	return instance->callbackSeek(absoluteByteOffset);
}
}
::FLAC__SeekableStreamDecoderTellStatus FlacInputStream::callWrapTell(const ::FLAC__SeekableStreamDecoder *decoder, FLAC__uint64 *absoluteByteOffset, void *clientData) {
#ifdef LEGACY_FLAC
::FLAC__SeekableStreamDecoderTellStatus FlacInputStream::callWrapTell(const ::FLAC__SeekableStreamDecoder *decoder, FLAC__uint64 *absoluteByteOffset, void *clientData)
#else
::FLAC__StreamDecoderTellStatus FlacInputStream::callWrapTell(const ::FLAC__StreamDecoder *decoder, FLAC__uint64 *absoluteByteOffset, void *clientData)
#endif
{
	assert(0 != clientData);
	assert(0 != clientData);
	FlacInputStream *instance = reinterpret_cast<FlacInputStream *>(clientData);
	FlacInputStream *instance = reinterpret_cast<FlacInputStream *>(clientData);
	assert(0 != instance);
	assert(0 != instance);
	return instance->callbackTell(absoluteByteOffset);
	return instance->callbackTell(absoluteByteOffset);
}
}
::FLAC__SeekableStreamDecoderLengthStatus FlacInputStream::callWrapLength(const ::FLAC__SeekableStreamDecoder *decoder, FLAC__uint64 *streamLength, void *clientData) {
#ifdef LEGACY_FLAC
::FLAC__SeekableStreamDecoderLengthStatus FlacInputStream::callWrapLength(const ::FLAC__SeekableStreamDecoder *decoder, FLAC__uint64 *streamLength, void *clientData)
#else
::FLAC__StreamDecoderLengthStatus FlacInputStream::callWrapLength(const ::FLAC__StreamDecoder *decoder, FLAC__uint64 *streamLength, void *clientData)
#endif
{
	assert(0 != clientData);
	assert(0 != clientData);
	FlacInputStream *instance = reinterpret_cast<FlacInputStream *>(clientData);
	FlacInputStream *instance = reinterpret_cast<FlacInputStream *>(clientData);
	assert(0 != instance);
	assert(0 != instance);
	return instance->callbackLength(streamLength);
	return instance->callbackLength(streamLength);
}
}
FLAC__bool FlacInputStream::callWrapEOF(const ::FLAC__SeekableStreamDecoder *decoder, void *clientData) {
#ifdef LEGACY_FLAC
FLAC__bool FlacInputStream::callWrapEOF(const ::FLAC__SeekableStreamDecoder *decoder, void *clientData)
#else
FLAC__bool FlacInputStream::callWrapEOF(const ::FLAC__StreamDecoder *decoder, void *clientData)
#endif
{
	assert(0 != clientData);
	assert(0 != clientData);
	FlacInputStream *instance = reinterpret_cast<FlacInputStream *>(clientData);
	FlacInputStream *instance = reinterpret_cast<FlacInputStream *>(clientData);
	assert(0 != instance);
	assert(0 != instance);
	return instance->callbackEOF();
	return instance->callbackEOF();
}
}
::FLAC__StreamDecoderWriteStatus FlacInputStream::callWrapWrite(const ::FLAC__SeekableStreamDecoder *decoder, const ::FLAC__Frame *frame, const FLAC__int32 * const buffer[], void *clientData) {
#ifdef LEGACY_FLAC
::FLAC__StreamDecoderWriteStatus FlacInputStream::callWrapWrite(const ::FLAC__SeekableStreamDecoder *decoder, const ::FLAC__Frame *frame, const FLAC__int32 * const buffer[], void *clientData)
#else
::FLAC__StreamDecoderWriteStatus FlacInputStream::callWrapWrite(const ::FLAC__StreamDecoder *decoder, const ::FLAC__Frame *frame, const FLAC__int32 * const buffer[], void *clientData)
#endif
{
	assert(0 != clientData);
	assert(0 != clientData);
	FlacInputStream *instance = reinterpret_cast<FlacInputStream *>(clientData);
	FlacInputStream *instance = reinterpret_cast<FlacInputStream *>(clientData);
	assert(0 != instance);
	assert(0 != instance);
	return instance->callbackWrite(frame, buffer);
	return instance->callbackWrite(frame, buffer);
}
}
void FlacInputStream::callWrapMetadata(const ::FLAC__SeekableStreamDecoder *decoder, const ::FLAC__StreamMetadata *metadata, void *clientData) {
#ifdef LEGACY_FLAC
void FlacInputStream::callWrapMetadata(const ::FLAC__SeekableStreamDecoder *decoder, const ::FLAC__StreamMetadata *metadata, void *clientData)
#else
void FlacInputStream::callWrapMetadata(const ::FLAC__StreamDecoder *decoder, const ::FLAC__StreamMetadata *metadata, void *clientData)
#endif
{
	assert(0 != clientData);
	assert(0 != clientData);
	FlacInputStream *instance = reinterpret_cast<FlacInputStream *>(clientData);
	FlacInputStream *instance = reinterpret_cast<FlacInputStream *>(clientData);
	assert(0 != instance);
	assert(0 != instance);
	instance->callbackMetadata(metadata);
	instance->callbackMetadata(metadata);
}
}
void FlacInputStream::callWrapError(const ::FLAC__SeekableStreamDecoder *decoder, ::FLAC__StreamDecoderErrorStatus status, void *clientData) {
#ifdef LEGACY_FLAC
void FlacInputStream::callWrapError(const ::FLAC__SeekableStreamDecoder *decoder, ::FLAC__StreamDecoderErrorStatus status, void *clientData)
#else
void FlacInputStream::callWrapError(const ::FLAC__StreamDecoder *decoder, ::FLAC__StreamDecoderErrorStatus status, void *clientData)
#endif
{
	assert(0 != clientData);
	assert(0 != clientData);
	FlacInputStream *instance = reinterpret_cast<FlacInputStream *>(clientData);
	FlacInputStream *instance = reinterpret_cast<FlacInputStream *>(clientData);
	assert(0 != instance);
	assert(0 != instance);