diff -ru vlc-0.8.5/configure vlc-0.8.5-b2/configure --- vlc-0.8.5/configure 2006-05-06 08:54:17.000000000 -0700 +++ vlc-0.8.5-b2/configure 2006-05-06 08:54:17.000000000 -0700 @@ -49204,7 +49204,7 @@ for element in flacdec; do - eval "LDFLAGS_${element}="'"'"-lFLAC "'$'"{LDFLAGS_${element}} "'"' + eval "LDFLAGS_${element}="'"'"-lFLAC -logg "'$'"{LDFLAGS_${element}} "'"' am_modules_with_ldflags="${am_modules_with_ldflags} ${element}" done diff -ru vlc-0.8.5/configure.ac vlc-0.8.5-b2/configure.ac --- vlc-0.8.5/configure.ac 2006-05-06 08:52:25.000000000 -0700 +++ vlc-0.8.5-b2/configure.ac 2006-05-06 08:52:25.000000000 -0700 @@ -3008,7 +3008,7 @@ fi else AC_CHECK_HEADERS(FLAC/stream_decoder.h, [ - VLC_ADD_LDFLAGS([flacdec],[-lFLAC]) + VLC_ADD_LDFLAGS([flacdec],[-lFLAC -logg]) ],[]) fi fi diff -ru vlc-0.8.5/modules/codec/flac.c vlc-0.8.5-b2/modules/codec/flac.c --- vlc-0.8.5/modules/codec/flac.c 2006-05-06 08:52:19.000000000 -0700 +++ vlc-0.8.5-b2/modules/codec/flac.c 2006-10-31 22:57:40.000000000 -0800 @@ -33,6 +33,12 @@ # include # include # define USE_LIBFLAC + /* by LEGACY_FLAC we mean before FLAC 1.1.3 when the decoder/encoder APIs were simplified */ +# if !defined(FLAC_API_VERSION_CURRENT) || FLAC_API_VERSION_CURRENT < 8 +# define LEGACY_FLAC +# else +# undef LEGACY_FLAC +# endif #endif #include "vlc_block_helper.h" @@ -133,7 +139,12 @@ #ifdef USE_LIBFLAC static FLAC__StreamDecoderReadStatus DecoderReadCallback( const FLAC__StreamDecoder *decoder, - FLAC__byte buffer[], unsigned *bytes, void *client_data ); +#ifdef LEGACY_FLAC + FLAC__byte buffer[], unsigned *bytes, +#else + FLAC__byte buffer[], size_t *bytes, +#endif + void *client_data ); static FLAC__StreamDecoderWriteStatus DecoderWriteCallback( const FLAC__StreamDecoder *decoder, @@ -223,6 +234,7 @@ return VLC_EGENERIC; } +#ifdef LEGACY_FLAC FLAC__stream_decoder_set_read_callback( p_sys->p_flac, DecoderReadCallback ); FLAC__stream_decoder_set_write_callback( p_sys->p_flac, @@ -233,7 +245,12 @@ DecoderErrorCallback ); FLAC__stream_decoder_set_client_data( p_sys->p_flac, p_dec ); + /* really should check the return value here */ FLAC__stream_decoder_init( p_sys->p_flac ); +#else + /* really should check the return value here */ + FLAC__stream_decoder_init_stream( p_sys->p_flac, DecoderReadCallback, NULL, NULL, NULL, NULL, DecoderWriteCallback, DecoderMetadataCallback, DecoderErrorCallback, p_dec ); +#endif #endif /* Set output properties */ @@ -535,7 +552,12 @@ *****************************************************************************/ static FLAC__StreamDecoderReadStatus DecoderReadCallback( const FLAC__StreamDecoder *decoder, FLAC__byte buffer[], - unsigned *bytes, void *client_data ) +#ifdef LEGACY_FLAC + unsigned *bytes, +#else + size_t *bytes, +#endif + void *client_data ) { decoder_t *p_dec = (decoder_t *)client_data; decoder_sys_t *p_sys = p_dec->p_sys; @@ -660,6 +682,11 @@ msg_Err( p_dec, "frame's data did not match the CRC in the " "footer." ); break; +#ifndef LEGACY_FLAC + case FLAC__STREAM_DECODER_ERROR_STATUS_UNPARSEABLE_STREAM: + msg_Err( p_dec, "the decoder encountered reserved fields in use in the stream." ); + break; +#endif default: msg_Err( p_dec, "got decoder error: %d", status ); } @@ -722,16 +749,11 @@ case FLAC__STREAM_DECODER_END_OF_STREAM: msg_Dbg( p_dec, "the decoder has reached the end of the stream." ); break; - case FLAC__STREAM_DECODER_ABORTED: - msg_Warn( p_dec, "the decoder was aborted by the read callback." ); - break; +#ifdef LEGACY_FLAC case FLAC__STREAM_DECODER_UNPARSEABLE_STREAM: msg_Warn( p_dec, "the decoder encountered reserved fields in use " "in the stream." ); break; - case FLAC__STREAM_DECODER_MEMORY_ALLOCATION_ERROR: - msg_Err( p_dec, "error when allocating memory." ); - break; case FLAC__STREAM_DECODER_ALREADY_INITIALIZED: msg_Err( p_dec, "FLAC__stream_decoder_init() was called when the " "decoder was already initialized, usually because " @@ -741,6 +763,20 @@ msg_Err( p_dec, "FLAC__stream_decoder_init() was called without " "all callbacks being set." ); break; +#else + case FLAC__STREAM_DECODER_OGG_ERROR: + msg_Warn( p_dec, "an error occurred in the underlying Ogg layer." ); + break; + case FLAC__STREAM_DECODER_SEEK_ERROR: + msg_Warn( p_dec, "an error occurred while seeking." ); + break; +#endif + case FLAC__STREAM_DECODER_ABORTED: + msg_Warn( p_dec, "the decoder was aborted by the read callback." ); + break; + case FLAC__STREAM_DECODER_MEMORY_ALLOCATION_ERROR: + msg_Err( p_dec, "error when allocating memory." ); + break; case FLAC__STREAM_DECODER_UNINITIALIZED: msg_Err( p_dec, "decoder in uninitialized state." ); break; @@ -1138,7 +1174,11 @@ static FLAC__StreamEncoderWriteStatus EncoderWriteCallback( const FLAC__StreamEncoder *encoder, const FLAC__byte buffer[], +#ifdef LEGACY_FLAC unsigned bytes, unsigned samples, +#else + size_t bytes, unsigned samples, +#endif unsigned current_frame, void *client_data ); static void EncoderMetadataCallback( const FLAC__StreamEncoder *encoder, @@ -1185,15 +1225,23 @@ FLAC__stream_encoder_set_bits_per_sample( p_sys->p_flac, 16 ); p_enc->fmt_in.i_codec = AOUT_FMT_S16_NE; +#ifdef LEGACY_FLAC FLAC__stream_encoder_set_write_callback( p_sys->p_flac, EncoderWriteCallback ); FLAC__stream_encoder_set_metadata_callback( p_sys->p_flac, EncoderMetadataCallback ); FLAC__stream_encoder_set_client_data( p_sys->p_flac, p_enc ); +#endif /* Get and store the STREAMINFO metadata block as a p_extra */ p_sys->p_chain = 0; +#ifdef LEGACY_FLAC + /* really should check the return value here */ FLAC__stream_encoder_init( p_sys->p_flac ); +#else + /* really should check the return value here */ + FLAC__stream_encoder_init_stream( p_sys->p_flac, EncoderWriteCallback, NULL, NULL, EncoderMetadataCallback, p_enc ); +#endif return VLC_SUCCESS; } @@ -1270,7 +1318,11 @@ static FLAC__StreamEncoderWriteStatus EncoderWriteCallback( const FLAC__StreamEncoder *encoder, const FLAC__byte buffer[], +#ifdef LEGACY_FLAC unsigned bytes, unsigned samples, +#else + size_t bytes, unsigned samples, +#endif unsigned current_frame, void *client_data ) { encoder_t *p_enc = (encoder_t *)client_data;