📄 metadata.h
字号:
*/FLAC_API FLAC__Metadata_Iterator *FLAC__metadata_iterator_new();/** Free an iterator instance. Deletes the object pointed to by \a iterator. * * \param iterator A pointer to an existing iterator. * \assert * \code iterator != NULL \endcode */FLAC_API void FLAC__metadata_iterator_delete(FLAC__Metadata_Iterator *iterator);/** Initialize the iterator to point to the first metadata block in the * given chain. * * \param iterator A pointer to an existing iterator. * \param chain A pointer to an existing and initialized (read) chain. * \assert * \code iterator != NULL \endcode * \code chain != NULL \endcode */FLAC_API void FLAC__metadata_iterator_init(FLAC__Metadata_Iterator *iterator, FLAC__Metadata_Chain *chain);/** Moves the iterator forward one metadata block, returning \c false if * already at the end. * * \param iterator A pointer to an existing initialized iterator. * \assert * \code iterator != NULL \endcode * \a iterator has been successfully initialized with * FLAC__metadata_iterator_init() * \retval FLAC__bool * \c false if already at the last metadata block of the chain, else * \c true. */FLAC_API FLAC__bool FLAC__metadata_iterator_next(FLAC__Metadata_Iterator *iterator);/** Moves the iterator backward one metadata block, returning \c false if * already at the beginning. * * \param iterator A pointer to an existing initialized iterator. * \assert * \code iterator != NULL \endcode * \a iterator has been successfully initialized with * FLAC__metadata_iterator_init() * \retval FLAC__bool * \c false if already at the first metadata block of the chain, else * \c true. */FLAC_API FLAC__bool FLAC__metadata_iterator_prev(FLAC__Metadata_Iterator *iterator);/** Get the type of the metadata block at the current position. * * \param iterator A pointer to an existing initialized iterator. * \assert * \code iterator != NULL \endcode * \a iterator has been successfully initialized with * FLAC__metadata_iterator_init() * \retval FLAC__MetadataType * The type of the metadata block at the current iterator position. */FLAC_API FLAC__MetadataType FLAC__metadata_iterator_get_block_type(const FLAC__Metadata_Iterator *iterator);/** Get the metadata block at the current position. You can modify * the block in place but must write the chain before the changes * are reflected to the FLAC file. You do not need to call * FLAC__metadata_iterator_set_block() to reflect the changes; * the pointer returned by FLAC__metadata_iterator_get_block() * points directly into the chain. * * \warning * Do not call FLAC__metadata_object_delete() on the returned object; * to delete a block use FLAC__metadata_iterator_delete_block(). * * \param iterator A pointer to an existing initialized iterator. * \assert * \code iterator != NULL \endcode * \a iterator has been successfully initialized with * FLAC__metadata_iterator_init() * \retval FLAC__StreamMetadata* * The current metadata block. */FLAC_API 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 it will be * deleted when the chain is deleted. * * \param iterator A pointer to an existing initialized iterator. * \param block A pointer to a metadata block. * \assert * \code iterator != NULL \endcode * \a iterator has been successfully initialized with * FLAC__metadata_iterator_init() * \code block != NULL \endcode * \retval FLAC__bool * \c false if the conditions in the above description are not met, or * a memory allocation error occurs, otherwise \c true. */FLAC_API FLAC__bool FLAC__metadata_iterator_set_block(FLAC__Metadata_Iterator *iterator, FLAC__StreamMetadata *block);/** Removes the current block from the chain. If \a replace_with_padding is * \c true, the block will instead be replaced with a padding block of equal * size. You can not delete the STREAMINFO block. The iterator will be * left pointing to the block before the one just "deleted", even if * \a replace_with_padding is \c true. * * \param iterator A pointer to an existing initialized iterator. * \param replace_with_padding See above. * \assert * \code iterator != NULL \endcode * \a iterator has been successfully initialized with * FLAC__metadata_iterator_init() * \retval FLAC__bool * \c false if the conditions in the above description are not met, * otherwise \c true. */FLAC_API FLAC__bool FLAC__metadata_iterator_delete_block(FLAC__Metadata_Iterator *iterator, FLAC__bool replace_with_padding);/** Insert a new block before the current block. You cannot insert a block * before the first STREAMINFO block. You cannot insert a STREAMINFO block * as there can be only one, the one that already exists at the head when you * read in a chain. The chain takes ownership of the new block and it will be * deleted when the chain is deleted. The iterator will be left pointing to * the new block. * * \param iterator A pointer to an existing initialized iterator. * \param block A pointer to a metadata block to insert. * \assert * \code iterator != NULL \endcode * \a iterator has been successfully initialized with * FLAC__metadata_iterator_init() * \retval FLAC__bool * \c false if the conditions in the above description are not met, or * a memory allocation error occurs, otherwise \c true. */FLAC_API FLAC__bool FLAC__metadata_iterator_insert_block_before(FLAC__Metadata_Iterator *iterator, FLAC__StreamMetadata *block);/** Insert a new block after the current block. You cannot insert a STREAMINFO * block as there can be only one, the one that already exists at the head when * you read in a chain. The chain takes ownership of the new block and it will * be deleted when the chain is deleted. The iterator will be left pointing to * the new block. * * \param iterator A pointer to an existing initialized iterator. * \param block A pointer to a metadata block to insert. * \assert * \code iterator != NULL \endcode * \a iterator has been successfully initialized with * FLAC__metadata_iterator_init() * \retval FLAC__bool * \c false if the conditions in the above description are not met, or * a memory allocation error occurs, otherwise \c true. */FLAC_API FLAC__bool FLAC__metadata_iterator_insert_block_after(FLAC__Metadata_Iterator *iterator, FLAC__StreamMetadata *block);/* \} *//** \defgroup flac_metadata_object FLAC/metadata.h: metadata object methods * \ingroup flac_metadata * * \brief * This module contains methods for manipulating FLAC metadata objects. * * Since many are variable length we have to be careful about the memory * management. We decree that all pointers to data in the object are * owned by the object and memory-managed by the object. * * Use the FLAC__metadata_object_new() and FLAC__metadata_object_delete() * functions to create all instances. When using the * FLAC__metadata_object_set_*() functions to set pointers to data, set * \a copy to \c true to have the function make it's own copy of the data, or * to \c false to give the object ownership of your data. In the latter case * your pointer must be freeable by free() and will be free()d when the object * is FLAC__metadata_object_delete()d. It is legal to pass a null pointer as * the data pointer to a FLAC__metadata_object_set_*() function as long as * the length argument is 0 and the \a copy argument is \c false. * * The FLAC__metadata_object_new() and FLAC__metadata_object_clone() function * will return \c NULL in the case of a memory allocation error, otherwise a new * object. The FLAC__metadata_object_set_*() functions return \c 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 to * FLAC__metadata_object_application_set_data(), you will get an assertion * failure. * * For convenience the FLAC__metadata_object_vorbiscomment_*() functions * maintain a trailing NUL on each Vorbis comment entry. This is not counted * toward the length or stored in the stream, but it can make working with plain * comments (those that don't contain embedded-NULs in the value) easier. * Entries passed into these functions have trailing NULs added if missing, and * returned entries are guaranteed to have a trailing NUL. * * The FLAC__metadata_object_vorbiscomment_*() functions that take a Vorbis * comment entry/name/value will first validate that it complies with the Vorbis * comment specification and return false if it does not. * * There is no need to recalculate the length field on metadata blocks you * have modified. They will be calculated automatically before they are * written back to a file. * * \{ *//** Create a new metadata object instance of the given type. * * The object will be "empty"; i.e. values and data pointers will be \c 0, * 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 or the type code is * greater than FLAC__MAX_METADATA_TYPE_CODE, else the new instance. */FLAC_API FLAC__StreamMetadata *FLAC__metadata_object_new(FLAC__MetadataType type);/** Create a copy of an existing metadata object. * * The copy is a "deep" copy, i.e. dynamically allocated data within the * object is also copied. The caller takes ownership of the new block and * is responsible for freeing it with FLAC__metadata_object_delete(). * * \param object Pointer to object to copy. * \assert * \code object != NULL \endcode * \retval FLAC__StreamMetadata* * \c NULL if there was an error allocating memory, else the new instance. */FLAC_API FLAC__StreamMetadata *FLAC__metadata_object_clone(const FLAC__StreamMetadata *object);/** Free a metadata object. Deletes the object pointed to by \a object. * * The delete is a "deep" delete, i.e. dynamically allocated data within the * object is also deleted. * * \param object A pointer to an existing object. * \assert * \code object != NULL \endcode */FLAC_API void FLAC__metadata_object_delete(FLAC__StreamMetadata *object);/** Compares two metadata objects. * * The compare is "deep", i.e. dynamically allocated data within the * object is also compared. * * \param block1 A pointer to an existing object. * \param block2 A pointer to an existing object. * \assert * \code block1 != NULL \endcode * \code block2 != NULL \endcode * \retval FLAC__bool * \c true if objects are identical, else \c false. */FLAC_API FLAC__bool FLAC__metadata_object_is_equal(const FLAC__StreamMetadata *block1, const FLAC__StreamMetadata *block2);/** 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. * * \param object A pointer to an existing APPLICATION 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_APPLICATION \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_application_set_data(FLAC__StreamMetadata *object, FLAC__byte *data, unsigned length, FLAC__bool copy);/** Resize the seekpoint array. * * If the size shrinks, elements will truncated; if it grows, new placeholder * points will be added to the end. * * \param object A pointer to an existing SEEKTABLE object. * \param new_num_points The desired length of the array; may be \c 0. * \assert * \code object != NULL \endcode * \code object->type == FLAC__METADATA_TYPE_SEEKTABLE \endcode * \code (object->data.seek_table.points == NULL && object->data.seek_table.num_points == 0) || * (object->data.seek_table.points != NULL && object->data.seek_table.num_points > 0) \endcode * \retval FLAC__bool * \c false if memory allocation error, else \c true. */FLAC_API FLAC__bool FLAC__metadata_object_seektable_resize_points(FLAC__StreamMetadata *object, unsigned new_num_points);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -