summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorJosh Coalson <jcoalson@users.sourceforce.net>2006-09-23 19:21:19 +0000
committerJosh Coalson <jcoalson@users.sourceforce.net>2006-09-23 19:21:19 +0000
commite343ab2b87dbea605bbaebb1d1af786838510c92 (patch)
treefecd516eaf193c4b59dbf721a28241d131c60658 /include
parentaa1edebacd62b891d2fe046a0380a8c5c4cdc2a9 (diff)
downloadflac-e343ab2b87dbea605bbaebb1d1af786838510c92.tar.gz
add support for new PICTURE metadata block
Diffstat (limited to 'include')
-rw-r--r--include/FLAC++/metadata.h90
-rw-r--r--include/FLAC/format.h113
-rw-r--r--include/FLAC/metadata.h153
-rw-r--r--include/test_libs_common/metadata_utils.h4
4 files changed, 340 insertions, 20 deletions
diff --git a/include/FLAC++/metadata.h b/include/FLAC++/metadata.h
index 549546be..9641f91b 100644
--- a/include/FLAC++/metadata.h
+++ b/include/FLAC++/metadata.h
@@ -782,6 +782,80 @@ namespace FLAC {
FLAC__uint32 calculate_cddb_id() const;
};
+ /** PICTURE metadata block.
+ * See <A HREF="../format.html#metadata_block_picture">format specification</A>.
+ */
+ class FLACPP_API Picture : public Prototype {
+ public:
+ Picture();
+
+ //@{
+ /** Constructs a copy of the given object. This form
+ * always performs a deep copy.
+ */
+ inline Picture(const Picture &object): Prototype(object) { }
+ inline Picture(const ::FLAC__StreamMetadata &object): Prototype(object) { }
+ inline Picture(const ::FLAC__StreamMetadata *object): Prototype(object) { }
+ //@}
+
+ /** Constructs an object with copy control. See
+ * Prototype(::FLAC__StreamMetadata *object, bool copy).
+ */
+ inline Picture(::FLAC__StreamMetadata *object, bool copy): Prototype(object, copy) { }
+
+ ~Picture();
+
+ //@{
+ /** Assign from another object. Always performs a deep copy. */
+ inline Picture &operator=(const Picture &object) { Prototype::operator=(object); return *this; }
+ inline Picture &operator=(const ::FLAC__StreamMetadata &object) { Prototype::operator=(object); return *this; }
+ inline Picture &operator=(const ::FLAC__StreamMetadata *object) { Prototype::operator=(object); return *this; }
+ //@}
+
+ /** Assigns an object with copy control. See
+ * Prototype::assign_object(::FLAC__StreamMetadata *object, bool copy).
+ */
+ inline Picture &assign(::FLAC__StreamMetadata *object, bool copy) { Prototype::assign_object(object, copy); return *this; }
+
+ //@{
+ /** Check for equality, performing a deep compare by following pointers. */
+ inline bool operator==(const Picture &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 Picture &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); }
+ //@}
+
+ ::FLAC__StreamMetadata_Picture_Type get_type() const;
+ const char *get_mime_type() const; // NUL-terminated printable ASCII string
+ const FLAC__byte *get_description() const; // NUL-terminated UTF-8 string
+ FLAC__uint32 get_width() const;
+ FLAC__uint32 get_height() const;
+ FLAC__uint32 get_depth() const;
+ FLAC__uint32 get_data_length() const;
+ const FLAC__byte *get_data() const;
+
+ void set_type(::FLAC__StreamMetadata_Picture_Type type);
+
+ //! See FLAC__metadata_object_picture_set_mime_type()
+ bool set_mime_type(const char *string); // NUL-terminated printable ASCII string
+
+ //! See FLAC__metadata_object_picture_set_description()
+ bool set_description(const FLAC__byte *string); // NUL-terminated UTF-8 string
+
+ void set_width(FLAC__uint32 value) const;
+ void set_height(FLAC__uint32 value) const;
+ void set_depth(FLAC__uint32 value) const;
+
+ //! See FLAC__metadata_object_picture_set_data()
+ bool set_data(const FLAC__byte *data, FLAC__uint32 data_length);
+ };
+
/** 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
@@ -855,16 +929,16 @@ namespace FLAC {
* \{
*/
- //! See FLAC__metadata_get_streaminfo().
- FLACPP_API bool get_streaminfo(const char *filename, StreamInfo &streaminfo);
+ FLACPP_API bool get_streaminfo(const char *filename, StreamInfo &streaminfo); //< See FLAC__metadata_get_streaminfo().
+
+ FLACPP_API bool get_tags(const char *filename, VorbisComment *&tags); //< See FLAC__metadata_get_tags().
+ FLACPP_API bool get_tags(const char *filename, VorbisComment &tags); //< See FLAC__metadata_get_tags().
- //! See FLAC__metadata_get_tags().
- FLACPP_API bool get_tags(const char *filename, VorbisComment *&tags);
- FLACPP_API bool get_tags(const char *filename, VorbisComment &tags);
+ FLACPP_API bool get_cuesheet(const char *filename, CueSheet *&cuesheet); //! See FLAC__metadata_get_cuesheet().
+ FLACPP_API bool get_cuesheet(const char *filename, CueSheet &cuesheet); //! See FLAC__metadata_get_cuesheet().
- //! See FLAC__metadata_get_cuesheet().
- FLACPP_API bool get_cuesheet(const char *filename, CueSheet *&cuesheet);
- FLACPP_API bool get_cuesheet(const char *filename, CueSheet &cuesheet);
+ FLACPP_API bool get_picture(const char *filename, Picture *&picture, ::FLAC__StreamMetadata_Picture_Type type, const char *mime_type, const FLAC__byte *description, unsigned max_width, unsigned max_height, unsigned max_depth); //! See FLAC__metadata_get_picture().
+ FLACPP_API bool get_picture(const char *filename, Picture &picture, ::FLAC__StreamMetadata_Picture_Type type, const char *mime_type, const FLAC__byte *description, unsigned max_width, unsigned max_height, unsigned max_depth); //! See FLAC__metadata_get_picture().
/* \} */
diff --git a/include/FLAC/format.h b/include/FLAC/format.h
index de9f6eae..6d09df69 100644
--- a/include/FLAC/format.h
+++ b/include/FLAC/format.h
@@ -478,7 +478,10 @@ typedef enum {
FLAC__METADATA_TYPE_CUESHEET = 5,
/**< <A HREF="../format.html#metadata_block_cuesheet">CUESHEET</A> block */
- FLAC__METADATA_TYPE_UNDEFINED = 6
+ FLAC__METADATA_TYPE_PICTURE = 6,
+ /**< <A HREF="../format.html#metadata_block_picture">PICTURE</A> block */
+
+ FLAC__METADATA_TYPE_UNDEFINED = 7
/**< marker to denote beginning of undefined type range; this number will increase as new metadata types are added */
} FLAC__MetadataType;
@@ -678,7 +681,7 @@ typedef struct {
/**< The number of lead-in samples. */
FLAC__bool is_cd;
- /**< \c true if CUESHEET corresponds to a Compact Disc, else \c false */
+ /**< \c true if CUESHEET corresponds to a Compact Disc, else \c false. */
unsigned num_tracks;
/**< The number of tracks. */
@@ -695,6 +698,92 @@ 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) */
+/** An enumeration of the PICTURE types (see FLAC__StreamMetadataPicture and id3 v2.4 APIC tag). */
+typedef enum {
+ FLAC__STREAM_METADATA_PICTURE_TYPE_OTHER = 0, /**< Other */
+ FLAC__STREAM_METADATA_PICTURE_TYPE_FILE_ICON_STANDARD = 1, /**< 32x32 pixels 'file icon' (PNG only) */
+ FLAC__STREAM_METADATA_PICTURE_TYPE_FILE_ICON = 2, /**< Other file icon */
+ FLAC__STREAM_METADATA_PICTURE_TYPE_FRONT_COVER = 3, /**< Cover (front) */
+ FLAC__STREAM_METADATA_PICTURE_TYPE_BACK_COVER = 4, /**< Cover (back) */
+ FLAC__STREAM_METADATA_PICTURE_TYPE_LEAFLET_PAGE = 5, /**< Leaflet page */
+ FLAC__STREAM_METADATA_PICTURE_TYPE_MEDIA = 6, /**< Media (e.g. label side of CD) */
+ FLAC__STREAM_METADATA_PICTURE_TYPE_LEAD_ARTIST = 7, /**< Lead artist/lead performer/soloist */
+ FLAC__STREAM_METADATA_PICTURE_TYPE_ARTIST = 8, /**< Artist/performer */
+ FLAC__STREAM_METADATA_PICTURE_TYPE_CONDUCTOR = 9, /**< Conductor */
+ FLAC__STREAM_METADATA_PICTURE_TYPE_BAND = 10, /**< Band/Orchestra */
+ FLAC__STREAM_METADATA_PICTURE_TYPE_COMPOSER = 11, /**< Composer */
+ FLAC__STREAM_METADATA_PICTURE_TYPE_LYRICIST = 12, /**< Lyricist/text writer */
+ FLAC__STREAM_METADATA_PICTURE_TYPE_RECORDING_LOCATION = 13, /**< Recording Location */
+ FLAC__STREAM_METADATA_PICTURE_TYPE_DURING_RECORDING = 14, /**< During recording */
+ FLAC__STREAM_METADATA_PICTURE_TYPE_DURING_PERFORMANCE = 15, /**< During performance */
+ FLAC__STREAM_METADATA_PICTURE_TYPE_VIDEO_SCREEN_CAPTURE = 16, /**< Movie/video screen capture */
+ FLAC__STREAM_METADATA_PICTURE_TYPE_FISH = 17, /**< A bright coloured fish */
+ FLAC__STREAM_METADATA_PICTURE_TYPE_ILLUSTRATION = 18, /**< Illustration */
+ FLAC__STREAM_METADATA_PICTURE_TYPE_BAND_LOGOTYPE = 19, /**< Band/artist logotype */
+ FLAC__STREAM_METADATA_PICTURE_TYPE_PUBLISHER_LOGOTYPE = 20, /**< Publisher/Studio logotype */
+ FLAC__STREAM_METADATA_PICTURE_TYPE_UNDEFINED
+} FLAC__StreamMetadata_Picture_Type;
+
+/** Maps a FLAC__StreamMetadata_Picture_Type to a C string.
+ *
+ * Using a FLAC__StreamMetadata_Picture_Type as the index to this array
+ * will give the string equivalent. The contents should not be
+ * modified.
+ */
+extern FLAC_API const char * const FLAC__StreamMetadata_Picture_TypeString[];
+
+/** FLAC PICTURE structure. (See the
+ * <A HREF="../format.html#metadata_block_picture">format specification</A>
+ * for the full description of each field.)
+ */
+typedef struct {
+ FLAC__StreamMetadata_Picture_Type type;
+ /**< The kind of picture stored. */
+
+ char *mime_type;
+ /**< Picture data's MIME type, in ASCII printable characters
+ * 0x20-0x7e, NUL terminated. For best compatibility with players,
+ * use picture data of MIME type \c image/jpeg or \c image/png. A
+ * MIME type of '-->' is also allowed, in which case the picture
+ * data should be a complete URL. In file storage, the MIME type is
+ * stored as a 32-bit length followed by the ASCII string with no NUL
+ * terminator, but is converted to a plain C string in this structure
+ * for convenience.
+ */
+
+ FLAC__byte *description;
+ /**< Picture's description in UTF-8, NUL terminated. In file storage,
+ * the description is stored as a 32-bit length followed by the UTF-8
+ * string with no NUL terminator, but is converted to a plain C string
+ * in this structure for convenience.
+ */
+
+ FLAC__uint32 width;
+ /**< Picture's width in pixels. */
+
+ FLAC__uint32 height;
+ /**< Picture's height in pixels. */
+
+ FLAC__uint32 depth;
+ /**< Picture's color depth in bits-per-pixel. */
+
+ FLAC__uint32 data_length;
+ /**< Length of binary picture data in bytes. */
+
+ FLAC__byte *data;
+ /**< Binary picture data. */
+
+} FLAC__StreamMetadata_Picture;
+
+extern FLAC_API const unsigned FLAC__STREAM_METADATA_PICTURE_TYPE_LEN; /**< == 32 (bits) */
+extern FLAC_API const unsigned FLAC__STREAM_METADATA_PICTURE_MIME_TYPE_LENGTH_LEN; /**< == 32 (bits) */
+extern FLAC_API const unsigned FLAC__STREAM_METADATA_PICTURE_DESCRIPTION_LENGTH_LEN; /**< == 32 (bits) */
+extern FLAC_API const unsigned FLAC__STREAM_METADATA_PICTURE_WIDTH_LEN; /**< == 32 (bits) */
+extern FLAC_API const unsigned FLAC__STREAM_METADATA_PICTURE_HEIGHT_LEN; /**< == 32 (bits) */
+extern FLAC_API const unsigned FLAC__STREAM_METADATA_PICTURE_DEPTH_LEN; /**< == 32 (bits) */
+extern FLAC_API const unsigned FLAC__STREAM_METADATA_PICTURE_DATA_LENGTH_LEN; /**< == 32 (bits) */
+
+
/** Structure that is used when a metadata block of unknown type is loaded.
* The contents are opaque. The structure is used only internally to
* correctly handle unknown metadata.
@@ -725,6 +814,7 @@ typedef struct {
FLAC__StreamMetadata_SeekTable seek_table;
FLAC__StreamMetadata_VorbisComment vorbis_comment;
FLAC__StreamMetadata_CueSheet cue_sheet;
+ FLAC__StreamMetadata_Picture picture;
FLAC__StreamMetadata_Unknown unknown;
} data;
/**< Polymorphic block data; use the \a type value to determine which
@@ -852,6 +942,25 @@ FLAC_API unsigned FLAC__format_seektable_sort(FLAC__StreamMetadata_SeekTable *se
*/
FLAC_API FLAC__bool FLAC__format_cuesheet_is_legal(const FLAC__StreamMetadata_CueSheet *cue_sheet, FLAC__bool check_cd_da_subset, const char **violation);
+/* @@@@ add to unit tests; it is already indirectly tested by the metadata_object tests */
+/** Check picture data to see if it conforms to the FLAC specification.
+ * See the format specification for limits on the contents of the
+ * PICTURE block.
+ *
+ * \param picture A pointer to existing picture data to be checked.
+ * \param violation Address of a pointer to a string. If there is a
+ * violation, a pointer to a string explanation of the
+ * violation will be returned here. \a violation may be
+ * \c NULL if you don't need the returned string. Do not
+ * free the returned string; it will always point to static
+ * data.
+ * \assert
+ * \code picture != NULL \endcode
+ * \retval FLAC__bool
+ * \c false if picture data is illegal, else \c true.
+ */
+FLAC_API FLAC__bool FLAC__format_picture_is_legal(const FLAC__StreamMetadata_Picture *picture, const char **violation);
+
/* \} */
#ifdef __cplusplus
diff --git a/include/FLAC/metadata.h b/include/FLAC/metadata.h
index e5799de8..68b24531 100644
--- a/include/FLAC/metadata.h
+++ b/include/FLAC/metadata.h
@@ -64,7 +64,8 @@
* There are three metadata interfaces of increasing complexity:
*
* Level 0:
- * Read-only access to the STREAMINFO and VORBIS_COMMENT blocks.
+ * Read-only access to the STREAMINFO, VORBIS_COMMENT, CUESHEET, and
+ * PICTURE blocks.
*
* Level 1:
* Read-write access to all metadata blocks. This level is write-
@@ -124,7 +125,8 @@ extern "C" {
*
* \brief
* The level 0 interface consists of individual routines to read the
- * STREAMINFO, VORBIS_COMMENT, and CUESHEET blocks, requiring only a filename.
+ * STREAMINFO, VORBIS_COMMENT, CUESHEET, and PICTURE blocks, requiring
+ * only a filename.
*
* They try to skip any ID3v2 tag at the head of the file.
*
@@ -162,7 +164,7 @@ FLAC_API FLAC__bool FLAC__metadata_get_streaminfo(const char *filename, FLAC__St
* \code tags != NULL \endcode
* \retval FLAC__bool
* \c true if a valid VORBIS_COMMENT block was read from \a filename,
- * and \a *tags will be set to the address of the tag structure.
+ * and \a *tags will be set to the address of the metadata structure.
* Returns \c false if there was a memory allocation error, a file
* decoder error, or the file contained no VORBIS_COMMENT block, and
* \a *tags will be set to \c NULL.
@@ -181,13 +183,51 @@ FLAC_API FLAC__bool FLAC__metadata_get_tags(const char *filename, FLAC__StreamMe
* \code cuesheet != NULL \endcode
* \retval FLAC__bool
* \c true if a valid CUESHEET block was read from \a filename,
- * and \a *cuesheet will be set to the address of the tag structure.
- * Returns \c false if there was a memory allocation error, a file
- * decoder error, or the file contained no CUESHEET block, and
- * \a *cuesheet will be set to \c NULL.
+ * and \a *cuesheet will be set to the address of the metadata
+ * structure. Returns \c false if there was a memory allocation
+ * error, a file decoder error, or the file contained no CUESHEET
+ * block, and \a *cuesheet will be set to \c NULL.
*/
FLAC_API FLAC__bool FLAC__metadata_get_cuesheet(const char *filename, FLAC__StreamMetadata **cuesheet);
+/** Read a PICTURE metadata block of the given FLAC file. This
+ * function will try to skip any ID3v2 tag at the head of the file.
+ * Since there can be more than one PICTURE block in a file, this
+ * function takes a number of parameters that act as constraints to
+ * the search. The PICTURE block with the largest area matching all
+ * the constraints will be returned, or \a *picture will be set to
+ * \c NULL if there was no such block.
+ *
+ * \param filename The path to the FLAC file to read.
+ * \param picture The address where the returned pointer will be
+ * stored. The \a picture object must be deleted by
+ * the caller using FLAC__metadata_object_delete().
+ * \param type The desired picture type. Use \c -1 to mean
+ * "any type".
+ * \param mime_type The desired MIME type, e.g. "image/jpeg". The
+ * string will be matched exactly. Use \c NULL to
+ * mean "any MIME type".
+ * \param description The desired description. The string will be
+ * matched exactly. Use \c NULL to mean "any
+ * description".
+ * \param max_width The maximum width in pixels desired. Use
+ * \c (unsigned)(-1) to mean "any width".
+ * \param max_height The maximum height in pixels desired. Use
+ * \c (unsigned)(-1) to mean "any height".
+ * \param max_depth The maximum color depth in bits-per-pixel desired.
+ * Use \c (unsigned)(-1) to mean "any depth".
+ * \assert
+ * \code filename != NULL \endcode
+ * \code picture != NULL \endcode
+ * \retval FLAC__bool
+ * \c true if a valid PICTURE block was read from \a filename,
+ * and \a *picture will be set to the address of the metadata
+ * structure. Returns \c false if there was a memory allocation
+ * error, a file decoder error, or the file contained no PICTURE
+ * block, and \a *picture will be set to \c NULL.
+ */
+FLAC_API FLAC__bool FLAC__metadata_get_picture(const char *filename, FLAC__StreamMetadata **picture, FLAC__StreamMetadata_Picture_Type type, const char *mime_type, const FLAC__byte *description, unsigned max_width, unsigned max_height, unsigned max_depth);
+
/* \} */
@@ -203,9 +243,9 @@ FLAC_API FLAC__bool FLAC__metadata_get_cuesheet(const char *filename, FLAC__Stre
* - Create an iterator using FLAC__metadata_simple_iterator_new()
* - Attach it to a file using FLAC__metadata_simple_iterator_init() and check
* the exit code. Call FLAC__metadata_simple_iterator_is_writable() to
- * see if the file is writable, or read-only access is allowed.
+ * see if the file is writable, or only read access is allowed.
* - Use FLAC__metadata_simple_iterator_next() and
- * FLAC__metadata_simple_iterator_prev() to move around the blocks.
+ * FLAC__metadata_simple_iterator_prev() to traverse the blocks.
* This is does not read the actual blocks themselves.
* FLAC__metadata_simple_iterator_next() is relatively fast.
* FLAC__metadata_simple_iterator_prev() is slower since it needs to search
@@ -1185,7 +1225,11 @@ FLAC_API FLAC__bool FLAC__metadata_object_is_equal(const FLAC__StreamMetadata *b
/** Sets the application data of an APPLICATION block.
*
* If \a copy is \c true, a copy of the data is stored; otherwise, the object
- * takes ownership of the pointer.
+ * takes ownership of the pointer. The existing data will be freed if this
+ * function is successful, otherwise the original data will remain if \a copy
+ * is \c true and malloc() fails.
+ *
+ * \note It is safe to pass a const pointer to \a data if \a copy is \c true.
*
* \param object A pointer to an existing APPLICATION object.
* \param data A pointer to the data to set.
@@ -1911,6 +1955,95 @@ FLAC_API FLAC__bool FLAC__metadata_object_cuesheet_is_legal(const FLAC__StreamMe
*/
FLAC_API FLAC__uint32 FLAC__metadata_object_cuesheet_calculate_cddb_id(const FLAC__StreamMetadata *object);
+/** Sets the MIME type of a PICTURE block.
+ *
+ * If \a copy is \c true, a copy of the string is stored; otherwise, the object
+ * takes ownership of the pointer. The existing string will be freed if this
+ * function is successful, otherwise the original string will remain if \a copy
+ * is \c true and malloc() fails.
+ *
+ * \note It is safe to pass a const pointer to \a mime_type if \a copy is \c true.
+ *
+ * \param object A pointer to an existing PICTURE object.
+ * \param mime_type A pointer to the MIME type string. The string must be
+ * ASCII characters 0x20-0x7e, NUL-terminated. No validation
+ * is done.
+ * \param copy See above.
+ * \assert
+ * \code object != NULL \endcode
+ * \code object->type == FLAC__METADATA_TYPE_PICTURE \endcode
+ * \code (mime_type != NULL) \endcode
+ * \retval FLAC__bool
+ * \c false if \a copy is \c true and malloc() fails, else \c true.
+ */
+FLAC_API FLAC__bool FLAC__metadata_object_picture_set_mime_type(FLAC__StreamMetadata *object, char *mime_type, FLAC__bool copy);
+
+/** Sets the description of a PICTURE block.
+ *
+ * If \a copy is \c true, a copy of the string is stored; otherwise, the object
+ * takes ownership of the pointer. The existing string will be freed if this
+ * function is successful, otherwise the original string will remain if \a copy
+ * is \c true and malloc() fails.
+ *
+ * \note It is safe to pass a const pointer to \a description if \a copy is \c true.
+ *
+ * \param object A pointer to an existing PICTURE object.
+ * \param description A pointer to the description string. The string must be
+ * valid UTF-8, NUL-terminated. No validation is done.
+ * \param copy See above.
+ * \assert
+ * \code object != NULL \endcode
+ * \code object->type == FLAC__METADATA_TYPE_PICTURE \endcode
+ * \code (description != NULL) \endcode
+ * \retval FLAC__bool
+ * \c false if \a copy is \c true and malloc() fails, else \c true.
+ */
+FLAC_API FLAC__bool FLAC__metadata_object_picture_set_description(FLAC__StreamMetadata *object, FLAC__byte *description, FLAC__bool copy);
+
+/** Sets the picture data of a PICTURE block.
+ *
+ * If \a copy is \c true, a copy of the data is stored; otherwise, the object
+ * takes ownership of the pointer. Also sets the \a data_length field of the
+ * metadata object to what is passed in as the \a length parameter. The
+ * existing data will be freed if this function is successful, otherwise the
+ * original data and data_length will remain if \a copy is \c true and
+ * malloc() fails.
+ *
+ * \note It is safe to pass a const pointer to \a data if \a copy is \c true.
+ *
+ * \param object A pointer to an existing PICTURE object.
+ * \param data A pointer to the data to set.
+ * \param length The length of \a data in bytes.
+ * \param copy See above.
+ * \assert
+ * \code object != NULL \endcode
+ * \code object->type == FLAC__METADATA_TYPE_PICTURE \endcode
+ * \code (data != NULL && length > 0) ||
+ * (data == NULL && length == 0 && copy == false) \endcode
+ * \retval FLAC__bool
+ * \c false if \a copy is \c true and malloc() fails, else \c true.
+ */
+FLAC_API FLAC__bool FLAC__metadata_object_picture_set_data(FLAC__StreamMetadata *object, FLAC__byte *data, FLAC__uint32 length, FLAC__bool copy);
+
+/** Check a PICTURE block to see if it conforms to the FLAC specification.
+ * See the format specification for limits on the contents of the
+ * PICTURE block.
+ *
+ * \param picture A pointer to existing PICTURE block to be checked.
+ * \param violation Address of a pointer to a string. If there is a
+ * violation, a pointer to a string explanation of the
+ * violation will be returned here. \a violation may be
+ * \c NULL if you don't need the returned string. Do not
+ * free the returned string; it will always point to static
+ * data.
+ * \assert
+ * \code object != NULL \endcode
+ * \code object->type == FLAC__METADATA_TYPE_PICTURE \endcode
+ * \retval FLAC__bool
+ * \c false if PICTURE block is illegal, else \c true.
+ */
+FLAC_API FLAC__bool FLAC__metadata_object_picture_is_legal(const FLAC__StreamMetadata *object, const char **violation);
+
/* \} */
#ifdef __cplusplus
diff --git a/include/test_libs_common/metadata_utils.h b/include/test_libs_common/metadata_utils.h
index 3d7af192..882bf5b5 100644
--- a/include/test_libs_common/metadata_utils.h
+++ b/include/test_libs_common/metadata_utils.h
@@ -40,6 +40,8 @@ FLAC__bool mutils__compare_block_data_vorbiscomment(const FLAC__StreamMetadata_V
FLAC__bool mutils__compare_block_data_cuesheet(const FLAC__StreamMetadata_CueSheet *block, const FLAC__StreamMetadata_CueSheet *blockcopy);
+FLAC__bool mutils__compare_block_data_picture(const FLAC__StreamMetadata_Picture *block, const FLAC__StreamMetadata_Picture *blockcopy);
+
FLAC__bool mutils__compare_block_data_unknown(const FLAC__StreamMetadata_Unknown *block, const FLAC__StreamMetadata_Unknown *blockcopy, unsigned block_length);
FLAC__bool mutils__compare_block(const FLAC__StreamMetadata *block, const FLAC__StreamMetadata *blockcopy);
@@ -52,6 +54,7 @@ void mutils__init_metadata_blocks(
FLAC__StreamMetadata *application2,
FLAC__StreamMetadata *vorbiscomment,
FLAC__StreamMetadata *cuesheet,
+ FLAC__StreamMetadata *picture,
FLAC__StreamMetadata *unknown
);
@@ -63,6 +66,7 @@ void mutils__free_metadata_blocks(
FLAC__StreamMetadata *application2,
FLAC__StreamMetadata *vorbiscomment,
FLAC__StreamMetadata *cuesheet,
+ FLAC__StreamMetadata *picture,
FLAC__StreamMetadata *unknown
);