FLAC 1.5.0 Free Lossless Audio Codec

Modules | Functions
FLAC/metadata.h: metadata level 0 interface
FLAC C API » FLAC/metadata.h: metadata interfaces

## Modules

| FLAC/metadata.h: metadata level 1 interface

## Functions

FLAC__bool | FLAC__metadata_get_streaminfo (const char *filename, FLAC__StreamMetadata *streaminfo)
FLAC__bool | FLAC__metadata_get_tags (const char *filename, FLAC__StreamMetadata **tags)
FLAC__bool | FLAC__metadata_get_cuesheet (const char *filename, FLAC__StreamMetadata **cuesheet)
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, uint32_t max_width, uint32_t max_height, uint32_t max_depth, uint32_t max_colors)

## Detailed Description

The level 0 interface consists of individual routines to read the STREAMINFO, VORBIS_COMMENT, CUESHEET, and PICTURE blocks, requiring only a filename.

On Windows, filename must be a UTF-8 encoded filename, which libFLAC internally translates to an appropriate representation to use with _wfopen. On all other systems, filename is passed to fopen without any translation.

They try to skip any ID3v2 tag at the head of the file.

## Function Documentation

## ◆ FLAC__metadata_get_streaminfo()

FLAC__bool FLAC__metadata_get_streaminfo | ( | const char * | filename,
|  | FLAC__StreamMetadata * | streaminfo
| ) |  |

Read the STREAMINFO metadata block of the given FLAC or Ogg FLAC file. This function will try to skip any ID3v2 tag at the head of the file.

Parameters

  filename | The path to the FLAC or Ogg FLAC file to read.
  streaminfo | A pointer to space for the STREAMINFO block. Since FLAC__StreamMetadata is a simple structure with no memory allocation involved, you pass the address of an existing structure. It need not be initialized.

Assertions:
  filename != NULL
  streaminfo != NULL

Return values

  FLAC__bool | `true` if a valid STREAMINFO block was read from filename. Returns `false` if there was a memory allocation error, a file decoder error, or the file contained no STREAMINFO block. (A memory allocation error is possible because this function must set up a file decoder.)

## ◆ FLAC__metadata_get_tags()

FLAC__bool FLAC__metadata_get_tags | ( | const char * | filename,
|  | FLAC__StreamMetadata ** | tags
| ) |  |

Read the VORBIS_COMMENT metadata block of the given FLAC or Ogg FLAC file. This function will try to skip any ID3v2 tag at the head of the file.

Parameters

  filename | The path to the FLAC or Ogg FLAC file to read.
  tags | The address where the returned pointer will be stored. The tags object must be deleted by the caller using FLAC__metadata_object_delete().

Assertions:
  filename != NULL
  tags != NULL

Return values

  FLAC__bool | `true` if a valid VORBIS_COMMENT block was read from filename, and *tags will be set to the address of the metadata structure. Returns `false` if there was a memory allocation error, a file decoder error, or the file contained no VORBIS_COMMENT block, and *tags will be set to `NULL`.

## ◆ FLAC__metadata_get_cuesheet()

FLAC__bool FLAC__metadata_get_cuesheet | ( | const char * | filename,
|  | FLAC__StreamMetadata ** | cuesheet
| ) |  |

Read the CUESHEET metadata block of the given FLAC or Ogg FLAC file. This function will try to skip any ID3v2 tag at the head of the file.

Parameters

  filename | The path to the FLAC or Ogg FLAC file to read.
  cuesheet | The address where the returned pointer will be stored. The cuesheet object must be deleted by the caller using FLAC__metadata_object_delete().

Assertions:
  filename != NULL
  cuesheet != NULL

Return values

  FLAC__bool | `true` if a valid CUESHEET block was read from filename, and *cuesheet will be set to the address of the metadata structure. Returns `false` if there was a memory allocation error, a file decoder error, or the file contained no CUESHEET block, and *cuesheet will be set to `NULL`.

## ◆ FLAC__metadata_get_picture()

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,
|  | uint32_t | max_width,
|  | uint32_t | max_height,
|  | uint32_t | max_depth,
|  | uint32_t | max_colors
| ) |  |

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 *picture will be set to `NULL` if there was no such block. This function does not currently support reading from Ogg FLAC files.

Parameters

  filename | The path to the FLAC file to read.
  picture | The address where the returned pointer will be stored. The picture object must be deleted by the caller using FLAC__metadata_object_delete().
  type | The desired picture type. Use `-1` to mean "any type".
  mime_type | The desired MIME type, e.g. "image/jpeg". The string will be matched exactly. Use `NULL` to mean "any MIME type".
  description | The desired description. The string will be matched exactly. Use `NULL` to mean "any description".
  max_width | The maximum width in pixels desired. Use ``(uint32_t)(-1) to mean "any width".
  max_height | The maximum height in pixels desired. Use ``(uint32_t)(-1) to mean "any height".
  max_depth | The maximum color depth in bits-per-pixel desired. Use ``(uint32_t)(-1) to mean "any depth".
  max_colors | The maximum number of colors desired. Use ``(uint32_t)(-1) to mean "any number of colors".

Assertions:
  filename != NULL
  picture != NULL

Return values

  FLAC__bool | `true` if a valid PICTURE block was read from filename, and *picture will be set to the address of the metadata structure. Returns `false` if there was a memory allocation error, a file decoder error, or the file contained no PICTURE block, and *picture will be set to `NULL`.

Copyright (c) 2000-2009 Josh Coalson Copyright (c) 2011-2025 Xiph.Org Foundation