--- xine-lib-1.1.3/src/libflac/demux_flac.c.flac 2006-10-21 20:50:41.000000000 +0200 +++ xine-lib-1.1.3/src/libflac/demux_flac.c 2007-01-11 18:46:09.000000000 +0100 @@ -441,7 +441,11 @@ lprintf("demux_flac_dispose\n"); if (this->flac_decoder) +#ifdef LEGACY_FLAC FLAC__seekable_stream_decoder_delete (this->flac_decoder); +#else + FLAC__stream_decoder_delete (this->flac_decoder); +#endif free(this); return; @@ -494,8 +498,13 @@ } target_sample = (uint64_t)(distance * this->total_samples); +#ifdef LEGACY_FLAC s = FLAC__seekable_stream_decoder_seek_absolute (this->flac_decoder, target_sample); +#else + s = FLAC__stream_decoder_seek_absolute (this->flac_decoder, + target_sample); +#endif if (s) { lprintf ("Seek to: %d successfull!\n", start_time); @@ -618,9 +627,6 @@ /* Get a new FLAC decoder and hook up callbacks */ #ifdef LEGACY_FLAC this->flac_decoder = FLAC__seekable_stream_decoder_new(); -#else - this->flac_decoder = FLAC__stream_decoder_new(); -#endif lprintf("this->flac_decoder: %p\n", this->flac_decoder); FLAC__seekable_stream_decoder_set_md5_checking (this->flac_decoder, false); @@ -644,6 +650,37 @@ this); FLAC__seekable_stream_decoder_init (this->flac_decoder); +#else + this->flac_decoder = FLAC__stream_decoder_new(); + lprintf("this->flac_decoder: %p\n", this->flac_decoder); + + if ( ! this->flac_decoder ) { + free(this); + return NULL; + } + + FLAC__stream_decoder_set_md5_checking (this->flac_decoder, false); + + if ( FLAC__stream_decoder_init_stream(this->flac_decoder, + flac_read_callback, + flac_seek_callback, + flac_tell_callback, + flac_length_callback, + flac_eof_callback, + flac_write_callback, + flac_metadata_callback, + flac_error_callback, + this + ) != FLAC__STREAM_DECODER_INIT_STATUS_OK ) { +#ifdef LEGACY_FLAC + FLAC__seekable_stream_decoder_delete (this->flac_decoder); +#else + FLAC__stream_decoder_delete (this->flac_decoder); +#endif + free(this); + return NULL; + } +#endif /* Get some stream info */ this->data_size = this->input->get_length (this->input); @@ -653,13 +690,21 @@ * this flac stream */ this->status = DEMUX_OK; +#ifdef LEGACY_FLAC FLAC__seekable_stream_decoder_process_until_end_of_metadata (this->flac_decoder); +#else + FLAC__stream_decoder_process_until_end_of_metadata (this->flac_decoder); +#endif lprintf("Processed file until end of metadata: %s\n", this->status == DEMUX_OK ? "success" : "failure"); if (this->status != DEMUX_OK) { +#ifdef LEGACY_FLAC FLAC__seekable_stream_decoder_delete (this->flac_decoder); +#else + FLAC__stream_decoder_delete (this->flac_decoder); +#endif free (this); return NULL; } --- xine-lib-1.1.3/src/libflac/decoder_flac.c.flac 2006-08-05 15:34:42.000000000 +0200 +++ xine-lib-1.1.3/src/libflac/decoder_flac.c 2007-01-11 18:46:09.000000000 +0100 @@ -30,6 +30,13 @@ #include +#if !defined FLAC_API_VERSION_CURRENT || FLAC_API_VERSION_CURRENT < 8 +#include +#define LEGACY_FLAC +#else +#undef LEGACY_FLAC +#endif + #define LOG_MODULE "flac_decoder" #define LOG_VERBOSE @@ -344,6 +351,7 @@ this->flac_decoder = FLAC__stream_decoder_new(); +#ifdef LEGACY_FLAC FLAC__stream_decoder_set_read_callback (this->flac_decoder, flac_read_callback); FLAC__stream_decoder_set_write_callback (this->flac_decoder, @@ -359,6 +367,22 @@ free (this); return NULL; } +#else + if ( FLAC__stream_decoder_init_stream (this->flac_decoder, + flac_read_callback, + NULL, /* seek */ + NULL, /* tell */ + NULL, /* length */ + NULL, /* eof */ + flac_write_callback, + NULL, /* metadata */ + flac_error_callback, + this + ) != FLAC__STREAM_DECODER_INIT_STATUS_OK ) { + free (this); + return NULL; + } +#endif return (audio_decoder_t *) this; } --- xine-lib-1.1.3/src/libflac/Makefile.am.flac 2006-07-11 00:08:29.000000000 +0200 +++ xine-lib-1.1.3/src/libflac/Makefile.am 2007-01-11 18:46:09.000000000 +0100 @@ -1,12 +1,10 @@ include $(top_srcdir)/misc/Makefile.common -if HAVE_FLAC -flac_module = xineplug_flac.la -endif - libdir = $(XINE_PLUGINDIR) -lib_LTLIBRARIES = $(flac_module) +if HAVE_LIBFLAC +lib_LTLIBRARIES = xineplug_flac.la +endif xineplug_flac_la_SOURCES = demux_flac.c decoder_flac.c xineplug_flac_la_LIBADD = $(LIBFLAC_LIBS) $(XINE_LIB) --- xine-lib-1.1.3/configure.ac.flac 2007-01-11 18:47:57.000000000 +0100 +++ xine-lib-1.1.3/configure.ac 2007-01-11 18:48:11.000000000 +0100 @@ -1154,17 +1154,15 @@ dnl check for libFLAC dnl --------------------------------------------- -AC_ARG_ENABLE([flac], - AC_HELP_STRING([--disable-flac], [do not build flac support]), - [with_flac=$enableval], [with_flac=yes]) - -if test "x$with_flac" = "xyes"; then - AM_PATH_LIBFLAC([], - AC_MSG_RESULT([*** All FLAC dependent parts will be disabled ***])) -else - no_libFLAC=yes +AC_ARG_WITH([libflac], + AC_HELP_STRING([--with-libflac], [build libFLAC-based decoder and demuxer])) + +have_libflac="no" +if test "x$with_libflac" = "xyes"; then + AM_PATH_LIBFLAC([have_libflac="yes"]) fi -AM_CONDITIONAL(HAVE_FLAC, [test x"$no_libFLAC" != "xyes"]) + +AM_CONDITIONAL([HAVE_LIBFLAC], [test "x$have_libflac" = "xyes"]) dnl --------------------------------------------- dnl External version of a52dec @@ -2572,7 +2570,7 @@ echo " - ws aud - pva" echo " - vox - nsf" echo " - nsv - 4xm" -echo " - aac" +echo " - FLAC - aac" echo " - iff - matroska" echo " - vmd - flv" if test x"$enable_asf" = "xyes"; then @@ -2587,6 +2585,9 @@ if test x"$enable_modplug" != x"no"; then echo " - mod" fi +if test "x$have_libflac" = "xyes"; then + echo " - FLAC (with libFLAC)" +fi if test x"$enable_a52dec" = "xyes"; then if test x"$have_a52" = "xyes"; then echo " - ac3 (external library)" @@ -2654,8 +2655,9 @@ echo " - MS ADPCM - IMA ADPCM" echo " - XA ADPCM - Game DPCM/ADPCM" echo " - Mace 3:13 - Mace 6:1" -if test x"no_libFLAC" != "xyes"; then - echo " - FLAC" +echo " - FLAC" +if test "x$have_libflac" = "xyes"; then + echo " - FLAC (with libFLAC)" fi if test "x$have_vorbis" = "xyes"; then echo " - vorbis"