diff -urN k3b-0.12.17.orig/configure.in k3b-0.12.17/configure.in --- k3b-0.12.17.orig/configure.in 2006-08-23 10:45:55 +0300 +++ k3b-0.12.17/configure.in 2007-02-26 02:48:33 +0200 @@ -313,7 +313,7 @@ have_flac=no if test "$ac_cv_use_flac" = "yes"; then KDE_CHECK_HEADERS(FLAC++/decoder.h, [ - AC_CHECK_LIB(FLAC,FLAC__seekable_stream_decoder_process_single, + AC_CHECK_LIB(FLAC,FLAC__stream_decoder_process_single, have_flac=yes,[],$all_libraries)]) # Hack to get the flac version since I was not able to handle the code from diff -urN k3b-0.12.17.orig/configure.in.in k3b-0.12.17/configure.in.in --- k3b-0.12.17.orig/configure.in.in 2006-08-23 10:32:30 +0300 +++ k3b-0.12.17/configure.in.in 2007-02-26 02:48:33 +0200 @@ -248,7 +248,7 @@ have_flac=no if test "$ac_cv_use_flac" = "yes"; then KDE_CHECK_HEADERS(FLAC++/decoder.h, [ - AC_CHECK_LIB(FLAC,FLAC__seekable_stream_decoder_process_single, + AC_CHECK_LIB(FLAC,FLAC__stream_decoder_process_single, have_flac=yes,[],$all_libraries)]) # Hack to get the flac version since I was not able to handle the code from diff -urN k3b-0.12.17.orig/plugins/decoder/flac/k3bflacdecoder.cpp k3b-0.12.17/plugins/decoder/flac/k3bflacdecoder.cpp --- k3b-0.12.17.orig/plugins/decoder/flac/k3bflacdecoder.cpp 2006-08-23 10:31:46 +0300 +++ k3b-0.12.17/plugins/decoder/flac/k3bflacdecoder.cpp 2007-02-26 02:48:55 +0200 @@ -29,6 +29,12 @@ #include #include +#if !defined FLACPP_API_VERSION_CURRENT || FLACPP_API_VERSION_CURRENT < 6 +#define LEGACY_FLAC +#else +#undef LEGACY_FLAC +#endif + #include #ifdef HAVE_TAGLIB @@ -40,7 +46,11 @@ class K3bFLACDecoder::Private +#ifdef LEGACY_FLAC : public FLAC::Decoder::SeekableStream +#else + : public FLAC::Decoder::Stream +#endif { public: void open(QFile* f) { @@ -64,7 +74,11 @@ } Private(QFile* f) +#ifdef LEGACY_FLAC : FLAC::Decoder::SeekableStream(), +#else + : FLAC::Decoder::Stream(), +#endif comments(0) { internalBuffer = new QBuffer(); internalBuffer->open(IO_ReadWrite); @@ -93,10 +107,17 @@ FLAC__uint64 samples; protected: +#ifdef LEGACY_FLAC virtual FLAC__SeekableStreamDecoderReadStatus read_callback(FLAC__byte buffer[], unsigned *bytes); virtual FLAC__SeekableStreamDecoderSeekStatus seek_callback(FLAC__uint64 absolute_byte_offset); virtual FLAC__SeekableStreamDecoderTellStatus tell_callback(FLAC__uint64 *absolute_byte_offset); virtual FLAC__SeekableStreamDecoderLengthStatus length_callback(FLAC__uint64 *stream_length); +#else + virtual FLAC__StreamDecoderReadStatus read_callback(FLAC__byte buffer[], size_t *bytes); + virtual FLAC__StreamDecoderSeekStatus seek_callback(FLAC__uint64 absolute_byte_offset); + virtual FLAC__StreamDecoderTellStatus tell_callback(FLAC__uint64 *absolute_byte_offset); + virtual FLAC__StreamDecoderLengthStatus length_callback(FLAC__uint64 *stream_length); +#endif virtual bool eof_callback(); virtual void error_callback(FLAC__StreamDecoderErrorStatus){}; virtual void metadata_callback(const ::FLAC__StreamMetadata *metadata); @@ -112,6 +133,7 @@ return file->atEnd(); } +#ifdef LEGACY_FLAC FLAC__SeekableStreamDecoderReadStatus K3bFLACDecoder::Private::read_callback(FLAC__byte buffer[], unsigned *bytes) { long retval = file->readBlock((char *)buffer, (*bytes)); if(-1 == retval) { @@ -119,27 +141,53 @@ } else { (*bytes) = retval; return FLAC__SEEKABLE_STREAM_DECODER_READ_STATUS_OK; +#else +FLAC__StreamDecoderReadStatus K3bFLACDecoder::Private::read_callback(FLAC__byte buffer[], size_t *bytes) { + long retval = file->readBlock((char *)buffer, (*bytes)); + if(-1 == retval) return FLAC__STREAM_DECODER_READ_STATUS_ABORT; + else { + (*bytes) = retval; + return FLAC__STREAM_DECODER_READ_STATUS_CONTINUE; +#endif } } +#ifdef LEGACY_FLAC FLAC__SeekableStreamDecoderSeekStatus K3bFLACDecoder::Private::seek_callback(FLAC__uint64 absolute_byte_offset) { if(file->at(absolute_byte_offset) == FALSE) return FLAC__SEEKABLE_STREAM_DECODER_SEEK_STATUS_ERROR; else return FLAC__SEEKABLE_STREAM_DECODER_SEEK_STATUS_OK; +#else +FLAC__StreamDecoderSeekStatus K3bFLACDecoder::Private::seek_callback(FLAC__uint64 absolute_byte_offset) { + if(file->at(absolute_byte_offset) == FALSE) return FLAC__STREAM_DECODER_SEEK_STATUS_ERROR; + else return FLAC__STREAM_DECODER_SEEK_STATUS_OK; +#endif } +#ifdef LEGACY_FLAC FLAC__SeekableStreamDecoderTellStatus K3bFLACDecoder::Private::tell_callback(FLAC__uint64 *absolute_byte_offset) { (*absolute_byte_offset) = file->at(); return FLAC__SEEKABLE_STREAM_DECODER_TELL_STATUS_OK; +#else +FLAC__StreamDecoderTellStatus K3bFLACDecoder::Private::tell_callback(FLAC__uint64 *absolute_byte_offset) { + (*absolute_byte_offset) = file->at(); + return FLAC__STREAM_DECODER_TELL_STATUS_OK; +#endif } +#ifdef LEGACY_FLAC FLAC__SeekableStreamDecoderLengthStatus K3bFLACDecoder::Private::length_callback(FLAC__uint64 *stream_length) { (*stream_length) = file->size(); return FLAC__SEEKABLE_STREAM_DECODER_LENGTH_STATUS_OK; +#else +FLAC__StreamDecoderLengthStatus K3bFLACDecoder::Private::length_callback(FLAC__uint64 *stream_length) { + (*stream_length) = file->size(); + return FLAC__STREAM_DECODER_LENGTH_STATUS_OK; +#endif } @@ -262,6 +310,7 @@ if(d->internalBuffer->size() == 0) { // want more data +#ifdef LEGACY_FLAC switch(d->get_state()) { case FLAC__SEEKABLE_STREAM_DECODER_END_OF_STREAM: d->finish(); @@ -273,6 +322,14 @@ default: return -1; } +#else + if(d->get_state() == FLAC__STREAM_DECODER_END_OF_STREAM) d->finish(); + else if(d->get_state() < FLAC__STREAM_DECODER_END_OF_STREAM) { + if(! d->process_single()) + return -1; + } + else return -1; +#endif } bytesAvailable = d->internalBuffer->size() - d->internalBuffer->at();