$NetBSD: patch-ah,v 1.1 2007/01/13 21:58:24 wiz Exp $ --- src/input/r_ogm.cpp.orig 2006-04-28 08:48:49.000000000 +0000 +++ src/input/r_ogm.cpp @@ -23,6 +23,11 @@ #include #if defined(HAVE_FLAC_FORMAT_H) #include +#if !defined(FLAC_API_VERSION_CURRENT) || FLAC_API_VERSION_CURRENT < 8 +#define LEGACY_FLAC +#else +#undef LEGACY_FLAC +#endif #endif #if defined(SYS_WINDOWS) #include @@ -102,7 +107,11 @@ extract_vorbis_comments(const memory_cpt static FLAC__StreamDecoderReadStatus fhe_read_cb(const FLAC__StreamDecoder *decoder, FLAC__byte buffer[], +#ifdef LEGACY_FLAC unsigned *bytes, +#else + size_t *bytes, +#endif void *client_data) { flac_header_extractor_c *fhe; ogg_packet op; @@ -193,6 +202,7 @@ flac_header_extractor_c::flac_header_ext decoder = FLAC__stream_decoder_new(); if (decoder == NULL) mxerror(FPFX "FLAC__stream_decoder_new() failed.\n"); +#ifdef LEGACY_FLAC FLAC__stream_decoder_set_client_data(decoder, this); if (!FLAC__stream_decoder_set_read_callback(decoder, fhe_read_cb)) mxerror(FPFX "Could not set the read callback.\n"); @@ -202,10 +212,16 @@ flac_header_extractor_c::flac_header_ext mxerror(FPFX "Could not set the metadata callback.\n"); if (!FLAC__stream_decoder_set_error_callback(decoder, fhe_error_cb)) mxerror(FPFX "Could not set the error callback.\n"); +#endif if (!FLAC__stream_decoder_set_metadata_respond_all(decoder)) mxerror(FPFX "Could not set metadata_respond_all.\n"); +#ifdef LEGACY_FLAC if (FLAC__stream_decoder_init(decoder) != FLAC__STREAM_DECODER_SEARCH_FOR_METADATA) +#else + if (FLAC__stream_decoder_init_stream(decoder, fhe_read_cb, NULL, NULL, NULL, NULL, fhe_write_cb, fhe_metadata_cb, fhe_error_cb, this) != + FLAC__STREAM_DECODER_INIT_STATUS_OK) +#endif mxerror(FPFX "Could not initialize the FLAC decoder.\n"); ogg_sync_init(&oy); }