big fix to allow codec and metadata interface to handle unknown metadata block types correctly
This commit is contained in:
parent
315daa9e17
commit
0eea34aad0
@ -693,6 +693,59 @@ namespace FLAC {
|
||||
bool is_legal(bool check_cd_da_subset = false, const char **violation = 0) const;
|
||||
};
|
||||
|
||||
/** Opaque metadata block for storing unknown types.
|
||||
* This should not be used unless you know what you are doing;
|
||||
* it is currently used only internally to support forward
|
||||
* compatibility of metadata blocks.
|
||||
*/
|
||||
class FLACPP_API Unknown : public Prototype {
|
||||
public:
|
||||
Unknown();
|
||||
//
|
||||
//@{
|
||||
/** Constructs a copy of the given object. This form
|
||||
* always performs a deep copy.
|
||||
*/
|
||||
inline Unknown(const Unknown &object): Prototype(object) { }
|
||||
inline Unknown(const ::FLAC__StreamMetadata &object): Prototype(object) { }
|
||||
inline Unknown(const ::FLAC__StreamMetadata *object): Prototype(object) { }
|
||||
//@}
|
||||
|
||||
/** Constructs an object with copy control. See
|
||||
* Prototype(::FLAC__StreamMetadata *object, bool copy).
|
||||
*/
|
||||
inline Unknown(::FLAC__StreamMetadata *object, bool copy): Prototype(object, copy) { }
|
||||
|
||||
~Unknown();
|
||||
|
||||
//@{
|
||||
/** Assign from another object. Always performs a deep copy. */
|
||||
inline void operator=(const Unknown &object) { Prototype::operator=(object); }
|
||||
inline void operator=(const ::FLAC__StreamMetadata &object) { Prototype::operator=(object); }
|
||||
inline void operator=(const ::FLAC__StreamMetadata *object) { Prototype::operator=(object); }
|
||||
//@}
|
||||
|
||||
//@{
|
||||
/** Check for equality, performing a deep compare by following pointers. */
|
||||
inline bool operator==(const Unknown &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); }
|
||||
//@}
|
||||
|
||||
//@{
|
||||
/** Check for inequality, performing a deep compare by following pointers. */
|
||||
inline bool operator!=(const Unknown &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_data() const;
|
||||
|
||||
//! This form always copies \a data
|
||||
bool set_data(const FLAC__byte *data, unsigned length);
|
||||
bool set_data(FLAC__byte *data, unsigned length, bool copy);
|
||||
};
|
||||
|
||||
/* \} */
|
||||
|
||||
|
||||
|
@ -670,12 +670,20 @@ extern FLAC_API const unsigned FLAC__STREAM_METADATA_CUESHEET_RESERVED_LEN; /**<
|
||||
extern FLAC_API const unsigned FLAC__STREAM_METADATA_CUESHEET_NUM_TRACKS_LEN; /**< == 8 (bits) */
|
||||
|
||||
|
||||
/** Structure that is used when a metadata block of unknown type is loaded. The contents are opaque.
|
||||
*/
|
||||
typedef struct {
|
||||
FLAC__byte *data;
|
||||
} FLAC__StreamMetadata_Unknown;
|
||||
|
||||
|
||||
/** FLAC metadata block structure. (c.f. <A HREF="../format.html#metadata_block">format specification</A>)
|
||||
*/
|
||||
typedef struct {
|
||||
FLAC__MetadataType type;
|
||||
/**< The type of the metadata block; used determine which member of the
|
||||
* \a data union to dereference. */
|
||||
* \a data union to dereference. If type >= FLAC__METADATA_TYPE_UNDEFINED
|
||||
* then \a data.unknown must be used. */
|
||||
|
||||
FLAC__bool is_last;
|
||||
/**< \c true if this metadata block is the last, else \a false */
|
||||
@ -690,6 +698,7 @@ typedef struct {
|
||||
FLAC__StreamMetadata_SeekTable seek_table;
|
||||
FLAC__StreamMetadata_VorbisComment vorbis_comment;
|
||||
FLAC__StreamMetadata_CueSheet cue_sheet;
|
||||
FLAC__StreamMetadata_Unknown unknown;
|
||||
} data;
|
||||
/**< Polymorphic block data; use the \a type value to determine which
|
||||
* to use. */
|
||||
|
@ -907,6 +907,10 @@ FLAC_API FLAC__bool FLAC__metadata_iterator_insert_block_after(FLAC__Metadata_It
|
||||
* with the exception of FLAC__METADATA_TYPE_VORBIS_COMMENT, which will have
|
||||
* the vendor string set (but zero comments).
|
||||
*
|
||||
* Do not pass in a value greater than or equal to
|
||||
* \a FLAC__METADATA_TYPE_UNDEFINED unless you really know what you're
|
||||
* doing.
|
||||
*
|
||||
* \param type Type of object to create
|
||||
* \retval FLAC__StreamMetadata*
|
||||
* \c NULL if there was an error allocating memory, else the new instance.
|
||||
|
Loading…
Reference in New Issue
Block a user