1 diff -u -r SDL_sound-1.0.1/configure.in SDL_sound-1.0.1-flac/configure.in
2 --- SDL_sound-1.0.1/configure.in 2003-10-12 20:49:54.000000000 +0200
3 +++ SDL_sound-1.0.1-flac/configure.in 2006-12-11 20:43:46.546583251 +0100
5 dnl FLAC developers tend to break their API with every release, so we're
6 dnl checking for the latest-and-greatest here so we don't have to support
8 +dnl Starting with FLAC 1.1.3:
9 +dnl libFLAC supports Ogg FLAC (no more libOggFLAC) so we also need -logg
10 +dnl the libFLAC .so version is also #defined in FLAC/export.h
12 dnl Hooray for shitty autoconf bugs!
13 -x="C__seekable_stream_decoder_process_single"
14 +x="C__stream_decoder_process_single"
19 AC_CHECK_HEADER(FLAC/stream_decoder.h, have_flac_hdr=yes)
20 AC_CHECK_LIB(FLAC, $flcsym, have_flac_lib=yes)
21 if test x$have_flac_hdr = xyes -a x$have_flac_lib = xyes; then
23 + LIBS="$LIBS -lFLAC -logg"
24 AC_DEFINE(SOUND_SUPPORTS_FLAC)
27 diff -u -r SDL_sound-1.0.1/decoders/flac.c SDL_sound-1.0.1-flac/decoders/flac.c
28 --- SDL_sound-1.0.1/decoders/flac.c 2003-03-10 23:44:14.000000000 +0100
29 +++ SDL_sound-1.0.1-flac/decoders/flac.c 2006-12-11 20:43:57.880097062 +0100
31 #define __SDL_SOUND_INTERNAL__
32 #include "SDL_sound_internal.h"
34 +#include <FLAC/export.h>
36 +/* FLAC 1.1.3 has FLAC_API_VERSION_CURRENT == 8 */
37 +#if !defined(FLAC_API_VERSION_CURRENT) || FLAC_API_VERSION_CURRENT < 8
44 #include <FLAC/seekable_stream_decoder.h>
46 #define D_END_OF_STREAM FLAC__SEEKABLE_STREAM_DECODER_END_OF_STREAM
48 typedef FLAC__SeekableStreamDecoderSeekStatus d_seek_status_t;
49 typedef FLAC__SeekableStreamDecoderTellStatus d_tell_status_t;
50 typedef FLAC__SeekableStreamDecoderLengthStatus d_length_status_t;
52 +#include <FLAC/stream_decoder.h>
54 +#define D_END_OF_STREAM FLAC__STREAM_DECODER_END_OF_STREAM
56 +#define d_new() FLAC__stream_decoder_new()
57 +#define d_process_metadata(x) FLAC__stream_decoder_process_until_end_of_metadata(x)
58 +#define d_process_one_frame(x) FLAC__stream_decoder_process_single(x)
59 +#define d_get_state(x) FLAC__stream_decoder_get_state(x)
60 +#define d_finish(x) FLAC__stream_decoder_finish(x)
61 +#define d_delete(x) FLAC__stream_decoder_delete(x)
63 +typedef FLAC__StreamDecoder decoder_t;
64 +typedef FLAC__StreamDecoderReadStatus d_read_status_t;
66 +#define D_SEEK_STATUS_OK FLAC__STREAM_DECODER_SEEK_STATUS_OK
67 +#define D_SEEK_STATUS_ERROR FLAC__STREAM_DECODER_SEEK_STATUS_ERROR
68 +#define D_TELL_STATUS_OK FLAC__STREAM_DECODER_TELL_STATUS_OK
69 +#define D_TELL_STATUS_ERROR FLAC__STREAM_DECODER_TELL_STATUS_ERROR
70 +#define D_LENGTH_STATUS_OK FLAC__STREAM_DECODER_LENGTH_STATUS_OK
71 +#define D_LENGTH_STATUS_ERROR FLAC__STREAM_DECODER_LENGTH_STATUS_ERROR
73 +#define d_seek_absolute(x, y) FLAC__stream_decoder_seek_absolute(x, y)
75 +typedef FLAC__StreamDecoderSeekStatus d_seek_status_t;
76 +typedef FLAC__StreamDecoderTellStatus d_tell_status_t;
77 +typedef FLAC__StreamDecoderLengthStatus d_length_status_t;
80 #define D_WRITE_CONTINUE FLAC__STREAM_DECODER_WRITE_STATUS_CONTINUE
81 #define D_READ_END_OF_STREAM FLAC__STREAM_DECODER_READ_STATUS_END_OF_STREAM
87 static d_read_status_t read_callback(
88 const decoder_t *decoder, FLAC__byte buffer[],
89 unsigned int *bytes, void *client_data)
91 +static d_read_status_t read_callback(
92 + const decoder_t *decoder, FLAC__byte buffer[],
93 + size_t *bytes, void *client_data)
96 flac_t *f = (flac_t *) client_data;
99 BAIL_MACRO(ERR_OUT_OF_MEMORY, 0);
103 d_set_read_callback(decoder, read_callback);
104 d_set_write_callback(decoder, write_callback);
105 d_set_metadata_callback(decoder, metadata_callback);
107 d_set_eof_callback(decoder, eof_callback);
109 d_set_client_data(decoder, f);
112 f->rw = internal->rw;
115 f->is_flac = 0 /* !!! FIXME: should be "has_extension", not "0". */;
117 internal->decoder_private = f;
118 + /* really should check the init return value here: */
122 + FLAC__stream_decoder_init_stream(decoder, read_callback, seek_callback, tell_callback, length_callback, eof_callback, write_callback, metadata_callback, error_callback, f);
125 sample->flags = SOUND_SAMPLEFLAG_NONE;