RetroArch
Typedefs | Enumerations | Functions | Variables
FLAC/metadata.h: metadata level 2 interface

The level 2 interface provides read-write access to FLAC file metadata; all metadata is read into memory, operated on in memory, and then written to file, which is more efficient than level 1 when editing multiple blocks. More...

Collaboration diagram for FLAC/metadata.h: metadata level 2 interface:

Typedefs

typedef struct FLAC__Metadata_Chain FLAC__Metadata_Chain
 
typedef struct FLAC__Metadata_Iterator FLAC__Metadata_Iterator
 

Enumerations

enum  FLAC__Metadata_ChainStatus {
  FLAC__METADATA_CHAIN_STATUS_OK = 0, FLAC__METADATA_CHAIN_STATUS_ILLEGAL_INPUT, FLAC__METADATA_CHAIN_STATUS_ERROR_OPENING_FILE, FLAC__METADATA_CHAIN_STATUS_NOT_A_FLAC_FILE,
  FLAC__METADATA_CHAIN_STATUS_NOT_WRITABLE, FLAC__METADATA_CHAIN_STATUS_BAD_METADATA, FLAC__METADATA_CHAIN_STATUS_READ_ERROR, FLAC__METADATA_CHAIN_STATUS_SEEK_ERROR,
  FLAC__METADATA_CHAIN_STATUS_WRITE_ERROR, FLAC__METADATA_CHAIN_STATUS_RENAME_ERROR, FLAC__METADATA_CHAIN_STATUS_UNLINK_ERROR, FLAC__METADATA_CHAIN_STATUS_MEMORY_ALLOCATION_ERROR,
  FLAC__METADATA_CHAIN_STATUS_INTERNAL_ERROR, FLAC__METADATA_CHAIN_STATUS_INVALID_CALLBACKS, FLAC__METADATA_CHAIN_STATUS_READ_WRITE_MISMATCH, FLAC__METADATA_CHAIN_STATUS_WRONG_WRITE_CALL
}
 

Functions

FLAC_API FLAC__Metadata_ChainFLAC__metadata_chain_new (void)
 
FLAC_API void FLAC__metadata_chain_delete (FLAC__Metadata_Chain *chain)
 
FLAC_API FLAC__Metadata_ChainStatus FLAC__metadata_chain_status (FLAC__Metadata_Chain *chain)
 
FLAC_API FLAC__bool FLAC__metadata_chain_read (FLAC__Metadata_Chain *chain, const char *filename)
 
FLAC_API FLAC__bool FLAC__metadata_chain_read_ogg (FLAC__Metadata_Chain *chain, const char *filename)
 
FLAC_API FLAC__bool FLAC__metadata_chain_read_with_callbacks (FLAC__Metadata_Chain *chain, FLAC__IOHandle handle, FLAC__IOCallbacks callbacks)
 
FLAC_API FLAC__bool FLAC__metadata_chain_read_ogg_with_callbacks (FLAC__Metadata_Chain *chain, FLAC__IOHandle handle, FLAC__IOCallbacks callbacks)
 
FLAC_API FLAC__bool FLAC__metadata_chain_check_if_tempfile_needed (FLAC__Metadata_Chain *chain, FLAC__bool use_padding)
 
FLAC_API FLAC__bool FLAC__metadata_chain_write (FLAC__Metadata_Chain *chain, FLAC__bool use_padding, FLAC__bool preserve_file_stats)
 
FLAC_API FLAC__bool FLAC__metadata_chain_write_with_callbacks (FLAC__Metadata_Chain *chain, FLAC__bool use_padding, FLAC__IOHandle handle, FLAC__IOCallbacks callbacks)
 
FLAC_API FLAC__bool FLAC__metadata_chain_write_with_callbacks_and_tempfile (FLAC__Metadata_Chain *chain, FLAC__bool use_padding, FLAC__IOHandle handle, FLAC__IOCallbacks callbacks, FLAC__IOHandle temp_handle, FLAC__IOCallbacks temp_callbacks)
 
FLAC_API void FLAC__metadata_chain_merge_padding (FLAC__Metadata_Chain *chain)
 
FLAC_API void FLAC__metadata_chain_sort_padding (FLAC__Metadata_Chain *chain)
 
FLAC_API FLAC__Metadata_IteratorFLAC__metadata_iterator_new (void)
 
FLAC_API void FLAC__metadata_iterator_delete (FLAC__Metadata_Iterator *iterator)
 
FLAC_API void FLAC__metadata_iterator_init (FLAC__Metadata_Iterator *iterator, FLAC__Metadata_Chain *chain)
 
FLAC_API FLAC__bool FLAC__metadata_iterator_next (FLAC__Metadata_Iterator *iterator)
 
FLAC_API FLAC__bool FLAC__metadata_iterator_prev (FLAC__Metadata_Iterator *iterator)
 
FLAC_API FLAC__MetadataType FLAC__metadata_iterator_get_block_type (const FLAC__Metadata_Iterator *iterator)
 
FLAC_API FLAC__StreamMetadataFLAC__metadata_iterator_get_block (FLAC__Metadata_Iterator *iterator)
 
FLAC_API FLAC__bool FLAC__metadata_iterator_set_block (FLAC__Metadata_Iterator *iterator, FLAC__StreamMetadata *block)
 
FLAC_API FLAC__bool FLAC__metadata_iterator_delete_block (FLAC__Metadata_Iterator *iterator, FLAC__bool replace_with_padding)
 
FLAC_API FLAC__bool FLAC__metadata_iterator_insert_block_before (FLAC__Metadata_Iterator *iterator, FLAC__StreamMetadata *block)
 
FLAC_API FLAC__bool FLAC__metadata_iterator_insert_block_after (FLAC__Metadata_Iterator *iterator, FLAC__StreamMetadata *block)
 

Variables

FLAC_API const char *const FLAC__Metadata_ChainStatusString []
 

Detailed Description

The level 2 interface provides read-write access to FLAC file metadata; all metadata is read into memory, operated on in memory, and then written to file, which is more efficient than level 1 when editing multiple blocks.

Currently Ogg FLAC is supported for read only, via FLAC__metadata_chain_read_ogg() but a subsequent FLAC__metadata_chain_write() will fail.

The general usage of this interface is:

Note
Even though the FLAC file is not open while the chain is being manipulated, you must not alter the file externally during this time. The chain assumes the FLAC file will not change between the time of FLAC__metadata_chain_read()/FLAC__metadata_chain_read_ogg() and FLAC__metadata_chain_write().
Do not modify the is_last, length, or type fields of returned FLAC__StreamMetadata objects. These are managed automatically.
The metadata objects returned by FLAC__metadata_iterator_get_block() are owned by the chain; do not FLAC__metadata_object_delete() them. In the same way, blocks passed to FLAC__metadata_iterator_set_block() become owned by the chain and they will be deleted when the chain is deleted.

Typedef Documentation

◆ FLAC__Metadata_Chain

The opaque structure definition for the level 2 chain type.

◆ FLAC__Metadata_Iterator

The opaque structure definition for the level 2 iterator type.

Enumeration Type Documentation

◆ FLAC__Metadata_ChainStatus

Enumerator
FLAC__METADATA_CHAIN_STATUS_OK 

The chain is in the normal OK state

FLAC__METADATA_CHAIN_STATUS_ILLEGAL_INPUT 

The data passed into a function violated the function's usage criteria

FLAC__METADATA_CHAIN_STATUS_ERROR_OPENING_FILE 

The chain could not open the target file

FLAC__METADATA_CHAIN_STATUS_NOT_A_FLAC_FILE 

The chain could not find the FLAC signature at the start of the file

FLAC__METADATA_CHAIN_STATUS_NOT_WRITABLE 

The chain tried to write to a file that was not writable

FLAC__METADATA_CHAIN_STATUS_BAD_METADATA 

The chain encountered input that does not conform to the FLAC metadata specification

FLAC__METADATA_CHAIN_STATUS_READ_ERROR 

The chain encountered an error while reading the FLAC file

FLAC__METADATA_CHAIN_STATUS_SEEK_ERROR 

The chain encountered an error while seeking in the FLAC file

FLAC__METADATA_CHAIN_STATUS_WRITE_ERROR 

The chain encountered an error while writing the FLAC file

FLAC__METADATA_CHAIN_STATUS_RENAME_ERROR 

The chain encountered an error renaming the FLAC file

FLAC__METADATA_CHAIN_STATUS_UNLINK_ERROR 

The chain encountered an error removing the temporary file

FLAC__METADATA_CHAIN_STATUS_MEMORY_ALLOCATION_ERROR 

Memory allocation failed

FLAC__METADATA_CHAIN_STATUS_INTERNAL_ERROR 

The caller violated an assertion or an unexpected error occurred

FLAC__METADATA_CHAIN_STATUS_INVALID_CALLBACKS 

One or more of the required callbacks was NULL

FLAC__METADATA_CHAIN_STATUS_READ_WRITE_MISMATCH 

FLAC__metadata_chain_write() was called on a chain read by FLAC__metadata_chain_read_with_callbacks()/FLAC__metadata_chain_read_ogg_with_callbacks(), or FLAC__metadata_chain_write_with_callbacks()/FLAC__metadata_chain_write_with_callbacks_and_tempfile() was called on a chain read by FLAC__metadata_chain_read()/FLAC__metadata_chain_read_ogg(). Matching read/write methods must always be used.

FLAC__METADATA_CHAIN_STATUS_WRONG_WRITE_CALL 

FLAC__metadata_chain_write_with_callbacks() was called when the chain write requires a tempfile; use FLAC__metadata_chain_write_with_callbacks_and_tempfile() instead. Or, FLAC__metadata_chain_write_with_callbacks_and_tempfile() was called when the chain write does not require a tempfile; use FLAC__metadata_chain_write_with_callbacks() instead. Always check FLAC__metadata_chain_check_if_tempfile_needed() before writing via callbacks.

Function Documentation

◆ FLAC__metadata_chain_check_if_tempfile_needed()

FLAC_API FLAC__bool FLAC__metadata_chain_check_if_tempfile_needed ( FLAC__Metadata_Chain chain,
FLAC__bool  use_padding 
)

Checks if writing the given chain would require the use of a temporary file, or if it could be written in place.

Under certain conditions, padding can be utilized so that writing edited metadata back to the FLAC file does not require rewriting the entire file. If rewriting is required, then a temporary workfile is required. When writing metadata using callbacks, you must check this function to know whether to call FLAC__metadata_chain_write_with_callbacks() or FLAC__metadata_chain_write_with_callbacks_and_tempfile(). When writing with FLAC__metadata_chain_write(), the temporary file is handled internally.

Parameters
chainA pointer to an existing chain.
use_paddingWhether or not padding will be allowed to be used during the write. The value of use_padding given here must match the value later passed to FLAC__metadata_chain_write_with_callbacks() or FLAC__metadata_chain_write_with_callbacks_with_tempfile().
chain != NULL
Return values
FLAC__booltrue if writing the current chain would require a tempfile, or false if metadata can be written in place.

◆ FLAC__metadata_chain_delete()

FLAC_API void FLAC__metadata_chain_delete ( FLAC__Metadata_Chain chain)

Free a chain instance. Deletes the object pointed to by chain.

Parameters
chainA pointer to an existing chain.
chain != NULL

◆ FLAC__metadata_chain_merge_padding()

FLAC_API void FLAC__metadata_chain_merge_padding ( FLAC__Metadata_Chain chain)

Merge adjacent PADDING blocks into a single block.

Note
This function does not write to the FLAC file, it only modifies the chain.
Warning
Any iterator on the current chain will become invalid after this call. You should delete the iterator and get a new one.
Parameters
chainA pointer to an existing chain.
chain != NULL

◆ FLAC__metadata_chain_new()

FLAC_API FLAC__Metadata_Chain* FLAC__metadata_chain_new ( void  )

Create a new chain instance.

Return values
FLAC__Metadata_Chain*NULL if there was an error allocating memory, else the new instance.

◆ FLAC__metadata_chain_read()

FLAC_API FLAC__bool FLAC__metadata_chain_read ( FLAC__Metadata_Chain chain,
const char *  filename 
)

Read all metadata from a FLAC file into the chain.

Parameters
chainA pointer to an existing chain.
filenameThe path to the FLAC file to read.
chain != NULL
filename != NULL
Return values
FLAC__booltrue if a valid list of metadata blocks was read from filename, else false. On failure, check the status with FLAC__metadata_chain_status().

◆ FLAC__metadata_chain_read_ogg()

FLAC_API FLAC__bool FLAC__metadata_chain_read_ogg ( FLAC__Metadata_Chain chain,
const char *  filename 
)

Read all metadata from an Ogg FLAC file into the chain.

Note
Ogg FLAC metadata data writing is not supported yet and FLAC__metadata_chain_write() will fail.
Parameters
chainA pointer to an existing chain.
filenameThe path to the Ogg FLAC file to read.
chain != NULL
filename != NULL
Return values
FLAC__booltrue if a valid list of metadata blocks was read from filename, else false. On failure, check the status with FLAC__metadata_chain_status().

◆ FLAC__metadata_chain_read_ogg_with_callbacks()

FLAC_API FLAC__bool FLAC__metadata_chain_read_ogg_with_callbacks ( FLAC__Metadata_Chain chain,
FLAC__IOHandle  handle,
FLAC__IOCallbacks  callbacks 
)

Read all metadata from an Ogg FLAC stream into the chain via I/O callbacks.

The handle need only be open for reading, but must be seekable. The equivalent minimum stdio fopen() file mode is "r" (or "rb" for Windows).

Note
Ogg FLAC metadata data writing is not supported yet and FLAC__metadata_chain_write() will fail.
Parameters
chainA pointer to an existing chain.
handleThe I/O handle of the Ogg FLAC stream to read. The handle will NOT be closed after the metadata is read; that is the duty of the caller.
callbacksA set of callbacks to use for I/O. The mandatory callbacks are read, seek, and tell.
chain != NULL
Return values
FLAC__booltrue if a valid list of metadata blocks was read from handle, else false. On failure, check the status with FLAC__metadata_chain_status().

◆ FLAC__metadata_chain_read_with_callbacks()

FLAC_API FLAC__bool FLAC__metadata_chain_read_with_callbacks ( FLAC__Metadata_Chain chain,
FLAC__IOHandle  handle,
FLAC__IOCallbacks  callbacks 
)

Read all metadata from a FLAC stream into the chain via I/O callbacks.

The handle need only be open for reading, but must be seekable. The equivalent minimum stdio fopen() file mode is "r" (or "rb" for Windows).

Parameters
chainA pointer to an existing chain.
handleThe I/O handle of the FLAC stream to read. The handle will NOT be closed after the metadata is read; that is the duty of the caller.
callbacksA set of callbacks to use for I/O. The mandatory callbacks are read, seek, and tell.
chain != NULL
Return values
FLAC__booltrue if a valid list of metadata blocks was read from handle, else false. On failure, check the status with FLAC__metadata_chain_status().

◆ FLAC__metadata_chain_sort_padding()

FLAC_API void FLAC__metadata_chain_sort_padding ( FLAC__Metadata_Chain chain)

This function will move all PADDING blocks to the end on the metadata, then merge them into a single block.

Note
This function does not write to the FLAC file, it only modifies the chain.
Warning
Any iterator on the current chain will become invalid after this call. You should delete the iterator and get a new one.
Parameters
chainA pointer to an existing chain.
chain != NULL

◆ FLAC__metadata_chain_status()

FLAC_API FLAC__Metadata_ChainStatus FLAC__metadata_chain_status ( 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.

Parameters
chainA pointer to an existing chain.
chain != NULL
Return values
FLAC__Metadata_ChainStatusThe current status of the chain.

◆ FLAC__metadata_chain_write()

FLAC_API FLAC__bool FLAC__metadata_chain_write ( FLAC__Metadata_Chain chain,
FLAC__bool  use_padding,
FLAC__bool  preserve_file_stats 
)

Write all metadata out to the FLAC file. This function tries to be as efficient as possible; how the metadata is actually written is shown by the following:

If the current chain is the same size as the existing metadata, the new data is written in place.

If the current chain is longer than the existing metadata, and use_padding is true, and the last block is a PADDING block of sufficient length, the function will truncate the final padding block so that the overall size of the metadata is the same as the existing metadata, and then just rewrite the metadata. Otherwise, if not all of the above conditions are met, the entire FLAC file must be rewritten. If you want to use padding this way it is a good idea to call FLAC__metadata_chain_sort_padding() first so that you have the maximum amount of padding to work with, unless you need to preserve ordering of the PADDING blocks for some reason.

If the current chain is shorter than the existing metadata, and use_padding is true, and the final block is a PADDING block, the padding is extended to make the overall size the same as the existing data. If use_padding is true and the last block is not a PADDING block, a new PADDING block is added to the end of the new data to make it the same size as the existing data (if possible, see the note to FLAC__metadata_simple_iterator_set_block() about the four byte limit) and the new data is written in place. If none of the above apply or use_padding is false, the entire FLAC file is rewritten.

If preserve_file_stats is true, the owner and modification time will be preserved even if the FLAC file is written.

For this write function to be used, the chain must have been read with FLAC__metadata_chain_read()/FLAC__metadata_chain_read_ogg(), not FLAC__metadata_chain_read_with_callbacks()/FLAC__metadata_chain_read_ogg_with_callbacks().

Parameters
chainA pointer to an existing chain.
use_paddingSee above.
preserve_file_statsSee above.
chain != NULL
Return values
FLAC__booltrue if the write succeeded, else false. On failure, check the status with FLAC__metadata_chain_status().

◆ FLAC__metadata_chain_write_with_callbacks()

FLAC_API FLAC__bool FLAC__metadata_chain_write_with_callbacks ( FLAC__Metadata_Chain chain,
FLAC__bool  use_padding,
FLAC__IOHandle  handle,
FLAC__IOCallbacks  callbacks 
)

Write all metadata out to a FLAC stream via callbacks.

(See FLAC__metadata_chain_write() for the details on how padding is used to write metadata in place if possible.)

The handle must be open for updating and be seekable. The equivalent minimum stdio fopen() file mode is "r+" (or "r+b" for Windows).

For this write function to be used, the chain must have been read with FLAC__metadata_chain_read_with_callbacks()/FLAC__metadata_chain_read_ogg_with_callbacks(), not FLAC__metadata_chain_read()/FLAC__metadata_chain_read_ogg(). Also, FLAC__metadata_chain_check_if_tempfile_needed() must have returned false.

Parameters
chainA pointer to an existing chain.
use_paddingSee FLAC__metadata_chain_write()
handleThe I/O handle of the FLAC stream to write. The handle will NOT be closed after the metadata is written; that is the duty of the caller.
callbacksA set of callbacks to use for I/O. The mandatory callbacks are write and seek.
chain != NULL
Return values
FLAC__booltrue if the write succeeded, else false. On failure, check the status with FLAC__metadata_chain_status().

◆ FLAC__metadata_chain_write_with_callbacks_and_tempfile()

FLAC_API FLAC__bool FLAC__metadata_chain_write_with_callbacks_and_tempfile ( FLAC__Metadata_Chain chain,
FLAC__bool  use_padding,
FLAC__IOHandle  handle,
FLAC__IOCallbacks  callbacks,
FLAC__IOHandle  temp_handle,
FLAC__IOCallbacks  temp_callbacks 
)

Write all metadata out to a FLAC stream via callbacks.

(See FLAC__metadata_chain_write() for the details on how padding is used to write metadata in place if possible.)

This version of the write-with-callbacks function must be used when FLAC__metadata_chain_check_if_tempfile_needed() returns true. In this function, you must supply an I/O handle corresponding to the FLAC file to edit, and a temporary handle to which the new FLAC file will be written. It is the caller's job to move this temporary FLAC file on top of the original FLAC file to complete the metadata edit.

The handle must be open for reading and be seekable. The equivalent minimum stdio fopen() file mode is "r" (or "rb" for Windows).

The temp_handle must be open for writing. The equivalent minimum stdio fopen() file mode is "w" (or "wb" for Windows). It should be an empty stream, or at least positioned at the start-of-file (in which case it is the caller's duty to truncate it on return).

For this write function to be used, the chain must have been read with FLAC__metadata_chain_read_with_callbacks()/FLAC__metadata_chain_read_ogg_with_callbacks(), not FLAC__metadata_chain_read()/FLAC__metadata_chain_read_ogg(). Also, FLAC__metadata_chain_check_if_tempfile_needed() must have returned true.

Parameters
chainA pointer to an existing chain.
use_paddingSee FLAC__metadata_chain_write()
handleThe I/O handle of the original FLAC stream to read. The handle will NOT be closed after the metadata is written; that is the duty of the caller.
callbacksA set of callbacks to use for I/O on handle. The mandatory callbacks are read, seek, and eof.
temp_handleThe I/O handle of the FLAC stream to write. The handle will NOT be closed after the metadata is written; that is the duty of the caller.
temp_callbacksA set of callbacks to use for I/O on temp_handle. The only mandatory callback is write.
chain != NULL
Return values
FLAC__booltrue if the write succeeded, else false. On failure, check the status with FLAC__metadata_chain_status().

◆ FLAC__metadata_iterator_delete()

FLAC_API void FLAC__metadata_iterator_delete ( FLAC__Metadata_Iterator iterator)

Free an iterator instance. Deletes the object pointed to by iterator.

Parameters
iteratorA pointer to an existing iterator.
iterator != NULL

◆ FLAC__metadata_iterator_delete_block()

FLAC_API FLAC__bool FLAC__metadata_iterator_delete_block ( FLAC__Metadata_Iterator iterator,
FLAC__bool  replace_with_padding 
)

Removes the current block from the chain. If replace_with_padding is 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 replace_with_padding is true.

Parameters
iteratorA pointer to an existing initialized iterator.
replace_with_paddingSee above.
iterator != NULL
iterator has been successfully initialized with FLAC__metadata_iterator_init()
Return values
FLAC__boolfalse if the conditions in the above description are not met, otherwise true.

◆ FLAC__metadata_iterator_get_block()

FLAC_API FLAC__StreamMetadata* FLAC__metadata_iterator_get_block ( 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().
Parameters
iteratorA pointer to an existing initialized iterator.
iterator != NULL
iterator has been successfully initialized with FLAC__metadata_iterator_init()
Return values
FLAC__StreamMetadata*The current metadata block.

◆ FLAC__metadata_iterator_get_block_type()

FLAC_API FLAC__MetadataType FLAC__metadata_iterator_get_block_type ( const FLAC__Metadata_Iterator iterator)

Get the type of the metadata block at the current position.

Parameters
iteratorA pointer to an existing initialized iterator.
iterator != NULL
iterator has been successfully initialized with FLAC__metadata_iterator_init()
Return values
FLAC__MetadataTypeThe type of the metadata block at the current iterator position.

◆ FLAC__metadata_iterator_init()

FLAC_API void FLAC__metadata_iterator_init ( FLAC__Metadata_Iterator iterator,
FLAC__Metadata_Chain chain 
)

Initialize the iterator to point to the first metadata block in the given chain.

Parameters
iteratorA pointer to an existing iterator.
chainA pointer to an existing and initialized (read) chain.
iterator != NULL
chain != NULL

◆ FLAC__metadata_iterator_insert_block_after()

FLAC_API FLAC__bool FLAC__metadata_iterator_insert_block_after ( 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.

Parameters
iteratorA pointer to an existing initialized iterator.
blockA pointer to a metadata block to insert.
iterator != NULL
iterator has been successfully initialized with FLAC__metadata_iterator_init()
Return values
FLAC__boolfalse if the conditions in the above description are not met, or a memory allocation error occurs, otherwise true.

◆ FLAC__metadata_iterator_insert_block_before()

FLAC_API FLAC__bool FLAC__metadata_iterator_insert_block_before ( FLAC__Metadata_Iterator iterator,
FLAC__StreamMetadata block 
)

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.

Parameters
iteratorA pointer to an existing initialized iterator.
blockA pointer to a metadata block to insert.
iterator != NULL
iterator has been successfully initialized with FLAC__metadata_iterator_init()
Return values
FLAC__boolfalse if the conditions in the above description are not met, or a memory allocation error occurs, otherwise true.

◆ FLAC__metadata_iterator_new()

FLAC_API FLAC__Metadata_Iterator* FLAC__metadata_iterator_new ( void  )

Create a new iterator instance.

Return values
FLAC__Metadata_Iterator*NULL if there was an error allocating memory, else the new instance.

◆ FLAC__metadata_iterator_next()

FLAC_API FLAC__bool FLAC__metadata_iterator_next ( FLAC__Metadata_Iterator iterator)

Moves the iterator forward one metadata block, returning false if already at the end.

Parameters
iteratorA pointer to an existing initialized iterator.
iterator != NULL
iterator has been successfully initialized with FLAC__metadata_iterator_init()
Return values
FLAC__boolfalse if already at the last metadata block of the chain, else true.

◆ FLAC__metadata_iterator_prev()

FLAC_API FLAC__bool FLAC__metadata_iterator_prev ( FLAC__Metadata_Iterator iterator)

Moves the iterator backward one metadata block, returning false if already at the beginning.

Parameters
iteratorA pointer to an existing initialized iterator.
iterator != NULL
iterator has been successfully initialized with FLAC__metadata_iterator_init()
Return values
FLAC__boolfalse if already at the first metadata block of the chain, else true.

◆ FLAC__metadata_iterator_set_block()

FLAC_API FLAC__bool FLAC__metadata_iterator_set_block ( FLAC__Metadata_Iterator iterator,
FLAC__StreamMetadata block 
)

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.

Parameters
iteratorA pointer to an existing initialized iterator.
blockA pointer to a metadata block.
iterator != NULL
iterator has been successfully initialized with FLAC__metadata_iterator_init()
Return values
FLAC__boolfalse if the conditions in the above description are not met, or a memory allocation error occurs, otherwise true.

Variable Documentation

◆ FLAC__Metadata_ChainStatusString

FLAC_API const char* const FLAC__Metadata_ChainStatusString[]

Maps a FLAC__Metadata_ChainStatus to a C string.

Using a FLAC__Metadata_ChainStatus as the index to this array will give the string equivalent. The contents should not be modified.