ALT Linux Bugzilla
– Attachment 1819 Details for
Bug 10874
unsupported flac >= 1.1.3
New bug
|
Search
|
[?]
|
Help
Register
|
Log In
[x]
|
Forgot Password
Login:
[x]
|
EN
|
RU
[patch]
mpd-0.12.1+flac-1.1.3.patch
mpd-0.12.1+flac-1.1.3.patch (text/plain), 23.65 KB, created by
led
on 2007-02-19 18:50:02 MSK
(
hide
)
Description:
mpd-0.12.1+flac-1.1.3.patch
Filename:
MIME Type:
Creator:
led
Created:
2007-02-19 18:50:02 MSK
Size:
23.65 KB
patch
obsolete
>diff -ru mpd-0.12.1/configure.ac mpd-0.12.1-b2/configure.ac >--- mpd-0.12.1/configure.ac 2006-10-10 16:56:58.000000000 -0700 >+++ mpd-0.12.1-b2/configure.ac 2006-10-24 16:58:56.000000000 -0700 >@@ -164,10 +164,6 @@ > XIPH_PATH_AO([AC_DEFINE(HAVE_AO, 1, [Define to play with ao]) MPD_LIBS="$MPD_LIBS $AO_LIBS" MPD_CFLAGS="$MPD_CFLAGS $AO_CFLAGS"], enable_ao=no) > fi > >-if test x$enable_shout = xyes; then >- XIPH_PATH_SHOUT([AC_DEFINE(HAVE_SHOUT, 1, [Define to enable libshout support]) MPD_LIBS="$MPD_LIBS $SHOUT_LIBS" MPD_CFLAGS="$MPD_CFLAGS $SHOUT_CFLAGS"], enable_shout=no) >-fi >- > if test x$enable_sun = xyes; then > AC_CHECK_HEADER(sys/audioio.h,[enable_sun=yes;AC_DEFINE(HAVE_SUN,1,[Define to enable SUN audio support])],[AC_MSG_WARN(Sun audioio headers not found -- disabling SUN support);enable_sun=no]) > fi >@@ -549,9 +545,31 @@ > > > if test x$enable_oggflac = xyes; then >- oldmpdcflags="$MPD_CFLAGS" >- oldmpdlibs="$MPD_LIBS" >- AM_PATH_LIBOGGFLAC(MPD_LIBS="$MPD_LIBS $LIBOGGFLAC_LIBS" MPD_CFLAGS="$MPD_CFLAGS $LIBOGGFLAC_CFLAGS",enable_oggflac=no) >+ # libOggFLAC was merged into libFLAC in FLAC-1.1.3 >+ # FLAC_API_SUPPORTS_OGG_FLAC first appears in FLAC-1.1.3 >+ oldcflags="$CFLAGS" >+ oldlibs="$LIBS" >+ oldldpath="$LD_LIBRARY_PATH" >+ CFLAGS="$CFLAGS $LIBFLAC_CFLAGS" >+ LIBS="$LIBS $LIBFLAC_LIBS -logg" >+ LD_LIBRARY_PATH="$LIBFLAC_LIBDIR:$LD_LIBRARY_PATH" >+ AC_TRY_RUN([ >+#include <FLAC/export.h> >+int main () { return !FLAC_API_SUPPORTS_OGG_FLAC; } >+],oggflac_in_flac=yes,oggflac_in_flac=no,oggflac_in_flac=yes) >+ CFLAGS="$oldcflags" >+ LIBS="$oldlibs" >+ LD_LIBRARY_PATH="$oldldpath" >+ if test x$oggflac_in_flac = xyes; then >+ oldmpdcflags="$MPD_CFLAGS" >+ oldmpdlibs="$MPD_LIBS" >+ MPD_LIBS="$MPD_LIBS $LIBOGGFLAC_LIBS" >+ MPD_CFLAGS="$MPD_CFLAGS $LIBOGGFLAC_CFLAGS" >+ else >+ oldmpdcflags="$MPD_CFLAGS" >+ oldmpdlibs="$MPD_LIBS" >+ AM_PATH_LIBOGGFLAC(MPD_LIBS="$MPD_LIBS $LIBOGGFLAC_LIBS" MPD_CFLAGS="$MPD_CFLAGS $LIBOGGFLAC_CFLAGS",enable_oggflac=no) >+ fi > fi > > if test x$enable_oggflac = xyes; then >@@ -568,14 +586,6 @@ > AC_DEFINE(HAVE_AUDIOFILE,1,[Define for audiofile support]) > fi > >-if test x$enable_mod = xyes; then >- AM_PATH_LIBMIKMOD(3.1.7, MPD_CFLAGS="$MPD_CFLAGS $LIBMIKMOD_CFLAGS" >- MPD_LIBS="$MPD_LIBS $LIBMIKMOD_LIBS $LIBMIKMOD_LDADD", enable_mod=no) >- if test x$enable_mod = xyes; then >- AC_DEFINE(HAVE_MIKMOD, 1, [Define for mikmod support]) >- fi >-fi >- > AC_OUTPUT(src/mp4ff/Makefile doc/Makefile src/Makefile Makefile ) > > echo "" >diff -ru mpd-0.12.1/src/inputPlugins/_flac_common.h mpd-0.12.1-b2/src/inputPlugins/_flac_common.h >--- mpd-0.12.1/src/inputPlugins/_flac_common.h 2006-10-10 16:56:55.000000000 -0700 >+++ mpd-0.12.1-b2/src/inputPlugins/_flac_common.h 2006-10-24 15:28:57.000000000 -0700 >@@ -30,7 +30,12 @@ > #include "../inputStream.h" > #include "../outputBuffer.h" > #include "../decode.h" >+#include <FLAC/export.h> >+#if !defined(FLAC_API_VERSION_CURRENT) || FLAC_API_VERSION_CURRENT < 8 > #include <FLAC/seekable_stream_decoder.h> >+#else >+#include <FLAC/stream_decoder.h> >+#endif > #include <FLAC/metadata.h> > > #define FLAC_CHUNK_SIZE 4080 >diff -ru mpd-0.12.1/src/inputPlugins/flac_plugin.c mpd-0.12.1-b2/src/inputPlugins/flac_plugin.c >--- mpd-0.12.1/src/inputPlugins/flac_plugin.c 2006-10-10 16:56:56.000000000 -0700 >+++ mpd-0.12.1-b2/src/inputPlugins/flac_plugin.c 2006-10-24 15:30:03.000000000 -0700 >@@ -33,11 +33,22 @@ > #include <stdio.h> > #include <string.h> > #include <unistd.h> >+#include <FLAC/export.h> >+#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> >+#else >+#include <FLAC/stream_decoder.h> >+#endif > #include <FLAC/metadata.h> > > /* this code is based on flac123, from flac-tools */ > >+#ifdef LEGACY_FLAC > static void flacError(const FLAC__SeekableStreamDecoder *, > FLAC__StreamDecoderErrorStatus, void *); > static void flacPrintErroredState(FLAC__SeekableStreamDecoderState state); >@@ -64,22 +75,55 @@ > *, FLAC__uint64 *, > void *); > static FLAC__bool flacEOF(const FLAC__SeekableStreamDecoder *, void *); >+#else >+static void flacError(const FLAC__StreamDecoder *, >+ FLAC__StreamDecoderErrorStatus, void *); >+static void flacPrintErroredState(FLAC__StreamDecoderState state); >+static void flacMetadata(const FLAC__StreamDecoder *, >+ const FLAC__StreamMetadata *, void *); >+static FLAC__StreamDecoderWriteStatus flacWrite(const >+ FLAC__StreamDecoder *, >+ const FLAC__Frame *, >+ const FLAC__int32 * const buf[], >+ void *); >+static FLAC__StreamDecoderReadStatus flacRead(const >+ FLAC__StreamDecoder >+ *, FLAC__byte buf[], >+ size_t *, void *); >+static FLAC__StreamDecoderSeekStatus flacSeek(const >+ FLAC__StreamDecoder >+ *, FLAC__uint64, void *); >+static FLAC__StreamDecoderTellStatus flacTell(const >+ FLAC__StreamDecoder >+ *, FLAC__uint64 *, >+ void *); >+static FLAC__StreamDecoderLengthStatus flacLength(const >+ FLAC__StreamDecoder >+ *, FLAC__uint64 *, >+ void *); >+static FLAC__bool flacEOF(const FLAC__StreamDecoder *, void *); >+#endif > > static int flac_decode(OutputBuffer * cb, DecoderControl * dc, > InputStream * inStream) > { >+#ifdef LEGACY_FLAC > FLAC__SeekableStreamDecoder *flacDec = NULL; >+#else >+ FLAC__StreamDecoder *flacDec = NULL; >+#endif > FlacData data; > int status = 1; > int ret = 0; > > init_FlacData(&data, cb, dc, inStream); > >+#ifdef LEGACY_FLAC > if (!(flacDec = FLAC__seekable_stream_decoder_new())) { > ret = -1; > goto fail; > } >- /*status&=FLAC__file_decoder_set_md5_checking(flacDec,1); */ >+ /*status&=FLAC__seekable_decoder_set_md5_checking(flacDec,1); */ > status &= FLAC__seekable_stream_decoder_set_read_callback(flacDec, > flacRead); > status &= FLAC__seekable_stream_decoder_set_seek_callback(flacDec, >@@ -130,20 +174,61 @@ > ret = -1; > goto fail; > } >+#else >+ if (!(flacDec = FLAC__stream_decoder_new())) { >+ ret = -1; >+ goto fail; >+ } >+ /*status&=FLAC__stream_decoder_set_md5_checking(flacDec,1); */ >+ status &= FLAC__stream_decoder_set_metadata_respond(flacDec, FLAC__METADATA_TYPE_VORBIS_COMMENT); >+ if (!status) { >+ ERROR("flac problem before init()\n"); >+ flacPrintErroredState(FLAC__stream_decoder_get_state(flacDec)); >+ ret = -1; >+ goto fail; >+ } >+ >+ if (FLAC__stream_decoder_init_stream(flacDec, flacRead, flacSeek, flacTell, flacLength, flacEOF, flacWrite, flacMetadata, flacError, (void *)&data) != >+ FLAC__STREAM_DECODER_INIT_STATUS_OK) { >+ ERROR("flac problem doing init()\n"); >+ flacPrintErroredState(FLAC__stream_decoder_get_state(flacDec)); >+ ret = -1; >+ goto fail; >+ } >+ >+ if (!FLAC__stream_decoder_process_until_end_of_metadata(flacDec)) { >+ ERROR("flac problem reading metadata\n"); >+ flacPrintErroredState(FLAC__stream_decoder_get_state(flacDec)); >+ ret = -1; >+ goto fail; >+ } >+#endif > > dc->state = DECODE_STATE_DECODE; > > while (1) { >+#ifdef LEGACY_FLAC > FLAC__seekable_stream_decoder_process_single(flacDec); > if (FLAC__seekable_stream_decoder_get_state(flacDec) != > FLAC__SEEKABLE_STREAM_DECODER_OK) { > break; > } >+#else >+ FLAC__stream_decoder_process_single(flacDec); >+ if (FLAC__stream_decoder_get_state(flacDec) > >+ FLAC__STREAM_DECODER_READ_FRAME) { >+ break; >+ } >+#endif > if (dc->seek) { > FLAC__uint64 sampleToSeek = dc->seekWhere * > dc->audioFormat.sampleRate + 0.5; >+#ifdef LEGACY_FLAC > if (FLAC__seekable_stream_decoder_seek_absolute(flacDec, > sampleToSeek)) >+#else >+ if (FLAC__stream_decoder_seek_absolute(flacDec, sampleToSeek)) >+#endif > { > clearOutputBuffer(cb); > data.time = ((float)sampleToSeek) / >@@ -157,9 +242,14 @@ > /* I don't think we need this bit here! -shank */ > /*FLAC__file_decoder_process_until_end_of_file(flacDec); */ > if (!dc->stop) { >+#ifdef LEGACY_FLAC > flacPrintErroredState(FLAC__seekable_stream_decoder_get_state > (flacDec)); > FLAC__seekable_stream_decoder_finish(flacDec); >+#else >+ flacPrintErroredState(FLAC__stream_decoder_get_state(flacDec)); >+ FLAC__stream_decoder_finish(flacDec); >+#endif > } > /* send last little bit */ > if (data.chunk_length > 0 && !dc->stop) { >@@ -180,19 +270,31 @@ > freeReplayGainInfo(data.replayGainInfo); > > if (flacDec) >+#ifdef LEGACY_FLAC > FLAC__seekable_stream_decoder_delete(flacDec); >+#else >+ FLAC__stream_decoder_delete(flacDec); >+#endif > > closeInputStream(inStream); > > return ret; > } > >+#ifdef LEGACY_FLAC > static FLAC__SeekableStreamDecoderReadStatus flacRead(const > FLAC__SeekableStreamDecoder > * flacDec, > FLAC__byte buf[], > unsigned *bytes, > void *fdata) >+#else >+static FLAC__StreamDecoderReadStatus flacRead(const >+ FLAC__StreamDecoder* flacDec, >+ FLAC__byte buf[], >+ size_t *bytes, >+ void *fdata) >+#endif > { > FlacData *data = (FlacData *) fdata; > size_t r; >@@ -208,54 +310,102 @@ > *bytes = r; > > if (*bytes == 0 && !inputStreamAtEOF(data->inStream) && !data->dc->stop) >+#ifdef LEGACY_FLAC > return FLAC__SEEKABLE_STREAM_DECODER_READ_STATUS_ERROR; >+#else >+ return FLAC__STREAM_DECODER_READ_STATUS_ABORT; >+#endif > >+#ifdef LEGACY_FLAC > return FLAC__SEEKABLE_STREAM_DECODER_READ_STATUS_OK; >+#else >+ return FLAC__STREAM_DECODER_READ_STATUS_CONTINUE; >+#endif > } > >+#ifdef LEGACY_FLAC > static FLAC__SeekableStreamDecoderSeekStatus flacSeek(const > FLAC__SeekableStreamDecoder > * flacDec, > FLAC__uint64 offset, > void *fdata) >+#else >+static FLAC__StreamDecoderSeekStatus flacSeek(const >+ FLAC__StreamDecoder* flacDec, >+ FLAC__uint64 offset, >+ void *fdata) >+#endif > { > FlacData *data = (FlacData *) fdata; > > if (seekInputStream(data->inStream, offset, SEEK_SET) < 0) { >+#ifdef LEGACY_FLAC > return FLAC__SEEKABLE_STREAM_DECODER_SEEK_STATUS_ERROR; >+#else >+ return FLAC__STREAM_DECODER_SEEK_STATUS_ERROR; >+#endif > } > >+#ifdef LEGACY_FLAC > return FLAC__SEEKABLE_STREAM_DECODER_SEEK_STATUS_OK; >+#else >+ return FLAC__STREAM_DECODER_SEEK_STATUS_OK; >+#endif > } > >+#ifdef LEGACY_FLAC > static FLAC__SeekableStreamDecoderTellStatus flacTell(const >- FLAC__SeekableStreamDecoder >- * flacDec, >+ FLAC__SeekableStreamDecoder* flacDec, >+ FLAC__uint64 * offset, >+ void *fdata) >+#else >+static FLAC__StreamDecoderTellStatus flacTell(const >+ FLAC__StreamDecoder* flacDec, > FLAC__uint64 * offset, > void *fdata) >+#endif > { > FlacData *data = (FlacData *) fdata; > > *offset = (long)(data->inStream->offset); > >+#ifdef LEGACY_FLAC > return FLAC__SEEKABLE_STREAM_DECODER_TELL_STATUS_OK; >+#else >+ return FLAC__STREAM_DECODER_TELL_STATUS_OK; >+#endif > } > >+#ifdef LEGACY_FLAC > static FLAC__SeekableStreamDecoderLengthStatus flacLength(const > FLAC__SeekableStreamDecoder > * flacDec, > FLAC__uint64 * length, > void *fdata) >+#else >+static FLAC__StreamDecoderLengthStatus flacLength(const >+ FLAC__StreamDecoder* flacDec, >+ FLAC__uint64 * length, >+ void *fdata) >+#endif > { > FlacData *data = (FlacData *) fdata; > > *length = (size_t) (data->inStream->size); > >+#ifdef LEGACY_FLAC > return FLAC__SEEKABLE_STREAM_DECODER_LENGTH_STATUS_OK; >+#else >+ return FLAC__STREAM_DECODER_LENGTH_STATUS_OK; >+#endif > } > >+#ifdef LEGACY_FLAC > static FLAC__bool flacEOF(const FLAC__SeekableStreamDecoder * flacDec, > void *fdata) >+#else >+static FLAC__bool flacEOF(const FLAC__StreamDecoder * flacDec, void *fdata) >+#endif > { > FlacData *data = (FlacData *) fdata; > >@@ -264,14 +414,24 @@ > return false; > } > >+#ifdef LEGACY_FLAC > static void flacError(const FLAC__SeekableStreamDecoder * dec, > FLAC__StreamDecoderErrorStatus status, void *fdata) >+#else >+static void flacError(const FLAC__StreamDecoder * dec, >+ FLAC__StreamDecoderErrorStatus status, void *fdata) >+#endif > { > flac_error_common_cb("flac", status, (FlacData *) fdata); > } > >+#ifdef LEGACY_FLAC > static void flacPrintErroredState(FLAC__SeekableStreamDecoderState state) >+#else >+static void flacPrintErroredState(FLAC__StreamDecoderState state) >+#endif > { >+#ifdef LEGACY_FLAC > switch (state) { > case FLAC__SEEKABLE_STREAM_DECODER_MEMORY_ALLOCATION_ERROR: > ERROR("flac allocation error\n"); >@@ -299,19 +459,35 @@ > case FLAC__SEEKABLE_STREAM_DECODER_END_OF_STREAM: > break; > } >+#else >+ ERROR("%s\n", FLAC__StreamDecoderStateString[state]); >+#endif > } > >+#ifdef LEGACY_FLAC > static void flacMetadata(const FLAC__SeekableStreamDecoder * dec, > const FLAC__StreamMetadata * block, void *vdata) >+#else >+static void flacMetadata(const FLAC__StreamDecoder * dec, >+ const FLAC__StreamMetadata * block, void *vdata) >+#endif > { > flac_metadata_common_cb(block, (FlacData *) vdata); > } > >+#ifdef LEGACY_FLAC > static FLAC__StreamDecoderWriteStatus flacWrite(const > FLAC__SeekableStreamDecoder * > dec, const FLAC__Frame * frame, > const FLAC__int32 * const buf[], > void *vdata) >+#else >+static FLAC__StreamDecoderWriteStatus flacWrite(const >+ FLAC__StreamDecoder * >+ dec, const FLAC__Frame * frame, >+ const FLAC__int32 * const buf[], >+ void *vdata) >+#endif > { > FlacData *data = (FlacData *) vdata; > FLAC__uint32 samples = frame->header.blocksize; >@@ -325,7 +501,11 @@ > timeChange = ((float)samples) / frame->header.sample_rate; > data->time += timeChange; > >+#ifdef LEGACY_FLAC > FLAC__seekable_stream_decoder_get_decode_position(dec, &newPosition); >+#else >+ FLAC__stream_decoder_get_decode_position(dec, &newPosition); >+#endif > if (data->position) { > data->bitRate = > ((newPosition - data->position) * 8.0 / timeChange) >diff -ru mpd-0.12.1/src/inputPlugins/oggflac_plugin.c mpd-0.12.1-b2/src/inputPlugins/oggflac_plugin.c >--- mpd-0.12.1/src/inputPlugins/oggflac_plugin.c 2006-10-10 16:56:55.000000000 -0700 >+++ mpd-0.12.1-b2/src/inputPlugins/oggflac_plugin.c 2006-10-24 15:30:24.000000000 -0700 >@@ -37,26 +37,54 @@ > #include <stdio.h> > #include <string.h> > #include <unistd.h> >+#include <FLAC/export.h> >+#if !defined(FLAC_API_VERSION_CURRENT) || FLAC_API_VERSION_CURRENT < 8 >+#define LEGACY_FLAC >+#else >+#undef LEGACY_FLAC >+#endif >+#ifdef LEGACY_FLAC > #include <OggFLAC/seekable_stream_decoder.h> >+#else >+#include <FLAC/stream_decoder.h> >+#endif > #include <FLAC/metadata.h> > >+#ifdef LEGACY_FLAC > static void oggflac_cleanup(InputStream * inStream, > FlacData * data, > OggFLAC__SeekableStreamDecoder * decoder) >+#else >+static void oggflac_cleanup(InputStream * inStream, >+ FlacData * data, >+ FLAC__StreamDecoder * decoder) >+#endif > { > if (data->replayGainInfo) > freeReplayGainInfo(data->replayGainInfo); > if (decoder) >+#ifdef LEGACY_FLAC > OggFLAC__seekable_stream_decoder_delete(decoder); >+#else >+ FLAC__stream_decoder_delete(decoder); >+#endif > closeInputStream(inStream); > } > >+#ifdef LEGACY_FLAC > static OggFLAC__SeekableStreamDecoderReadStatus of_read_cb(const > OggFLAC__SeekableStreamDecoder > * decoder, > FLAC__byte buf[], > unsigned *bytes, > void *fdata) >+#else >+static FLAC__StreamDecoderReadStatus of_read_cb(const >+ FLAC__StreamDecoder* decoder, >+ FLAC__byte buf[], >+ size_t *bytes, >+ void *fdata) >+#endif > { > FlacData *data = (FlacData *) fdata; > size_t r; >@@ -72,55 +100,105 @@ > *bytes = r; > > if (r == 0 && !inputStreamAtEOF(data->inStream) && !data->dc->stop) >+#ifdef LEGACY_FLAC > return OggFLAC__SEEKABLE_STREAM_DECODER_READ_STATUS_ERROR; >+#else >+ return FLAC__STREAM_DECODER_READ_STATUS_ABORT; >+#endif > >+#ifdef LEGACY_FLAC > return OggFLAC__SEEKABLE_STREAM_DECODER_READ_STATUS_OK; >+#else >+ return FLAC__STREAM_DECODER_READ_STATUS_CONTINUE; >+#endif > } > >+#ifdef LEGACY_FLAC > static OggFLAC__SeekableStreamDecoderSeekStatus of_seek_cb(const > OggFLAC__SeekableStreamDecoder > * decoder, > FLAC__uint64 offset, > void *fdata) >+#else >+static FLAC__StreamDecoderSeekStatus of_seek_cb(const >+ FLAC__StreamDecoder* decoder, >+ FLAC__uint64 offset, >+ void *fdata) >+#endif > { > FlacData *data = (FlacData *) fdata; > > if (seekInputStream(data->inStream, offset, SEEK_SET) < 0) { >+#ifdef LEGACY_FLAC > return OggFLAC__SEEKABLE_STREAM_DECODER_SEEK_STATUS_ERROR; >+#else >+ return FLAC__STREAM_DECODER_SEEK_STATUS_ERROR; >+#endif > } > >+#ifdef LEGACY_FLAC > return OggFLAC__SEEKABLE_STREAM_DECODER_SEEK_STATUS_OK; >+#else >+ return FLAC__STREAM_DECODER_SEEK_STATUS_OK; >+#endif > } > >+#ifdef LEGACY_FLAC > static OggFLAC__SeekableStreamDecoderTellStatus of_tell_cb(const > OggFLAC__SeekableStreamDecoder > * decoder, > FLAC__uint64 * > offset, void *fdata) >+#else >+static FLAC__StreamDecoderTellStatus of_tell_cb(const >+ FLAC__StreamDecoder* decoder, >+ FLAC__uint64 * >+ offset, void *fdata) >+#endif > { > FlacData *data = (FlacData *) fdata; > > *offset = (long)(data->inStream->offset); > >+#ifdef LEGACY_FLAC > return OggFLAC__SEEKABLE_STREAM_DECODER_TELL_STATUS_OK; >+#else >+ return FLAC__STREAM_DECODER_TELL_STATUS_OK; >+#endif > } > >+#ifdef LEGACY_FLAC > static OggFLAC__SeekableStreamDecoderLengthStatus of_length_cb(const > OggFLAC__SeekableStreamDecoder > * decoder, > FLAC__uint64 * > length, > void *fdata) >+#else >+static FLAC__StreamDecoderLengthStatus of_length_cb(const >+ FLAC__StreamDecoder* decoder, >+ FLAC__uint64 * >+ length, >+ void *fdata) >+#endif > { > FlacData *data = (FlacData *) fdata; > > *length = (size_t) (data->inStream->size); > >+#ifdef LEGACY_FLAC > return OggFLAC__SEEKABLE_STREAM_DECODER_LENGTH_STATUS_OK; >+#else >+ return FLAC__STREAM_DECODER_LENGTH_STATUS_OK; >+#endif > } > >+#ifdef LEGACY_FLAC > static FLAC__bool of_EOF_cb(const OggFLAC__SeekableStreamDecoder * decoder, > void *fdata) >+#else >+static FLAC__bool of_EOF_cb(const FLAC__StreamDecoder * decoder, void *fdata) >+#endif > { > FlacData *data = (FlacData *) fdata; > >@@ -129,14 +207,24 @@ > return false; > } > >+#ifdef LEGACY_FLAC > static void of_error_cb(const OggFLAC__SeekableStreamDecoder * decoder, > FLAC__StreamDecoderErrorStatus status, void *fdata) >+#else >+static void of_error_cb(const FLAC__StreamDecoder * decoder, >+ FLAC__StreamDecoderErrorStatus status, void *fdata) >+#endif > { > flac_error_common_cb("oggflac", status, (FlacData *) fdata); > } > >+#ifdef LEGACY_FLAC > static void oggflacPrintErroredState(OggFLAC__SeekableStreamDecoderState state) >+#else >+static void oggflacPrintErroredState(FLAC__StreamDecoderState state) >+#endif > { >+#ifdef LEGACY_FLAC > switch (state) { > case OggFLAC__SEEKABLE_STREAM_DECODER_MEMORY_ALLOCATION_ERROR: > ERROR("oggflac allocation error\n"); >@@ -164,14 +252,25 @@ > case OggFLAC__SEEKABLE_STREAM_DECODER_END_OF_STREAM: > break; > } >+#else >+ ERROR("%s\n", FLAC__StreamDecoderStateString[state]); >+#endif > } > >+#ifdef LEGACY_FLAC > static FLAC__StreamDecoderWriteStatus oggflacWrite(const > OggFLAC__SeekableStreamDecoder > * decoder, > const FLAC__Frame * frame, > const FLAC__int32 * > const buf[], void *vdata) >+#else >+static FLAC__StreamDecoderWriteStatus oggflacWrite(const >+ FLAC__StreamDecoder * decoder, >+ const FLAC__Frame * frame, >+ const FLAC__int32 * >+ const buf[], void *vdata) >+#endif > { > FlacData *data = (FlacData *) vdata; > FLAC__uint32 samples = frame->header.blocksize; >@@ -222,8 +321,13 @@ > } > > /* used by TagDup */ >+#ifdef LEGACY_FLAC > static void of_metadata_dup_cb(const OggFLAC__SeekableStreamDecoder * decoder, > const FLAC__StreamMetadata * block, void *vdata) >+#else >+static void of_metadata_dup_cb(const FLAC__StreamDecoder * decoder, >+ const FLAC__StreamMetadata * block, void *vdata) >+#endif > { > FlacData *data = (FlacData *) vdata; > >@@ -243,20 +347,37 @@ > } > > /* used by decode */ >+#ifdef LEGACY_FLAC > static void of_metadata_decode_cb(const OggFLAC__SeekableStreamDecoder * dec, > const FLAC__StreamMetadata * block, > void *vdata) >+#else >+static void of_metadata_decode_cb(const FLAC__StreamDecoder * dec, >+ const FLAC__StreamMetadata * block, >+ void *vdata) >+#endif > { > flac_metadata_common_cb(block, (FlacData *) vdata); > } > >+#ifdef LEGACY_FLAC > static OggFLAC__SeekableStreamDecoder > * full_decoder_init_and_read_metadata(FlacData * data, > unsigned int metadata_only) >+#else >+static FLAC__StreamDecoder >+ * full_decoder_init_and_read_metadata(FlacData * data, >+ unsigned int metadata_only) >+#endif > { >+#ifdef LEGACY_FLAC > OggFLAC__SeekableStreamDecoder *decoder = NULL; >+#else >+ FLAC__StreamDecoder *decoder = NULL; >+#endif > unsigned int s = 1; > >+#ifdef LEGACY_FLAC > if (!(decoder = OggFLAC__seekable_stream_decoder_new())) > return NULL; > >@@ -303,13 +424,43 @@ > ERROR("oggflac problem reading metadata\n"); > goto fail; > } >+#else >+ if (!(decoder = FLAC__stream_decoder_new())) >+ return NULL; >+ >+ if (metadata_only) { >+ s &= FLAC__stream_decoder_set_metadata_respond >+ (decoder, FLAC__METADATA_TYPE_STREAMINFO); >+ } >+ >+ s &= FLAC__stream_decoder_set_metadata_respond(decoder, FLAC__METADATA_TYPE_VORBIS_COMMENT); >+ >+ if (!s) { >+ ERROR("oggflac problem before init()\n"); >+ goto fail; >+ } >+ if (FLAC__stream_decoder_init_ogg_stream(decoder, of_read_cb, of_seek_cb, of_tell_cb, of_length_cb, of_EOF_cb, oggflacWrite, metadata_only? of_metadata_dup_cb : of_metadata_decode_cb, of_error_cb, (void *)data) != >+ FLAC__STREAM_DECODER_INIT_STATUS_OK) { >+ ERROR("oggflac problem doing init()\n"); >+ goto fail; >+ } >+ if (!FLAC__stream_decoder_process_until_end_of_metadata(decoder)) { >+ ERROR("oggflac problem reading metadata\n"); >+ goto fail; >+ } >+#endif > > return decoder; > > fail: >+#ifdef LEGACY_FLAC > oggflacPrintErroredState(OggFLAC__seekable_stream_decoder_get_state > (decoder)); > OggFLAC__seekable_stream_decoder_delete(decoder); >+#else >+ oggflacPrintErroredState(FLAC__stream_decoder_get_state(decoder)); >+ FLAC__stream_decoder_delete(decoder); >+#endif > return NULL; > } > >@@ -317,7 +468,11 @@ > static MpdTag *oggflac_TagDup(char *file) > { > InputStream inStream; >+#ifdef LEGACY_FLAC > OggFLAC__SeekableStreamDecoder *decoder; >+#else >+ FLAC__StreamDecoder *decoder; >+#endif > FlacData data; > > if (openInputStream(&inStream, file) < 0) >@@ -346,7 +501,11 @@ > static int oggflac_decode(OutputBuffer * cb, DecoderControl * dc, > InputStream * inStream) > { >+#ifdef LEGACY_FLAC > OggFLAC__SeekableStreamDecoder *decoder = NULL; >+#else >+ FLAC__StreamDecoder *decoder = NULL; >+#endif > FlacData data; > int ret = 0; > >@@ -360,16 +519,29 @@ > dc->state = DECODE_STATE_DECODE; > > while (1) { >+#ifdef LEGACY_FLAC > OggFLAC__seekable_stream_decoder_process_single(decoder); > if (OggFLAC__seekable_stream_decoder_get_state(decoder) != > OggFLAC__SEEKABLE_STREAM_DECODER_OK) { > break; > } >+#else >+ FLAC__stream_decoder_process_single(decoder); >+ if (FLAC__stream_decoder_get_state(decoder) > >+ FLAC__STREAM_DECODER_READ_FRAME) { >+ break; >+ } >+#endif > if (dc->seek) { > FLAC__uint64 sampleToSeek = dc->seekWhere * > dc->audioFormat.sampleRate + 0.5; >+#ifdef LEGACY_FLAC > if (OggFLAC__seekable_stream_decoder_seek_absolute >- (decoder, sampleToSeek)) { >+ (decoder, sampleToSeek)) >+#else >+ if (FLAC__stream_decoder_seek_absolute(decoder, sampleToSeek)) >+#endif >+ { > clearOutputBuffer(cb); > data.time = ((float)sampleToSeek) / > dc->audioFormat.sampleRate; >@@ -381,9 +553,14 @@ > } > > if (!dc->stop) { >+#ifdef LEGACY_FLAC > oggflacPrintErroredState > (OggFLAC__seekable_stream_decoder_get_state(decoder)); > OggFLAC__seekable_stream_decoder_finish(decoder); >+#else >+ oggflacPrintErroredState(FLAC__stream_decoder_get_state(decoder)); >+ FLAC__stream_decoder_finish(decoder); >+#endif > } > /* send last little bit */ > if (data.chunk_length > 0 && !dc->stop) { >@@ -416,7 +593,7 @@ > oggflac_mime_types > }; > >-#else /* !HAVE_FLAC */ >+#else /* !HAVE_OGGFLAC */ > > InputPlugin oggflacPlugin = { > NULL,
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 10874
: 1819 |
1820
|
1821