libgstflac_la_LIBADD = $(FLAC_LIBS)
libgstflac_la_LDFLAGS = $(GST_PLUGIN_LDFLAGS)
-noinst_HEADERS = gstflacenc.h gstflacdec.h
+noinst_HEADERS = gstflacenc.h gstflacdec.h flac_compat.h
--- /dev/null
+
+/* This file is an attempt to hack compatibility between the
+ * FLAC API version used in the code in this directory
+ * (currently 1.0.3) and older versions of FLAC, particularly
+ * 1.0.2.
+ */
+
+#ifndef _FLAC_COMPAT_H_
+#define _FLAC_COMPAT_H_
+
+#include <FLAC/all.h>
+
+/* FIXME when there's a autoconf symbol */
+#ifndef FLAC_VERSION
+
+#ifdef FLAC__REFERENCE_CODEC_MAX_BITS_PER_SAMPLE
+#define FLAC_VERSION 0x010003
+#else
+#define FLAC_VERSION 0x010002
+#endif
+
+#endif /* !defined(FLAC_VERSION) */
+
+#if FLAC_VERSION < 0x010003
+
+#define FLAC__STREAM_DECODER_ERROR_STATUS_LOST_SYNC \
+ FLAC__STREAM_DECODER_ERROR_LOST_SYNC
+#define FLAC__STREAM_DECODER_ERROR_STATUS_BAD_HEADER \
+ FLAC__STREAM_DECODER_ERROR_BAD_HEADER
+#define FLAC__STREAM_DECODER_ERROR_STATUS_FRAME_CRC_MISMATCH \
+ FLAC__STREAM_DECODER_ERROR_FRAME_CRC_MISMATCH
+#define FLAC__STREAM_DECODER_WRITE_STATUS_ABORT \
+ FLAC__STREAM_DECODER_WRITE_ABORT
+#define FLAC__STREAM_DECODER_WRITE_STATUS_CONTINUE \
+ FLAC__STREAM_DECODER_WRITE_CONTINUE
+
+#define FLAC__StreamMetadata FLAC__StreamMetaData
+
+#endif /* FLAC_VERSION < 0x010003 */
+
+#endif
+
#include "gstflacenc.h"
#include "gstflacdec.h"
+#include "flac_compat.h"
+
extern GstElementDetails flacenc_details;
extern GstElementDetails flacdec_details;
/*#define DEBUG_ENABLED */
#include "gstflacdec.h"
+#include "flac_compat.h"
extern GstPadTemplate *gst_flacdec_src_template, *gst_flacdec_sink_template;
FLAC__seekable_stream_decoder_set_tell_callback (flacdec->decoder, gst_flacdec_tell);
FLAC__seekable_stream_decoder_set_length_callback (flacdec->decoder, gst_flacdec_length);
FLAC__seekable_stream_decoder_set_eof_callback (flacdec->decoder, gst_flacdec_eof);
+#if FLAC_VERSION >= 0x010003
FLAC__seekable_stream_decoder_set_write_callback (flacdec->decoder, gst_flacdec_write);
+#else
+ FLAC__seekable_stream_decoder_set_write_callback (flacdec->decoder,
+ (FLAC__StreamDecoderWriteStatus (*)
+ (const FLAC__SeekableStreamDecoder *decoder,
+ const FLAC__Frame *frame,
+ const FLAC__int32 *buffer[],
+ void *client_data))
+ (gst_flacdec_write));
+#endif
FLAC__seekable_stream_decoder_set_metadata_callback (flacdec->decoder, gst_flacdec_metadata_callback);
FLAC__seekable_stream_decoder_set_error_callback (flacdec->decoder, gst_flacdec_error_callback);
FLAC__seekable_stream_decoder_set_client_data (flacdec->decoder, flacdec);
#include <gstflacenc.h>
+#include "flac_compat.h"
+
extern GstPadTemplate *gst_flacenc_src_template, *gst_flacenc_sink_template;
/* elementfactory information */