head 1.2; access; symbols pkgsrc-2013Q2:1.2.0.16 pkgsrc-2013Q2-base:1.2 pkgsrc-2012Q4:1.2.0.14 pkgsrc-2012Q4-base:1.2 pkgsrc-2011Q4:1.2.0.12 pkgsrc-2011Q4-base:1.2 pkgsrc-2011Q2:1.2.0.10 pkgsrc-2011Q2-base:1.2 pkgsrc-2009Q4:1.2.0.8 pkgsrc-2009Q4-base:1.2 pkgsrc-2008Q4:1.2.0.6 pkgsrc-2008Q4-base:1.2 pkgsrc-2008Q3:1.2.0.4 pkgsrc-2008Q3-base:1.2 cube-native-xorg:1.2.0.2 cube-native-xorg-base:1.2 pkgsrc-2008Q2:1.1.0.14 pkgsrc-2008Q2-base:1.1 cwrapper:1.1.0.12 pkgsrc-2008Q1:1.1.0.10 pkgsrc-2008Q1-base:1.1 pkgsrc-2007Q4:1.1.0.8 pkgsrc-2007Q4-base:1.1 pkgsrc-2007Q3:1.1.0.6 pkgsrc-2007Q3-base:1.1 pkgsrc-2007Q2:1.1.0.4 pkgsrc-2007Q2-base:1.1 pkgsrc-2007Q1:1.1.0.2 pkgsrc-2007Q1-base:1.1; locks; strict; comment @# @; 1.2 date 2008.09.08.19.20.26; author ahoka; state dead; branches; next 1.1; 1.1 date 2007.01.13.07.31.07; author wiz; state Exp; branches; next ; desc @@ 1.2 log @This package is long obsolete and as vlc has been updated to 0.9 and we have vlc08 there is no need to keep two legacy versions. @ text @$NetBSD: patch-af,v 1.1 2007/01/13 07:31:07 wiz Exp $ --- modules/codec/flac.c.orig 2004-04-25 18:08:39.000000000 +0000 +++ modules/codec/flac.c @@@@ -31,6 +31,12 @@@@ #include #include +/* 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 #include "vlc_block_helper.h" @@@@ -112,7 +118,12 @@@@ static int SyncInfo( decoder_t *, uint8_ 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, @@@@ -195,6 +206,7 @@@@ static int OpenDecoder( vlc_object_t *p_ 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, @@@@ -205,7 +217,12 @@@@ static int OpenDecoder( vlc_object_t *p_ 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 /* Set output properties */ p_dec->fmt_out.i_cat = AUDIO_ES; @@@@ -450,7 +467,12 @@@@ static void CloseDecoder( vlc_object_t * *****************************************************************************/ 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; @@@@ -575,6 +597,11 @@@@ static void DecoderErrorCallback( const 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 ); } @@@@ -640,6 +667,7 @@@@ static void decoder_state_error( decoder case FLAC__STREAM_DECODER_ABORTED: msg_Err( p_dec, "the decoder was aborted by the read callback." ); break; +#ifdef LEGACY_FLAC case FLAC__STREAM_DECODER_UNPARSEABLE_STREAM: msg_Err( p_dec, "the decoder encountered reserved fields in use " "in the stream." ); @@@@ -656,6 +684,14 @@@@ static void decoder_state_error( decoder 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_UNINITIALIZED: msg_Err( p_dec, "decoder in uninitialized state." ); break; @@@@ -1046,7 +1082,11 @@@@ static block_t *Encode( encoder_t *, aou 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, @@@@ -1093,15 +1133,23 @@@@ static int OpenEncoder( vlc_object_t *p_ 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; } @@@@ -1178,7 +1226,11 @@@@ static void EncoderMetadataCallback( con 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; @ 1.1 log @Fix build with flac-1.1.3 using patch from ftp.altlinux.org /pub/people/thresh Tested by joerg@@ @ text @d1 1 a1 1 $NetBSD$ @