Commit 6d514674 authored by David Schleef's avatar David Schleef
Browse files

Add hack to make the flac plugin compile with both flac-1.0.2 and 1.0.3

Original commit message from CVS:
Add hack to make the flac plugin compile with both flac-1.0.2 and
1.0.3
parent 2ff64d48
......@@ -7,4 +7,4 @@ libgstflac_la_CFLAGS = $(GST_CFLAGS)
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
/* 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
......@@ -21,6 +21,8 @@
#include "gstflacenc.h"
#include "gstflacdec.h"
#include "flac_compat.h"
extern GstElementDetails flacenc_details;
extern GstElementDetails flacdec_details;
......
......@@ -23,6 +23,7 @@
/*#define DEBUG_ENABLED */
#include "gstflacdec.h"
#include "flac_compat.h"
extern GstPadTemplate *gst_flacdec_src_template, *gst_flacdec_sink_template;
......@@ -155,7 +156,17 @@ gst_flacdec_init (FlacDec *flacdec)
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);
......
......@@ -23,6 +23,8 @@
#include <gstflacenc.h>
#include "flac_compat.h"
extern GstPadTemplate *gst_flacenc_src_template, *gst_flacenc_sink_template;
/* elementfactory information */
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment