diff options
61 files changed, 2276 insertions, 1643 deletions
@@ -30,7 +30,7 @@ and Winamp, licensed under the GPL; and 5) documentation, licensed under the GNU Free Documentation License. ============ -FLAC - 1.0.3 +FLAC - 1.0.3_beta ============ This is the source release for the FLAC project. See diff --git a/build/config.mk b/build/config.mk index 0e019984..53db714f 100644 --- a/build/config.mk +++ b/build/config.mk @@ -19,7 +19,7 @@ # GNU makefile fragment for emulating stuff normally done by configure # -VERSION=\"1.0.3\" +VERSION=\"1.0.3_beta\" ORDINALS_H = ../../include/FLAC/ordinals.h diff --git a/configure.in b/configure.in index 66af86c9..1f260da1 100644 --- a/configure.in +++ b/configure.in @@ -19,7 +19,7 @@ # instead of FLAC__ since autoconf triggers off 'AC_' in strings AC_INIT(src/flac/main.c) -AM_INIT_AUTOMAKE(flac, 1.0.3) +AM_INIT_AUTOMAKE(flac, 1.0.3_beta) # We need two libtools, one that builds both shared and static, and # one that builds only static. This is because the resulting libtool diff --git a/doc/documentation.html b/doc/documentation.html index 8d0130b0..f0c42c18 100644 --- a/doc/documentation.html +++ b/doc/documentation.html @@ -875,7 +875,7 @@ <UL> <LI>Read callback - This function will be called when the decoder needs more input data. The address of the buffer to be filled is supplied, along with the number of bytes the buffer can hold. The callback may choose to supply less data and modify the byte count but must be careful not to overflow the buffer. The callback then returns a status code chosen from FLAC__StreamDecoderReadStatus.</LI> <LI>Write callback - This function will be called when the decoder has decoded a single frame of data. The decoder will pass the frame metadata as well as an array of pointers (one for each channel) pointing to the decoded audio.</LI> - <LI>Metadata callback - This function will be called when the decoder has decoded a metadata block. There will always be one STREAMINFO block per stream, followed by zero or more other metadata blocks. These will be supplied by the decoder in the same order as they appear in the stream and always before the first audio frame. The metadata block that is passed in must not be modified, and it doesn't live beyond the callback, so you should make a copy of it with <TT>FLAC__metadata_object_copy()</TT> if you will need it elsewhere.</LI> + <LI>Metadata callback - This function will be called when the decoder has decoded a metadata block. There will always be one STREAMINFO block per stream, followed by zero or more other metadata blocks. These will be supplied by the decoder in the same order as they appear in the stream and always before the first audio frame. The metadata block that is passed in must not be modified, and it doesn't live beyond the callback, so you should make a copy of it with <TT>FLAC__metadata_object_clone()</TT> if you will need it elsewhere.</LI> <LI>Error callback - This function will be called whenever an error occurs during decoding.</LI> </UL> </P> diff --git a/flac.pbproj/project.pbxproj b/flac.pbproj/project.pbxproj index c9b93a07..35ce5cdf 100644 --- a/flac.pbproj/project.pbxproj +++ b/flac.pbproj/project.pbxproj @@ -865,7 +865,7 @@ buildSettings = { HEADER_SEARCH_PATHS = include; OPTIMIZATION_CFLAGS = "-O3"; - OTHER_CFLAGS = "-DFLAC__VERSION_STRING=\\\\\\\"1.0.3\\\\\\\""; + OTHER_CFLAGS = "-DFLAC__VERSION_STRING=\\\\\\\"1.0.3_beta\\\\\\\""; OTHER_LDFLAGS = ""; OTHER_REZFLAGS = ""; PRODUCT_NAME = flac; @@ -995,7 +995,7 @@ buildSettings = { HEADER_SEARCH_PATHS = include; OPTIMIZATION_CFLAGS = "-O3"; - OTHER_CFLAGS = "-DFLAC__VERSION_STRING=\\\\\\\"1.0.3\\\\\\\""; + OTHER_CFLAGS = "-DFLAC__VERSION_STRING=\\\\\\\"1.0.3_beta\\\\\\\""; OTHER_LDFLAGS = ""; OTHER_REZFLAGS = ""; PRODUCT_NAME = metaflac; diff --git a/include/FLAC++/decoder.h b/include/FLAC++/decoder.h index 4d29cb62..de8884d9 100644 --- a/include/FLAC++/decoder.h +++ b/include/FLAC++/decoder.h @@ -68,10 +68,10 @@ namespace FLAC { bool is_valid() const; inline operator bool() const { return is_valid(); } - bool set_metadata_respond(::FLAC__MetaDataType type); + bool set_metadata_respond(::FLAC__MetadataType type); bool set_metadata_respond_application(const FLAC__byte id[4]); bool set_metadata_respond_all(); - bool set_metadata_ignore(::FLAC__MetaDataType type); + bool set_metadata_ignore(::FLAC__MetadataType type); bool set_metadata_ignore_application(const FLAC__byte id[4]); bool set_metadata_ignore_all(); @@ -99,14 +99,14 @@ namespace FLAC { protected: virtual ::FLAC__StreamDecoderReadStatus read_callback(FLAC__byte buffer[], unsigned *bytes) = 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 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 * const buffer[], void *client_data); - static void metadata_callback_(const ::FLAC__StreamDecoder *decoder, const ::FLAC__StreamMetaData *metadata, 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); // Private and undefined so you can't use them: @@ -138,10 +138,10 @@ namespace FLAC { inline operator bool() const { return is_valid(); } bool set_md5_checking(bool value); - bool set_metadata_respond(::FLAC__MetaDataType type); + bool set_metadata_respond(::FLAC__MetadataType type); bool set_metadata_respond_application(const FLAC__byte id[4]); bool set_metadata_respond_all(); - bool set_metadata_ignore(::FLAC__MetaDataType type); + bool set_metadata_ignore(::FLAC__MetadataType type); bool set_metadata_ignore_application(const FLAC__byte id[4]); bool set_metadata_ignore_all(); @@ -173,7 +173,7 @@ namespace FLAC { 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 * const buffer[]) = 0; - virtual void metadata_callback(const ::FLAC__StreamMetaData *metadata) = 0; + virtual void metadata_callback(const ::FLAC__StreamMetadata *metadata) = 0; virtual void error_callback(::FLAC__StreamDecoderErrorStatus status) = 0; ::FLAC__SeekableStreamDecoder *decoder_; @@ -184,7 +184,7 @@ namespace FLAC { 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 * const buffer[], void *client_data); - static void metadata_callback_(const ::FLAC__SeekableStreamDecoder *decoder, const ::FLAC__StreamMetaData *metadata, 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); // Private and undefined so you can't use them: @@ -217,10 +217,10 @@ namespace FLAC { bool set_md5_checking(bool value); bool set_filename(const char *value); // 'value' may not be 0; use "-" for stdin - bool set_metadata_respond(::FLAC__MetaDataType type); + bool set_metadata_respond(::FLAC__MetadataType type); bool set_metadata_respond_application(const FLAC__byte id[4]); bool set_metadata_respond_all(); - bool set_metadata_ignore(::FLAC__MetaDataType type); + bool set_metadata_ignore(::FLAC__MetadataType type); bool set_metadata_ignore_application(const FLAC__byte id[4]); bool set_metadata_ignore_all(); @@ -244,13 +244,13 @@ namespace FLAC { bool seek_absolute(FLAC__uint64 sample); protected: 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 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 * const buffer[], void *client_data); - static void metadata_callback_(const ::FLAC__FileDecoder *decoder, const ::FLAC__StreamMetaData *metadata, 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); // Private and undefined so you can't use them: diff --git a/include/FLAC++/encoder.h b/include/FLAC++/encoder.h index 69005fa7..dca7d4cc 100644 --- a/include/FLAC++/encoder.h +++ b/include/FLAC++/encoder.h @@ -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; @@ -110,12 +110,12 @@ namespace FLAC { 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: 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 void metadata_callback_(const ::FLAC__StreamEncoder *encoder, const ::FLAC__StreamMetadata *metadata, void *client_data); // Private and undefined so you can't use them: Stream(const Stream &); diff --git a/include/FLAC++/metadata.h b/include/FLAC++/metadata.h index fa741884..28aa2514 100644 --- a/include/FLAC++/metadata.h +++ b/include/FLAC++/metadata.h @@ -39,6 +39,10 @@ namespace FLAC { // // ============================================================ + class Prototype; + + Prototype *clone(const Prototype *); + // NOTE: When the get_*() methods return you a const pointer, // DO NOT disobey and write into it. Always use the set_*() // methods. @@ -46,33 +50,38 @@ namespace FLAC { // base class for all metadata blocks class Prototype { protected: - Prototype(::FLAC__StreamMetaData *object, bool copy); + Prototype(const Prototype &object); // this form always copies object.object_ + Prototype(const ::FLAC__StreamMetadata &object); // this form always copies + Prototype(const ::FLAC__StreamMetadata *object); // this form always copies + Prototype(::FLAC__StreamMetadata *object, bool copy); // this form allows you to pass ownership to the Prototype using copy=false 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; + void operator=(const ::FLAC__StreamMetadata &); // this form always copies + void operator=(const ::FLAC__StreamMetadata *); // this form always copies virtual void clear(); - ::FLAC__StreamMetaData *object_; + ::FLAC__StreamMetadata *object_; public: virtual ~Prototype(); + 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; + friend class SimpleIterator; friend class Iterator; inline bool is_valid() const; bool get_is_last() const; - FLAC__MetaDataType get_type() const; + FLAC__MetadataType get_type() const; unsigned get_length() const; // NOTE: does not include the header, per spec + + void set_is_last(bool); private: Prototype(); // Private and undefined so you can't use it @@ -84,19 +93,19 @@ namespace FLAC { 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 + 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 + 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 + inline bool Prototype::operator!=(const ::FLAC__StreamMetadata &object) const { return !operator==(object); } - inline bool Prototype::operator!=(const ::FLAC__StreamMetaData *object) const + inline bool Prototype::operator!=(const ::FLAC__StreamMetadata *object) const { return !operator==(object); } inline bool Prototype::is_valid() const @@ -106,19 +115,22 @@ namespace FLAC { class StreamInfo : public Prototype { public: StreamInfo(); - StreamInfo(::FLAC__StreamMetaData *object, bool copy = false); + inline StreamInfo(const StreamInfo &object): Prototype(object) { } + inline StreamInfo(const ::FLAC__StreamMetadata &object): Prototype(object) { } + inline StreamInfo(const ::FLAC__StreamMetadata *object): Prototype(object) { } + inline StreamInfo(::FLAC__StreamMetadata *object, bool copy): Prototype(object, copy) { } ~StreamInfo(); inline void operator=(const StreamInfo &object) { Prototype::operator=(object); } - inline void operator=(const ::FLAC__StreamMetaData &object) { Prototype::operator=(object); } - inline void operator=(const ::FLAC__StreamMetaData *object) { Prototype::operator=(object); } + 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 ::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); } + 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; @@ -144,19 +156,22 @@ namespace FLAC { class Padding : public Prototype { public: Padding(); - Padding(::FLAC__StreamMetaData *object, bool copy = false); + inline Padding(const Padding &object): Prototype(object) { } + inline Padding(const ::FLAC__StreamMetadata &object): Prototype(object) { } + inline Padding(const ::FLAC__StreamMetadata *object): Prototype(object) { } + inline Padding(::FLAC__StreamMetadata *object, bool copy): Prototype(object, copy) { } ~Padding(); inline void operator=(const Padding &object) { Prototype::operator=(object); } - inline void operator=(const ::FLAC__StreamMetaData &object) { Prototype::operator=(object); } - inline void operator=(const ::FLAC__StreamMetaData *object) { Prototype::operator=(object); } + 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 ::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); } + 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); }; @@ -164,49 +179,56 @@ namespace FLAC { class Application : public Prototype { public: Application(); - Application(::FLAC__StreamMetaData *object, bool copy = false); + inline Application(const Application &object): Prototype(object) { } + inline Application(const ::FLAC__StreamMetadata &object): Prototype(object) { } + inline Application(const ::FLAC__StreamMetadata *object): Prototype(object) { } + inline Application(::FLAC__StreamMetadata *object, bool copy): Prototype(object, copy) { } ~Application(); inline void operator=(const Application &object) { Prototype::operator=(object); } - inline void operator=(const ::FLAC__StreamMetaData &object) { Prototype::operator=(object); } - inline void operator=(const ::FLAC__StreamMetaData *object) { Prototype::operator=(object); } + 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 ::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); } + 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; - void set_id(FLAC__byte value[4]); - bool set_data(FLAC__byte *data, unsigned length, bool copy = false); + void set_id(const FLAC__byte value[4]); + bool set_data(const FLAC__byte *data, unsigned length); // this form always copies + bool set_data(FLAC__byte *data, unsigned length, bool copy); }; class SeekTable : public Prototype { public: SeekTable(); - SeekTable(::FLAC__StreamMetaData *object, bool copy = false); + inline SeekTable(const SeekTable &object): Prototype(object) { } + inline SeekTable(const ::FLAC__StreamMetadata &object): Prototype(object) { } + inline SeekTable(const ::FLAC__StreamMetadata *object): Prototype(object) { } + inline SeekTable(::FLAC__StreamMetadata *object, bool copy): Prototype(object, copy) { } ~SeekTable(); inline void operator=(const SeekTable &object) { Prototype::operator=(object); } - inline void operator=(const ::FLAC__StreamMetaData &object) { Prototype::operator=(object); } - inline void operator=(const ::FLAC__StreamMetaData *object) { Prototype::operator=(object); } + 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 ::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); } + 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; + ::FLAC__StreamMetadata_SeekPoint get_point(unsigned index) const; - void set_point(unsigned index, const ::FLAC__StreamMetaData_SeekPoint &point); - bool insert_point(unsigned index, const ::FLAC__StreamMetaData_SeekPoint &point); + void set_point(unsigned index, const ::FLAC__StreamMetadata_SeekPoint &point); + bool insert_point(unsigned index, const ::FLAC__StreamMetadata_SeekPoint &point); bool delete_point(unsigned index); bool is_legal() const; @@ -230,7 +252,7 @@ namespace FLAC { unsigned get_field_name_length() const; unsigned get_field_value_length() const; - ::FLAC__StreamMetaData_VorbisComment_Entry get_entry() const; + ::FLAC__StreamMetadata_VorbisComment_Entry get_entry() const; const char *get_field() const; const char *get_field_name() const; const char *get_field_value() const; @@ -240,7 +262,7 @@ namespace FLAC { bool set_field_value(const char *field_value, unsigned field_value_length); protected: bool is_valid_; - ::FLAC__StreamMetaData_VorbisComment_Entry entry_; + ::FLAC__StreamMetadata_VorbisComment_Entry entry_; char *field_name_; unsigned field_name_length_; char *field_value_; @@ -258,25 +280,28 @@ namespace FLAC { }; VorbisComment(); - VorbisComment(::FLAC__StreamMetaData *object, bool copy = false); + inline VorbisComment(const VorbisComment &object): Prototype(object) { } + inline VorbisComment(const ::FLAC__StreamMetadata &object): Prototype(object) { } + inline VorbisComment(const ::FLAC__StreamMetadata *object): Prototype(object) { } + inline VorbisComment(::FLAC__StreamMetadata *object, bool copy): Prototype(object, copy) { } ~VorbisComment(); inline void operator=(const VorbisComment &object) { Prototype::operator=(object); } - inline void operator=(const ::FLAC__StreamMetaData &object) { Prototype::operator=(object); } - inline void operator=(const ::FLAC__StreamMetaData *object) { Prototype::operator=(object); } + 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 ::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); } + 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_vendor_string() const; // only the Entry's field name should be used Entry get_comment(unsigned index) const; - bool set_vendor_string(const Entry &entry); + bool set_vendor_string(const Entry &entry); // only the Entry's field name will be used bool set_comment(unsigned index, const Entry &entry); bool insert_comment(unsigned index, const Entry &entry); bool delete_comment(unsigned index); @@ -324,11 +349,11 @@ namespace FLAC { public: class Status { public: - inline Status(::FLAC__MetaData_SimpleIteratorStatus status): status_(status) { } - inline operator ::FLAC__MetaData_SimpleIteratorStatus() const { return status_; } - inline const char *as_cstring() const { return ::FLAC__MetaData_SimpleIteratorStatusString[status_]; } + inline Status(::FLAC__Metadata_SimpleIteratorStatus status): status_(status) { } + inline operator ::FLAC__Metadata_SimpleIteratorStatus() const { return status_; } + inline const char *as_cstring() const { return ::FLAC__Metadata_SimpleIteratorStatusString[status_]; } protected: - ::FLAC__MetaData_SimpleIteratorStatus status_; + ::FLAC__Metadata_SimpleIteratorStatus status_; }; SimpleIterator(); @@ -343,14 +368,14 @@ namespace FLAC { bool next(); bool prev(); - ::FLAC__MetaDataType get_block_type() const; + ::FLAC__MetadataType get_block_type() const; Prototype *get_block(); bool set_block(Prototype *block, bool use_padding = true); bool insert_block_after(Prototype *block, bool use_padding = true); bool delete_block(bool use_padding = true); protected: - ::FLAC__MetaData_SimpleIterator *iterator_; + ::FLAC__Metadata_SimpleIterator *iterator_; void clear(); }; @@ -396,11 +421,11 @@ namespace FLAC { public: class Status { public: - inline Status(::FLAC__MetaData_ChainStatus status): status_(status) { } - inline operator ::FLAC__MetaData_ChainStatus() const { return status_; } - inline const char *as_cstring() const { return ::FLAC__MetaData_ChainStatusString[status_]; } + inline Status(::FLAC__Metadata_ChainStatus status): status_(status) { } + inline operator ::FLAC__Metadata_ChainStatus() const { return status_; } + inline const char *as_cstring() const { return ::FLAC__Metadata_ChainStatusString[status_]; } protected: - ::FLAC__MetaData_ChainStatus status_; + ::FLAC__Metadata_ChainStatus status_; }; Chain(); @@ -418,7 +443,7 @@ namespace FLAC { void sort_padding(); protected: - ::FLAC__MetaData_Chain *chain_; + ::FLAC__Metadata_Chain *chain_; virtual void clear(); }; @@ -434,7 +459,7 @@ namespace FLAC { bool next(); bool prev(); - ::FLAC__MetaDataType get_block_type() const; + ::FLAC__MetadataType get_block_type() const; Prototype *get_block(); bool set_block(Prototype *block); bool delete_block(bool replace_with_padding); @@ -442,7 +467,7 @@ namespace FLAC { bool insert_block_after(Prototype *block); protected: - ::FLAC__MetaData_Iterator *iterator_; + ::FLAC__Metadata_Iterator *iterator_; virtual void clear(); }; diff --git a/include/FLAC/file_decoder.h b/include/FLAC/file_decoder.h index c3dc22e3..789e2731 100644 --- a/include/FLAC/file_decoder.h +++ b/include/FLAC/file_decoder.h @@ -100,16 +100,16 @@ 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 * 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_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); /* * See the comments for the equivalent functions in stream_decoder.h */ -FLAC__bool FLAC__file_decoder_set_metadata_respond(FLAC__FileDecoder *decoder, FLAC__MetaDataType type); +FLAC__bool FLAC__file_decoder_set_metadata_respond(FLAC__FileDecoder *decoder, FLAC__MetadataType type); FLAC__bool FLAC__file_decoder_set_metadata_respond_application(FLAC__FileDecoder *decoder, const FLAC__byte id[4]); FLAC__bool FLAC__file_decoder_set_metadata_respond_all(FLAC__FileDecoder *decoder); -FLAC__bool FLAC__file_decoder_set_metadata_ignore(FLAC__FileDecoder *decoder, FLAC__MetaDataType type); +FLAC__bool FLAC__file_decoder_set_metadata_ignore(FLAC__FileDecoder *decoder, FLAC__MetadataType type); FLAC__bool FLAC__file_decoder_set_metadata_ignore_application(FLAC__FileDecoder *decoder, const FLAC__byte id[4]); FLAC__bool FLAC__file_decoder_set_metadata_ignore_all(FLAC__FileDecoder *decoder); diff --git a/include/FLAC/format.h b/include/FLAC/format.h index babe6878..4cb9e0df 100644 --- a/include/FLAC/format.h +++ b/include/FLAC/format.h @@ -350,8 +350,8 @@ typedef enum { FLAC__METADATA_TYPE_APPLICATION = 2, FLAC__METADATA_TYPE_SEEKTABLE = 3, FLAC__METADATA_TYPE_VORBIS_COMMENT = 4 -} FLAC__MetaDataType; -extern const char * const FLAC__MetaDataTypeString[]; +} FLAC__MetadataType; +extern const char * const FLAC__MetadataTypeString[]; /***************************************************************************** * @@ -375,7 +375,7 @@ typedef struct { unsigned bits_per_sample; FLAC__uint64 total_samples; FLAC__byte md5sum[16]; -} FLAC__StreamMetaData_StreamInfo; +} FLAC__StreamMetadata_StreamInfo; extern const unsigned FLAC__STREAM_METADATA_STREAMINFO_MIN_BLOCK_SIZE_LEN; /* = 16 bits */ extern const unsigned FLAC__STREAM_METADATA_STREAMINFO_MAX_BLOCK_SIZE_LEN; /* = 16 bits */ @@ -398,7 +398,7 @@ extern const unsigned FLAC__STREAM_METADATA_STREAMINFO_MD5SUM_LEN; /* = 128 bits typedef struct { int dummy; /* conceptually this is an empty struct since we don't store the padding bytes */ /* empty structs are allowed by C++ but not C, hence the 'dummy' */ -} FLAC__StreamMetaData_Padding; +} FLAC__StreamMetadata_Padding; /***************************************************************************** * @@ -410,7 +410,7 @@ typedef struct { typedef struct { FLAC__byte id[4]; FLAC__byte *data; -} FLAC__StreamMetaData_Application; +} FLAC__StreamMetadata_Application; extern const unsigned FLAC__STREAM_METADATA_APPLICATION_ID_LEN; /* = 32 bits */ @@ -426,7 +426,7 @@ typedef struct { FLAC__uint64 sample_number; FLAC__uint64 stream_offset; unsigned frame_samples; -} FLAC__StreamMetaData_SeekPoint; +} FLAC__StreamMetadata_SeekPoint; extern const unsigned FLAC__STREAM_METADATA_SEEKPOINT_SAMPLE_NUMBER_LEN; /* = 64 bits */ extern const unsigned FLAC__STREAM_METADATA_SEEKPOINT_STREAM_OFFSET_LEN; /* = 64 bits */ @@ -451,8 +451,8 @@ extern const FLAC__uint64 FLAC__STREAM_METADATA_SEEKPOINT_PLACEHOLDER; /* = 0xff */ typedef struct { unsigned num_points; - FLAC__StreamMetaData_SeekPoint *points; -} FLAC__StreamMetaData_SeekTable; + FLAC__StreamMetadata_SeekPoint *points; +} FLAC__StreamMetadata_SeekTable; /***************************************************************************** * @@ -464,7 +464,7 @@ typedef struct { typedef struct { FLAC__uint32 length; FLAC__byte *entry; -} FLAC__StreamMetaData_VorbisComment_Entry; +} FLAC__StreamMetadata_VorbisComment_Entry; extern const unsigned FLAC__STREAM_METADATA_VORBIS_COMMENT_ENTRY_LENGTH_LEN; /* = 32 bits */ @@ -477,33 +477,33 @@ extern const unsigned FLAC__STREAM_METADATA_VORBIS_COMMENT_ENTRY_LENGTH_LEN; /* * (32+m+n)/8 bytes total */ typedef struct { - FLAC__StreamMetaData_VorbisComment_Entry vendor_string; + FLAC__StreamMetadata_VorbisComment_Entry vendor_string; FLAC__uint32 num_comments; - FLAC__StreamMetaData_VorbisComment_Entry *comments; -} FLAC__StreamMetaData_VorbisComment; + FLAC__StreamMetadata_VorbisComment_Entry *comments; +} FLAC__StreamMetadata_VorbisComment; extern const unsigned FLAC__STREAM_METADATA_VORBIS_COMMENT_NUM_COMMENTS_LEN; /* = 32 bits */ /***************************************************************************** * * 1: =1 if this is the last meta-data block, else =0 - * 7: meta-data type (c.f. FLAC__MetaDataType) + * 7: meta-data type (c.f. FLAC__MetadataType) * 24: length (in bytes) of the block-specific data to follow *---- ----------------- * 4 bytes total */ typedef struct { - FLAC__MetaDataType type; + FLAC__MetadataType type; FLAC__bool is_last; unsigned length; /* in bytes */ union { - FLAC__StreamMetaData_StreamInfo stream_info; - FLAC__StreamMetaData_Padding padding; - FLAC__StreamMetaData_Application application; - FLAC__StreamMetaData_SeekTable seek_table; - FLAC__StreamMetaData_VorbisComment vorbis_comment; + FLAC__StreamMetadata_StreamInfo stream_info; + FLAC__StreamMetadata_Padding padding; + FLAC__StreamMetadata_Application application; + FLAC__StreamMetadata_SeekTable seek_table; + FLAC__StreamMetadata_VorbisComment vorbis_comment; } data; -} FLAC__StreamMetaData; +} FLAC__StreamMetadata; extern const unsigned FLAC__STREAM_METADATA_IS_LAST_LEN; /* = 1 bit */ extern const unsigned FLAC__STREAM_METADATA_TYPE_LEN; /* = 7 bits */ diff --git a/include/FLAC/metadata.h b/include/FLAC/metadata.h index a42068fb..ed9f7f19 100644 --- a/include/FLAC/metadata.h +++ b/include/FLAC/metadata.h @@ -80,11 +80,11 @@ extern "C" { * Only one routine to read the STREAMINFO. Skips any ID3v2 tag at the * head of the file. Useful for file-based player plugins. * - * Provide the address of a FLAC__StreamMetaData_StreamInfo object to + * Provide the address of a FLAC__StreamMetadata_StreamInfo object to * fill. */ -FLAC__bool FLAC__metadata_get_streaminfo(const char *filename, FLAC__StreamMetaData_StreamInfo *streaminfo); +FLAC__bool FLAC__metadata_get_streaminfo(const char *filename, FLAC__StreamMetadata_StreamInfo *streaminfo); /*********************************************************************** @@ -118,7 +118,7 @@ FLAC__bool FLAC__metadata_get_streaminfo(const char *filename, FLAC__StreamMetaD * this time. * * NOTE: Do not modify the is_last, length, or type fields of returned - * FLAC__MetaDataType objects. These are managed automatically. + * FLAC__MetadataType objects. These are managed automatically. * * NOTE: If any of the modification functions (_set_block, _delete_block, * _insert_block_after, etc) return false, you should delete the @@ -128,8 +128,8 @@ FLAC__bool FLAC__metadata_get_streaminfo(const char *filename, FLAC__StreamMetaD /* * opaque structure definition */ -struct FLAC__MetaData_SimpleIterator; -typedef struct FLAC__MetaData_SimpleIterator FLAC__MetaData_SimpleIterator; +struct FLAC__Metadata_SimpleIterator; +typedef struct FLAC__Metadata_SimpleIterator FLAC__Metadata_SimpleIterator; typedef enum { FLAC__METADATA_SIMPLE_ITERATOR_STATUS_OK = 0, @@ -145,49 +145,49 @@ typedef enum { FLAC__METADATA_SIMPLE_ITERATOR_STATUS_UNLINK_ERROR, FLAC__METADATA_SIMPLE_ITERATOR_STATUS_MEMORY_ALLOCATION_ERROR, FLAC__METADATA_SIMPLE_ITERATOR_STATUS_INTERNAL_ERROR -} FLAC__MetaData_SimpleIteratorStatus; -extern const char * const FLAC__MetaData_SimpleIteratorStatusString[]; +} FLAC__Metadata_SimpleIteratorStatus; +extern const char * const FLAC__Metadata_SimpleIteratorStatusString[]; /* * Constructor/destructor */ -FLAC__MetaData_SimpleIterator *FLAC__metadata_simple_iterator_new(); -void FLAC__metadata_simple_iterator_delete(FLAC__MetaData_SimpleIterator *iterator); +FLAC__Metadata_SimpleIterator *FLAC__metadata_simple_iterator_new(); +void FLAC__metadata_simple_iterator_delete(FLAC__Metadata_SimpleIterator *iterator); /* * Get the current status of the iterator. Call this after a function * returns false to get the reason for the error. Also resets the status * to FLAC__METADATA_SIMPLE_ITERATOR_STATUS_OK */ -FLAC__MetaData_SimpleIteratorStatus FLAC__metadata_simple_iterator_status(FLAC__MetaData_SimpleIterator *iterator); +FLAC__Metadata_SimpleIteratorStatus FLAC__metadata_simple_iterator_status(FLAC__Metadata_SimpleIterator *iterator); /* * Initialize the iterator to point to the first metadata block in the * given FLAC file. If 'preserve_file_stats' is true, the owner and * modification time will be preserved even if the FLAC file is written. */ -FLAC__bool FLAC__metadata_simple_iterator_init(FLAC__MetaData_SimpleIterator *iterator, const char *filename, FLAC__bool preserve_file_stats); +FLAC__bool FLAC__metadata_simple_iterator_init(FLAC__Metadata_SimpleIterator *iterator, const char *filename, FLAC__bool preserve_file_stats); /* * Returns true if the FLAC file is writable. If false, calls to * FLAC__metadata_simple_iterator_set_block() and * FLAC__metadata_simple_iterator_insert_block_after() will fail. */ -FLAC__bool FLAC__metadata_simple_iterator_is_writable(const FLAC__MetaData_SimpleIterator *iterator); +FLAC__bool FLAC__metadata_simple_iterator_is_writable(const FLAC__Metadata_SimpleIterator *iterator); /* * These move the iterator forwards or backwards, returning false if * already at the end. */ -FLAC__bool FLAC__metadata_simple_iterator_next(FLAC__MetaData_SimpleIterator *iterator); -FLAC__bool FLAC__metadata_simple_iterator_prev(FLAC__MetaData_SimpleIterator *iterator); +FLAC__bool FLAC__metadata_simple_iterator_next(FLAC__Metadata_SimpleIterator *iterator); +FLAC__bool FLAC__metadata_simple_iterator_prev(FLAC__Metadata_SimpleIterator *iterator); /* * Get the type of the metadata block at the current position. This * avoids reading the actual block data which can save time for large * blocks. */ -FLAC__MetaDataType FLAC__metadata_simple_iterator_get_block_type(const FLAC__MetaData_SimpleIterator *iterator); +FLAC__MetadataType FLAC__metadata_simple_iterator_get_block_type(const FLAC__Metadata_SimpleIterator *iterator); /* * Get the metadata block at the current position. You can modify the @@ -197,7 +197,7 @@ FLAC__MetaDataType FLAC__metadata_simple_iterator_get_block_type(const FLAC__Met * You must call FLAC__metadata_object_delete() on the returned object * when you are finished with it. */ -FLAC__StreamMetaData *FLAC__metadata_simple_iterator_get_block(FLAC__MetaData_SimpleIterator *iterator); +FLAC__StreamMetadata *FLAC__metadata_simple_iterator_get_block(FLAC__Metadata_SimpleIterator *iterator); /* * Write a block back to the FLAC file. This function tries to be @@ -243,7 +243,7 @@ FLAC__StreamMetaData *FLAC__metadata_simple_iterator_get_block(FLAC__MetaData_Si * After writing the block, the iterator will remain in the same * place, i.e. pointing to the new block. */ -FLAC__bool FLAC__metadata_simple_iterator_set_block(FLAC__MetaData_SimpleIterator *iterator, FLAC__StreamMetaData *block, FLAC__bool use_padding); +FLAC__bool FLAC__metadata_simple_iterator_set_block(FLAC__Metadata_SimpleIterator *iterator, FLAC__StreamMetadata *block, FLAC__bool use_padding); /* * This is similar to FLAC__metadata_simple_iterator_set_block() @@ -258,7 +258,7 @@ FLAC__bool FLAC__metadata_simple_iterator_set_block(FLAC__MetaData_SimpleIterato * After writing the block, the iterator will be pointing to the * new block. */ -FLAC__bool FLAC__metadata_simple_iterator_insert_block_after(FLAC__MetaData_SimpleIterator *iterator, FLAC__StreamMetaData *block, FLAC__bool use_padding); +FLAC__bool FLAC__metadata_simple_iterator_insert_block_after(FLAC__Metadata_SimpleIterator *iterator, FLAC__StreamMetadata *block, FLAC__bool use_padding); /* * Deletes the block at the current position. This will cause the @@ -269,7 +269,7 @@ FLAC__bool FLAC__metadata_simple_iterator_insert_block_after(FLAC__MetaData_Simp * * You may not delete the STREAMINFO block. */ -FLAC__bool FLAC__metadata_simple_iterator_delete_block(FLAC__MetaData_SimpleIterator *iterator, FLAC__bool use_padding); +FLAC__bool FLAC__metadata_simple_iterator_delete_block(FLAC__Metadata_SimpleIterator *iterator, FLAC__bool use_padding); /*********************************************************************** @@ -304,7 +304,7 @@ FLAC__bool FLAC__metadata_simple_iterator_delete_block(FLAC__MetaData_SimpleIter * FLAC__metadata_chain_write(). * * NOTE: Do not modify the is_last, length, or type fields of returned - * FLAC__MetaDataType objects. These are managed automatically. + * FLAC__MetadataType objects. These are managed automatically. * * NOTE: The metadata objects returned by _get_bloca()k are owned by the * chain; do not FLAC__metadata_object_delete() them. In the @@ -315,10 +315,10 @@ FLAC__bool FLAC__metadata_simple_iterator_delete_block(FLAC__MetaData_SimpleIter /* * opaque structure definitions */ -struct FLAC__MetaData_Chain; -typedef struct FLAC__MetaData_Chain FLAC__MetaData_Chain; -struct FLAC__MetaData_Iterator; -typedef struct FLAC__MetaData_Iterator FLAC__MetaData_Iterator; +struct FLAC__Metadata_Chain; +typedef struct FLAC__Metadata_Chain FLAC__Metadata_Chain; +struct FLAC__Metadata_Iterator; +typedef struct FLAC__Metadata_Iterator FLAC__Metadata_Iterator; typedef enum { FLAC__METADATA_CHAIN_STATUS_OK = 0, @@ -334,28 +334,28 @@ typedef enum { FLAC__METADATA_CHAIN_STATUS_UNLINK_ERROR, FLAC__METADATA_CHAIN_STATUS_MEMORY_ALLOCATION_ERROR, FLAC__METADATA_CHAIN_STATUS_INTERNAL_ERROR -} FLAC__MetaData_ChainStatus; -extern const char * const FLAC__MetaData_ChainStatusString[]; +} FLAC__Metadata_ChainStatus; +extern const char * const FLAC__Metadata_ChainStatusString[]; -/*********** FLAC__MetaData_Chain ***********/ +/*********** FLAC__Metadata_Chain ***********/ /* * Constructor/destructor */ -FLAC__MetaData_Chain *FLAC__metadata_chain_new(); -void FLAC__metadata_chain_delete(FLAC__MetaData_Chain *chain); +FLAC__Metadata_Chain *FLAC__metadata_chain_new(); +void FLAC__metadata_chain_delete(FLAC__Metadata_Chain *chain); /* * Get the current status of the chain. Call this after a function * returns false to get the reason for the error. Also resets the status * to FLAC__METADATA_CHAIN_STATUS_OK */ -FLAC__MetaData_ChainStatus FLAC__metadata_chain_status(FLAC__MetaData_Chain *chain); +FLAC__Metadata_ChainStatus FLAC__metadata_chain_status(FLAC__Metadata_Chain *chain); /* * Read all metadata into the chain */ -FLAC__bool FLAC__metadata_chain_read(FLAC__MetaData_Chain *chain, const char *filename); +FLAC__bool FLAC__metadata_chain_read(FLAC__Metadata_Chain *chain, const char *filename); /* * Write all metadata out to the FLAC file. This function tries to be as @@ -389,7 +389,7 @@ FLAC__bool FLAC__metadata_chain_read(FLAC__MetaData_Chain *chain, const char *fi * If 'preserve_file_stats' is true, the owner and modification time will * be preserved even if the FLAC file is written. */ -FLAC__bool FLAC__metadata_chain_write(FLAC__MetaData_Chain *chain, FLAC__bool use_padding, FLAC__bool preserve_file_stats); +FLAC__bool FLAC__metadata_chain_write(FLAC__Metadata_Chain *chain, FLAC__bool use_padding, FLAC__bool preserve_file_stats); /* * This function will merge adjacent PADDING blocks into a single block. @@ -400,7 +400,7 @@ FLAC__bool FLAC__metadata_chain_write(FLAC__MetaData_Chain *chain, FLAC__bool us * NOTE: Any iterator on the current chain will become invalid after this * call. You should delete the iterator and get a new one. */ -void FLAC__metadata_chain_merge_padding(FLAC__MetaData_Chain *chain); +void FLAC__metadata_chain_merge_padding(FLAC__Metadata_Chain *chain); /* * This function will move all PADDING blocks to the end on the metadata, @@ -412,34 +412,34 @@ void FLAC__metadata_chain_merge_padding(FLAC__MetaData_Chain *chain); * NOTE: Any iterator on the current chain will become invalid after this * call. You should delete the iterator and get a new one. */ -void FLAC__metadata_chain_sort_padding(FLAC__MetaData_Chain *chain); +void FLAC__metadata_chain_sort_padding(FLAC__Metadata_Chain *chain); -/*********** FLAC__MetaData_Iterator ***********/ +/*********** FLAC__Metadata_Iterator ***********/ /* * Constructor/destructor */ -FLAC__MetaData_Iterator *FLAC__metadata_iterator_new(); -void FLAC__metadata_iterator_delete(FLAC__MetaData_Iterator *iterator); +FLAC__Metadata_Iterator *FLAC__metadata_iterator_new(); +void FLAC__metadata_iterator_delete(FLAC__Metadata_Iterator *iterator); /* * Initialize the iterator to point to the first metadata block in the * given chain. */ -void FLAC__metadata_iterator_init(FLAC__MetaData_Iterator *iterator, FLAC__MetaData_Chain *chain); +void FLAC__metadata_iterator_init(FLAC__Metadata_Iterator *iterator, FLAC__Metadata_Chain *chain); /* * These move the iterator forwards or backwards, returning false if * already at the end. */ -FLAC__bool FLAC__metadata_iterator_next(FLAC__MetaData_Iterator *iterator); -FLAC__bool FLAC__metadata_iterator_prev(FLAC__MetaData_Iterator *iterator); +FLAC__bool FLAC__metadata_iterator_next(FLAC__Metadata_Iterator *iterator); +FLAC__bool FLAC__metadata_iterator_prev(FLAC__Metadata_Iterator *iterator); /* * Get the type of the metadata block at the current position. */ -FLAC__MetaDataType FLAC__metadata_iterator_get_block_type(const FLAC__MetaData_Iterator *iterator); +FLAC__MetadataType FLAC__metadata_iterator_get_block_type(const FLAC__Metadata_Iterator *iterator); /* * Get the metadata block at the current position. You can modify @@ -452,14 +452,14 @@ FLAC__MetaDataType FLAC__metadata_iterator_get_block_type(const FLAC__MetaData_I * Do not call FLAC__metadata_object_delete() on the returned object; * to delete a block use FLAC__metadata_iterator_delete_block(). */ -FLAC__StreamMetaData *FLAC__metadata_iterator_get_block(FLAC__MetaData_Iterator *iterator); +FLAC__StreamMetadata *FLAC__metadata_iterator_get_block(FLAC__Metadata_Iterator *iterator); /* * Set the metadata block at the current position, replacing the existing * block. The new block passed in becomes owned by the chain and will be * deleted when the chain is deleted. */ -FLAC__bool FLAC__metadata_iterator_set_block(FLAC__MetaData_Iterator *iterator, FLAC__StreamMetaData *block); +FLAC__bool FLAC__metadata_iterator_set_block(FLAC__Metadata_Iterator *iterator, FLAC__StreamMetadata *block); /* * Removes the current block from the chain. If replace_with_padding is @@ -468,7 +468,7 @@ FLAC__bool FLAC__metadata_iterator_set_block(FLAC__MetaData_Iterator *iterator, * left pointing to the block before the one just 'deleted', even if * 'replace_with_padding' is true. */ -FLAC__bool FLAC__metadata_iterator_delete_block(FLAC__MetaData_Iterator *iterator, FLAC__bool replace_with_padding); +FLAC__bool FLAC__metadata_iterator_delete_block(FLAC__Metadata_Iterator *iterator, FLAC__bool replace_with_padding); /* * Insert a new block before or after the current block. You cannot @@ -477,8 +477,8 @@ FLAC__bool FLAC__metadata_iterator_delete_block(FLAC__MetaData_Iterator *iterato * already exists at the head when you read in a chain. The iterator * will be left pointing to the new block. */ -FLAC__bool FLAC__metadata_iterator_insert_block_before(FLAC__MetaData_Iterator *iterator, FLAC__StreamMetaData *block); -FLAC__bool FLAC__metadata_iterator_insert_block_after(FLAC__MetaData_Iterator *iterator, FLAC__StreamMetaData *block); +FLAC__bool FLAC__metadata_iterator_insert_block_before(FLAC__Metadata_Iterator *iterator, FLAC__StreamMetadata *block); +FLAC__bool FLAC__metadata_iterator_insert_block_after(FLAC__Metadata_Iterator *iterator, FLAC__StreamMetadata *block); /****************************************************************************** @@ -496,13 +496,13 @@ FLAC__bool FLAC__metadata_iterator_insert_block_after(FLAC__MetaData_Iterator *i as the data pointer to a _set_ function as long as then length argument is 0 and the copy argument is 'false'. - The _new and _copy function will return NULL in the case of a memory + The _new and _clone function will return NULL in the case of a memory allocation error, otherwise a new object. The _set_ functions return false in the case of a memory allocation error. We don't have the convenience of C++ here, so note that the library relies on you to keep the types straight. In other words, if you pass, - for example, a FLAC__StreamMetaData* that represents a STREAMINFO block + for example, a FLAC__StreamMetadata* that represents a STREAMINFO block to FLAC__metadata_object_application_set_data(), you will get an assertion failure. @@ -513,23 +513,23 @@ FLAC__bool FLAC__metadata_iterator_insert_block_after(FLAC__MetaData_Iterator *i /****************************************************************** - * Common to all the types derived from FLAC__StreamMetaData: + * Common to all the types derived from FLAC__StreamMetadata: */ -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); +FLAC__StreamMetadata *FLAC__metadata_object_new(FLAC__MetadataType type); +FLAC__StreamMetadata *FLAC__metadata_object_clone(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__bool FLAC__metadata_object_is_equal(const FLAC__StreamMetadata *block1, const FLAC__StreamMetadata *block2); /****************************************************************** - * FLAC__StreamMetaData_Application + * FLAC__StreamMetadata_Application * ---------------------------------------------------------------- * Note: 'length' is in bytes. */ -FLAC__bool FLAC__metadata_object_application_set_data(FLAC__StreamMetaData *object, FLAC__byte *data, unsigned length, FLAC__bool copy); +FLAC__bool FLAC__metadata_object_application_set_data(FLAC__StreamMetadata *object, FLAC__byte *data, unsigned length, FLAC__bool copy); /****************************************************************** - * FLAC__StreamMetaData_SeekPoint + * FLAC__StreamMetadata_SeekPoint * ---------------------------------------------------------------- * @@@@ You can * use the _resize function to alter it. If the size shrinks, @@ -538,22 +538,22 @@ FLAC__bool FLAC__metadata_object_application_set_data(FLAC__StreamMetaData *obje */ /****************************************************************** - * FLAC__StreamMetaData_SeekTable + * FLAC__StreamMetadata_SeekTable */ -FLAC__bool FLAC__metadata_object_seektable_resize_points(FLAC__StreamMetaData *object, unsigned new_num_points); -void FLAC__metadata_object_seektable_set_point(FLAC__StreamMetaData *object, unsigned point_num, FLAC__StreamMetaData_SeekPoint point); -FLAC__bool FLAC__metadata_object_seektable_insert_point(FLAC__StreamMetaData *object, unsigned point_num, FLAC__StreamMetaData_SeekPoint point); -FLAC__bool FLAC__metadata_object_seektable_delete_point(FLAC__StreamMetaData *object, unsigned point_num); +FLAC__bool FLAC__metadata_object_seektable_resize_points(FLAC__StreamMetadata *object, unsigned new_num_points); +void FLAC__metadata_object_seektable_set_point(FLAC__StreamMetadata *object, unsigned point_num, FLAC__StreamMetadata_SeekPoint point); +FLAC__bool FLAC__metadata_object_seektable_insert_point(FLAC__StreamMetadata *object, unsigned point_num, FLAC__StreamMetadata_SeekPoint point); +FLAC__bool FLAC__metadata_object_seektable_delete_point(FLAC__StreamMetadata *object, unsigned point_num); /****************************************************************** - * FLAC__StreamMetaData_VorbisComment - */ -FLAC__bool FLAC__metadata_object_vorbiscomment_set_vendor_string(FLAC__StreamMetaData *object, FLAC__StreamMetaData_VorbisComment_Entry entry, FLAC__bool copy); -FLAC__bool FLAC__metadata_object_vorbiscomment_resize_comments(FLAC__StreamMetaData *object, unsigned new_num_comments); -FLAC__bool FLAC__metadata_object_vorbiscomment_set_comment(FLAC__StreamMetaData *object, unsigned comment_num, FLAC__StreamMetaData_VorbisComment_Entry entry, FLAC__bool copy); -FLAC__bool FLAC__metadata_object_vorbiscomment_insert_comment(FLAC__StreamMetaData *object, unsigned comment_num, FLAC__StreamMetaData_VorbisComment_Entry entry, FLAC__bool copy); -FLAC__bool FLAC__metadata_object_vorbiscomment_delete_comment(FLAC__StreamMetaData *object, unsigned comment_num); -FLAC__bool FLAC__metadata_object_seektable_is_legal(const FLAC__StreamMetaData *object); + * FLAC__StreamMetadata_VorbisComment + */ +FLAC__bool FLAC__metadata_object_vorbiscomment_set_vendor_string(FLAC__StreamMetadata *object, FLAC__StreamMetadata_VorbisComment_Entry entry, FLAC__bool copy); +FLAC__bool FLAC__metadata_object_vorbiscomment_resize_comments(FLAC__StreamMetadata *object, unsigned new_num_comments); +FLAC__bool FLAC__metadata_object_vorbiscomment_set_comment(FLAC__StreamMetadata *object, unsigned comment_num, FLAC__StreamMetadata_VorbisComment_Entry entry, FLAC__bool copy); +FLAC__bool FLAC__metadata_object_vorbiscomment_insert_comment(FLAC__StreamMetadata *object, unsigned comment_num, FLAC__StreamMetadata_VorbisComment_Entry entry, FLAC__bool copy); +FLAC__bool FLAC__metadata_object_vorbiscomment_delete_comment(FLAC__StreamMetadata *object, unsigned comment_num); +FLAC__bool FLAC__metadata_object_seektable_is_legal(const FLAC__StreamMetadata *object); #ifdef __cplusplus } diff --git a/include/FLAC/ordinals.h.in b/include/FLAC/ordinals.h.in index e28ed1e7..82dbdbf9 100644 --- a/include/FLAC/ordinals.h.in +++ b/include/FLAC/ordinals.h.in @@ -26,8 +26,10 @@ #ifdef false #undef false #endif +#ifndef __cplusplus #define true 1 #define false 0 +#endif typedef int FLAC__bool; diff --git a/include/FLAC/seekable_stream_decoder.h b/include/FLAC/seekable_stream_decoder.h index 7d697923..1b2efd2c 100644 --- a/include/FLAC/seekable_stream_decoder.h +++ b/include/FLAC/seekable_stream_decoder.h @@ -135,16 +135,16 @@ FLAC__bool FLAC__seekable_stream_decoder_set_tell_callback(FLAC__SeekableStreamD 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 * 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_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); /* * See the comments for the equivalent functions in stream_decoder.h */ -FLAC__bool FLAC__seekable_stream_decoder_set_metadata_respond(FLAC__SeekableStreamDecoder *decoder, FLAC__MetaDataType type); +FLAC__bool FLAC__seekable_stream_decoder_set_metadata_respond(FLAC__SeekableStreamDecoder *decoder, FLAC__MetadataType type); FLAC__bool FLAC__seekable_stream_decoder_set_metadata_respond_application(FLAC__SeekableStreamDecoder *decoder, const FLAC__byte id[4]); FLAC__bool FLAC__seekable_stream_decoder_set_metadata_respond_all(FLAC__SeekableStreamDecoder *decoder); -FLAC__bool FLAC__seekable_stream_decoder_set_metadata_ignore(FLAC__SeekableStreamDecoder *decoder, FLAC__MetaDataType type); +FLAC__bool FLAC__seekable_stream_decoder_set_metadata_ignore(FLAC__SeekableStreamDecoder *decoder, FLAC__MetadataType type); FLAC__bool FLAC__seekable_stream_decoder_set_metadata_ignore_application(FLAC__SeekableStreamDecoder *decoder, const FLAC__byte id[4]); FLAC__bool FLAC__seekable_stream_decoder_set_metadata_ignore_all(FLAC__SeekableStreamDecoder *decoder); diff --git a/include/FLAC/stream_decoder.h b/include/FLAC/stream_decoder.h index e2cb3499..05f1365b 100644 --- a/include/FLAC/stream_decoder.h +++ b/include/FLAC/stream_decoder.h @@ -122,7 +122,7 @@ void FLAC__stream_decoder_delete(FLAC__StreamDecoder *); */ 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 * 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_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); /* @@ -139,10 +139,10 @@ FLAC__bool FLAC__stream_decoder_set_client_data(FLAC__StreamDecoder *decoder, vo * STREAMINFO and SEEKTABLE blocks are always parsed and used internally, but * they still can legally be filtered from the metadata_callback here. */ -FLAC__bool FLAC__stream_decoder_set_metadata_respond(FLAC__StreamDecoder *decoder, FLAC__MetaDataType type); +FLAC__bool FLAC__stream_decoder_set_metadata_respond(FLAC__StreamDecoder *decoder, FLAC__MetadataType type); FLAC__bool FLAC__stream_decoder_set_metadata_respond_application(FLAC__StreamDecoder *decoder, const FLAC__byte id[4]); FLAC__bool FLAC__stream_decoder_set_metadata_respond_all(FLAC__StreamDecoder *decoder); -FLAC__bool FLAC__stream_decoder_set_metadata_ignore(FLAC__StreamDecoder *decoder, FLAC__MetaDataType type); +FLAC__bool FLAC__stream_decoder_set_metadata_ignore(FLAC__StreamDecoder *decoder, FLAC__MetadataType type); FLAC__bool FLAC__stream_decoder_set_metadata_ignore_application(FLAC__StreamDecoder *decoder, const FLAC__byte id[4]); FLAC__bool FLAC__stream_decoder_set_metadata_ignore_all(FLAC__StreamDecoder *decoder); diff --git a/include/FLAC/stream_encoder.h b/include/FLAC/stream_encoder.h index 2278a381..eb728a9a 100644 --- a/include/FLAC/stream_encoder.h +++ b/include/FLAC/stream_encoder.h @@ -97,7 +97,7 @@ typedef struct { * unsigned max_residual_partition_order (DEFAULT: 0 ) for each based on mean; min_ and max_ specify the min and max Rice partition order * unsigned rice_parameter_search_dist (DEFAULT: 0 ) 0 => try only calc'd parameter k; else try all [k-dist..k+dist] parameters, use best * FLAC__uint64 total_samples_estimate (DEFAULT: 0 ) may be 0 if unknown. acts as a placeholder in the STREAMINFO until the actual total is calculated - * FLAC__StreamMetaData **metadata (DEFAULT: NULL,0) optional metadata blocks to prepend. STREAMINFO is not allowed since it is done internally. + * FLAC__StreamMetadata **metadata (DEFAULT: NULL,0) optional metadata blocks to prepend. STREAMINFO is not allowed since it is done internally. * + unsigned num_blocks * (*write_callback)() (DEFAULT: NULL ) The callbacks are the only values that MUST be set before FLAC__stream_encoder_init() * (*metadata_callback)() (DEFAULT: NULL ) @@ -146,9 +146,9 @@ FLAC__bool FLAC__stream_encoder_set_min_residual_partition_order(FLAC__StreamEnc FLAC__bool FLAC__stream_encoder_set_max_residual_partition_order(FLAC__StreamEncoder *encoder, unsigned value); FLAC__bool FLAC__stream_encoder_set_rice_parameter_search_dist(FLAC__StreamEncoder *encoder, unsigned value); FLAC__bool FLAC__stream_encoder_set_total_samples_estimate(FLAC__StreamEncoder *encoder, FLAC__uint64 value); -FLAC__bool FLAC__stream_encoder_set_metadata(FLAC__StreamEncoder *encoder, FLAC__StreamMetaData **metadata, unsigned num_blocks); +FLAC__bool FLAC__stream_encoder_set_metadata(FLAC__StreamEncoder *encoder, FLAC__StreamMetadata **metadata, unsigned num_blocks); FLAC__bool FLAC__stream_encoder_set_write_callback(FLAC__StreamEncoder *encoder, FLAC__StreamEncoderWriteStatus (*value)(const FLAC__StreamEncoder *encoder, const FLAC__byte buffer[], unsigned bytes, unsigned samples, unsigned current_frame, void *client_data)); -FLAC__bool FLAC__stream_encoder_set_metadata_callback(FLAC__StreamEncoder *encoder, void (*value)(const FLAC__StreamEncoder *encoder, const FLAC__StreamMetaData *metadata, void *client_data)); +FLAC__bool FLAC__stream_encoder_set_metadata_callback(FLAC__StreamEncoder *encoder, void (*value)(const FLAC__StreamEncoder *encoder, const FLAC__StreamMetadata *metadata, void *client_data)); FLAC__bool FLAC__stream_encoder_set_client_data(FLAC__StreamEncoder *encoder, void *value); /* diff --git a/src/flac/Makefile.vc b/src/flac/Makefile.vc index 3d3f130a..dc5b7fa7 100644 --- a/src/flac/Makefile.vc +++ b/src/flac/Makefile.vc @@ -21,10 +21,10 @@ !IFDEF DEBUG
.c.obj:
- $(cc) $(cdebug) $(cflags) /I "..\..\include" /I ".\include" -DSTRICT -DVERSION=\"1.0.3\" -DFLAC__HAS_OGG -YX /Od /D "_DEBUG" $<
+ $(cc) $(cdebug) $(cflags) /I "..\..\include" /I ".\include" -DSTRICT -DVERSION=\"1.0.3_beta\" -DFLAC__HAS_OGG -YX /Od /D "_DEBUG" $<
!else
.c.obj:
- $(cc) /O2 $(crelease) $(cflags) /I "..\..\include" /I ".\include" -DSTRICT -DVERSION=\"1.0.3\" -DFLAC__HAS_OGG -YX -DNODEBUG $<
+ $(cc) /O2 $(crelease) $(cflags) /I "..\..\include" /I ".\include" -DSTRICT -DVERSION=\"1.0.3_beta\" -DFLAC__HAS_OGG -YX -DNODEBUG $<
!endif
C_FILES= \
diff --git a/src/flac/decode.c b/src/flac/decode.c index 5d60dc94..fe5f4c19 100644 --- a/src/flac/decode.c +++ b/src/flac/decode.c @@ -94,7 +94,7 @@ static FLAC__StreamDecoderReadStatus read_callback(const FLAC__StreamDecoder *de * actually never used in the callbacks. */ static FLAC__StreamDecoderWriteStatus write_callback(const void *decoder, const FLAC__Frame *frame, const FLAC__int32 *buffer[], void *client_data); -static void metadata_callback(const void *decoder, const FLAC__StreamMetaData *metadata, void *client_data); +static void metadata_callback(const void *decoder, const FLAC__StreamMetadata *metadata, void *client_data); static void error_callback(const void *decoder, FLAC__StreamDecoderErrorStatus status, void *client_data); static void print_stats(const stream_info_struct *stream_info); @@ -492,7 +492,7 @@ FLAC__bool init(const char *infilename, stream_info_struct *stream_info) * unnecessary but here the cast makes the C compiler happy. */ FLAC__stream_decoder_set_write_callback(stream_info->decoder.stream, (FLAC__StreamDecoderWriteStatus (*)(const FLAC__StreamDecoder *, const FLAC__Frame *, const FLAC__int32 *[], void *))write_callback); - FLAC__stream_decoder_set_metadata_callback(stream_info->decoder.stream, (void (*)(const FLAC__StreamDecoder *, const FLAC__StreamMetaData *, void *))metadata_callback); + FLAC__stream_decoder_set_metadata_callback(stream_info->decoder.stream, (void (*)(const FLAC__StreamDecoder *, const FLAC__StreamMetadata *, void *))metadata_callback); FLAC__stream_decoder_set_error_callback(stream_info->decoder.stream, (void (*)(const FLAC__StreamDecoder *, FLAC__StreamDecoderErrorStatus, void *))error_callback); FLAC__stream_decoder_set_client_data(stream_info->decoder.stream, stream_info); @@ -521,7 +521,7 @@ FLAC__bool init(const char *infilename, stream_info_struct *stream_info) * 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 * 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_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); @@ -755,7 +755,7 @@ FLAC__StreamDecoderWriteStatus write_callback(const void *decoder, const FLAC__F return FLAC__STREAM_DECODER_WRITE_STATUS_CONTINUE; } -void metadata_callback(const void *decoder, const FLAC__StreamMetaData *metadata, void *client_data) +void metadata_callback(const void *decoder, const FLAC__StreamMetadata *metadata, void *client_data) { stream_info_struct *stream_info = (stream_info_struct *)client_data; (void)decoder; @@ -856,7 +856,7 @@ void print_stats(const stream_info_struct *stream_info) } } #if 0 -void metadata_callback(const FLAC__StreamEncoder *encoder, const FLAC__StreamMetaData *metadata, void *client_data) +void metadata_callback(const FLAC__StreamEncoder *encoder, const FLAC__StreamMetadata *metadata, void *client_data) { encoder_wrapper_struct *encoder_wrapper = (encoder_wrapper_struct *)client_data; FLAC__byte b; diff --git a/src/flac/encode.c b/src/flac/encode.c index a2ad9bde..3c978ae7 100644 --- a/src/flac/encode.c +++ b/src/flac/encode.c @@ -86,7 +86,7 @@ typedef struct { FLAC__uint64 stream_offset; /* i.e. number of bytes before the first byte of the the first frame's header */ unsigned current_frame; verify_fifo_struct verify_fifo; - FLAC__StreamMetaData_SeekTable seek_table; + FLAC__StreamMetadata_SeekTable seek_table; unsigned first_seek_point_to_check; #ifdef FLAC__HAS_OGG FLAC__bool use_ogg; @@ -107,16 +107,16 @@ static FLAC__int32 *input[FLAC__MAX_CHANNELS]; /* local routines */ static FLAC__bool init(encoder_wrapper_struct *encoder_wrapper); static FLAC__bool init_encoder(encode_options_t options, unsigned channels, unsigned bps, unsigned sample_rate, encoder_wrapper_struct *encoder_wrapper); -static FLAC__bool convert_to_seek_table(char *requested_seek_points, int num_requested_seek_points, FLAC__uint64 stream_samples, unsigned blocksize, FLAC__StreamMetaData_SeekTable *seek_table); -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 FLAC__bool convert_to_seek_table(char *requested_seek_points, int num_requested_seek_points, FLAC__uint64 stream_samples, unsigned blocksize, FLAC__StreamMetadata_SeekTable *seek_table); +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 * 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 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 * const buffer[], void *client_data); -static void verify_metadata_callback(const FLAC__StreamDecoder *decoder, const FLAC__StreamMetaData *metadata, 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); static FLAC__bool read_little_endian_uint16(FILE *f, FLAC__uint16 *val, FLAC__bool eof_ok, const char *fn); @@ -682,8 +682,8 @@ FLAC__bool init(encoder_wrapper_struct *encoder_wrapper) FLAC__bool init_encoder(encode_options_t options, unsigned channels, unsigned bps, unsigned sample_rate, encoder_wrapper_struct *encoder_wrapper) { unsigned i, num_metadata; - FLAC__StreamMetaData seek_table, padding; - FLAC__StreamMetaData *metadata[2]; + FLAC__StreamMetadata seek_table, padding; + FLAC__StreamMetadata *metadata[2]; if(channels != 2) options.do_mid_side = options.loose_mid_side = false; @@ -770,7 +770,7 @@ FLAC__bool init_encoder(encode_options_t options, unsigned channels, unsigned bp return true; } -FLAC__bool convert_to_seek_table(char *requested_seek_points, int num_requested_seek_points, FLAC__uint64 stream_samples, unsigned blocksize, FLAC__StreamMetaData_SeekTable *seek_table) +FLAC__bool convert_to_seek_table(char *requested_seek_points, int num_requested_seek_points, FLAC__uint64 stream_samples, unsigned blocksize, FLAC__StreamMetadata_SeekTable *seek_table) { unsigned i, j, real_points, placeholders; char *pt = requested_seek_points, *q; @@ -810,7 +810,7 @@ FLAC__bool convert_to_seek_table(char *requested_seek_points, int num_requested_ pt = requested_seek_points; /* make some space */ - if(0 == (seek_table->points = (FLAC__StreamMetaData_SeekPoint*)malloc(sizeof(FLAC__StreamMetaData_SeekPoint) * (real_points+placeholders)))) + if(0 == (seek_table->points = (FLAC__StreamMetadata_SeekPoint*)malloc(sizeof(FLAC__StreamMetadata_SeekPoint) * (real_points+placeholders)))) return false; /* initialize the seek_table. we set frame_samples to zero to signify the points have not yet been hit by a frame write yet. */ @@ -844,7 +844,7 @@ FLAC__bool convert_to_seek_table(char *requested_seek_points, int num_requested_ } /* sort the seekpoints */ - qsort(seek_table->points, seek_table->num_points, sizeof(FLAC__StreamMetaData_SeekPoint), (int (*)(const void *, const void *))seekpoint_compare); + qsort(seek_table->points, seek_table->num_points, sizeof(FLAC__StreamMetadata_SeekPoint), (int (*)(const void *, const void *))seekpoint_compare); /* uniqify the seekpoints */ first = true; @@ -866,7 +866,7 @@ FLAC__bool convert_to_seek_table(char *requested_seek_points, int num_requested_ return true; } -void append_point_to_seek_table(FLAC__StreamMetaData_SeekTable *seek_table, FLAC__uint64 sample, FLAC__uint64 stream_samples, FLAC__uint64 blocksize) +void append_point_to_seek_table(FLAC__StreamMetadata_SeekTable *seek_table, FLAC__uint64 sample, FLAC__uint64 stream_samples, FLAC__uint64 blocksize) { const FLAC__uint64 target_sample = (sample / blocksize) * blocksize; @@ -874,7 +874,7 @@ void append_point_to_seek_table(FLAC__StreamMetaData_SeekTable *seek_table, FLAC seek_table->points[seek_table->num_points++].sample_number = target_sample; } -int seekpoint_compare(const FLAC__StreamMetaData_SeekPoint *l, const FLAC__StreamMetaData_SeekPoint *r) +int seekpoint_compare(const FLAC__StreamMetadata_SeekPoint *l, const FLAC__StreamMetadata_SeekPoint *r) { /* we don't just 'return l->sample_number - r->sample_number' since the result (FLAC__int64) might overflow an 'int' */ if(l->sample_number == r->sample_number) @@ -1064,7 +1064,7 @@ FLAC__StreamEncoderWriteStatus write_callback(const FLAC__StreamEncoder *encoder } } -void metadata_callback(const FLAC__StreamEncoder *encoder, const FLAC__StreamMetaData *metadata, void *client_data) +void metadata_callback(const FLAC__StreamEncoder *encoder, const FLAC__StreamMetadata *metadata, void *client_data) { encoder_wrapper_struct *encoder_wrapper = (encoder_wrapper_struct *)client_data; FLAC__byte b; @@ -1230,7 +1230,7 @@ FLAC__StreamDecoderWriteStatus verify_write_callback(const FLAC__StreamDecoder * return FLAC__STREAM_DECODER_WRITE_STATUS_CONTINUE; } -void verify_metadata_callback(const FLAC__StreamDecoder *decoder, const FLAC__StreamMetaData *metadata, void *client_data) +void verify_metadata_callback(const FLAC__StreamDecoder *decoder, const FLAC__StreamMetadata *metadata, void *client_data) { (void)decoder; (void)metadata; diff --git a/src/libFLAC++/file_decoder.cc b/src/libFLAC++/file_decoder.cc index abb5ac2d..3744ba89 100644 --- a/src/libFLAC++/file_decoder.cc +++ b/src/libFLAC++/file_decoder.cc @@ -52,7 +52,7 @@ namespace FLAC { return (bool)::FLAC__file_decoder_set_filename(decoder_, value); } - bool File::set_metadata_respond(::FLAC__MetaDataType type) + bool File::set_metadata_respond(::FLAC__MetadataType type) { FLAC__ASSERT(0 != decoder_); return (bool)::FLAC__file_decoder_set_metadata_respond(decoder_, type); @@ -70,7 +70,7 @@ namespace FLAC { return (bool)::FLAC__file_decoder_set_metadata_respond_all(decoder_); } - bool File::set_metadata_ignore(::FLAC__MetaDataType type) + bool File::set_metadata_ignore(::FLAC__MetadataType type) { FLAC__ASSERT(0 != decoder_); return (bool)::FLAC__file_decoder_set_metadata_ignore(decoder_, type); @@ -185,7 +185,7 @@ namespace FLAC { return instance->write_callback(frame, buffer); } - void File::metadata_callback_(const ::FLAC__FileDecoder *decoder, const ::FLAC__StreamMetaData *metadata, void *client_data) + void File::metadata_callback_(const ::FLAC__FileDecoder *decoder, const ::FLAC__StreamMetadata *metadata, void *client_data) { (void) decoder; FLAC__ASSERT(0 != client_data); diff --git a/src/libFLAC++/metadata.cc b/src/libFLAC++/metadata.cc index d1e82724..19fb497a 100644 --- a/src/libFLAC++/metadata.cc +++ b/src/libFLAC++/metadata.cc @@ -29,7 +29,7 @@ namespace FLAC { namespace local { - Prototype *construct_block(::FLAC__StreamMetaData *object) + Prototype *construct_block(::FLAC__StreamMetadata *object) { Prototype *ret = 0; switch(object->type) { @@ -57,17 +57,59 @@ namespace FLAC { }; + Prototype *clone(const Prototype *object) + { + const StreamInfo *streaminfo = dynamic_cast<const StreamInfo *>(object); + const Padding *padding = dynamic_cast<const Padding *>(object); + const Application *application = dynamic_cast<const Application *>(object); + const SeekTable *seektable = dynamic_cast<const SeekTable *>(object); + const VorbisComment *vorbiscomment = dynamic_cast<const VorbisComment *>(object); + + if(0 != streaminfo) + return new StreamInfo(*streaminfo); + else if(0 != padding) + return new Padding(*padding); + else if(0 != application) + return new Application(*application); + else if(0 != seektable) + return new SeekTable(*seektable); + else if(0 != vorbiscomment) + return new VorbisComment(*vorbiscomment); + else { + FLAC__ASSERT(0); + return 0; + } + } + // // Prototype // - Prototype::Prototype(::FLAC__StreamMetaData *object, bool copy): - object_(0) + Prototype::Prototype(const Prototype &object): + object_(::FLAC__metadata_object_clone(object.object_)), + is_reference_(false) + { + FLAC__ASSERT(object.is_valid()); + } + + Prototype::Prototype(const ::FLAC__StreamMetadata &object): + object_(::FLAC__metadata_object_clone(&object)), + is_reference_(false) + { + } + + Prototype::Prototype(const ::FLAC__StreamMetadata *object): + object_(::FLAC__metadata_object_clone(object)), + is_reference_(false) + { + FLAC__ASSERT(0 != object); + } + + Prototype::Prototype(::FLAC__StreamMetadata *object, bool copy): + object_(copy? ::FLAC__metadata_object_clone(object) : object), + is_reference_(false) { FLAC__ASSERT(0 != object); - clear(); - object_ = copy? ::FLAC__metadata_object_copy(object) : object; - is_reference_ = false; } Prototype::~Prototype() @@ -77,34 +119,32 @@ namespace FLAC { void Prototype::clear() { - if(0 != object_) + if(0 != object_ && !is_reference_) FLAC__metadata_object_delete(object_); object_ = 0; } void Prototype::operator=(const Prototype &object) { + FLAC__ASSERT(object.is_valid()); clear(); - is_reference_ = object.is_reference_; - if(is_reference_) - object_ = object.object_; - else - object_ = ::FLAC__metadata_object_copy(object.object_); + is_reference_ = false; + object_ = ::FLAC__metadata_object_clone(object.object_); } - void Prototype::operator=(const ::FLAC__StreamMetaData &object) + void Prototype::operator=(const ::FLAC__StreamMetadata &object) { clear(); is_reference_ = false; - object_ = ::FLAC__metadata_object_copy(&object); + object_ = ::FLAC__metadata_object_clone(&object); } - void Prototype::operator=(const ::FLAC__StreamMetaData *object) + void Prototype::operator=(const ::FLAC__StreamMetadata *object) { FLAC__ASSERT(0 != object); clear(); is_reference_ = false; - object_ = ::FLAC__metadata_object_copy(object); + object_ = ::FLAC__metadata_object_clone(object); } bool Prototype::get_is_last() const @@ -113,7 +153,7 @@ namespace FLAC { return (bool)object_->is_last; } - FLAC__MetaDataType Prototype::get_type() const + FLAC__MetadataType Prototype::get_type() const { FLAC__ASSERT(is_valid()); return object_->type; @@ -125,6 +165,12 @@ namespace FLAC { return object_->length; } + void Prototype::set_is_last(bool value) + { + FLAC__ASSERT(is_valid()); + object_->is_last = value; + } + // // StreamInfo @@ -134,10 +180,6 @@ namespace FLAC { Prototype(FLAC__metadata_object_new(FLAC__METADATA_TYPE_STREAMINFO), /*copy=*/false) { } - StreamInfo::StreamInfo(::FLAC__StreamMetaData *object, bool copy): - Prototype(object, copy) - { } - StreamInfo::~StreamInfo() { } @@ -271,10 +313,6 @@ namespace FLAC { Prototype(FLAC__metadata_object_new(FLAC__METADATA_TYPE_PADDING), /*copy=*/false) { } - Padding::Padding(::FLAC__StreamMetaData *object, bool copy): - Prototype(object, copy) - { } - Padding::~Padding() { } @@ -293,10 +331,6 @@ namespace FLAC { Prototype(FLAC__metadata_object_new(FLAC__METADATA_TYPE_APPLICATION), /*copy=*/false) { } - Application::Application(::FLAC__StreamMetaData *object, bool copy): - Prototype(object, copy) - { } - Application::~Application() { } @@ -312,13 +346,19 @@ namespace FLAC { return object_->data.application.data; } - void Application::set_id(FLAC__byte value[4]) + void Application::set_id(const FLAC__byte value[4]) { FLAC__ASSERT(is_valid()); FLAC__ASSERT(0 != value); memcpy(object_->data.application.id, value, 4); } + bool Application::set_data(const FLAC__byte *data, unsigned length) + { + FLAC__ASSERT(is_valid()); + return (bool)::FLAC__metadata_object_application_set_data(object_, (FLAC__byte*)data, length, true); + } + bool Application::set_data(FLAC__byte *data, unsigned length, bool copy) { FLAC__ASSERT(is_valid()); @@ -334,10 +374,6 @@ namespace FLAC { Prototype(FLAC__metadata_object_new(FLAC__METADATA_TYPE_SEEKTABLE), /*copy=*/false) { } - SeekTable::SeekTable(::FLAC__StreamMetaData *object, bool copy): - Prototype(object, copy) - { } - SeekTable::~SeekTable() { } @@ -347,21 +383,21 @@ namespace FLAC { return object_->data.seek_table.num_points; } - ::FLAC__StreamMetaData_SeekPoint SeekTable::get_point(unsigned index) const + ::FLAC__StreamMetadata_SeekPoint SeekTable::get_point(unsigned index) const { FLAC__ASSERT(is_valid()); FLAC__ASSERT(index < object_->data.seek_table.num_points); return object_->data.seek_table.points[index]; } - void SeekTable::set_point(unsigned index, const ::FLAC__StreamMetaData_SeekPoint &point) + void SeekTable::set_point(unsigned index, const ::FLAC__StreamMetadata_SeekPoint &point) { FLAC__ASSERT(is_valid()); FLAC__ASSERT(index < object_->data.seek_table.num_points); ::FLAC__metadata_object_seektable_set_point(object_, index, point); } - bool SeekTable::insert_point(unsigned index, const ::FLAC__StreamMetaData_SeekPoint &point) + bool SeekTable::insert_point(unsigned index, const ::FLAC__StreamMetadata_SeekPoint &point) { FLAC__ASSERT(is_valid()); FLAC__ASSERT(index <= object_->data.seek_table.num_points); @@ -405,16 +441,16 @@ namespace FLAC { VorbisComment::Entry::Entry(const Entry &entry) { + FLAC__ASSERT(entry.is_valid()); zero(); - if(entry.is_valid()) - construct((const char *)entry.entry_.entry, entry.entry_.length); + construct((const char *)entry.entry_.entry, entry.entry_.length); } void VorbisComment::Entry::operator=(const Entry &entry) { + FLAC__ASSERT(entry.is_valid()); clear(); - if(entry.is_valid()) - construct((const char *)entry.entry_.entry, entry.entry_.length); + construct((const char *)entry.entry_.entry, entry.entry_.length); } VorbisComment::Entry::~Entry() @@ -445,7 +481,7 @@ namespace FLAC { return field_value_length_; } - ::FLAC__StreamMetaData_VorbisComment_Entry VorbisComment::Entry::get_entry() const + ::FLAC__StreamMetadata_VorbisComment_Entry VorbisComment::Entry::get_entry() const { FLAC__ASSERT(is_valid()); return entry_; @@ -477,14 +513,12 @@ namespace FLAC { clear_entry(); if(0 == (entry_.entry = (FLAC__byte*)malloc(field_length))) { - clear(); is_valid_ = false; } else { entry_.length = field_length; memcpy(entry_.entry, field, field_length); - parse_field(); - is_valid_ = true; + (void) parse_field(); } return is_valid_; @@ -498,13 +532,11 @@ namespace FLAC { clear_field_name(); if(0 == (field_name_ = strdup(field_name))) { - clear(); is_valid_ = false; } else { field_name_length_ = strlen(field_name_); compose_field(); - is_valid_ = true; } return is_valid_; @@ -518,14 +550,12 @@ namespace FLAC { clear_field_value(); if(0 == (field_value_ = (char *)malloc(field_value_length))) { - clear(); is_valid_ = false; } else { field_value_length_ = field_value_length; memcpy(field_value_, field_value, field_value_length); compose_field(); - is_valid_ = true; } return is_valid_; @@ -533,7 +563,7 @@ namespace FLAC { void VorbisComment::Entry::zero() { - is_valid_ = false; + is_valid_ = true; entry_.length = 0; entry_.entry = 0; field_name_ = 0; @@ -547,13 +577,12 @@ namespace FLAC { clear_entry(); clear_field_name(); clear_field_value(); - is_valid_ = false; + is_valid_ = true; } void VorbisComment::Entry::clear_entry() { if(0 != entry_.entry) { - FLAC__ASSERT(entry_.length == 0); free(entry_.entry); entry_.entry = 0; entry_.length = 0; @@ -563,7 +592,6 @@ namespace FLAC { void VorbisComment::Entry::clear_field_name() { if(0 != field_name_) { - FLAC__ASSERT(field_name_length_ == 0); free(field_name_); field_name_ = 0; field_name_length_ = 0; @@ -573,7 +601,6 @@ namespace FLAC { void VorbisComment::Entry::clear_field_value() { if(0 != field_value_) { - FLAC__ASSERT(field_name_length_ == 0); free(field_value_); field_value_ = 0; field_value_length_ = 0; @@ -582,21 +609,14 @@ namespace FLAC { void VorbisComment::Entry::construct(const char *field, unsigned field_length) { - set_field(field, field_length); - if(is_valid_) { + if(set_field(field, field_length)) parse_field(); - } } void VorbisComment::Entry::construct(const char *field_name, const char *field_value, unsigned field_value_length) { - set_field_name(field_name); - if(is_valid_) { - set_field_value(field_value, field_value_length); - if(is_valid_) { - compose_field(); - } - } + if(set_field_name(field_name) && set_field_value(field_value, field_value_length)) + compose_field(); } void VorbisComment::Entry::compose_field() @@ -604,14 +624,14 @@ namespace FLAC { clear_entry(); if(0 == (entry_.entry = (FLAC__byte*)malloc(field_name_length_ + 1 + field_value_length_))) { - clear(); + is_valid_ = false; } else { memcpy(entry_.entry, field_name_, field_name_length_); entry_.length += field_name_length_; memcpy(entry_.entry + entry_.length, "=", 1); entry_.length += 1; - memcpy(entry_.entry, field_value_, field_value_length_); + memcpy(entry_.entry + entry_.length, field_value_, field_value_length_); entry_.length += field_value_length_; is_valid_ = true; } @@ -624,25 +644,32 @@ namespace FLAC { const char *p = (const char *)memchr(entry_.entry, '=', entry_.length); - if(0 == p) { - clear(); - return; - } + if(0 == p) + p = (const char *)entry_.entry + entry_.length; - if(0 == (field_name_ = (char *)malloc(p - (const char *)entry_.entry + 1))) { // +1 for the trailing \0 - clear(); + field_name_length_ = p - (const char *)entry_.entry; + if(0 == (field_name_ = (char *)malloc(field_name_length_ + 1))) { // +1 for the trailing \0 + is_valid_ = false; return; } - field_name_length_ = p - (const char *)entry_.entry; memcpy(field_name_, entry_.entry, field_name_length_); field_name_[field_name_length_] = '\0'; - if(0 == (field_value_ = (char *)malloc(entry_.length - field_name_length_ - 1))) { - clear(); - return; + if(entry_.length - field_name_length_ == 0) { + field_value_length_ = 0; + if(0 == (field_value_ = (char *)malloc(0))) { + is_valid_ = false; + return; + } + } + else { + field_value_length_ = entry_.length - field_name_length_ - 1; + if(0 == (field_value_ = (char *)malloc(field_value_length_))) { + is_valid_ = false; + return; + } + memcpy(field_value_, ++p, field_value_length_); } - field_value_length_ = entry_.length - field_name_length_ - 1; - memcpy(field_value_, ++p, field_value_length_); is_valid_ = true; } @@ -656,10 +683,6 @@ namespace FLAC { Prototype(FLAC__metadata_object_new(FLAC__METADATA_TYPE_VORBIS_COMMENT), /*copy=*/false) { } - VorbisComment::VorbisComment(::FLAC__StreamMetaData *object, bool copy): - Prototype(object, copy) - { } - VorbisComment::~VorbisComment() { } @@ -679,13 +702,17 @@ namespace FLAC { { FLAC__ASSERT(is_valid()); FLAC__ASSERT(index < object_->data.vorbis_comment.num_comments); - return Entry((const char *)object_->data.vorbis_comment.vendor_string.entry, object_->data.vorbis_comment.vendor_string.length); + return Entry((const char *)object_->data.vorbis_comment.comments[index].entry, object_->data.vorbis_comment.comments[index].length); } bool VorbisComment::set_vendor_string(const VorbisComment::Entry &entry) { FLAC__ASSERT(is_valid()); - return (bool)::FLAC__metadata_object_vorbiscomment_set_vendor_string(object_, entry.get_entry(), /*copy=*/true); + // vendor_string is a special kind of entry + ::FLAC__StreamMetadata_VorbisComment_Entry vendor_string; + vendor_string.length = entry.get_field_name_length(); + vendor_string.entry = (FLAC__byte*)entry.get_field_name(); // we can cheat on const-ness because we make a copy below: + return (bool)::FLAC__metadata_object_vorbiscomment_set_vendor_string(object_, vendor_string, /*copy=*/true); } bool VorbisComment::set_comment(unsigned index, const VorbisComment::Entry &entry) @@ -720,9 +747,9 @@ namespace FLAC { { FLAC__ASSERT(0 != filename); - FLAC__StreamMetaData s; + ::FLAC__StreamMetadata s; - if(FLAC__metadata_get_streaminfo(filename, &s.data.stream_info)) { + if(::FLAC__metadata_get_streaminfo(filename, &s.data.stream_info)) { streaminfo = s; return true; } @@ -789,7 +816,7 @@ namespace FLAC { return (bool)::FLAC__metadata_simple_iterator_prev(iterator_); } - ::FLAC__MetaDataType SimpleIterator::get_block_type() const + ::FLAC__MetadataType SimpleIterator::get_block_type() const { FLAC__ASSERT(is_valid()); return ::FLAC__metadata_simple_iterator_get_block_type(iterator_); @@ -922,7 +949,7 @@ namespace FLAC { return (bool)::FLAC__metadata_iterator_prev(iterator_); } - ::FLAC__MetaDataType Iterator::get_block_type() const + ::FLAC__MetadataType Iterator::get_block_type() const { FLAC__ASSERT(is_valid()); return ::FLAC__metadata_iterator_get_block_type(iterator_); diff --git a/src/libFLAC++/seekable_stream_decoder.cc b/src/libFLAC++/seekable_stream_decoder.cc index c12b7c3d..85de0467 100644 --- a/src/libFLAC++/seekable_stream_decoder.cc +++ b/src/libFLAC++/seekable_stream_decoder.cc @@ -46,7 +46,7 @@ namespace FLAC { return (bool)::FLAC__seekable_stream_decoder_set_md5_checking(decoder_, value); } - bool SeekableStream::set_metadata_respond(::FLAC__MetaDataType type) + bool SeekableStream::set_metadata_respond(::FLAC__MetadataType type) { FLAC__ASSERT(is_valid()); return (bool)::FLAC__seekable_stream_decoder_set_metadata_respond(decoder_, type); @@ -64,7 +64,7 @@ namespace FLAC { return (bool)::FLAC__seekable_stream_decoder_set_metadata_respond_all(decoder_); } - bool SeekableStream::set_metadata_ignore(::FLAC__MetaDataType type) + bool SeekableStream::set_metadata_ignore(::FLAC__MetadataType type) { FLAC__ASSERT(is_valid()); return (bool)::FLAC__seekable_stream_decoder_set_metadata_ignore(decoder_, type); @@ -241,7 +241,7 @@ namespace FLAC { return instance->write_callback(frame, buffer); } - void SeekableStream::metadata_callback_(const ::FLAC__SeekableStreamDecoder *decoder, const ::FLAC__StreamMetaData *metadata, void *client_data) + void SeekableStream::metadata_callback_(const ::FLAC__SeekableStreamDecoder *decoder, const ::FLAC__StreamMetadata *metadata, void *client_data) { (void) decoder; FLAC__ASSERT(0 != client_data); diff --git a/src/libFLAC++/stream_decoder.cc b/src/libFLAC++/stream_decoder.cc index faa7ece0..106a43ee 100644 --- a/src/libFLAC++/stream_decoder.cc +++ b/src/libFLAC++/stream_decoder.cc @@ -40,7 +40,7 @@ namespace FLAC { return 0 != decoder_; } - bool Stream::set_metadata_respond(::FLAC__MetaDataType type) + bool Stream::set_metadata_respond(::FLAC__MetadataType type) { FLAC__ASSERT(is_valid()); return (bool)::FLAC__stream_decoder_set_metadata_respond(decoder_, type); @@ -58,7 +58,7 @@ namespace FLAC { return (bool)::FLAC__stream_decoder_set_metadata_respond_all(decoder_); } - bool Stream::set_metadata_ignore(::FLAC__MetaDataType type) + bool Stream::set_metadata_ignore(::FLAC__MetadataType type) { FLAC__ASSERT(is_valid()); return (bool)::FLAC__stream_decoder_set_metadata_ignore(decoder_, type); @@ -183,7 +183,7 @@ namespace FLAC { return instance->write_callback(frame, buffer); } - void Stream::metadata_callback_(const ::FLAC__StreamDecoder *decoder, const ::FLAC__StreamMetaData *metadata, void *client_data) + void Stream::metadata_callback_(const ::FLAC__StreamDecoder *decoder, const ::FLAC__StreamMetadata *metadata, void *client_data) { (void)decoder; FLAC__ASSERT(0 != client_data); diff --git a/src/libFLAC++/stream_encoder.cc b/src/libFLAC++/stream_encoder.cc index b756cb0a..a9997864 100644 --- a/src/libFLAC++/stream_encoder.cc +++ b/src/libFLAC++/stream_encoder.cc @@ -136,7 +136,7 @@ namespace FLAC { return (bool)::FLAC__stream_encoder_set_total_samples_estimate(encoder_, value); } - bool Stream::set_metadata(::FLAC__StreamMetaData **metadata, unsigned num_blocks) + bool Stream::set_metadata(::FLAC__StreamMetadata **metadata, unsigned num_blocks) { FLAC__ASSERT(is_valid()); return (bool)::FLAC__stream_encoder_set_metadata(encoder_, metadata, num_blocks); @@ -274,7 +274,7 @@ namespace FLAC { return instance->write_callback(buffer, bytes, samples, current_frame); } - void Stream::metadata_callback_(const ::FLAC__StreamEncoder *encoder, const ::FLAC__StreamMetaData *metadata, void *client_data) + void Stream::metadata_callback_(const ::FLAC__StreamEncoder *encoder, const ::FLAC__StreamMetadata *metadata, void *client_data) { (void)encoder; FLAC__ASSERT(0 != client_data); diff --git a/src/libFLAC/file_decoder.c b/src/libFLAC/file_decoder.c index 62a926dd..67e3c66b 100644 --- a/src/libFLAC/file_decoder.c +++ b/src/libFLAC/file_decoder.c @@ -46,7 +46,7 @@ static FLAC__SeekableStreamDecoderTellStatus tell_callback_(const FLAC__Seekable 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 * const buffer[], void *client_data); -static void metadata_callback_(const FLAC__SeekableStreamDecoder *decoder, const FLAC__StreamMetaData *metadata, 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); /*********************************************************************** @@ -57,7 +57,7 @@ static void error_callback_(const FLAC__SeekableStreamDecoder *decoder, FLAC__St typedef struct FLAC__FileDecoderPrivate { FLAC__StreamDecoderWriteStatus (*write_callback)(const FLAC__FileDecoder *decoder, const FLAC__Frame *frame, const FLAC__int32 * const buffer[], void *client_data); - void (*metadata_callback)(const FLAC__FileDecoder *decoder, const FLAC__StreamMetaData *metadata, void *client_data); + void (*metadata_callback)(const FLAC__FileDecoder *decoder, const FLAC__StreamMetadata *metadata, void *client_data); void (*error_callback)(const FLAC__FileDecoder *decoder, FLAC__StreamDecoderErrorStatus status, void *client_data); void *client_data; FILE *file; @@ -254,7 +254,7 @@ FLAC__bool FLAC__file_decoder_set_write_callback(FLAC__FileDecoder *decoder, FLA return true; } -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_metadata_callback(FLAC__FileDecoder *decoder, void (*value)(const FLAC__FileDecoder *decoder, const FLAC__StreamMetadata *metadata, void *client_data)) { FLAC__ASSERT(decoder != 0); FLAC__ASSERT(decoder->private_ != 0); @@ -287,7 +287,7 @@ FLAC__bool FLAC__file_decoder_set_client_data(FLAC__FileDecoder *decoder, void * return true; } -FLAC__bool FLAC__file_decoder_set_metadata_respond(FLAC__FileDecoder *decoder, FLAC__MetaDataType type) +FLAC__bool FLAC__file_decoder_set_metadata_respond(FLAC__FileDecoder *decoder, FLAC__MetadataType type) { FLAC__ASSERT(decoder != 0); FLAC__ASSERT(decoder->private_ != 0); @@ -320,7 +320,7 @@ FLAC__bool FLAC__file_decoder_set_metadata_respond_all(FLAC__FileDecoder *decode return FLAC__seekable_stream_decoder_set_metadata_respond_all(decoder->private_->seekable_stream_decoder); } -FLAC__bool FLAC__file_decoder_set_metadata_ignore(FLAC__FileDecoder *decoder, FLAC__MetaDataType type) +FLAC__bool FLAC__file_decoder_set_metadata_ignore(FLAC__FileDecoder *decoder, FLAC__MetadataType type) { FLAC__ASSERT(decoder != 0); FLAC__ASSERT(decoder->private_ != 0); @@ -611,7 +611,7 @@ FLAC__StreamDecoderWriteStatus write_callback_(const FLAC__SeekableStreamDecoder return file_decoder->private_->write_callback(file_decoder, frame, buffer, file_decoder->private_->client_data); } -void metadata_callback_(const FLAC__SeekableStreamDecoder *decoder, const FLAC__StreamMetaData *metadata, void *client_data) +void metadata_callback_(const FLAC__SeekableStreamDecoder *decoder, const FLAC__StreamMetadata *metadata, void *client_data) { FLAC__FileDecoder *file_decoder = (FLAC__FileDecoder *)client_data; (void)decoder; diff --git a/src/libFLAC/format.c b/src/libFLAC/format.c index f8eae477..6c17b602 100644 --- a/src/libFLAC/format.c +++ b/src/libFLAC/format.c @@ -103,7 +103,7 @@ const char * const FLAC__FrameNumberTypeString[] = { "FRAME_NUMBER_TYPE_SAMPLE_NUMBER" }; -const char * const FLAC__MetaDataTypeString[] = { +const char * const FLAC__MetadataTypeString[] = { "STREAMINFO", "PADDING", "APPLICATION", diff --git a/src/libFLAC/include/private/metadata.h b/src/libFLAC/include/private/metadata.h index a2e55324..de845d38 100644 --- a/src/libFLAC/include/private/metadata.h +++ b/src/libFLAC/include/private/metadata.h @@ -22,6 +22,6 @@ #include "FLAC/metadata.h" -void FLAC__metadata_object_delete_data(FLAC__StreamMetaData *object); +void FLAC__metadata_object_delete_data(FLAC__StreamMetadata *object); #endif diff --git a/src/libFLAC/include/private/stream_encoder_framing.h b/src/libFLAC/include/private/stream_encoder_framing.h index 6b94ab73..4908db47 100644 --- a/src/libFLAC/include/private/stream_encoder_framing.h +++ b/src/libFLAC/include/private/stream_encoder_framing.h @@ -23,7 +23,7 @@ #include "FLAC/format.h" #include "bitbuffer.h" -FLAC__bool FLAC__add_metadata_block(const FLAC__StreamMetaData *metadata, FLAC__BitBuffer *bb); +FLAC__bool FLAC__add_metadata_block(const FLAC__StreamMetadata *metadata, FLAC__BitBuffer *bb); FLAC__bool FLAC__frame_add_header(const FLAC__FrameHeader *header, FLAC__bool streamable_subset, FLAC__bool is_last_block, FLAC__BitBuffer *bb); FLAC__bool FLAC__subframe_add_constant(const FLAC__Subframe_Constant *subframe, unsigned subframe_bps, unsigned wasted_bits, FLAC__BitBuffer *bb); FLAC__bool FLAC__subframe_add_fixed(const FLAC__Subframe_Fixed *subframe, unsigned residual_samples, unsigned subframe_bps, unsigned wasted_bits, FLAC__BitBuffer *bb); diff --git a/src/libFLAC/include/protected/stream_encoder.h b/src/libFLAC/include/protected/stream_encoder.h index 5d4dcd21..9f2d6a41 100644 --- a/src/libFLAC/include/protected/stream_encoder.h +++ b/src/libFLAC/include/protected/stream_encoder.h @@ -40,7 +40,7 @@ typedef struct FLAC__StreamEncoderProtected { unsigned max_residual_partition_order; unsigned rice_parameter_search_dist; FLAC__uint64 total_samples_estimate; - FLAC__StreamMetaData **metadata; + FLAC__StreamMetadata **metadata; unsigned num_metadata_blocks; } FLAC__StreamEncoderProtected; diff --git a/src/libFLAC/metadata_iterators.c b/src/libFLAC/metadata_iterators.c index b6f177f1..b34ae897 100644 --- a/src/libFLAC/metadata_iterators.c +++ b/src/libFLAC/metadata_iterators.c @@ -60,49 +60,49 @@ static FLAC__uint32 unpack_uint32_(FLAC__byte *b, unsigned bytes); static FLAC__uint32 unpack_uint32_little_endian_(FLAC__byte *b, unsigned bytes); static FLAC__uint64 unpack_uint64_(FLAC__byte *b, unsigned bytes); -static FLAC__bool read_metadata_block_header_(FLAC__MetaData_SimpleIterator *iterator); -static FLAC__bool read_metadata_block_data_(FLAC__MetaData_SimpleIterator *iterator, FLAC__StreamMetaData *block); -static FLAC__MetaData_SimpleIteratorStatus read_metadata_block_data_streaminfo_(FILE *file, FLAC__StreamMetaData_StreamInfo *block); -static FLAC__MetaData_SimpleIteratorStatus read_metadata_block_data_padding_(FILE *file, FLAC__StreamMetaData_Padding *block, unsigned block_length); -static FLAC__MetaData_SimpleIteratorStatus read_metadata_block_data_application_(FILE *file, FLAC__StreamMetaData_Application *block, unsigned block_length); -static FLAC__MetaData_SimpleIteratorStatus read_metadata_block_data_seektable_(FILE *file, FLAC__StreamMetaData_SeekTable *block, unsigned block_length); -static FLAC__MetaData_SimpleIteratorStatus read_metadata_block_data_vorbis_comment_entry_(FILE *file, FLAC__StreamMetaData_VorbisComment_Entry *entry); -static FLAC__MetaData_SimpleIteratorStatus read_metadata_block_data_vorbis_comment_(FILE *file, FLAC__StreamMetaData_VorbisComment *block); - -static FLAC__bool write_metadata_block_header_(FILE *file, FLAC__MetaData_SimpleIteratorStatus *status, const FLAC__StreamMetaData *block); -static FLAC__bool write_metadata_block_data_(FILE *file, FLAC__MetaData_SimpleIteratorStatus *status, const FLAC__StreamMetaData *block); -static FLAC__MetaData_SimpleIteratorStatus write_metadata_block_data_streaminfo_(FILE *file, const FLAC__StreamMetaData_StreamInfo *block); -static FLAC__MetaData_SimpleIteratorStatus write_metadata_block_data_padding_(FILE *file, const FLAC__StreamMetaData_Padding *block, unsigned block_length); -static FLAC__MetaData_SimpleIteratorStatus write_metadata_block_data_application_(FILE *file, const FLAC__StreamMetaData_Application *block, unsigned block_length); -static FLAC__MetaData_SimpleIteratorStatus write_metadata_block_data_seektable_(FILE *file, const FLAC__StreamMetaData_SeekTable *block); -static FLAC__MetaData_SimpleIteratorStatus write_metadata_block_data_vorbis_comment_(FILE *file, const FLAC__StreamMetaData_VorbisComment *block); -static FLAC__bool write_metadata_block_stationary_(FLAC__MetaData_SimpleIterator *iterator, const FLAC__StreamMetaData *block); -static FLAC__bool write_metadata_block_stationary_with_padding_(FLAC__MetaData_SimpleIterator *iterator, FLAC__StreamMetaData *block, unsigned padding_length, FLAC__bool padding_is_last); -static FLAC__bool rewrite_whole_file_(FLAC__MetaData_SimpleIterator *iterator, FLAC__StreamMetaData *block, FLAC__bool append); - -static FLAC__bool chain_rewrite_chain_(FLAC__MetaData_Chain *chain); -static FLAC__bool chain_rewrite_file_(FLAC__MetaData_Chain *chain, const char *tempfile_path_prefix); - -static void simple_iterator_push_(FLAC__MetaData_SimpleIterator *iterator); -static FLAC__bool simple_iterator_pop_(FLAC__MetaData_SimpleIterator *iterator); +static FLAC__bool read_metadata_block_header_(FLAC__Metadata_SimpleIterator *iterator); +static FLAC__bool read_metadata_block_data_(FLAC__Metadata_SimpleIterator *iterator, FLAC__StreamMetadata *block); +static FLAC__Metadata_SimpleIteratorStatus read_metadata_block_data_streaminfo_(FILE *file, FLAC__StreamMetadata_StreamInfo *block); +static FLAC__Metadata_SimpleIteratorStatus read_metadata_block_data_padding_(FILE *file, FLAC__StreamMetadata_Padding *block, unsigned block_length); +static FLAC__Metadata_SimpleIteratorStatus read_metadata_block_data_application_(FILE *file, FLAC__StreamMetadata_Application *block, unsigned block_length); +static FLAC__Metadata_SimpleIteratorStatus read_metadata_block_data_seektable_(FILE *file, FLAC__StreamMetadata_SeekTable *block, unsigned block_length); +static FLAC__Metadata_SimpleIteratorStatus read_metadata_block_data_vorbis_comment_entry_(FILE *file, FLAC__StreamMetadata_VorbisComment_Entry *entry); +static FLAC__Metadata_SimpleIteratorStatus read_metadata_block_data_vorbis_comment_(FILE *file, FLAC__StreamMetadata_VorbisComment *block); + +static FLAC__bool write_metadata_block_header_(FILE *file, FLAC__Metadata_SimpleIteratorStatus *status, const FLAC__StreamMetadata *block); +static FLAC__bool write_metadata_block_data_(FILE *file, FLAC__Metadata_SimpleIteratorStatus *status, const FLAC__StreamMetadata *block); +static FLAC__Metadata_SimpleIteratorStatus write_metadata_block_data_streaminfo_(FILE *file, const FLAC__StreamMetadata_StreamInfo *block); +static FLAC__Metadata_SimpleIteratorStatus write_metadata_block_data_padding_(FILE *file, const FLAC__StreamMetadata_Padding *block, unsigned block_length); +static FLAC__Metadata_SimpleIteratorStatus write_metadata_block_data_application_(FILE *file, const FLAC__StreamMetadata_Application *block, unsigned block_length); +static FLAC__Metadata_SimpleIteratorStatus write_metadata_block_data_seektable_(FILE *file, const FLAC__StreamMetadata_SeekTable *block); +static FLAC__Metadata_SimpleIteratorStatus write_metadata_block_data_vorbis_comment_(FILE *file, const FLAC__StreamMetadata_VorbisComment *block); +static FLAC__bool write_metadata_block_stationary_(FLAC__Metadata_SimpleIterator *iterator, const FLAC__StreamMetadata *block); +static FLAC__bool write_metadata_block_stationary_with_padding_(FLAC__Metadata_SimpleIterator *iterator, FLAC__StreamMetadata *block, unsigned padding_length, FLAC__bool padding_is_last); +static FLAC__bool rewrite_whole_file_(FLAC__Metadata_SimpleIterator *iterator, FLAC__StreamMetadata *block, FLAC__bool append); + +static FLAC__bool chain_rewrite_chain_(FLAC__Metadata_Chain *chain); +static FLAC__bool chain_rewrite_file_(FLAC__Metadata_Chain *chain, const char *tempfile_path_prefix); + +static void simple_iterator_push_(FLAC__Metadata_SimpleIterator *iterator); +static FLAC__bool simple_iterator_pop_(FLAC__Metadata_SimpleIterator *iterator); /* return 0 if OK, 1 if read error, 2 if not a FLAC file */ static unsigned seek_to_first_metadata_block_(FILE *f); -static FLAC__bool simple_iterator_copy_file_prefix_(FLAC__MetaData_SimpleIterator *iterator, FILE **tempfile, char **tempfilename, FLAC__bool append); -static FLAC__bool simple_iterator_copy_file_postfix_(FLAC__MetaData_SimpleIterator *iterator, FILE **tempfile, char **tempfilename, int fixup_is_last_code, long fixup_is_last_flag_offset, FLAC__bool backup); +static FLAC__bool simple_iterator_copy_file_prefix_(FLAC__Metadata_SimpleIterator *iterator, FILE **tempfile, char **tempfilename, FLAC__bool append); +static FLAC__bool simple_iterator_copy_file_postfix_(FLAC__Metadata_SimpleIterator *iterator, FILE **tempfile, char **tempfilename, int fixup_is_last_code, long fixup_is_last_flag_offset, FLAC__bool backup); -static FLAC__bool copy_n_bytes_from_file_(FILE *file, FILE *tempfile, unsigned bytes/*@@@ 4G limit*/, FLAC__MetaData_SimpleIteratorStatus *status); -static FLAC__bool copy_remaining_bytes_from_file_(FILE *file, FILE *tempfile, FLAC__MetaData_SimpleIteratorStatus *status); +static FLAC__bool copy_n_bytes_from_file_(FILE *file, FILE *tempfile, unsigned bytes/*@@@ 4G limit*/, FLAC__Metadata_SimpleIteratorStatus *status); +static FLAC__bool copy_remaining_bytes_from_file_(FILE *file, FILE *tempfile, FLAC__Metadata_SimpleIteratorStatus *status); -static FLAC__bool open_tempfile_(const char *filename, const char *tempfile_path_prefix, FILE **tempfile, char **tempfilename, FLAC__MetaData_SimpleIteratorStatus *status); -static FLAC__bool transport_tempfile_(const char *filename, FILE **tempfile, char **tempfilename, FLAC__MetaData_SimpleIteratorStatus *status); +static FLAC__bool open_tempfile_(const char *filename, const char *tempfile_path_prefix, FILE **tempfile, char **tempfilename, FLAC__Metadata_SimpleIteratorStatus *status); +static FLAC__bool transport_tempfile_(const char *filename, FILE **tempfile, char **tempfilename, FLAC__Metadata_SimpleIteratorStatus *status); static void cleanup_tempfile_(FILE **tempfile, char **tempfilename); static FLAC__bool get_file_stats_(const char *filename, struct stat *stats); static void set_file_stats_(const char *filename, struct stat *stats); -static FLAC__MetaData_ChainStatus get_equivalent_status_(FLAC__MetaData_SimpleIteratorStatus status); +static FLAC__Metadata_ChainStatus get_equivalent_status_(FLAC__Metadata_SimpleIteratorStatus status); /**************************************************************************** @@ -112,16 +112,16 @@ static FLAC__MetaData_ChainStatus get_equivalent_status_(FLAC__MetaData_SimpleIt ***************************************************************************/ 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 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); typedef struct { FLAC__bool got_error; FLAC__bool got_streaminfo; - FLAC__StreamMetaData_StreamInfo *streaminfo; + FLAC__StreamMetadata_StreamInfo *streaminfo; } level0_client_data; -FLAC__bool FLAC__metadata_get_streaminfo(const char *filename, FLAC__StreamMetaData_StreamInfo *streaminfo) +FLAC__bool FLAC__metadata_get_streaminfo(const char *filename, FLAC__StreamMetadata_StreamInfo *streaminfo) { level0_client_data cd; FLAC__FileDecoder *decoder = FLAC__file_decoder_new(); @@ -165,7 +165,7 @@ FLAC__StreamDecoderWriteStatus write_callback_(const FLAC__FileDecoder *decoder, return FLAC__STREAM_DECODER_WRITE_STATUS_CONTINUE; } -void metadata_callback_(const FLAC__FileDecoder *decoder, const FLAC__StreamMetaData *metadata, void *client_data) +void metadata_callback_(const FLAC__FileDecoder *decoder, const FLAC__StreamMetadata *metadata, void *client_data) { level0_client_data *cd = (level0_client_data *)client_data; (void)decoder; @@ -195,24 +195,24 @@ void error_callback_(const FLAC__FileDecoder *decoder, FLAC__StreamDecoderErrorS #define SIMPLE_ITERATOR_MAX_PUSH_DEPTH (1+4) /* 1 for initial offset, +4 for our own personal use */ -struct FLAC__MetaData_SimpleIterator { +struct FLAC__Metadata_SimpleIterator { FILE *file; char *filename, *tempfile_path_prefix; struct stat stats; FLAC__bool has_stats; FLAC__bool is_writable; - FLAC__MetaData_SimpleIteratorStatus status; + FLAC__Metadata_SimpleIteratorStatus status; /*@@@ 2G limits here because of the offset type: */ long offset[SIMPLE_ITERATOR_MAX_PUSH_DEPTH]; long first_offset; /* this is the offset to the STREAMINFO block */ unsigned depth; /* this is the metadata block header of the current block we are pointing to: */ FLAC__bool is_last; - FLAC__MetaDataType type; + FLAC__MetadataType type; unsigned length; }; -const char * const FLAC__MetaData_SimpleIteratorStatusString[] = { +const char * const FLAC__Metadata_SimpleIteratorStatusString[] = { "FLAC__METADATA_SIMPLE_ITERATOR_STATUS_OK", "FLAC__METADATA_SIMPLE_ITERATOR_STATUS_ILLEGAL_INPUT", "FLAC__METADATA_SIMPLE_ITERATOR_STATUS_ERROR_OPENING_FILE", @@ -229,9 +229,9 @@ const char * const FLAC__MetaData_SimpleIteratorStatusString[] = { }; -FLAC__MetaData_SimpleIterator *FLAC__metadata_simple_iterator_new() +FLAC__Metadata_SimpleIterator *FLAC__metadata_simple_iterator_new() { - FLAC__MetaData_SimpleIterator *iterator = malloc(sizeof(FLAC__MetaData_SimpleIterator)); + FLAC__Metadata_SimpleIterator *iterator = malloc(sizeof(FLAC__Metadata_SimpleIterator)); if(0 != iterator) { iterator->file = 0; @@ -247,7 +247,7 @@ FLAC__MetaData_SimpleIterator *FLAC__metadata_simple_iterator_new() return iterator; } -static void simple_iterator_free_guts_(FLAC__MetaData_SimpleIterator *iterator) +static void simple_iterator_free_guts_(FLAC__Metadata_SimpleIterator *iterator) { FLAC__ASSERT(0 != iterator); @@ -267,7 +267,7 @@ static void simple_iterator_free_guts_(FLAC__MetaData_SimpleIterator *iterator) } } -void FLAC__metadata_simple_iterator_delete(FLAC__MetaData_SimpleIterator *iterator) +void FLAC__metadata_simple_iterator_delete(FLAC__Metadata_SimpleIterator *iterator) { FLAC__ASSERT(0 != iterator); @@ -275,9 +275,9 @@ void FLAC__metadata_simple_iterator_delete(FLAC__MetaData_SimpleIterator *iterat free(iterator); } -FLAC__MetaData_SimpleIteratorStatus FLAC__metadata_simple_iterator_status(FLAC__MetaData_SimpleIterator *iterator) +FLAC__Metadata_SimpleIteratorStatus FLAC__metadata_simple_iterator_status(FLAC__Metadata_SimpleIterator *iterator) { - FLAC__MetaData_SimpleIteratorStatus status; + FLAC__Metadata_SimpleIteratorStatus status; FLAC__ASSERT(0 != iterator); @@ -286,7 +286,7 @@ FLAC__MetaData_SimpleIteratorStatus FLAC__metadata_simple_iterator_status(FLAC__ return status; } -static FLAC__bool simple_iterator_prime_input_(FLAC__MetaData_SimpleIterator *iterator) +static FLAC__bool simple_iterator_prime_input_(FLAC__Metadata_SimpleIterator *iterator) { unsigned ret; @@ -343,10 +343,10 @@ static FLAC__bool simple_iterator_prime_input_(FLAC__MetaData_SimpleIterator *it * '/' as the directory separator. A trailing slash is not needed; it * will be added automatically. */ -FLAC__bool FLAC__metadata_simple_iterator_init(FLAC__MetaData_SimpleIterator *iterator, const char *filename, FLAC__bool preserve_file_stats, const char *tempfile_path_prefix); +FLAC__bool FLAC__metadata_simple_iterator_init(FLAC__Metadata_SimpleIterator *iterator, const char *filename, FLAC__bool preserve_file_stats, const char *tempfile_path_prefix); #endif -FLAC__bool FLAC__metadata_simple_iterator_init(FLAC__MetaData_SimpleIterator *iterator, const char *filename, FLAC__bool preserve_file_stats) +FLAC__bool FLAC__metadata_simple_iterator_init(FLAC__Metadata_SimpleIterator *iterator, const char *filename, FLAC__bool preserve_file_stats) { const char *tempfile_path_prefix = 0; /*@@@ search for comments near 'rename(...)' for what it will take to finish implementing this */ @@ -370,7 +370,7 @@ FLAC__bool FLAC__metadata_simple_iterator_init(FLAC__MetaData_SimpleIterator *it return simple_iterator_prime_input_(iterator); } -FLAC__bool FLAC__metadata_simple_iterator_is_writable(const FLAC__MetaData_SimpleIterator *iterator) +FLAC__bool FLAC__metadata_simple_iterator_is_writable(const FLAC__Metadata_SimpleIterator *iterator) { FLAC__ASSERT(0 != iterator); FLAC__ASSERT(0 != iterator->file); @@ -378,7 +378,7 @@ FLAC__bool FLAC__metadata_simple_iterator_is_writable(const FLAC__MetaData_Simpl return iterator->is_writable; } -FLAC__bool FLAC__metadata_simple_iterator_next(FLAC__MetaData_SimpleIterator *iterator) +FLAC__bool FLAC__metadata_simple_iterator_next(FLAC__Metadata_SimpleIterator *iterator) { FLAC__ASSERT(0 != iterator); FLAC__ASSERT(0 != iterator->file); @@ -396,7 +396,7 @@ FLAC__bool FLAC__metadata_simple_iterator_next(FLAC__MetaData_SimpleIterator *it return read_metadata_block_header_(iterator); } -FLAC__bool FLAC__metadata_simple_iterator_prev(FLAC__MetaData_SimpleIterator *iterator) +FLAC__bool FLAC__metadata_simple_iterator_prev(FLAC__Metadata_SimpleIterator *iterator) { long this_offset; @@ -430,7 +430,7 @@ FLAC__bool FLAC__metadata_simple_iterator_prev(FLAC__MetaData_SimpleIterator *it return true; } -FLAC__MetaDataType FLAC__metadata_simple_iterator_get_block_type(const FLAC__MetaData_SimpleIterator *iterator) +FLAC__MetadataType FLAC__metadata_simple_iterator_get_block_type(const FLAC__Metadata_SimpleIterator *iterator) { FLAC__ASSERT(0 != iterator); FLAC__ASSERT(0 != iterator->file); @@ -438,9 +438,9 @@ FLAC__MetaDataType FLAC__metadata_simple_iterator_get_block_type(const FLAC__Met return iterator->type; } -FLAC__StreamMetaData *FLAC__metadata_simple_iterator_get_block(FLAC__MetaData_SimpleIterator *iterator) +FLAC__StreamMetadata *FLAC__metadata_simple_iterator_get_block(FLAC__Metadata_SimpleIterator *iterator) { - FLAC__StreamMetaData *block = FLAC__metadata_object_new(iterator->type); + FLAC__StreamMetadata *block = FLAC__metadata_object_new(iterator->type); FLAC__ASSERT(0 != iterator); FLAC__ASSERT(0 != iterator->file); @@ -467,7 +467,7 @@ FLAC__StreamMetaData *FLAC__metadata_simple_iterator_get_block(FLAC__MetaData_Si return block; } -FLAC__bool FLAC__metadata_simple_iterator_set_block(FLAC__MetaData_SimpleIterator *iterator, FLAC__StreamMetaData *block, FLAC__bool use_padding) +FLAC__bool FLAC__metadata_simple_iterator_set_block(FLAC__Metadata_SimpleIterator *iterator, FLAC__StreamMetadata *block, FLAC__bool use_padding) { FLAC__ASSERT_DECLARATION(long debug_target_offset = iterator->offset[iterator->depth];) FLAC__bool ret; @@ -564,7 +564,7 @@ FLAC__bool FLAC__metadata_simple_iterator_set_block(FLAC__MetaData_SimpleIterato } } -FLAC__bool FLAC__metadata_simple_iterator_insert_block_after(FLAC__MetaData_SimpleIterator *iterator, FLAC__StreamMetaData *block, FLAC__bool use_padding) +FLAC__bool FLAC__metadata_simple_iterator_insert_block_after(FLAC__Metadata_SimpleIterator *iterator, FLAC__StreamMetadata *block, FLAC__bool use_padding) { unsigned padding_leftover = 0; FLAC__bool padding_is_last = false; @@ -642,7 +642,7 @@ FLAC__bool FLAC__metadata_simple_iterator_insert_block_after(FLAC__MetaData_Simp } } -FLAC__bool FLAC__metadata_simple_iterator_delete_block(FLAC__MetaData_SimpleIterator *iterator, FLAC__bool use_padding) +FLAC__bool FLAC__metadata_simple_iterator_delete_block(FLAC__Metadata_SimpleIterator *iterator, FLAC__bool use_padding) { FLAC__ASSERT_DECLARATION(long debug_target_offset = iterator->offset[iterator->depth];) FLAC__bool ret; @@ -653,7 +653,7 @@ FLAC__bool FLAC__metadata_simple_iterator_delete_block(FLAC__MetaData_SimpleIter } if(use_padding) { - FLAC__StreamMetaData *padding = FLAC__metadata_object_new(FLAC__METADATA_TYPE_PADDING); + FLAC__StreamMetadata *padding = FLAC__metadata_object_new(FLAC__METADATA_TYPE_PADDING); if(0 == padding) { iterator->status = FLAC__METADATA_SIMPLE_ITERATOR_STATUS_MEMORY_ALLOCATION_ERROR; return false; @@ -687,17 +687,17 @@ FLAC__bool FLAC__metadata_simple_iterator_delete_block(FLAC__MetaData_SimpleIter ***************************************************************************/ -typedef struct FLAC__MetaData_Node { - FLAC__StreamMetaData *data; - struct FLAC__MetaData_Node *prev, *next; -} FLAC__MetaData_Node; +typedef struct FLAC__Metadata_Node { + FLAC__StreamMetadata *data; + struct FLAC__Metadata_Node *prev, *next; +} FLAC__Metadata_Node; -struct FLAC__MetaData_Chain { +struct FLAC__Metadata_Chain { char *filename; - FLAC__MetaData_Node *head; - FLAC__MetaData_Node *tail; + FLAC__Metadata_Node *head; + FLAC__Metadata_Node *tail; unsigned nodes; - FLAC__MetaData_ChainStatus status; + FLAC__Metadata_ChainStatus status; long first_offset, last_offset; /*@@@ 2G limit */ /* * This is the length of the chain initially read from the FLAC file. @@ -708,12 +708,12 @@ struct FLAC__MetaData_Chain { unsigned current_length; /*@@@ 4G limit */ }; -struct FLAC__MetaData_Iterator { - FLAC__MetaData_Chain *chain; - FLAC__MetaData_Node *current; +struct FLAC__Metadata_Iterator { + FLAC__Metadata_Chain *chain; + FLAC__Metadata_Node *current; }; -const char * const FLAC__MetaData_ChainStatusString[] = { +const char * const FLAC__Metadata_ChainStatusString[] = { "FLAC__METADATA_CHAIN_STATUS_OK", "FLAC__METADATA_CHAIN_STATUS_ILLEGAL_INPUT", "FLAC__METADATA_CHAIN_STATUS_ERROR_OPENING_FILE", @@ -730,15 +730,15 @@ const char * const FLAC__MetaData_ChainStatusString[] = { }; -static FLAC__MetaData_Node *node_new_() +static FLAC__Metadata_Node *node_new_() { - FLAC__MetaData_Node *node = (FLAC__MetaData_Node*)malloc(sizeof(FLAC__MetaData_Node)); + FLAC__Metadata_Node *node = (FLAC__Metadata_Node*)malloc(sizeof(FLAC__Metadata_Node)); if(0 != node) - memset(node, 0, sizeof(FLAC__MetaData_Node)); + memset(node, 0, sizeof(FLAC__Metadata_Node)); return node; } -static void node_delete_(FLAC__MetaData_Node *node) +static void node_delete_(FLAC__Metadata_Node *node) { FLAC__ASSERT(0 != node); if(0 != node->data) @@ -746,7 +746,7 @@ static void node_delete_(FLAC__MetaData_Node *node) free(node); } -static void chain_append_node_(FLAC__MetaData_Chain *chain, FLAC__MetaData_Node *node) +static void chain_append_node_(FLAC__Metadata_Chain *chain, FLAC__Metadata_Node *node) { FLAC__ASSERT(0 != chain); FLAC__ASSERT(0 != node); @@ -769,7 +769,7 @@ static void chain_append_node_(FLAC__MetaData_Chain *chain, FLAC__MetaData_Node chain->current_length += (FLAC__STREAM_METADATA_HEADER_LENGTH + node->data->length); } -static void chain_remove_node_(FLAC__MetaData_Chain *chain, FLAC__MetaData_Node *node) +static void chain_remove_node_(FLAC__Metadata_Chain *chain, FLAC__Metadata_Node *node) { FLAC__ASSERT(0 != chain); FLAC__ASSERT(0 != node); @@ -791,13 +791,13 @@ static void chain_remove_node_(FLAC__MetaData_Chain *chain, FLAC__MetaData_Node chain->current_length -= (FLAC__STREAM_METADATA_HEADER_LENGTH + node->data->length); } -static void chain_delete_node_(FLAC__MetaData_Chain *chain, FLAC__MetaData_Node *node) +static void chain_delete_node_(FLAC__Metadata_Chain *chain, FLAC__Metadata_Node *node) { chain_remove_node_(chain, node); node_delete_(node); } -static void iterator_insert_node_(FLAC__MetaData_Iterator *iterator, FLAC__MetaData_Node *node) +static void iterator_insert_node_(FLAC__Metadata_Iterator *iterator, FLAC__Metadata_Node *node) { FLAC__ASSERT(0 != node); FLAC__ASSERT(0 != node->data); @@ -823,7 +823,7 @@ static void iterator_insert_node_(FLAC__MetaData_Iterator *iterator, FLAC__MetaD iterator->chain->current_length += (FLAC__STREAM_METADATA_HEADER_LENGTH + node->data->length); } -static void iterator_insert_node_after_(FLAC__MetaData_Iterator *iterator, FLAC__MetaData_Node *node) +static void iterator_insert_node_after_(FLAC__Metadata_Iterator *iterator, FLAC__Metadata_Node *node) { FLAC__ASSERT(0 != node); FLAC__ASSERT(0 != node->data); @@ -852,7 +852,7 @@ static void iterator_insert_node_after_(FLAC__MetaData_Iterator *iterator, FLAC_ } /* return true iff node and node->next are both padding */ -static FLAC__bool chain_merge_adjacent_padding_(FLAC__MetaData_Chain *chain, FLAC__MetaData_Node *node) +static FLAC__bool chain_merge_adjacent_padding_(FLAC__Metadata_Chain *chain, FLAC__Metadata_Node *node) { if(node->data->type == FLAC__METADATA_TYPE_PADDING && 0 != node->next && node->next->data->type == FLAC__METADATA_TYPE_PADDING) { const unsigned growth = FLAC__STREAM_METADATA_HEADER_LENGTH + node->next->data->length; @@ -866,9 +866,9 @@ static FLAC__bool chain_merge_adjacent_padding_(FLAC__MetaData_Chain *chain, FLA return false; } -FLAC__MetaData_Chain *FLAC__metadata_chain_new() +FLAC__Metadata_Chain *FLAC__metadata_chain_new() { - FLAC__MetaData_Chain *chain = malloc(sizeof(FLAC__MetaData_Chain)); + FLAC__Metadata_Chain *chain = malloc(sizeof(FLAC__Metadata_Chain)); if(0 != chain) { chain->filename = 0; @@ -881,9 +881,9 @@ FLAC__MetaData_Chain *FLAC__metadata_chain_new() return chain; } -void FLAC__metadata_chain_delete(FLAC__MetaData_Chain *chain) +void FLAC__metadata_chain_delete(FLAC__Metadata_Chain *chain) { - FLAC__MetaData_Node *node, *next; + FLAC__Metadata_Node *node, *next; FLAC__ASSERT(0 != chain); @@ -899,9 +899,9 @@ void FLAC__metadata_chain_delete(FLAC__MetaData_Chain *chain) free(chain); } -FLAC__MetaData_ChainStatus FLAC__metadata_chain_status(FLAC__MetaData_Chain *chain) +FLAC__Metadata_ChainStatus FLAC__metadata_chain_status(FLAC__Metadata_Chain *chain) { - FLAC__MetaData_ChainStatus status; + FLAC__Metadata_ChainStatus status; FLAC__ASSERT(0 != chain); @@ -910,10 +910,10 @@ FLAC__MetaData_ChainStatus FLAC__metadata_chain_status(FLAC__MetaData_Chain *cha return status; } -FLAC__bool FLAC__metadata_chain_read(FLAC__MetaData_Chain *chain, const char *filename) +FLAC__bool FLAC__metadata_chain_read(FLAC__Metadata_Chain *chain, const char *filename) { - FLAC__MetaData_SimpleIterator *iterator; - FLAC__MetaData_Node *node; + FLAC__Metadata_SimpleIterator *iterator; + FLAC__Metadata_Node *node; FLAC__ASSERT(0 != chain); FLAC__ASSERT(0 != filename); @@ -962,7 +962,7 @@ FLAC__bool FLAC__metadata_chain_read(FLAC__MetaData_Chain *chain, const char *fi return true; } -FLAC__bool FLAC__metadata_chain_write(FLAC__MetaData_Chain *chain, FLAC__bool use_padding, FLAC__bool preserve_file_stats) +FLAC__bool FLAC__metadata_chain_write(FLAC__Metadata_Chain *chain, FLAC__bool use_padding, FLAC__bool preserve_file_stats) { struct stat stats; const char *tempfile_path_prefix = 0; @@ -975,8 +975,8 @@ FLAC__bool FLAC__metadata_chain_write(FLAC__MetaData_Chain *chain, FLAC__bool us FLAC__ASSERT(chain->current_length == chain->initial_length); } else if(chain->current_length + FLAC__STREAM_METADATA_HEADER_LENGTH <= chain->initial_length) { - FLAC__StreamMetaData *padding; - FLAC__MetaData_Node *node; + FLAC__StreamMetadata *padding; + FLAC__Metadata_Node *node; if(0 == (padding = FLAC__metadata_object_new(FLAC__METADATA_TYPE_PADDING))) { chain->status = FLAC__METADATA_CHAIN_STATUS_MEMORY_ALLOCATION_ERROR; return false; @@ -1024,7 +1024,7 @@ FLAC__bool FLAC__metadata_chain_write(FLAC__MetaData_Chain *chain, FLAC__bool us /* recompute lengths and offsets if necessary */ if(chain->initial_length != chain->current_length) { - const FLAC__MetaData_Node *node; + const FLAC__Metadata_Node *node; chain->initial_length = chain->current_length; chain->last_offset = chain->first_offset; for(node = chain->head; node; node = node->next) @@ -1034,9 +1034,9 @@ FLAC__bool FLAC__metadata_chain_write(FLAC__MetaData_Chain *chain, FLAC__bool us return true; } -void FLAC__metadata_chain_merge_padding(FLAC__MetaData_Chain *chain) +void FLAC__metadata_chain_merge_padding(FLAC__Metadata_Chain *chain) { - FLAC__MetaData_Node *node; + FLAC__Metadata_Node *node; FLAC__ASSERT(0 != chain); @@ -1046,9 +1046,9 @@ void FLAC__metadata_chain_merge_padding(FLAC__MetaData_Chain *chain) } } -void FLAC__metadata_chain_sort_padding(FLAC__MetaData_Chain *chain) +void FLAC__metadata_chain_sort_padding(FLAC__Metadata_Chain *chain) { - FLAC__MetaData_Node *node, *save; + FLAC__Metadata_Node *node, *save; unsigned i; FLAC__ASSERT(0 != chain); @@ -1073,9 +1073,9 @@ void FLAC__metadata_chain_sort_padding(FLAC__MetaData_Chain *chain) } -FLAC__MetaData_Iterator *FLAC__metadata_iterator_new() +FLAC__Metadata_Iterator *FLAC__metadata_iterator_new() { - FLAC__MetaData_Iterator *iterator = malloc(sizeof(FLAC__MetaData_Iterator)); + FLAC__Metadata_Iterator *iterator = malloc(sizeof(FLAC__Metadata_Iterator)); if(0 != iterator) { iterator->current = 0; @@ -1085,7 +1085,7 @@ FLAC__MetaData_Iterator *FLAC__metadata_iterator_new() return iterator; } -void FLAC__metadata_iterator_delete(FLAC__MetaData_Iterator *iterator) +void FLAC__metadata_iterator_delete(FLAC__Metadata_Iterator *iterator) { FLAC__ASSERT(0 != iterator); @@ -1096,7 +1096,7 @@ void FLAC__metadata_iterator_delete(FLAC__MetaData_Iterator *iterator) * Initialize the iterator to point to the first metadata block in the * given chain. */ -void FLAC__metadata_iterator_init(FLAC__MetaData_Iterator *iterator, FLAC__MetaData_Chain *chain) +void FLAC__metadata_iterator_init(FLAC__Metadata_Iterator *iterator, FLAC__Metadata_Chain *chain) { FLAC__ASSERT(0 != iterator); FLAC__ASSERT(0 != chain); @@ -1106,7 +1106,7 @@ void FLAC__metadata_iterator_init(FLAC__MetaData_Iterator *iterator, FLAC__MetaD iterator->current = chain->head; } -FLAC__bool FLAC__metadata_iterator_next(FLAC__MetaData_Iterator *iterator) +FLAC__bool FLAC__metadata_iterator_next(FLAC__Metadata_Iterator *iterator) { FLAC__ASSERT(0 != iterator); @@ -1117,7 +1117,7 @@ FLAC__bool FLAC__metadata_iterator_next(FLAC__MetaData_Iterator *iterator) return true; } -FLAC__bool FLAC__metadata_iterator_prev(FLAC__MetaData_Iterator *iterator) +FLAC__bool FLAC__metadata_iterator_prev(FLAC__Metadata_Iterator *iterator) { FLAC__ASSERT(0 != iterator); @@ -1128,7 +1128,7 @@ FLAC__bool FLAC__metadata_iterator_prev(FLAC__MetaData_Iterator *iterator) return true; } -FLAC__MetaDataType FLAC__metadata_iterator_get_block_type(const FLAC__MetaData_Iterator *iterator) +FLAC__MetadataType FLAC__metadata_iterator_get_block_type(const FLAC__Metadata_Iterator *iterator) { FLAC__ASSERT(0 != iterator); FLAC__ASSERT(0 != iterator->current); @@ -1137,7 +1137,7 @@ FLAC__MetaDataType FLAC__metadata_iterator_get_block_type(const FLAC__MetaData_I return iterator->current->data->type; } -FLAC__StreamMetaData *FLAC__metadata_iterator_get_block(FLAC__MetaData_Iterator *iterator) +FLAC__StreamMetadata *FLAC__metadata_iterator_get_block(FLAC__Metadata_Iterator *iterator) { FLAC__ASSERT(0 != iterator); FLAC__ASSERT(0 != iterator->current); @@ -1145,14 +1145,14 @@ FLAC__StreamMetaData *FLAC__metadata_iterator_get_block(FLAC__MetaData_Iterator return iterator->current->data; } -FLAC__bool FLAC__metadata_iterator_set_block(FLAC__MetaData_Iterator *iterator, FLAC__StreamMetaData *block) +FLAC__bool FLAC__metadata_iterator_set_block(FLAC__Metadata_Iterator *iterator, FLAC__StreamMetadata *block) { return FLAC__metadata_iterator_delete_block(iterator, false) && FLAC__metadata_iterator_insert_block_after(iterator, block); } -FLAC__bool FLAC__metadata_iterator_delete_block(FLAC__MetaData_Iterator *iterator, FLAC__bool replace_with_padding) +FLAC__bool FLAC__metadata_iterator_delete_block(FLAC__Metadata_Iterator *iterator, FLAC__bool replace_with_padding) { - FLAC__MetaData_Node *save; + FLAC__Metadata_Node *save; FLAC__ASSERT(0 != iterator); FLAC__ASSERT(0 != iterator->current); @@ -1176,9 +1176,9 @@ FLAC__bool FLAC__metadata_iterator_delete_block(FLAC__MetaData_Iterator *iterato return true; } -FLAC__bool FLAC__metadata_iterator_insert_block_before(FLAC__MetaData_Iterator *iterator, FLAC__StreamMetaData *block) +FLAC__bool FLAC__metadata_iterator_insert_block_before(FLAC__Metadata_Iterator *iterator, FLAC__StreamMetadata *block) { - FLAC__MetaData_Node *node; + FLAC__Metadata_Node *node; FLAC__ASSERT(0 != iterator); FLAC__ASSERT(0 != iterator->current); @@ -1200,9 +1200,9 @@ FLAC__bool FLAC__metadata_iterator_insert_block_before(FLAC__MetaData_Iterator * return true; } -FLAC__bool FLAC__metadata_iterator_insert_block_after(FLAC__MetaData_Iterator *iterator, FLAC__StreamMetaData *block) +FLAC__bool FLAC__metadata_iterator_insert_block_after(FLAC__Metadata_Iterator *iterator, FLAC__StreamMetadata *block) { - FLAC__MetaData_Node *node; + FLAC__Metadata_Node *node; FLAC__ASSERT(0 != iterator); FLAC__ASSERT(0 != iterator->current); @@ -1295,7 +1295,7 @@ FLAC__uint64 unpack_uint64_(FLAC__byte *b, unsigned bytes) return ret; } -FLAC__bool read_metadata_block_header_(FLAC__MetaData_SimpleIterator *iterator) +FLAC__bool read_metadata_block_header_(FLAC__Metadata_SimpleIterator *iterator) { FLAC__byte raw_header[FLAC__STREAM_METADATA_HEADER_LENGTH]; @@ -1308,7 +1308,7 @@ FLAC__bool read_metadata_block_header_(FLAC__MetaData_SimpleIterator *iterator) } iterator->is_last = raw_header[0] & 0x80? true : false; - iterator->type = (FLAC__MetaDataType)(raw_header[0] & 0x7f); + iterator->type = (FLAC__MetadataType)(raw_header[0] & 0x7f); iterator->length = unpack_uint32_(raw_header + 1, 3); /* do some checking */ @@ -1320,7 +1320,7 @@ FLAC__bool read_metadata_block_header_(FLAC__MetaData_SimpleIterator *iterator) return true; } -FLAC__bool read_metadata_block_data_(FLAC__MetaData_SimpleIterator *iterator, FLAC__StreamMetaData *block) +FLAC__bool read_metadata_block_data_(FLAC__Metadata_SimpleIterator *iterator, FLAC__StreamMetadata *block) { FLAC__ASSERT(0 != iterator); FLAC__ASSERT(0 != iterator->file); @@ -1349,7 +1349,7 @@ FLAC__bool read_metadata_block_data_(FLAC__MetaData_SimpleIterator *iterator, FL return (iterator->status == FLAC__METADATA_SIMPLE_ITERATOR_STATUS_OK); } -FLAC__MetaData_SimpleIteratorStatus read_metadata_block_data_streaminfo_(FILE *file, FLAC__StreamMetaData_StreamInfo *block) +FLAC__Metadata_SimpleIteratorStatus read_metadata_block_data_streaminfo_(FILE *file, FLAC__StreamMetadata_StreamInfo *block) { FLAC__byte buffer[FLAC__STREAM_METADATA_STREAMINFO_LENGTH], *b; @@ -1378,7 +1378,7 @@ FLAC__MetaData_SimpleIteratorStatus read_metadata_block_data_streaminfo_(FILE *f } -FLAC__MetaData_SimpleIteratorStatus read_metadata_block_data_padding_(FILE *file, FLAC__StreamMetaData_Padding *block, unsigned block_length) +FLAC__Metadata_SimpleIteratorStatus read_metadata_block_data_padding_(FILE *file, FLAC__StreamMetadata_Padding *block, unsigned block_length) { FLAC__ASSERT(0 != file); @@ -1390,7 +1390,7 @@ FLAC__MetaData_SimpleIteratorStatus read_metadata_block_data_padding_(FILE *file return FLAC__METADATA_SIMPLE_ITERATOR_STATUS_OK; } -FLAC__MetaData_SimpleIteratorStatus read_metadata_block_data_application_(FILE *file, FLAC__StreamMetaData_Application *block, unsigned block_length) +FLAC__Metadata_SimpleIteratorStatus read_metadata_block_data_application_(FILE *file, FLAC__StreamMetadata_Application *block, unsigned block_length) { const unsigned id_bytes = FLAC__STREAM_METADATA_APPLICATION_ID_LEN / 8; @@ -1415,7 +1415,7 @@ FLAC__MetaData_SimpleIteratorStatus read_metadata_block_data_application_(FILE * return FLAC__METADATA_SIMPLE_ITERATOR_STATUS_OK; } -FLAC__MetaData_SimpleIteratorStatus read_metadata_block_data_seektable_(FILE *file, FLAC__StreamMetaData_SeekTable *block, unsigned block_length) +FLAC__Metadata_SimpleIteratorStatus read_metadata_block_data_seektable_(FILE *file, FLAC__StreamMetadata_SeekTable *block, unsigned block_length) { unsigned i; FLAC__byte buffer[FLAC__STREAM_METADATA_SEEKPOINT_LENGTH]; @@ -1427,7 +1427,7 @@ FLAC__MetaData_SimpleIteratorStatus read_metadata_block_data_seektable_(FILE *fi if(block->num_points == 0) block->points = 0; - else if(0 == (block->points = malloc(block->num_points * sizeof(FLAC__StreamMetaData_SeekPoint)))) + else if(0 == (block->points = malloc(block->num_points * sizeof(FLAC__StreamMetadata_SeekPoint)))) return FLAC__METADATA_SIMPLE_ITERATOR_STATUS_MEMORY_ALLOCATION_ERROR; for(i = 0; i < block->num_points; i++) { @@ -1442,7 +1442,7 @@ FLAC__MetaData_SimpleIteratorStatus read_metadata_block_data_seektable_(FILE *fi return FLAC__METADATA_SIMPLE_ITERATOR_STATUS_OK; } -FLAC__MetaData_SimpleIteratorStatus read_metadata_block_data_vorbis_comment_entry_(FILE *file, FLAC__StreamMetaData_VorbisComment_Entry *entry) +FLAC__Metadata_SimpleIteratorStatus read_metadata_block_data_vorbis_comment_entry_(FILE *file, FLAC__StreamMetadata_VorbisComment_Entry *entry) { const unsigned entry_length_len = FLAC__STREAM_METADATA_VORBIS_COMMENT_ENTRY_LENGTH_LEN / 8; FLAC__byte buffer[4]; /* magic number is asserted below */ @@ -1468,10 +1468,10 @@ FLAC__MetaData_SimpleIteratorStatus read_metadata_block_data_vorbis_comment_entr return FLAC__METADATA_SIMPLE_ITERATOR_STATUS_OK; } -FLAC__MetaData_SimpleIteratorStatus read_metadata_block_data_vorbis_comment_(FILE *file, FLAC__StreamMetaData_VorbisComment *block) +FLAC__Metadata_SimpleIteratorStatus read_metadata_block_data_vorbis_comment_(FILE *file, FLAC__StreamMetadata_VorbisComment *block) { unsigned i; - FLAC__MetaData_SimpleIteratorStatus status; + FLAC__Metadata_SimpleIteratorStatus status; const unsigned num_comments_len = FLAC__STREAM_METADATA_VORBIS_COMMENT_NUM_COMMENTS_LEN / 8; FLAC__byte buffer[4]; /* magic number is asserted below */ @@ -1488,7 +1488,7 @@ FLAC__MetaData_SimpleIteratorStatus read_metadata_block_data_vorbis_comment_(FIL if(block->num_comments == 0) { block->comments = 0; } - else if(0 == (block->comments = malloc(block->num_comments * sizeof(FLAC__StreamMetaData_VorbisComment_Entry)))) + else if(0 == (block->comments = malloc(block->num_comments * sizeof(FLAC__StreamMetadata_VorbisComment_Entry)))) return FLAC__METADATA_SIMPLE_ITERATOR_STATUS_MEMORY_ALLOCATION_ERROR; for(i = 0; i < block->num_comments; i++) { @@ -1499,7 +1499,7 @@ FLAC__MetaData_SimpleIteratorStatus read_metadata_block_data_vorbis_comment_(FIL return FLAC__METADATA_SIMPLE_ITERATOR_STATUS_OK; } -FLAC__bool write_metadata_block_header_(FILE *file, FLAC__MetaData_SimpleIteratorStatus *status, const FLAC__StreamMetaData *block) +FLAC__bool write_metadata_block_header_(FILE *file, FLAC__Metadata_SimpleIteratorStatus *status, const FLAC__StreamMetadata *block) { FLAC__byte buffer[FLAC__STREAM_METADATA_HEADER_LENGTH]; @@ -1518,7 +1518,7 @@ FLAC__bool write_metadata_block_header_(FILE *file, FLAC__MetaData_SimpleIterato return true; } -FLAC__bool write_metadata_block_data_(FILE *file, FLAC__MetaData_SimpleIteratorStatus *status, const FLAC__StreamMetaData *block) +FLAC__bool write_metadata_block_data_(FILE *file, FLAC__Metadata_SimpleIteratorStatus *status, const FLAC__StreamMetadata *block) { FLAC__ASSERT(0 != file); FLAC__ASSERT(0 != status); @@ -1546,7 +1546,7 @@ FLAC__bool write_metadata_block_data_(FILE *file, FLAC__MetaData_SimpleIteratorS return (*status == FLAC__METADATA_SIMPLE_ITERATOR_STATUS_OK); } -FLAC__MetaData_SimpleIteratorStatus write_metadata_block_data_streaminfo_(FILE *file, const FLAC__StreamMetaData_StreamInfo *block) +FLAC__Metadata_SimpleIteratorStatus write_metadata_block_data_streaminfo_(FILE *file, const FLAC__StreamMetadata_StreamInfo *block) { FLAC__byte buffer[FLAC__STREAM_METADATA_STREAMINFO_LENGTH]; const unsigned channels1 = block->channels - 1; @@ -1575,7 +1575,7 @@ FLAC__MetaData_SimpleIteratorStatus write_metadata_block_data_streaminfo_(FILE * return FLAC__METADATA_SIMPLE_ITERATOR_STATUS_OK; } -FLAC__MetaData_SimpleIteratorStatus write_metadata_block_data_padding_(FILE *file, const FLAC__StreamMetaData_Padding *block, unsigned block_length) +FLAC__Metadata_SimpleIteratorStatus write_metadata_block_data_padding_(FILE *file, const FLAC__StreamMetadata_Padding *block, unsigned block_length) { unsigned i, n = block_length; FLAC__byte buffer[1024]; @@ -1598,7 +1598,7 @@ FLAC__MetaData_SimpleIteratorStatus write_metadata_block_data_padding_(FILE *fil return FLAC__METADATA_SIMPLE_ITERATOR_STATUS_OK; } -FLAC__MetaData_SimpleIteratorStatus write_metadata_block_data_application_(FILE *file, const FLAC__StreamMetaData_Application *block, unsigned block_length) +FLAC__Metadata_SimpleIteratorStatus write_metadata_block_data_application_(FILE *file, const FLAC__StreamMetadata_Application *block, unsigned block_length) { const unsigned id_bytes = FLAC__STREAM_METADATA_APPLICATION_ID_LEN / 8; @@ -1615,7 +1615,7 @@ FLAC__MetaData_SimpleIteratorStatus write_metadata_block_data_application_(FILE return FLAC__METADATA_SIMPLE_ITERATOR_STATUS_OK; } -FLAC__MetaData_SimpleIteratorStatus write_metadata_block_data_seektable_(FILE *file, const FLAC__StreamMetaData_SeekTable *block) +FLAC__Metadata_SimpleIteratorStatus write_metadata_block_data_seektable_(FILE *file, const FLAC__StreamMetadata_SeekTable *block) { unsigned i; FLAC__byte buffer[FLAC__STREAM_METADATA_SEEKPOINT_LENGTH]; @@ -1634,7 +1634,7 @@ FLAC__MetaData_SimpleIteratorStatus write_metadata_block_data_seektable_(FILE *f return FLAC__METADATA_SIMPLE_ITERATOR_STATUS_OK; } -FLAC__MetaData_SimpleIteratorStatus write_metadata_block_data_vorbis_comment_(FILE *file, const FLAC__StreamMetaData_VorbisComment *block) +FLAC__Metadata_SimpleIteratorStatus write_metadata_block_data_vorbis_comment_(FILE *file, const FLAC__StreamMetadata_VorbisComment *block) { unsigned i; const unsigned entry_length_len = FLAC__STREAM_METADATA_VORBIS_COMMENT_ENTRY_LENGTH_LEN / 8; @@ -1665,7 +1665,7 @@ FLAC__MetaData_SimpleIteratorStatus write_metadata_block_data_vorbis_comment_(FI return FLAC__METADATA_SIMPLE_ITERATOR_STATUS_OK; } -FLAC__bool write_metadata_block_stationary_(FLAC__MetaData_SimpleIterator *iterator, const FLAC__StreamMetaData *block) +FLAC__bool write_metadata_block_stationary_(FLAC__Metadata_SimpleIterator *iterator, const FLAC__StreamMetadata *block) { if(0 != fseek(iterator->file, iterator->offset[iterator->depth], SEEK_SET)) { iterator->status = FLAC__METADATA_SIMPLE_ITERATOR_STATUS_SEEK_ERROR; @@ -1686,9 +1686,9 @@ FLAC__bool write_metadata_block_stationary_(FLAC__MetaData_SimpleIterator *itera return read_metadata_block_header_(iterator); } -FLAC__bool write_metadata_block_stationary_with_padding_(FLAC__MetaData_SimpleIterator *iterator, FLAC__StreamMetaData *block, unsigned padding_length, FLAC__bool padding_is_last) +FLAC__bool write_metadata_block_stationary_with_padding_(FLAC__Metadata_SimpleIterator *iterator, FLAC__StreamMetadata *block, unsigned padding_length, FLAC__bool padding_is_last) { - FLAC__StreamMetaData *padding; + FLAC__StreamMetadata *padding; if(0 != fseek(iterator->file, iterator->offset[iterator->depth], SEEK_SET)) { iterator->status = FLAC__METADATA_SIMPLE_ITERATOR_STATUS_SEEK_ERROR; @@ -1729,7 +1729,7 @@ FLAC__bool write_metadata_block_stationary_with_padding_(FLAC__MetaData_SimpleIt return read_metadata_block_header_(iterator); } -FLAC__bool rewrite_whole_file_(FLAC__MetaData_SimpleIterator *iterator, FLAC__StreamMetaData *block, FLAC__bool append) +FLAC__bool rewrite_whole_file_(FLAC__Metadata_SimpleIterator *iterator, FLAC__StreamMetadata *block, FLAC__bool append) { FILE *tempfile; char *tempfilename; @@ -1780,11 +1780,11 @@ FLAC__bool rewrite_whole_file_(FLAC__MetaData_SimpleIterator *iterator, FLAC__St return true; } -FLAC__bool chain_rewrite_chain_(FLAC__MetaData_Chain *chain) +FLAC__bool chain_rewrite_chain_(FLAC__Metadata_Chain *chain) { FILE *f; - FLAC__MetaData_Node *node; - FLAC__MetaData_SimpleIteratorStatus status; + FLAC__Metadata_Node *node; + FLAC__Metadata_SimpleIteratorStatus status; FLAC__ASSERT(0 != chain); FLAC__ASSERT(0 != chain->filename); @@ -1817,12 +1817,12 @@ FLAC__bool chain_rewrite_chain_(FLAC__MetaData_Chain *chain) return true; } -FLAC__bool chain_rewrite_file_(FLAC__MetaData_Chain *chain, const char *tempfile_path_prefix) +FLAC__bool chain_rewrite_file_(FLAC__Metadata_Chain *chain, const char *tempfile_path_prefix) { FILE *f, *tempfile; char *tempfilename; - FLAC__MetaData_SimpleIteratorStatus status; - const FLAC__MetaData_Node *node; + FLAC__Metadata_SimpleIteratorStatus status; + const FLAC__Metadata_Node *node; FLAC__ASSERT(0 != chain); FLAC__ASSERT(0 != chain->filename); @@ -1877,14 +1877,14 @@ FLAC__bool chain_rewrite_file_(FLAC__MetaData_Chain *chain, const char *tempfile return true; } -void simple_iterator_push_(FLAC__MetaData_SimpleIterator *iterator) +void simple_iterator_push_(FLAC__Metadata_SimpleIterator *iterator) { FLAC__ASSERT(iterator->depth+1 < SIMPLE_ITERATOR_MAX_PUSH_DEPTH); iterator->offset[iterator->depth+1] = iterator->offset[iterator->depth]; iterator->depth++; } -FLAC__bool simple_iterator_pop_(FLAC__MetaData_SimpleIterator *iterator) +FLAC__bool simple_iterator_pop_(FLAC__Metadata_SimpleIterator *iterator) { FLAC__ASSERT(iterator->depth > 0); iterator->depth--; @@ -1947,7 +1947,7 @@ unsigned seek_to_first_metadata_block_(FILE *f) return 2; } -FLAC__bool simple_iterator_copy_file_prefix_(FLAC__MetaData_SimpleIterator *iterator, FILE **tempfile, char **tempfilename, FLAC__bool append) +FLAC__bool simple_iterator_copy_file_prefix_(FLAC__Metadata_SimpleIterator *iterator, FILE **tempfile, char **tempfilename, FLAC__bool append) { const long offset_end = append? iterator->offset[iterator->depth] + (long)FLAC__STREAM_METADATA_HEADER_LENGTH + (long)iterator->length : iterator->offset[iterator->depth]; @@ -1967,7 +1967,7 @@ FLAC__bool simple_iterator_copy_file_prefix_(FLAC__MetaData_SimpleIterator *iter return true; } -FLAC__bool simple_iterator_copy_file_postfix_(FLAC__MetaData_SimpleIterator *iterator, FILE **tempfile, char **tempfilename, int fixup_is_last_code, long fixup_is_last_flag_offset, FLAC__bool backup) +FLAC__bool simple_iterator_copy_file_postfix_(FLAC__Metadata_SimpleIterator *iterator, FILE **tempfile, char **tempfilename, int fixup_is_last_code, long fixup_is_last_flag_offset, FLAC__bool backup) { long save_offset = iterator->offset[iterator->depth]; /*@@@ 2G limit */ FLAC__ASSERT(0 != *tempfile); @@ -2046,7 +2046,7 @@ FLAC__bool simple_iterator_copy_file_postfix_(FLAC__MetaData_SimpleIterator *ite } } -FLAC__bool copy_n_bytes_from_file_(FILE *file, FILE *tempfile, unsigned bytes/*@@@ 4G limit*/, FLAC__MetaData_SimpleIteratorStatus *status) +FLAC__bool copy_n_bytes_from_file_(FILE *file, FILE *tempfile, unsigned bytes/*@@@ 4G limit*/, FLAC__Metadata_SimpleIteratorStatus *status) { FLAC__byte buffer[8192]; unsigned n; @@ -2067,7 +2067,7 @@ FLAC__bool copy_n_bytes_from_file_(FILE *file, FILE *tempfile, unsigned bytes/*@ return true; } -FLAC__bool copy_remaining_bytes_from_file_(FILE *file, FILE *tempfile, FLAC__MetaData_SimpleIteratorStatus *status) +FLAC__bool copy_remaining_bytes_from_file_(FILE *file, FILE *tempfile, FLAC__Metadata_SimpleIteratorStatus *status) { FLAC__byte buffer[8192]; size_t n; @@ -2087,7 +2087,7 @@ FLAC__bool copy_remaining_bytes_from_file_(FILE *file, FILE *tempfile, FLAC__Met return true; } -FLAC__bool open_tempfile_(const char *filename, const char *tempfile_path_prefix, FILE **tempfile, char **tempfilename, FLAC__MetaData_SimpleIteratorStatus *status) +FLAC__bool open_tempfile_(const char *filename, const char *tempfile_path_prefix, FILE **tempfile, char **tempfilename, FLAC__Metadata_SimpleIteratorStatus *status) { static const char *tempfile_suffix = ".metadata_edit"; if(0 == tempfile_path_prefix) { @@ -2123,7 +2123,7 @@ FLAC__bool open_tempfile_(const char *filename, const char *tempfile_path_prefix return true; } -FLAC__bool transport_tempfile_(const char *filename, FILE **tempfile, char **tempfilename, FLAC__MetaData_SimpleIteratorStatus *status) +FLAC__bool transport_tempfile_(const char *filename, FILE **tempfile, char **tempfilename, FLAC__Metadata_SimpleIteratorStatus *status) { FLAC__ASSERT(0 != filename); FLAC__ASSERT(0 != tempfile); @@ -2184,7 +2184,7 @@ void set_file_stats_(const char *filename, struct stat *stats) #endif } -FLAC__MetaData_ChainStatus get_equivalent_status_(FLAC__MetaData_SimpleIteratorStatus status) +FLAC__Metadata_ChainStatus get_equivalent_status_(FLAC__Metadata_SimpleIteratorStatus status) { switch(status) { case FLAC__METADATA_SIMPLE_ITERATOR_STATUS_OK: diff --git a/src/libFLAC/metadata_object.c b/src/libFLAC/metadata_object.c index 21f81c45..c79fd81b 100644 --- a/src/libFLAC/metadata_object.c +++ b/src/libFLAC/metadata_object.c @@ -48,7 +48,7 @@ static FLAC__bool copy_bytes_(FLAC__byte **to, const FLAC__byte *from, unsigned return true; } -static FLAC__bool copy_vcentry_(FLAC__StreamMetaData_VorbisComment_Entry *to, const FLAC__StreamMetaData_VorbisComment_Entry *from) +static FLAC__bool copy_vcentry_(FLAC__StreamMetadata_VorbisComment_Entry *to, const FLAC__StreamMetadata_VorbisComment_Entry *from) { to->length = from->length; if(0 == from->entry) { @@ -66,7 +66,7 @@ static FLAC__bool copy_vcentry_(FLAC__StreamMetaData_VorbisComment_Entry *to, co return true; } -static void seektable_calculate_length_(FLAC__StreamMetaData *object) +static void seektable_calculate_length_(FLAC__StreamMetadata *object) { FLAC__ASSERT(0 != object); FLAC__ASSERT(object->type == FLAC__METADATA_TYPE_SEEKTABLE); @@ -74,13 +74,13 @@ static void seektable_calculate_length_(FLAC__StreamMetaData *object) object->length = object->data.seek_table.num_points * FLAC__STREAM_METADATA_SEEKPOINT_LENGTH; } -static FLAC__StreamMetaData_SeekPoint *seekpoint_array_new_(unsigned num_points) +static FLAC__StreamMetadata_SeekPoint *seekpoint_array_new_(unsigned num_points) { - FLAC__StreamMetaData_SeekPoint *object_array; + FLAC__StreamMetadata_SeekPoint *object_array; FLAC__ASSERT(num_points > 0); - object_array = malloc(num_points * sizeof(FLAC__StreamMetaData_SeekPoint)); + object_array = malloc(num_points * sizeof(FLAC__StreamMetadata_SeekPoint)); if(0 != object_array) { unsigned i; @@ -94,7 +94,7 @@ static FLAC__StreamMetaData_SeekPoint *seekpoint_array_new_(unsigned num_points) return object_array; } -static void vorbiscomment_calculate_length_(FLAC__StreamMetaData *object) +static void vorbiscomment_calculate_length_(FLAC__StreamMetadata *object) { unsigned i; @@ -109,21 +109,21 @@ static void vorbiscomment_calculate_length_(FLAC__StreamMetaData *object) } } -static FLAC__StreamMetaData_VorbisComment_Entry *vorbiscomment_entry_array_new_(unsigned num_comments) +static FLAC__StreamMetadata_VorbisComment_Entry *vorbiscomment_entry_array_new_(unsigned num_comments) { - FLAC__StreamMetaData_VorbisComment_Entry *object_array; + FLAC__StreamMetadata_VorbisComment_Entry *object_array; FLAC__ASSERT(num_comments > 0); - object_array = malloc(num_comments * sizeof(FLAC__StreamMetaData_VorbisComment_Entry)); + object_array = malloc(num_comments * sizeof(FLAC__StreamMetadata_VorbisComment_Entry)); if(0 != object_array) - memset(object_array, 0, num_comments * sizeof(FLAC__StreamMetaData_VorbisComment_Entry)); + memset(object_array, 0, num_comments * sizeof(FLAC__StreamMetadata_VorbisComment_Entry)); return object_array; } -static void vorbiscomment_entry_array_delete_(FLAC__StreamMetaData_VorbisComment_Entry *object_array, unsigned num_comments) +static void vorbiscomment_entry_array_delete_(FLAC__StreamMetadata_VorbisComment_Entry *object_array, unsigned num_comments) { unsigned i; @@ -137,9 +137,9 @@ static void vorbiscomment_entry_array_delete_(FLAC__StreamMetaData_VorbisComment free(object_array); } -static FLAC__StreamMetaData_VorbisComment_Entry *vorbiscomment_entry_array_copy_(const FLAC__StreamMetaData_VorbisComment_Entry *object_array, unsigned num_comments) +static FLAC__StreamMetadata_VorbisComment_Entry *vorbiscomment_entry_array_copy_(const FLAC__StreamMetadata_VorbisComment_Entry *object_array, unsigned num_comments) { - FLAC__StreamMetaData_VorbisComment_Entry *return_array; + FLAC__StreamMetadata_VorbisComment_Entry *return_array; FLAC__ASSERT(0 != object_array); FLAC__ASSERT(num_comments > 0); @@ -154,7 +154,7 @@ static FLAC__StreamMetaData_VorbisComment_Entry *vorbiscomment_entry_array_copy_ * deleted and we don't want the destructor freeing uninitialized * pointers. */ - memset(return_array, 0, num_comments * sizeof(FLAC__StreamMetaData_VorbisComment_Entry)); + memset(return_array, 0, num_comments * sizeof(FLAC__StreamMetadata_VorbisComment_Entry)); for(i = 0; i < num_comments; i++) { if(!copy_vcentry_(return_array+i, object_array+i)) { @@ -167,7 +167,7 @@ static FLAC__StreamMetaData_VorbisComment_Entry *vorbiscomment_entry_array_copy_ return return_array; } -static FLAC__bool vorbiscomment_set_entry_(FLAC__StreamMetaData *object, FLAC__StreamMetaData_VorbisComment_Entry *dest, const FLAC__StreamMetaData_VorbisComment_Entry *src, FLAC__bool copy) +static FLAC__bool vorbiscomment_set_entry_(FLAC__StreamMetadata *object, FLAC__StreamMetadata_VorbisComment_Entry *dest, const FLAC__StreamMetadata_VorbisComment_Entry *src, FLAC__bool copy) { FLAC__byte *save; @@ -206,11 +206,11 @@ static FLAC__bool vorbiscomment_set_entry_(FLAC__StreamMetaData *object, FLAC__S will return pointer to new empty object of type 'type', or 0 if malloc failed type is valid type */ -FLAC__StreamMetaData *FLAC__metadata_object_new(FLAC__MetaDataType type) +FLAC__StreamMetadata *FLAC__metadata_object_new(FLAC__MetadataType type) { - FLAC__StreamMetaData *object = malloc(sizeof(FLAC__StreamMetaData)); + FLAC__StreamMetadata *object = malloc(sizeof(FLAC__StreamMetadata)); if(0 != object) { - memset(object, 0, sizeof(FLAC__StreamMetaData)); + memset(object, 0, sizeof(FLAC__StreamMetadata)); object->is_last = false; object->type = type; switch(type) { @@ -242,9 +242,9 @@ FLAC__StreamMetaData *FLAC__metadata_object_new(FLAC__MetaDataType type) return a pointer to a copy of 'object', or 0 if any malloc failed. does a deep copy. user gets ownership of object. FLAC__ASSERT(0 != object); */ -FLAC__StreamMetaData *FLAC__metadata_object_copy(const FLAC__StreamMetaData *object) +FLAC__StreamMetadata *FLAC__metadata_object_clone(const FLAC__StreamMetadata *object) { - FLAC__StreamMetaData *to; + FLAC__StreamMetadata *to; FLAC__ASSERT(0 != object); @@ -254,7 +254,7 @@ FLAC__StreamMetaData *FLAC__metadata_object_copy(const FLAC__StreamMetaData *obj to->length = object->length; switch(to->type) { case FLAC__METADATA_TYPE_STREAMINFO: - memcpy(&to->data.stream_info, &object->data.stream_info, sizeof(FLAC__StreamMetaData_StreamInfo)); + memcpy(&to->data.stream_info, &object->data.stream_info, sizeof(FLAC__StreamMetadata_StreamInfo)); break; case FLAC__METADATA_TYPE_PADDING: break; @@ -267,7 +267,7 @@ FLAC__StreamMetaData *FLAC__metadata_object_copy(const FLAC__StreamMetaData *obj break; case FLAC__METADATA_TYPE_SEEKTABLE: to->data.seek_table.num_points = object->data.seek_table.num_points; - if(!copy_bytes_((FLAC__byte**)&to->data.seek_table.points, (FLAC__byte*)object->data.seek_table.points, object->data.seek_table.num_points * sizeof(FLAC__StreamMetaData_SeekPoint))) { + if(!copy_bytes_((FLAC__byte**)&to->data.seek_table.points, (FLAC__byte*)object->data.seek_table.points, object->data.seek_table.num_points * sizeof(FLAC__StreamMetadata_SeekPoint))) { FLAC__metadata_object_delete(to); return 0; } @@ -302,7 +302,7 @@ FLAC__StreamMetaData *FLAC__metadata_object_copy(const FLAC__StreamMetaData *obj return to; } -void FLAC__metadata_object_delete_data(FLAC__StreamMetaData *object) +void FLAC__metadata_object_delete_data(FLAC__StreamMetadata *object) { FLAC__ASSERT(0 != object); @@ -334,13 +334,13 @@ void FLAC__metadata_object_delete_data(FLAC__StreamMetaData *object) /*@@@@move frees 'object'. does a deep delete. */ -void FLAC__metadata_object_delete(FLAC__StreamMetaData *object) +void FLAC__metadata_object_delete(FLAC__StreamMetadata *object) { FLAC__metadata_object_delete_data(object); free(object); } -static FLAC__bool compare_block_data_streaminfo_(const FLAC__StreamMetaData_StreamInfo *block1, const FLAC__StreamMetaData_StreamInfo *block2) +static FLAC__bool compare_block_data_streaminfo_(const FLAC__StreamMetadata_StreamInfo *block1, const FLAC__StreamMetadata_StreamInfo *block2) { if(block1->min_blocksize != block2->min_blocksize) return false; @@ -363,7 +363,7 @@ static FLAC__bool compare_block_data_streaminfo_(const FLAC__StreamMetaData_Stre return true; } -static FLAC__bool compare_block_data_application_(const FLAC__StreamMetaData_Application *block1, const FLAC__StreamMetaData_Application *block2, unsigned block_length) +static FLAC__bool compare_block_data_application_(const FLAC__StreamMetadata_Application *block1, const FLAC__StreamMetadata_Application *block2, unsigned block_length) { FLAC__ASSERT(0 != block1); FLAC__ASSERT(0 != block2); @@ -377,7 +377,7 @@ static FLAC__bool compare_block_data_application_(const FLAC__StreamMetaData_App return block1->data == block2->data; } -static FLAC__bool compare_block_data_seektable_(const FLAC__StreamMetaData_SeekTable *block1, const FLAC__StreamMetaData_SeekTable *block2) +static FLAC__bool compare_block_data_seektable_(const FLAC__StreamMetadata_SeekTable *block1, const FLAC__StreamMetadata_SeekTable *block2) { unsigned i; @@ -402,7 +402,7 @@ static FLAC__bool compare_block_data_seektable_(const FLAC__StreamMetaData_SeekT return block1->points == block2->points; } -static FLAC__bool compare_block_data_vorbiscomment_(const FLAC__StreamMetaData_VorbisComment *block1, const FLAC__StreamMetaData_VorbisComment *block2) +static FLAC__bool compare_block_data_vorbiscomment_(const FLAC__StreamMetadata_VorbisComment *block1, const FLAC__StreamMetadata_VorbisComment *block2) { unsigned i; @@ -430,7 +430,7 @@ static FLAC__bool compare_block_data_vorbiscomment_(const FLAC__StreamMetaData_V return true; } -FLAC__bool FLAC__metadata_object_is_equal(const FLAC__StreamMetaData *block1, const FLAC__StreamMetaData *block2) +FLAC__bool FLAC__metadata_object_is_equal(const FLAC__StreamMetadata *block1, const FLAC__StreamMetadata *block2) { if(block1->type != block2->type) { return false; @@ -463,7 +463,7 @@ sets the application data to 'data'. if 'copy' is true, makes, copy, else takes FLAC__ASSERT(object->type == FLAC__METADATA_TYPE_APPLICATION); FLAC__ASSERT((0 != data && length > 0) || (0 == data && length == 0 && copy == false)); */ -FLAC__bool FLAC__metadata_object_application_set_data(FLAC__StreamMetaData *object, FLAC__byte *data, unsigned length, FLAC__bool copy) +FLAC__bool FLAC__metadata_object_application_set_data(FLAC__StreamMetadata *object, FLAC__byte *data, unsigned length, FLAC__bool copy) { FLAC__byte *save; @@ -488,7 +488,7 @@ FLAC__bool FLAC__metadata_object_application_set_data(FLAC__StreamMetaData *obje return true; } -FLAC__bool FLAC__metadata_object_seektable_resize_points(FLAC__StreamMetaData *object, unsigned new_num_points) +FLAC__bool FLAC__metadata_object_seektable_resize_points(FLAC__StreamMetadata *object, unsigned new_num_points) { FLAC__ASSERT(0 != object); FLAC__ASSERT(object->type == FLAC__METADATA_TYPE_SEEKTABLE); @@ -501,8 +501,8 @@ FLAC__bool FLAC__metadata_object_seektable_resize_points(FLAC__StreamMetaData *o return false; } else { - const unsigned old_size = object->data.seek_table.num_points * sizeof(FLAC__StreamMetaData_SeekPoint); - const unsigned new_size = new_num_points * sizeof(FLAC__StreamMetaData_SeekPoint); + const unsigned old_size = object->data.seek_table.num_points * sizeof(FLAC__StreamMetadata_SeekPoint); + const unsigned new_size = new_num_points * sizeof(FLAC__StreamMetadata_SeekPoint); FLAC__ASSERT(object->data.seek_table.num_points > 0); @@ -530,7 +530,7 @@ FLAC__bool FLAC__metadata_object_seektable_resize_points(FLAC__StreamMetaData *o return true; } -void FLAC__metadata_object_seektable_set_point(FLAC__StreamMetaData *object, unsigned point_num, FLAC__StreamMetaData_SeekPoint point) +void FLAC__metadata_object_seektable_set_point(FLAC__StreamMetadata *object, unsigned point_num, FLAC__StreamMetadata_SeekPoint point) { FLAC__ASSERT(0 != object); FLAC__ASSERT(object->type == FLAC__METADATA_TYPE_SEEKTABLE); @@ -539,7 +539,7 @@ void FLAC__metadata_object_seektable_set_point(FLAC__StreamMetaData *object, uns object->data.seek_table.points[point_num] = point; } -FLAC__bool FLAC__metadata_object_seektable_insert_point(FLAC__StreamMetaData *object, unsigned point_num, FLAC__StreamMetaData_SeekPoint point) +FLAC__bool FLAC__metadata_object_seektable_insert_point(FLAC__StreamMetadata *object, unsigned point_num, FLAC__StreamMetadata_SeekPoint point) { int i; @@ -559,7 +559,7 @@ FLAC__bool FLAC__metadata_object_seektable_insert_point(FLAC__StreamMetaData *ob return true; } -FLAC__bool FLAC__metadata_object_seektable_delete_point(FLAC__StreamMetaData *object, unsigned point_num) +FLAC__bool FLAC__metadata_object_seektable_delete_point(FLAC__StreamMetadata *object, unsigned point_num) { unsigned i; @@ -574,39 +574,37 @@ FLAC__bool FLAC__metadata_object_seektable_delete_point(FLAC__StreamMetaData *ob return FLAC__metadata_object_seektable_resize_points(object, object->data.seek_table.num_points-1); } -FLAC__bool FLAC__metadata_object_seektable_is_legal(const FLAC__StreamMetaData *object) +FLAC__bool FLAC__metadata_object_seektable_is_legal(const FLAC__StreamMetadata *object) { unsigned i; - FLAC__uint64 last_sample_number = 0; - FLAC__bool got_last = false; + FLAC__uint64 prev_sample_number = 0; + FLAC__bool got_prev = false; FLAC__ASSERT(0 != object); FLAC__ASSERT(object->type == FLAC__METADATA_TYPE_SEEKTABLE); { - const FLAC__StreamMetaData_SeekTable *seek_table = &object->data.seek_table; + const FLAC__StreamMetadata_SeekTable *seek_table = &object->data.seek_table; for(i = 0; i < seek_table->num_points; i++) { - if(seek_table->points[i].sample_number != FLAC__STREAM_METADATA_SEEKPOINT_PLACEHOLDER) { - if(got_last) { - if(seek_table->points[i].sample_number <= last_sample_number) - return false; - } - last_sample_number = seek_table->points[i].sample_number; - got_last = true; + if(got_prev) { + if(seek_table->points[i].sample_number <= prev_sample_number) + return false; } + prev_sample_number = seek_table->points[i].sample_number; + got_prev = true; } } return true; } -FLAC__bool FLAC__metadata_object_vorbiscomment_set_vendor_string(FLAC__StreamMetaData *object, FLAC__StreamMetaData_VorbisComment_Entry entry, FLAC__bool copy) +FLAC__bool FLAC__metadata_object_vorbiscomment_set_vendor_string(FLAC__StreamMetadata *object, FLAC__StreamMetadata_VorbisComment_Entry entry, FLAC__bool copy) { return vorbiscomment_set_entry_(object, &object->data.vorbis_comment.vendor_string, &entry, copy); } -FLAC__bool FLAC__metadata_object_vorbiscomment_resize_comments(FLAC__StreamMetaData *object, unsigned new_num_comments) +FLAC__bool FLAC__metadata_object_vorbiscomment_resize_comments(FLAC__StreamMetadata *object, unsigned new_num_comments) { FLAC__ASSERT(0 != object); FLAC__ASSERT(object->type == FLAC__METADATA_TYPE_VORBIS_COMMENT); @@ -619,8 +617,8 @@ FLAC__bool FLAC__metadata_object_vorbiscomment_resize_comments(FLAC__StreamMetaD return false; } else { - const unsigned old_size = object->data.vorbis_comment.num_comments * sizeof(FLAC__StreamMetaData_VorbisComment_Entry); - const unsigned new_size = new_num_comments * sizeof(FLAC__StreamMetaData_VorbisComment_Entry); + const unsigned old_size = object->data.vorbis_comment.num_comments * sizeof(FLAC__StreamMetadata_VorbisComment_Entry); + const unsigned new_size = new_num_comments * sizeof(FLAC__StreamMetadata_VorbisComment_Entry); FLAC__ASSERT(object->data.vorbis_comment.num_comments > 0); @@ -650,14 +648,14 @@ FLAC__bool FLAC__metadata_object_vorbiscomment_resize_comments(FLAC__StreamMetaD return true; } -FLAC__bool FLAC__metadata_object_vorbiscomment_set_comment(FLAC__StreamMetaData *object, unsigned comment_num, FLAC__StreamMetaData_VorbisComment_Entry entry, FLAC__bool copy) +FLAC__bool FLAC__metadata_object_vorbiscomment_set_comment(FLAC__StreamMetadata *object, unsigned comment_num, FLAC__StreamMetadata_VorbisComment_Entry entry, FLAC__bool copy) { return vorbiscomment_set_entry_(object, &object->data.vorbis_comment.comments[comment_num], &entry, copy); } -FLAC__bool FLAC__metadata_object_vorbiscomment_insert_comment(FLAC__StreamMetaData *object, unsigned comment_num, FLAC__StreamMetaData_VorbisComment_Entry entry, FLAC__bool copy) +FLAC__bool FLAC__metadata_object_vorbiscomment_insert_comment(FLAC__StreamMetadata *object, unsigned comment_num, FLAC__StreamMetadata_VorbisComment_Entry entry, FLAC__bool copy) { - FLAC__StreamMetaData_VorbisComment *vc; + FLAC__StreamMetadata_VorbisComment *vc; FLAC__ASSERT(0 != object); FLAC__ASSERT(object->type == FLAC__METADATA_TYPE_VORBIS_COMMENT); @@ -669,16 +667,16 @@ FLAC__bool FLAC__metadata_object_vorbiscomment_insert_comment(FLAC__StreamMetaDa return false; /* move all comments >= comment_num forward one space */ - memmove(&vc->comments[comment_num+1], &vc->comments[comment_num], sizeof(FLAC__StreamMetaData_VorbisComment_Entry)*(vc->num_comments-1-comment_num)); + memmove(&vc->comments[comment_num+1], &vc->comments[comment_num], sizeof(FLAC__StreamMetadata_VorbisComment_Entry)*(vc->num_comments-1-comment_num)); vc->comments[comment_num].length = 0; vc->comments[comment_num].entry = 0; return FLAC__metadata_object_vorbiscomment_set_comment(object, comment_num, entry, copy); } -FLAC__bool FLAC__metadata_object_vorbiscomment_delete_comment(FLAC__StreamMetaData *object, unsigned comment_num) +FLAC__bool FLAC__metadata_object_vorbiscomment_delete_comment(FLAC__StreamMetadata *object, unsigned comment_num) { - FLAC__StreamMetaData_VorbisComment *vc; + FLAC__StreamMetadata_VorbisComment *vc; FLAC__ASSERT(0 != object); FLAC__ASSERT(object->type == FLAC__METADATA_TYPE_VORBIS_COMMENT); @@ -691,7 +689,7 @@ FLAC__bool FLAC__metadata_object_vorbiscomment_delete_comment(FLAC__StreamMetaDa free(vc->comments[comment_num].entry); /* move all comments > comment_num backward one space */ - memmove(&vc->comments[comment_num], &vc->comments[comment_num+1], sizeof(FLAC__StreamMetaData_VorbisComment_Entry)*(vc->num_comments-comment_num-1)); + memmove(&vc->comments[comment_num], &vc->comments[comment_num+1], sizeof(FLAC__StreamMetadata_VorbisComment_Entry)*(vc->num_comments-comment_num-1)); vc->comments[vc->num_comments-1].length = 0; vc->comments[vc->num_comments-1].entry = 0; diff --git a/src/libFLAC/seekable_stream_decoder.c b/src/libFLAC/seekable_stream_decoder.c index 9104e45b..0414ff56 100644 --- a/src/libFLAC/seekable_stream_decoder.c +++ b/src/libFLAC/seekable_stream_decoder.c @@ -34,7 +34,7 @@ static void seekable_stream_decoder_set_defaults_(FLAC__SeekableStreamDecoder *decoder); 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 * const buffer[], void *client_data); -static void metadata_callback_(const FLAC__StreamDecoder *decoder, const FLAC__StreamMetaData *metadata, 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); static FLAC__bool seek_to_absolute_sample_(FLAC__SeekableStreamDecoder *decoder, FLAC__uint64 stream_length, FLAC__uint64 target_sample); @@ -51,7 +51,7 @@ typedef struct FLAC__SeekableStreamDecoderPrivate { FLAC__SeekableStreamDecoderLengthStatus (*length_callback)(const FLAC__SeekableStreamDecoder *decoder, FLAC__uint64 *stream_length, void *client_data); FLAC__bool (*eof_callback)(const FLAC__SeekableStreamDecoder *decoder, void *client_data); FLAC__StreamDecoderWriteStatus (*write_callback)(const FLAC__SeekableStreamDecoder *decoder, const FLAC__Frame *frame, const FLAC__int32 * const buffer[], void *client_data); - void (*metadata_callback)(const FLAC__SeekableStreamDecoder *decoder, const FLAC__StreamMetaData *metadata, void *client_data); + void (*metadata_callback)(const FLAC__SeekableStreamDecoder *decoder, const FLAC__StreamMetadata *metadata, void *client_data); void (*error_callback)(const FLAC__SeekableStreamDecoder *decoder, FLAC__StreamDecoderErrorStatus status, void *client_data); void *client_data; FLAC__StreamDecoder *stream_decoder; @@ -59,8 +59,8 @@ typedef struct FLAC__SeekableStreamDecoderPrivate { FLAC__byte stored_md5sum[16]; /* this is what is stored in the metadata */ FLAC__byte computed_md5sum[16]; /* this is the sum we computed from the decoded data */ /* the rest of these are only used for seeking: */ - FLAC__StreamMetaData_StreamInfo stream_info; /* we keep this around so we can figure out how to seek quickly */ - const FLAC__StreamMetaData_SeekTable *seek_table; /* we hold a pointer to the stream decoder's seek table for the same reason */ + FLAC__StreamMetadata_StreamInfo stream_info; /* we keep this around so we can figure out how to seek quickly */ + const FLAC__StreamMetadata_SeekTable *seek_table; /* we hold a pointer to the stream decoder's seek table for the same reason */ FLAC__Frame last_frame; /* holds the info of the last frame we seeked to */ FLAC__uint64 target_sample; } FLAC__SeekableStreamDecoderPrivate; @@ -313,7 +313,7 @@ FLAC__bool FLAC__seekable_stream_decoder_set_write_callback(FLAC__SeekableStream return true; } -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_metadata_callback(FLAC__SeekableStreamDecoder *decoder, void (*value)(const FLAC__SeekableStreamDecoder *decoder, const FLAC__StreamMetadata *metadata, void *client_data)) { FLAC__ASSERT(decoder != 0); FLAC__ASSERT(decoder->private_ != 0); @@ -346,7 +346,7 @@ FLAC__bool FLAC__seekable_stream_decoder_set_client_data(FLAC__SeekableStreamDec return true; } -FLAC__bool FLAC__seekable_stream_decoder_set_metadata_respond(FLAC__SeekableStreamDecoder *decoder, FLAC__MetaDataType type) +FLAC__bool FLAC__seekable_stream_decoder_set_metadata_respond(FLAC__SeekableStreamDecoder *decoder, FLAC__MetadataType type) { FLAC__ASSERT(decoder != 0); FLAC__ASSERT(decoder->private_ != 0); @@ -379,7 +379,7 @@ FLAC__bool FLAC__seekable_stream_decoder_set_metadata_respond_all(FLAC__Seekable return FLAC__stream_decoder_set_metadata_respond_all(decoder->private_->stream_decoder); } -FLAC__bool FLAC__seekable_stream_decoder_set_metadata_ignore(FLAC__SeekableStreamDecoder *decoder, FLAC__MetaDataType type) +FLAC__bool FLAC__seekable_stream_decoder_set_metadata_ignore(FLAC__SeekableStreamDecoder *decoder, FLAC__MetadataType type) { FLAC__ASSERT(decoder != 0); FLAC__ASSERT(decoder->private_ != 0); @@ -716,7 +716,7 @@ FLAC__StreamDecoderWriteStatus write_callback_(const FLAC__StreamDecoder *decode } } -void metadata_callback_(const FLAC__StreamDecoder *decoder, const FLAC__StreamMetaData *metadata, void *client_data) +void metadata_callback_(const FLAC__StreamDecoder *decoder, const FLAC__StreamMetadata *metadata, void *client_data) { FLAC__SeekableStreamDecoder *seekable_stream_decoder = (FLAC__SeekableStreamDecoder *)client_data; (void)decoder; diff --git a/src/libFLAC/stream_decoder.c b/src/libFLAC/stream_decoder.c index 924c2517..6bac1596 100644 --- a/src/libFLAC/stream_decoder.c +++ b/src/libFLAC/stream_decoder.c @@ -69,7 +69,7 @@ static FLAC__bool read_callback_(FLAC__byte buffer[], unsigned *bytes, void *cli typedef struct FLAC__StreamDecoderPrivate { FLAC__StreamDecoderReadStatus (*read_callback)(const FLAC__StreamDecoder *decoder, FLAC__byte buffer[], unsigned *bytes, void *client_data); FLAC__StreamDecoderWriteStatus (*write_callback)(const FLAC__StreamDecoder *decoder, const FLAC__Frame *frame, const FLAC__int32 * const buffer[], void *client_data); - void (*metadata_callback)(const FLAC__StreamDecoder *decoder, const FLAC__StreamMetaData *metadata, void *client_data); + void (*metadata_callback)(const FLAC__StreamDecoder *decoder, const FLAC__StreamMetadata *metadata, void *client_data); void (*error_callback)(const FLAC__StreamDecoder *decoder, FLAC__StreamDecoderErrorStatus status, void *client_data); void (*local_lpc_restore_signal)(const FLAC__int32 residual[], unsigned data_len, const FLAC__int32 qlp_coeff[], unsigned order, int lp_quantization, FLAC__int32 data[]); void (*local_lpc_restore_signal_16bit)(const FLAC__int32 residual[], unsigned data_len, const FLAC__int32 qlp_coeff[], unsigned order, int lp_quantization, FLAC__int32 data[]); @@ -81,8 +81,8 @@ typedef struct FLAC__StreamDecoderPrivate { FLAC__uint32 last_frame_number; FLAC__uint64 samples_decoded; FLAC__bool has_stream_info, has_seek_table; - FLAC__StreamMetaData stream_info; - FLAC__StreamMetaData seek_table; + FLAC__StreamMetadata stream_info; + FLAC__StreamMetadata seek_table; FLAC__bool metadata_filter[FLAC__METADATA_TYPE_VORBIS_COMMENT+1]; FLAC__byte *metadata_filter_ids; unsigned metadata_filter_ids_count, metadata_filter_ids_capacity; /* units for both are IDs, not bytes */ @@ -313,7 +313,7 @@ FLAC__bool FLAC__stream_decoder_set_write_callback(FLAC__StreamDecoder *decoder, return true; } -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_metadata_callback(FLAC__StreamDecoder *decoder, void (*value)(const FLAC__StreamDecoder *decoder, const FLAC__StreamMetadata *metadata, void *client_data)) { FLAC__ASSERT(decoder != 0); FLAC__ASSERT(decoder->private_ != 0); @@ -346,7 +346,7 @@ FLAC__bool FLAC__stream_decoder_set_client_data(FLAC__StreamDecoder *decoder, vo return true; } -FLAC__bool FLAC__stream_decoder_set_metadata_respond(FLAC__StreamDecoder *decoder, FLAC__MetaDataType type) +FLAC__bool FLAC__stream_decoder_set_metadata_respond(FLAC__StreamDecoder *decoder, FLAC__MetadataType type) { FLAC__ASSERT(decoder != 0); FLAC__ASSERT(decoder->private_ != 0); @@ -399,7 +399,7 @@ FLAC__bool FLAC__stream_decoder_set_metadata_respond_all(FLAC__StreamDecoder *de return true; } -FLAC__bool FLAC__stream_decoder_set_metadata_ignore(FLAC__StreamDecoder *decoder, FLAC__MetaDataType type) +FLAC__bool FLAC__stream_decoder_set_metadata_ignore(FLAC__StreamDecoder *decoder, FLAC__MetadataType type) { FLAC__ASSERT(decoder != 0); FLAC__ASSERT(decoder->private_ != 0); @@ -888,7 +888,7 @@ FLAC__bool stream_decoder_read_metadata_(FLAC__StreamDecoder *decoder) decoder->private_->seek_table.data.seek_table.num_points = length / FLAC__STREAM_METADATA_SEEKPOINT_LENGTH; - if(0 == (decoder->private_->seek_table.data.seek_table.points = (FLAC__StreamMetaData_SeekPoint*)malloc(decoder->private_->seek_table.data.seek_table.num_points * sizeof(FLAC__StreamMetaData_SeekPoint)))) { + if(0 == (decoder->private_->seek_table.data.seek_table.points = (FLAC__StreamMetadata_SeekPoint*)malloc(decoder->private_->seek_table.data.seek_table.num_points * sizeof(FLAC__StreamMetadata_SeekPoint)))) { decoder->protected_->state = FLAC__STREAM_DECODER_MEMORY_ALLOCATION_ERROR; return false; } @@ -920,7 +920,7 @@ FLAC__bool stream_decoder_read_metadata_(FLAC__StreamDecoder *decoder) else { FLAC__bool skip_it = !decoder->private_->metadata_filter[type]; unsigned real_length = length; - FLAC__StreamMetaData block; + FLAC__StreamMetadata block; block.is_last = last_block; block.type = type; @@ -983,7 +983,7 @@ FLAC__bool stream_decoder_read_metadata_(FLAC__StreamDecoder *decoder) /* read comments */ if(block.data.vorbis_comment.num_comments > 0) { - if(0 == (block.data.vorbis_comment.comments = malloc(block.data.vorbis_comment.num_comments * sizeof(FLAC__StreamMetaData_VorbisComment_Entry)))) { + if(0 == (block.data.vorbis_comment.comments = malloc(block.data.vorbis_comment.num_comments * sizeof(FLAC__StreamMetadata_VorbisComment_Entry)))) { decoder->protected_->state = FLAC__STREAM_DECODER_MEMORY_ALLOCATION_ERROR; return false; } diff --git a/src/libFLAC/stream_encoder.c b/src/libFLAC/stream_encoder.c index 4c20b6ca..aa01b4ab 100644 --- a/src/libFLAC/stream_encoder.c +++ b/src/libFLAC/stream_encoder.c @@ -102,7 +102,7 @@ typedef struct FLAC__StreamEncoderPrivate { unsigned loose_mid_side_stereo_frames; /* rounded number of frames the encoder will use before trying both independent and mid/side frames again */ unsigned loose_mid_side_stereo_frame_count; /* number of frames using the current channel assignment */ FLAC__ChannelAssignment last_channel_assignment; - FLAC__StreamMetaData metadata; + FLAC__StreamMetadata metadata; unsigned current_sample_number; unsigned current_frame_number; struct MD5Context md5context; @@ -116,7 +116,7 @@ typedef struct FLAC__StreamEncoderPrivate { FLAC__bool use_wide_by_order; /* use slow 64-bit versions of some functions because of the lpc order */ FLAC__bool precompute_partition_sums; /* our initial guess as to whether precomputing the partitions sums will be a speed improvement */ FLAC__StreamEncoderWriteStatus (*write_callback)(const FLAC__StreamEncoder *encoder, const FLAC__byte buffer[], unsigned bytes, unsigned samples, unsigned current_frame, void *client_data); - void (*metadata_callback)(const FLAC__StreamEncoder *encoder, const FLAC__StreamMetaData *metadata, void *client_data); + void (*metadata_callback)(const FLAC__StreamEncoder *encoder, const FLAC__StreamMetadata *metadata, void *client_data); void *client_data; /* unaligned (original) pointers to allocated data */ FLAC__int32 *integer_signal_unaligned[FLAC__MAX_CHANNELS]; @@ -686,7 +686,7 @@ FLAC__bool FLAC__stream_encoder_set_total_samples_estimate(FLAC__StreamEncoder * return true; } -FLAC__bool FLAC__stream_encoder_set_metadata(FLAC__StreamEncoder *encoder, FLAC__StreamMetaData **metadata, unsigned num_blocks) +FLAC__bool FLAC__stream_encoder_set_metadata(FLAC__StreamEncoder *encoder, FLAC__StreamMetadata **metadata, unsigned num_blocks) { if(encoder->protected_->state != FLAC__STREAM_ENCODER_UNINITIALIZED) return false; @@ -703,7 +703,7 @@ FLAC__bool FLAC__stream_encoder_set_write_callback(FLAC__StreamEncoder *encoder, return true; } -FLAC__bool FLAC__stream_encoder_set_metadata_callback(FLAC__StreamEncoder *encoder, void (*value)(const FLAC__StreamEncoder *encoder, const FLAC__StreamMetaData *metadata, void *client_data)) +FLAC__bool FLAC__stream_encoder_set_metadata_callback(FLAC__StreamEncoder *encoder, void (*value)(const FLAC__StreamEncoder *encoder, const FLAC__StreamMetadata *metadata, void *client_data)) { if(encoder->protected_->state != FLAC__STREAM_ENCODER_UNINITIALIZED) return false; diff --git a/src/libFLAC/stream_encoder_framing.c b/src/libFLAC/stream_encoder_framing.c index c884d8a4..e3e3e5a4 100644 --- a/src/libFLAC/stream_encoder_framing.c +++ b/src/libFLAC/stream_encoder_framing.c @@ -30,7 +30,7 @@ static FLAC__bool subframe_add_entropy_coding_method_(FLAC__BitBuffer *bb, const FLAC__EntropyCodingMethod *method); static FLAC__bool subframe_add_residual_partitioned_rice_(FLAC__BitBuffer *bb, const FLAC__int32 residual[], const unsigned residual_samples, const unsigned predictor_order, const unsigned rice_parameters[], const unsigned raw_bits[], const unsigned partition_order); -FLAC__bool FLAC__add_metadata_block(const FLAC__StreamMetaData *metadata, FLAC__BitBuffer *bb) +FLAC__bool FLAC__add_metadata_block(const FLAC__StreamMetadata *metadata, FLAC__BitBuffer *bb) { unsigned i; diff --git a/src/metaflac/Makefile.vc b/src/metaflac/Makefile.vc index f7256713..7067bfc4 100644 --- a/src/metaflac/Makefile.vc +++ b/src/metaflac/Makefile.vc @@ -19,10 +19,10 @@ !IFDEF DEBUG
.c.obj:
- $(cc) $(cdebug) $(cflags) /I "..\..\include" /I ".\include" -DSTRICT -DVERSION=\"1.0.3\" -YX /Od /D "_DEBUG" $<
+ $(cc) $(cdebug) $(cflags) /I "..\..\include" /I ".\include" -DSTRICT -DVERSION=\"1.0.3_beta\" -YX /Od /D "_DEBUG" $<
!else
.c.obj:
- $(cc) /O2 $(crelease) $(cflags) /I "..\..\include" /I ".\include" -DSTRICT -DVERSION=\"1.0.3\" -YX -DNODEBUG $<
+ $(cc) /O2 $(crelease) $(cflags) /I "..\..\include" /I ".\include" -DSTRICT -DVERSION=\"1.0.3_beta\" -YX -DNODEBUG $<
!endif
C_FILES= \
diff --git a/src/metaflac/main.c b/src/metaflac/main.c index e0b4f507..44951a2f 100644 --- a/src/metaflac/main.c +++ b/src/metaflac/main.c @@ -135,7 +135,7 @@ typedef struct { } Argument_BlockNumber; typedef struct { - FLAC__MetaDataType type; + FLAC__MetadataType type; char application_id[4]; /* only relevant if type == FLAC__STREAM_METADATA_TYPE_APPLICATION */ FLAC__bool filter_application_by_id; } Argument_BlockTypeEntry; @@ -226,25 +226,25 @@ static FLAC__bool parse_application_data_format(const char *in, FLAC__bool *out) static FLAC__bool do_operations(const CommandLineOptions *options); static FLAC__bool do_major_operation(const CommandLineOptions *options); static FLAC__bool do_major_operation_on_file(const char *filename, const CommandLineOptions *options); -static FLAC__bool do_major_operation__list(const char *filename, FLAC__MetaData_Chain *chain, const CommandLineOptions *options); -static FLAC__bool do_major_operation__append(FLAC__MetaData_Chain *chain, const CommandLineOptions *options); -static FLAC__bool do_major_operation__remove(FLAC__MetaData_Chain *chain, const CommandLineOptions *options); -static FLAC__bool do_major_operation__remove_all(FLAC__MetaData_Chain *chain, const CommandLineOptions *options); +static FLAC__bool do_major_operation__list(const char *filename, FLAC__Metadata_Chain *chain, const CommandLineOptions *options); +static FLAC__bool do_major_operation__append(FLAC__Metadata_Chain *chain, const CommandLineOptions *options); +static FLAC__bool do_major_operation__remove(FLAC__Metadata_Chain *chain, const CommandLineOptions *options); +static FLAC__bool do_major_operation__remove_all(FLAC__Metadata_Chain *chain, const CommandLineOptions *options); static FLAC__bool do_shorthand_operations(const CommandLineOptions *options); static FLAC__bool do_shorthand_operations_on_file(const char *fielname, const CommandLineOptions *options); -static FLAC__bool do_shorthand_operation(const char *filename, FLAC__MetaData_Chain *chain, const Operation *operation, FLAC__bool *needs_write); -static FLAC__bool do_shorthand_operation__add_padding(FLAC__MetaData_Chain *chain, unsigned length, FLAC__bool *needs_write); -static FLAC__bool do_shorthand_operation__streaminfo(const char *filename, FLAC__MetaData_Chain *chain, OperationType op); -static FLAC__bool do_shorthand_operation__vorbis_comment(const char *filename, FLAC__MetaData_Chain *chain, const Operation *operation, FLAC__bool *needs_write); -static FLAC__bool passes_filter(const CommandLineOptions *options, const FLAC__StreamMetaData *block, unsigned block_number); -static void write_metadata(const char *filename, FLAC__StreamMetaData *block, unsigned block_number, FLAC__bool hexdump_application); -static void write_vc_field(const char *filename, const FLAC__StreamMetaData_VorbisComment_Entry *entry); -static void write_vc_fields(const char *filename, const char *field_name, const FLAC__StreamMetaData_VorbisComment_Entry entry[], unsigned num_entries); -static FLAC__bool remove_vc_all(FLAC__StreamMetaData *block, FLAC__bool *needs_write); -static FLAC__bool remove_vc_field(FLAC__StreamMetaData *block, const char *field_name, FLAC__bool *needs_write); -static FLAC__bool remove_vc_firstfield(FLAC__StreamMetaData *block, const char *field_name, FLAC__bool *needs_write); -static FLAC__bool set_vc_field(FLAC__StreamMetaData *block, const Argument_VcField *field, FLAC__bool *needs_write); -static FLAC__bool field_name_matches_entry(const char *field_name, unsigned field_name_length, const FLAC__StreamMetaData_VorbisComment_Entry *entry); +static FLAC__bool do_shorthand_operation(const char *filename, FLAC__Metadata_Chain *chain, const Operation *operation, FLAC__bool *needs_write); +static FLAC__bool do_shorthand_operation__add_padding(FLAC__Metadata_Chain *chain, unsigned length, FLAC__bool *needs_write); +static FLAC__bool do_shorthand_operation__streaminfo(const char *filename, FLAC__Metadata_Chain *chain, OperationType op); +static FLAC__bool do_shorthand_operation__vorbis_comment(const char *filename, FLAC__Metadata_Chain *chain, const Operation *operation, FLAC__bool *needs_write); +static FLAC__bool passes_filter(const CommandLineOptions *options, const FLAC__StreamMetadata *block, unsigned block_number); +static void write_metadata(const char *filename, FLAC__StreamMetadata *block, unsigned block_number, FLAC__bool hexdump_application); +static void write_vc_field(const char *filename, const FLAC__StreamMetadata_VorbisComment_Entry *entry); +static void write_vc_fields(const char *filename, const char *field_name, const FLAC__StreamMetadata_VorbisComment_Entry entry[], unsigned num_entries); +static FLAC__bool remove_vc_all(FLAC__StreamMetadata *block, FLAC__bool *needs_write); +static FLAC__bool remove_vc_field(FLAC__StreamMetadata *block, const char *field_name, FLAC__bool *needs_write); +static FLAC__bool remove_vc_firstfield(FLAC__StreamMetadata *block, const char *field_name, FLAC__bool *needs_write); +static FLAC__bool set_vc_field(FLAC__StreamMetadata *block, const Argument_VcField *field, FLAC__bool *needs_write); +static FLAC__bool field_name_matches_entry(const char *field_name, unsigned field_name_length, const FLAC__StreamMetadata_VorbisComment_Entry *entry); static void hexdump(const char *filename, const FLAC__byte *buf, unsigned bytes, const char *indent); int main(int argc, char *argv[]) @@ -1056,13 +1056,13 @@ FLAC__bool do_major_operation(const CommandLineOptions *options) FLAC__bool do_major_operation_on_file(const char *filename, const CommandLineOptions *options) { FLAC__bool ok = true, needs_write = false; - FLAC__MetaData_Chain *chain = FLAC__metadata_chain_new(); + FLAC__Metadata_Chain *chain = FLAC__metadata_chain_new(); if(0 == chain) die("out of memory allocating chain"); if(!FLAC__metadata_chain_read(chain, filename)) { - fprintf(stderr, "ERROR: reading metadata, status = \"%s\"\n", FLAC__MetaData_ChainStatusString[FLAC__metadata_chain_status(chain)]); + fprintf(stderr, "ERROR: reading metadata, status = \"%s\"\n", FLAC__Metadata_ChainStatusString[FLAC__metadata_chain_status(chain)]); return false; } @@ -1100,7 +1100,7 @@ FLAC__bool do_major_operation_on_file(const char *filename, const CommandLineOpt FLAC__metadata_chain_sort_padding(chain); ok = FLAC__metadata_chain_write(chain, options->use_padding, options->preserve_modtime); if(!ok) - fprintf(stderr, "ERROR: writing FLAC file %s, error = %s\n", filename, FLAC__MetaData_ChainStatusString[FLAC__metadata_chain_status(chain)]); + fprintf(stderr, "ERROR: writing FLAC file %s, error = %s\n", filename, FLAC__Metadata_ChainStatusString[FLAC__metadata_chain_status(chain)]); } FLAC__metadata_chain_delete(chain); @@ -1108,10 +1108,10 @@ FLAC__bool do_major_operation_on_file(const char *filename, const CommandLineOpt return ok; } -FLAC__bool do_major_operation__list(const char *filename, FLAC__MetaData_Chain *chain, const CommandLineOptions *options) +FLAC__bool do_major_operation__list(const char *filename, FLAC__Metadata_Chain *chain, const CommandLineOptions *options) { - FLAC__MetaData_Iterator *iterator = FLAC__metadata_iterator_new(); - FLAC__StreamMetaData *block; + FLAC__Metadata_Iterator *iterator = FLAC__metadata_iterator_new(); + FLAC__StreamMetadata *block; FLAC__bool ok = true; unsigned block_number; @@ -1136,16 +1136,16 @@ FLAC__bool do_major_operation__list(const char *filename, FLAC__MetaData_Chain * return ok; } -FLAC__bool do_major_operation__append(FLAC__MetaData_Chain *chain, const CommandLineOptions *options) +FLAC__bool do_major_operation__append(FLAC__Metadata_Chain *chain, const CommandLineOptions *options) { (void) chain, (void) options; fprintf(stderr, "ERROR: --append not implemented yet\n"); /*@@@*/ return false; } -FLAC__bool do_major_operation__remove(FLAC__MetaData_Chain *chain, const CommandLineOptions *options) +FLAC__bool do_major_operation__remove(FLAC__Metadata_Chain *chain, const CommandLineOptions *options) { - FLAC__MetaData_Iterator *iterator = FLAC__metadata_iterator_new(); + FLAC__Metadata_Iterator *iterator = FLAC__metadata_iterator_new(); FLAC__bool ok = true; unsigned block_number; @@ -1166,9 +1166,9 @@ FLAC__bool do_major_operation__remove(FLAC__MetaData_Chain *chain, const Command return ok; } -FLAC__bool do_major_operation__remove_all(FLAC__MetaData_Chain *chain, const CommandLineOptions *options) +FLAC__bool do_major_operation__remove_all(FLAC__Metadata_Chain *chain, const CommandLineOptions *options) { - FLAC__MetaData_Iterator *iterator = FLAC__metadata_iterator_new(); + FLAC__Metadata_Iterator *iterator = FLAC__metadata_iterator_new(); FLAC__bool ok = true; if(0 == iterator) @@ -1200,13 +1200,13 @@ FLAC__bool do_shorthand_operations_on_file(const char *filename, const CommandLi { unsigned i; FLAC__bool ok = true, needs_write = false; - FLAC__MetaData_Chain *chain = FLAC__metadata_chain_new(); + FLAC__Metadata_Chain *chain = FLAC__metadata_chain_new(); if(0 == chain) die("out of memory allocating chain"); if(!FLAC__metadata_chain_read(chain, filename)) { - fprintf(stderr, "ERROR: reading metadata, status = \"%s\"\n", FLAC__MetaData_ChainStatusString[FLAC__metadata_chain_status(chain)]); + fprintf(stderr, "ERROR: reading metadata, status = \"%s\"\n", FLAC__Metadata_ChainStatusString[FLAC__metadata_chain_status(chain)]); return false; } @@ -1218,7 +1218,7 @@ FLAC__bool do_shorthand_operations_on_file(const char *filename, const CommandLi FLAC__metadata_chain_sort_padding(chain); ok = FLAC__metadata_chain_write(chain, options->use_padding, options->preserve_modtime); if(!ok) - fprintf(stderr, "ERROR: writing FLAC file %s, error = %s\n", filename, FLAC__MetaData_ChainStatusString[FLAC__metadata_chain_status(chain)]); + fprintf(stderr, "ERROR: writing FLAC file %s, error = %s\n", filename, FLAC__Metadata_ChainStatusString[FLAC__metadata_chain_status(chain)]); } FLAC__metadata_chain_delete(chain); @@ -1226,7 +1226,7 @@ FLAC__bool do_shorthand_operations_on_file(const char *filename, const CommandLi return ok; } -FLAC__bool do_shorthand_operation(const char *filename, FLAC__MetaData_Chain *chain, const Operation *operation, FLAC__bool *needs_write) +FLAC__bool do_shorthand_operation(const char *filename, FLAC__Metadata_Chain *chain, const Operation *operation, FLAC__bool *needs_write) { FLAC__bool ok = true; @@ -1262,10 +1262,10 @@ FLAC__bool do_shorthand_operation(const char *filename, FLAC__MetaData_Chain *ch return ok; } -FLAC__bool do_shorthand_operation__add_padding(FLAC__MetaData_Chain *chain, unsigned length, FLAC__bool *needs_write) +FLAC__bool do_shorthand_operation__add_padding(FLAC__Metadata_Chain *chain, unsigned length, FLAC__bool *needs_write) { - FLAC__StreamMetaData *padding = 0; - FLAC__MetaData_Iterator *iterator = FLAC__metadata_iterator_new(); + FLAC__StreamMetadata *padding = 0; + FLAC__Metadata_Iterator *iterator = FLAC__metadata_iterator_new(); if(0 == iterator) die("out of memory allocating iterator"); @@ -1282,7 +1282,7 @@ FLAC__bool do_shorthand_operation__add_padding(FLAC__MetaData_Chain *chain, unsi padding->length = length; if(!FLAC__metadata_iterator_insert_block_after(iterator, padding)) { - fprintf(stderr, "ERROR: adding new PADDING block to metadata, status =\"%s\"\n", FLAC__MetaData_ChainStatusString[FLAC__metadata_chain_status(chain)]); + fprintf(stderr, "ERROR: adding new PADDING block to metadata, status =\"%s\"\n", FLAC__Metadata_ChainStatusString[FLAC__metadata_chain_status(chain)]); FLAC__metadata_object_delete(padding); return false; } @@ -1291,12 +1291,12 @@ FLAC__bool do_shorthand_operation__add_padding(FLAC__MetaData_Chain *chain, unsi return true; } -FLAC__bool do_shorthand_operation__streaminfo(const char *filename, FLAC__MetaData_Chain *chain, OperationType op) +FLAC__bool do_shorthand_operation__streaminfo(const char *filename, FLAC__Metadata_Chain *chain, OperationType op) { unsigned i; FLAC__bool ok = true; - FLAC__StreamMetaData *block; - FLAC__MetaData_Iterator *iterator = FLAC__metadata_iterator_new(); + FLAC__StreamMetadata *block; + FLAC__Metadata_Iterator *iterator = FLAC__metadata_iterator_new(); if(0 == iterator) die("out of memory allocating iterator"); @@ -1352,11 +1352,11 @@ FLAC__bool do_shorthand_operation__streaminfo(const char *filename, FLAC__MetaDa return ok; } -FLAC__bool do_shorthand_operation__vorbis_comment(const char *filename, FLAC__MetaData_Chain *chain, const Operation *operation, FLAC__bool *needs_write) +FLAC__bool do_shorthand_operation__vorbis_comment(const char *filename, FLAC__Metadata_Chain *chain, const Operation *operation, FLAC__bool *needs_write) { FLAC__bool ok = true, found_vc_block = false; - FLAC__StreamMetaData *block = 0; - FLAC__MetaData_Iterator *iterator = FLAC__metadata_iterator_new(); + FLAC__StreamMetadata *block = 0; + FLAC__Metadata_Iterator *iterator = FLAC__metadata_iterator_new(); if(0 == iterator) die("out of memory allocating iterator"); @@ -1377,7 +1377,7 @@ FLAC__bool do_shorthand_operation__vorbis_comment(const char *filename, FLAC__Me while(FLAC__metadata_iterator_next(iterator)) ; if(!FLAC__metadata_iterator_insert_block_after(iterator, block)) { - fprintf(stderr, "ERROR: adding new VORBIS_COMMENT block to metadata, status =\"%s\"\n", FLAC__MetaData_ChainStatusString[FLAC__metadata_chain_status(chain)]); + fprintf(stderr, "ERROR: adding new VORBIS_COMMENT block to metadata, status =\"%s\"\n", FLAC__Metadata_ChainStatusString[FLAC__metadata_chain_status(chain)]); return false; } /* iterator is left pointing to new block */ @@ -1415,7 +1415,7 @@ FLAC__bool do_shorthand_operation__vorbis_comment(const char *filename, FLAC__Me return ok; } -FLAC__bool passes_filter(const CommandLineOptions *options, const FLAC__StreamMetaData *block, unsigned block_number) +FLAC__bool passes_filter(const CommandLineOptions *options, const FLAC__StreamMetadata *block, unsigned block_number) { unsigned i, j; FLAC__bool matches_number = false, matches_type = false; @@ -1453,14 +1453,14 @@ FLAC__bool passes_filter(const CommandLineOptions *options, const FLAC__StreamMe return matches_number && matches_type; } -void write_metadata(const char *filename, FLAC__StreamMetaData *block, unsigned block_number, FLAC__bool hexdump_application) +void write_metadata(const char *filename, FLAC__StreamMetadata *block, unsigned block_number, FLAC__bool hexdump_application) { unsigned i; /*@@@ yuck, should do this with a varargs function or something: */ #define PPR if(filename)printf("%s:",filename); PPR; printf("METADATA block #%u\n", block_number); - PPR; printf(" type: %u (%s)\n", (unsigned)block->type, block->type<=FLAC__METADATA_TYPE_VORBIS_COMMENT? FLAC__MetaDataTypeString[block->type] : "UNKNOWN"); + PPR; printf(" type: %u (%s)\n", (unsigned)block->type, block->type<=FLAC__METADATA_TYPE_VORBIS_COMMENT? FLAC__MetadataTypeString[block->type] : "UNKNOWN"); PPR; printf(" is last: %s\n", block->is_last? "true":"false"); PPR; printf(" length: %u\n", block->length); @@ -1521,7 +1521,7 @@ void write_metadata(const char *filename, FLAC__StreamMetaData *block, unsigned #undef PPR } -void write_vc_field(const char *filename, const FLAC__StreamMetaData_VorbisComment_Entry *entry) +void write_vc_field(const char *filename, const FLAC__StreamMetadata_VorbisComment_Entry *entry) { if(filename) printf("%s:", filename); @@ -1529,7 +1529,7 @@ void write_vc_field(const char *filename, const FLAC__StreamMetaData_VorbisComme printf("\n"); } -void write_vc_fields(const char *filename, const char *field_name, const FLAC__StreamMetaData_VorbisComment_Entry entry[], unsigned num_entries) +void write_vc_fields(const char *filename, const char *field_name, const FLAC__StreamMetadata_VorbisComment_Entry entry[], unsigned num_entries) { unsigned i; const unsigned field_name_length = strlen(field_name); @@ -1540,7 +1540,7 @@ void write_vc_fields(const char *filename, const char *field_name, const FLAC__S } } -FLAC__bool remove_vc_all(FLAC__StreamMetaData *block, FLAC__bool *needs_write) +FLAC__bool remove_vc_all(FLAC__StreamMetadata *block, FLAC__bool *needs_write) { FLAC__ASSERT(0 != block); FLAC__ASSERT(block->type == FLAC__METADATA_TYPE_VORBIS_COMMENT); @@ -1559,7 +1559,7 @@ FLAC__bool remove_vc_all(FLAC__StreamMetaData *block, FLAC__bool *needs_write) return true; } -FLAC__bool remove_vc_field(FLAC__StreamMetaData *block, const char *field_name, FLAC__bool *needs_write) +FLAC__bool remove_vc_field(FLAC__StreamMetadata *block, const char *field_name, FLAC__bool *needs_write) { FLAC__bool ok = true; const unsigned field_name_length = strlen(field_name); @@ -1581,7 +1581,7 @@ FLAC__bool remove_vc_field(FLAC__StreamMetaData *block, const char *field_name, return ok; } -FLAC__bool remove_vc_firstfield(FLAC__StreamMetaData *block, const char *field_name, FLAC__bool *needs_write) +FLAC__bool remove_vc_firstfield(FLAC__StreamMetadata *block, const char *field_name, FLAC__bool *needs_write) { const unsigned field_name_length = strlen(field_name); unsigned i; @@ -1603,9 +1603,9 @@ FLAC__bool remove_vc_firstfield(FLAC__StreamMetaData *block, const char *field_n return true; } -FLAC__bool set_vc_field(FLAC__StreamMetaData *block, const Argument_VcField *field, FLAC__bool *needs_write) +FLAC__bool set_vc_field(FLAC__StreamMetadata *block, const Argument_VcField *field, FLAC__bool *needs_write) { - FLAC__StreamMetaData_VorbisComment_Entry entry; + FLAC__StreamMetadata_VorbisComment_Entry entry; FLAC__ASSERT(0 != block); FLAC__ASSERT(block->type == FLAC__METADATA_TYPE_VORBIS_COMMENT); FLAC__ASSERT(0 != field); @@ -1623,7 +1623,7 @@ FLAC__bool set_vc_field(FLAC__StreamMetaData *block, const Argument_VcField *fie } } -FLAC__bool field_name_matches_entry(const char *field_name, unsigned field_name_length, const FLAC__StreamMetaData_VorbisComment_Entry *entry) +FLAC__bool field_name_matches_entry(const char *field_name, unsigned field_name_length, const FLAC__StreamMetadata_VorbisComment_Entry *entry) { return (0 != memchr(entry->entry, '=', entry->length) && 0 == strncmp(field_name, entry->entry, field_name_length)); } diff --git a/src/plugin_winamp2/Makefile.vc b/src/plugin_winamp2/Makefile.vc index 2f0f1040..8bd2d3e5 100644 --- a/src/plugin_winamp2/Makefile.vc +++ b/src/plugin_winamp2/Makefile.vc @@ -19,10 +19,10 @@ !IFDEF DEBUG
.c.obj:
- $(cc) /GX $(cdebug) $(cflags) $(cvarsdll) /I "..\..\include" /I ".\include" -DSTRICT -DVERSION=\"1.0.3\" -YX /Od /D "_DEBUG" $<
+ $(cc) /GX $(cdebug) $(cflags) $(cvarsdll) /I "..\..\include" /I ".\include" -DSTRICT -DVERSION=\"1.0.3_beta\" -YX /Od /D "_DEBUG" $<
!else
.c.obj:
- $(cc) /O2 $(crelease) $(cflags) $(cvarsdll) /I "..\..\include" /I ".\include" -DSTRICT -DVERSION=\"1.0.3\" -YX -DNODEBUG $<
+ $(cc) /O2 $(crelease) $(cflags) $(cvarsdll) /I "..\..\include" /I ".\include" -DSTRICT -DVERSION=\"1.0.3_beta\" -YX -DNODEBUG $<
!endif
C_FILES= \
diff --git a/src/plugin_winamp2/in_flac.c b/src/plugin_winamp2/in_flac.c index a87fe82d..10d944ef 100644 --- a/src/plugin_winamp2/in_flac.c +++ b/src/plugin_winamp2/in_flac.c @@ -58,7 +58,7 @@ static FLAC__bool safe_decoder_init_(const char *infilename, FLAC__FileDecoder * static void safe_decoder_finish_(FLAC__FileDecoder *decoder); static void safe_decoder_delete_(FLAC__FileDecoder *decoder); static FLAC__StreamDecoderWriteStatus write_callback_(const FLAC__FileDecoder *decoder, const FLAC__Frame *frame, const FLAC__int32 *buffer[], void *client_data); -static void metadata_callback_(const FLAC__FileDecoder *decoder, const FLAC__StreamMetaData *metadata, 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); static FLAC__bool get_id3v1_tag_(const char *filename, id3v1_struct *tag); @@ -211,7 +211,7 @@ int infoDlg(char *fn, HWND hwnd) void getfileinfo(char *filename, char *title, int *length_in_ms) { id3v1_struct tag; - FLAC__StreamMetaData_StreamInfo streaminfo; + FLAC__StreamMetadata_StreamInfo streaminfo; if(0 == filename) { filename = lastfn_; @@ -427,7 +427,7 @@ FLAC__StreamDecoderWriteStatus write_callback_(const FLAC__FileDecoder *decoder, return FLAC__STREAM_DECODER_WRITE_STATUS_CONTINUE; } -void metadata_callback_(const FLAC__FileDecoder *decoder, const FLAC__StreamMetaData *metadata, void *client_data) +void metadata_callback_(const FLAC__FileDecoder *decoder, const FLAC__StreamMetadata *metadata, void *client_data) { file_info_struct *file_info_ = (file_info_struct *)client_data; (void)decoder; diff --git a/src/plugin_winamp3/flacpcm.cpp b/src/plugin_winamp3/flacpcm.cpp index 612eab4f..d2eeaaef 100644 --- a/src/plugin_winamp3/flacpcm.cpp +++ b/src/plugin_winamp3/flacpcm.cpp @@ -274,7 +274,7 @@ FLAC__StreamDecoderWriteStatus FlacPcm::writeCallback_(const FLAC__SeekableStrea return FLAC__STREAM_DECODER_WRITE_STATUS_CONTINUE;
}
-void FlacPcm::metadataCallback_(const FLAC__SeekableStreamDecoder *decoder, const FLAC__StreamMetaData *metadata, void *client_data)
+void FlacPcm::metadataCallback_(const FLAC__SeekableStreamDecoder *decoder, const FLAC__StreamMetadata *metadata, void *client_data)
{
FlacPcm *instance = (FlacPcm*)client_data;
(void)decoder;
diff --git a/src/plugin_winamp3/flacpcm.h b/src/plugin_winamp3/flacpcm.h index 43f7b1f5..c6c17a9e 100644 --- a/src/plugin_winamp3/flacpcm.h +++ b/src/plugin_winamp3/flacpcm.h @@ -88,7 +88,7 @@ protected: bool abort_flag;
svc_fileReader *reader;
FLAC__SeekableStreamDecoder *decoder;
- FLAC__StreamMetaData_StreamInfo stream_info;
+ FLAC__StreamMetadata_StreamInfo stream_info;
FLAC__int16 reservoir[FLAC__MAX_BLOCK_SIZE * 2 * 2]; // *2 for max channels, another *2 for overflow
unsigned char output[576 * 2 * (16/8)]; // *2 for max channels, (16/8) for max bytes per sample
@@ -101,7 +101,7 @@ private: static FLAC__SeekableStreamDecoderLengthStatus lengthCallback_(const FLAC__SeekableStreamDecoder *decoder, FLAC__uint64 *stream_length, void *client_data);
static FLAC__bool eofCallback_(const FLAC__SeekableStreamDecoder *decoder, void *client_data);
static FLAC__StreamDecoderWriteStatus writeCallback_(const FLAC__SeekableStreamDecoder *decoder, const FLAC__Frame *frame, const FLAC__int32 *buffer[], void *client_data);
- static void metadataCallback_(const FLAC__SeekableStreamDecoder *decoder, const FLAC__StreamMetaData *metadata, void *client_data);
+ static void metadataCallback_(const FLAC__SeekableStreamDecoder *decoder, const FLAC__StreamMetadata *metadata, void *client_data);
static void errorCallback_(const FLAC__SeekableStreamDecoder *decoder, FLAC__StreamDecoderErrorStatus status, void *client_data);
};
#endif
diff --git a/src/plugin_xmms/plugin.c b/src/plugin_xmms/plugin.c index 1e1cdff8..c3eb5332 100644 --- a/src/plugin_xmms/plugin.c +++ b/src/plugin_xmms/plugin.c @@ -73,7 +73,7 @@ static FLAC__bool safe_decoder_init_(const char *filename, FLAC__FileDecoder *de static FLAC__bool safe_decoder_finish_(FLAC__FileDecoder *decoder); static FLAC__bool safe_decoder_delete_(FLAC__FileDecoder *decoder); static FLAC__StreamDecoderWriteStatus write_callback_(const FLAC__FileDecoder *decoder, const FLAC__Frame *frame, const FLAC__int32 *buffer[], void *client_data); -static void metadata_callback_(const FLAC__FileDecoder *decoder, const FLAC__StreamMetaData *metadata, 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); @@ -220,7 +220,7 @@ void FLAC_XMMS__cleanup() void FLAC_XMMS__get_song_info(char *filename, char **title, int *length_in_msec) { id3v1_struct tag; - FLAC__StreamMetaData_StreamInfo streaminfo; + FLAC__StreamMetadata_StreamInfo streaminfo; if(0 == filename) filename = ""; @@ -427,7 +427,7 @@ FLAC__StreamDecoderWriteStatus write_callback_(const FLAC__FileDecoder *decoder, return FLAC__STREAM_DECODER_WRITE_STATUS_CONTINUE; } -void metadata_callback_(const FLAC__FileDecoder *decoder, const FLAC__StreamMetaData *metadata, void *client_data) +void metadata_callback_(const FLAC__FileDecoder *decoder, const FLAC__StreamMetadata *metadata, void *client_data) { file_info_struct *file_info = (file_info_struct *)client_data; (void)decoder; diff --git a/src/test_libFLAC++/Makefile.vc b/src/test_libFLAC++/Makefile.vc index 5af32f80..96ede9cc 100644 --- a/src/test_libFLAC++/Makefile.vc +++ b/src/test_libFLAC++/Makefile.vc @@ -21,10 +21,10 @@ SUFFIXES = .cpp !IFDEF DEBUG
.c.obj:
- $(cc) $(cdebug) $(cflags) /I "..\..\include" /I ".\include" -DSTRICT -DVERSION=\"1.0.3\" -YX /Od /D "_DEBUG" $<
+ $(cc) $(cdebug) $(cflags) /I "..\..\include" /I ".\include" -DSTRICT -DVERSION=\"1.0.3_beta\" -YX /Od /D "_DEBUG" $<
!else
.c.obj:
- $(cc) /O2 $(crelease) $(cflags) /I "..\..\include" /I ".\include" -DSTRICT -DVERSION=\"1.0.3\" -YX -DNODEBUG $<
+ $(cc) /O2 $(crelease) $(cflags) /I "..\..\include" /I ".\include" -DSTRICT -DVERSION=\"1.0.3_beta\" -YX -DNODEBUG $<
!endif
!IFDEF DEBUG
diff --git a/src/test_libFLAC++/decoders.cc b/src/test_libFLAC++/decoders.cc index d592bd28..6c39a8d6 100644 --- a/src/test_libFLAC++/decoders.cc +++ b/src/test_libFLAC++/decoders.cc @@ -28,8 +28,8 @@ extern "C" { #include <stdlib.h> #include <string.h> -static ::FLAC__StreamMetaData streaminfo_, padding_, seektable_, application1_, application2_, vorbiscomment_; -static ::FLAC__StreamMetaData *expected_metadata_sequence_[6]; +static ::FLAC__StreamMetadata streaminfo_, padding_, seektable_, application1_, application2_, vorbiscomment_; +static ::FLAC__StreamMetadata *expected_metadata_sequence_[6]; static unsigned num_expected_; static const char *flacfilename_ = "metadata.flac"; static unsigned flacfilesize_; @@ -82,7 +82,7 @@ static void init_metadata_blocks_() seektable_.type = ::FLAC__METADATA_TYPE_SEEKTABLE; seektable_.data.seek_table.num_points = 2; seektable_.length = seektable_.data.seek_table.num_points * FLAC__STREAM_METADATA_SEEKPOINT_LENGTH; - seektable_.data.seek_table.points = (::FLAC__StreamMetaData_SeekPoint*)malloc_or_die_(seektable_.data.seek_table.num_points * sizeof(::FLAC__StreamMetaData_SeekPoint)); + seektable_.data.seek_table.points = (::FLAC__StreamMetadata_SeekPoint*)malloc_or_die_(seektable_.data.seek_table.num_points * sizeof(::FLAC__StreamMetadata_SeekPoint)); seektable_.data.seek_table.points[0].sample_number = 0; seektable_.data.seek_table.points[0].stream_offset = 0; seektable_.data.seek_table.points[0].frame_samples = streaminfo_.data.stream_info.min_blocksize; @@ -110,7 +110,7 @@ static void init_metadata_blocks_() vorbiscomment_.data.vorbis_comment.vendor_string.entry = (FLAC__byte*)malloc_or_die_(8); memcpy(vorbiscomment_.data.vorbis_comment.vendor_string.entry, "flac 1.x", 8); vorbiscomment_.data.vorbis_comment.num_comments = 2; - vorbiscomment_.data.vorbis_comment.comments = (::FLAC__StreamMetaData_VorbisComment_Entry*)malloc_or_die_(vorbiscomment_.data.vorbis_comment.num_comments * sizeof(::FLAC__StreamMetaData_VorbisComment_Entry)); + vorbiscomment_.data.vorbis_comment.comments = (::FLAC__StreamMetadata_VorbisComment_Entry*)malloc_or_die_(vorbiscomment_.data.vorbis_comment.num_comments * sizeof(::FLAC__StreamMetadata_VorbisComment_Entry)); vorbiscomment_.data.vorbis_comment.comments[0].length = 5; vorbiscomment_.data.vorbis_comment.comments[0].entry = (FLAC__byte*)malloc_or_die_(5); memcpy(vorbiscomment_.data.vorbis_comment.comments[0].entry, "ab=cd", 5); @@ -155,7 +155,7 @@ public: DecoderCommon(): file_(0), current_metadata_number_(0), ignore_errors_(false), error_occurred_(false) { } ::FLAC__StreamDecoderReadStatus common_read_callback_(FLAC__byte buffer[], unsigned *bytes); ::FLAC__StreamDecoderWriteStatus common_write_callback_(const ::FLAC__Frame *frame); - void common_metadata_callback_(const ::FLAC__StreamMetaData *metadata); + void common_metadata_callback_(const ::FLAC__StreamMetadata *metadata); void common_error_callback_(::FLAC__StreamDecoderErrorStatus status); }; @@ -199,7 +199,7 @@ public: return ::FLAC__STREAM_DECODER_WRITE_STATUS_CONTINUE; } -void DecoderCommon::common_metadata_callback_(const ::FLAC__StreamMetaData *metadata) +void DecoderCommon::common_metadata_callback_(const ::FLAC__StreamMetadata *metadata) { if(error_occurred_) return; @@ -236,7 +236,7 @@ public: // from FLAC::Decoder::Stream ::FLAC__StreamDecoderReadStatus read_callback(FLAC__byte buffer[], unsigned *bytes); ::FLAC__StreamDecoderWriteStatus write_callback(const ::FLAC__Frame *frame, const FLAC__int32 * const buffer[]); - void metadata_callback(const ::FLAC__StreamMetaData *metadata); + void metadata_callback(const ::FLAC__StreamMetadata *metadata); void error_callback(::FLAC__StreamDecoderErrorStatus status); bool die(const char *msg = 0) const; @@ -256,7 +256,7 @@ public: return common_write_callback_(frame); } -void StreamDecoder::metadata_callback(const ::FLAC__StreamMetaData *metadata) +void StreamDecoder::metadata_callback(const ::FLAC__StreamMetadata *metadata) { return common_metadata_callback_(metadata); } @@ -311,7 +311,7 @@ static bool test_stream_decoder() { StreamDecoder *decoder; - printf("\n+++ unit test: FLAC::Decoder::Stream\n\n"); + printf("\n+++ libFLAC++ unit test: FLAC::Decoder::Stream\n\n"); num_expected_ = 0; expected_metadata_sequence_[num_expected_++] = &streaminfo_; @@ -803,7 +803,7 @@ public: ::FLAC__SeekableStreamDecoderLengthStatus length_callback(FLAC__uint64 *stream_length); bool eof_callback(); ::FLAC__StreamDecoderWriteStatus write_callback(const ::FLAC__Frame *frame, const FLAC__int32 * const buffer[]); - void metadata_callback(const ::FLAC__StreamMetaData *metadata); + void metadata_callback(const ::FLAC__StreamMetadata *metadata); void error_callback(::FLAC__StreamDecoderErrorStatus status); bool die(const char *msg = 0) const; @@ -878,7 +878,7 @@ bool SeekableStreamDecoder::eof_callback() return common_write_callback_(frame); } -void SeekableStreamDecoder::metadata_callback(const ::FLAC__StreamMetaData *metadata) +void SeekableStreamDecoder::metadata_callback(const ::FLAC__StreamMetadata *metadata) { common_metadata_callback_(metadata); } @@ -938,7 +938,7 @@ static bool test_seekable_stream_decoder() { SeekableStreamDecoder *decoder; - printf("\n+++ unit test: FLAC::Decoder::SeekableStream\n\n"); + printf("\n+++ libFLAC++ unit test: FLAC::Decoder::SeekableStream\n\n"); num_expected_ = 0; expected_metadata_sequence_[num_expected_++] = &streaminfo_; @@ -1444,7 +1444,7 @@ public: // from FLAC::Decoder::File ::FLAC__StreamDecoderWriteStatus write_callback(const ::FLAC__Frame *frame, const FLAC__int32 * const buffer[]); - void metadata_callback(const ::FLAC__StreamMetaData *metadata); + void metadata_callback(const ::FLAC__StreamMetadata *metadata); void error_callback(::FLAC__StreamDecoderErrorStatus status); bool die(const char *msg = 0) const; @@ -1458,7 +1458,7 @@ public: return common_write_callback_(frame); } -void FileDecoder::metadata_callback(const ::FLAC__StreamMetaData *metadata) +void FileDecoder::metadata_callback(const ::FLAC__StreamMetadata *metadata) { common_metadata_callback_(metadata); } @@ -1518,7 +1518,7 @@ static bool test_file_decoder() { FileDecoder *decoder; - printf("\n+++ unit test: FLAC::Decoder::File\n\n"); + printf("\n+++ libFLAC++ unit test: FLAC::Decoder::File\n\n"); num_expected_ = 0; expected_metadata_sequence_[num_expected_++] = &streaminfo_; diff --git a/src/test_libFLAC++/encoders.cc b/src/test_libFLAC++/encoders.cc index 820a5f44..7b7dc345 100644 --- a/src/test_libFLAC++/encoders.cc +++ b/src/test_libFLAC++/encoders.cc @@ -26,8 +26,8 @@ extern "C" { #include <stdlib.h> #include <string.h> -static ::FLAC__StreamMetaData streaminfo_, padding_, seektable_, application1_, application2_, vorbiscomment_; -static ::FLAC__StreamMetaData *metadata_sequence_[] = { &padding_, &seektable_, &application1_, &application2_, &vorbiscomment_ }; +static ::FLAC__StreamMetadata streaminfo_, padding_, seektable_, application1_, application2_, vorbiscomment_; +static ::FLAC__StreamMetadata *metadata_sequence_[] = { &padding_, &seektable_, &application1_, &application2_, &vorbiscomment_ }; static const unsigned num_metadata_ = 5; static void *malloc_or_die_(size_t size) @@ -72,7 +72,7 @@ static void init_metadata_blocks_() seektable_.type = ::FLAC__METADATA_TYPE_SEEKTABLE; seektable_.data.seek_table.num_points = 2; seektable_.length = seektable_.data.seek_table.num_points * FLAC__STREAM_METADATA_SEEKPOINT_LENGTH; - seektable_.data.seek_table.points = (::FLAC__StreamMetaData_SeekPoint*)malloc_or_die_(seektable_.data.seek_table.num_points * sizeof(::FLAC__StreamMetaData_SeekPoint)); + seektable_.data.seek_table.points = (::FLAC__StreamMetadata_SeekPoint*)malloc_or_die_(seektable_.data.seek_table.num_points * sizeof(::FLAC__StreamMetadata_SeekPoint)); seektable_.data.seek_table.points[0].sample_number = 0; seektable_.data.seek_table.points[0].stream_offset = 0; seektable_.data.seek_table.points[0].frame_samples = streaminfo_.data.stream_info.min_blocksize; @@ -100,7 +100,7 @@ static void init_metadata_blocks_() vorbiscomment_.data.vorbis_comment.vendor_string.entry = (FLAC__byte*)malloc_or_die_(8); memcpy(vorbiscomment_.data.vorbis_comment.vendor_string.entry, "flac 1.x", 8); vorbiscomment_.data.vorbis_comment.num_comments = 2; - vorbiscomment_.data.vorbis_comment.comments = (::FLAC__StreamMetaData_VorbisComment_Entry*)malloc_or_die_(vorbiscomment_.data.vorbis_comment.num_comments * sizeof(::FLAC__StreamMetaData_VorbisComment_Entry)); + vorbiscomment_.data.vorbis_comment.comments = (::FLAC__StreamMetadata_VorbisComment_Entry*)malloc_or_die_(vorbiscomment_.data.vorbis_comment.num_comments * sizeof(::FLAC__StreamMetadata_VorbisComment_Entry)); vorbiscomment_.data.vorbis_comment.comments[0].length = 5; vorbiscomment_.data.vorbis_comment.comments[0].entry = (FLAC__byte*)malloc_or_die_(5); memcpy(vorbiscomment_.data.vorbis_comment.comments[0].entry, "ab=cd", 5); @@ -124,7 +124,7 @@ public: // from FLAC::Encoder::Stream ::FLAC__StreamEncoderWriteStatus write_callback(const FLAC__byte buffer[], unsigned bytes, unsigned samples, unsigned current_frame); - void metadata_callback(const ::FLAC__StreamMetaData *metadata); + void metadata_callback(const ::FLAC__StreamMetadata *metadata); bool die(const char *msg = 0) const; }; @@ -136,7 +136,7 @@ public: return ::FLAC__STREAM_ENCODER_WRITE_OK; } -void StreamEncoder::metadata_callback(const ::FLAC__StreamMetaData *metadata) +void StreamEncoder::metadata_callback(const ::FLAC__StreamMetadata *metadata) { (void)metadata; } @@ -160,7 +160,7 @@ static bool test_stream_encoder() FLAC__int32 *samples_array[1] = { samples }; unsigned i; - printf("\n+++ unit test: FLAC::Encoder::Stream\n\n"); + printf("\n+++ libFLAC++ unit test: FLAC::Encoder::Stream\n\n"); printf("allocating encoder instance... "); encoder = new StreamEncoder(); diff --git a/src/test_libFLAC++/file_utils.c b/src/test_libFLAC++/file_utils.c index 31f80639..e7fb6a9a 100644 --- a/src/test_libFLAC++/file_utils.c +++ b/src/test_libFLAC++/file_utils.c @@ -51,7 +51,7 @@ static FLAC__StreamEncoderWriteStatus encoder_write_callback_(const FLAC__Stream return FLAC__STREAM_ENCODER_WRITE_OK; } -static void encoder_metadata_callback_(const FLAC__StreamEncoder *encoder, const FLAC__StreamMetaData *metadata, void *client_data) +static void encoder_metadata_callback_(const FLAC__StreamEncoder *encoder, const FLAC__StreamMetadata *metadata, void *client_data) { (void)encoder, (void)metadata, (void)client_data; } @@ -92,7 +92,7 @@ FLAC__bool file_utils__remove_file(const char *filename) return file_utils__change_stats(filename, /*read_only=*/false) && 0 == unlink(filename); } -FLAC__bool file_utils__generate_flacfile(const char *output_filename, unsigned *output_filesize, unsigned length, const FLAC__StreamMetaData *streaminfo, FLAC__StreamMetaData **metadata, unsigned num_metadata) +FLAC__bool file_utils__generate_flacfile(const char *output_filename, unsigned *output_filesize, unsigned length, const FLAC__StreamMetadata *streaminfo, FLAC__StreamMetadata **metadata, unsigned num_metadata) { FLAC__int32 samples[1024]; FLAC__StreamEncoder *encoder; diff --git a/src/test_libFLAC++/file_utils.h b/src/test_libFLAC++/file_utils.h index 5944187c..851992ea 100644 --- a/src/test_libFLAC++/file_utils.h +++ b/src/test_libFLAC++/file_utils.h @@ -25,6 +25,6 @@ FLAC__bool file_utils__change_stats(const char *filename, FLAC__bool read_only); FLAC__bool file_utils__remove_file(const char *filename); -FLAC__bool file_utils__generate_flacfile(const char *output_filename, unsigned *output_filesize, unsigned length, const FLAC__StreamMetaData *streaminfo, FLAC__StreamMetaData **metadata, unsigned num_metadata); +FLAC__bool file_utils__generate_flacfile(const char *output_filename, unsigned *output_filesize, unsigned length, const FLAC__StreamMetadata *streaminfo, FLAC__StreamMetadata **metadata, unsigned num_metadata); #endif diff --git a/src/test_libFLAC++/main.cc b/src/test_libFLAC++/main.cc index a4db680f..c05adfcf 100644 --- a/src/test_libFLAC++/main.cc +++ b/src/test_libFLAC++/main.cc @@ -24,11 +24,13 @@ int main(int argc, char *argv[]) { (void)argc, (void)argv; +/*@@@@ if(!test_encoders()) return 1; if(!test_decoders()) return 1; +@@@@*/ if(!test_metadata()) return 1; diff --git a/src/test_libFLAC++/metadata_manip.cc b/src/test_libFLAC++/metadata_manip.cc index bf30290b..5130e1e3 100644 --- a/src/test_libFLAC++/metadata_manip.cc +++ b/src/test_libFLAC++/metadata_manip.cc @@ -20,8 +20,8 @@ extern "C" { #include "file_utils.h" } #include "FLAC/assert.h" -#include "FLAC/file_decoder.h" -#include "FLAC/metadata.h" +#include "FLAC++/decoder.h" +#include "FLAC++/metadata.h" #include <stdio.h> #include <stdlib.h> /* for malloc() */ #include <string.h> /* for memcpy()/memset() */ @@ -33,76 +33,85 @@ extern "C" { after each operation. Then testing becomes a simple matter of running a FLAC__FileDecoder over the dummy file after each operation, comparing the decoded metadata to what's in our local copy. If there are any - differences in the metadata, or the actual audio data is corrupted, we + differences in the metadata, or the actual audio data is corrupted, we will catch it while decoding. ******************************************************************************/ -typedef struct { - FLAC__bool error_occurred; -} decoder_client_struct; +class FileDecoder: public FLAC::Decoder::File { +public: + inline FileDecoder(bool ignore_metadata): ignore_metadata_(ignore_metadata), error_occurred_(false) { } -typedef struct { - FLAC__StreamMetaData *blocks[64]; + bool ignore_metadata_;; + bool error_occurred_; +protected: + ::FLAC__StreamDecoderWriteStatus write_callback(const ::FLAC__Frame *frame, const FLAC__int32 * const buffer[]); + void metadata_callback(const ::FLAC__StreamMetadata *metadata); + void error_callback(::FLAC__StreamDecoderErrorStatus status); +}; + +struct OurMetadata { + FLAC::Metadata::Prototype *blocks[64]; unsigned num_blocks; -} our_metadata_struct; +}; static const char *flacfile_ = "metadata.flac"; /* our copy of the metadata in flacfile_ */ -static our_metadata_struct our_metadata_; +static OurMetadata our_metadata_; /* the current block number that corresponds to the position of the iterator we are testing */ static unsigned mc_our_block_number_ = 0; -static FLAC__bool die_(const char *msg) +static bool die_(const char *msg) { printf("ERROR: %s\n", msg); return false; } -static FLAC__bool die_c_(const char *msg, FLAC__MetaData_ChainStatus status) +static bool die_c_(const char *msg, FLAC::Metadata::Chain::Status status) { printf("ERROR: %s\n", msg); - printf(" status=%s\n", FLAC__MetaData_ChainStatusString[status]); + printf(" status=%u (%s)\n", (unsigned)((::FLAC__Metadata_ChainStatus)status), status.as_cstring()); return false; } -static FLAC__bool die_ss_(const char *msg, FLAC__MetaData_SimpleIterator *siterator) +static bool die_ss_(const char *msg, FLAC::Metadata::SimpleIterator &iterator) { + const FLAC::Metadata::SimpleIterator::Status status = iterator.status(); printf("ERROR: %s\n", msg); - printf(" status=%s\n", FLAC__MetaData_SimpleIteratorStatusString[FLAC__metadata_simple_iterator_status(siterator)]); + printf(" status=%u (%s)\n", (unsigned)((::FLAC__Metadata_SimpleIteratorStatus)status), status.as_cstring()); return false; } /* functions for working with our metadata copy */ -static FLAC__bool replace_in_our_metadata_(FLAC__StreamMetaData *block, unsigned position, FLAC__bool copy) +static bool replace_in_our_metadata_(FLAC::Metadata::Prototype *block, unsigned position, bool copy) { unsigned i; - FLAC__StreamMetaData *obj = block; + FLAC::Metadata::Prototype *obj = block; FLAC__ASSERT(position < our_metadata_.num_blocks); if(copy) { - if(0 == (obj = FLAC__metadata_object_copy(block))) - return die_("during FLAC__metadata_object_copy()"); + if(0 == (obj = FLAC::Metadata::clone(block))) + return die_("during FLAC::Metadata::clone()"); } - FLAC__metadata_object_delete(our_metadata_.blocks[position]); + delete our_metadata_.blocks[position]; our_metadata_.blocks[position] = obj; /* set the is_last flags */ for(i = 0; i < our_metadata_.num_blocks - 1; i++) - our_metadata_.blocks[i]->is_last = false; - our_metadata_.blocks[i]->is_last = true; + our_metadata_.blocks[i]->set_is_last(false); + our_metadata_.blocks[i]->set_is_last(true); return true; } -static FLAC__bool insert_to_our_metadata_(FLAC__StreamMetaData *block, unsigned position, FLAC__bool copy) +static bool insert_to_our_metadata_(FLAC::Metadata::Prototype *block, unsigned position, bool copy) { unsigned i; - FLAC__StreamMetaData *obj = block; + FLAC::Metadata::Prototype *obj = block; if(copy) { - if(0 == (obj = FLAC__metadata_object_copy(block))) - return die_("during FLAC__metadata_object_copy()"); + if(0 == (obj = FLAC::Metadata::clone(block))) + return die_("during FLAC::Metadata::clone()"); } if(position > our_metadata_.num_blocks) { position = our_metadata_.num_blocks; @@ -116,8 +125,8 @@ static FLAC__bool insert_to_our_metadata_(FLAC__StreamMetaData *block, unsigned /* set the is_last flags */ for(i = 0; i < our_metadata_.num_blocks - 1; i++) - our_metadata_.blocks[i]->is_last = false; - our_metadata_.blocks[i]->is_last = true; + our_metadata_.blocks[i]->set_is_last(false); + our_metadata_.blocks[i]->set_is_last(true); return true; } @@ -126,7 +135,7 @@ static void delete_from_our_metadata_(unsigned position) { unsigned i; FLAC__ASSERT(position < our_metadata_.num_blocks); - FLAC__metadata_object_delete(our_metadata_.blocks[position]); + delete our_metadata_.blocks[position]; for(i = position; i < our_metadata_.num_blocks - 1; i++) our_metadata_.blocks[i] = our_metadata_.blocks[i+1]; our_metadata_.num_blocks--; @@ -134,53 +143,45 @@ static void delete_from_our_metadata_(unsigned position) /* set the is_last flags */ if(our_metadata_.num_blocks > 0) { for(i = 0; i < our_metadata_.num_blocks - 1; i++) - our_metadata_.blocks[i]->is_last = false; - our_metadata_.blocks[i]->is_last = true; + our_metadata_.blocks[i]->set_is_last(false); + our_metadata_.blocks[i]->set_is_last(true); } } -/* function for comparing our metadata to a FLAC__MetaData_Chain */ +/* function for comparing our metadata to a FLAC::Metadata::Chain */ -static FLAC__bool compare_chain_(FLAC__MetaData_Chain *chain, unsigned current_position, FLAC__StreamMetaData *current_block) +static bool compare_chain_(FLAC::Metadata::Chain *chain, unsigned current_position, FLAC::Metadata::Prototype *current_block) { unsigned i; - FLAC__MetaData_Iterator *iterator; - FLAC__StreamMetaData *block; - FLAC__bool next_ok = true; + FLAC::Metadata::Iterator iterator; + FLAC::Metadata::Prototype *block; + bool next_ok = true; FLAC__ASSERT(0 != chain); printf("\tcomparing chain... "); fflush(stdout); - if(0 == (iterator = FLAC__metadata_iterator_new())) + if(!iterator.is_valid()) return die_("allocating memory for iterator"); - FLAC__metadata_iterator_init(iterator, chain); + iterator.init(chain); i = 0; do { printf("%u... ", i); fflush(stdout); - if(0 == (block = FLAC__metadata_iterator_get_block(iterator))) { - FLAC__metadata_iterator_delete(iterator); + if(0 == (block = iterator.get_block())) return die_("getting block from iterator"); - } -#if 0 - if(!compare_block_(our_metadata_.blocks[i], block)) { - FLAC__metadata_iterator_delete(iterator); + if(*block != *our_metadata_.blocks[i]) return die_("metadata block mismatch"); - } -#endif i++; - next_ok = FLAC__metadata_iterator_next(iterator); + next_ok = iterator.next(); } while(i < our_metadata_.num_blocks && next_ok); - FLAC__metadata_iterator_delete(iterator); - if(next_ok) return die_("chain has more blocks than expected"); @@ -191,10 +192,8 @@ static FLAC__bool compare_chain_(FLAC__MetaData_Chain *chain, unsigned current_p printf("CURRENT_POSITION... "); fflush(stdout); -#if 0 - if(!compare_block_(our_metadata_.blocks[current_position], current_block)) + if(*current_block != *our_metadata_.blocks[current_position]) return die_("metadata block mismatch"); -#endif } printf("PASSED\n"); @@ -202,11 +201,9 @@ static FLAC__bool compare_chain_(FLAC__MetaData_Chain *chain, unsigned current_p return true; } -/* decoder callbacks for checking the file */ - -static FLAC__StreamDecoderWriteStatus decoder_write_callback_(const FLAC__FileDecoder *decoder, const FLAC__Frame *frame, const FLAC__int32 * const buffer[], void *client_data) +::FLAC__StreamDecoderWriteStatus FileDecoder::write_callback(const ::FLAC__Frame *frame, const FLAC__int32 * const buffer[]) { - (void)decoder, (void)buffer, (void)client_data; + (void)buffer; if( (frame->header.number_type == FLAC__FRAME_NUMBER_TYPE_FRAME_NUMBER && frame->header.number.frame_number == 0) || @@ -216,62 +213,45 @@ static FLAC__StreamDecoderWriteStatus decoder_write_callback_(const FLAC__FileDe fflush(stdout); } - return FLAC__STREAM_DECODER_WRITE_STATUS_CONTINUE; -} - -static void decoder_error_callback_(const FLAC__FileDecoder *decoder, FLAC__StreamDecoderErrorStatus status, void *client_data) -{ - decoder_client_struct *dcd = (decoder_client_struct*)client_data; - (void)decoder; - - dcd->error_occurred = true; - printf("ERROR: got error callback, status = %s (%u)\n", FLAC__StreamDecoderErrorStatusString[status], (unsigned)status); -} - -/* this version pays no attention to the metadata */ -static void decoder_metadata_callback_null_(const FLAC__FileDecoder *decoder, const FLAC__StreamMetaData *metadata, void *client_data) -{ - (void)decoder, (void)metadata, (void)client_data; - - printf("%d... ", mc_our_block_number_); - fflush(stdout); - - mc_our_block_number_++; + return ::FLAC__STREAM_DECODER_WRITE_STATUS_CONTINUE; } -/* this version is used when we want to compare to our metadata copy */ -static void decoder_metadata_callback_compare_(const FLAC__FileDecoder *decoder, const FLAC__StreamMetaData *metadata, void *client_data) +void FileDecoder::metadata_callback(const ::FLAC__StreamMetadata *metadata) { - decoder_client_struct *dcd = (decoder_client_struct*)client_data; - - (void)decoder; - /* don't bother checking if we've already hit an error */ - if(dcd->error_occurred) + if(error_occurred_) return; printf("%d... ", mc_our_block_number_); fflush(stdout); - if(mc_our_block_number_ >= our_metadata_.num_blocks) { - (void)die_("got more metadata blocks than expected"); - dcd->error_occurred = true; - } - else { -#if 0 - if(!compare_block_(our_metadata_.blocks[mc_our_block_number_], metadata)) { - (void)die_("metadata block mismatch"); - dcd->error_occurred = true; + if(!ignore_metadata_) { + if(mc_our_block_number_ >= our_metadata_.num_blocks) { + (void)die_("got more metadata blocks than expected"); + error_occurred_ = true; + } + else { + if(*our_metadata_.blocks[mc_our_block_number_] != metadata) { + //@@@@if(!::FLAC__metadata_object_is_equal(our_metadata_.blocks[mc_our_block_number_], metadata)) { + (void)die_("metadata block mismatch"); + error_occurred_ = true; + } } -#endif } + mc_our_block_number_++; } -static FLAC__bool generate_file_() +void FileDecoder::error_callback(::FLAC__StreamDecoderErrorStatus status) +{ + error_occurred_ = true; + printf("ERROR: got error callback, status = %s (%u)\n", FLAC__StreamDecoderErrorStatusString[status], (unsigned)status); +} + +static bool generate_file_() { - FLAC__StreamMetaData streaminfo, padding; - FLAC__StreamMetaData *metadata[1]; + ::FLAC__StreamMetadata streaminfo, padding; + ::FLAC__StreamMetadata *metadata[1]; printf("generating FLAC file for test\n"); @@ -279,7 +259,7 @@ static FLAC__bool generate_file_() delete_from_our_metadata_(0); streaminfo.is_last = false; - streaminfo.type = FLAC__METADATA_TYPE_STREAMINFO; + streaminfo.type = ::FLAC__METADATA_TYPE_STREAMINFO; streaminfo.length = FLAC__STREAM_METADATA_STREAMINFO_LENGTH; streaminfo.data.stream_info.min_blocksize = 576; streaminfo.data.stream_info.max_blocksize = 576; @@ -292,12 +272,14 @@ static FLAC__bool generate_file_() memset(streaminfo.data.stream_info.md5sum, 0, 16); padding.is_last = true; - padding.type = FLAC__METADATA_TYPE_PADDING; + padding.type = ::FLAC__METADATA_TYPE_PADDING; padding.length = 1234; metadata[0] = &padding; - if(!insert_to_our_metadata_(&streaminfo, 0, /*copy=*/true) || !insert_to_our_metadata_(&padding, 1, /*copy=*/true)) + FLAC::Metadata::StreamInfo s(&streaminfo, /*copy=*/false); + FLAC::Metadata::Padding p(&padding, /*copy=*/false); + if(!insert_to_our_metadata_(&s, 0, /*copy=*/true) || !insert_to_our_metadata_(&p, 1, /*copy=*/true)) return die_("priming our metadata"); if(!file_utils__generate_flacfile(flacfile_, 0, 512 * 1024, &streaminfo, metadata, 1)) @@ -306,45 +288,36 @@ static FLAC__bool generate_file_() return true; } -static FLAC__bool test_file_(const char *filename, void (*metadata_callback)(const FLAC__FileDecoder *decoder, const FLAC__StreamMetaData *metadata, void *client_data)) +static bool test_file_(const char *filename, bool ignore_metadata) { - FLAC__FileDecoder *decoder; - decoder_client_struct decoder_client_data; + FileDecoder decoder(ignore_metadata); FLAC__ASSERT(0 != filename); - FLAC__ASSERT(0 != metadata_callback); mc_our_block_number_ = 0; - decoder_client_data.error_occurred = false; + decoder.error_occurred_ = false; printf("\ttesting '%s'... ", filename); fflush(stdout); - if(0 == (decoder = FLAC__file_decoder_new())) - return die_("couldn't allocate memory"); - - FLAC__file_decoder_set_md5_checking(decoder, true); - FLAC__file_decoder_set_filename(decoder, filename); - FLAC__file_decoder_set_write_callback(decoder, decoder_write_callback_); - FLAC__file_decoder_set_metadata_callback(decoder, metadata_callback); - FLAC__file_decoder_set_error_callback(decoder, decoder_error_callback_); - FLAC__file_decoder_set_client_data(decoder, &decoder_client_data); - FLAC__file_decoder_set_metadata_respond_all(decoder); - if(FLAC__file_decoder_init(decoder) != FLAC__FILE_DECODER_OK) { - FLAC__file_decoder_finish(decoder); - FLAC__file_decoder_delete(decoder); + if(!decoder.is_valid()) + return die_("couldn't allocate decoder instance"); + + decoder.set_md5_checking(true); + decoder.set_filename(filename); + decoder.set_metadata_respond_all(); + if(decoder.init() != ::FLAC__FILE_DECODER_OK) { + decoder.finish(); return die_("initializing decoder\n"); } - if(!FLAC__file_decoder_process_whole_file(decoder)) { - FLAC__file_decoder_finish(decoder); - FLAC__file_decoder_delete(decoder); + if(!decoder.process_whole_file()) { + decoder.finish(); return die_("decoding file\n"); } - FLAC__file_decoder_finish(decoder); - FLAC__file_decoder_delete(decoder); + decoder.finish(); - if(decoder_client_data.error_occurred) + if(decoder.error_occurred_) return false; if(mc_our_block_number_ != our_metadata_.num_blocks) @@ -354,7 +327,7 @@ static FLAC__bool test_file_(const char *filename, void (*metadata_callback)(con return true; } -static FLAC__bool change_stats_(const char *filename, FLAC__bool read_only) +static bool change_stats_(const char *filename, bool read_only) { if(!file_utils__change_stats(filename, read_only)) return die_("during file_utils__change_stats()"); @@ -362,7 +335,7 @@ static FLAC__bool change_stats_(const char *filename, FLAC__bool read_only) return true; } -static FLAC__bool remove_file_(const char *filename) +static bool remove_file_(const char *filename) { while(our_metadata_.num_blocks > 0) delete_from_our_metadata_(0); @@ -373,32 +346,32 @@ static FLAC__bool remove_file_(const char *filename) return true; } -static FLAC__bool test_level_0_() +static bool test_level_0_() { - FLAC__StreamMetaData_StreamInfo streaminfo; + FLAC::Metadata::StreamInfo streaminfo; printf("\n\n++++++ testing level 0 interface\n"); if(!generate_file_()) return false; - if(!test_file_(flacfile_, decoder_metadata_callback_null_)) + if(!test_file_(flacfile_, /*ignore_metadata=*/true)) return false; - if(!FLAC__metadata_get_streaminfo(flacfile_, &streaminfo)) - return die_("during FLAC__metadata_get_streaminfo()"); + if(!FLAC::Metadata::get_streaminfo(flacfile_, streaminfo)) + return die_("during FLAC::Metadata::get_streaminfo()"); /* check to see if some basic data matches (c.f. generate_file_()) */ - if(streaminfo.channels != 1) - return die_("mismatch in streaminfo.channels"); - if(streaminfo.bits_per_sample != 8) - return die_("mismatch in streaminfo.bits_per_sample"); - if(streaminfo.sample_rate != 44100) - return die_("mismatch in streaminfo.sample_rate"); - if(streaminfo.min_blocksize != 576) - return die_("mismatch in streaminfo.min_blocksize"); - if(streaminfo.max_blocksize != 576) - return die_("mismatch in streaminfo.max_blocksize"); + if(streaminfo.get_channels() != 1) + return die_("mismatch in streaminfo.get_channels()"); + if(streaminfo.get_bits_per_sample() != 8) + return die_("mismatch in streaminfo.get_bits_per_sample()"); + if(streaminfo.get_sample_rate() != 44100) + return die_("mismatch in streaminfo.get_sample_rate()"); + if(streaminfo.get_min_blocksize() != 576) + return die_("mismatch in streaminfo.get_min_blocksize()"); + if(streaminfo.get_max_blocksize() != 576) + return die_("mismatch in streaminfo.get_max_blocksize()"); if(!remove_file_(flacfile_)) return false; @@ -406,17 +379,19 @@ static FLAC__bool test_level_0_() return true; } -static FLAC__bool test_level_1_() +static bool test_level_1_() { - FLAC__MetaData_SimpleIterator *siterator; - FLAC__StreamMetaData *block, *app, *padding; + FLAC::Metadata::Prototype *block; + FLAC::Metadata::StreamInfo *streaminfo; + FLAC::Metadata::Padding *padding; + FLAC::Metadata::Application *app; FLAC__byte data[1000]; unsigned our_current_position = 0; printf("\n\n++++++ testing level 1 interface\n"); /************************************************************/ - + { printf("simple iterator on read-only file\n"); if(!generate_file_()) @@ -425,79 +400,82 @@ static FLAC__bool test_level_1_() if(!change_stats_(flacfile_, /*read_only=*/true)) return false; - if(!test_file_(flacfile_, decoder_metadata_callback_null_)) + if(!test_file_(flacfile_, /*ignore_metadata=*/true)) return false; - if(0 == (siterator = FLAC__metadata_simple_iterator_new())) - return die_("FLAC__metadata_simple_iterator_new()"); + FLAC::Metadata::SimpleIterator iterator; + + if(!iterator.is_valid()) + return die_("iterator.is_valid() returned false"); - if(!FLAC__metadata_simple_iterator_init(siterator, flacfile_, false)) - return die_("ERROR: FLAC__metadata_simple_iterator_init()\n"); + if(!iterator.init(flacfile_, false)) + return die_("iterator.init() returned false"); - printf("is writable = %u\n", (unsigned)FLAC__metadata_simple_iterator_is_writable(siterator)); - if(FLAC__metadata_simple_iterator_is_writable(siterator)) + printf("is writable = %u\n", (unsigned)iterator.is_writable()); + if(iterator.is_writable()) return die_("iterator claims file is writable when it should not be\n"); printf("iterate forwards\n"); - if(FLAC__metadata_simple_iterator_get_block_type(siterator) != FLAC__METADATA_TYPE_STREAMINFO) - return die_("expected STREAMINFO type from FLAC__metadata_simple_iterator_get_block_type()"); - if(0 == (block = FLAC__metadata_simple_iterator_get_block(siterator))) + if(iterator.get_block_type() != ::FLAC__METADATA_TYPE_STREAMINFO) + return die_("expected STREAMINFO type from iterator.get_block_type()"); + if(0 == (block = iterator.get_block())) return die_("getting block 0"); - if(block->type != FLAC__METADATA_TYPE_STREAMINFO) + if(block->get_type() != ::FLAC__METADATA_TYPE_STREAMINFO) return die_("expected STREAMINFO type"); - if(block->is_last) + if(block->get_is_last()) return die_("expected is_last to be false"); - if(block->length != FLAC__STREAM_METADATA_STREAMINFO_LENGTH) + if(block->get_length() != FLAC__STREAM_METADATA_STREAMINFO_LENGTH) return die_("bad STREAMINFO length"); /* check to see if some basic data matches (c.f. generate_file_()) */ - if(block->data.stream_info.channels != 1) + streaminfo = dynamic_cast<FLAC::Metadata::StreamInfo *>(block); + FLAC__ASSERT(0 != streaminfo); + if(streaminfo->get_channels() != 1) return die_("mismatch in channels"); - if(block->data.stream_info.bits_per_sample != 8) + if(streaminfo->get_bits_per_sample() != 8) return die_("mismatch in bits_per_sample"); - if(block->data.stream_info.sample_rate != 44100) + if(streaminfo->get_sample_rate() != 44100) return die_("mismatch in sample_rate"); - if(block->data.stream_info.min_blocksize != 576) + if(streaminfo->get_min_blocksize() != 576) return die_("mismatch in min_blocksize"); - if(block->data.stream_info.max_blocksize != 576) + if(streaminfo->get_max_blocksize() != 576) return die_("mismatch in max_blocksize"); - if(!FLAC__metadata_simple_iterator_next(siterator)) + if(!iterator.next()) return die_("forward iterator ended early"); our_current_position++; - if(FLAC__metadata_simple_iterator_get_block_type(siterator) != FLAC__METADATA_TYPE_PADDING) - return die_("expected PADDING type from FLAC__metadata_simple_iterator_get_block_type()"); - if(0 == (block = FLAC__metadata_simple_iterator_get_block(siterator))) + if(iterator.get_block_type() != ::FLAC__METADATA_TYPE_PADDING) + return die_("expected PADDING type from iterator.get_block_type()"); + if(0 == (block = iterator.get_block())) return die_("getting block 1"); - if(block->type != FLAC__METADATA_TYPE_PADDING) + if(block->get_type() != ::FLAC__METADATA_TYPE_PADDING) return die_("expected PADDING type"); - if(!block->is_last) + if(!block->get_is_last()) return die_("expected is_last to be true"); /* check to see if some basic data matches (c.f. generate_file_()) */ - if(block->length != 1234) - return die_("bad STREAMINFO length"); + if(block->get_length() != 1234) + return die_("bad PADDING length"); - if(FLAC__metadata_simple_iterator_next(siterator)) + if(iterator.next()) return die_("forward iterator returned true but should have returned false"); printf("iterate backwards\n"); - if(!FLAC__metadata_simple_iterator_prev(siterator)) + if(!iterator.prev()) return die_("reverse iterator ended early"); - if(FLAC__metadata_simple_iterator_prev(siterator)) + if(iterator.prev()) return die_("reverse iterator returned true but should have returned false"); - printf("testing FLAC__metadata_simple_iterator_set_block() on read-only file...\n"); + printf("testing iterator.set_block() on read-only file...\n"); - if(!FLAC__metadata_simple_iterator_set_block(siterator, (::FLAC__StreamMetaData*)99, false)) - printf("PASSED. FLAC__metadata_simple_iterator_set_block() returned false like it should\n"); + if(!iterator.set_block(streaminfo, false)) + printf("PASSED. iterator.set_block() returned false like it should\n"); else - return die_("FLAC__metadata_simple_iterator_set_block() returned true but shouldn't have"); - - FLAC__metadata_simple_iterator_delete(siterator); + return die_("iterator.set_block() returned true but shouldn't have"); + } /************************************************************/ - + { printf("simple iterator on writable file\n"); if(!change_stats_(flacfile_, /*read-only=*/false)) @@ -505,213 +483,217 @@ static FLAC__bool test_level_1_() printf("creating APPLICATION block\n"); - if(0 == (app = FLAC__metadata_object_new(FLAC__METADATA_TYPE_APPLICATION))) - return die_("FLAC__metadata_object_new(FLAC__METADATA_TYPE_APPLICATION)"); - memcpy(app->data.application.id, "duh", (FLAC__STREAM_METADATA_APPLICATION_ID_LEN/8)); + if(0 == (app = new FLAC::Metadata::Application())) + return die_("new FLAC::Metadata::Application()"); + app->set_id((const unsigned char *)"duh"); printf("creating PADDING block\n"); - if(0 == (padding = FLAC__metadata_object_new(FLAC__METADATA_TYPE_PADDING))) - return die_("FLAC__metadata_object_new(FLAC__METADATA_TYPE_PADDING)"); - padding->length = 20; + if(0 == (padding = new FLAC::Metadata::Padding())) + return die_("new FLAC::Metadata::Padding()"); + padding->set_length(20); - if(0 == (siterator = FLAC__metadata_simple_iterator_new())) - return die_("FLAC__metadata_simple_iterator_new()"); + FLAC::Metadata::SimpleIterator iterator; - if(!FLAC__metadata_simple_iterator_init(siterator, flacfile_, /*preserve_file_stats=*/false)) - return die_("ERROR: FLAC__metadata_simple_iterator_init()\n"); + if(!iterator.is_valid()) + return die_("iterator.is_valid() returned false"); + + if(!iterator.init(flacfile_, /*preserve_file_stats=*/false)) + return die_("iterator.init() returned false"); our_current_position = 0; - printf("is writable = %u\n", (unsigned)FLAC__metadata_simple_iterator_is_writable(siterator)); + printf("is writable = %u\n", (unsigned)iterator.is_writable()); printf("[S]P\ttry to write over STREAMINFO block...\n"); - if(!FLAC__metadata_simple_iterator_set_block(siterator, app, false)) - printf("\tFLAC__metadata_simple_iterator_set_block() returned false like it should\n"); + if(!iterator.set_block(app, false)) + printf("\titerator.set_block() returned false like it should\n"); else - return die_("FLAC__metadata_simple_iterator_set_block() returned true but shouldn't have"); + return die_("iterator.set_block() returned true but shouldn't have"); printf("[S]P\tnext\n"); - if(!FLAC__metadata_simple_iterator_next(siterator)) + if(!iterator.next()) return die_("iterator ended early\n"); our_current_position++; printf("S[P]\tinsert PADDING after, don't expand into padding\n"); - padding->length = 25; - if(!FLAC__metadata_simple_iterator_insert_block_after(siterator, padding, false)) - return die_ss_("FLAC__metadata_simple_iterator_insert_block_after(siterator, padding, false)", siterator); + padding->set_length(25); + if(!iterator.insert_block_after(padding, false)) + return die_ss_("iterator.insert_block_after(padding, false)", iterator); if(!insert_to_our_metadata_(padding, ++our_current_position, /*copy=*/true)) return false; printf("SP[P]\tprev\n"); - if(!FLAC__metadata_simple_iterator_prev(siterator)) + if(!iterator.prev()) return die_("iterator ended early\n"); our_current_position--; printf("S[P]P\tprev\n"); - if(!FLAC__metadata_simple_iterator_prev(siterator)) + if(!iterator.prev()) return die_("iterator ended early\n"); our_current_position--; printf("[S]PP\tinsert PADDING after, don't expand into padding\n"); - padding->length = 30; - if(!FLAC__metadata_simple_iterator_insert_block_after(siterator, padding, false)) - return die_ss_("FLAC__metadata_simple_iterator_insert_block_after(siterator, padding, false)", siterator); + padding->set_length(30); + if(!iterator.insert_block_after(padding, false)) + return die_ss_("iterator.insert_block_after(padding, false)", iterator); if(!insert_to_our_metadata_(padding, ++our_current_position, /*copy=*/true)) return false; - if(!test_file_(flacfile_, decoder_metadata_callback_compare_)) + if(!test_file_(flacfile_, /*ignore_metadata=*/false)) return false; printf("S[P]PP\tprev\n"); - if(!FLAC__metadata_simple_iterator_prev(siterator)) + if(!iterator.prev()) return die_("iterator ended early\n"); our_current_position--; printf("[S]PPP\tdelete (STREAMINFO block), must fail\n"); - if(FLAC__metadata_simple_iterator_delete_block(siterator, false)) - return die_ss_("FLAC__metadata_simple_iterator_delete_block(siterator, false) should have returned false", siterator); + if(iterator.delete_block(false)) + return die_ss_("iterator.delete_block(false) should have returned false", iterator); - if(!test_file_(flacfile_, decoder_metadata_callback_compare_)) + if(!test_file_(flacfile_, /*ignore_metadata=*/false)) return false; printf("[S]PPP\tnext\n"); - if(!FLAC__metadata_simple_iterator_next(siterator)) + if(!iterator.next()) return die_("iterator ended early\n"); our_current_position++; printf("S[P]PP\tdelete (middle block), replace with padding\n"); - if(!FLAC__metadata_simple_iterator_delete_block(siterator, true)) - return die_ss_("FLAC__metadata_simple_iterator_delete_block(siterator, true)", siterator); + if(!iterator.delete_block(true)) + return die_ss_("iterator.delete_block(true)", iterator); our_current_position--; printf("[S]PPP\tnext\n"); - if(!FLAC__metadata_simple_iterator_next(siterator)) + if(!iterator.next()) return die_("iterator ended early\n"); our_current_position++; printf("S[P]PP\tdelete (middle block), don't replace with padding\n"); - if(!FLAC__metadata_simple_iterator_delete_block(siterator, false)) - return die_ss_("FLAC__metadata_simple_iterator_delete_block(siterator, false)", siterator); + if(!iterator.delete_block(false)) + return die_ss_("iterator.delete_block(false)", iterator); delete_from_our_metadata_(our_current_position--); - if(!test_file_(flacfile_, decoder_metadata_callback_compare_)) + if(!test_file_(flacfile_, /*ignore_metadata=*/false)) return false; printf("[S]PP\tnext\n"); - if(!FLAC__metadata_simple_iterator_next(siterator)) + if(!iterator.next()) return die_("iterator ended early\n"); our_current_position++; printf("S[P]P\tnext\n"); - if(!FLAC__metadata_simple_iterator_next(siterator)) + if(!iterator.next()) return die_("iterator ended early\n"); our_current_position++; printf("SP[P]\tdelete (last block), replace with padding\n"); - if(!FLAC__metadata_simple_iterator_delete_block(siterator, true)) - return die_ss_("FLAC__metadata_simple_iterator_delete_block(siterator, false)", siterator); + if(!iterator.delete_block(true)) + return die_ss_("iterator.delete_block(false)", iterator); our_current_position--; - if(!test_file_(flacfile_, decoder_metadata_callback_compare_)) + if(!test_file_(flacfile_, /*ignore_metadata=*/false)) return false; printf("S[P]P\tnext\n"); - if(!FLAC__metadata_simple_iterator_next(siterator)) + if(!iterator.next()) return die_("iterator ended early\n"); our_current_position++; printf("SP[P]\tdelete (last block), don't replace with padding\n"); - if(!FLAC__metadata_simple_iterator_delete_block(siterator, false)) - return die_ss_("FLAC__metadata_simple_iterator_delete_block(siterator, false)", siterator); + if(!iterator.delete_block(false)) + return die_ss_("iterator.delete_block(false)", iterator); delete_from_our_metadata_(our_current_position--); - if(!test_file_(flacfile_, decoder_metadata_callback_compare_)) + if(!test_file_(flacfile_, /*ignore_metadata=*/false)) return false; printf("S[P]\tprev\n"); - if(!FLAC__metadata_simple_iterator_prev(siterator)) + if(!iterator.prev()) return die_("iterator ended early\n"); our_current_position--; printf("[S]P\tset STREAMINFO (change sample rate)\n"); FLAC__ASSERT(our_current_position == 0); - block = FLAC__metadata_simple_iterator_get_block(siterator); - block->data.stream_info.sample_rate = 32000; + block = iterator.get_block(); + streaminfo = dynamic_cast<FLAC::Metadata::StreamInfo *>(block); + FLAC__ASSERT(0 != streaminfo); + streaminfo->set_sample_rate(32000); if(!replace_in_our_metadata_(block, our_current_position, /*copy=*/true)) return die_("copying object"); - if(!FLAC__metadata_simple_iterator_set_block(siterator, block, false)) - return die_ss_("FLAC__metadata_simple_iterator_set_block(siterator, block, false)", siterator); - FLAC__metadata_object_delete(block); + if(!iterator.set_block(block, false)) + return die_ss_("iterator.set_block(block, false)", iterator); + delete block; - if(!test_file_(flacfile_, decoder_metadata_callback_compare_)) + if(!test_file_(flacfile_, /*ignore_metadata=*/false)) return false; printf("[S]P\tinsert APPLICATION after, expand into padding of exceeding size\n"); - app->data.application.id[0] = 'e'; /* twiddle the id so that our comparison doesn't miss transposition */ - if(!FLAC__metadata_simple_iterator_insert_block_after(siterator, app, true)) - return die_ss_("FLAC__metadata_simple_iterator_insert_block_after(siterator, app, true)", siterator); + app->set_id((const unsigned char *)"euh"); /* twiddle the id so that our comparison doesn't miss transposition */ + if(!iterator.insert_block_after(app, true)) + return die_ss_("iterator.insert_block_after(app, true)", iterator); if(!insert_to_our_metadata_(app, ++our_current_position, /*copy=*/true)) return false; - our_metadata_.blocks[our_current_position+1]->length -= (FLAC__STREAM_METADATA_APPLICATION_ID_LEN/8) + app->length; + our_metadata_.blocks[our_current_position+1]->set_length() = our_metadata_.blocks[our_current_position+1]->get_length() - (FLAC__STREAM_METADATA_APPLICATION_ID_LEN/8) + app->length; - if(!test_file_(flacfile_, decoder_metadata_callback_compare_)) + if(!test_file_(flacfile_, /*ignore_metadata=*/false)) return false; printf("S[A]P\tnext\n"); - if(!FLAC__metadata_simple_iterator_next(siterator)) + if(!iterator.next()) return die_("iterator ended early\n"); our_current_position++; printf("SA[P]\tset APPLICATION, expand into padding of exceeding size\n"); - app->data.application.id[0] = 'f'; /* twiddle the id */ - if(!FLAC__metadata_simple_iterator_set_block(siterator, app, true)) - return die_ss_("FLAC__metadata_simple_iterator_set_block(siterator, app, true)", siterator); + app->set_id((const unsigned char *)"fuh"); /* twiddle the id */ + if(!iterator.set_block(app, true)) + return die_ss_("iterator.set_block(app, true)", iterator); if(!insert_to_our_metadata_(app, our_current_position, /*copy=*/true)) return false; our_metadata_.blocks[our_current_position+1]->length -= (FLAC__STREAM_METADATA_APPLICATION_ID_LEN/8) + app->length; - if(!test_file_(flacfile_, decoder_metadata_callback_compare_)) + if(!test_file_(flacfile_, /*ignore_metadata=*/false)) return false; printf("SA[A]P\tset APPLICATION (grow), don't expand into padding\n"); - app->data.application.id[0] = 'g'; /* twiddle the id */ + app->set_id((const unsigned char *)"guh"); /* twiddle the id */ if(!FLAC__metadata_object_application_set_data(app, data, sizeof(data), true)) return die_("setting APPLICATION data"); if(!replace_in_our_metadata_(app, our_current_position, /*copy=*/true)) return die_("copying object"); - if(!FLAC__metadata_simple_iterator_set_block(siterator, app, false)) - return die_ss_("FLAC__metadata_simple_iterator_set_block(siterator, app, false)", siterator); + if(!iterator.set_block(app, false)) + return die_ss_("iterator.set_block(app, false)", iterator); - if(!test_file_(flacfile_, decoder_metadata_callback_compare_)) + if(!test_file_(flacfile_, /*ignore_metadata=*/false)) return false; printf("SA[A]P\tset APPLICATION (shrink), don't fill in with padding\n"); - app->data.application.id[0] = 'h'; /* twiddle the id */ + app->set_id((const unsigned char *)"huh"); /* twiddle the id */ if(!FLAC__metadata_object_application_set_data(app, data, 12, true)) return die_("setting APPLICATION data"); if(!replace_in_our_metadata_(app, our_current_position, /*copy=*/true)) return die_("copying object"); - if(!FLAC__metadata_simple_iterator_set_block(siterator, app, false)) - return die_ss_("FLAC__metadata_simple_iterator_set_block(siterator, app, false)", siterator); + if(!iterator.set_block(app, false)) + return die_ss_("iterator.set_block(app, false)", iterator); - if(!test_file_(flacfile_, decoder_metadata_callback_compare_)) + if(!test_file_(flacfile_, /*ignore_metadata=*/false)) return false; printf("SA[A]P\tset APPLICATION (grow), expand into padding of exceeding size\n"); - app->data.application.id[0] = 'i'; /* twiddle the id */ + app->set_id((const unsigned char *)"iuh"); /* twiddle the id */ if(!FLAC__metadata_object_application_set_data(app, data, sizeof(data), true)) return die_("setting APPLICATION data"); if(!replace_in_our_metadata_(app, our_current_position, /*copy=*/true)) return die_("copying object"); our_metadata_.blocks[our_current_position+1]->length -= (sizeof(data) - 12); - if(!FLAC__metadata_simple_iterator_set_block(siterator, app, true)) - return die_ss_("FLAC__metadata_simple_iterator_set_block(siterator, app, true)", siterator); + if(!iterator.set_block(app, true)) + return die_ss_("iterator.set_block(app, true)", iterator); - if(!test_file_(flacfile_, decoder_metadata_callback_compare_)) + if(!test_file_(flacfile_, /*ignore_metadata=*/false)) return false; printf("SA[A]P\tset APPLICATION (shrink), fill in with padding\n"); - app->data.application.id[0] = 'j'; /* twiddle the id */ + app->set_id((const unsigned char *)"juh"); /* twiddle the id */ if(!FLAC__metadata_object_application_set_data(app, data, 23, true)) return die_("setting APPLICATION data"); if(!replace_in_our_metadata_(app, our_current_position, /*copy=*/true)) @@ -719,19 +701,19 @@ static FLAC__bool test_level_1_() if(!insert_to_our_metadata_(padding, our_current_position+1, /*copy=*/true)) return die_("copying object"); our_metadata_.blocks[our_current_position+1]->length = sizeof(data) - 23 - FLAC__STREAM_METADATA_HEADER_LENGTH; - if(!FLAC__metadata_simple_iterator_set_block(siterator, app, true)) - return die_ss_("FLAC__metadata_simple_iterator_set_block(siterator, app, true)", siterator); + if(!iterator.set_block(app, true)) + return die_ss_("iterator.set_block(app, true)", iterator); - if(!test_file_(flacfile_, decoder_metadata_callback_compare_)) + if(!test_file_(flacfile_, /*ignore_metadata=*/false)) return false; printf("SA[A]PP\tnext\n"); - if(!FLAC__metadata_simple_iterator_next(siterator)) + if(!iterator.next()) return die_("iterator ended early\n"); our_current_position++; printf("SAA[P]P\tnext\n"); - if(!FLAC__metadata_simple_iterator_next(siterator)) + if(!iterator.next()) return die_("iterator ended early\n"); our_current_position++; @@ -739,75 +721,75 @@ static FLAC__bool test_level_1_() padding->length = 5; if(!replace_in_our_metadata_(padding, our_current_position, /*copy=*/true)) return die_("copying object"); - if(!FLAC__metadata_simple_iterator_set_block(siterator, padding, false)) - return die_ss_("FLAC__metadata_simple_iterator_set_block(siterator, padding, false)", siterator); + if(!iterator.set_block(padding, false)) + return die_ss_("iterator.set_block(padding, false)", iterator); - if(!test_file_(flacfile_, decoder_metadata_callback_compare_)) + if(!test_file_(flacfile_, /*ignore_metadata=*/false)) return false; printf("SAAP[P]\tset APPLICATION (grow)\n"); - app->data.application.id[0] = 'k'; /* twiddle the id */ + app->set_id((const unsigned char *)"kuh"); /* twiddle the id */ if(!replace_in_our_metadata_(app, our_current_position, /*copy=*/true)) return die_("copying object"); - if(!FLAC__metadata_simple_iterator_set_block(siterator, app, false)) - return die_ss_("FLAC__metadata_simple_iterator_set_block(siterator, app, false)", siterator); + if(!iterator.set_block(app, false)) + return die_ss_("iterator.set_block(app, false)", iterator); - if(!test_file_(flacfile_, decoder_metadata_callback_compare_)) + if(!test_file_(flacfile_, /*ignore_metadata=*/false)) return false; printf("SAAP[A]\tset PADDING (equal)\n"); padding->length = 27; if(!replace_in_our_metadata_(padding, our_current_position, /*copy=*/true)) return die_("copying object"); - if(!FLAC__metadata_simple_iterator_set_block(siterator, padding, false)) - return die_ss_("FLAC__metadata_simple_iterator_set_block(siterator, padding, false)", siterator); + if(!iterator.set_block(padding, false)) + return die_ss_("iterator.set_block(padding, false)", iterator); - if(!test_file_(flacfile_, decoder_metadata_callback_compare_)) + if(!test_file_(flacfile_, /*ignore_metadata=*/false)) return false; printf("SAAP[P]\tprev\n"); - if(!FLAC__metadata_simple_iterator_prev(siterator)) + if(!iterator.prev()) return die_("iterator ended early\n"); our_current_position--; printf("SAA[P]P\tdelete (middle block), don't replace with padding\n"); - if(!FLAC__metadata_simple_iterator_delete_block(siterator, false)) - return die_ss_("FLAC__metadata_simple_iterator_delete_block(siterator, false)", siterator); + if(!iterator.delete_block(false)) + return die_ss_("iterator.delete_block(false)", iterator); delete_from_our_metadata_(our_current_position--); - if(!test_file_(flacfile_, decoder_metadata_callback_compare_)) + if(!test_file_(flacfile_, /*ignore_metadata=*/false)) return false; printf("SA[A]P\tdelete (middle block), don't replace with padding\n"); - if(!FLAC__metadata_simple_iterator_delete_block(siterator, false)) - return die_ss_("FLAC__metadata_simple_iterator_delete_block(siterator, false)", siterator); + if(!iterator.delete_block(false)) + return die_ss_("iterator.delete_block(false)", iterator); delete_from_our_metadata_(our_current_position--); - if(!test_file_(flacfile_, decoder_metadata_callback_compare_)) + if(!test_file_(flacfile_, /*ignore_metadata=*/false)) return false; printf("S[A]P\tnext\n"); - if(!FLAC__metadata_simple_iterator_next(siterator)) + if(!iterator.next()) return die_("iterator ended early\n"); our_current_position++; printf("SA[P]\tinsert PADDING after\n"); padding->length = 5; - if(!FLAC__metadata_simple_iterator_insert_block_after(siterator, padding, false)) - return die_ss_("FLAC__metadata_simple_iterator_insert_block_after(siterator, padding, false)", siterator); + if(!iterator.insert_block_after(padding, false)) + return die_ss_("iterator.insert_block_after(padding, false)", iterator); if(!insert_to_our_metadata_(padding, ++our_current_position, /*copy=*/true)) return false; - if(!test_file_(flacfile_, decoder_metadata_callback_compare_)) + if(!test_file_(flacfile_, /*ignore_metadata=*/false)) return false; printf("SAP[P]\tprev\n"); - if(!FLAC__metadata_simple_iterator_prev(siterator)) + if(!iterator.prev()) return die_("iterator ended early\n"); our_current_position--; printf("SA[P]P\tprev\n"); - if(!FLAC__metadata_simple_iterator_prev(siterator)) + if(!iterator.prev()) return die_("iterator ended early\n"); our_current_position--; @@ -816,10 +798,10 @@ static FLAC__bool test_level_1_() return die_("setting APPLICATION data"); if(!replace_in_our_metadata_(app, our_current_position, /*copy=*/true)) return die_("copying object"); - if(!FLAC__metadata_simple_iterator_set_block(siterator, app, true)) - return die_ss_("FLAC__metadata_simple_iterator_set_block(siterator, app, true)", siterator); + if(!iterator.set_block(app, true)) + return die_ss_("iterator.set_block(app, true)", iterator); - if(!test_file_(flacfile_, decoder_metadata_callback_compare_)) + if(!test_file_(flacfile_, /*ignore_metadata=*/false)) return false; printf("S[A]PP\tset APPLICATION (grow), try to expand into padding which is 'close' but still too small\n"); @@ -827,10 +809,10 @@ static FLAC__bool test_level_1_() return die_("setting APPLICATION data"); if(!replace_in_our_metadata_(app, our_current_position, /*copy=*/true)) return die_("copying object"); - if(!FLAC__metadata_simple_iterator_set_block(siterator, app, true)) - return die_ss_("FLAC__metadata_simple_iterator_set_block(siterator, app, true)", siterator); + if(!iterator.set_block(app, true)) + return die_ss_("iterator.set_block(app, true)", iterator); - if(!test_file_(flacfile_, decoder_metadata_callback_compare_)) + if(!test_file_(flacfile_, /*ignore_metadata=*/false)) return false; printf("S[A]PP\tset APPLICATION (grow), expand into padding which will leave 0-length pad\n"); @@ -839,10 +821,10 @@ static FLAC__bool test_level_1_() if(!replace_in_our_metadata_(app, our_current_position, /*copy=*/true)) return die_("copying object"); our_metadata_.blocks[our_current_position+1]->length = 0; - if(!FLAC__metadata_simple_iterator_set_block(siterator, app, true)) - return die_ss_("FLAC__metadata_simple_iterator_set_block(siterator, app, true)", siterator); + if(!iterator.set_block(app, true)) + return die_ss_("iterator.set_block(app, true)", iterator); - if(!test_file_(flacfile_, decoder_metadata_callback_compare_)) + if(!test_file_(flacfile_, /*ignore_metadata=*/false)) return false; printf("S[A]PP\tset APPLICATION (grow), expand into padding which is exactly consumed\n"); @@ -851,10 +833,10 @@ static FLAC__bool test_level_1_() if(!replace_in_our_metadata_(app, our_current_position, /*copy=*/true)) return die_("copying object"); delete_from_our_metadata_(our_current_position+1); - if(!FLAC__metadata_simple_iterator_set_block(siterator, app, true)) - return die_ss_("FLAC__metadata_simple_iterator_set_block(siterator, app, true)", siterator); + if(!iterator.set_block(app, true)) + return die_ss_("iterator.set_block(app, true)", iterator); - if(!test_file_(flacfile_, decoder_metadata_callback_compare_)) + if(!test_file_(flacfile_, /*ignore_metadata=*/false)) return false; printf("S[A]P\tset APPLICATION (grow), expand into padding which is exactly consumed\n"); @@ -864,53 +846,53 @@ static FLAC__bool test_level_1_() return die_("copying object"); delete_from_our_metadata_(our_current_position+1); our_metadata_.blocks[our_current_position]->is_last = true; - if(!FLAC__metadata_simple_iterator_set_block(siterator, app, true)) - return die_ss_("FLAC__metadata_simple_iterator_set_block(siterator, app, true)", siterator); + if(!iterator.set_block(app, true)) + return die_ss_("iterator.set_block(app, true)", iterator); - if(!test_file_(flacfile_, decoder_metadata_callback_compare_)) + if(!test_file_(flacfile_, /*ignore_metadata=*/false)) return false; printf("S[A]\tset PADDING (equal size)\n"); padding->length = app->length; if(!replace_in_our_metadata_(padding, our_current_position, /*copy=*/true)) return die_("copying object"); - if(!FLAC__metadata_simple_iterator_set_block(siterator, padding, true)) - return die_ss_("FLAC__metadata_simple_iterator_set_block(siterator, padding, true)", siterator); + if(!iterator.set_block(padding, true)) + return die_ss_("iterator.set_block(padding, true)", iterator); - if(!test_file_(flacfile_, decoder_metadata_callback_compare_)) + if(!test_file_(flacfile_, /*ignore_metadata=*/false)) return false; printf("S[P]\tinsert PADDING after\n"); - if(!FLAC__metadata_simple_iterator_insert_block_after(siterator, padding, false)) - return die_ss_("FLAC__metadata_simple_iterator_insert_block_after(siterator, padding, false)", siterator); + if(!iterator.insert_block_after(padding, false)) + return die_ss_("iterator.insert_block_after(padding, false)", iterator); if(!insert_to_our_metadata_(padding, ++our_current_position, /*copy=*/true)) return false; - if(!test_file_(flacfile_, decoder_metadata_callback_compare_)) + if(!test_file_(flacfile_, /*ignore_metadata=*/false)) return false; printf("SP[P]\tinsert PADDING after\n"); padding->length = 5; - if(!FLAC__metadata_simple_iterator_insert_block_after(siterator, padding, false)) - return die_ss_("FLAC__metadata_simple_iterator_insert_block_after(siterator, padding, false)", siterator); + if(!iterator.insert_block_after(padding, false)) + return die_ss_("iterator.insert_block_after(padding, false)", iterator); if(!insert_to_our_metadata_(padding, ++our_current_position, /*copy=*/true)) return false; - if(!test_file_(flacfile_, decoder_metadata_callback_compare_)) + if(!test_file_(flacfile_, /*ignore_metadata=*/false)) return false; printf("SPP[P]\tprev\n"); - if(!FLAC__metadata_simple_iterator_prev(siterator)) + if(!iterator.prev()) return die_("iterator ended early\n"); our_current_position--; printf("SP[P]P\tprev\n"); - if(!FLAC__metadata_simple_iterator_prev(siterator)) + if(!iterator.prev()) return die_("iterator ended early\n"); our_current_position--; printf("S[P]PP\tprev\n"); - if(!FLAC__metadata_simple_iterator_prev(siterator)) + if(!iterator.prev()) return die_("iterator ended early\n"); our_current_position--; @@ -919,18 +901,18 @@ static FLAC__bool test_level_1_() return die_("setting APPLICATION data"); if(!insert_to_our_metadata_(app, ++our_current_position, /*copy=*/true)) return die_("copying object"); - if(!FLAC__metadata_simple_iterator_insert_block_after(siterator, app, true)) - return die_ss_("FLAC__metadata_simple_iterator_insert_block_after(siterator, app, true)", siterator); + if(!iterator.insert_block_after(app, true)) + return die_ss_("iterator.insert_block_after(app, true)", iterator); - if(!test_file_(flacfile_, decoder_metadata_callback_compare_)) + if(!test_file_(flacfile_, /*ignore_metadata=*/false)) return false; printf("S[A]PPP\tdelete (middle block), don't replace with padding\n"); - if(!FLAC__metadata_simple_iterator_delete_block(siterator, false)) - return die_ss_("FLAC__metadata_simple_iterator_delete_block(siterator, false)", siterator); + if(!iterator.delete_block(false)) + return die_ss_("iterator.delete_block(false)", iterator); delete_from_our_metadata_(our_current_position--); - if(!test_file_(flacfile_, decoder_metadata_callback_compare_)) + if(!test_file_(flacfile_, /*ignore_metadata=*/false)) return false; printf("[S]PPP\tinsert APPLICATION after, try to expand into padding which is 'close' but still too small\n"); @@ -938,18 +920,18 @@ static FLAC__bool test_level_1_() return die_("setting APPLICATION data"); if(!insert_to_our_metadata_(app, ++our_current_position, /*copy=*/true)) return die_("copying object"); - if(!FLAC__metadata_simple_iterator_insert_block_after(siterator, app, true)) - return die_ss_("FLAC__metadata_simple_iterator_insert_block_after(siterator, app, true)", siterator); + if(!iterator.insert_block_after(app, true)) + return die_ss_("iterator.insert_block_after(app, true)", iterator); - if(!test_file_(flacfile_, decoder_metadata_callback_compare_)) + if(!test_file_(flacfile_, /*ignore_metadata=*/false)) return false; printf("S[A]PPP\tdelete (middle block), don't replace with padding\n"); - if(!FLAC__metadata_simple_iterator_delete_block(siterator, false)) - return die_ss_("FLAC__metadata_simple_iterator_delete_block(siterator, false)", siterator); + if(!iterator.delete_block(false)) + return die_ss_("iterator.delete_block(false)", iterator); delete_from_our_metadata_(our_current_position--); - if(!test_file_(flacfile_, decoder_metadata_callback_compare_)) + if(!test_file_(flacfile_, /*ignore_metadata=*/false)) return false; printf("[S]PPP\tinsert APPLICATION after, expand into padding which is exactly consumed\n"); @@ -958,18 +940,18 @@ static FLAC__bool test_level_1_() if(!insert_to_our_metadata_(app, ++our_current_position, /*copy=*/true)) return die_("copying object"); delete_from_our_metadata_(our_current_position+1); - if(!FLAC__metadata_simple_iterator_insert_block_after(siterator, app, true)) - return die_ss_("FLAC__metadata_simple_iterator_insert_block_after(siterator, app, true)", siterator); + if(!iterator.insert_block_after(app, true)) + return die_ss_("iterator.insert_block_after(app, true)", iterator); - if(!test_file_(flacfile_, decoder_metadata_callback_compare_)) + if(!test_file_(flacfile_, /*ignore_metadata=*/false)) return false; printf("S[A]PP\tdelete (middle block), don't replace with padding\n"); - if(!FLAC__metadata_simple_iterator_delete_block(siterator, false)) - return die_ss_("FLAC__metadata_simple_iterator_delete_block(siterator, false)", siterator); + if(!iterator.delete_block(false)) + return die_ss_("iterator.delete_block(false)", iterator); delete_from_our_metadata_(our_current_position--); - if(!test_file_(flacfile_, decoder_metadata_callback_compare_)) + if(!test_file_(flacfile_, /*ignore_metadata=*/false)) return false; printf("[S]PP\tinsert APPLICATION after, expand into padding which will leave 0-length pad\n"); @@ -978,31 +960,31 @@ static FLAC__bool test_level_1_() if(!insert_to_our_metadata_(app, ++our_current_position, /*copy=*/true)) return die_("copying object"); our_metadata_.blocks[our_current_position+1]->length = 0; - if(!FLAC__metadata_simple_iterator_insert_block_after(siterator, app, true)) - return die_ss_("FLAC__metadata_simple_iterator_insert_block_after(siterator, app, true)", siterator); + if(!iterator.insert_block_after(app, true)) + return die_ss_("iterator.insert_block_after(app, true)", iterator); - if(!test_file_(flacfile_, decoder_metadata_callback_compare_)) + if(!test_file_(flacfile_, /*ignore_metadata=*/false)) return false; printf("S[A]PP\tdelete (middle block), don't replace with padding\n"); - if(!FLAC__metadata_simple_iterator_delete_block(siterator, false)) - return die_ss_("FLAC__metadata_simple_iterator_delete_block(siterator, false)", siterator); + if(!iterator.delete_block(false)) + return die_ss_("iterator.delete_block(false)", iterator); delete_from_our_metadata_(our_current_position--); - if(!test_file_(flacfile_, decoder_metadata_callback_compare_)) + if(!test_file_(flacfile_, /*ignore_metadata=*/false)) return false; printf("[S]PP\tnext\n"); - if(!FLAC__metadata_simple_iterator_next(siterator)) + if(!iterator.next()) return die_("iterator ended early\n"); our_current_position++; printf("S[P]P\tdelete (middle block), don't replace with padding\n"); - if(!FLAC__metadata_simple_iterator_delete_block(siterator, false)) - return die_ss_("FLAC__metadata_simple_iterator_delete_block(siterator, false)", siterator); + if(!iterator.delete_block(false)) + return die_ss_("iterator.delete_block(false)", iterator); delete_from_our_metadata_(our_current_position--); - if(!test_file_(flacfile_, decoder_metadata_callback_compare_)) + if(!test_file_(flacfile_, /*ignore_metadata=*/false)) return false; printf("[S]P\tinsert APPLICATION after, expand into padding which is exactly consumed\n"); @@ -1011,15 +993,16 @@ static FLAC__bool test_level_1_() if(!insert_to_our_metadata_(app, ++our_current_position, /*copy=*/true)) return die_("copying object"); delete_from_our_metadata_(our_current_position+1); - if(!FLAC__metadata_simple_iterator_insert_block_after(siterator, app, true)) - return die_ss_("FLAC__metadata_simple_iterator_insert_block_after(siterator, app, true)", siterator); + if(!iterator.insert_block_after(app, true)) + return die_ss_("iterator.insert_block_after(app, true)", iterator); - if(!test_file_(flacfile_, decoder_metadata_callback_compare_)) + if(!test_file_(flacfile_, /*ignore_metadata=*/false)) return false; printf("delete simple iterator\n"); - FLAC__metadata_simple_iterator_delete(siterator); + iterator.delete(); + } FLAC__metadata_object_delete(app); FLAC__metadata_object_delete(padding); @@ -1030,11 +1013,11 @@ static FLAC__bool test_level_1_() return true; } -static FLAC__bool test_level_2_() +static bool test_level_2_() { - FLAC__MetaData_Iterator *iterator; - FLAC__MetaData_Chain *chain; - FLAC__StreamMetaData *block, *app, *padding; + FLAC__Metadata_Iterator *iterator; + FLAC__Metadata_Chain *chain; + FLAC__StreamMetadata *block, *app, *padding; FLAC__byte data[2000]; unsigned our_current_position; @@ -1050,19 +1033,19 @@ static FLAC__bool test_level_2_() printf("create chain\n"); - if(0 == (chain = FLAC__metadata_chain_new())) + if(0 == (chain = chain.new())) return die_("allocating chain"); printf("read chain\n"); - if(!FLAC__metadata_chain_read(chain, flacfile_)) - return die_c_("reading chain", FLAC__metadata_chain_status(chain)); + if(!chain.read(chain, flacfile_)) + return die_c_("reading chain", chain.status(chain)); printf("[S]P\ttest initial metadata\n"); if(!compare_chain_(chain, 0, 0)) return false; - if(!test_file_(flacfile_, decoder_metadata_callback_compare_)) + if(!test_file_(flacfile_, /*ignore_metadata=*/false)) return false; printf("switch file to read-write\n"); @@ -1071,14 +1054,14 @@ static FLAC__bool test_level_2_() return false; printf("create iterator\n"); - if(0 == (iterator = FLAC__metadata_iterator_new())) + if(0 == (iterator = iterator.new())) return die_("allocating memory for iterator"); our_current_position = 0; - FLAC__metadata_iterator_init(iterator, chain); + iterator.init(chain); - if(0 == (block = FLAC__metadata_iterator_get_block(iterator))) + if(0 == (block = iterator.get_block())) return die_("getting block from iterator"); FLAC__ASSERT(block->type == FLAC__METADATA_TYPE_STREAMINFO); @@ -1089,20 +1072,20 @@ static FLAC__bool test_level_2_() if(!replace_in_our_metadata_(block, our_current_position, /*copy=*/true)) return die_("copying object"); - if(!FLAC__metadata_chain_write(chain, /*use_padding=*/false, /*preserve_file_stats=*/true)) - return die_c_("during FLAC__metadata_chain_write(chain, false, true)", FLAC__metadata_chain_status(chain)); - if(!compare_chain_(chain, our_current_position, FLAC__metadata_iterator_get_block(iterator))) + if(!chain.write(chain, /*use_padding=*/false, /*preserve_file_stats=*/true)) + return die_c_("during chain.write(chain, false, true)", chain.status(chain)); + if(!compare_chain_(chain, our_current_position, iterator.get_block())) return false; - if(!test_file_(flacfile_, decoder_metadata_callback_compare_)) + if(!test_file_(flacfile_, /*ignore_metadata=*/false)) return false; printf("[S]P\tnext\n"); - if(!FLAC__metadata_iterator_next(iterator)) + if(!iterator.next()) return die_("iterator ended early\n"); our_current_position++; printf("S[P]\treplace PADDING with identical-size APPLICATION\n"); - if(0 == (block = FLAC__metadata_iterator_get_block(iterator))) + if(0 == (block = iterator.get_block())) return die_("getting block from iterator"); if(0 == (app = FLAC__metadata_object_new(FLAC__METADATA_TYPE_APPLICATION))) return die_("FLAC__metadata_object_new(FLAC__METADATA_TYPE_APPLICATION)"); @@ -1111,88 +1094,88 @@ static FLAC__bool test_level_2_() return die_("setting APPLICATION data"); if(!replace_in_our_metadata_(app, our_current_position, /*copy=*/true)) return die_("copying object"); - if(!FLAC__metadata_iterator_set_block(iterator, app)) - return die_c_("FLAC__metadata_iterator_set_block(iterator, app)", FLAC__metadata_chain_status(chain)); + if(!iterator.set_block(app)) + return die_c_("iterator.set_block(app)", chain.status(chain)); - if(!FLAC__metadata_chain_write(chain, /*use_padding=*/false, /*preserve_file_stats=*/false)) - return die_c_("during FLAC__metadata_chain_write(chain, false, false)", FLAC__metadata_chain_status(chain)); - if(!compare_chain_(chain, our_current_position, FLAC__metadata_iterator_get_block(iterator))) + if(!chain.write(chain, /*use_padding=*/false, /*preserve_file_stats=*/false)) + return die_c_("during chain.write(chain, false, false)", chain.status(chain)); + if(!compare_chain_(chain, our_current_position, iterator.get_block())) return false; - if(!test_file_(flacfile_, decoder_metadata_callback_compare_)) + if(!test_file_(flacfile_, /*ignore_metadata=*/false)) return false; printf("S[A]\tshrink APPLICATION, don't use padding\n"); - if(0 == (app = FLAC__metadata_object_copy(our_metadata_.blocks[our_current_position]))) + if(0 == (app = FLAC__metadata_object_clone(our_metadata_.blocks[our_current_position]))) return die_("copying object"); if(!FLAC__metadata_object_application_set_data(app, data, 26, true)) return die_("setting APPLICATION data"); if(!replace_in_our_metadata_(app, our_current_position, /*copy=*/true)) return die_("copying object"); - if(!FLAC__metadata_iterator_set_block(iterator, app)) - return die_c_("FLAC__metadata_iterator_set_block(iterator, app)", FLAC__metadata_chain_status(chain)); + if(!iterator.set_block(app)) + return die_c_("iterator.set_block(app)", chain.status(chain)); - if(!FLAC__metadata_chain_write(chain, /*use_padding=*/false, /*preserve_file_stats=*/false)) - return die_c_("during FLAC__metadata_chain_write(chain, false, false)", FLAC__metadata_chain_status(chain)); - if(!compare_chain_(chain, our_current_position, FLAC__metadata_iterator_get_block(iterator))) + if(!chain.write(chain, /*use_padding=*/false, /*preserve_file_stats=*/false)) + return die_c_("during chain.write(chain, false, false)", chain.status(chain)); + if(!compare_chain_(chain, our_current_position, iterator.get_block())) return false; - if(!test_file_(flacfile_, decoder_metadata_callback_compare_)) + if(!test_file_(flacfile_, /*ignore_metadata=*/false)) return false; printf("S[A]\tgrow APPLICATION, don't use padding\n"); - if(0 == (app = FLAC__metadata_object_copy(our_metadata_.blocks[our_current_position]))) + if(0 == (app = FLAC__metadata_object_clone(our_metadata_.blocks[our_current_position]))) return die_("copying object"); if(!FLAC__metadata_object_application_set_data(app, data, 28, true)) return die_("setting APPLICATION data"); if(!replace_in_our_metadata_(app, our_current_position, /*copy=*/true)) return die_("copying object"); - if(!FLAC__metadata_iterator_set_block(iterator, app)) - return die_c_("FLAC__metadata_iterator_set_block(iterator, app)", FLAC__metadata_chain_status(chain)); + if(!iterator.set_block(app)) + return die_c_("iterator.set_block(app)", chain.status(chain)); - if(!FLAC__metadata_chain_write(chain, /*use_padding=*/false, /*preserve_file_stats=*/false)) - return die_c_("during FLAC__metadata_chain_write(chain, false, false)", FLAC__metadata_chain_status(chain)); - if(!compare_chain_(chain, our_current_position, FLAC__metadata_iterator_get_block(iterator))) + if(!chain.write(chain, /*use_padding=*/false, /*preserve_file_stats=*/false)) + return die_c_("during chain.write(chain, false, false)", chain.status(chain)); + if(!compare_chain_(chain, our_current_position, iterator.get_block())) return false; - if(!test_file_(flacfile_, decoder_metadata_callback_compare_)) + if(!test_file_(flacfile_, /*ignore_metadata=*/false)) return false; printf("S[A]\tgrow APPLICATION, use padding, but last block is not padding\n"); - if(0 == (app = FLAC__metadata_object_copy(our_metadata_.blocks[our_current_position]))) + if(0 == (app = FLAC__metadata_object_clone(our_metadata_.blocks[our_current_position]))) return die_("copying object"); if(!FLAC__metadata_object_application_set_data(app, data, 36, true)) return die_("setting APPLICATION data"); if(!replace_in_our_metadata_(app, our_current_position, /*copy=*/true)) return die_("copying object"); - if(!FLAC__metadata_iterator_set_block(iterator, app)) - return die_c_("FLAC__metadata_iterator_set_block(iterator, app)", FLAC__metadata_chain_status(chain)); + if(!iterator.set_block(app)) + return die_c_("iterator.set_block(app)", chain.status(chain)); - if(!FLAC__metadata_chain_write(chain, /*use_padding=*/false, /*preserve_file_stats=*/false)) - return die_c_("during FLAC__metadata_chain_write(chain, false, false)", FLAC__metadata_chain_status(chain)); - if(!compare_chain_(chain, our_current_position, FLAC__metadata_iterator_get_block(iterator))) + if(!chain.write(chain, /*use_padding=*/false, /*preserve_file_stats=*/false)) + return die_c_("during chain.write(chain, false, false)", chain.status(chain)); + if(!compare_chain_(chain, our_current_position, iterator.get_block())) return false; - if(!test_file_(flacfile_, decoder_metadata_callback_compare_)) + if(!test_file_(flacfile_, /*ignore_metadata=*/false)) return false; printf("S[A]\tshrink APPLICATION, use padding, last block is not padding, but delta is too small for new PADDING block\n"); - if(0 == (app = FLAC__metadata_object_copy(our_metadata_.blocks[our_current_position]))) + if(0 == (app = FLAC__metadata_object_clone(our_metadata_.blocks[our_current_position]))) return die_("copying object"); if(!FLAC__metadata_object_application_set_data(app, data, 33, true)) return die_("setting APPLICATION data"); if(!replace_in_our_metadata_(app, our_current_position, /*copy=*/true)) return die_("copying object"); - if(!FLAC__metadata_iterator_set_block(iterator, app)) - return die_c_("FLAC__metadata_iterator_set_block(iterator, app)", FLAC__metadata_chain_status(chain)); + if(!iterator.set_block(app)) + return die_c_("iterator.set_block(app)", chain.status(chain)); - if(!FLAC__metadata_chain_write(chain, /*use_padding=*/true, /*preserve_file_stats=*/false)) - return die_c_("during FLAC__metadata_chain_write(chain, true, false)", FLAC__metadata_chain_status(chain)); - if(!compare_chain_(chain, our_current_position, FLAC__metadata_iterator_get_block(iterator))) + if(!chain.write(chain, /*use_padding=*/true, /*preserve_file_stats=*/false)) + return die_c_("during chain.write(chain, true, false)", chain.status(chain)); + if(!compare_chain_(chain, our_current_position, iterator.get_block())) return false; - if(!test_file_(flacfile_, decoder_metadata_callback_compare_)) + if(!test_file_(flacfile_, /*ignore_metadata=*/false)) return false; printf("S[A]\tshrink APPLICATION, use padding, last block is not padding, delta is enough for new PADDING block\n"); if(0 == (padding = FLAC__metadata_object_new(FLAC__METADATA_TYPE_PADDING))) return die_("creating PADDING block"); - if(0 == (app = FLAC__metadata_object_copy(our_metadata_.blocks[our_current_position]))) + if(0 == (app = FLAC__metadata_object_clone(our_metadata_.blocks[our_current_position]))) return die_("copying object"); if(!FLAC__metadata_object_application_set_data(app, data, 29, true)) return die_("setting APPLICATION data"); @@ -1201,89 +1184,89 @@ static FLAC__bool test_level_2_() padding->length = 0; if(!insert_to_our_metadata_(padding, our_current_position+1, /*copy=*/false)) return die_("internal error"); - if(!FLAC__metadata_iterator_set_block(iterator, app)) - return die_c_("FLAC__metadata_iterator_set_block(iterator, app)", FLAC__metadata_chain_status(chain)); + if(!iterator.set_block(app)) + return die_c_("iterator.set_block(app)", chain.status(chain)); - if(!FLAC__metadata_chain_write(chain, /*use_padding=*/true, /*preserve_file_stats=*/false)) - return die_c_("during FLAC__metadata_chain_write(chain, true, false)", FLAC__metadata_chain_status(chain)); - if(!compare_chain_(chain, our_current_position, FLAC__metadata_iterator_get_block(iterator))) + if(!chain.write(chain, /*use_padding=*/true, /*preserve_file_stats=*/false)) + return die_c_("during chain.write(chain, true, false)", chain.status(chain)); + if(!compare_chain_(chain, our_current_position, iterator.get_block())) return false; - if(!test_file_(flacfile_, decoder_metadata_callback_compare_)) + if(!test_file_(flacfile_, /*ignore_metadata=*/false)) return false; printf("S[A]P\tshrink APPLICATION, use padding, last block is padding\n"); - if(0 == (app = FLAC__metadata_object_copy(our_metadata_.blocks[our_current_position]))) + if(0 == (app = FLAC__metadata_object_clone(our_metadata_.blocks[our_current_position]))) return die_("copying object"); if(!FLAC__metadata_object_application_set_data(app, data, 16, true)) return die_("setting APPLICATION data"); if(!replace_in_our_metadata_(app, our_current_position, /*copy=*/true)) return die_("copying object"); our_metadata_.blocks[our_current_position+1]->length = 13; - if(!FLAC__metadata_iterator_set_block(iterator, app)) - return die_c_("FLAC__metadata_iterator_set_block(iterator, app)", FLAC__metadata_chain_status(chain)); + if(!iterator.set_block(app)) + return die_c_("iterator.set_block(app)", chain.status(chain)); - if(!FLAC__metadata_chain_write(chain, /*use_padding=*/true, /*preserve_file_stats=*/false)) - return die_c_("during FLAC__metadata_chain_write(chain, true, false)", FLAC__metadata_chain_status(chain)); - if(!compare_chain_(chain, our_current_position, FLAC__metadata_iterator_get_block(iterator))) + if(!chain.write(chain, /*use_padding=*/true, /*preserve_file_stats=*/false)) + return die_c_("during chain.write(chain, true, false)", chain.status(chain)); + if(!compare_chain_(chain, our_current_position, iterator.get_block())) return false; - if(!test_file_(flacfile_, decoder_metadata_callback_compare_)) + if(!test_file_(flacfile_, /*ignore_metadata=*/false)) return false; printf("S[A]P\tgrow APPLICATION, use padding, last block is padding, but delta is too small\n"); - if(0 == (app = FLAC__metadata_object_copy(our_metadata_.blocks[our_current_position]))) + if(0 == (app = FLAC__metadata_object_clone(our_metadata_.blocks[our_current_position]))) return die_("copying object"); if(!FLAC__metadata_object_application_set_data(app, data, 50, true)) return die_("setting APPLICATION data"); if(!replace_in_our_metadata_(app, our_current_position, /*copy=*/true)) return die_("copying object"); - if(!FLAC__metadata_iterator_set_block(iterator, app)) - return die_c_("FLAC__metadata_iterator_set_block(iterator, app)", FLAC__metadata_chain_status(chain)); + if(!iterator.set_block(app)) + return die_c_("iterator.set_block(app)", chain.status(chain)); - if(!FLAC__metadata_chain_write(chain, /*use_padding=*/true, /*preserve_file_stats=*/false)) - return die_c_("during FLAC__metadata_chain_write(chain, true, false)", FLAC__metadata_chain_status(chain)); - if(!compare_chain_(chain, our_current_position, FLAC__metadata_iterator_get_block(iterator))) + if(!chain.write(chain, /*use_padding=*/true, /*preserve_file_stats=*/false)) + return die_c_("during chain.write(chain, true, false)", chain.status(chain)); + if(!compare_chain_(chain, our_current_position, iterator.get_block())) return false; - if(!test_file_(flacfile_, decoder_metadata_callback_compare_)) + if(!test_file_(flacfile_, /*ignore_metadata=*/false)) return false; printf("S[A]P\tgrow APPLICATION, use padding, last block is padding of exceeding size\n"); - if(0 == (app = FLAC__metadata_object_copy(our_metadata_.blocks[our_current_position]))) + if(0 == (app = FLAC__metadata_object_clone(our_metadata_.blocks[our_current_position]))) return die_("copying object"); if(!FLAC__metadata_object_application_set_data(app, data, 56, true)) return die_("setting APPLICATION data"); if(!replace_in_our_metadata_(app, our_current_position, /*copy=*/true)) return die_("copying object"); our_metadata_.blocks[our_current_position+1]->length -= (56 - 50); - if(!FLAC__metadata_iterator_set_block(iterator, app)) - return die_c_("FLAC__metadata_iterator_set_block(iterator, app)", FLAC__metadata_chain_status(chain)); + if(!iterator.set_block(app)) + return die_c_("iterator.set_block(app)", chain.status(chain)); - if(!FLAC__metadata_chain_write(chain, /*use_padding=*/true, /*preserve_file_stats=*/false)) - return die_c_("during FLAC__metadata_chain_write(chain, true, false)", FLAC__metadata_chain_status(chain)); - if(!compare_chain_(chain, our_current_position, FLAC__metadata_iterator_get_block(iterator))) + if(!chain.write(chain, /*use_padding=*/true, /*preserve_file_stats=*/false)) + return die_c_("during chain.write(chain, true, false)", chain.status(chain)); + if(!compare_chain_(chain, our_current_position, iterator.get_block())) return false; - if(!test_file_(flacfile_, decoder_metadata_callback_compare_)) + if(!test_file_(flacfile_, /*ignore_metadata=*/false)) return false; printf("S[A]P\tgrow APPLICATION, use padding, last block is padding of exact size\n"); - if(0 == (app = FLAC__metadata_object_copy(our_metadata_.blocks[our_current_position]))) + if(0 == (app = FLAC__metadata_object_clone(our_metadata_.blocks[our_current_position]))) return die_("copying object"); if(!FLAC__metadata_object_application_set_data(app, data, 67, true)) return die_("setting APPLICATION data"); if(!replace_in_our_metadata_(app, our_current_position, /*copy=*/true)) return die_("copying object"); delete_from_our_metadata_(our_current_position+1); - if(!FLAC__metadata_iterator_set_block(iterator, app)) - return die_c_("FLAC__metadata_iterator_set_block(iterator, app)", FLAC__metadata_chain_status(chain)); + if(!iterator.set_block(app)) + return die_c_("iterator.set_block(app)", chain.status(chain)); - if(!FLAC__metadata_chain_write(chain, /*use_padding=*/true, /*preserve_file_stats=*/false)) - return die_c_("during FLAC__metadata_chain_write(chain, true, false)", FLAC__metadata_chain_status(chain)); - if(!compare_chain_(chain, our_current_position, FLAC__metadata_iterator_get_block(iterator))) + if(!chain.write(chain, /*use_padding=*/true, /*preserve_file_stats=*/false)) + return die_c_("during chain.write(chain, true, false)", chain.status(chain)); + if(!compare_chain_(chain, our_current_position, iterator.get_block())) return false; - if(!test_file_(flacfile_, decoder_metadata_callback_compare_)) + if(!test_file_(flacfile_, /*ignore_metadata=*/false)) return false; printf("S[A]\tprev\n"); - if(!FLAC__metadata_iterator_prev(iterator)) + if(!iterator.prev()) return die_("iterator ended early\n"); our_current_position--; @@ -1291,89 +1274,89 @@ static FLAC__bool test_level_2_() if(0 == (padding = FLAC__metadata_object_new(FLAC__METADATA_TYPE_PADDING))) return die_("creating PADDING block"); padding->length = 30; - if(!FLAC__metadata_iterator_insert_block_before(iterator, padding)) - printf("\tFLAC__metadata_iterator_insert_block_before() returned false like it should\n"); + if(!iterator.insert_block_before(padding)) + printf("\titerator.insert_block_before() returned false like it should\n"); else - return die_("FLAC__metadata_iterator_insert_block_before() should have returned false"); + return die_("iterator.insert_block_before() should have returned false"); printf("[S]A\tinsert PADDING after\n"); if(!insert_to_our_metadata_(padding, ++our_current_position, /*copy=*/true)) return die_("copying metadata"); - if(!FLAC__metadata_iterator_insert_block_after(iterator, padding)) - return die_("FLAC__metadata_iterator_insert_block_after(iterator, padding)"); + if(!iterator.insert_block_after(padding)) + return die_("iterator.insert_block_after(padding)"); - if(!compare_chain_(chain, our_current_position, FLAC__metadata_iterator_get_block(iterator))) + if(!compare_chain_(chain, our_current_position, iterator.get_block())) return false; printf("S[P]A\tinsert PADDING before\n"); - if(0 == (padding = FLAC__metadata_object_copy(our_metadata_.blocks[our_current_position]))) + if(0 == (padding = FLAC__metadata_object_clone(our_metadata_.blocks[our_current_position]))) return die_("creating PADDING block"); padding->length = 17; if(!insert_to_our_metadata_(padding, our_current_position, /*copy=*/true)) return die_("copying metadata"); - if(!FLAC__metadata_iterator_insert_block_before(iterator, padding)) - return die_("FLAC__metadata_iterator_insert_block_before(iterator, padding)"); + if(!iterator.insert_block_before(padding)) + return die_("iterator.insert_block_before(padding)"); - if(!compare_chain_(chain, our_current_position, FLAC__metadata_iterator_get_block(iterator))) + if(!compare_chain_(chain, our_current_position, iterator.get_block())) return false; printf("S[P]PA\tinsert PADDING before\n"); - if(0 == (padding = FLAC__metadata_object_copy(our_metadata_.blocks[our_current_position]))) + if(0 == (padding = FLAC__metadata_object_clone(our_metadata_.blocks[our_current_position]))) return die_("creating PADDING block"); padding->length = 0; if(!insert_to_our_metadata_(padding, our_current_position, /*copy=*/true)) return die_("copying metadata"); - if(!FLAC__metadata_iterator_insert_block_before(iterator, padding)) - return die_("FLAC__metadata_iterator_insert_block_before(iterator, padding)"); + if(!iterator.insert_block_before(padding)) + return die_("iterator.insert_block_before(padding)"); - if(!compare_chain_(chain, our_current_position, FLAC__metadata_iterator_get_block(iterator))) + if(!compare_chain_(chain, our_current_position, iterator.get_block())) return false; printf("S[P]PPA\tnext\n"); - if(!FLAC__metadata_iterator_next(iterator)) + if(!iterator.next()) return die_("iterator ended early\n"); our_current_position++; printf("SP[P]PA\tnext\n"); - if(!FLAC__metadata_iterator_next(iterator)) + if(!iterator.next()) return die_("iterator ended early\n"); our_current_position++; printf("SPP[P]A\tnext\n"); - if(!FLAC__metadata_iterator_next(iterator)) + if(!iterator.next()) return die_("iterator ended early\n"); our_current_position++; printf("SPPP[A]\tinsert PADDING after\n"); - if(0 == (padding = FLAC__metadata_object_copy(our_metadata_.blocks[1]))) + if(0 == (padding = FLAC__metadata_object_clone(our_metadata_.blocks[1]))) return die_("creating PADDING block"); padding->length = 57; if(!insert_to_our_metadata_(padding, ++our_current_position, /*copy=*/true)) return die_("copying metadata"); - if(!FLAC__metadata_iterator_insert_block_after(iterator, padding)) - return die_("FLAC__metadata_iterator_insert_block_after(iterator, padding)"); + if(!iterator.insert_block_after(padding)) + return die_("iterator.insert_block_after(padding)"); - if(!compare_chain_(chain, our_current_position, FLAC__metadata_iterator_get_block(iterator))) + if(!compare_chain_(chain, our_current_position, iterator.get_block())) return false; printf("SPPPA[P]\tinsert PADDING before\n"); - if(0 == (padding = FLAC__metadata_object_copy(our_metadata_.blocks[1]))) + if(0 == (padding = FLAC__metadata_object_clone(our_metadata_.blocks[1]))) return die_("creating PADDING block"); padding->length = 99; if(!insert_to_our_metadata_(padding, our_current_position, /*copy=*/true)) return die_("copying metadata"); - if(!FLAC__metadata_iterator_insert_block_before(iterator, padding)) - return die_("FLAC__metadata_iterator_insert_block_before(iterator, padding)"); + if(!iterator.insert_block_before(padding)) + return die_("iterator.insert_block_before(padding)"); - if(!compare_chain_(chain, our_current_position, FLAC__metadata_iterator_get_block(iterator))) + if(!compare_chain_(chain, our_current_position, iterator.get_block())) return false; printf("delete iterator\n"); - FLAC__metadata_iterator_delete(iterator); + iterator.delete(); our_current_position = 0; printf("SPPPAPP\tmerge padding\n"); - FLAC__metadata_chain_merge_padding(chain); + chain.merge_padding(chain); our_metadata_.blocks[1]->length += (FLAC__STREAM_METADATA_HEADER_LENGTH + our_metadata_.blocks[2]->length); our_metadata_.blocks[1]->length += (FLAC__STREAM_METADATA_HEADER_LENGTH + our_metadata_.blocks[3]->length); our_metadata_.blocks[5]->length += (FLAC__STREAM_METADATA_HEADER_LENGTH + our_metadata_.blocks[6]->length); @@ -1381,35 +1364,35 @@ static FLAC__bool test_level_2_() delete_from_our_metadata_(3); delete_from_our_metadata_(2); - if(!FLAC__metadata_chain_write(chain, /*use_padding=*/true, /*preserve_file_stats=*/false)) - return die_c_("during FLAC__metadata_chain_write(chain, true, false)", FLAC__metadata_chain_status(chain)); + if(!chain.write(chain, /*use_padding=*/true, /*preserve_file_stats=*/false)) + return die_c_("during chain.write(chain, true, false)", chain.status(chain)); if(!compare_chain_(chain, 0, 0)) return false; - if(!test_file_(flacfile_, decoder_metadata_callback_compare_)) + if(!test_file_(flacfile_, /*ignore_metadata=*/false)) return false; printf("SPAP\tsort padding\n"); - FLAC__metadata_chain_sort_padding(chain); + chain.sort_padding(chain); our_metadata_.blocks[3]->length += (FLAC__STREAM_METADATA_HEADER_LENGTH + our_metadata_.blocks[1]->length); delete_from_our_metadata_(1); - if(!FLAC__metadata_chain_write(chain, /*use_padding=*/true, /*preserve_file_stats=*/false)) - return die_c_("during FLAC__metadata_chain_write(chain, true, false)", FLAC__metadata_chain_status(chain)); + if(!chain.write(chain, /*use_padding=*/true, /*preserve_file_stats=*/false)) + return die_c_("during chain.write(chain, true, false)", chain.status(chain)); if(!compare_chain_(chain, 0, 0)) return false; - if(!test_file_(flacfile_, decoder_metadata_callback_compare_)) + if(!test_file_(flacfile_, /*ignore_metadata=*/false)) return false; printf("create iterator\n"); - if(0 == (iterator = FLAC__metadata_iterator_new())) + if(0 == (iterator = iterator.new())) return die_("allocating memory for iterator"); our_current_position = 0; - FLAC__metadata_iterator_init(iterator, chain); + iterator.init(chain); printf("[S]AP\tnext\n"); - if(!FLAC__metadata_iterator_next(iterator)) + if(!iterator.next()) return die_("iterator ended early\n"); our_current_position++; @@ -1419,27 +1402,27 @@ static FLAC__bool test_level_2_() padding->length = 71; if(!replace_in_our_metadata_(padding, our_current_position--, /*copy=*/false)) return die_("copying object"); - if(!FLAC__metadata_iterator_delete_block(iterator, /*replace_with_padding=*/true)) - return die_c_("FLAC__metadata_iterator_delete_block(iterator, true)", FLAC__metadata_chain_status(chain)); + if(!iterator.delete_block(/*replace_with_padding=*/true)) + return die_c_("iterator.delete_block(true)", chain.status(chain)); - if(!compare_chain_(chain, our_current_position, FLAC__metadata_iterator_get_block(iterator))) + if(!compare_chain_(chain, our_current_position, iterator.get_block())) return false; printf("[S]PP\tnext\n"); - if(!FLAC__metadata_iterator_next(iterator)) + if(!iterator.next()) return die_("iterator ended early\n"); our_current_position++; printf("S[P]P\tdelete middle block, don't replace with padding\n"); delete_from_our_metadata_(our_current_position--); - if(!FLAC__metadata_iterator_delete_block(iterator, /*replace_with_padding=*/false)) - return die_c_("FLAC__metadata_iterator_delete_block(iterator, false)", FLAC__metadata_chain_status(chain)); + if(!iterator.delete_block(/*replace_with_padding=*/false)) + return die_c_("iterator.delete_block(false)", chain.status(chain)); - if(!compare_chain_(chain, our_current_position, FLAC__metadata_iterator_get_block(iterator))) + if(!compare_chain_(chain, our_current_position, iterator.get_block())) return false; printf("[S]P\tnext\n"); - if(!FLAC__metadata_iterator_next(iterator)) + if(!iterator.next()) return die_("iterator ended early\n"); our_current_position++; @@ -1449,59 +1432,59 @@ static FLAC__bool test_level_2_() padding->length = 219; if(!replace_in_our_metadata_(padding, our_current_position--, /*copy=*/false)) return die_("copying object"); - if(!FLAC__metadata_iterator_delete_block(iterator, /*replace_with_padding=*/true)) - return die_c_("FLAC__metadata_iterator_delete_block(iterator, true)", FLAC__metadata_chain_status(chain)); + if(!iterator.delete_block(/*replace_with_padding=*/true)) + return die_c_("iterator.delete_block(true)", chain.status(chain)); - if(!compare_chain_(chain, our_current_position, FLAC__metadata_iterator_get_block(iterator))) + if(!compare_chain_(chain, our_current_position, iterator.get_block())) return false; printf("[S]P\tnext\n"); - if(!FLAC__metadata_iterator_next(iterator)) + if(!iterator.next()) return die_("iterator ended early\n"); our_current_position++; printf("S[P]\tdelete last block, don't replace with padding\n"); delete_from_our_metadata_(our_current_position--); - if(!FLAC__metadata_iterator_delete_block(iterator, /*replace_with_padding=*/false)) - return die_c_("FLAC__metadata_iterator_delete_block(iterator, false)", FLAC__metadata_chain_status(chain)); + if(!iterator.delete_block(/*replace_with_padding=*/false)) + return die_c_("iterator.delete_block(false)", chain.status(chain)); - if(!compare_chain_(chain, our_current_position, FLAC__metadata_iterator_get_block(iterator))) + if(!compare_chain_(chain, our_current_position, iterator.get_block())) return false; printf("[S]\tdelete STREAMINFO block, should fail\n"); - if(FLAC__metadata_iterator_delete_block(iterator, /*replace_with_padding=*/false)) - return die_("FLAC__metadata_iterator_delete_block() on STREAMINFO should have failed but didn't"); + if(iterator.delete_block(/*replace_with_padding=*/false)) + return die_("iterator.delete_block() on STREAMINFO should have failed but didn't"); - if(!compare_chain_(chain, our_current_position, FLAC__metadata_iterator_get_block(iterator))) + if(!compare_chain_(chain, our_current_position, iterator.get_block())) return false; printf("delete iterator\n"); - FLAC__metadata_iterator_delete(iterator); + iterator.delete(); our_current_position = 0; printf("S\tmerge padding\n"); - FLAC__metadata_chain_merge_padding(chain); + chain.merge_padding(chain); - if(!FLAC__metadata_chain_write(chain, /*use_padding=*/false, /*preserve_file_stats=*/false)) - return die_c_("during FLAC__metadata_chain_write(chain, false, false)", FLAC__metadata_chain_status(chain)); + if(!chain.write(chain, /*use_padding=*/false, /*preserve_file_stats=*/false)) + return die_c_("during chain.write(chain, false, false)", chain.status(chain)); if(!compare_chain_(chain, 0, 0)) return false; - if(!test_file_(flacfile_, decoder_metadata_callback_compare_)) + if(!test_file_(flacfile_, /*ignore_metadata=*/false)) return false; printf("S\tsort padding\n"); - FLAC__metadata_chain_sort_padding(chain); + chain.sort_padding(chain); - if(!FLAC__metadata_chain_write(chain, /*use_padding=*/false, /*preserve_file_stats=*/false)) - return die_c_("during FLAC__metadata_chain_write(chain, false, false)", FLAC__metadata_chain_status(chain)); + if(!chain.write(chain, /*use_padding=*/false, /*preserve_file_stats=*/false)) + return die_c_("during chain.write(chain, false, false)", chain.status(chain)); if(!compare_chain_(chain, 0, 0)) return false; - if(!test_file_(flacfile_, decoder_metadata_callback_compare_)) + if(!test_file_(flacfile_, /*ignore_metadata=*/false)) return false; printf("delete chain\n"); - FLAC__metadata_chain_delete(chain); + chain.delete(chain); if(!remove_file_(flacfile_)) return false; @@ -1511,7 +1494,7 @@ static FLAC__bool test_level_2_() bool test_metadata_file_manipulation() { - printf("\n+++ unit test: metadata manipulation\n\n"); + printf("\n+++ libFLAC++ unit test: metadata manipulation\n\n"); our_metadata_.num_blocks = 0; diff --git a/src/test_libFLAC++/metadata_object.cc b/src/test_libFLAC++/metadata_object.cc index 6ce385f0..2c3f33fa 100644 --- a/src/test_libFLAC++/metadata_object.cc +++ b/src/test_libFLAC++/metadata_object.cc @@ -22,7 +22,13 @@ #include <stdlib.h> /* for malloc() */ #include <string.h> /* for memcmp() */ -static ::FLAC__StreamMetaData streaminfo_, padding_, seektable_, application_, vorbiscomment_; +static ::FLAC__StreamMetadata streaminfo_, padding_, seektable_, application_, vorbiscomment_; + +static bool die_(const char *msg) +{ + printf("FAILED, %s\n", msg); + return false; +} static void *malloc_or_die_(size_t size) { @@ -57,7 +63,7 @@ static void init_metadata_blocks_() seektable_.type = ::FLAC__METADATA_TYPE_SEEKTABLE; seektable_.data.seek_table.num_points = 2; seektable_.length = seektable_.data.seek_table.num_points * FLAC__STREAM_METADATA_SEEKPOINT_LENGTH; - seektable_.data.seek_table.points = (::FLAC__StreamMetaData_SeekPoint*)malloc_or_die_(seektable_.data.seek_table.num_points * sizeof(::FLAC__StreamMetaData_SeekPoint)); + seektable_.data.seek_table.points = (::FLAC__StreamMetadata_SeekPoint*)malloc_or_die_(seektable_.data.seek_table.num_points * sizeof(::FLAC__StreamMetadata_SeekPoint)); seektable_.data.seek_table.points[0].sample_number = 0; seektable_.data.seek_table.points[0].stream_offset = 0; seektable_.data.seek_table.points[0].frame_samples = streaminfo_.data.stream_info.min_blocksize; @@ -75,16 +81,17 @@ static void init_metadata_blocks_() vorbiscomment_.is_last = true; vorbiscomment_.type = ::FLAC__METADATA_TYPE_VORBIS_COMMENT; vorbiscomment_.length = (4 + 8) + 4 + (4 + 5) + (4 + 0); - vorbiscomment_.data.vorbis_comment.vendor_string.length = 8; - vorbiscomment_.data.vorbis_comment.vendor_string.entry = (FLAC__byte*)malloc_or_die_(8); - memcpy(vorbiscomment_.data.vorbis_comment.vendor_string.entry, "flac 1.x", 8); + vorbiscomment_.data.vorbis_comment.vendor_string.length = 5; + vorbiscomment_.data.vorbis_comment.vendor_string.entry = (FLAC__byte*)malloc_or_die_(5); + memcpy(vorbiscomment_.data.vorbis_comment.vendor_string.entry, "name0", 8); vorbiscomment_.data.vorbis_comment.num_comments = 2; - vorbiscomment_.data.vorbis_comment.comments = (::FLAC__StreamMetaData_VorbisComment_Entry*)malloc_or_die_(vorbiscomment_.data.vorbis_comment.num_comments * sizeof(::FLAC__StreamMetaData_VorbisComment_Entry)); - vorbiscomment_.data.vorbis_comment.comments[0].length = 5; - vorbiscomment_.data.vorbis_comment.comments[0].entry = (FLAC__byte*)malloc_or_die_(5); - memcpy(vorbiscomment_.data.vorbis_comment.comments[0].entry, "ab=cd", 5); - vorbiscomment_.data.vorbis_comment.comments[1].length = 0; - vorbiscomment_.data.vorbis_comment.comments[1].entry = 0; + vorbiscomment_.data.vorbis_comment.comments = (::FLAC__StreamMetadata_VorbisComment_Entry*)malloc_or_die_(vorbiscomment_.data.vorbis_comment.num_comments * sizeof(::FLAC__StreamMetadata_VorbisComment_Entry)); + vorbiscomment_.data.vorbis_comment.comments[0].length = 12; + vorbiscomment_.data.vorbis_comment.comments[0].entry = (FLAC__byte*)malloc_or_die_(12); + memcpy(vorbiscomment_.data.vorbis_comment.comments[0].entry, "name2=value2", 12); + vorbiscomment_.data.vorbis_comment.comments[1].length = 12; + vorbiscomment_.data.vorbis_comment.comments[1].entry = (FLAC__byte*)malloc_or_die_(12); + memcpy(vorbiscomment_.data.vorbis_comment.comments[1].entry, "name3=value3", 12); } static void free_metadata_blocks_() @@ -98,282 +105,871 @@ static void free_metadata_blocks_() bool test_metadata_object_streaminfo() { + unsigned expected_length; + + printf("testing class FLAC::Metadata::StreamInfo\n"); + + printf("testing StreamInfo::StreamInfo()... "); FLAC::Metadata::StreamInfo block; + if(!block.is_valid()) + return die_("!block.is_valid()"); + expected_length = FLAC__STREAM_METADATA_STREAMINFO_LENGTH; + if(block.get_length() != expected_length) { + printf("FAILED, bad length, expected %u, got %u\n", expected_length, block.get_length()); + return false; + } + printf("OK\n"); + + printf("testing StreamInfo::StreamInfo(const StreamInfo &)... +\n"); + printf(" StreamInfo::operator!=(const StreamInfo &)... "); + { + FLAC::Metadata::StreamInfo blockcopy(block); + if(!blockcopy.is_valid()) + return die_("!block.is_valid()"); + if(blockcopy != block) + return die_("copy is not identical to original"); + printf("OK\n"); + + printf("testing StreamInfo::~StreamInfo()... "); + } + printf("OK\n"); + + printf("testing StreamInfo::StreamInfo(const ::FLAC__StreamMetadata &)... +\n"); + printf(" StreamInfo::operator!=(const ::FLAC__StreamMetadata &)... "); + { + FLAC::Metadata::StreamInfo blockcopy(streaminfo_); + if(!blockcopy.is_valid()) + return die_("!block.is_valid()"); + if(blockcopy != streaminfo_) + return die_("copy is not identical to original"); + printf("OK\n"); + } + + printf("testing StreamInfo::StreamInfo(const ::FLAC__StreamMetadata *)... +\n"); + printf(" StreamInfo::operator!=(const ::FLAC__StreamMetadata *)... "); + { + FLAC::Metadata::StreamInfo blockcopy(&streaminfo_); + if(!blockcopy.is_valid()) + return die_("!block.is_valid()"); + if(blockcopy != streaminfo_) + return die_("copy is not identical to original"); + printf("OK\n"); + } + + printf("testing StreamInfo::operator=(const StreamInfo &)... +\n"); + printf(" StreamInfo::operator==(const StreamInfo &)... "); + { + FLAC::Metadata::StreamInfo blockcopy = block; + if(!blockcopy.is_valid()) + return die_("!block.is_valid()"); + if(!(blockcopy == block)) + return die_("copy is not identical to original"); + printf("OK\n"); + } + + printf("testing StreamInfo::operator=(const ::FLAC__StreamMetadata &)... +\n"); + printf(" StreamInfo::operator==(const ::FLAC__StreamMetadata &)... "); + { + FLAC::Metadata::StreamInfo blockcopy = streaminfo_; + if(!blockcopy.is_valid()) + return die_("!block.is_valid()"); + if(!(blockcopy == streaminfo_)) + return die_("copy is not identical to original"); + printf("OK\n"); + } + + printf("testing StreamInfo::operator=(const ::FLAC__StreamMetadata *)... +\n"); + printf(" StreamInfo::operator==(const ::FLAC__StreamMetadata *)... "); + { + FLAC::Metadata::StreamInfo blockcopy = &streaminfo_; + if(!blockcopy.is_valid()) + return die_("!block.is_valid()"); + if(!(blockcopy == streaminfo_)) + return die_("copy is not identical to original"); + printf("OK\n"); + } + + printf("testing StreamInfo::set_min_blocksize()... "); + block.set_min_blocksize(streaminfo_.data.stream_info.min_blocksize); + printf("OK\n"); + + printf("testing StreamInfo::set_max_blocksize()... "); + block.set_max_blocksize(streaminfo_.data.stream_info.max_blocksize); + printf("OK\n"); + + printf("testing StreamInfo::set_min_framesize()... "); + block.set_min_framesize(streaminfo_.data.stream_info.min_framesize); + printf("OK\n"); + + printf("testing StreamInfo::set_max_framesize()... "); + block.set_max_framesize(streaminfo_.data.stream_info.max_framesize); + printf("OK\n"); + + printf("testing StreamInfo::set_sample_rate()... "); + block.set_sample_rate(streaminfo_.data.stream_info.sample_rate); + printf("OK\n"); + + printf("testing StreamInfo::set_channels()... "); + block.set_channels(streaminfo_.data.stream_info.channels); + printf("OK\n"); + + printf("testing StreamInfo::set_bits_per_sample()... "); + block.set_bits_per_sample(streaminfo_.data.stream_info.bits_per_sample); + printf("OK\n"); + + printf("testing StreamInfo::set_total_samples()... "); + block.set_total_samples(streaminfo_.data.stream_info.total_samples); + printf("OK\n"); + + printf("testing StreamInfo::set_md5sum()... "); + block.set_md5sum(streaminfo_.data.stream_info.md5sum); + printf("OK\n"); + + printf("testing StreamInfo::get_min_blocksize()... "); + if(block.get_min_blocksize() != streaminfo_.data.stream_info.min_blocksize) + return die_("value mismatch, doesn't match previously set value"); + printf("OK\n"); + + printf("testing StreamInfo::get_max_blocksize()... "); + if(block.get_max_blocksize() != streaminfo_.data.stream_info.max_blocksize) + return die_("value mismatch, doesn't match previously set value"); + printf("OK\n"); + + printf("testing StreamInfo::get_min_framesize()... "); + if(block.get_min_framesize() != streaminfo_.data.stream_info.min_framesize) + return die_("value mismatch, doesn't match previously set value"); + printf("OK\n"); + + printf("testing StreamInfo::get_max_framesize()... "); + if(block.get_max_framesize() != streaminfo_.data.stream_info.max_framesize) + return die_("value mismatch, doesn't match previously set value"); + printf("OK\n"); + + printf("testing StreamInfo::get_sample_rate()... "); + if(block.get_sample_rate() != streaminfo_.data.stream_info.sample_rate) + return die_("value mismatch, doesn't match previously set value"); + printf("OK\n"); + + printf("testing StreamInfo::get_channels()... "); + if(block.get_channels() != streaminfo_.data.stream_info.channels) + return die_("value mismatch, doesn't match previously set value"); + printf("OK\n"); + + printf("testing StreamInfo::get_bits_per_sample()... "); + if(block.get_bits_per_sample() != streaminfo_.data.stream_info.bits_per_sample) + return die_("value mismatch, doesn't match previously set value"); + printf("OK\n"); + + printf("testing StreamInfo::get_total_samples()... "); + if(block.get_total_samples() != streaminfo_.data.stream_info.total_samples) + return die_("value mismatch, doesn't match previously set value"); + printf("OK\n"); + + printf("testing StreamInfo::get_md5sum()... "); + if(0 != memcmp(block.get_md5sum(), streaminfo_.data.stream_info.md5sum, 16)) + return die_("value mismatch, doesn't match previously set value"); + printf("OK\n"); + + printf("testing FLAC::Metadata::clone(const FLAC::Metadata::Prototype *)... "); + FLAC::Metadata::Prototype *clone_ = clone(&block); + if(0 == clone_) + return die_("returned NULL"); + if(0 == dynamic_cast<FLAC::Metadata::StreamInfo *>(clone_)) + return die_("downcast is NULL"); + if(*dynamic_cast<FLAC::Metadata::StreamInfo *>(clone_) != block) + return die_("clone is not identical"); + printf("OK\n"); + + + printf("PASSED\n\n"); + return true; +} + +bool test_metadata_object_padding() +{ unsigned expected_length; - printf("\n+++ unit test: metadata objects (libFLAC++)\n\n"); + printf("testing class FLAC::Metadata::Padding\n"); + + printf("testing Padding::Padding()... "); + FLAC::Metadata::Padding block; + if(!block.is_valid()) + return die_("!block.is_valid()"); + expected_length = 0; + if(block.get_length() != expected_length) { + printf("FAILED, bad length, expected %u, got %u\n", expected_length, block.get_length()); + return false; + } + printf("OK\n"); + + printf("testing Padding::Padding(const Padding &)... +\n"); + printf(" Padding::operator!=(const Padding &)... "); + { + FLAC::Metadata::Padding blockcopy(block); + if(!blockcopy.is_valid()) + return die_("!block.is_valid()"); + if(blockcopy != block) + return die_("copy is not identical to original"); + printf("OK\n"); + + printf("testing Padding::~Padding()... "); + } + printf("OK\n"); + + printf("testing Padding::Padding(const ::FLAC__StreamMetadata &)... +\n"); + printf(" Padding::operator!=(const ::FLAC__StreamMetadata &)... "); + { + FLAC::Metadata::Padding blockcopy(padding_); + if(!blockcopy.is_valid()) + return die_("!block.is_valid()"); + if(blockcopy != padding_) + return die_("copy is not identical to original"); + printf("OK\n"); + } + + printf("testing Padding::Padding(const ::FLAC__StreamMetadata *)... +\n"); + printf(" Padding::operator!=(const ::FLAC__StreamMetadata *)... "); + { + FLAC::Metadata::Padding blockcopy(&padding_); + if(!blockcopy.is_valid()) + return die_("!block.is_valid()"); + if(blockcopy != padding_) + return die_("copy is not identical to original"); + printf("OK\n"); + } + + printf("testing Padding::operator=(const Padding &)... +\n"); + printf(" Padding::operator==(const Padding &)... "); + { + FLAC::Metadata::Padding blockcopy = block; + if(!blockcopy.is_valid()) + return die_("!block.is_valid()"); + if(!(blockcopy == block)) + return die_("copy is not identical to original"); + printf("OK\n"); + } + + printf("testing Padding::operator=(const ::FLAC__StreamMetadata &)... +\n"); + printf(" Padding::operator==(const ::FLAC__StreamMetadata &)... "); + { + FLAC::Metadata::Padding blockcopy = padding_; + if(!blockcopy.is_valid()) + return die_("!block.is_valid()"); + if(!(blockcopy == padding_)) + return die_("copy is not identical to original"); + printf("OK\n"); + } + + printf("testing Padding::operator=(const ::FLAC__StreamMetadata *)... +\n"); + printf(" Padding::operator==(const ::FLAC__StreamMetadata *)... "); + { + FLAC::Metadata::Padding blockcopy = &padding_; + if(!blockcopy.is_valid()) + return die_("!block.is_valid()"); + if(!(blockcopy == padding_)) + return die_("copy is not identical to original"); + printf("OK\n"); + } + + printf("testing Padding::set_length()... "); + block.set_length(padding_.length); + printf("OK\n"); + printf("testing Prototype::get_length()... "); + if(block.get_length() != padding_.length) + return die_("value mismatch, doesn't match previously set value"); + printf("OK\n"); - printf("testing FLAC::Metadata::StreamInfo\n"); + printf("testing FLAC::Metadata::clone(const FLAC::Metadata::Prototype *)... "); + FLAC::Metadata::Prototype *clone_ = clone(&block); + if(0 == clone_) + return die_("returned NULL"); + if(0 == dynamic_cast<FLAC::Metadata::Padding *>(clone_)) + return die_("downcast is NULL"); + if(*dynamic_cast<FLAC::Metadata::Padding *>(clone_) != block) + return die_("clone is not identical"); + printf("OK\n"); - printf("testing FLAC::Metadata::StreamInfo::StreamInfo()... "); - if(!block.is_valid()) { - printf("FAILED, !block.is_valid()\n"); + + printf("PASSED\n\n"); + return true; +} + +bool test_metadata_object_application() +{ + unsigned expected_length; + + printf("testing class FLAC::Metadata::Application\n"); + + printf("testing Application::Application()... "); + FLAC::Metadata::Application block; + if(!block.is_valid()) + return die_("!block.is_valid()"); + expected_length = FLAC__STREAM_METADATA_APPLICATION_ID_LEN / 8; + if(block.get_length() != expected_length) { + printf("FAILED, bad length, expected %u, got %u\n", expected_length, block.get_length()); return false; + } + printf("OK\n"); + + printf("testing Application::Application(const Application &)... +\n"); + printf(" Application::operator!=(const Application &)... "); + { + FLAC::Metadata::Application blockcopy(block); + if(!blockcopy.is_valid()) + return die_("!block.is_valid()"); + if(blockcopy != block) + return die_("copy is not identical to original"); + printf("OK\n"); + + printf("testing Application::~Application()... "); } - expected_length = FLAC__STREAM_METADATA_STREAMINFO_LENGTH; + printf("OK\n"); + + printf("testing Application::Application(const ::FLAC__StreamMetadata &)... +\n"); + printf(" Application::operator!=(const ::FLAC__StreamMetadata &)... "); + { + FLAC::Metadata::Application blockcopy(application_); + if(!blockcopy.is_valid()) + return die_("!block.is_valid()"); + if(blockcopy != application_) + return die_("copy is not identical to original"); + printf("OK\n"); + } + + printf("testing Application::Application(const ::FLAC__StreamMetadata *)... +\n"); + printf(" Application::operator!=(const ::FLAC__StreamMetadata *)... "); + { + FLAC::Metadata::Application blockcopy(&application_); + if(!blockcopy.is_valid()) + return die_("!block.is_valid()"); + if(blockcopy != application_) + return die_("copy is not identical to original"); + printf("OK\n"); + } + + printf("testing Application::operator=(const Application &)... +\n"); + printf(" Application::operator==(const Application &)... "); + { + FLAC::Metadata::Application blockcopy = block; + if(!blockcopy.is_valid()) + return die_("!block.is_valid()"); + if(!(blockcopy == block)) + return die_("copy is not identical to original"); + printf("OK\n"); + } + + printf("testing Application::operator=(const ::FLAC__StreamMetadata &)... +\n"); + printf(" Application::operator==(const ::FLAC__StreamMetadata &)... "); + { + FLAC::Metadata::Application blockcopy = application_; + if(!blockcopy.is_valid()) + return die_("!block.is_valid()"); + if(!(blockcopy == application_)) + return die_("copy is not identical to original"); + printf("OK\n"); + } + + printf("testing Application::operator=(const ::FLAC__StreamMetadata *)... +\n"); + printf(" Application::operator==(const ::FLAC__StreamMetadata *)... "); + { + FLAC::Metadata::Application blockcopy = &application_; + if(!blockcopy.is_valid()) + return die_("!block.is_valid()"); + if(!(blockcopy == application_)) + return die_("copy is not identical to original"); + printf("OK\n"); + } + + printf("testing Application::set_id()... "); + block.set_id(application_.data.application.id); + printf("OK\n"); + + printf("testing Application::set_data()... "); + block.set_data(application_.data.application.data, application_.length - sizeof(application_.data.application.id), /*copy=*/true); + printf("OK\n"); + + printf("testing Application::get_id()... "); + if(0 != memcmp(block.get_id(), application_.data.application.id, sizeof(application_.data.application.id))) + return die_("value mismatch, doesn't match previously set value"); + printf("OK\n"); + + printf("testing Application::get_data()... "); + if(0 != memcmp(block.get_data(), application_.data.application.data, application_.length - sizeof(application_.data.application.id))) + return die_("value mismatch, doesn't match previously set value"); + printf("OK\n"); + + printf("testing FLAC::Metadata::clone(const FLAC::Metadata::Prototype *)... "); + FLAC::Metadata::Prototype *clone_ = clone(&block); + if(0 == clone_) + return die_("returned NULL"); + if(0 == dynamic_cast<FLAC::Metadata::Application *>(clone_)) + return die_("downcast is NULL"); + if(*dynamic_cast<FLAC::Metadata::Application *>(clone_) != block) + return die_("clone is not identical"); + printf("OK\n"); + + + printf("PASSED\n\n"); + return true; +} + +bool test_metadata_object_seektable() +{ + unsigned expected_length; + + printf("testing class FLAC::Metadata::SeekTable\n"); + + printf("testing SeekTable::SeekTable()... "); + FLAC::Metadata::SeekTable block; + if(!block.is_valid()) + return die_("!block.is_valid()"); + expected_length = 0; if(block.get_length() != expected_length) { printf("FAILED, bad length, expected %u, got %u\n", expected_length, block.get_length()); return false; } printf("OK\n"); - printf("testing FLAC::MetaData::StreamInfo::StreamInfo(const StreamInfo &)... "); + printf("testing SeekTable::SeekTable(const SeekTable &)... +\n"); + printf(" SeekTable::operator!=(const SeekTable &)... "); { - FLAC::Metadata::StreamInfo blockcopy(block); - if(blockcopy != block) { - printf("FAILED, copy is not identical to original\n"); - return false; - } + FLAC::Metadata::SeekTable blockcopy(block); + if(!blockcopy.is_valid()) + return die_("!block.is_valid()"); + if(blockcopy != block) + return die_("copy is not identical to original"); printf("OK\n"); - printf("testing FLAC::Metadata::StreamInfo::~StreamInfo()... "); + printf("testing SeekTable::~SeekTable()... "); } printf("OK\n"); - printf("testing FLAC::Metadata::StreamInfo::operator=(const ::FLAC__StreamMetaData &)... "); + printf("testing SeekTable::SeekTable(const ::FLAC__StreamMetadata &)... +\n"); + printf(" SeekTable::operator!=(const ::FLAC__StreamMetadata &)... "); + { + FLAC::Metadata::SeekTable blockcopy(seektable_); + if(!blockcopy.is_valid()) + return die_("!block.is_valid()"); + if(blockcopy != seektable_) + return die_("copy is not identical to original"); + printf("OK\n"); + } + + printf("testing SeekTable::SeekTable(const ::FLAC__StreamMetadata *)... +\n"); + printf(" SeekTable::operator!=(const ::FLAC__StreamMetadata *)... "); + { + FLAC::Metadata::SeekTable blockcopy(&seektable_); + if(!blockcopy.is_valid()) + return die_("!block.is_valid()"); + if(blockcopy != seektable_) + return die_("copy is not identical to original"); + printf("OK\n"); + } + + printf("testing SeekTable::operator=(const SeekTable &)... +\n"); + printf(" SeekTable::operator==(const SeekTable &)... "); + { + FLAC::Metadata::SeekTable blockcopy = block; + if(!blockcopy.is_valid()) + return die_("!block.is_valid()"); + if(!(blockcopy == block)) + return die_("copy is not identical to original"); + printf("OK\n"); + } + + printf("testing SeekTable::operator=(const ::FLAC__StreamMetadata &)... +\n"); + printf(" SeekTable::operator==(const ::FLAC__StreamMetadata &)... "); + { + FLAC::Metadata::SeekTable blockcopy = seektable_; + if(!blockcopy.is_valid()) + return die_("!block.is_valid()"); + if(!(blockcopy == seektable_)) + return die_("copy is not identical to original"); + printf("OK\n"); + } + + printf("testing SeekTable::operator=(const ::FLAC__StreamMetadata *)... +\n"); + printf(" SeekTable::operator==(const ::FLAC__StreamMetadata *)... "); { - FLAC::Metadata::StreamInfo blockcopy(streaminfo_, /*copy=*/true); - if(!blockcopy.is_valid()) { - printf("FAILED, !block.is_valid()\n"); - return false; - } - if(blockcopy != streaminfo_) { - printf("FAILED, copy is not identical to original\n"); - return false; - } + FLAC::Metadata::SeekTable blockcopy = &seektable_; + if(!blockcopy.is_valid()) + return die_("!block.is_valid()"); + if(!(blockcopy == seektable_)) + return die_("copy is not identical to original"); + printf("OK\n"); } + + printf("testing SeekTable::insert_point() x 3... "); + if(!block.insert_point(0, seektable_.data.seek_table.points[1])) + return die_("returned false"); + if(!block.insert_point(0, seektable_.data.seek_table.points[1])) + return die_("returned false"); + if(!block.insert_point(1, seektable_.data.seek_table.points[0])) + return die_("returned false"); printf("OK\n"); - printf("testing FLAC::Metadata::StreamInfo::operator=(const ::FLAC__StreamMetaData *)... "); + printf("testing SeekTable::is_legal()... "); + if(block.is_legal()) + return die_("returned true"); + printf("OK\n"); + + printf("testing SeekTable::set_point()... "); + block.set_point(0, seektable_.data.seek_table.points[0]); + printf("OK\n"); + + printf("testing SeekTable::delete_point()... "); + if(!block.delete_point(0)) + return die_("returned false"); + printf("OK\n"); + + printf("testing SeekTable::is_legal()... "); + if(!block.is_legal()) + return die_("returned false"); + printf("OK\n"); + + printf("testing SeekTable::get_num_points()... "); + if(block.get_num_points() != seektable_.data.seek_table.num_points) + return die_("number mismatch"); + printf("OK\n"); + + printf("testing SeekTable::operator!=(const ::FLAC__StreamMetadata &)... "); + if(block != seektable_) + return die_("data mismatch"); + printf("OK\n"); + + printf("testing SeekTable::get_point()... "); + if( + block.get_point(1).sample_number != seektable_.data.seek_table.points[1].sample_number || + block.get_point(1).stream_offset != seektable_.data.seek_table.points[1].stream_offset || + block.get_point(1).frame_samples != seektable_.data.seek_table.points[1].frame_samples + ) + return die_("point mismatch"); + printf("OK\n"); + + printf("testing FLAC::Metadata::clone(const FLAC::Metadata::Prototype *)... "); + FLAC::Metadata::Prototype *clone_ = clone(&block); + if(0 == clone_) + return die_("returned NULL"); + if(0 == dynamic_cast<FLAC::Metadata::SeekTable *>(clone_)) + return die_("downcast is NULL"); + if(*dynamic_cast<FLAC::Metadata::SeekTable *>(clone_) != block) + return die_("clone is not identical"); + printf("OK\n"); + + + printf("PASSED\n\n"); + return true; +} + +bool test_metadata_object_vorbiscomment() +{ + unsigned expected_length; + + printf("testing class FLAC::Metadata::VorbisComment::Entry\n"); + + printf("testing Entry::Entry()... "); { - FLAC::Metadata::StreamInfo blockcopy(&streaminfo_, /*copy=*/true); - if(!blockcopy.is_valid()) { - printf("FAILED, !block.is_valid()\n"); - return false; - } - if(blockcopy != streaminfo_) { - printf("FAILED, copy is not identical to original\n"); - return false; - } + FLAC::Metadata::VorbisComment::Entry entry1; + if(!entry1.is_valid()) + return die_("!is_valid()"); + printf("OK\n"); + + printf("testing Entry::~Entry()... "); } printf("OK\n"); - printf("testing FLAC::Metadata::StreamInfo::operator=(const StreamInfo &)... "); + printf("testing Entry::Entry(const char *field, unsigned field_length)... "); + FLAC::Metadata::VorbisComment::Entry entry2("name2=value2", strlen("name2=value2")); + if(!entry2.is_valid()) + return die_("!is_valid()"); + printf("OK\n"); + + printf("testing Entry::Entry(const char *field_name, const char *field_value, unsigned field_value_length)... "); + FLAC::Metadata::VorbisComment::Entry entry3("name3", "value3", strlen("value3")); + if(!entry3.is_valid()) + return die_("!is_valid()"); + printf("OK\n"); + + printf("testing Entry::Entry(const Entry &entry)... "); { - FLAC::Metadata::StreamInfo blockcopy = block; - if(!blockcopy.is_valid()) { - printf("FAILED, !block.is_valid()\n"); - return false; - } - if(blockcopy != block) { - printf("FAILED, copy is not identical to original\n"); - return false; - } + FLAC::Metadata::VorbisComment::Entry entry2copy(entry2); + if(!entry2copy.is_valid()) + return die_("!is_valid()"); + printf("OK\n"); + + printf("testing Entry::~Entry()... "); + } + printf("OK\n"); + + printf("testing Entry::operator=(const Entry &entry)... "); + FLAC::Metadata::VorbisComment::Entry entry1 = entry2; + if(!entry2.is_valid()) + return die_("!is_valid()"); + printf("OK\n"); + + printf("testing Entry::get_field_length()... "); + if(entry1.get_field_length() != strlen("name2=value2")) + return die_("value mismatch"); + printf("OK\n"); + + printf("testing Entry::get_field_name_length()... "); + if(entry1.get_field_name_length() != strlen("name2")) + return die_("value mismatch"); + printf("OK\n"); + + printf("testing Entry::get_field_value_length()... "); + if(entry1.get_field_value_length() != strlen("value2")) + return die_("value mismatch"); + printf("OK\n"); + + printf("testing Entry::get_entry()... "); + { + ::FLAC__StreamMetadata_VorbisComment_Entry entry = entry1.get_entry(); + if(entry.length != strlen("name2=value2")) + return die_("entry length mismatch"); + if(0 != memcmp(entry.entry, "name2=value2", entry.length)) + return die_("entry value mismatch"); + } + printf("OK\n"); + + printf("testing Entry::get_field()... "); + if(0 != memcmp(entry1.get_field(), "name2=value2", strlen("name2=value2"))) + return die_("value mismatch"); + printf("OK\n"); + + printf("testing Entry::get_field_name()... "); + if(0 != memcmp(entry1.get_field_name(), "name2", strlen("name2"))) + return die_("value mismatch"); + printf("OK\n"); + + printf("testing Entry::get_field_value()... "); + if(0 != memcmp(entry1.get_field_value(), "value2", strlen("value2"))) + return die_("value mismatch"); + printf("OK\n"); + + printf("testing Entry::set_field_name()... "); + if(!entry1.set_field_name("name1")) + return die_("returned false"); + if(0 != memcmp(entry1.get_field_name(), "name1", strlen("name1"))) + return die_("value mismatch"); + if(0 != memcmp(entry1.get_field(), "name1=value2", strlen("name1=value2"))) + return die_("entry mismatch"); + printf("OK\n"); + + printf("testing Entry::set_field_value()... "); + if(!entry1.set_field_value("value1", strlen("value1"))) + return die_("returned false"); + if(0 != memcmp(entry1.get_field_value(), "value1", strlen("value1"))) + return die_("value mismatch"); + if(0 != memcmp(entry1.get_field(), "name1=value1", strlen("name1=value1"))) + return die_("entry mismatch"); + printf("OK\n"); + + printf("testing Entry::set_field()... "); + if(!entry1.set_field("name0=value0", strlen("name0=value0"))) + return die_("returned false"); + if(0 != memcmp(entry1.get_field_name(), "name0", strlen("name0"))) + return die_("value mismatch"); + if(0 != memcmp(entry1.get_field_value(), "value0", strlen("value0"))) + return die_("value mismatch"); + if(0 != memcmp(entry1.get_field(), "name0=value0", strlen("name0=value0"))) + return die_("entry mismatch"); + printf("OK\n"); + + printf("PASSED\n\n"); + + + printf("testing class FLAC::Metadata::VorbisComment\n"); + + printf("testing VorbisComment::VorbisComment()... "); + FLAC::Metadata::VorbisComment block; + if(!block.is_valid()) + return die_("!block.is_valid()"); + expected_length = (FLAC__STREAM_METADATA_VORBIS_COMMENT_ENTRY_LENGTH_LEN + FLAC__STREAM_METADATA_VORBIS_COMMENT_NUM_COMMENTS_LEN) / 8; + if(block.get_length() != expected_length) { + printf("FAILED, bad length, expected %u, got %u\n", expected_length, block.get_length()); + return false; + } + printf("OK\n"); + + printf("testing VorbisComment::VorbisComment(const VorbisComment &)... +\n"); + printf(" VorbisComment::operator!=(const VorbisComment &)... "); + { + FLAC::Metadata::VorbisComment blockcopy(block); + if(!blockcopy.is_valid()) + return die_("!block.is_valid()"); + if(blockcopy != block) + return die_("copy is not identical to original"); + printf("OK\n"); + + printf("testing VorbisComment::~VorbisComment()... "); } printf("OK\n"); + printf("testing VorbisComment::VorbisComment(const ::FLAC__StreamMetadata &)... +\n"); + printf(" VorbisComment::operator!=(const ::FLAC__StreamMetadata &)... "); + { + FLAC::Metadata::VorbisComment blockcopy(vorbiscomment_); + if(!blockcopy.is_valid()) + return die_("!block.is_valid()"); + if(blockcopy != vorbiscomment_) + return die_("copy is not identical to original"); + printf("OK\n"); + } + + printf("testing VorbisComment::VorbisComment(const ::FLAC__StreamMetadata *)... +\n"); + printf(" VorbisComment::operator!=(const ::FLAC__StreamMetadata *)... "); + { + FLAC::Metadata::VorbisComment blockcopy(&vorbiscomment_); + if(!blockcopy.is_valid()) + return die_("!block.is_valid()"); + if(blockcopy != vorbiscomment_) + return die_("copy is not identical to original"); + printf("OK\n"); + } + + printf("testing VorbisComment::operator=(const VorbisComment &)... +\n"); + printf(" VorbisComment::operator==(const VorbisComment &)... "); + { + FLAC::Metadata::VorbisComment blockcopy = block; + if(!blockcopy.is_valid()) + return die_("!block.is_valid()"); + if(!(blockcopy == block)) + return die_("copy is not identical to original"); + printf("OK\n"); + } + + printf("testing VorbisComment::operator=(const ::FLAC__StreamMetadata &)... +\n"); + printf(" VorbisComment::operator==(const ::FLAC__StreamMetadata &)... "); + { + FLAC::Metadata::VorbisComment blockcopy = vorbiscomment_; + if(!blockcopy.is_valid()) + return die_("!block.is_valid()"); + if(!(blockcopy == vorbiscomment_)) + return die_("copy is not identical to original"); + printf("OK\n"); + } + + printf("testing VorbisComment::operator=(const ::FLAC__StreamMetadata *)... +\n"); + printf(" VorbisComment::operator==(const ::FLAC__StreamMetadata *)... "); + { + FLAC::Metadata::VorbisComment blockcopy = &vorbiscomment_; + if(!blockcopy.is_valid()) + return die_("!block.is_valid()"); + if(!(blockcopy == vorbiscomment_)) + return die_("copy is not identical to original"); + printf("OK\n"); + } + + printf("testing VorbisComment::get_num_comments()... "); + if(block.get_num_comments() != 0) + return die_("value mismatch, expected 0"); + printf("OK\n"); + + printf("testing VorbisComment::set_vendor_string()... "); + if(!block.set_vendor_string(entry1)) + return die_("returned false"); + printf("OK\n"); + + printf("testing VorbisComment::get_vendor_string()... "); + if(block.get_vendor_string().get_field_name_length() != vorbiscomment_.data.vorbis_comment.vendor_string.length) + return die_("length mismatch"); + if(0 != memcmp(block.get_vendor_string().get_field_name(), vorbiscomment_.data.vorbis_comment.vendor_string.entry, vorbiscomment_.data.vorbis_comment.vendor_string.length)) + return die_("value mismatch"); + printf("OK\n"); + + printf("testing VorbisComment::insert_comment()... +\n"); + printf(" VorbisComment::get_comment()... "); + if(!block.insert_comment(0, entry3)) + return die_("returned false"); + if(block.get_comment(0).get_field_length() != vorbiscomment_.data.vorbis_comment.comments[1].length) + return die_("length mismatch"); + if(0 != memcmp(block.get_comment(0).get_field(), vorbiscomment_.data.vorbis_comment.comments[1].entry, vorbiscomment_.data.vorbis_comment.comments[1].length)) + return die_("value mismatch"); + printf("OK\n"); + + printf("testing VorbisComment::insert_comment()... +\n"); + printf(" VorbisComment::get_comment()... "); + if(!block.insert_comment(0, entry3)) + return die_("returned false"); + if(block.get_comment(0).get_field_length() != vorbiscomment_.data.vorbis_comment.comments[1].length) + return die_("length mismatch"); + if(0 != memcmp(block.get_comment(0).get_field(), vorbiscomment_.data.vorbis_comment.comments[1].entry, vorbiscomment_.data.vorbis_comment.comments[1].length)) + return die_("value mismatch"); + printf("OK\n"); + + printf("testing VorbisComment::insert_comment()... +\n"); + printf(" VorbisComment::get_comment()... "); + if(!block.insert_comment(1, entry2)) + return die_("returned false"); + if(block.get_comment(1).get_field_length() != vorbiscomment_.data.vorbis_comment.comments[0].length) + return die_("length mismatch"); + if(0 != memcmp(block.get_comment(1).get_field(), vorbiscomment_.data.vorbis_comment.comments[0].entry, vorbiscomment_.data.vorbis_comment.comments[0].length)) + return die_("value mismatch"); + printf("OK\n"); + + printf("testing VorbisComment::set_comment()... +\n"); + printf(" VorbisComment::get_comment()... "); + if(!block.set_comment(0, entry2)) + return die_("returned false"); + if(block.get_comment(0).get_field_length() != vorbiscomment_.data.vorbis_comment.comments[0].length) + return die_("length mismatch"); + if(0 != memcmp(block.get_comment(0).get_field(), vorbiscomment_.data.vorbis_comment.comments[0].entry, vorbiscomment_.data.vorbis_comment.comments[0].length)) + return die_("value mismatch"); + printf("OK\n"); + + printf("testing VorbisComment::delete_comment()... +\n"); + printf(" VorbisComment::get_comment()... "); + if(!block.delete_comment(0)) + return die_("returned false"); + if(block.get_comment(0).get_field_length() != vorbiscomment_.data.vorbis_comment.comments[0].length) + return die_("length[0] mismatch"); + if(0 != memcmp(block.get_comment(0).get_field(), vorbiscomment_.data.vorbis_comment.comments[0].entry, vorbiscomment_.data.vorbis_comment.comments[0].length)) + return die_("value[0] mismatch"); + if(block.get_comment(1).get_field_length() != vorbiscomment_.data.vorbis_comment.comments[1].length) + return die_("length[1] mismatch"); + if(0 != memcmp(block.get_comment(1).get_field(), vorbiscomment_.data.vorbis_comment.comments[1].entry, vorbiscomment_.data.vorbis_comment.comments[1].length)) + return die_("value[0] mismatch"); + printf("OK\n"); + + printf("testing FLAC::Metadata::clone(const FLAC::Metadata::Prototype *)... "); + FLAC::Metadata::Prototype *clone_ = clone(&block); + if(0 == clone_) + return die_("returned NULL"); + if(0 == dynamic_cast<FLAC::Metadata::VorbisComment *>(clone_)) + return die_("downcast is NULL"); + if(*dynamic_cast<FLAC::Metadata::VorbisComment *>(clone_) != block) + return die_("clone is not identical"); + printf("OK\n"); + + + printf("PASSED\n\n"); return true; } bool test_metadata_object() { + printf("\n+++ libFLAC++ unit test: metadata objects\n\n"); + init_metadata_blocks_(); if(!test_metadata_object_streaminfo()) return false; + if(!test_metadata_object_padding()) + return false; + + if(!test_metadata_object_application()) + return false; + + if(!test_metadata_object_seektable()) + return false; + + if(!test_metadata_object_vorbiscomment()) + return false; + free_metadata_blocks_(); return true; } - -#if 0 - - - // ============================================================ - // - // Metadata objects - // - // ============================================================ - - // NOTE: When the get_*() methods return you a const pointer, - // DO NOT disobey and write into it. Always use the set_*() - // methods. - - // base class for all metadata blocks - 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 FLAC::Metadata::Prototype &block) - { return ::FLAC__metadata_object_is_equal(object_, block.object_); } - - virtual void clear(); - - ::FLAC__StreamMetaData *object_; - public: - friend class SimpleIterator; - friend class Iterator; - - inline bool is_valid() const { return 0 != object_; } - inline operator bool() const { return is_valid(); } - - bool get_is_last() const; - FLAC__MetaDataType get_type() const; - unsigned get_length() const; // NOTE: does not include the header, per spec - private: - Prototype(); // Private and undefined so you can't use it - - // These are used only by Iterator - bool is_reference_; - inline void set_reference(bool x) { is_reference_ = x; } - }; - - class StreamInfo : public Prototype { - public: - unsigned get_min_blocksize() const; - unsigned get_max_blocksize() const; - unsigned get_min_framesize() const; - unsigned get_max_framesize() const; - unsigned get_sample_rate() const; - unsigned get_channels() const; - unsigned get_bits_per_sample() const; - FLAC__uint64 get_total_samples() const; - const FLAC__byte *get_md5sum() const; - - void set_min_blocksize(unsigned value); - void set_max_blocksize(unsigned value); - void set_min_framesize(unsigned value); - void set_max_framesize(unsigned value); - void set_sample_rate(unsigned value); - void set_channels(unsigned value); - void set_bits_per_sample(unsigned value); - void set_total_samples(FLAC__uint64 value); - void set_md5sum(const FLAC__byte value[16]); - }; - - class Padding : public Prototype { - public: - Padding(); - Padding(::FLAC__StreamMetaData *object, bool copy = false); - ~Padding(); - - inline void operator=(const Padding &object) { Prototype::operator=(object); } - inline void operator=(const ::FLAC__StreamMetaData &object) { Prototype::operator=(object); } - inline void operator=(const ::FLAC__StreamMetaData *object) { Prototype::operator=(object); } - - void set_length(unsigned length); - }; - - class Application : public Prototype { - public: - Application(); - Application(::FLAC__StreamMetaData *object, bool copy = false); - ~Application(); - - inline void operator=(const Application &object) { Prototype::operator=(object); } - inline void operator=(const ::FLAC__StreamMetaData &object) { Prototype::operator=(object); } - inline void operator=(const ::FLAC__StreamMetaData *object) { Prototype::operator=(object); } - - const FLAC__byte *get_id() const; - const FLAC__byte *get_data() const; - - void set_id(FLAC__byte value[4]); - bool set_data(FLAC__byte *data, unsigned length, bool copy = false); - }; - - class SeekTable : public Prototype { - public: - SeekTable(); - SeekTable(::FLAC__StreamMetaData *object, bool copy = false); - ~SeekTable(); - - inline void operator=(const SeekTable &object) { Prototype::operator=(object); } - inline void operator=(const ::FLAC__StreamMetaData &object) { Prototype::operator=(object); } - inline void operator=(const ::FLAC__StreamMetaData *object) { Prototype::operator=(object); } - - unsigned get_num_points() const; - ::FLAC__StreamMetaData_SeekPoint get_point(unsigned index) const; - - void set_point(unsigned index, const ::FLAC__StreamMetaData_SeekPoint &point); - bool insert_point(unsigned index, const ::FLAC__StreamMetaData_SeekPoint &point); - bool delete_point(unsigned index); - - bool is_legal() const; - }; - - class VorbisComment : public Prototype { - public: - class Entry { - public: - Entry(); - Entry(const char *field, unsigned field_length); - Entry(const char *field_name, const char *field_value, unsigned field_value_length); - Entry(const Entry &entry); - void operator=(const Entry &entry); - - 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; - unsigned get_field_value_length() const; - - ::FLAC__StreamMetaData_VorbisComment_Entry get_entry() const; - const char *get_field() const; - const char *get_field_name() const; - const char *get_field_value() const; - - bool set_field(const char *field, unsigned field_length); - bool set_field_name(const char *field_name); - bool set_field_value(const char *field_value, unsigned field_value_length); - protected: - bool is_valid_; - ::FLAC__StreamMetaData_VorbisComment_Entry entry_; - char *field_name_; - unsigned field_name_length_; - char *field_value_; - unsigned field_value_length_; - private: - void zero(); - void clear(); - void clear_entry(); - void clear_field_name(); - void clear_field_value(); - void construct(const char *field, unsigned field_length); - void construct(const char *field_name, const char *field_value, unsigned field_value_length); - void compose_field(); - void parse_field(); - }; - - VorbisComment(); - VorbisComment(::FLAC__StreamMetaData *object, bool copy = false); - ~VorbisComment(); - - inline void operator=(const VorbisComment &object) { Prototype::operator=(object); } - inline void operator=(const ::FLAC__StreamMetaData &object) { Prototype::operator=(object); } - inline void operator=(const ::FLAC__StreamMetaData *object) { Prototype::operator=(object); } - - unsigned get_num_comments() const; - Entry get_vendor_string() const; - Entry get_comment(unsigned index) const; - - bool set_vendor_string(const Entry &entry); - bool set_comment(unsigned index, const Entry &entry); - bool insert_comment(unsigned index, const Entry &entry); - bool delete_comment(unsigned index); - }; - - - - - -#endif diff --git a/src/test_libFLAC/Makefile.vc b/src/test_libFLAC/Makefile.vc index ab6ef534..a4448141 100644 --- a/src/test_libFLAC/Makefile.vc +++ b/src/test_libFLAC/Makefile.vc @@ -19,10 +19,10 @@ !IFDEF DEBUG
.c.obj:
- $(cc) $(cdebug) $(cflags) /I "..\libFLAC\include" /I "..\..\include" /I ".\include" -DSTRICT -DVERSION=\"1.0.3\" -YX /Od /D "_DEBUG" $<
+ $(cc) $(cdebug) $(cflags) /I "..\libFLAC\include" /I "..\..\include" /I ".\include" -DSTRICT -DVERSION=\"1.0.3_beta\" -YX /Od /D "_DEBUG" $<
!else
.c.obj:
- $(cc) /O2 $(crelease) $(cflags) /I "..\libFLAC\include" /I "..\..\include" /I ".\include" -DSTRICT -DVERSION=\"1.0.3\" -YX -DNODEBUG $<
+ $(cc) /O2 $(crelease) $(cflags) /I "..\libFLAC\include" /I "..\..\include" /I ".\include" -DSTRICT -DVERSION=\"1.0.3_beta\" -YX -DNODEBUG $<
!endif
C_FILES= \
diff --git a/src/test_libFLAC/bitbuffer.c b/src/test_libFLAC/bitbuffer.c index e50da77c..55a63700 100644 --- a/src/test_libFLAC/bitbuffer.c +++ b/src/test_libFLAC/bitbuffer.c @@ -56,7 +56,7 @@ FLAC__bool test_bitbuffer() FLAC__ASSERT(FLAC__BITS_PER_BLURB == 8); - printf("\n+++ unit test: bitbuffer\n\n"); + printf("\n+++ libFLAC unit test: bitbuffer\n\n"); printf("testing new... OK\n"); bb = FLAC__bitbuffer_new(); diff --git a/src/test_libFLAC/decoders.c b/src/test_libFLAC/decoders.c index a22dbdc4..09a1720a 100644 --- a/src/test_libFLAC/decoders.c +++ b/src/test_libFLAC/decoders.c @@ -38,8 +38,8 @@ typedef struct { typedef stream_decoder_client_data_struct seekable_stream_decoder_client_data_struct; typedef stream_decoder_client_data_struct file_decoder_client_data_struct; -static FLAC__StreamMetaData streaminfo_, padding_, seektable_, application1_, application2_, vorbiscomment_; -static FLAC__StreamMetaData *expected_metadata_sequence_[6]; +static FLAC__StreamMetadata streaminfo_, padding_, seektable_, application1_, application2_, vorbiscomment_; +static FLAC__StreamMetadata *expected_metadata_sequence_[6]; static unsigned num_expected_; static const char *flacfilename_ = "metadata.flac"; static unsigned flacfilesize_; @@ -128,7 +128,7 @@ static void init_metadata_blocks_() seektable_.type = FLAC__METADATA_TYPE_SEEKTABLE; seektable_.data.seek_table.num_points = 2; seektable_.length = seektable_.data.seek_table.num_points * FLAC__STREAM_METADATA_SEEKPOINT_LENGTH; - seektable_.data.seek_table.points = malloc_or_die_(seektable_.data.seek_table.num_points * sizeof(FLAC__StreamMetaData_SeekPoint)); + seektable_.data.seek_table.points = malloc_or_die_(seektable_.data.seek_table.num_points * sizeof(FLAC__StreamMetadata_SeekPoint)); seektable_.data.seek_table.points[0].sample_number = 0; seektable_.data.seek_table.points[0].stream_offset = 0; seektable_.data.seek_table.points[0].frame_samples = streaminfo_.data.stream_info.min_blocksize; @@ -156,7 +156,7 @@ static void init_metadata_blocks_() vorbiscomment_.data.vorbis_comment.vendor_string.entry = malloc_or_die_(8); memcpy(vorbiscomment_.data.vorbis_comment.vendor_string.entry, "flac 1.x", 8); vorbiscomment_.data.vorbis_comment.num_comments = 2; - vorbiscomment_.data.vorbis_comment.comments = malloc_or_die_(vorbiscomment_.data.vorbis_comment.num_comments * sizeof(FLAC__StreamMetaData_VorbisComment_Entry)); + vorbiscomment_.data.vorbis_comment.comments = malloc_or_die_(vorbiscomment_.data.vorbis_comment.num_comments * sizeof(FLAC__StreamMetadata_VorbisComment_Entry)); vorbiscomment_.data.vorbis_comment.comments[0].length = 5; vorbiscomment_.data.vorbis_comment.comments[0].entry = malloc_or_die_(5); memcpy(vorbiscomment_.data.vorbis_comment.comments[0].entry, "ab=cd", 5); @@ -248,7 +248,7 @@ static FLAC__StreamDecoderWriteStatus stream_decoder_write_callback_(const FLAC_ return FLAC__STREAM_DECODER_WRITE_STATUS_CONTINUE; } -static void stream_decoder_metadata_callback_(const FLAC__StreamDecoder *decoder, const FLAC__StreamMetaData *metadata, void *client_data) +static void stream_decoder_metadata_callback_(const FLAC__StreamDecoder *decoder, const FLAC__StreamMetadata *metadata, void *client_data) { stream_decoder_client_data_struct *dcd = (stream_decoder_client_data_struct*)client_data; @@ -342,7 +342,7 @@ static FLAC__bool test_stream_decoder() FLAC__StreamDecoderState state; stream_decoder_client_data_struct decoder_client_data; - printf("\n+++ unit test: FLAC__StreamDecoder\n\n"); + printf("\n+++ libFLAC unit test: FLAC__StreamDecoder\n\n"); num_expected_ = 0; expected_metadata_sequence_[num_expected_++] = &streaminfo_; @@ -895,7 +895,7 @@ static FLAC__StreamDecoderWriteStatus seekable_stream_decoder_write_callback_(co return stream_decoder_write_callback_(0, frame, buffer, client_data); } -static void seekable_stream_decoder_metadata_callback_(const FLAC__SeekableStreamDecoder *decoder, const FLAC__StreamMetaData *metadata, void *client_data) +static void seekable_stream_decoder_metadata_callback_(const FLAC__SeekableStreamDecoder *decoder, const FLAC__StreamMetadata *metadata, void *client_data) { (void)decoder; stream_decoder_metadata_callback_(0, metadata, client_data); @@ -969,7 +969,7 @@ static FLAC__bool test_seekable_stream_decoder() FLAC__SeekableStreamDecoderState state; seekable_stream_decoder_client_data_struct decoder_client_data; - printf("\n+++ unit test: FLAC__SeekableStreamDecoder\n\n"); + printf("\n+++ libFLAC unit test: FLAC__SeekableStreamDecoder\n\n"); num_expected_ = 0; expected_metadata_sequence_[num_expected_++] = &streaminfo_; @@ -1458,7 +1458,7 @@ static FLAC__StreamDecoderWriteStatus file_decoder_write_callback_(const FLAC__F return stream_decoder_write_callback_(0, frame, buffer, client_data); } -static void file_decoder_metadata_callback_(const FLAC__FileDecoder *decoder, const FLAC__StreamMetaData *metadata, void *client_data) +static void file_decoder_metadata_callback_(const FLAC__FileDecoder *decoder, const FLAC__StreamMetadata *metadata, void *client_data) { (void)decoder; stream_decoder_metadata_callback_(0, metadata, client_data); @@ -1515,7 +1515,7 @@ static FLAC__bool test_file_decoder() FLAC__FileDecoderState state; seekable_stream_decoder_client_data_struct decoder_client_data; - printf("\n+++ unit test: FLAC__FileDecoder\n\n"); + printf("\n+++ libFLAC unit test: FLAC__FileDecoder\n\n"); num_expected_ = 0; expected_metadata_sequence_[num_expected_++] = &streaminfo_; diff --git a/src/test_libFLAC/encoders.c b/src/test_libFLAC/encoders.c index c2343857..7425aea3 100644 --- a/src/test_libFLAC/encoders.c +++ b/src/test_libFLAC/encoders.c @@ -24,8 +24,8 @@ #include <stdlib.h> #include <string.h> -static FLAC__StreamMetaData streaminfo_, padding_, seektable_, application1_, application2_, vorbiscomment_; -static FLAC__StreamMetaData *metadata_sequence_[] = { &padding_, &seektable_, &application1_, &application2_, &vorbiscomment_ }; +static FLAC__StreamMetadata streaminfo_, padding_, seektable_, application1_, application2_, vorbiscomment_; +static FLAC__StreamMetadata *metadata_sequence_[] = { &padding_, &seektable_, &application1_, &application2_, &vorbiscomment_ }; static const unsigned num_metadata_ = 5; static const char *flacfilename_ = "metadata.flac"; @@ -83,7 +83,7 @@ static void init_metadata_blocks_() seektable_.type = FLAC__METADATA_TYPE_SEEKTABLE; seektable_.data.seek_table.num_points = 2; seektable_.length = seektable_.data.seek_table.num_points * FLAC__STREAM_METADATA_SEEKPOINT_LENGTH; - seektable_.data.seek_table.points = malloc_or_die_(seektable_.data.seek_table.num_points * sizeof(FLAC__StreamMetaData_SeekPoint)); + seektable_.data.seek_table.points = malloc_or_die_(seektable_.data.seek_table.num_points * sizeof(FLAC__StreamMetadata_SeekPoint)); seektable_.data.seek_table.points[0].sample_number = 0; seektable_.data.seek_table.points[0].stream_offset = 0; seektable_.data.seek_table.points[0].frame_samples = streaminfo_.data.stream_info.min_blocksize; @@ -111,7 +111,7 @@ static void init_metadata_blocks_() vorbiscomment_.data.vorbis_comment.vendor_string.entry = malloc_or_die_(8); memcpy(vorbiscomment_.data.vorbis_comment.vendor_string.entry, "flac 1.x", 8); vorbiscomment_.data.vorbis_comment.num_comments = 2; - vorbiscomment_.data.vorbis_comment.comments = malloc_or_die_(vorbiscomment_.data.vorbis_comment.num_comments * sizeof(FLAC__StreamMetaData_VorbisComment_Entry)); + vorbiscomment_.data.vorbis_comment.comments = malloc_or_die_(vorbiscomment_.data.vorbis_comment.num_comments * sizeof(FLAC__StreamMetadata_VorbisComment_Entry)); vorbiscomment_.data.vorbis_comment.comments[0].length = 5; vorbiscomment_.data.vorbis_comment.comments[0].entry = malloc_or_die_(5); memcpy(vorbiscomment_.data.vorbis_comment.comments[0].entry, "ab=cd", 5); @@ -134,7 +134,7 @@ static FLAC__StreamEncoderWriteStatus encoder_write_callback_(const FLAC__Stream return FLAC__STREAM_ENCODER_WRITE_OK; } -static void encoder_metadata_callback_(const FLAC__StreamEncoder *encoder, const FLAC__StreamMetaData *metadata, void *client_data) +static void encoder_metadata_callback_(const FLAC__StreamEncoder *encoder, const FLAC__StreamMetadata *metadata, void *client_data) { (void)encoder, (void)metadata, (void)client_data; } @@ -147,7 +147,7 @@ static FLAC__bool test_stream_encoder() FLAC__int32 *samples_array[1] = { samples }; unsigned i; - printf("\n+++ unit test: FLAC__StreamEncoder\n\n"); + printf("\n+++ libFLAC unit test: FLAC__StreamEncoder\n\n"); printf("testing FLAC__stream_encoder_new()... "); encoder = FLAC__stream_encoder_new(); diff --git a/src/test_libFLAC/file_utils.c b/src/test_libFLAC/file_utils.c index 31f80639..e7fb6a9a 100644 --- a/src/test_libFLAC/file_utils.c +++ b/src/test_libFLAC/file_utils.c @@ -51,7 +51,7 @@ static FLAC__StreamEncoderWriteStatus encoder_write_callback_(const FLAC__Stream return FLAC__STREAM_ENCODER_WRITE_OK; } -static void encoder_metadata_callback_(const FLAC__StreamEncoder *encoder, const FLAC__StreamMetaData *metadata, void *client_data) +static void encoder_metadata_callback_(const FLAC__StreamEncoder *encoder, const FLAC__StreamMetadata *metadata, void *client_data) { (void)encoder, (void)metadata, (void)client_data; } @@ -92,7 +92,7 @@ FLAC__bool file_utils__remove_file(const char *filename) return file_utils__change_stats(filename, /*read_only=*/false) && 0 == unlink(filename); } -FLAC__bool file_utils__generate_flacfile(const char *output_filename, unsigned *output_filesize, unsigned length, const FLAC__StreamMetaData *streaminfo, FLAC__StreamMetaData **metadata, unsigned num_metadata) +FLAC__bool file_utils__generate_flacfile(const char *output_filename, unsigned *output_filesize, unsigned length, const FLAC__StreamMetadata *streaminfo, FLAC__StreamMetadata **metadata, unsigned num_metadata) { FLAC__int32 samples[1024]; FLAC__StreamEncoder *encoder; diff --git a/src/test_libFLAC/file_utils.h b/src/test_libFLAC/file_utils.h index 5944187c..851992ea 100644 --- a/src/test_libFLAC/file_utils.h +++ b/src/test_libFLAC/file_utils.h @@ -25,6 +25,6 @@ FLAC__bool file_utils__change_stats(const char *filename, FLAC__bool read_only); FLAC__bool file_utils__remove_file(const char *filename); -FLAC__bool file_utils__generate_flacfile(const char *output_filename, unsigned *output_filesize, unsigned length, const FLAC__StreamMetaData *streaminfo, FLAC__StreamMetaData **metadata, unsigned num_metadata); +FLAC__bool file_utils__generate_flacfile(const char *output_filename, unsigned *output_filesize, unsigned length, const FLAC__StreamMetadata *streaminfo, FLAC__StreamMetadata **metadata, unsigned num_metadata); #endif diff --git a/src/test_libFLAC/matrix b/src/test_libFLAC/matrix index 57fae25b..a78ecf3a 100644 --- a/src/test_libFLAC/matrix +++ b/src/test_libFLAC/matrix @@ -42,8 +42,8 @@ d use_padding, last block is not padding, delta is < 4 e use_padding, last block is not padding, delta is >= 4 f use_padding, last block is padding -void FLAC__metadata_chain_merge_padding(FLAC__MetaData_Chain *chain); -void FLAC__metadata_chain_sort_padding(FLAC__MetaData_Chain *chain); +void FLAC__metadata_chain_merge_padding(FLAC__Metadata_Chain *chain); +void FLAC__metadata_chain_sort_padding(FLAC__Metadata_Chain *chain); S:34 A:1234 a:shrink A->30 write nopad diff --git a/src/test_libFLAC/metadata_manip.c b/src/test_libFLAC/metadata_manip.c index fc7ae3dc..8aebd8a2 100644 --- a/src/test_libFLAC/metadata_manip.c +++ b/src/test_libFLAC/metadata_manip.c @@ -31,7 +31,7 @@ after each operation. Then testing becomes a simple matter of running a FLAC__FileDecoder over the dummy file after each operation, comparing the decoded metadata to what's in our local copy. If there are any - differences in the metadata, or the actual audio data is corrupted, we + differences in the metadata, or the actual audio data is corrupted, we will catch it while decoding. ******************************************************************************/ @@ -40,7 +40,7 @@ typedef struct { } decoder_client_struct; typedef struct { - FLAC__StreamMetaData *blocks[64]; + FLAC__StreamMetadata *blocks[64]; unsigned num_blocks; } our_metadata_struct; @@ -58,30 +58,30 @@ static FLAC__bool die_(const char *msg) return false; } -static FLAC__bool die_c_(const char *msg, FLAC__MetaData_ChainStatus status) +static FLAC__bool die_c_(const char *msg, FLAC__Metadata_ChainStatus status) { printf("ERROR: %s\n", msg); - printf(" status=%s\n", FLAC__MetaData_ChainStatusString[status]); + printf(" status=%s\n", FLAC__Metadata_ChainStatusString[status]); return false; } -static FLAC__bool die_ss_(const char *msg, FLAC__MetaData_SimpleIterator *siterator) +static FLAC__bool die_ss_(const char *msg, FLAC__Metadata_SimpleIterator *iterator) { printf("ERROR: %s\n", msg); - printf(" status=%s\n", FLAC__MetaData_SimpleIteratorStatusString[FLAC__metadata_simple_iterator_status(siterator)]); + printf(" status=%s\n", FLAC__Metadata_SimpleIteratorStatusString[FLAC__metadata_simple_iterator_status(iterator)]); return false; } /* functions for working with our metadata copy */ -static FLAC__bool replace_in_our_metadata_(FLAC__StreamMetaData *block, unsigned position, FLAC__bool copy) +static FLAC__bool replace_in_our_metadata_(FLAC__StreamMetadata *block, unsigned position, FLAC__bool copy) { unsigned i; - FLAC__StreamMetaData *obj = block; + FLAC__StreamMetadata *obj = block; FLAC__ASSERT(position < our_metadata_.num_blocks); if(copy) { - if(0 == (obj = FLAC__metadata_object_copy(block))) - return die_("during FLAC__metadata_object_copy()"); + if(0 == (obj = FLAC__metadata_object_clone(block))) + return die_("during FLAC__metadata_object_clone()"); } FLAC__metadata_object_delete(our_metadata_.blocks[position]); our_metadata_.blocks[position] = obj; @@ -94,13 +94,13 @@ static FLAC__bool replace_in_our_metadata_(FLAC__StreamMetaData *block, unsigned return true; } -static FLAC__bool insert_to_our_metadata_(FLAC__StreamMetaData *block, unsigned position, FLAC__bool copy) +static FLAC__bool insert_to_our_metadata_(FLAC__StreamMetadata *block, unsigned position, FLAC__bool copy) { unsigned i; - FLAC__StreamMetaData *obj = block; + FLAC__StreamMetadata *obj = block; if(copy) { - if(0 == (obj = FLAC__metadata_object_copy(block))) - return die_("during FLAC__metadata_object_copy()"); + if(0 == (obj = FLAC__metadata_object_clone(block))) + return die_("during FLAC__metadata_object_clone()"); } if(position > our_metadata_.num_blocks) { position = our_metadata_.num_blocks; @@ -137,13 +137,13 @@ static void delete_from_our_metadata_(unsigned position) } } -/* function for comparing our metadata to a FLAC__MetaData_Chain */ +/* function for comparing our metadata to a FLAC__Metadata_Chain */ -static FLAC__bool compare_chain_(FLAC__MetaData_Chain *chain, unsigned current_position, FLAC__StreamMetaData *current_block) +static FLAC__bool compare_chain_(FLAC__Metadata_Chain *chain, unsigned current_position, FLAC__StreamMetadata *current_block) { unsigned i; - FLAC__MetaData_Iterator *iterator; - FLAC__StreamMetaData *block; + FLAC__Metadata_Iterator *iterator; + FLAC__StreamMetadata *block; FLAC__bool next_ok = true; FLAC__ASSERT(0 != chain); @@ -213,17 +213,8 @@ static FLAC__StreamDecoderWriteStatus decoder_write_callback_(const FLAC__FileDe return FLAC__STREAM_DECODER_WRITE_STATUS_CONTINUE; } -static void decoder_error_callback_(const FLAC__FileDecoder *decoder, FLAC__StreamDecoderErrorStatus status, void *client_data) -{ - decoder_client_struct *dcd = (decoder_client_struct*)client_data; - (void)decoder; - - dcd->error_occurred = true; - printf("ERROR: got error callback, status = %s (%u)\n", FLAC__StreamDecoderErrorStatusString[status], (unsigned)status); -} - /* this version pays no attention to the metadata */ -static void decoder_metadata_callback_null_(const FLAC__FileDecoder *decoder, const FLAC__StreamMetaData *metadata, void *client_data) +static void decoder_metadata_callback_null_(const FLAC__FileDecoder *decoder, const FLAC__StreamMetadata *metadata, void *client_data) { (void)decoder, (void)metadata, (void)client_data; @@ -234,7 +225,7 @@ static void decoder_metadata_callback_null_(const FLAC__FileDecoder *decoder, co } /* this version is used when we want to compare to our metadata copy */ -static void decoder_metadata_callback_compare_(const FLAC__FileDecoder *decoder, const FLAC__StreamMetaData *metadata, void *client_data) +static void decoder_metadata_callback_compare_(const FLAC__FileDecoder *decoder, const FLAC__StreamMetadata *metadata, void *client_data) { decoder_client_struct *dcd = (decoder_client_struct*)client_data; @@ -260,10 +251,19 @@ static void decoder_metadata_callback_compare_(const FLAC__FileDecoder *decoder, mc_our_block_number_++; } +static void decoder_error_callback_(const FLAC__FileDecoder *decoder, FLAC__StreamDecoderErrorStatus status, void *client_data) +{ + decoder_client_struct *dcd = (decoder_client_struct*)client_data; + (void)decoder; + + dcd->error_occurred = true; + printf("ERROR: got error callback, status = %s (%u)\n", FLAC__StreamDecoderErrorStatusString[status], (unsigned)status); +} + static FLAC__bool generate_file_() { - FLAC__StreamMetaData streaminfo, padding; - FLAC__StreamMetaData *metadata[1]; + FLAC__StreamMetadata streaminfo, padding; + FLAC__StreamMetadata *metadata[1]; printf("generating FLAC file for test\n"); @@ -298,7 +298,7 @@ static FLAC__bool generate_file_() return true; } -static FLAC__bool test_file_(const char *filename, void (*metadata_callback)(const FLAC__FileDecoder *decoder, const FLAC__StreamMetaData *metadata, void *client_data)) +static FLAC__bool test_file_(const char *filename, void (*metadata_callback)(const FLAC__FileDecoder *decoder, const FLAC__StreamMetadata *metadata, void *client_data)) { FLAC__FileDecoder *decoder; decoder_client_struct decoder_client_data; @@ -313,7 +313,7 @@ static FLAC__bool test_file_(const char *filename, void (*metadata_callback)(con fflush(stdout); if(0 == (decoder = FLAC__file_decoder_new())) - return die_("couldn't allocate memory"); + return die_("couldn't allocate decoder instance"); FLAC__file_decoder_set_md5_checking(decoder, true); FLAC__file_decoder_set_filename(decoder, filename); @@ -367,7 +367,7 @@ static FLAC__bool remove_file_(const char *filename) static FLAC__bool test_level_0_() { - FLAC__StreamMetaData_StreamInfo streaminfo; + FLAC__StreamMetadata_StreamInfo streaminfo; printf("\n\n++++++ testing level 0 interface\n"); @@ -400,8 +400,8 @@ static FLAC__bool test_level_0_() static FLAC__bool test_level_1_() { - FLAC__MetaData_SimpleIterator *siterator; - FLAC__StreamMetaData *block, *app, *padding; + FLAC__Metadata_SimpleIterator *iterator; + FLAC__StreamMetadata *block, *app, *padding; FLAC__byte data[1000]; unsigned our_current_position = 0; @@ -420,21 +420,21 @@ static FLAC__bool test_level_1_() if(!test_file_(flacfile_, decoder_metadata_callback_null_)) return false; - if(0 == (siterator = FLAC__metadata_simple_iterator_new())) + if(0 == (iterator = FLAC__metadata_simple_iterator_new())) return die_("FLAC__metadata_simple_iterator_new()"); - if(!FLAC__metadata_simple_iterator_init(siterator, flacfile_, false)) - return die_("ERROR: FLAC__metadata_simple_iterator_init()\n"); + if(!FLAC__metadata_simple_iterator_init(iterator, flacfile_, false)) + return die_("FLAC__metadata_simple_iterator_init() returned false"); - printf("is writable = %u\n", (unsigned)FLAC__metadata_simple_iterator_is_writable(siterator)); - if(FLAC__metadata_simple_iterator_is_writable(siterator)) + printf("is writable = %u\n", (unsigned)FLAC__metadata_simple_iterator_is_writable(iterator)); + if(FLAC__metadata_simple_iterator_is_writable(iterator)) return die_("iterator claims file is writable when it should not be\n"); printf("iterate forwards\n"); - if(FLAC__metadata_simple_iterator_get_block_type(siterator) != FLAC__METADATA_TYPE_STREAMINFO) + if(FLAC__metadata_simple_iterator_get_block_type(iterator) != FLAC__METADATA_TYPE_STREAMINFO) return die_("expected STREAMINFO type from FLAC__metadata_simple_iterator_get_block_type()"); - if(0 == (block = FLAC__metadata_simple_iterator_get_block(siterator))) + if(0 == (block = FLAC__metadata_simple_iterator_get_block(iterator))) return die_("getting block 0"); if(block->type != FLAC__METADATA_TYPE_STREAMINFO) return die_("expected STREAMINFO type"); @@ -454,13 +454,13 @@ static FLAC__bool test_level_1_() if(block->data.stream_info.max_blocksize != 576) return die_("mismatch in max_blocksize"); - if(!FLAC__metadata_simple_iterator_next(siterator)) + if(!FLAC__metadata_simple_iterator_next(iterator)) return die_("forward iterator ended early"); our_current_position++; - if(FLAC__metadata_simple_iterator_get_block_type(siterator) != FLAC__METADATA_TYPE_PADDING) + if(FLAC__metadata_simple_iterator_get_block_type(iterator) != FLAC__METADATA_TYPE_PADDING) return die_("expected PADDING type from FLAC__metadata_simple_iterator_get_block_type()"); - if(0 == (block = FLAC__metadata_simple_iterator_get_block(siterator))) + if(0 == (block = FLAC__metadata_simple_iterator_get_block(iterator))) return die_("getting block 1"); if(block->type != FLAC__METADATA_TYPE_PADDING) return die_("expected PADDING type"); @@ -468,25 +468,25 @@ static FLAC__bool test_level_1_() return die_("expected is_last to be true"); /* check to see if some basic data matches (c.f. generate_file_()) */ if(block->length != 1234) - return die_("bad STREAMINFO length"); + return die_("bad PADDING length"); - if(FLAC__metadata_simple_iterator_next(siterator)) + if(FLAC__metadata_simple_iterator_next(iterator)) return die_("forward iterator returned true but should have returned false"); printf("iterate backwards\n"); - if(!FLAC__metadata_simple_iterator_prev(siterator)) + if(!FLAC__metadata_simple_iterator_prev(iterator)) return die_("reverse iterator ended early"); - if(FLAC__metadata_simple_iterator_prev(siterator)) + if(FLAC__metadata_simple_iterator_prev(iterator)) return die_("reverse iterator returned true but should have returned false"); printf("testing FLAC__metadata_simple_iterator_set_block() on read-only file...\n"); - if(!FLAC__metadata_simple_iterator_set_block(siterator, (FLAC__StreamMetaData*)99, false)) + if(!FLAC__metadata_simple_iterator_set_block(iterator, (FLAC__StreamMetadata*)99, false)) printf("PASSED. FLAC__metadata_simple_iterator_set_block() returned false like it should\n"); else return die_("FLAC__metadata_simple_iterator_set_block() returned true but shouldn't have"); - FLAC__metadata_simple_iterator_delete(siterator); + FLAC__metadata_simple_iterator_delete(iterator); /************************************************************/ @@ -507,47 +507,47 @@ static FLAC__bool test_level_1_() return die_("FLAC__metadata_object_new(FLAC__METADATA_TYPE_PADDING)"); padding->length = 20; - if(0 == (siterator = FLAC__metadata_simple_iterator_new())) + if(0 == (iterator = FLAC__metadata_simple_iterator_new())) return die_("FLAC__metadata_simple_iterator_new()"); - if(!FLAC__metadata_simple_iterator_init(siterator, flacfile_, /*preserve_file_stats=*/false)) - return die_("ERROR: FLAC__metadata_simple_iterator_init()\n"); + if(!FLAC__metadata_simple_iterator_init(iterator, flacfile_, /*preserve_file_stats=*/false)) + return die_("FLAC__metadata_simple_iterator_init() returned false"); our_current_position = 0; - printf("is writable = %u\n", (unsigned)FLAC__metadata_simple_iterator_is_writable(siterator)); + printf("is writable = %u\n", (unsigned)FLAC__metadata_simple_iterator_is_writable(iterator)); printf("[S]P\ttry to write over STREAMINFO block...\n"); - if(!FLAC__metadata_simple_iterator_set_block(siterator, app, false)) + if(!FLAC__metadata_simple_iterator_set_block(iterator, app, false)) printf("\tFLAC__metadata_simple_iterator_set_block() returned false like it should\n"); else return die_("FLAC__metadata_simple_iterator_set_block() returned true but shouldn't have"); printf("[S]P\tnext\n"); - if(!FLAC__metadata_simple_iterator_next(siterator)) + if(!FLAC__metadata_simple_iterator_next(iterator)) return die_("iterator ended early\n"); our_current_position++; printf("S[P]\tinsert PADDING after, don't expand into padding\n"); padding->length = 25; - if(!FLAC__metadata_simple_iterator_insert_block_after(siterator, padding, false)) - return die_ss_("FLAC__metadata_simple_iterator_insert_block_after(siterator, padding, false)", siterator); + if(!FLAC__metadata_simple_iterator_insert_block_after(iterator, padding, false)) + return die_ss_("FLAC__metadata_simple_iterator_insert_block_after(iterator, padding, false)", iterator); if(!insert_to_our_metadata_(padding, ++our_current_position, /*copy=*/true)) return false; printf("SP[P]\tprev\n"); - if(!FLAC__metadata_simple_iterator_prev(siterator)) + if(!FLAC__metadata_simple_iterator_prev(iterator)) return die_("iterator ended early\n"); our_current_position--; printf("S[P]P\tprev\n"); - if(!FLAC__metadata_simple_iterator_prev(siterator)) + if(!FLAC__metadata_simple_iterator_prev(iterator)) return die_("iterator ended early\n"); our_current_position--; printf("[S]PP\tinsert PADDING after, don't expand into padding\n"); padding->length = 30; - if(!FLAC__metadata_simple_iterator_insert_block_after(siterator, padding, false)) - return die_ss_("FLAC__metadata_simple_iterator_insert_block_after(siterator, padding, false)", siterator); + if(!FLAC__metadata_simple_iterator_insert_block_after(iterator, padding, false)) + return die_ss_("FLAC__metadata_simple_iterator_insert_block_after(iterator, padding, false)", iterator); if(!insert_to_our_metadata_(padding, ++our_current_position, /*copy=*/true)) return false; @@ -555,84 +555,84 @@ static FLAC__bool test_level_1_() return false; printf("S[P]PP\tprev\n"); - if(!FLAC__metadata_simple_iterator_prev(siterator)) + if(!FLAC__metadata_simple_iterator_prev(iterator)) return die_("iterator ended early\n"); our_current_position--; printf("[S]PPP\tdelete (STREAMINFO block), must fail\n"); - if(FLAC__metadata_simple_iterator_delete_block(siterator, false)) - return die_ss_("FLAC__metadata_simple_iterator_delete_block(siterator, false) should have returned false", siterator); + if(FLAC__metadata_simple_iterator_delete_block(iterator, false)) + return die_ss_("FLAC__metadata_simple_iterator_delete_block(iterator, false) should have returned false", iterator); if(!test_file_(flacfile_, decoder_metadata_callback_compare_)) return false; printf("[S]PPP\tnext\n"); - if(!FLAC__metadata_simple_iterator_next(siterator)) + if(!FLAC__metadata_simple_iterator_next(iterator)) return die_("iterator ended early\n"); our_current_position++; printf("S[P]PP\tdelete (middle block), replace with padding\n"); - if(!FLAC__metadata_simple_iterator_delete_block(siterator, true)) - return die_ss_("FLAC__metadata_simple_iterator_delete_block(siterator, true)", siterator); + if(!FLAC__metadata_simple_iterator_delete_block(iterator, true)) + return die_ss_("FLAC__metadata_simple_iterator_delete_block(iterator, true)", iterator); our_current_position--; printf("[S]PPP\tnext\n"); - if(!FLAC__metadata_simple_iterator_next(siterator)) + if(!FLAC__metadata_simple_iterator_next(iterator)) return die_("iterator ended early\n"); our_current_position++; printf("S[P]PP\tdelete (middle block), don't replace with padding\n"); - if(!FLAC__metadata_simple_iterator_delete_block(siterator, false)) - return die_ss_("FLAC__metadata_simple_iterator_delete_block(siterator, false)", siterator); + if(!FLAC__metadata_simple_iterator_delete_block(iterator, false)) + return die_ss_("FLAC__metadata_simple_iterator_delete_block(iterator, false)", iterator); delete_from_our_metadata_(our_current_position--); if(!test_file_(flacfile_, decoder_metadata_callback_compare_)) return false; printf("[S]PP\tnext\n"); - if(!FLAC__metadata_simple_iterator_next(siterator)) + if(!FLAC__metadata_simple_iterator_next(iterator)) return die_("iterator ended early\n"); our_current_position++; printf("S[P]P\tnext\n"); - if(!FLAC__metadata_simple_iterator_next(siterator)) + if(!FLAC__metadata_simple_iterator_next(iterator)) return die_("iterator ended early\n"); our_current_position++; printf("SP[P]\tdelete (last block), replace with padding\n"); - if(!FLAC__metadata_simple_iterator_delete_block(siterator, true)) - return die_ss_("FLAC__metadata_simple_iterator_delete_block(siterator, false)", siterator); + if(!FLAC__metadata_simple_iterator_delete_block(iterator, true)) + return die_ss_("FLAC__metadata_simple_iterator_delete_block(iterator, false)", iterator); our_current_position--; if(!test_file_(flacfile_, decoder_metadata_callback_compare_)) return false; printf("S[P]P\tnext\n"); - if(!FLAC__metadata_simple_iterator_next(siterator)) + if(!FLAC__metadata_simple_iterator_next(iterator)) return die_("iterator ended early\n"); our_current_position++; printf("SP[P]\tdelete (last block), don't replace with padding\n"); - if(!FLAC__metadata_simple_iterator_delete_block(siterator, false)) - return die_ss_("FLAC__metadata_simple_iterator_delete_block(siterator, false)", siterator); + if(!FLAC__metadata_simple_iterator_delete_block(iterator, false)) + return die_ss_("FLAC__metadata_simple_iterator_delete_block(iterator, false)", iterator); delete_from_our_metadata_(our_current_position--); if(!test_file_(flacfile_, decoder_metadata_callback_compare_)) return false; printf("S[P]\tprev\n"); - if(!FLAC__metadata_simple_iterator_prev(siterator)) + if(!FLAC__metadata_simple_iterator_prev(iterator)) return die_("iterator ended early\n"); our_current_position--; printf("[S]P\tset STREAMINFO (change sample rate)\n"); FLAC__ASSERT(our_current_position == 0); - block = FLAC__metadata_simple_iterator_get_block(siterator); + block = FLAC__metadata_simple_iterator_get_block(iterator); block->data.stream_info.sample_rate = 32000; if(!replace_in_our_metadata_(block, our_current_position, /*copy=*/true)) return die_("copying object"); - if(!FLAC__metadata_simple_iterator_set_block(siterator, block, false)) - return die_ss_("FLAC__metadata_simple_iterator_set_block(siterator, block, false)", siterator); + if(!FLAC__metadata_simple_iterator_set_block(iterator, block, false)) + return die_ss_("FLAC__metadata_simple_iterator_set_block(iterator, block, false)", iterator); FLAC__metadata_object_delete(block); if(!test_file_(flacfile_, decoder_metadata_callback_compare_)) @@ -640,8 +640,8 @@ static FLAC__bool test_level_1_() printf("[S]P\tinsert APPLICATION after, expand into padding of exceeding size\n"); app->data.application.id[0] = 'e'; /* twiddle the id so that our comparison doesn't miss transposition */ - if(!FLAC__metadata_simple_iterator_insert_block_after(siterator, app, true)) - return die_ss_("FLAC__metadata_simple_iterator_insert_block_after(siterator, app, true)", siterator); + if(!FLAC__metadata_simple_iterator_insert_block_after(iterator, app, true)) + return die_ss_("FLAC__metadata_simple_iterator_insert_block_after(iterator, app, true)", iterator); if(!insert_to_our_metadata_(app, ++our_current_position, /*copy=*/true)) return false; our_metadata_.blocks[our_current_position+1]->length -= (FLAC__STREAM_METADATA_APPLICATION_ID_LEN/8) + app->length; @@ -650,14 +650,14 @@ static FLAC__bool test_level_1_() return false; printf("S[A]P\tnext\n"); - if(!FLAC__metadata_simple_iterator_next(siterator)) + if(!FLAC__metadata_simple_iterator_next(iterator)) return die_("iterator ended early\n"); our_current_position++; printf("SA[P]\tset APPLICATION, expand into padding of exceeding size\n"); app->data.application.id[0] = 'f'; /* twiddle the id */ - if(!FLAC__metadata_simple_iterator_set_block(siterator, app, true)) - return die_ss_("FLAC__metadata_simple_iterator_set_block(siterator, app, true)", siterator); + if(!FLAC__metadata_simple_iterator_set_block(iterator, app, true)) + return die_ss_("FLAC__metadata_simple_iterator_set_block(iterator, app, true)", iterator); if(!insert_to_our_metadata_(app, our_current_position, /*copy=*/true)) return false; our_metadata_.blocks[our_current_position+1]->length -= (FLAC__STREAM_METADATA_APPLICATION_ID_LEN/8) + app->length; @@ -671,8 +671,8 @@ static FLAC__bool test_level_1_() return die_("setting APPLICATION data"); if(!replace_in_our_metadata_(app, our_current_position, /*copy=*/true)) return die_("copying object"); - if(!FLAC__metadata_simple_iterator_set_block(siterator, app, false)) - return die_ss_("FLAC__metadata_simple_iterator_set_block(siterator, app, false)", siterator); + if(!FLAC__metadata_simple_iterator_set_block(iterator, app, false)) + return die_ss_("FLAC__metadata_simple_iterator_set_block(iterator, app, false)", iterator); if(!test_file_(flacfile_, decoder_metadata_callback_compare_)) return false; @@ -683,8 +683,8 @@ static FLAC__bool test_level_1_() return die_("setting APPLICATION data"); if(!replace_in_our_metadata_(app, our_current_position, /*copy=*/true)) return die_("copying object"); - if(!FLAC__metadata_simple_iterator_set_block(siterator, app, false)) - return die_ss_("FLAC__metadata_simple_iterator_set_block(siterator, app, false)", siterator); + if(!FLAC__metadata_simple_iterator_set_block(iterator, app, false)) + return die_ss_("FLAC__metadata_simple_iterator_set_block(iterator, app, false)", iterator); if(!test_file_(flacfile_, decoder_metadata_callback_compare_)) return false; @@ -696,8 +696,8 @@ static FLAC__bool test_level_1_() if(!replace_in_our_metadata_(app, our_current_position, /*copy=*/true)) return die_("copying object"); our_metadata_.blocks[our_current_position+1]->length -= (sizeof(data) - 12); - if(!FLAC__metadata_simple_iterator_set_block(siterator, app, true)) - return die_ss_("FLAC__metadata_simple_iterator_set_block(siterator, app, true)", siterator); + if(!FLAC__metadata_simple_iterator_set_block(iterator, app, true)) + return die_ss_("FLAC__metadata_simple_iterator_set_block(iterator, app, true)", iterator); if(!test_file_(flacfile_, decoder_metadata_callback_compare_)) return false; @@ -711,19 +711,19 @@ static FLAC__bool test_level_1_() if(!insert_to_our_metadata_(padding, our_current_position+1, /*copy=*/true)) return die_("copying object"); our_metadata_.blocks[our_current_position+1]->length = sizeof(data) - 23 - FLAC__STREAM_METADATA_HEADER_LENGTH; - if(!FLAC__metadata_simple_iterator_set_block(siterator, app, true)) - return die_ss_("FLAC__metadata_simple_iterator_set_block(siterator, app, true)", siterator); + if(!FLAC__metadata_simple_iterator_set_block(iterator, app, true)) + return die_ss_("FLAC__metadata_simple_iterator_set_block(iterator, app, true)", iterator); if(!test_file_(flacfile_, decoder_metadata_callback_compare_)) return false; printf("SA[A]PP\tnext\n"); - if(!FLAC__metadata_simple_iterator_next(siterator)) + if(!FLAC__metadata_simple_iterator_next(iterator)) return die_("iterator ended early\n"); our_current_position++; printf("SAA[P]P\tnext\n"); - if(!FLAC__metadata_simple_iterator_next(siterator)) + if(!FLAC__metadata_simple_iterator_next(iterator)) return die_("iterator ended early\n"); our_current_position++; @@ -731,8 +731,8 @@ static FLAC__bool test_level_1_() padding->length = 5; if(!replace_in_our_metadata_(padding, our_current_position, /*copy=*/true)) return die_("copying object"); - if(!FLAC__metadata_simple_iterator_set_block(siterator, padding, false)) - return die_ss_("FLAC__metadata_simple_iterator_set_block(siterator, padding, false)", siterator); + if(!FLAC__metadata_simple_iterator_set_block(iterator, padding, false)) + return die_ss_("FLAC__metadata_simple_iterator_set_block(iterator, padding, false)", iterator); if(!test_file_(flacfile_, decoder_metadata_callback_compare_)) return false; @@ -741,8 +741,8 @@ static FLAC__bool test_level_1_() app->data.application.id[0] = 'k'; /* twiddle the id */ if(!replace_in_our_metadata_(app, our_current_position, /*copy=*/true)) return die_("copying object"); - if(!FLAC__metadata_simple_iterator_set_block(siterator, app, false)) - return die_ss_("FLAC__metadata_simple_iterator_set_block(siterator, app, false)", siterator); + if(!FLAC__metadata_simple_iterator_set_block(iterator, app, false)) + return die_ss_("FLAC__metadata_simple_iterator_set_block(iterator, app, false)", iterator); if(!test_file_(flacfile_, decoder_metadata_callback_compare_)) return false; @@ -751,42 +751,42 @@ static FLAC__bool test_level_1_() padding->length = 27; if(!replace_in_our_metadata_(padding, our_current_position, /*copy=*/true)) return die_("copying object"); - if(!FLAC__metadata_simple_iterator_set_block(siterator, padding, false)) - return die_ss_("FLAC__metadata_simple_iterator_set_block(siterator, padding, false)", siterator); + if(!FLAC__metadata_simple_iterator_set_block(iterator, padding, false)) + return die_ss_("FLAC__metadata_simple_iterator_set_block(iterator, padding, false)", iterator); if(!test_file_(flacfile_, decoder_metadata_callback_compare_)) return false; printf("SAAP[P]\tprev\n"); - if(!FLAC__metadata_simple_iterator_prev(siterator)) + if(!FLAC__metadata_simple_iterator_prev(iterator)) return die_("iterator ended early\n"); our_current_position--; printf("SAA[P]P\tdelete (middle block), don't replace with padding\n"); - if(!FLAC__metadata_simple_iterator_delete_block(siterator, false)) - return die_ss_("FLAC__metadata_simple_iterator_delete_block(siterator, false)", siterator); + if(!FLAC__metadata_simple_iterator_delete_block(iterator, false)) + return die_ss_("FLAC__metadata_simple_iterator_delete_block(iterator, false)", iterator); delete_from_our_metadata_(our_current_position--); if(!test_file_(flacfile_, decoder_metadata_callback_compare_)) return false; printf("SA[A]P\tdelete (middle block), don't replace with padding\n"); - if(!FLAC__metadata_simple_iterator_delete_block(siterator, false)) - return die_ss_("FLAC__metadata_simple_iterator_delete_block(siterator, false)", siterator); + if(!FLAC__metadata_simple_iterator_delete_block(iterator, false)) + return die_ss_("FLAC__metadata_simple_iterator_delete_block(iterator, false)", iterator); delete_from_our_metadata_(our_current_position--); if(!test_file_(flacfile_, decoder_metadata_callback_compare_)) return false; printf("S[A]P\tnext\n"); - if(!FLAC__metadata_simple_iterator_next(siterator)) + if(!FLAC__metadata_simple_iterator_next(iterator)) return die_("iterator ended early\n"); our_current_position++; printf("SA[P]\tinsert PADDING after\n"); padding->length = 5; - if(!FLAC__metadata_simple_iterator_insert_block_after(siterator, padding, false)) - return die_ss_("FLAC__metadata_simple_iterator_insert_block_after(siterator, padding, false)", siterator); + if(!FLAC__metadata_simple_iterator_insert_block_after(iterator, padding, false)) + return die_ss_("FLAC__metadata_simple_iterator_insert_block_after(iterator, padding, false)", iterator); if(!insert_to_our_metadata_(padding, ++our_current_position, /*copy=*/true)) return false; @@ -794,12 +794,12 @@ static FLAC__bool test_level_1_() return false; printf("SAP[P]\tprev\n"); - if(!FLAC__metadata_simple_iterator_prev(siterator)) + if(!FLAC__metadata_simple_iterator_prev(iterator)) return die_("iterator ended early\n"); our_current_position--; printf("SA[P]P\tprev\n"); - if(!FLAC__metadata_simple_iterator_prev(siterator)) + if(!FLAC__metadata_simple_iterator_prev(iterator)) return die_("iterator ended early\n"); our_current_position--; @@ -808,8 +808,8 @@ static FLAC__bool test_level_1_() return die_("setting APPLICATION data"); if(!replace_in_our_metadata_(app, our_current_position, /*copy=*/true)) return die_("copying object"); - if(!FLAC__metadata_simple_iterator_set_block(siterator, app, true)) - return die_ss_("FLAC__metadata_simple_iterator_set_block(siterator, app, true)", siterator); + if(!FLAC__metadata_simple_iterator_set_block(iterator, app, true)) + return die_ss_("FLAC__metadata_simple_iterator_set_block(iterator, app, true)", iterator); if(!test_file_(flacfile_, decoder_metadata_callback_compare_)) return false; @@ -819,8 +819,8 @@ static FLAC__bool test_level_1_() return die_("setting APPLICATION data"); if(!replace_in_our_metadata_(app, our_current_position, /*copy=*/true)) return die_("copying object"); - if(!FLAC__metadata_simple_iterator_set_block(siterator, app, true)) - return die_ss_("FLAC__metadata_simple_iterator_set_block(siterator, app, true)", siterator); + if(!FLAC__metadata_simple_iterator_set_block(iterator, app, true)) + return die_ss_("FLAC__metadata_simple_iterator_set_block(iterator, app, true)", iterator); if(!test_file_(flacfile_, decoder_metadata_callback_compare_)) return false; @@ -831,8 +831,8 @@ static FLAC__bool test_level_1_() if(!replace_in_our_metadata_(app, our_current_position, /*copy=*/true)) return die_("copying object"); our_metadata_.blocks[our_current_position+1]->length = 0; - if(!FLAC__metadata_simple_iterator_set_block(siterator, app, true)) - return die_ss_("FLAC__metadata_simple_iterator_set_block(siterator, app, true)", siterator); + if(!FLAC__metadata_simple_iterator_set_block(iterator, app, true)) + return die_ss_("FLAC__metadata_simple_iterator_set_block(iterator, app, true)", iterator); if(!test_file_(flacfile_, decoder_metadata_callback_compare_)) return false; @@ -843,8 +843,8 @@ static FLAC__bool test_level_1_() if(!replace_in_our_metadata_(app, our_current_position, /*copy=*/true)) return die_("copying object"); delete_from_our_metadata_(our_current_position+1); - if(!FLAC__metadata_simple_iterator_set_block(siterator, app, true)) - return die_ss_("FLAC__metadata_simple_iterator_set_block(siterator, app, true)", siterator); + if(!FLAC__metadata_simple_iterator_set_block(iterator, app, true)) + return die_ss_("FLAC__metadata_simple_iterator_set_block(iterator, app, true)", iterator); if(!test_file_(flacfile_, decoder_metadata_callback_compare_)) return false; @@ -856,8 +856,8 @@ static FLAC__bool test_level_1_() return die_("copying object"); delete_from_our_metadata_(our_current_position+1); our_metadata_.blocks[our_current_position]->is_last = true; - if(!FLAC__metadata_simple_iterator_set_block(siterator, app, true)) - return die_ss_("FLAC__metadata_simple_iterator_set_block(siterator, app, true)", siterator); + if(!FLAC__metadata_simple_iterator_set_block(iterator, app, true)) + return die_ss_("FLAC__metadata_simple_iterator_set_block(iterator, app, true)", iterator); if(!test_file_(flacfile_, decoder_metadata_callback_compare_)) return false; @@ -866,15 +866,15 @@ static FLAC__bool test_level_1_() padding->length = app->length; if(!replace_in_our_metadata_(padding, our_current_position, /*copy=*/true)) return die_("copying object"); - if(!FLAC__metadata_simple_iterator_set_block(siterator, padding, true)) - return die_ss_("FLAC__metadata_simple_iterator_set_block(siterator, padding, true)", siterator); + if(!FLAC__metadata_simple_iterator_set_block(iterator, padding, true)) + return die_ss_("FLAC__metadata_simple_iterator_set_block(iterator, padding, true)", iterator); if(!test_file_(flacfile_, decoder_metadata_callback_compare_)) return false; printf("S[P]\tinsert PADDING after\n"); - if(!FLAC__metadata_simple_iterator_insert_block_after(siterator, padding, false)) - return die_ss_("FLAC__metadata_simple_iterator_insert_block_after(siterator, padding, false)", siterator); + if(!FLAC__metadata_simple_iterator_insert_block_after(iterator, padding, false)) + return die_ss_("FLAC__metadata_simple_iterator_insert_block_after(iterator, padding, false)", iterator); if(!insert_to_our_metadata_(padding, ++our_current_position, /*copy=*/true)) return false; @@ -883,8 +883,8 @@ static FLAC__bool test_level_1_() printf("SP[P]\tinsert PADDING after\n"); padding->length = 5; - if(!FLAC__metadata_simple_iterator_insert_block_after(siterator, padding, false)) - return die_ss_("FLAC__metadata_simple_iterator_insert_block_after(siterator, padding, false)", siterator); + if(!FLAC__metadata_simple_iterator_insert_block_after(iterator, padding, false)) + return die_ss_("FLAC__metadata_simple_iterator_insert_block_after(iterator, padding, false)", iterator); if(!insert_to_our_metadata_(padding, ++our_current_position, /*copy=*/true)) return false; @@ -892,17 +892,17 @@ static FLAC__bool test_level_1_() return false; printf("SPP[P]\tprev\n"); - if(!FLAC__metadata_simple_iterator_prev(siterator)) + if(!FLAC__metadata_simple_iterator_prev(iterator)) return die_("iterator ended early\n"); our_current_position--; printf("SP[P]P\tprev\n"); - if(!FLAC__metadata_simple_iterator_prev(siterator)) + if(!FLAC__metadata_simple_iterator_prev(iterator)) return die_("iterator ended early\n"); our_current_position--; printf("S[P]PP\tprev\n"); - if(!FLAC__metadata_simple_iterator_prev(siterator)) + if(!FLAC__metadata_simple_iterator_prev(iterator)) return die_("iterator ended early\n"); our_current_position--; @@ -911,15 +911,15 @@ static FLAC__bool test_level_1_() return die_("setting APPLICATION data"); if(!insert_to_our_metadata_(app, ++our_current_position, /*copy=*/true)) return die_("copying object"); - if(!FLAC__metadata_simple_iterator_insert_block_after(siterator, app, true)) - return die_ss_("FLAC__metadata_simple_iterator_insert_block_after(siterator, app, true)", siterator); + if(!FLAC__metadata_simple_iterator_insert_block_after(iterator, app, true)) + return die_ss_("FLAC__metadata_simple_iterator_insert_block_after(iterator, app, true)", iterator); if(!test_file_(flacfile_, decoder_metadata_callback_compare_)) return false; printf("S[A]PPP\tdelete (middle block), don't replace with padding\n"); - if(!FLAC__metadata_simple_iterator_delete_block(siterator, false)) - return die_ss_("FLAC__metadata_simple_iterator_delete_block(siterator, false)", siterator); + if(!FLAC__metadata_simple_iterator_delete_block(iterator, false)) + return die_ss_("FLAC__metadata_simple_iterator_delete_block(iterator, false)", iterator); delete_from_our_metadata_(our_current_position--); if(!test_file_(flacfile_, decoder_metadata_callback_compare_)) @@ -930,15 +930,15 @@ static FLAC__bool test_level_1_() return die_("setting APPLICATION data"); if(!insert_to_our_metadata_(app, ++our_current_position, /*copy=*/true)) return die_("copying object"); - if(!FLAC__metadata_simple_iterator_insert_block_after(siterator, app, true)) - return die_ss_("FLAC__metadata_simple_iterator_insert_block_after(siterator, app, true)", siterator); + if(!FLAC__metadata_simple_iterator_insert_block_after(iterator, app, true)) + return die_ss_("FLAC__metadata_simple_iterator_insert_block_after(iterator, app, true)", iterator); if(!test_file_(flacfile_, decoder_metadata_callback_compare_)) return false; printf("S[A]PPP\tdelete (middle block), don't replace with padding\n"); - if(!FLAC__metadata_simple_iterator_delete_block(siterator, false)) - return die_ss_("FLAC__metadata_simple_iterator_delete_block(siterator, false)", siterator); + if(!FLAC__metadata_simple_iterator_delete_block(iterator, false)) + return die_ss_("FLAC__metadata_simple_iterator_delete_block(iterator, false)", iterator); delete_from_our_metadata_(our_current_position--); if(!test_file_(flacfile_, decoder_metadata_callback_compare_)) @@ -950,15 +950,15 @@ static FLAC__bool test_level_1_() if(!insert_to_our_metadata_(app, ++our_current_position, /*copy=*/true)) return die_("copying object"); delete_from_our_metadata_(our_current_position+1); - if(!FLAC__metadata_simple_iterator_insert_block_after(siterator, app, true)) - return die_ss_("FLAC__metadata_simple_iterator_insert_block_after(siterator, app, true)", siterator); + if(!FLAC__metadata_simple_iterator_insert_block_after(iterator, app, true)) + return die_ss_("FLAC__metadata_simple_iterator_insert_block_after(iterator, app, true)", iterator); if(!test_file_(flacfile_, decoder_metadata_callback_compare_)) return false; printf("S[A]PP\tdelete (middle block), don't replace with padding\n"); - if(!FLAC__metadata_simple_iterator_delete_block(siterator, false)) - return die_ss_("FLAC__metadata_simple_iterator_delete_block(siterator, false)", siterator); + if(!FLAC__metadata_simple_iterator_delete_block(iterator, false)) + return die_ss_("FLAC__metadata_simple_iterator_delete_block(iterator, false)", iterator); delete_from_our_metadata_(our_current_position--); if(!test_file_(flacfile_, decoder_metadata_callback_compare_)) @@ -970,28 +970,28 @@ static FLAC__bool test_level_1_() if(!insert_to_our_metadata_(app, ++our_current_position, /*copy=*/true)) return die_("copying object"); our_metadata_.blocks[our_current_position+1]->length = 0; - if(!FLAC__metadata_simple_iterator_insert_block_after(siterator, app, true)) - return die_ss_("FLAC__metadata_simple_iterator_insert_block_after(siterator, app, true)", siterator); + if(!FLAC__metadata_simple_iterator_insert_block_after(iterator, app, true)) + return die_ss_("FLAC__metadata_simple_iterator_insert_block_after(iterator, app, true)", iterator); if(!test_file_(flacfile_, decoder_metadata_callback_compare_)) return false; printf("S[A]PP\tdelete (middle block), don't replace with padding\n"); - if(!FLAC__metadata_simple_iterator_delete_block(siterator, false)) - return die_ss_("FLAC__metadata_simple_iterator_delete_block(siterator, false)", siterator); + if(!FLAC__metadata_simple_iterator_delete_block(iterator, false)) + return die_ss_("FLAC__metadata_simple_iterator_delete_block(iterator, false)", iterator); delete_from_our_metadata_(our_current_position--); if(!test_file_(flacfile_, decoder_metadata_callback_compare_)) return false; printf("[S]PP\tnext\n"); - if(!FLAC__metadata_simple_iterator_next(siterator)) + if(!FLAC__metadata_simple_iterator_next(iterator)) return die_("iterator ended early\n"); our_current_position++; printf("S[P]P\tdelete (middle block), don't replace with padding\n"); - if(!FLAC__metadata_simple_iterator_delete_block(siterator, false)) - return die_ss_("FLAC__metadata_simple_iterator_delete_block(siterator, false)", siterator); + if(!FLAC__metadata_simple_iterator_delete_block(iterator, false)) + return die_ss_("FLAC__metadata_simple_iterator_delete_block(iterator, false)", iterator); delete_from_our_metadata_(our_current_position--); if(!test_file_(flacfile_, decoder_metadata_callback_compare_)) @@ -1003,15 +1003,15 @@ static FLAC__bool test_level_1_() if(!insert_to_our_metadata_(app, ++our_current_position, /*copy=*/true)) return die_("copying object"); delete_from_our_metadata_(our_current_position+1); - if(!FLAC__metadata_simple_iterator_insert_block_after(siterator, app, true)) - return die_ss_("FLAC__metadata_simple_iterator_insert_block_after(siterator, app, true)", siterator); + if(!FLAC__metadata_simple_iterator_insert_block_after(iterator, app, true)) + return die_ss_("FLAC__metadata_simple_iterator_insert_block_after(iterator, app, true)", iterator); if(!test_file_(flacfile_, decoder_metadata_callback_compare_)) return false; printf("delete simple iterator\n"); - FLAC__metadata_simple_iterator_delete(siterator); + FLAC__metadata_simple_iterator_delete(iterator); FLAC__metadata_object_delete(app); FLAC__metadata_object_delete(padding); @@ -1024,9 +1024,9 @@ static FLAC__bool test_level_1_() static FLAC__bool test_level_2_() { - FLAC__MetaData_Iterator *iterator; - FLAC__MetaData_Chain *chain; - FLAC__StreamMetaData *block, *app, *padding; + FLAC__Metadata_Iterator *iterator; + FLAC__Metadata_Chain *chain; + FLAC__StreamMetadata *block, *app, *padding; FLAC__byte data[2000]; unsigned our_current_position; @@ -1114,7 +1114,7 @@ static FLAC__bool test_level_2_() return false; printf("S[A]\tshrink APPLICATION, don't use padding\n"); - if(0 == (app = FLAC__metadata_object_copy(our_metadata_.blocks[our_current_position]))) + if(0 == (app = FLAC__metadata_object_clone(our_metadata_.blocks[our_current_position]))) return die_("copying object"); if(!FLAC__metadata_object_application_set_data(app, data, 26, true)) return die_("setting APPLICATION data"); @@ -1131,7 +1131,7 @@ static FLAC__bool test_level_2_() return false; printf("S[A]\tgrow APPLICATION, don't use padding\n"); - if(0 == (app = FLAC__metadata_object_copy(our_metadata_.blocks[our_current_position]))) + if(0 == (app = FLAC__metadata_object_clone(our_metadata_.blocks[our_current_position]))) return die_("copying object"); if(!FLAC__metadata_object_application_set_data(app, data, 28, true)) return die_("setting APPLICATION data"); @@ -1148,7 +1148,7 @@ static FLAC__bool test_level_2_() return false; printf("S[A]\tgrow APPLICATION, use padding, but last block is not padding\n"); - if(0 == (app = FLAC__metadata_object_copy(our_metadata_.blocks[our_current_position]))) + if(0 == (app = FLAC__metadata_object_clone(our_metadata_.blocks[our_current_position]))) return die_("copying object"); if(!FLAC__metadata_object_application_set_data(app, data, 36, true)) return die_("setting APPLICATION data"); @@ -1165,7 +1165,7 @@ static FLAC__bool test_level_2_() return false; printf("S[A]\tshrink APPLICATION, use padding, last block is not padding, but delta is too small for new PADDING block\n"); - if(0 == (app = FLAC__metadata_object_copy(our_metadata_.blocks[our_current_position]))) + if(0 == (app = FLAC__metadata_object_clone(our_metadata_.blocks[our_current_position]))) return die_("copying object"); if(!FLAC__metadata_object_application_set_data(app, data, 33, true)) return die_("setting APPLICATION data"); @@ -1184,7 +1184,7 @@ static FLAC__bool test_level_2_() printf("S[A]\tshrink APPLICATION, use padding, last block is not padding, delta is enough for new PADDING block\n"); if(0 == (padding = FLAC__metadata_object_new(FLAC__METADATA_TYPE_PADDING))) return die_("creating PADDING block"); - if(0 == (app = FLAC__metadata_object_copy(our_metadata_.blocks[our_current_position]))) + if(0 == (app = FLAC__metadata_object_clone(our_metadata_.blocks[our_current_position]))) return die_("copying object"); if(!FLAC__metadata_object_application_set_data(app, data, 29, true)) return die_("setting APPLICATION data"); @@ -1204,7 +1204,7 @@ static FLAC__bool test_level_2_() return false; printf("S[A]P\tshrink APPLICATION, use padding, last block is padding\n"); - if(0 == (app = FLAC__metadata_object_copy(our_metadata_.blocks[our_current_position]))) + if(0 == (app = FLAC__metadata_object_clone(our_metadata_.blocks[our_current_position]))) return die_("copying object"); if(!FLAC__metadata_object_application_set_data(app, data, 16, true)) return die_("setting APPLICATION data"); @@ -1222,7 +1222,7 @@ static FLAC__bool test_level_2_() return false; printf("S[A]P\tgrow APPLICATION, use padding, last block is padding, but delta is too small\n"); - if(0 == (app = FLAC__metadata_object_copy(our_metadata_.blocks[our_current_position]))) + if(0 == (app = FLAC__metadata_object_clone(our_metadata_.blocks[our_current_position]))) return die_("copying object"); if(!FLAC__metadata_object_application_set_data(app, data, 50, true)) return die_("setting APPLICATION data"); @@ -1239,7 +1239,7 @@ static FLAC__bool test_level_2_() return false; printf("S[A]P\tgrow APPLICATION, use padding, last block is padding of exceeding size\n"); - if(0 == (app = FLAC__metadata_object_copy(our_metadata_.blocks[our_current_position]))) + if(0 == (app = FLAC__metadata_object_clone(our_metadata_.blocks[our_current_position]))) return die_("copying object"); if(!FLAC__metadata_object_application_set_data(app, data, 56, true)) return die_("setting APPLICATION data"); @@ -1257,7 +1257,7 @@ static FLAC__bool test_level_2_() return false; printf("S[A]P\tgrow APPLICATION, use padding, last block is padding of exact size\n"); - if(0 == (app = FLAC__metadata_object_copy(our_metadata_.blocks[our_current_position]))) + if(0 == (app = FLAC__metadata_object_clone(our_metadata_.blocks[our_current_position]))) return die_("copying object"); if(!FLAC__metadata_object_application_set_data(app, data, 67, true)) return die_("setting APPLICATION data"); @@ -1298,7 +1298,7 @@ static FLAC__bool test_level_2_() return false; printf("S[P]A\tinsert PADDING before\n"); - if(0 == (padding = FLAC__metadata_object_copy(our_metadata_.blocks[our_current_position]))) + if(0 == (padding = FLAC__metadata_object_clone(our_metadata_.blocks[our_current_position]))) return die_("creating PADDING block"); padding->length = 17; if(!insert_to_our_metadata_(padding, our_current_position, /*copy=*/true)) @@ -1310,7 +1310,7 @@ static FLAC__bool test_level_2_() return false; printf("S[P]PA\tinsert PADDING before\n"); - if(0 == (padding = FLAC__metadata_object_copy(our_metadata_.blocks[our_current_position]))) + if(0 == (padding = FLAC__metadata_object_clone(our_metadata_.blocks[our_current_position]))) return die_("creating PADDING block"); padding->length = 0; if(!insert_to_our_metadata_(padding, our_current_position, /*copy=*/true)) @@ -1337,7 +1337,7 @@ static FLAC__bool test_level_2_() our_current_position++; printf("SPPP[A]\tinsert PADDING after\n"); - if(0 == (padding = FLAC__metadata_object_copy(our_metadata_.blocks[1]))) + if(0 == (padding = FLAC__metadata_object_clone(our_metadata_.blocks[1]))) return die_("creating PADDING block"); padding->length = 57; if(!insert_to_our_metadata_(padding, ++our_current_position, /*copy=*/true)) @@ -1349,7 +1349,7 @@ static FLAC__bool test_level_2_() return false; printf("SPPPA[P]\tinsert PADDING before\n"); - if(0 == (padding = FLAC__metadata_object_copy(our_metadata_.blocks[1]))) + if(0 == (padding = FLAC__metadata_object_clone(our_metadata_.blocks[1]))) return die_("creating PADDING block"); padding->length = 99; if(!insert_to_our_metadata_(padding, our_current_position, /*copy=*/true)) @@ -1503,7 +1503,7 @@ static FLAC__bool test_level_2_() FLAC__bool test_metadata_file_manipulation() { - printf("\n+++ unit test: metadata manipulation\n\n"); + printf("\n+++ libFLAC unit test: metadata manipulation\n\n"); our_metadata_.num_blocks = 0; diff --git a/src/test_libFLAC/metadata_object.c b/src/test_libFLAC/metadata_object.c index 71964146..7559f59f 100644 --- a/src/test_libFLAC/metadata_object.c +++ b/src/test_libFLAC/metadata_object.c @@ -37,7 +37,7 @@ static FLAC__byte *make_dummydata_(FLAC__byte *dummydata, unsigned len) return ret; } -static FLAC__bool compare_seekpoint_array_(const FLAC__StreamMetaData_SeekPoint *from, const FLAC__StreamMetaData_SeekPoint *to, unsigned n) +static FLAC__bool compare_seekpoint_array_(const FLAC__StreamMetadata_SeekPoint *from, const FLAC__StreamMetadata_SeekPoint *to, unsigned n) { unsigned i; @@ -62,7 +62,7 @@ static FLAC__bool compare_seekpoint_array_(const FLAC__StreamMetaData_SeekPoint return true; } -static FLAC__bool check_seektable_(const FLAC__StreamMetaData *block, unsigned num_points, const FLAC__StreamMetaData_SeekPoint *array) +static FLAC__bool check_seektable_(const FLAC__StreamMetadata *block, unsigned num_points, const FLAC__StreamMetadata_SeekPoint *array) { const unsigned expected_length = num_points * FLAC__STREAM_METADATA_SEEKPOINT_LENGTH; @@ -89,7 +89,7 @@ static FLAC__bool check_seektable_(const FLAC__StreamMetaData *block, unsigned n return true; } -static void entry_new_(FLAC__StreamMetaData_VorbisComment_Entry *entry, const char *field) +static void entry_new_(FLAC__StreamMetadata_VorbisComment_Entry *entry, const char *field) { entry->length = strlen(field); entry->entry = (FLAC__byte*)malloc(entry->length); @@ -97,7 +97,7 @@ static void entry_new_(FLAC__StreamMetaData_VorbisComment_Entry *entry, const ch memcpy(entry->entry, field, entry->length); } -static void entry_clone_(FLAC__StreamMetaData_VorbisComment_Entry *entry) +static void entry_clone_(FLAC__StreamMetadata_VorbisComment_Entry *entry) { FLAC__byte *x = (FLAC__byte*)malloc(entry->length); FLAC__ASSERT(0 != x); @@ -105,9 +105,9 @@ static void entry_clone_(FLAC__StreamMetaData_VorbisComment_Entry *entry) entry->entry = x; } -static void vc_calc_len_(FLAC__StreamMetaData *block) +static void vc_calc_len_(FLAC__StreamMetadata *block) { - const FLAC__StreamMetaData_VorbisComment *vc = &block->data.vorbis_comment; + const FLAC__StreamMetadata_VorbisComment *vc = &block->data.vorbis_comment; unsigned i; block->length = FLAC__STREAM_METADATA_VORBIS_COMMENT_ENTRY_LENGTH_LEN / 8; @@ -119,9 +119,9 @@ static void vc_calc_len_(FLAC__StreamMetaData *block) } } -static void vc_resize_(FLAC__StreamMetaData *block, unsigned num) +static void vc_resize_(FLAC__StreamMetadata *block, unsigned num) { - FLAC__StreamMetaData_VorbisComment *vc = &block->data.vorbis_comment; + FLAC__StreamMetadata_VorbisComment *vc = &block->data.vorbis_comment; if(vc->num_comments != 0) { FLAC__ASSERT(0 != vc->comments); @@ -140,43 +140,43 @@ static void vc_resize_(FLAC__StreamMetaData *block, unsigned num) } } else { - vc->comments = (FLAC__StreamMetaData_VorbisComment_Entry*)realloc(vc->comments, sizeof(FLAC__StreamMetaData_VorbisComment_Entry)*num); + vc->comments = (FLAC__StreamMetadata_VorbisComment_Entry*)realloc(vc->comments, sizeof(FLAC__StreamMetadata_VorbisComment_Entry)*num); FLAC__ASSERT(0 != vc->comments); if(num > vc->num_comments) - memset(vc->comments+vc->num_comments, 0, sizeof(FLAC__StreamMetaData_VorbisComment_Entry)*(num-vc->num_comments)); + memset(vc->comments+vc->num_comments, 0, sizeof(FLAC__StreamMetadata_VorbisComment_Entry)*(num-vc->num_comments)); } vc->num_comments = num; vc_calc_len_(block); } -static void vc_set_vs_new_(FLAC__StreamMetaData_VorbisComment_Entry *entry, FLAC__StreamMetaData *block, const char *field) +static void vc_set_vs_new_(FLAC__StreamMetadata_VorbisComment_Entry *entry, FLAC__StreamMetadata *block, const char *field) { entry_new_(entry, field); block->data.vorbis_comment.vendor_string = *entry; vc_calc_len_(block); } -static void vc_set_new_(FLAC__StreamMetaData_VorbisComment_Entry *entry, FLAC__StreamMetaData *block, unsigned pos, const char *field) +static void vc_set_new_(FLAC__StreamMetadata_VorbisComment_Entry *entry, FLAC__StreamMetadata *block, unsigned pos, const char *field) { entry_new_(entry, field); block->data.vorbis_comment.comments[pos] = *entry; vc_calc_len_(block); } -static void vc_insert_new_(FLAC__StreamMetaData_VorbisComment_Entry *entry, FLAC__StreamMetaData *block, unsigned pos, const char *field) +static void vc_insert_new_(FLAC__StreamMetadata_VorbisComment_Entry *entry, FLAC__StreamMetadata *block, unsigned pos, const char *field) { vc_resize_(block, block->data.vorbis_comment.num_comments+1); - memmove(&block->data.vorbis_comment.comments[pos+1], &block->data.vorbis_comment.comments[pos], sizeof(FLAC__StreamMetaData_VorbisComment_Entry)*(block->data.vorbis_comment.num_comments-1-pos)); + memmove(&block->data.vorbis_comment.comments[pos+1], &block->data.vorbis_comment.comments[pos], sizeof(FLAC__StreamMetadata_VorbisComment_Entry)*(block->data.vorbis_comment.num_comments-1-pos)); vc_set_new_(entry, block, pos, field); vc_calc_len_(block); } -static void vc_delete_(FLAC__StreamMetaData *block, unsigned pos) +static void vc_delete_(FLAC__StreamMetadata *block, unsigned pos) { if(0 != block->data.vorbis_comment.comments[pos].entry) free(block->data.vorbis_comment.comments[pos].entry); - memmove(&block->data.vorbis_comment.comments[pos], &block->data.vorbis_comment.comments[pos+1], sizeof(FLAC__StreamMetaData_VorbisComment_Entry)*(block->data.vorbis_comment.num_comments-pos-1)); + memmove(&block->data.vorbis_comment.comments[pos], &block->data.vorbis_comment.comments[pos+1], sizeof(FLAC__StreamMetadata_VorbisComment_Entry)*(block->data.vorbis_comment.num_comments-pos-1)); block->data.vorbis_comment.comments[block->data.vorbis_comment.num_comments-1].entry = 0; block->data.vorbis_comment.comments[block->data.vorbis_comment.num_comments-1].length = 0; vc_resize_(block, block->data.vorbis_comment.num_comments-1); @@ -185,13 +185,13 @@ static void vc_delete_(FLAC__StreamMetaData *block, unsigned pos) FLAC__bool test_metadata_object() { - FLAC__StreamMetaData *block, *blockcopy, *vorbiscomment; - FLAC__StreamMetaData_SeekPoint seekpoint_array[4]; - FLAC__StreamMetaData_VorbisComment_Entry entry; + FLAC__StreamMetadata *block, *blockcopy, *vorbiscomment; + FLAC__StreamMetadata_SeekPoint seekpoint_array[4]; + FLAC__StreamMetadata_VorbisComment_Entry entry; unsigned i, expected_length, seekpoints; static FLAC__byte dummydata[4] = { 'a', 'b', 'c', 'd' }; - printf("\n+++ unit test: metadata objects (libFLAC)\n\n"); + printf("\n+++ libFLAC unit test: metadata objects\n\n"); printf("testing STREAMINFO\n"); @@ -209,8 +209,8 @@ FLAC__bool test_metadata_object() } printf("OK\n"); - printf("testing FLAC__metadata_object_copy()... "); - blockcopy = FLAC__metadata_object_copy(block); + printf("testing FLAC__metadata_object_clone()... "); + blockcopy = FLAC__metadata_object_clone(block); if(0 == blockcopy) { printf("FAILED, returned NULL\n"); return false; @@ -240,8 +240,8 @@ FLAC__bool test_metadata_object() } printf("OK\n"); - printf("testing FLAC__metadata_object_copy()... "); - blockcopy = FLAC__metadata_object_copy(block); + printf("testing FLAC__metadata_object_clone()... "); + blockcopy = FLAC__metadata_object_clone(block); if(0 == blockcopy) { printf("FAILED, returned NULL\n"); return false; @@ -271,8 +271,8 @@ FLAC__bool test_metadata_object() } printf("OK\n"); - printf("testing FLAC__metadata_object_copy()... "); - blockcopy = FLAC__metadata_object_copy(block); + printf("testing FLAC__metadata_object_clone()... "); + blockcopy = FLAC__metadata_object_clone(block); if(0 == blockcopy) { printf("FAILED, returned NULL\n"); return false; @@ -301,8 +301,8 @@ FLAC__bool test_metadata_object() } printf("OK\n"); - printf("testing FLAC__metadata_object_copy()... "); - blockcopy = FLAC__metadata_object_copy(block); + printf("testing FLAC__metadata_object_clone()... "); + blockcopy = FLAC__metadata_object_clone(block); if(0 == blockcopy) { printf("FAILED, returned NULL\n"); return false; @@ -331,8 +331,8 @@ FLAC__bool test_metadata_object() } printf("OK\n"); - printf("testing FLAC__metadata_object_copy()... "); - blockcopy = FLAC__metadata_object_copy(block); + printf("testing FLAC__metadata_object_clone()... "); + blockcopy = FLAC__metadata_object_clone(block); if(0 == blockcopy) { printf("FAILED, returned NULL\n"); return false; @@ -365,8 +365,8 @@ FLAC__bool test_metadata_object() if(!check_seektable_(block, seekpoints, 0)) return false; - printf("testing FLAC__metadata_object_copy()... "); - blockcopy = FLAC__metadata_object_copy(block); + printf("testing FLAC__metadata_object_clone()... "); + blockcopy = FLAC__metadata_object_clone(block); if(0 == blockcopy) { printf("FAILED, returned NULL\n"); return false; @@ -452,8 +452,8 @@ FLAC__bool test_metadata_object() if(!check_seektable_(block, seekpoints, seekpoint_array)) return false; - printf("testing FLAC__metadata_object_copy()... "); - blockcopy = FLAC__metadata_object_copy(block); + printf("testing FLAC__metadata_object_clone()... "); + blockcopy = FLAC__metadata_object_clone(block); if(0 == blockcopy) { printf("FAILED, returned NULL\n"); return false; @@ -516,8 +516,8 @@ FLAC__bool test_metadata_object() } printf("OK\n"); - printf("testing FLAC__metadata_object_copy()... "); - vorbiscomment = FLAC__metadata_object_copy(block); + printf("testing FLAC__metadata_object_clone()... "); + vorbiscomment = FLAC__metadata_object_clone(block); if(0 == vorbiscomment) { printf("FAILED, returned NULL\n"); return false; @@ -596,8 +596,8 @@ FLAC__bool test_metadata_object() return false; printf("OK\n"); - printf("testing FLAC__metadata_object_copy()... "); - blockcopy = FLAC__metadata_object_copy(block); + printf("testing FLAC__metadata_object_clone()... "); + blockcopy = FLAC__metadata_object_clone(block); if(0 == blockcopy) { printf("FAILED, returned NULL\n"); return false; @@ -668,8 +668,8 @@ FLAC__bool test_metadata_object() } printf("OK\n"); - printf("testing FLAC__metadata_object_copy()... "); - vorbiscomment = FLAC__metadata_object_copy(block); + printf("testing FLAC__metadata_object_clone()... "); + vorbiscomment = FLAC__metadata_object_clone(block); if(0 == vorbiscomment) { printf("FAILED, returned NULL\n"); return false; diff --git a/src/test_libFLAC/metadata_utils.c b/src/test_libFLAC/metadata_utils.c index 6e69b443..a691ab83 100644 --- a/src/test_libFLAC/metadata_utils.c +++ b/src/test_libFLAC/metadata_utils.c @@ -26,7 +26,7 @@ #include <stdlib.h> /* for malloc() */ #include <string.h> /* for memcmp() */ -FLAC__bool compare_block_data_streaminfo_(const FLAC__StreamMetaData_StreamInfo *block, const FLAC__StreamMetaData_StreamInfo *blockcopy) +FLAC__bool compare_block_data_streaminfo_(const FLAC__StreamMetadata_StreamInfo *block, const FLAC__StreamMetadata_StreamInfo *blockcopy) { if(blockcopy->min_blocksize != block->min_blocksize) { printf("FAILED, min_blocksize mismatch, expected %u, got %u\n", block->min_blocksize, blockcopy->min_blocksize); @@ -100,14 +100,14 @@ FLAC__bool compare_block_data_streaminfo_(const FLAC__StreamMetaData_StreamInfo return true; } -FLAC__bool compare_block_data_padding_(const FLAC__StreamMetaData_Padding *block, const FLAC__StreamMetaData_Padding *blockcopy, unsigned block_length) +FLAC__bool compare_block_data_padding_(const FLAC__StreamMetadata_Padding *block, const FLAC__StreamMetadata_Padding *blockcopy, unsigned block_length) { /* we don't compare the padding guts */ (void)block, (void)blockcopy, (void)block_length; return true; } -FLAC__bool compare_block_data_application_(const FLAC__StreamMetaData_Application *block, const FLAC__StreamMetaData_Application *blockcopy, unsigned block_length) +FLAC__bool compare_block_data_application_(const FLAC__StreamMetadata_Application *block, const FLAC__StreamMetadata_Application *blockcopy, unsigned block_length) { if(block_length < sizeof(block->id)) { printf("FAILED, bad block length = %u\n", block_length); @@ -149,7 +149,7 @@ FLAC__bool compare_block_data_application_(const FLAC__StreamMetaData_Applicatio return true; } -FLAC__bool compare_block_data_seektable_(const FLAC__StreamMetaData_SeekTable *block, const FLAC__StreamMetaData_SeekTable *blockcopy) +FLAC__bool compare_block_data_seektable_(const FLAC__StreamMetadata_SeekTable *block, const FLAC__StreamMetadata_SeekTable *blockcopy) { unsigned i; if(blockcopy->num_points != block->num_points) { @@ -173,7 +173,7 @@ FLAC__bool compare_block_data_seektable_(const FLAC__StreamMetaData_SeekTable *b return true; } -FLAC__bool compare_block_data_vorbiscomment_(const FLAC__StreamMetaData_VorbisComment *block, const FLAC__StreamMetaData_VorbisComment *blockcopy) +FLAC__bool compare_block_data_vorbiscomment_(const FLAC__StreamMetadata_VorbisComment *block, const FLAC__StreamMetadata_VorbisComment *blockcopy) { unsigned i; if(blockcopy->vendor_string.length != block->vendor_string.length) { @@ -215,10 +215,10 @@ FLAC__bool compare_block_data_vorbiscomment_(const FLAC__StreamMetaData_VorbisCo return true; } -FLAC__bool compare_block_(const FLAC__StreamMetaData *block, const FLAC__StreamMetaData *blockcopy) +FLAC__bool compare_block_(const FLAC__StreamMetadata *block, const FLAC__StreamMetadata *blockcopy) { if(blockcopy->type != block->type) { - printf("FAILED, type mismatch, expected %s, got %s\n", FLAC__MetaDataTypeString[block->type], FLAC__MetaDataTypeString[blockcopy->type]); + printf("FAILED, type mismatch, expected %s, got %s\n", FLAC__MetadataTypeString[block->type], FLAC__MetadataTypeString[blockcopy->type]); return false; } if(blockcopy->is_last != block->is_last) { diff --git a/src/test_libFLAC/metadata_utils.h b/src/test_libFLAC/metadata_utils.h index 8f403df6..03dca57f 100644 --- a/src/test_libFLAC/metadata_utils.h +++ b/src/test_libFLAC/metadata_utils.h @@ -28,16 +28,16 @@ #include <stdlib.h> /* for malloc() */ #include <string.h> /* for memcmp() */ -FLAC__bool compare_block_data_streaminfo_(const FLAC__StreamMetaData_StreamInfo *block, const FLAC__StreamMetaData_StreamInfo *blockcopy); +FLAC__bool compare_block_data_streaminfo_(const FLAC__StreamMetadata_StreamInfo *block, const FLAC__StreamMetadata_StreamInfo *blockcopy); -FLAC__bool compare_block_data_padding_(const FLAC__StreamMetaData_Padding *block, const FLAC__StreamMetaData_Padding *blockcopy, unsigned block_length); +FLAC__bool compare_block_data_padding_(const FLAC__StreamMetadata_Padding *block, const FLAC__StreamMetadata_Padding *blockcopy, unsigned block_length); -FLAC__bool compare_block_data_application_(const FLAC__StreamMetaData_Application *block, const FLAC__StreamMetaData_Application *blockcopy, unsigned block_length); +FLAC__bool compare_block_data_application_(const FLAC__StreamMetadata_Application *block, const FLAC__StreamMetadata_Application *blockcopy, unsigned block_length); -FLAC__bool compare_block_data_seektable_(const FLAC__StreamMetaData_SeekTable *block, const FLAC__StreamMetaData_SeekTable *blockcopy); +FLAC__bool compare_block_data_seektable_(const FLAC__StreamMetadata_SeekTable *block, const FLAC__StreamMetadata_SeekTable *blockcopy); -FLAC__bool compare_block_data_vorbiscomment_(const FLAC__StreamMetaData_VorbisComment *block, const FLAC__StreamMetaData_VorbisComment *blockcopy); +FLAC__bool compare_block_data_vorbiscomment_(const FLAC__StreamMetadata_VorbisComment *block, const FLAC__StreamMetadata_VorbisComment *blockcopy); -FLAC__bool compare_block_(const FLAC__StreamMetaData *block, const FLAC__StreamMetaData *blockcopy); +FLAC__bool compare_block_(const FLAC__StreamMetadata *block, const FLAC__StreamMetadata *blockcopy); #endif diff --git a/src/test_streams/Makefile.vc b/src/test_streams/Makefile.vc index b2fb4118..66d5c34e 100644 --- a/src/test_streams/Makefile.vc +++ b/src/test_streams/Makefile.vc @@ -19,10 +19,10 @@ !IFDEF DEBUG
.c.obj:
- $(cc) $(cdebug) $(cflags) /I "..\..\include" /I ".\include" -DSTRICT -DVERSION=\"1.0.3\" -YX /Od /D "_DEBUG" $<
+ $(cc) $(cdebug) $(cflags) /I "..\..\include" /I ".\include" -DSTRICT -DVERSION=\"1.0.3_beta\" -YX /Od /D "_DEBUG" $<
!else
.c.obj:
- $(cc) /O2 $(crelease) $(cflags) /I "..\..\include" /I ".\include" -DSTRICT -DVERSION=\"1.0.3\" -YX -DNODEBUG $<
+ $(cc) /O2 $(crelease) $(cflags) /I "..\..\include" /I ".\include" -DSTRICT -DVERSION=\"1.0.3_beta\" -YX -DNODEBUG $<
!endif
C_FILES= \
|