RetroArch
Functions
FLAC/metadata.h: metadata object methods

This module contains methods for manipulating FLAC metadata objects. More...

Collaboration diagram for FLAC/metadata.h: metadata object methods:

Functions

FLAC_API FLAC__StreamMetadataFLAC__metadata_object_new (FLAC__MetadataType type)
 
FLAC_API FLAC__StreamMetadataFLAC__metadata_object_clone (const FLAC__StreamMetadata *object)
 
FLAC_API void FLAC__metadata_object_delete (FLAC__StreamMetadata *object)
 
FLAC_API FLAC__bool FLAC__metadata_object_is_equal (const FLAC__StreamMetadata *block1, const FLAC__StreamMetadata *block2)
 
FLAC_API FLAC__bool FLAC__metadata_object_application_set_data (FLAC__StreamMetadata *object, FLAC__byte *data, unsigned length, FLAC__bool copy)
 
FLAC_API FLAC__bool FLAC__metadata_object_seektable_resize_points (FLAC__StreamMetadata *object, unsigned new_num_points)
 
FLAC_API void FLAC__metadata_object_seektable_set_point (FLAC__StreamMetadata *object, unsigned point_num, FLAC__StreamMetadata_SeekPoint point)
 
FLAC_API FLAC__bool FLAC__metadata_object_seektable_insert_point (FLAC__StreamMetadata *object, unsigned point_num, FLAC__StreamMetadata_SeekPoint point)
 
FLAC_API FLAC__bool FLAC__metadata_object_seektable_delete_point (FLAC__StreamMetadata *object, unsigned point_num)
 
FLAC_API FLAC__bool FLAC__metadata_object_seektable_is_legal (const FLAC__StreamMetadata *object)
 
FLAC_API FLAC__bool FLAC__metadata_object_seektable_template_append_placeholders (FLAC__StreamMetadata *object, unsigned num)
 
FLAC_API FLAC__bool FLAC__metadata_object_seektable_template_append_point (FLAC__StreamMetadata *object, FLAC__uint64 sample_number)
 
FLAC_API FLAC__bool FLAC__metadata_object_seektable_template_append_points (FLAC__StreamMetadata *object, FLAC__uint64 sample_numbers[], unsigned num)
 
FLAC_API FLAC__bool FLAC__metadata_object_seektable_template_append_spaced_points (FLAC__StreamMetadata *object, unsigned num, FLAC__uint64 total_samples)
 
FLAC_API FLAC__bool FLAC__metadata_object_seektable_template_append_spaced_points_by_samples (FLAC__StreamMetadata *object, unsigned samples, FLAC__uint64 total_samples)
 
FLAC_API FLAC__bool FLAC__metadata_object_seektable_template_sort (FLAC__StreamMetadata *object, FLAC__bool compact)
 
FLAC_API FLAC__bool FLAC__metadata_object_vorbiscomment_set_vendor_string (FLAC__StreamMetadata *object, FLAC__StreamMetadata_VorbisComment_Entry entry, FLAC__bool copy)
 
FLAC_API FLAC__bool FLAC__metadata_object_vorbiscomment_resize_comments (FLAC__StreamMetadata *object, unsigned new_num_comments)
 
FLAC_API FLAC__bool FLAC__metadata_object_vorbiscomment_set_comment (FLAC__StreamMetadata *object, unsigned comment_num, FLAC__StreamMetadata_VorbisComment_Entry entry, FLAC__bool copy)
 
FLAC_API FLAC__bool FLAC__metadata_object_vorbiscomment_insert_comment (FLAC__StreamMetadata *object, unsigned comment_num, FLAC__StreamMetadata_VorbisComment_Entry entry, FLAC__bool copy)
 
FLAC_API FLAC__bool FLAC__metadata_object_vorbiscomment_append_comment (FLAC__StreamMetadata *object, FLAC__StreamMetadata_VorbisComment_Entry entry, FLAC__bool copy)
 
FLAC_API FLAC__bool FLAC__metadata_object_vorbiscomment_replace_comment (FLAC__StreamMetadata *object, FLAC__StreamMetadata_VorbisComment_Entry entry, FLAC__bool all, FLAC__bool copy)
 
FLAC_API FLAC__bool FLAC__metadata_object_vorbiscomment_delete_comment (FLAC__StreamMetadata *object, unsigned comment_num)
 
FLAC_API FLAC__bool FLAC__metadata_object_vorbiscomment_entry_from_name_value_pair (FLAC__StreamMetadata_VorbisComment_Entry *entry, const char *field_name, const char *field_value)
 
FLAC_API FLAC__bool FLAC__metadata_object_vorbiscomment_entry_to_name_value_pair (const FLAC__StreamMetadata_VorbisComment_Entry entry, char **field_name, char **field_value)
 
FLAC_API FLAC__bool FLAC__metadata_object_vorbiscomment_entry_matches (const FLAC__StreamMetadata_VorbisComment_Entry entry, const char *field_name, unsigned field_name_length)
 
FLAC_API int FLAC__metadata_object_vorbiscomment_find_entry_from (const FLAC__StreamMetadata *object, unsigned offset, const char *field_name)
 
FLAC_API int FLAC__metadata_object_vorbiscomment_remove_entry_matching (FLAC__StreamMetadata *object, const char *field_name)
 
FLAC_API int FLAC__metadata_object_vorbiscomment_remove_entries_matching (FLAC__StreamMetadata *object, const char *field_name)
 
FLAC_API FLAC__StreamMetadata_CueSheet_TrackFLAC__metadata_object_cuesheet_track_new (void)
 
FLAC_API FLAC__StreamMetadata_CueSheet_TrackFLAC__metadata_object_cuesheet_track_clone (const FLAC__StreamMetadata_CueSheet_Track *object)
 
FLAC_API void FLAC__metadata_object_cuesheet_track_delete (FLAC__StreamMetadata_CueSheet_Track *object)
 
FLAC_API FLAC__bool FLAC__metadata_object_cuesheet_track_resize_indices (FLAC__StreamMetadata *object, unsigned track_num, unsigned new_num_indices)
 
FLAC_API FLAC__bool FLAC__metadata_object_cuesheet_track_insert_index (FLAC__StreamMetadata *object, unsigned track_num, unsigned index_num, FLAC__StreamMetadata_CueSheet_Index index)
 
FLAC_API FLAC__bool FLAC__metadata_object_cuesheet_track_insert_blank_index (FLAC__StreamMetadata *object, unsigned track_num, unsigned index_num)
 
FLAC_API FLAC__bool FLAC__metadata_object_cuesheet_track_delete_index (FLAC__StreamMetadata *object, unsigned track_num, unsigned index_num)
 
FLAC_API FLAC__bool FLAC__metadata_object_cuesheet_resize_tracks (FLAC__StreamMetadata *object, unsigned new_num_tracks)
 
FLAC_API FLAC__bool FLAC__metadata_object_cuesheet_set_track (FLAC__StreamMetadata *object, unsigned track_num, FLAC__StreamMetadata_CueSheet_Track *track, FLAC__bool copy)
 
FLAC_API FLAC__bool FLAC__metadata_object_cuesheet_insert_track (FLAC__StreamMetadata *object, unsigned track_num, FLAC__StreamMetadata_CueSheet_Track *track, FLAC__bool copy)
 
FLAC_API FLAC__bool FLAC__metadata_object_cuesheet_insert_blank_track (FLAC__StreamMetadata *object, unsigned track_num)
 
FLAC_API FLAC__bool FLAC__metadata_object_cuesheet_delete_track (FLAC__StreamMetadata *object, unsigned track_num)
 
FLAC_API FLAC__bool FLAC__metadata_object_cuesheet_is_legal (const FLAC__StreamMetadata *object, FLAC__bool check_cd_da_subset, const char **violation)
 
FLAC_API FLAC__uint32 FLAC__metadata_object_cuesheet_calculate_cddb_id (const FLAC__StreamMetadata *object)
 
FLAC_API FLAC__bool FLAC__metadata_object_picture_set_mime_type (FLAC__StreamMetadata *object, char *mime_type, FLAC__bool copy)
 
FLAC_API FLAC__bool FLAC__metadata_object_picture_set_description (FLAC__StreamMetadata *object, FLAC__byte *description, FLAC__bool copy)
 
FLAC_API FLAC__bool FLAC__metadata_object_picture_set_data (FLAC__StreamMetadata *object, FLAC__byte *data, FLAC__uint32 length, FLAC__bool copy)
 
FLAC_API FLAC__bool FLAC__metadata_object_picture_is_legal (const FLAC__StreamMetadata *object, const char **violation)
 

Detailed Description

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 copy to true to have the function make it's own copy of the data, or to 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 copy argument is false.

The FLAC__metadata_object_new() and FLAC__metadata_object_clone() function will return NULL in the case of a memory allocation error, otherwise a new object. The FLAC__metadata_object_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 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.

Function Documentation

◆ FLAC__metadata_object_application_set_data()

FLAC_API FLAC__bool FLAC__metadata_object_application_set_data ( FLAC__StreamMetadata object,
FLAC__byte data,
unsigned  length,
FLAC__bool  copy 
)

Sets the application data of an APPLICATION block.

If copy is true, a copy of the data is stored; otherwise, the object takes ownership of the pointer. The existing data will be freed if this function is successful, otherwise the original data will remain if copy is true and malloc() fails.

Note
It is safe to pass a const pointer to data if copy is true.
Parameters
objectA pointer to an existing APPLICATION object.
dataA pointer to the data to set.
lengthThe length of data in bytes.
copySee above.
object != NULL
(data != NULL && length > 0) ||
(data == NULL && length == 0 && copy == false)
Return values
FLAC__boolfalse if copy is true and malloc() fails, else true.

◆ FLAC__metadata_object_clone()

FLAC_API FLAC__StreamMetadata* FLAC__metadata_object_clone ( const FLAC__StreamMetadata object)

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().

Parameters
objectPointer to object to copy.
object != NULL
Return values
FLAC__StreamMetadata*NULL if there was an error allocating memory, else the new instance.

◆ FLAC__metadata_object_cuesheet_calculate_cddb_id()

FLAC_API FLAC__uint32 FLAC__metadata_object_cuesheet_calculate_cddb_id ( const FLAC__StreamMetadata object)

Calculate and return the CDDB/freedb ID for a cue sheet. The function assumes the cue sheet corresponds to a CD; the result is undefined if the cuesheet's is_cd bit is not set.

Parameters
objectA pointer to an existing CUESHEET object.
object != NULL
Return values
FLAC__uint32The unsigned integer representation of the CDDB/freedb ID

◆ FLAC__metadata_object_cuesheet_delete_track()

FLAC_API FLAC__bool FLAC__metadata_object_cuesheet_delete_track ( FLAC__StreamMetadata object,
unsigned  track_num 
)

Delete a track in a CUESHEET block at the given index.

Parameters
objectA pointer to an existing CUESHEET object.
track_numThe index into the track array of the track to delete. NOTE: this is not necessarily the same as the track's number field.
object != NULL
object->data.cue_sheet.num_tracks > track_num
Return values
FLAC__boolfalse if realloc() fails, else true.

◆ FLAC__metadata_object_cuesheet_insert_blank_track()

FLAC_API FLAC__bool FLAC__metadata_object_cuesheet_insert_blank_track ( FLAC__StreamMetadata object,
unsigned  track_num 
)

Insert a blank track in a CUESHEET block at the given index.

A blank track is one in which all field values are zero.

Parameters
objectA pointer to an existing CUESHEET object.
track_numThe index at which to insert the track. NOTE: this is not necessarily the same as the track's number field. The tracks at and after track_num move right one position. To append a track to the end, set track_num to object->data.cue_sheet.num_tracks .
object != NULL
object->data.cue_sheet.num_tracks >= track_num
Return values
FLAC__boolfalse if copy is true and malloc() fails, else true.

◆ FLAC__metadata_object_cuesheet_insert_track()

FLAC_API FLAC__bool FLAC__metadata_object_cuesheet_insert_track ( FLAC__StreamMetadata object,
unsigned  track_num,
FLAC__StreamMetadata_CueSheet_Track track,
FLAC__bool  copy 
)

Insert a track in a CUESHEET block at the given index.

If copy is true, a copy of the track is stored; otherwise, the object takes ownership of the track pointer.

Parameters
objectA pointer to an existing CUESHEET object.
track_numThe index at which to insert the track. NOTE: this is not necessarily the same as the track's number field. The tracks at and after track_num move right one position. To append a track to the end, set track_num to object->data.cue_sheet.num_tracks .
trackThe track to insert. You may safely pass in a const pointer if copy is true.
copySee above.
object != NULL
object->data.cue_sheet.num_tracks >= track_num
Return values
FLAC__boolfalse if copy is true and malloc() fails, else true.

◆ FLAC__metadata_object_cuesheet_is_legal()

FLAC_API FLAC__bool FLAC__metadata_object_cuesheet_is_legal ( const FLAC__StreamMetadata object,
FLAC__bool  check_cd_da_subset,
const char **  violation 
)

Check a cue sheet to see if it conforms to the FLAC specification. See the format specification for limits on the contents of the cue sheet.

Parameters
objectA pointer to an existing CUESHEET object.
check_cd_da_subsetIf true, check CUESHEET against more stringent requirements for a CD-DA (audio) disc.
violationAddress of a pointer to a string. If there is a violation, a pointer to a string explanation of the violation will be returned here. violation may be NULL if you don't need the returned string. Do not free the returned string; it will always point to static data.
object != NULL
Return values
FLAC__boolfalse if cue sheet is illegal, else true.

◆ FLAC__metadata_object_cuesheet_resize_tracks()

FLAC_API FLAC__bool FLAC__metadata_object_cuesheet_resize_tracks ( FLAC__StreamMetadata object,
unsigned  new_num_tracks 
)

Resize the track array.

If the size shrinks, elements will truncated; if it grows, new blank tracks will be added to the end.

Parameters
objectA pointer to an existing CUESHEET object.
new_num_tracksThe desired length of the array; may be 0.
object != NULL
(object->data.cue_sheet.tracks == NULL && object->data.cue_sheet.num_tracks == 0) ||
(object->data.cue_sheet.tracks != NULL && object->data.cue_sheet.num_tracks > 0)
Return values
FLAC__boolfalse if memory allocation error, else true.

◆ FLAC__metadata_object_cuesheet_set_track()

FLAC_API FLAC__bool FLAC__metadata_object_cuesheet_set_track ( FLAC__StreamMetadata object,
unsigned  track_num,
FLAC__StreamMetadata_CueSheet_Track track,
FLAC__bool  copy 
)

Sets a track in a CUESHEET block.

If copy is true, a copy of the track is stored; otherwise, the object takes ownership of the track pointer.

Parameters
objectA pointer to an existing CUESHEET object.
track_numIndex into track array to set. NOTE: this is not necessarily the same as the track's number field.
trackThe track to set the track to. You may safely pass in a const pointer if copy is true.
copySee above.
object != NULL
track_num < object->data.cue_sheet.num_tracks
(track->indices != NULL && track->num_indices > 0) ||
(track->indices == NULL && track->num_indices == 0)
Return values
FLAC__boolfalse if copy is true and malloc() fails, else true.

◆ FLAC__metadata_object_cuesheet_track_clone()

FLAC_API FLAC__StreamMetadata_CueSheet_Track* FLAC__metadata_object_cuesheet_track_clone ( const FLAC__StreamMetadata_CueSheet_Track object)

Create a copy of an existing CUESHEET track 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 object and is responsible for freeing it with FLAC__metadata_object_cuesheet_track_delete().

Parameters
objectPointer to object to copy.
object != NULL
Return values
FLAC__StreamMetadata_CueSheet_Track*NULL if there was an error allocating memory, else the new instance.

◆ FLAC__metadata_object_cuesheet_track_delete()

FLAC_API void FLAC__metadata_object_cuesheet_track_delete ( FLAC__StreamMetadata_CueSheet_Track object)

Delete a CUESHEET track object

Parameters
objectA pointer to an existing CUESHEET track object.
object != NULL

◆ FLAC__metadata_object_cuesheet_track_delete_index()

FLAC_API FLAC__bool FLAC__metadata_object_cuesheet_track_delete_index ( FLAC__StreamMetadata object,
unsigned  track_num,
unsigned  index_num 
)

Delete an index point in a CUESHEET track at the given index.

Parameters
objectA pointer to an existing CUESHEET object.
track_numThe index into the track array of the track to modify. NOTE: this is not necessarily the same as the track's number field.
index_numThe index into the track's index array of the index to delete. NOTE: this is not necessarily the same as the index's number field.
object != NULL
object->data.cue_sheet.num_tracks > track_num
object->data.cue_sheet.tracks[track_num].num_indices > index_num
Return values
FLAC__boolfalse if realloc() fails, else true.

◆ FLAC__metadata_object_cuesheet_track_insert_blank_index()

FLAC_API FLAC__bool FLAC__metadata_object_cuesheet_track_insert_blank_index ( FLAC__StreamMetadata object,
unsigned  track_num,
unsigned  index_num 
)

Insert a blank index point in a CUESHEET track at the given index.

A blank index point is one in which all field values are zero.

Parameters
objectA pointer to an existing CUESHEET object.
track_numThe index of the track to modify. NOTE: this is not necessarily the same as the track's number field.
index_numThe index into the track's index array at which to insert the index point. NOTE: this is not necessarily the same as the index point's number field. The indices at and after index_num move right one position. To append an index point to the end, set index_num to object->data.cue_sheet.tracks[track_num].num_indices .
object != NULL
object->data.cue_sheet.num_tracks > track_num
object->data.cue_sheet.tracks[track_num].num_indices >= index_num
Return values
FLAC__boolfalse if realloc() fails, else true.

◆ FLAC__metadata_object_cuesheet_track_insert_index()

FLAC_API FLAC__bool FLAC__metadata_object_cuesheet_track_insert_index ( FLAC__StreamMetadata object,
unsigned  track_num,
unsigned  index_num,
FLAC__StreamMetadata_CueSheet_Index  index 
)

Insert an index point in a CUESHEET track at the given index.

Parameters
objectA pointer to an existing CUESHEET object.
track_numThe index of the track to modify. NOTE: this is not necessarily the same as the track's number field.
index_numThe index into the track's index array at which to insert the index point. NOTE: this is not necessarily the same as the index point's number field. The indices at and after index_num move right one position. To append an index point to the end, set index_num to object->data.cue_sheet.tracks[track_num].num_indices .
indexThe index point to insert.
object != NULL
object->data.cue_sheet.num_tracks > track_num
object->data.cue_sheet.tracks[track_num].num_indices >= index_num
Return values
FLAC__boolfalse if realloc() fails, else true.

◆ FLAC__metadata_object_cuesheet_track_new()

FLAC_API FLAC__StreamMetadata_CueSheet_Track* FLAC__metadata_object_cuesheet_track_new ( void  )

Create a new CUESHEET track instance.

The object will be "empty"; i.e. values and data pointers will be 0.

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

◆ FLAC__metadata_object_cuesheet_track_resize_indices()

FLAC_API FLAC__bool FLAC__metadata_object_cuesheet_track_resize_indices ( FLAC__StreamMetadata object,
unsigned  track_num,
unsigned  new_num_indices 
)

Resize a track's index point array.

If the size shrinks, elements will truncated; if it grows, new blank indices will be added to the end.

Parameters
objectA pointer to an existing CUESHEET object.
track_numThe index of the track to modify. NOTE: this is not necessarily the same as the track's number field.
new_num_indicesThe desired length of the array; may be 0.
object != NULL
object->data.cue_sheet.num_tracks > track_num
(object->data.cue_sheet.tracks[track_num].indices == NULL && object->data.cue_sheet.tracks[track_num].num_indices == 0) ||
(object->data.cue_sheet.tracks[track_num].indices != NULL && object->data.cue_sheet.tracks[track_num].num_indices > 0)
Return values
FLAC__boolfalse if memory allocation error, else true.

◆ FLAC__metadata_object_delete()

FLAC_API void FLAC__metadata_object_delete ( FLAC__StreamMetadata object)

Free a metadata object. Deletes the object pointed to by object.

The delete is a "deep" delete, i.e. dynamically allocated data within the object is also deleted.

Parameters
objectA pointer to an existing object.
object != NULL

◆ FLAC__metadata_object_is_equal()

FLAC_API FLAC__bool FLAC__metadata_object_is_equal ( const FLAC__StreamMetadata block1,
const FLAC__StreamMetadata block2 
)

Compares two metadata objects.

The compare is "deep", i.e. dynamically allocated data within the object is also compared.

Parameters
block1A pointer to an existing object.
block2A pointer to an existing object.
block1 != NULL
block2 != NULL
Return values
FLAC__booltrue if objects are identical, else false.

◆ FLAC__metadata_object_new()

FLAC_API FLAC__StreamMetadata* FLAC__metadata_object_new ( FLAC__MetadataType  type)

Create a new metadata object instance of the given type.

The object will be "empty"; i.e. values and data pointers will be 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 FLAC__METADATA_TYPE_UNDEFINED unless you really know what you're doing.

Parameters
typeType of object to create
Return values
FLAC__StreamMetadata*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__metadata_object_picture_is_legal()

FLAC_API FLAC__bool FLAC__metadata_object_picture_is_legal ( const FLAC__StreamMetadata object,
const char **  violation 
)

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.

Parameters
objectA pointer to existing PICTURE block to be checked.
violationAddress of a pointer to a string. If there is a violation, a pointer to a string explanation of the violation will be returned here. violation may be NULL if you don't need the returned string. Do not free the returned string; it will always point to static data.
object != NULL
Return values
FLAC__boolfalse if PICTURE block is illegal, else true.

◆ FLAC__metadata_object_picture_set_data()

FLAC_API FLAC__bool FLAC__metadata_object_picture_set_data ( FLAC__StreamMetadata object,
FLAC__byte data,
FLAC__uint32  length,
FLAC__bool  copy 
)

Sets the picture data of a PICTURE block.

If copy is true, a copy of the data is stored; otherwise, the object takes ownership of the pointer. Also sets the data_length field of the metadata object to what is passed in as the length parameter. The existing data will be freed if this function is successful, otherwise the original data and data_length will remain if copy is true and malloc() fails.

Note
It is safe to pass a const pointer to data if copy is true.
Parameters
objectA pointer to an existing PICTURE object.
dataA pointer to the data to set.
lengthThe length of data in bytes.
copySee above.
object != NULL
(data != NULL && length > 0) ||
(data == NULL && length == 0 && copy == false)
Return values
FLAC__boolfalse if copy is true and malloc() fails, else true.

◆ FLAC__metadata_object_picture_set_description()

FLAC_API FLAC__bool FLAC__metadata_object_picture_set_description ( FLAC__StreamMetadata object,
FLAC__byte description,
FLAC__bool  copy 
)

Sets the description of a PICTURE block.

If copy is 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 copy is true and malloc() fails.

Note
It is safe to pass a const pointer to description if copy is true.
Parameters
objectA pointer to an existing PICTURE object.
descriptionA pointer to the description string. The string must be valid UTF-8, NUL-terminated. No validation is done.
copySee above.
object != NULL
Return values
FLAC__boolfalse if copy is true and malloc() fails, else true.

◆ FLAC__metadata_object_picture_set_mime_type()

FLAC_API FLAC__bool FLAC__metadata_object_picture_set_mime_type ( FLAC__StreamMetadata object,
char *  mime_type,
FLAC__bool  copy 
)

Sets the MIME type of a PICTURE block.

If copy is 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 copy is true and malloc() fails.

Note
It is safe to pass a const pointer to mime_type if copy is true.
Parameters
objectA pointer to an existing PICTURE object.
mime_typeA pointer to the MIME type string. The string must be ASCII characters 0x20-0x7e, NUL-terminated. No validation is done.
copySee above.
object != NULL
Return values
FLAC__boolfalse if copy is true and malloc() fails, else true.

◆ FLAC__metadata_object_seektable_delete_point()

FLAC_API FLAC__bool FLAC__metadata_object_seektable_delete_point ( FLAC__StreamMetadata object,
unsigned  point_num 
)

Delete a seekpoint from a seektable.

Parameters
objectA pointer to an existing SEEKTABLE object.
point_numIndex into seekpoint array to set.
object != NULL
object->data.seek_table.num_points > point_num
Return values
FLAC__boolfalse if memory allocation error, else true.

◆ FLAC__metadata_object_seektable_insert_point()

FLAC_API FLAC__bool FLAC__metadata_object_seektable_insert_point ( FLAC__StreamMetadata object,
unsigned  point_num,
FLAC__StreamMetadata_SeekPoint  point 
)

Insert a seekpoint into a seektable.

Parameters
objectA pointer to an existing SEEKTABLE object.
point_numIndex into seekpoint array to set.
pointThe point to set.
object != NULL
object->data.seek_table.num_points >= point_num
Return values
FLAC__boolfalse if memory allocation error, else true.

◆ FLAC__metadata_object_seektable_is_legal()

FLAC_API FLAC__bool FLAC__metadata_object_seektable_is_legal ( const FLAC__StreamMetadata object)

Check a seektable to see if it conforms to the FLAC specification. See the format specification for limits on the contents of the seektable.

Parameters
objectA pointer to an existing SEEKTABLE object.
object != NULL
Return values
FLAC__boolfalse if seek table is illegal, else true.

◆ FLAC__metadata_object_seektable_resize_points()

FLAC_API FLAC__bool FLAC__metadata_object_seektable_resize_points ( FLAC__StreamMetadata object,
unsigned  new_num_points 
)

Resize the seekpoint array.

If the size shrinks, elements will truncated; if it grows, new placeholder points will be added to the end.

Parameters
objectA pointer to an existing SEEKTABLE object.
new_num_pointsThe desired length of the array; may be 0.
object != NULL
(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)
Return values
FLAC__boolfalse if memory allocation error, else true.

◆ FLAC__metadata_object_seektable_set_point()

FLAC_API void FLAC__metadata_object_seektable_set_point ( FLAC__StreamMetadata object,
unsigned  point_num,
FLAC__StreamMetadata_SeekPoint  point 
)

Set a seekpoint in a seektable.

Parameters
objectA pointer to an existing SEEKTABLE object.
point_numIndex into seekpoint array to set.
pointThe point to set.
object != NULL
object->data.seek_table.num_points > point_num

◆ FLAC__metadata_object_seektable_template_append_placeholders()

FLAC_API FLAC__bool FLAC__metadata_object_seektable_template_append_placeholders ( FLAC__StreamMetadata object,
unsigned  num 
)

Append a number of placeholder points to the end of a seek table.

Note
As with the other ..._seektable_template_... functions, you should call FLAC__metadata_object_seektable_template_sort() when finished to make the seek table legal.
Parameters
objectA pointer to an existing SEEKTABLE object.
numThe number of placeholder points to append.
object != NULL
Return values
FLAC__boolfalse if memory allocation fails, else true.

◆ FLAC__metadata_object_seektable_template_append_point()

FLAC_API FLAC__bool FLAC__metadata_object_seektable_template_append_point ( FLAC__StreamMetadata object,
FLAC__uint64  sample_number 
)

Append a specific seek point template to the end of a seek table.

Note
As with the other ..._seektable_template_... functions, you should call FLAC__metadata_object_seektable_template_sort() when finished to make the seek table legal.
Parameters
objectA pointer to an existing SEEKTABLE object.
sample_numberThe sample number of the seek point template.
object != NULL
Return values
FLAC__boolfalse if memory allocation fails, else true.

◆ FLAC__metadata_object_seektable_template_append_points()

FLAC_API FLAC__bool FLAC__metadata_object_seektable_template_append_points ( FLAC__StreamMetadata object,
FLAC__uint64  sample_numbers[],
unsigned  num 
)

Append specific seek point templates to the end of a seek table.

Note
As with the other ..._seektable_template_... functions, you should call FLAC__metadata_object_seektable_template_sort() when finished to make the seek table legal.
Parameters
objectA pointer to an existing SEEKTABLE object.
sample_numbersAn array of sample numbers for the seek points.
numThe number of seek point templates to append.
object != NULL
Return values
FLAC__boolfalse if memory allocation fails, else true.

◆ FLAC__metadata_object_seektable_template_append_spaced_points()

FLAC_API FLAC__bool FLAC__metadata_object_seektable_template_append_spaced_points ( FLAC__StreamMetadata object,
unsigned  num,
FLAC__uint64  total_samples 
)

Append a set of evenly-spaced seek point templates to the end of a seek table.

Note
As with the other ..._seektable_template_... functions, you should call FLAC__metadata_object_seektable_template_sort() when finished to make the seek table legal.
Parameters
objectA pointer to an existing SEEKTABLE object.
numThe number of placeholder points to append.
total_samplesThe total number of samples to be encoded; the seekpoints will be spaced approximately total_samples / num samples apart.
object != NULL
total_samples > 0
Return values
FLAC__boolfalse if memory allocation fails, else true.

◆ FLAC__metadata_object_seektable_template_append_spaced_points_by_samples()

FLAC_API FLAC__bool FLAC__metadata_object_seektable_template_append_spaced_points_by_samples ( FLAC__StreamMetadata object,
unsigned  samples,
FLAC__uint64  total_samples 
)

Append a set of evenly-spaced seek point templates to the end of a seek table.

Note
As with the other ..._seektable_template_... functions, you should call FLAC__metadata_object_seektable_template_sort() when finished to make the seek table legal.
Parameters
objectA pointer to an existing SEEKTABLE object.
samplesThe number of samples apart to space the placeholder points. The first point will be at sample 0, the second at sample samples, then 2*samples, and so on. As long as samples and total_samples are greater than 0, there will always be at least one seekpoint at sample 0.
total_samplesThe total number of samples to be encoded; the seekpoints will be spaced samples samples apart.
object != NULL
samples > 0
total_samples > 0
Return values
FLAC__boolfalse if memory allocation fails, else true.

◆ FLAC__metadata_object_seektable_template_sort()

FLAC_API FLAC__bool FLAC__metadata_object_seektable_template_sort ( FLAC__StreamMetadata object,
FLAC__bool  compact 
)

Sort a seek table's seek points according to the format specification, removing duplicates.

Parameters
objectA pointer to a seek table to be sorted.
compactIf false, behaves like FLAC__format_seektable_sort(). If true, duplicates are deleted and the seek table is shrunk appropriately; the number of placeholder points present in the seek table will be the same after the call as before.
object != NULL
Return values
FLAC__boolfalse if realloc() fails, else true.

◆ FLAC__metadata_object_vorbiscomment_append_comment()

FLAC_API FLAC__bool FLAC__metadata_object_vorbiscomment_append_comment ( FLAC__StreamMetadata object,
FLAC__StreamMetadata_VorbisComment_Entry  entry,
FLAC__bool  copy 
)

Appends a comment to a VORBIS_COMMENT block.

For convenience, a trailing NUL is added to the entry if it doesn't have one already.

If copy is true, a copy of the entry is stored; otherwise, the object takes ownership of the entry.entry pointer.

Note
If this function returns false, the caller still owns the pointer.
Parameters
objectA pointer to an existing VORBIS_COMMENT object.
entryThe comment to insert.
copySee above.
object != NULL
(entry.entry != NULL && entry.length > 0) ||
(entry.entry == NULL && entry.length == 0 && copy == false)
Return values
FLAC__boolfalse if memory allocation fails or entry does not comply with the Vorbis comment specification, else true.

◆ FLAC__metadata_object_vorbiscomment_delete_comment()

FLAC_API FLAC__bool FLAC__metadata_object_vorbiscomment_delete_comment ( FLAC__StreamMetadata object,
unsigned  comment_num 
)

Delete a comment in a VORBIS_COMMENT block at the given index.

Parameters
objectA pointer to an existing VORBIS_COMMENT object.
comment_numThe index of the comment to delete.
object != NULL
object->data.vorbis_comment.num_comments > comment_num
Return values
FLAC__boolfalse if realloc() fails, else true.

◆ FLAC__metadata_object_vorbiscomment_entry_from_name_value_pair()

FLAC_API FLAC__bool FLAC__metadata_object_vorbiscomment_entry_from_name_value_pair ( FLAC__StreamMetadata_VorbisComment_Entry entry,
const char *  field_name,
const char *  field_value 
)

Creates a Vorbis comment entry from NUL-terminated name and value strings.

On return, the filled-in entry->entry pointer will point to malloc()ed memory and shall be owned by the caller. For convenience the entry will have a terminating NUL.

Parameters
entryA pointer to a Vorbis comment entry. The entry's entry pointer should not point to allocated memory as it will be overwritten.
field_nameThe field name in ASCII, NUL terminated.
field_valueThe field value in UTF-8, NUL terminated.
entry != NULL
field_name != NULL
field_value != NULL
Return values
FLAC__boolfalse if malloc() fails, or if field_name or field_value does not comply with the Vorbis comment specification, else true.

◆ FLAC__metadata_object_vorbiscomment_entry_matches()

FLAC_API FLAC__bool FLAC__metadata_object_vorbiscomment_entry_matches ( const FLAC__StreamMetadata_VorbisComment_Entry  entry,
const char *  field_name,
unsigned  field_name_length 
)

Check if the given Vorbis comment entry's field name matches the given field name.

Parameters
entryAn existing Vorbis comment entry.
field_nameThe field name to check.
field_name_lengthThe length of field_name, not including the terminating NUL.
(entry.entry != NULL && entry.length > 0)
Return values
FLAC__booltrue if the field names match, else false

◆ FLAC__metadata_object_vorbiscomment_entry_to_name_value_pair()

FLAC_API FLAC__bool FLAC__metadata_object_vorbiscomment_entry_to_name_value_pair ( const FLAC__StreamMetadata_VorbisComment_Entry  entry,
char **  field_name,
char **  field_value 
)

Splits a Vorbis comment entry into NUL-terminated name and value strings.

The returned pointers to name and value will be allocated by malloc() and shall be owned by the caller.

Parameters
entryAn existing Vorbis comment entry.
field_nameThe address of where the returned pointer to the field name will be stored.
field_valueThe address of where the returned pointer to the field value will be stored.
(entry.entry != NULL && entry.length > 0)
memchr(entry.entry, '=', entry.length) != NULL
field_name != NULL
field_value != NULL
Return values
FLAC__boolfalse if memory allocation fails or entry does not comply with the Vorbis comment specification, else true.

◆ FLAC__metadata_object_vorbiscomment_find_entry_from()

FLAC_API int FLAC__metadata_object_vorbiscomment_find_entry_from ( const FLAC__StreamMetadata object,
unsigned  offset,
const char *  field_name 
)

Find a Vorbis comment with the given field name.

The search begins at entry number offset; use an offset of 0 to search from the beginning of the comment array.

Parameters
objectA pointer to an existing VORBIS_COMMENT object.
offsetThe offset into the comment array from where to start the search.
field_nameThe field name of the comment to find.
object != NULL
field_name != NULL
Return values
intThe offset in the comment array of the first comment whose field name matches field_name, or -1 if no match was found.

◆ FLAC__metadata_object_vorbiscomment_insert_comment()

FLAC_API FLAC__bool FLAC__metadata_object_vorbiscomment_insert_comment ( FLAC__StreamMetadata object,
unsigned  comment_num,
FLAC__StreamMetadata_VorbisComment_Entry  entry,
FLAC__bool  copy 
)

Insert a comment in a VORBIS_COMMENT block at the given index.

For convenience, a trailing NUL is added to the entry if it doesn't have one already.

If copy is true, a copy of the entry is stored; otherwise, the object takes ownership of the entry.entry pointer.

Note
If this function returns false, the caller still owns the pointer.
Parameters
objectA pointer to an existing VORBIS_COMMENT object.
comment_numThe index at which to insert the comment. The comments at and after comment_num move right one position. To append a comment to the end, set comment_num to object->data.vorbis_comment.num_comments .
entryThe comment to insert.
copySee above.
object != NULL
object->data.vorbis_comment.num_comments >= comment_num
(entry.entry != NULL && entry.length > 0) ||
(entry.entry == NULL && entry.length == 0 && copy == false)
Return values
FLAC__boolfalse if memory allocation fails or entry does not comply with the Vorbis comment specification, else true.

◆ FLAC__metadata_object_vorbiscomment_remove_entries_matching()

FLAC_API int FLAC__metadata_object_vorbiscomment_remove_entries_matching ( FLAC__StreamMetadata object,
const char *  field_name 
)

Remove all Vorbis comments matching the given field name.

Parameters
objectA pointer to an existing VORBIS_COMMENT object.
field_nameThe field name of comments to delete.
object != NULL
Return values
int-1 for memory allocation error, 0 for no matching entries, else the number of matching entries deleted.

◆ FLAC__metadata_object_vorbiscomment_remove_entry_matching()

FLAC_API int FLAC__metadata_object_vorbiscomment_remove_entry_matching ( FLAC__StreamMetadata object,
const char *  field_name 
)

Remove first Vorbis comment matching the given field name.

Parameters
objectA pointer to an existing VORBIS_COMMENT object.
field_nameThe field name of comment to delete.
object != NULL
Return values
int-1 for memory allocation error, 0 for no matching entries, 1 for one matching entry deleted.

◆ FLAC__metadata_object_vorbiscomment_replace_comment()

FLAC_API FLAC__bool FLAC__metadata_object_vorbiscomment_replace_comment ( FLAC__StreamMetadata object,
FLAC__StreamMetadata_VorbisComment_Entry  entry,
FLAC__bool  all,
FLAC__bool  copy 
)

Replaces comments in a VORBIS_COMMENT block with a new one.

For convenience, a trailing NUL is added to the entry if it doesn't have one already.

Depending on the value of all, either all or just the first comment whose field name(s) match the given entry's name will be replaced by the given entry. If no comments match, entry will simply be appended.

If copy is true, a copy of the entry is stored; otherwise, the object takes ownership of the entry.entry pointer.

Note
If this function returns false, the caller still owns the pointer.
Parameters
objectA pointer to an existing VORBIS_COMMENT object.
entryThe comment to insert.
allIf true, all comments whose field name matches entry's field name will be removed, and entry will be inserted at the position of the first matching comment. If false, only the first comment whose field name matches entry's field name will be replaced with entry.
copySee above.
object != NULL
(entry.entry != NULL && entry.length > 0) ||
(entry.entry == NULL && entry.length == 0 && copy == false)
Return values
FLAC__boolfalse if memory allocation fails or entry does not comply with the Vorbis comment specification, else true.

◆ FLAC__metadata_object_vorbiscomment_resize_comments()

FLAC_API FLAC__bool FLAC__metadata_object_vorbiscomment_resize_comments ( FLAC__StreamMetadata object,
unsigned  new_num_comments 
)

Resize the comment array.

If the size shrinks, elements will truncated; if it grows, new empty fields will be added to the end.

Parameters
objectA pointer to an existing VORBIS_COMMENT object.
new_num_commentsThe desired length of the array; may be 0.
object != NULL
(object->data.vorbis_comment.comments == NULL && object->data.vorbis_comment.num_comments == 0) ||
(object->data.vorbis_comment.comments != NULL && object->data.vorbis_comment.num_comments > 0)
Return values
FLAC__boolfalse if memory allocation fails, else true.

◆ FLAC__metadata_object_vorbiscomment_set_comment()

FLAC_API FLAC__bool FLAC__metadata_object_vorbiscomment_set_comment ( FLAC__StreamMetadata object,
unsigned  comment_num,
FLAC__StreamMetadata_VorbisComment_Entry  entry,
FLAC__bool  copy 
)

Sets a comment in a VORBIS_COMMENT block.

For convenience, a trailing NUL is added to the entry if it doesn't have one already.

If copy is true, a copy of the entry is stored; otherwise, the object takes ownership of the entry.entry pointer.

Note
If this function returns false, the caller still owns the pointer.
Parameters
objectA pointer to an existing VORBIS_COMMENT object.
comment_numIndex into comment array to set.
entryThe entry to set the comment to.
copySee above.
object != NULL
comment_num < object->data.vorbis_comment.num_comments
(entry.entry != NULL && entry.length > 0) ||
(entry.entry == NULL && entry.length == 0)
Return values
FLAC__boolfalse if memory allocation fails or entry does not comply with the Vorbis comment specification, else true.

◆ FLAC__metadata_object_vorbiscomment_set_vendor_string()

FLAC_API FLAC__bool FLAC__metadata_object_vorbiscomment_set_vendor_string ( FLAC__StreamMetadata object,
FLAC__StreamMetadata_VorbisComment_Entry  entry,
FLAC__bool  copy 
)

Sets the vendor string in a VORBIS_COMMENT block.

For convenience, a trailing NUL is added to the entry if it doesn't have one already.

If copy is true, a copy of the entry is stored; otherwise, the object takes ownership of the entry.entry pointer.

Note
If this function returns false, the caller still owns the pointer.
Parameters
objectA pointer to an existing VORBIS_COMMENT object.
entryThe entry to set the vendor string to.
copySee above.
object != NULL
(entry.entry != NULL && entry.length > 0) ||
(entry.entry == NULL && entry.length == 0)
Return values
FLAC__boolfalse if memory allocation fails or entry does not comply with the Vorbis comment specification, else true.