Commit 57ba6f4e authored by Josh Coalson's avatar Josh Coalson

massive glob of checkins: improved tests, more tests, bugfixes

parent 7b2e3a37
......@@ -27,7 +27,7 @@
# clean : remove all non-distro files
#
all: libFLAC libFLAC++ share flac metaflac test_streams test_unit
all: libFLAC libFLAC++ share flac metaflac test_libFLAC test_libFLAC++ test_streams
DEFAULT_CONFIG = release
......@@ -42,7 +42,7 @@ release : all
libFLAC:
(cd src/$@ ; $(MAKE) -f Makefile.lite $(CONFIG))
libFLAC++: libFLAC
libFLAC++:
(cd src/$@ ; $(MAKE) -f Makefile.lite $(CONFIG))
share:
......@@ -51,7 +51,7 @@ share:
flac: libFLAC
(cd src/$@ ; $(MAKE) -f Makefile.lite $(CONFIG))
metaflac:
metaflac: libFLAC share
(cd src/$@ ; $(MAKE) -f Makefile.lite $(CONFIG))
plugin_xmms: libFLAC
......@@ -60,7 +60,10 @@ plugin_xmms: libFLAC
test_streams: libFLAC
(cd src/$@ ; $(MAKE) -f Makefile.lite $(CONFIG))
test_unit: libFLAC
test_libFLAC: libFLAC
(cd src/$@ ; $(MAKE) -f Makefile.lite $(CONFIG))
test_libFLAC++: libFLAC libFLAC++
(cd src/$@ ; $(MAKE) -f Makefile.lite $(CONFIG))
test: debug
......@@ -73,6 +76,7 @@ clean:
-(cd src/flac ; $(MAKE) -f Makefile.lite clean)
-(cd src/metaflac ; $(MAKE) -f Makefile.lite clean)
-(cd src/plugin_xmms ; $(MAKE) -f Makefile.lite clean)
-(cd src/test_libFLAC ; $(MAKE) -f Makefile.lite clean)
-(cd src/test_libFLAC++ ; $(MAKE) -f Makefile.lite clean)
-(cd src/test_streams ; $(MAKE) -f Makefile.lite clean)
-(cd src/test_unit ; $(MAKE) -f Makefile.lite clean)
-(cd test ; $(MAKE) -f Makefile.lite clean)
......@@ -28,6 +28,7 @@ AM_PROG_LIBTOOL
sed -e 's/^build_old_libs=yes/build_old_libs=no/' libtool > libtool-disable-static
chmod +x libtool-disable-static
AC_PROG_CXX
AC_PROG_MAKE_SET
dnl check for getopt in standard library
......@@ -163,17 +164,17 @@ AC_SUBST(FLaC__USIZE64)
AC_SUBST(SHARE_LIBS)
SAVE_CFLAGS="$CFLAGS"
CFLAGS='-I$(top_builddir) -I$(srcdir)/include -I$(top_srcdir)/include'
OUR_CFLAGS_HEAD='-I$(top_builddir) -I$(srcdir)/include -I$(top_srcdir)/include'
if test x$debug = xtrue; then
CFLAGS="$CFLAGS -g -O0 -DDEBUG"
OUR_CFLAGS_TAIL="-g -O0 -DDEBUG"
else
CFLAGS="$CFLAGS -O3 -DNDEBUG"
OUR_CFLAGS_TAIL="-O3 -DNDEBUG"
if test x$GCC = xyes; then
CFLAGS="$CFLAGS -fomit-frame-pointer -funroll-loops -finline-functions -Wall -W -Winline -DFLaC__INLINE=__inline__"
OUR_CFLAGS_TAIL="$OUR_CFLAGS_TAIL -fomit-frame-pointer -funroll-loops -finline-functions -Wall -W -Winline -DFLaC__INLINE=__inline__"
fi
fi
CFLAGS="$CFLAGS $SAVE_CFLAGS"
CFLAGS="$OUR_CFLAGS_HEAD $CFLAGS $OUR_CFLAGS_TAIL"
CXXFLAGS="$OUR_CFLAGS_HEAD $CXXFLAGS $OUR_CFLAGS_TAIL"
AC_OUTPUT( Makefile \
src/Makefile \
......@@ -182,12 +183,14 @@ AC_OUTPUT( Makefile \
src/libFLAC/include/Makefile \
src/libFLAC/include/private/Makefile \
src/libFLAC/include/protected/Makefile \
src/libFLAC++/Makefile \
src/flac/Makefile \
src/metaflac/Makefile \
src/plugin_xmms/Makefile \
src/share/Makefile \
src/test_libFLAC/Makefile \
src/test_libFLAC++/Makefile \
src/test_streams/Makefile \
src/test_unit/Makefile \
include/Makefile \
include/FLAC/Makefile \
include/FLAC/ordinals.h \
......
......@@ -494,7 +494,7 @@
F59E59BF01972D3E01A8006D,
);
isa = PBXGroup;
path = test_unit;
path = test_libFLAC;
refType = 4;
};
F59E59BD01972D3E01A8006D = {
......@@ -1061,7 +1061,7 @@
};
F5F561EF019B58E101A8006D = {
isa = PBXExecutableFileReference;
path = test_unit;
path = test_libFLAC;
refType = 3;
};
F5F561F0019B58E101A8006D = {
......@@ -1139,7 +1139,7 @@
OTHER_CFLAGS = "";
OTHER_LDFLAGS = "";
OTHER_REZFLAGS = "";
PRODUCT_NAME = test_unit;
PRODUCT_NAME = test_libFLAC;
REZ_EXECUTABLE = YES;
SECTORDER_FLAGS = "";
WARNING_CFLAGS = "-Wmost -Wno-four-char-constants -Wno-unknown-pragmas";
......@@ -1147,9 +1147,9 @@
dependencies = (
);
isa = PBXToolTarget;
name = test_unit;
name = test_libFLAC;
productInstallPath = /usr/local/bin;
productName = test_unit;
productName = test_libFLAC;
productReference = F5F561EF019B58E101A8006D;
shouldUseHeadermap = 0;
};
......
......@@ -98,14 +98,14 @@ namespace FLAC {
bool process_remaining_frames();
protected:
virtual ::FLAC__StreamDecoderReadStatus read_callback(FLAC__byte buffer[], unsigned *bytes) = 0;
virtual ::FLAC__StreamDecoderWriteStatus write_callback(const ::FLAC__Frame *frame, const FLAC__int32 *buffer[]) = 0;
virtual ::FLAC__StreamDecoderWriteStatus write_callback(const ::FLAC__Frame *frame, const FLAC__int32 * const buffer[]) = 0;
virtual void metadata_callback(const ::FLAC__StreamMetaData *metadata) = 0;
virtual void error_callback(::FLAC__StreamDecoderErrorStatus status) = 0;
::FLAC__StreamDecoder *decoder_;
private:
static ::FLAC__StreamDecoderReadStatus read_callback_(const ::FLAC__StreamDecoder *decoder, FLAC__byte buffer[], unsigned *bytes, void *client_data);
static ::FLAC__StreamDecoderWriteStatus write_callback_(const ::FLAC__StreamDecoder *decoder, const ::FLAC__Frame *frame, const FLAC__int32 *buffer[], void *client_data);
static ::FLAC__StreamDecoderWriteStatus write_callback_(const ::FLAC__StreamDecoder *decoder, const ::FLAC__Frame *frame, const FLAC__int32 * const buffer[], void *client_data);
static void metadata_callback_(const ::FLAC__StreamDecoder *decoder, const ::FLAC__StreamMetaData *metadata, void *client_data);
static void error_callback_(const ::FLAC__StreamDecoder *decoder, ::FLAC__StreamDecoderErrorStatus status, void *client_data);
......@@ -172,7 +172,7 @@ namespace FLAC {
virtual ::FLAC__SeekableStreamDecoderTellStatus tell_callback(FLAC__uint64 *absolute_byte_offset) = 0;
virtual ::FLAC__SeekableStreamDecoderLengthStatus length_callback(FLAC__uint64 *stream_length) = 0;
virtual bool eof_callback() = 0;
virtual ::FLAC__StreamDecoderWriteStatus write_callback(const ::FLAC__Frame *frame, const FLAC__int32 *buffer[]) = 0;
virtual ::FLAC__StreamDecoderWriteStatus write_callback(const ::FLAC__Frame *frame, const FLAC__int32 * const buffer[]) = 0;
virtual void metadata_callback(const ::FLAC__StreamMetaData *metadata) = 0;
virtual void error_callback(::FLAC__StreamDecoderErrorStatus status) = 0;
......@@ -183,7 +183,7 @@ namespace FLAC {
static FLAC__SeekableStreamDecoderTellStatus tell_callback_(const ::FLAC__SeekableStreamDecoder *decoder, FLAC__uint64 *absolute_byte_offset, void *client_data);
static FLAC__SeekableStreamDecoderLengthStatus length_callback_(const ::FLAC__SeekableStreamDecoder *decoder, FLAC__uint64 *stream_length, void *client_data);
static FLAC__bool eof_callback_(const ::FLAC__SeekableStreamDecoder *decoder, void *client_data);
static FLAC__StreamDecoderWriteStatus write_callback_(const ::FLAC__SeekableStreamDecoder *decoder, const ::FLAC__Frame *frame, const FLAC__int32 *buffer[], void *client_data);
static FLAC__StreamDecoderWriteStatus write_callback_(const ::FLAC__SeekableStreamDecoder *decoder, const ::FLAC__Frame *frame, const FLAC__int32 * const buffer[], void *client_data);
static void metadata_callback_(const ::FLAC__SeekableStreamDecoder *decoder, const ::FLAC__StreamMetaData *metadata, void *client_data);
static void error_callback_(const ::FLAC__SeekableStreamDecoder *decoder, ::FLAC__StreamDecoderErrorStatus status, void *client_data);
......@@ -243,13 +243,13 @@ namespace FLAC {
bool seek_absolute(FLAC__uint64 sample);
protected:
virtual ::FLAC__StreamDecoderWriteStatus write_callback(const ::FLAC__Frame *frame, const FLAC__int32 *buffer[]) = 0;
virtual ::FLAC__StreamDecoderWriteStatus write_callback(const ::FLAC__Frame *frame, const FLAC__int32 * const buffer[]) = 0;
virtual void metadata_callback(const ::FLAC__StreamMetaData *metadata) = 0;
virtual void error_callback(::FLAC__StreamDecoderErrorStatus status) = 0;
::FLAC__FileDecoder *decoder_;
private:
static ::FLAC__StreamDecoderWriteStatus write_callback_(const ::FLAC__FileDecoder *decoder, const ::FLAC__Frame *frame, const FLAC__int32 *buffer[], void *client_data);
static ::FLAC__StreamDecoderWriteStatus write_callback_(const ::FLAC__FileDecoder *decoder, const ::FLAC__Frame *frame, const FLAC__int32 * const buffer[], void *client_data);
static void metadata_callback_(const ::FLAC__FileDecoder *decoder, const ::FLAC__StreamMetaData *metadata, void *client_data);
static void error_callback_(const ::FLAC__FileDecoder *decoder, ::FLAC__StreamDecoderErrorStatus status, void *client_data);
......
......@@ -80,7 +80,7 @@ namespace FLAC {
bool set_max_residual_partition_order(unsigned value);
bool set_rice_parameter_search_dist(unsigned value);
bool set_total_samples_estimate(FLAC__uint64 value);
bool set_metadata(FLAC__StreamMetaData **metadata, unsigned num_blocks);
bool set_metadata(::FLAC__StreamMetaData **metadata, unsigned num_blocks);
State get_state() const;
bool get_streamable_subset() const;
......@@ -106,11 +106,11 @@ namespace FLAC {
void finish();
bool process(const FLAC__int32 *buf[], unsigned samples);
bool process_interleaved(const FLAC__int32 buf[], unsigned samples);
bool process(const FLAC__int32 * const buffer[], unsigned samples);
bool process_interleaved(const FLAC__int32 buffer[], unsigned samples);
protected:
virtual ::FLAC__StreamEncoderWriteStatus write_callback(const FLAC__byte buffer[], unsigned bytes, unsigned samples, unsigned current_frame) = 0;
virtual void metadata_callback(const FLAC__StreamMetaData *metadata) = 0;
virtual void metadata_callback(const ::FLAC__StreamMetaData *metadata) = 0;
::FLAC__StreamEncoder *encoder_;
private:
......
......@@ -47,21 +47,28 @@ namespace FLAC {
class Prototype {
protected:
Prototype(::FLAC__StreamMetaData *object, bool copy);
virtual ~Prototype();
void operator=(const Prototype &);
void operator=(const ::FLAC__StreamMetaData &);
void operator=(const ::FLAC__StreamMetaData *);
inline bool operator==(const Prototype &) const;
inline bool operator==(const ::FLAC__StreamMetaData &) const;
inline bool operator==(const ::FLAC__StreamMetaData *) const;
inline bool operator!=(const Prototype &) const;
inline bool operator!=(const ::FLAC__StreamMetaData &) const;
inline bool operator!=(const ::FLAC__StreamMetaData *) const;
virtual void clear();
::FLAC__StreamMetaData *object_;
public:
virtual ~Prototype();
friend class SimpleIterator;
friend class Iterator;
inline bool is_valid() const { return 0 != object_; }
inline operator bool() const { return is_valid(); }
inline bool is_valid() const;
bool get_is_last() const;
FLAC__MetaDataType get_type() const;
......@@ -74,6 +81,28 @@ namespace FLAC {
inline void set_reference(bool x) { is_reference_ = x; }
};
inline bool Prototype::operator==(const Prototype &object) const
{ return ::FLAC__metadata_object_is_equal(object_, object.object_); }
inline bool Prototype::operator==(const ::FLAC__StreamMetaData &object) const
{ return ::FLAC__metadata_object_is_equal(object_, &object); }
inline bool Prototype::operator==(const ::FLAC__StreamMetaData *object) const
{ return ::FLAC__metadata_object_is_equal(object_, object); }
inline bool Prototype::operator!=(const Prototype &object) const
{ return !operator==(object); }
inline bool Prototype::operator!=(const ::FLAC__StreamMetaData &object) const
{ return !operator==(object); }
inline bool Prototype::operator!=(const ::FLAC__StreamMetaData *object) const
{ return !operator==(object); }
inline bool Prototype::is_valid() const
{ return 0 != object_; }
class StreamInfo : public Prototype {
public:
StreamInfo();
......@@ -84,6 +113,13 @@ namespace FLAC {
inline void operator=(const ::FLAC__StreamMetaData &object) { Prototype::operator=(object); }
inline void operator=(const ::FLAC__StreamMetaData *object) { Prototype::operator=(object); }
inline bool operator==(const StreamInfo &object) const { return Prototype::operator==(object); }
inline bool operator==(const ::FLAC__StreamMetaData &object) const { return Prototype::operator==(object); }
inline bool operator==(const ::FLAC__StreamMetaData *object) const { return Prototype::operator==(object); }
inline bool operator!=(const StreamInfo &object) const { return Prototype::operator!=(object); }
inline bool operator!=(const ::FLAC__StreamMetaData &object) const { return Prototype::operator==(object); }
inline bool operator!=(const ::FLAC__StreamMetaData *object) const { return Prototype::operator==(object); }
unsigned get_min_blocksize() const;
unsigned get_max_blocksize() const;
unsigned get_min_framesize() const;
......@@ -115,6 +151,13 @@ namespace FLAC {
inline void operator=(const ::FLAC__StreamMetaData &object) { Prototype::operator=(object); }
inline void operator=(const ::FLAC__StreamMetaData *object) { Prototype::operator=(object); }
inline bool operator==(const Padding &object) const { return Prototype::operator==(object); }
inline bool operator==(const ::FLAC__StreamMetaData &object) const { return Prototype::operator==(object); }
inline bool operator==(const ::FLAC__StreamMetaData *object) const { return Prototype::operator==(object); }
inline bool operator!=(const Padding &object) const { return Prototype::operator!=(object); }
inline bool operator!=(const ::FLAC__StreamMetaData &object) const { return Prototype::operator==(object); }
inline bool operator!=(const ::FLAC__StreamMetaData *object) const { return Prototype::operator==(object); }
void set_length(unsigned length);
};
......@@ -128,6 +171,13 @@ namespace FLAC {
inline void operator=(const ::FLAC__StreamMetaData &object) { Prototype::operator=(object); }
inline void operator=(const ::FLAC__StreamMetaData *object) { Prototype::operator=(object); }
inline bool operator==(const Application &object) const { return Prototype::operator==(object); }
inline bool operator==(const ::FLAC__StreamMetaData &object) const { return Prototype::operator==(object); }
inline bool operator==(const ::FLAC__StreamMetaData *object) const { return Prototype::operator==(object); }
inline bool operator!=(const Application &object) const { return Prototype::operator!=(object); }
inline bool operator!=(const ::FLAC__StreamMetaData &object) const { return Prototype::operator==(object); }
inline bool operator!=(const ::FLAC__StreamMetaData *object) const { return Prototype::operator==(object); }
const FLAC__byte *get_id() const;
const FLAC__byte *get_data() const;
......@@ -145,6 +195,13 @@ namespace FLAC {
inline void operator=(const ::FLAC__StreamMetaData &object) { Prototype::operator=(object); }
inline void operator=(const ::FLAC__StreamMetaData *object) { Prototype::operator=(object); }
inline bool operator==(const SeekTable &object) const { return Prototype::operator==(object); }
inline bool operator==(const ::FLAC__StreamMetaData &object) const { return Prototype::operator==(object); }
inline bool operator==(const ::FLAC__StreamMetaData *object) const { return Prototype::operator==(object); }
inline bool operator!=(const SeekTable &object) const { return Prototype::operator!=(object); }
inline bool operator!=(const ::FLAC__StreamMetaData &object) const { return Prototype::operator==(object); }
inline bool operator!=(const ::FLAC__StreamMetaData *object) const { return Prototype::operator==(object); }
unsigned get_num_points() const;
::FLAC__StreamMetaData_SeekPoint get_point(unsigned index) const;
......@@ -168,7 +225,6 @@ namespace FLAC {
virtual ~Entry();
virtual bool is_valid() const;
inline operator bool() const { return is_valid(); }
unsigned get_field_length() const;
unsigned get_field_name_length() const;
......@@ -209,6 +265,13 @@ namespace FLAC {
inline void operator=(const ::FLAC__StreamMetaData &object) { Prototype::operator=(object); }
inline void operator=(const ::FLAC__StreamMetaData *object) { Prototype::operator=(object); }
inline bool operator==(const VorbisComment &object) const { return Prototype::operator==(object); }
inline bool operator==(const ::FLAC__StreamMetaData &object) const { return Prototype::operator==(object); }
inline bool operator==(const ::FLAC__StreamMetaData *object) const { return Prototype::operator==(object); }
inline bool operator!=(const VorbisComment &object) const { return Prototype::operator!=(object); }
inline bool operator!=(const ::FLAC__StreamMetaData &object) const { return Prototype::operator==(object); }
inline bool operator!=(const ::FLAC__StreamMetaData *object) const { return Prototype::operator==(object); }
unsigned get_num_comments() const;
Entry get_vendor_string() const;
Entry get_comment(unsigned index) const;
......@@ -274,7 +337,6 @@ namespace FLAC {
bool init(const char *filename, bool preserve_file_stats = false);
bool is_valid() const;
inline operator bool() const { return is_valid(); }
Status status();
bool is_writable() const;
......@@ -347,7 +409,6 @@ namespace FLAC {
friend class Iterator;
bool is_valid() const;
inline operator bool() const { return is_valid(); }
Status status();
bool read(const char *filename);
......@@ -367,7 +428,6 @@ namespace FLAC {
virtual ~Iterator();
bool is_valid() const;
inline operator bool() const { return is_valid(); }
void init(Chain *chain);
......
......@@ -37,7 +37,7 @@ typedef enum {
FLAC__FILE_DECODER_INVALID_CALLBACK,
FLAC__FILE_DECODER_UNINITIALIZED
} FLAC__FileDecoderState;
extern const char *FLAC__FileDecoderStateString[];
extern const char * const FLAC__FileDecoderStateString[];
/***********************************************************************
*
......@@ -99,7 +99,7 @@ void FLAC__file_decoder_delete(FLAC__FileDecoder *);
*/
FLAC__bool FLAC__file_decoder_set_md5_checking(FLAC__FileDecoder *decoder, FLAC__bool value);
FLAC__bool FLAC__file_decoder_set_filename(FLAC__FileDecoder *decoder, const char *value); /* 'value' may not be 0; use "-" for stdin */
FLAC__bool FLAC__file_decoder_set_write_callback(FLAC__FileDecoder *decoder, FLAC__StreamDecoderWriteStatus (*value)(const FLAC__FileDecoder *decoder, const FLAC__Frame *frame, const FLAC__int32 *buffer[], void *client_data));
FLAC__bool FLAC__file_decoder_set_write_callback(FLAC__FileDecoder *decoder, FLAC__StreamDecoderWriteStatus (*value)(const FLAC__FileDecoder *decoder, const FLAC__Frame *frame, const FLAC__int32 * const buffer[], void *client_data));
FLAC__bool FLAC__file_decoder_set_metadata_callback(FLAC__FileDecoder *decoder, void (*value)(const FLAC__FileDecoder *decoder, const FLAC__StreamMetaData *metadata, void *client_data));
FLAC__bool FLAC__file_decoder_set_error_callback(FLAC__FileDecoder *decoder, void (*value)(const FLAC__FileDecoder *decoder, FLAC__StreamDecoderErrorStatus status, void *client_data));
FLAC__bool FLAC__file_decoder_set_client_data(FLAC__FileDecoder *decoder, void *value);
......
......@@ -84,7 +84,7 @@ extern const unsigned FLAC__STREAM_SYNC_LEN; /* = 32 bits */;
typedef enum {
FLAC__ENTROPY_CODING_METHOD_PARTITIONED_RICE = 0
} FLAC__EntropyCodingMethodType;
extern const char *FLAC__EntropyCodingMethodTypeString[];
extern const char * const FLAC__EntropyCodingMethodTypeString[];
/*****************************************************************************
*
......@@ -126,7 +126,7 @@ typedef enum {
FLAC__SUBFRAME_TYPE_FIXED = 2,
FLAC__SUBFRAME_TYPE_LPC = 3
} FLAC__SubframeType;
extern const char *FLAC__SubframeTypeString[];
extern const char * const FLAC__SubframeTypeString[];
/*****************************************************************************
*
......@@ -233,13 +233,13 @@ typedef enum {
FLAC__CHANNEL_ASSIGNMENT_RIGHT_SIDE = 2,
FLAC__CHANNEL_ASSIGNMENT_MID_SIDE = 3
} FLAC__ChannelAssignment;
extern const char *FLAC__ChannelAssignmentString[];
extern const char * const FLAC__ChannelAssignmentString[];
typedef enum {
FLAC__FRAME_NUMBER_TYPE_FRAME_NUMBER,
FLAC__FRAME_NUMBER_TYPE_SAMPLE_NUMBER
} FLAC__FrameNumberType;
extern const char *FLAC__FrameNumberTypeString[];
extern const char * const FLAC__FrameNumberTypeString[];
/*****************************************************************************
*
......@@ -351,7 +351,7 @@ typedef enum {
FLAC__METADATA_TYPE_SEEKTABLE = 3,
FLAC__METADATA_TYPE_VORBIS_COMMENT = 4
} FLAC__MetaDataType;
extern const char *FLAC__MetaDataTypeString[];
extern const char * const FLAC__MetaDataTypeString[];
/*****************************************************************************
*
......
......@@ -24,7 +24,7 @@
/******************************************************************************
(For an example of how all these routines are used, see the source
code for the unit tests in src/test_unit/metadata_*.c, or metaflac
code for the unit tests in src/test_libFLAC/metadata_*.c, or metaflac
in src/metaflac/)
******************************************************************************/
......@@ -146,7 +146,7 @@ typedef enum {
FLAC__METADATA_SIMPLE_ITERATOR_STATUS_MEMORY_ALLOCATION_ERROR,
FLAC__METADATA_SIMPLE_ITERATOR_STATUS_INTERNAL_ERROR
} FLAC__MetaData_SimpleIteratorStatus;
extern const char *FLAC__MetaData_SimpleIteratorStatusString[];
extern const char * const FLAC__MetaData_SimpleIteratorStatusString[];
/*
* Constructor/destructor
......@@ -335,7 +335,7 @@ typedef enum {
FLAC__METADATA_CHAIN_STATUS_MEMORY_ALLOCATION_ERROR,
FLAC__METADATA_CHAIN_STATUS_INTERNAL_ERROR
} FLAC__MetaData_ChainStatus;
extern const char *FLAC__MetaData_ChainStatusString[];
extern const char * const FLAC__MetaData_ChainStatusString[];
/*********** FLAC__MetaData_Chain ***********/
......@@ -518,6 +518,8 @@ FLAC__bool FLAC__metadata_iterator_insert_block_after(FLAC__MetaData_Iterator *i
FLAC__StreamMetaData *FLAC__metadata_object_new(FLAC__MetaDataType type);
FLAC__StreamMetaData *FLAC__metadata_object_copy(const FLAC__StreamMetaData *object);
void FLAC__metadata_object_delete(FLAC__StreamMetaData *object);
/* Does a deep comparison of the block data */
FLAC__bool FLAC__metadata_object_is_equal(const FLAC__StreamMetaData *block1, const FLAC__StreamMetaData *block2);
/******************************************************************
* FLAC__StreamMetaData_Application
......
......@@ -39,31 +39,31 @@ typedef enum {
FLAC__SEEKABLE_STREAM_DECODER_INVALID_CALLBACK,
FLAC__SEEKABLE_STREAM_DECODER_UNINITIALIZED
} FLAC__SeekableStreamDecoderState;
extern const char *FLAC__SeekableStreamDecoderStateString[];
extern const char * const FLAC__SeekableStreamDecoderStateString[];
typedef enum {
FLAC__SEEKABLE_STREAM_DECODER_READ_STATUS_OK,
FLAC__SEEKABLE_STREAM_DECODER_READ_STATUS_ERROR
} FLAC__SeekableStreamDecoderReadStatus;
extern const char *FLAC__SeekableStreamDecoderReadStatusString[];
extern const char * const FLAC__SeekableStreamDecoderReadStatusString[];
typedef enum {
FLAC__SEEKABLE_STREAM_DECODER_SEEK_STATUS_OK,
FLAC__SEEKABLE_STREAM_DECODER_SEEK_STATUS_ERROR
} FLAC__SeekableStreamDecoderSeekStatus;
extern const char *FLAC__SeekableStreamDecoderSeekStatusString[];
extern const char * const FLAC__SeekableStreamDecoderSeekStatusString[];
typedef enum {
FLAC__SEEKABLE_STREAM_DECODER_TELL_STATUS_OK,
FLAC__SEEKABLE_STREAM_DECODER_TELL_STATUS_ERROR
} FLAC__SeekableStreamDecoderTellStatus;
extern const char *FLAC__SeekableStreamDecoderTellStatusString[];
extern const char * const FLAC__SeekableStreamDecoderTellStatusString[];
typedef enum {
FLAC__SEEKABLE_STREAM_DECODER_LENGTH_STATUS_OK,
FLAC__SEEKABLE_STREAM_DECODER_LENGTH_STATUS_ERROR
} FLAC__SeekableStreamDecoderLengthStatus;
extern const char *FLAC__SeekableStreamDecoderLengthStatusString[];
extern const char * const FLAC__SeekableStreamDecoderLengthStatusString[];
/***********************************************************************
*
......@@ -134,7 +134,7 @@ FLAC__bool FLAC__seekable_stream_decoder_set_seek_callback(FLAC__SeekableStreamD
FLAC__bool FLAC__seekable_stream_decoder_set_tell_callback(FLAC__SeekableStreamDecoder *decoder, FLAC__SeekableStreamDecoderTellStatus (*value)(const FLAC__SeekableStreamDecoder *decoder, FLAC__uint64 *absolute_byte_offset, void *client_data));
FLAC__bool FLAC__seekable_stream_decoder_set_length_callback(FLAC__SeekableStreamDecoder *decoder, FLAC__SeekableStreamDecoderLengthStatus (*value)(const FLAC__SeekableStreamDecoder *decoder, FLAC__uint64 *stream_length, void *client_data));
FLAC__bool FLAC__seekable_stream_decoder_set_eof_callback(FLAC__SeekableStreamDecoder *decoder, FLAC__bool (*value)(const FLAC__SeekableStreamDecoder *decoder, void *client_data));
FLAC__bool FLAC__seekable_stream_decoder_set_write_callback(FLAC__SeekableStreamDecoder *decoder, FLAC__StreamDecoderWriteStatus (*value)(const FLAC__SeekableStreamDecoder *decoder, const FLAC__Frame *frame, const FLAC__int32 *buffer[], void *client_data));
FLAC__bool FLAC__seekable_stream_decoder_set_write_callback(FLAC__SeekableStreamDecoder *decoder, FLAC__StreamDecoderWriteStatus (*value)(const FLAC__SeekableStreamDecoder *decoder, const FLAC__Frame *frame, const FLAC__int32 * const buffer[], void *client_data));
FLAC__bool FLAC__seekable_stream_decoder_set_metadata_callback(FLAC__SeekableStreamDecoder *decoder, void (*value)(const FLAC__SeekableStreamDecoder *decoder, const FLAC__StreamMetaData *metadata, void *client_data));
FLAC__bool FLAC__seekable_stream_decoder_set_error_callback(FLAC__SeekableStreamDecoder *decoder, void (*value)(const FLAC__SeekableStreamDecoder *decoder, FLAC__StreamDecoderErrorStatus status, void *client_data));
FLAC__bool FLAC__seekable_stream_decoder_set_client_data(FLAC__SeekableStreamDecoder *decoder, void *value);
......
......@@ -40,27 +40,27 @@ typedef enum {
FLAC__STREAM_DECODER_INVALID_CALLBACK,
FLAC__STREAM_DECODER_UNINITIALIZED
} FLAC__StreamDecoderState;
extern const char *FLAC__StreamDecoderStateString[];
extern const char * const FLAC__StreamDecoderStateString[];
typedef enum {
FLAC__STREAM_DECODER_READ_STATUS_CONTINUE,
FLAC__STREAM_DECODER_READ_STATUS_END_OF_STREAM,
FLAC__STREAM_DECODER_READ_STATUS_ABORT
} FLAC__StreamDecoderReadStatus;
extern const char *FLAC__StreamDecoderReadStatusString[];
extern const char * const FLAC__StreamDecoderReadStatusString[];
typedef enum {
FLAC__STREAM_DECODER_WRITE_STATUS_CONTINUE,
FLAC__STREAM_DECODER_WRITE_STATUS_ABORT
} FLAC__StreamDecoderWriteStatus;
extern const char *FLAC__StreamDecoderWriteStatusString[];
extern const char * const FLAC__StreamDecoderWriteStatusString[];
typedef enum {
FLAC__STREAM_DECODER_ERROR_STATUS_LOST_SYNC,
FLAC__STREAM_DECODER_ERROR_STATUS_BAD_HEADER,
FLAC__STREAM_DECODER_ERROR_STATUS_FRAME_CRC_MISMATCH
} FLAC__StreamDecoderErrorStatus;
extern const char *FLAC__StreamDecoderErrorStatusString[];
extern const char * const FLAC__StreamDecoderErrorStatusString[];
/***********************************************************************
*
......@@ -121,7 +121,7 @@ void FLAC__stream_decoder_delete(FLAC__StreamDecoder *);
@@@@ update defaults above and in documentation.html about the metadata_respond/ignore defaults
*/
FLAC__bool FLAC__stream_decoder_set_read_callback(FLAC__StreamDecoder *decoder, FLAC__StreamDecoderReadStatus (*value)(const FLAC__StreamDecoder *decoder, FLAC__byte buffer[], unsigned *bytes, void *client_data));
FLAC__bool FLAC__stream_decoder_set_write_callback(FLAC__StreamDecoder *decoder, FLAC__StreamDecoderWriteStatus (*value)(const FLAC__StreamDecoder *decoder, const FLAC__Frame *frame, const FLAC__int32 *buffer[], void *client_data));
FLAC__bool FLAC__stream_decoder_set_write_callback(FLAC__StreamDecoder *decoder, FLAC__StreamDecoderWriteStatus (*value)(const FLAC__StreamDecoder *decoder, const FLAC__Frame *frame, const FLAC__int32 * const buffer[], void *client_data));
FLAC__bool FLAC__stream_decoder_set_metadata_callback(FLAC__StreamDecoder *decoder, void (*value)(const FLAC__StreamDecoder *decoder, const FLAC__StreamMetaData *metadata, void *client_data));
FLAC__bool FLAC__stream_decoder_set_error_callback(FLAC__StreamDecoder *decoder, void (*value)(const FLAC__StreamDecoder *decoder, FLAC__StreamDecoderErrorStatus status, void *client_data));
FLAC__bool FLAC__stream_decoder_set_client_data(FLAC__StreamDecoder *decoder, void *value);
......
......@@ -48,13 +48,13 @@ typedef enum {
FLAC__STREAM_ENCODER_ALREADY_INITIALIZED,
FLAC__STREAM_ENCODER_UNINITIALIZED
} FLAC__StreamEncoderState;
extern const char *FLAC__StreamEncoderStateString[];
extern const char * const FLAC__StreamEncoderStateString[];
typedef enum {
FLAC__STREAM_ENCODER_WRITE_OK = 0,
FLAC__STREAM_ENCODER_WRITE_FATAL_ERROR
} FLAC__StreamEncoderWriteStatus;
extern const char *FLAC__StreamEncoderWriteStatusString[];
extern const char * const FLAC__StreamEncoderWriteStatusString[];
/***********************************************************************
*
......@@ -189,8 +189,8 @@ void FLAC__stream_encoder_finish(FLAC__StreamEncoder *encoder);
/*
* Methods for encoding the data
*/
FLAC__bool FLAC__stream_encoder_process(FLAC__StreamEncoder *encoder, const FLAC__int32 *buf[], unsigned samples);
FLAC__bool FLAC__stream_encoder_process_interleaved(FLAC__StreamEncoder *encoder, const FLAC__int32 buf[], unsigned samples);
FLAC__bool FLAC__stream_encoder_process(FLAC__StreamEncoder *encoder, const FLAC__int32 * const buffer[], unsigned samples);
FLAC__bool FLAC__stream_encoder_process_interleaved(FLAC__StreamEncoder *encoder, const FLAC__int32 buffer[], unsigned samples);
#ifdef __cplusplus
}
......
......@@ -19,4 +19,4 @@ if FLaC__HAS_XMMS
XMMS_DIRS = plugin_xmms
endif
SUBDIRS = libFLAC libFLAC++ share flac metaflac $(XMMS_DIRS) test_streams test_unit
SUBDIRS = libFLAC libFLAC++ share flac metaflac $(XMMS_DIRS) test_libFLAC test_libFLAC++ test_streams
......@@ -518,10 +518,9 @@ FLAC__bool init(const char *infilename, stream_info_struct *stream_info)
FLAC__file_decoder_set_filename(stream_info->decoder.file, infilename);
/*
* The three ugly casts here are to 'downcast' the 'void *' argument of
* the callback down to 'FLAC__FileDecoder *'. In C++ this would be
* unnecessary but here the cast makes the C compiler happy.
* the callback down to 'FLAC__FileDecoder *'.
*/
FLAC__file_decoder_set_write_callback(stream_info->decoder.file, (FLAC__StreamDecoderWriteStatus (*)(const FLAC__FileDecoder *, const FLAC__Frame *, const FLAC__int32 *[], void *))write_callback);
FLAC__file_decoder_set_write_callback(stream_info->decoder.file, (FLAC__StreamDecoderWriteStatus (*)(const FLAC__FileDecoder *, const FLAC__Frame *, const FLAC__int32 * const [], void *))write_callback);
FLAC__file_decoder_set_metadata_callback(stream_info->decoder.file, (void (*)(const FLAC__FileDecoder *, const FLAC__StreamMetaData *, void *))metadata_callback);
FLAC__file_decoder_set_error_callback(stream_info->decoder.file, (void (*)(const FLAC__FileDecoder *, FLAC__StreamDecoderErrorStatus, void *))error_callback);
FLAC__file_decoder_set_client_data(stream_info->decoder.file, stream_info);
......
......@@ -111,11 +111,11 @@ static FLAC__bool convert_to_seek_table(char *requested_seek_points, int num_req
static void append_point_to_seek_table(FLAC__StreamMetaData_SeekTable *seek_table, FLAC__uint64 sample, FLAC__uint64 stream_samples, FLAC__uint64 blocksize);
static int seekpoint_compare(const FLAC__StreamMetaData_SeekPoint *l, const FLAC__StreamMetaData_SeekPoint *r);
static void format_input(FLAC__int32 *dest[], unsigned wide_samples, FLAC__bool is_big_endian, FLAC__bool is_unsigned_samples, unsigned channels, unsigned bps, encoder_wrapper_struct *encoder_wrapper);
static void append_to_verify_fifo(encoder_wrapper_struct *encoder_wrapper, const FLAC__int32 *input[], unsigned channels, unsigned wide_samples);
static void append_to_verify_fifo(encoder_wrapper_struct *encoder_wrapper, const FLAC__int32 * const input[], unsigned channels, unsigned wide_samples);
static FLAC__StreamEncoderWriteStatus write_callback(const FLAC__StreamEncoder *encoder, const FLAC__byte buffer[], unsigned bytes, unsigned samples, unsigned current_frame, void *client_data);
static void metadata_callback(const FLAC__StreamEncoder *encoder, const FLAC__StreamMetaData *metadata, void *client_data);
static FLAC__StreamDecoderReadStatus verify_read_callback(const FLAC__StreamDecoder *decoder, FLAC__byte buffer[], unsigned *bytes, void *client_data);
static FLAC__StreamDecoderWriteStatus verify_write_callback(const FLAC__StreamDecoder *decoder, const FLAC__Frame *frame, const FLAC__int32 *buffer[], void *client_data);
static FLAC__StreamDecoderWriteStatus verify_write_callback(const FLAC__StreamDecoder *decoder, const FLAC__Frame *frame, const FLAC__int32 * const buffer[], void *client_data);
static void verify_metadata_callback(const FLAC__StreamDecoder *decoder, const FLAC__StreamMetaData *metadata, void *client_data);
static void verify_error_callback(const FLAC__StreamDecoder *decoder, FLAC__StreamDecoderErrorStatus status, void *client_data);
static void print_stats(const encoder_wrapper_struct *encoder_wrapper);
......@@ -311,11 +311,9 @@ int flac__encode_wav(FILE *infile, long infilesize, const char *infilename, cons
* first do any samples in the reservoir
*/
if(options.sector_align && *options.align_reservoir_samples > 0) {
/* NOTE: some versions of GCC can't figure out const-ness right and will give you an 'incompatible pointer type' warning on arg 2 here: */
append_to_verify_fifo(&encoder_wrapper, options.align_reservoir, channels, *options.align_reservoir_samples);
append_to_verify_fifo(&encoder_wrapper, (const FLAC__int32 * const *)options.align_reservoir, channels, *options.align_reservoir_samples);
/* NOTE: some versions of GCC can't figure out const-ness right and will give you an 'incompatible pointer type' warning on arg 2 here: */
if(!FLAC__stream_encoder_process(encoder_wrapper.encoder, options.align_reservoir, *options.align_reservoir_samples)) {
if(!FLAC__stream_encoder_process(encoder_wrapper.encoder, (const FLAC__int32 * const *)options.align_reservoir, *options.align_reservoir_samples)) {
fprintf(stderr, "%s: ERROR during encoding, state = %d:%s\n", encoder_wrapper.inbasefilename, FLAC__stream_encoder_get_state(encoder_wrapper.encoder), FLAC__StreamEncoderStateString[FLAC__stream_encoder_get_state(encoder_wrapper.encoder)]);
goto wav_abort_;
}
......@@ -358,8 +356,7 @@ int flac__encode_wav(FILE *infile, long infilesize, const char *infilename, cons
unsigned wide_samples = bytes_read / bytes_per_wide_sample;
format_input(input, wide_samples, false, is_unsigned_samples, channels, bps, &encoder_wrapper);
/* NOTE: some versions of GCC can't figure out const-ness right and will give you an 'incompatible pointer type' warning on arg 2 here: */
if(!FLAC__stream_encoder_process(encoder_wrapper.encoder, input, wide_samples)) {
if(!FLAC__stream_encoder_process(encoder_wrapper.encoder, (const FLAC__int32 * const *)input, wide_samples)) {
fprintf(stderr, "%s: ERROR during encoding, state = %d:%s\n", encoder_wrapper.inbasefilename, FLAC__stream_encoder_get_state(encoder_wrapper.encoder), FLAC__StreamEncoderStateString[FLAC__stream_encoder_get_state(encoder_wrapper.encoder)]);
goto wav_abort_;
}
......@@ -381,11 +378,9 @@ int flac__encode_wav(FILE *infile, long infilesize, const char *infilename, cons
data_bytes = wide_samples * bytes_per_wide_sample;
for(channel = 0; channel < channels; channel++)
memset(input[channel], 0, data_bytes);
/* NOTE: some versions of GCC can't figure out const-ness right and will give you an 'incompatible pointer type' warning on arg 2 here: */
appen