Main Page Modules Class Hierarchy Alphabetical List Compound List File List Compound Members File Members

# FLAC/format.h: format components
[FLAC C API]

This module contains structure definitions for the representation of FLAC format components in memory. These are the basic structures used by the rest of the interfaces. More...

## Compounds
struct | FLAC__EntropyCodingMethod_PartitionedRiceContents
struct | FLAC__EntropyCodingMethod_PartitionedRice
struct | FLAC__EntropyCodingMethod
struct | FLAC__Subframe_Constant
struct | FLAC__Subframe_Verbatim
struct | FLAC__Subframe_Fixed
struct | FLAC__Subframe_LPC
struct | FLAC__Subframe
struct | FLAC__FrameHeader
struct | FLAC__FrameFooter
struct | FLAC__Frame
struct | FLAC__StreamMetadata_StreamInfo
struct | FLAC__StreamMetadata_Padding
struct | FLAC__StreamMetadata_Application
struct | FLAC__StreamMetadata_SeekPoint
struct | FLAC__StreamMetadata_SeekTable
struct | FLAC__StreamMetadata_VorbisComment_Entry
struct | FLAC__StreamMetadata_VorbisComment
struct | FLAC__StreamMetadata
## Defines
#define | FLAC__MIN_BLOCK_SIZE (16u)
#define | FLAC__MAX_BLOCK_SIZE (65535u)
#define | FLAC__MAX_CHANNELS (8u)
#define | FLAC__MIN_BITS_PER_SAMPLE (4u)
#define | FLAC__MAX_BITS_PER_SAMPLE (32u)
#define | FLAC__REFERENCE_CODEC_MAX_BITS_PER_SAMPLE (24u)
#define | FLAC__MAX_SAMPLE_RATE (655350u)
#define | FLAC__MAX_LPC_ORDER (32u)
#define | FLAC__MIN_QLP_COEFF_PRECISION (5u)
#define | FLAC__MAX_FIXED_ORDER (4u)
#define | FLAC__MAX_RICE_PARTITION_ORDER (15u)
#define | FLAC__STREAM_SYNC_LENGTH (4u)
#define | FLAC__STREAM_METADATA_STREAMINFO_LENGTH (34u)
#define | FLAC__STREAM_METADATA_SEEKPOINT_LENGTH (18u)
#define | FLAC__STREAM_METADATA_HEADER_LENGTH (4u)
## Enumerations
enum | FLAC__EntropyCodingMethodType { FLAC__ENTROPY_CODING_METHOD_PARTITIONED_RICE = 0 }
enum | FLAC__SubframeType { FLAC__SUBFRAME_TYPE_CONSTANT = 0, FLAC__SUBFRAME_TYPE_VERBATIM = 1, FLAC__SUBFRAME_TYPE_FIXED = 2, FLAC__SUBFRAME_TYPE_LPC = 3 }
enum | FLAC__ChannelAssignment { FLAC__CHANNEL_ASSIGNMENT_INDEPENDENT = 0, FLAC__CHANNEL_ASSIGNMENT_LEFT_SIDE = 1, FLAC__CHANNEL_ASSIGNMENT_RIGHT_SIDE = 2, FLAC__CHANNEL_ASSIGNMENT_MID_SIDE = 3 }
enum | FLAC__FrameNumberType { FLAC__FRAME_NUMBER_TYPE_FRAME_NUMBER, FLAC__FRAME_NUMBER_TYPE_SAMPLE_NUMBER }
enum | FLAC__MetadataType { FLAC__METADATA_TYPE_STREAMINFO = 0, FLAC__METADATA_TYPE_PADDING = 1, FLAC__METADATA_TYPE_APPLICATION = 2, FLAC__METADATA_TYPE_SEEKTABLE = 3, FLAC__METADATA_TYPE_VORBIS_COMMENT = 4 }
## Functions
FLAC__bool | FLAC__format_sample_rate_is_valid (unsigned sample_rate)
FLAC__bool | FLAC__format_seektable_is_legal (const FLAC__StreamMetadata_SeekTable *seek_table)
unsigned | FLAC__format_seektable_sort (FLAC__StreamMetadata_SeekTable *seek_table)
## Variables
const char * | FLAC__VERSION_STRING
const char * | FLAC__VENDOR_STRING
const FLAC__byte | FLAC__STREAM_SYNC_STRING [4]
const unsigned | FLAC__STREAM_SYNC
const unsigned | FLAC__STREAM_SYNC_LEN
const char *const | FLAC__EntropyCodingMethodTypeString []
const unsigned | FLAC__ENTROPY_CODING_METHOD_PARTITIONED_RICE_ORDER_LEN
const unsigned | FLAC__ENTROPY_CODING_METHOD_PARTITIONED_RICE_PARAMETER_LEN
const unsigned | FLAC__ENTROPY_CODING_METHOD_PARTITIONED_RICE_RAW_LEN
const unsigned | FLAC__ENTROPY_CODING_METHOD_PARTITIONED_RICE_ESCAPE_PARAMETER
const unsigned | FLAC__ENTROPY_CODING_METHOD_TYPE_LEN
const char *const | FLAC__SubframeTypeString []
const unsigned | FLAC__SUBFRAME_LPC_QLP_COEFF_PRECISION_LEN
const unsigned | FLAC__SUBFRAME_LPC_QLP_SHIFT_LEN
const unsigned | FLAC__SUBFRAME_ZERO_PAD_LEN
const unsigned | FLAC__SUBFRAME_TYPE_LEN
const unsigned | FLAC__SUBFRAME_WASTED_BITS_FLAG_LEN
const unsigned | FLAC__SUBFRAME_TYPE_CONSTANT_BYTE_ALIGNED_MASK
const unsigned | FLAC__SUBFRAME_TYPE_VERBATIM_BYTE_ALIGNED_MASK
const unsigned | FLAC__SUBFRAME_TYPE_FIXED_BYTE_ALIGNED_MASK
const unsigned | FLAC__SUBFRAME_TYPE_LPC_BYTE_ALIGNED_MASK
const char *const | FLAC__ChannelAssignmentString []
const char *const | FLAC__FrameNumberTypeString []
const unsigned | FLAC__FRAME_HEADER_SYNC
const unsigned | FLAC__FRAME_HEADER_SYNC_LEN
const unsigned | FLAC__FRAME_HEADER_RESERVED_LEN
const unsigned | FLAC__FRAME_HEADER_BLOCK_SIZE_LEN
const unsigned | FLAC__FRAME_HEADER_SAMPLE_RATE_LEN
const unsigned | FLAC__FRAME_HEADER_CHANNEL_ASSIGNMENT_LEN
const unsigned | FLAC__FRAME_HEADER_BITS_PER_SAMPLE_LEN
const unsigned | FLAC__FRAME_HEADER_ZERO_PAD_LEN
const unsigned | FLAC__FRAME_HEADER_CRC_LEN
const unsigned | FLAC__FRAME_FOOTER_CRC_LEN
const char *const | FLAC__MetadataTypeString []
const unsigned | FLAC__STREAM_METADATA_STREAMINFO_MIN_BLOCK_SIZE_LEN
const unsigned | FLAC__STREAM_METADATA_STREAMINFO_MAX_BLOCK_SIZE_LEN
const unsigned | FLAC__STREAM_METADATA_STREAMINFO_MIN_FRAME_SIZE_LEN
const unsigned | FLAC__STREAM_METADATA_STREAMINFO_MAX_FRAME_SIZE_LEN
const unsigned | FLAC__STREAM_METADATA_STREAMINFO_SAMPLE_RATE_LEN
const unsigned | FLAC__STREAM_METADATA_STREAMINFO_CHANNELS_LEN
const unsigned | FLAC__STREAM_METADATA_STREAMINFO_BITS_PER_SAMPLE_LEN
const unsigned | FLAC__STREAM_METADATA_STREAMINFO_TOTAL_SAMPLES_LEN
const unsigned | FLAC__STREAM_METADATA_STREAMINFO_MD5SUM_LEN
const unsigned | FLAC__STREAM_METADATA_APPLICATION_ID_LEN
const unsigned | FLAC__STREAM_METADATA_SEEKPOINT_SAMPLE_NUMBER_LEN
const unsigned | FLAC__STREAM_METADATA_SEEKPOINT_STREAM_OFFSET_LEN
const unsigned | FLAC__STREAM_METADATA_SEEKPOINT_FRAME_SAMPLES_LEN
const FLAC__uint64 | FLAC__STREAM_METADATA_SEEKPOINT_PLACEHOLDER
const unsigned | FLAC__STREAM_METADATA_VORBIS_COMMENT_ENTRY_LENGTH_LEN
const unsigned | FLAC__STREAM_METADATA_VORBIS_COMMENT_NUM_COMMENTS_LEN
const unsigned | FLAC__STREAM_METADATA_IS_LAST_LEN
const unsigned | FLAC__STREAM_METADATA_TYPE_LEN
const unsigned | FLAC__STREAM_METADATA_LENGTH_LEN

## Detailed Description

This module contains structure definitions for the representation of FLAC format components in memory. These are the basic structures used by the rest of the interfaces.

First, you should be familiar with the FLAC format. Many of the values here follow directly from the specification. As a user of libFLAC, the interesting parts really are the structures that describe the frame header and metadata blocks.

The format structures here are very primitive, designed to store information in an efficient way. Reading information from the structures is easy but creating or modifying them directly is more complex. For the most part, as a user of a library, editing is not necessary; however, for metadata blocks it is, so there are convenience functions provided in the metadata module to simplify the manipulation of metadata blocks.

Note:
  It's not the best convention, but symbols ending in _LEN are in bits and _LENGTH are in bytes. _LENGTH symbols are #defines instead of global variables because they are usually used when declaring byte arrays and some compilers require compile-time knowledge of array sizes when declared on the stack.

## Define Documentation

#define FLAC__MIN_BLOCK_SIZE (16u)

| The minimum block size, in samples, permitted by the format.

#define FLAC__MAX_BLOCK_SIZE (65535u)

| The maximum block size, in samples, permitted by the format.

#define FLAC__MAX_CHANNELS (8u)

| The maximum number of channels permitted by the format.

#define FLAC__MIN_BITS_PER_SAMPLE (4u)

| The minimum sample resolution permitted by the format.

#define FLAC__MAX_BITS_PER_SAMPLE (32u)

| The maximum sample resolution permitted by the format.

#define FLAC__REFERENCE_CODEC_MAX_BITS_PER_SAMPLE (24u)

| The maximum sample resolution permitted by libFLAC. Warning: FLAC__MAX_BITS_PER_SAMPLE is the limit of the FLAC format. However, the reference encoder/decoder is currently limited to 24 bits because of prevalent 32-bit math, so make sure and use this value when appropriate.

#define FLAC__MAX_SAMPLE_RATE (655350u)

| The maximum sample rate permitted by the format. The value is ((2 ^ 16) - 1) * 10; see FLAC format as to why.

#define FLAC__MAX_LPC_ORDER (32u)

| The maximum LPC order permitted by the format.

#define FLAC__MIN_QLP_COEFF_PRECISION (5u)

| The minimum quantized linear predictor coefficient precision permitted by the format.

#define FLAC__MAX_FIXED_ORDER (4u)

| The maximum order of the fixed predictors permitted by the format.

#define FLAC__MAX_RICE_PARTITION_ORDER (15u)

| The maximum Rice partition order permitted by the format.

#define FLAC__STREAM_SYNC_LENGTH (4u)

| The length of the FLAC signature in bytes.

#define FLAC__STREAM_METADATA_STREAMINFO_LENGTH (34u)

| The total stream length of the STREAMINFO block in bytes.

#define FLAC__STREAM_METADATA_SEEKPOINT_LENGTH (18u)

| The total stream length of a seek point in bytes.

#define FLAC__STREAM_METADATA_HEADER_LENGTH (4u)

| The total stream length of a metadata block header in bytes.

## Enumeration Type Documentation

enum FLAC__EntropyCodingMethodType

  | An enumeration of the available entropy coding methods. Enumeration values:
  FLAC__ENTROPY_CODING_METHOD_PARTITIONED_RICE | Residual is coded by partitioning into contexts, each with it's own Rice parameter.

enum FLAC__SubframeType

  | An enumeration of the available subframe types. Enumeration values:
  FLAC__SUBFRAME_TYPE_CONSTANT | constant signal
  FLAC__SUBFRAME_TYPE_VERBATIM | uncompressed signal
  FLAC__SUBFRAME_TYPE_FIXED | fixed polynomial prediction
  FLAC__SUBFRAME_TYPE_LPC | linear prediction

enum FLAC__ChannelAssignment

  | An enumeration of the available channel assignments. Enumeration values:
  FLAC__CHANNEL_ASSIGNMENT_INDEPENDENT | independent channels
  FLAC__CHANNEL_ASSIGNMENT_LEFT_SIDE | left+side stereo
  FLAC__CHANNEL_ASSIGNMENT_RIGHT_SIDE | right+side stereo
  FLAC__CHANNEL_ASSIGNMENT_MID_SIDE | mid+side stereo

enum FLAC__FrameNumberType

  | An enumeration of the possible frame numbering methods. Enumeration values:
  FLAC__FRAME_NUMBER_TYPE_FRAME_NUMBER | number contains the frame number
  FLAC__FRAME_NUMBER_TYPE_SAMPLE_NUMBER | number contains the sample number of first sample in frame

enum FLAC__MetadataType

  | An enumeration of the available metadata block types. Enumeration values:
  FLAC__METADATA_TYPE_STREAMINFO | STREAMINFO block
  FLAC__METADATA_TYPE_PADDING | block
  FLAC__METADATA_TYPE_APPLICATION | block
  FLAC__METADATA_TYPE_SEEKTABLE | block
  FLAC__METADATA_TYPE_VORBIS_COMMENT | block

## Function Documentation

FLAC__bool FLAC__format_sample_rate_is_valid | ( | unsigned | sample_rate | ) |

  | Tests that a sample rate is valid for FLAC. Since the rules for valid sample rates are slightly complex, they are encapsulated in this function. Parameters:
  sample_rate | The sample rate to test for compliance.
  Return values:
  FLAC__bool | `true` if the given sample rate conforms to the specification, else `false`.

FLAC__bool FLAC__format_seektable_is_legal | ( | const FLAC__StreamMetadata_SeekTable * | seek_table | ) |

  | Check a seek table to see if it conforms to the FLAC specification. See the format specification for limits on the contents of the seek table. Parameters:
  seek_table | A pointer to a seek table to be checked.
  Assertions:
      seek_table != NULL
  Return values:
  FLAC__bool | `false` if seek table is illegal, else `true`.

unsigned FLAC__format_seektable_sort | ( | FLAC__StreamMetadata_SeekTable * | seek_table | ) |

  | Sort a seek table's seek points according to the format specification. This includes a "unique-ification" step to remove duplicates, i.e. seek points with identical sample_number values. Duplicate seek points are converted into placeholder points and sorted to the end of the table. Parameters:
  seek_table | A pointer to a seek table to be sorted.
  Assertions:
      seek_table != NULL
  Return values:
  unsigned | The number of duplicate seek points converted into placeholders.

## Variable Documentation

const char* FLAC__VERSION_STRING

| The version string of the release, stamped onto the libraries and binaries. Note: This does not correspond to the shared library version number, which is used to determine binary compatibility.

const char* FLAC__VENDOR_STRING

| The vendor string inserted by the encoder into the VORBIS_COMMENT block. This is a nulL-terminated ASCII string; when inserted into the VORBIS_COMMENT the trailing null is stripped.

const FLAC__byte FLAC__STREAM_SYNC_STRING[4]

| The byte string representation of the beginning of a FLAC stream.

const unsigned FLAC__STREAM_SYNC

| The 32-bit integer big-endian representation of the beginning of a FLAC stream.

const unsigned FLAC__STREAM_SYNC_LEN

| The length of the FLAC signature in bits.

const char* const FLAC__EntropyCodingMethodTypeString[]

| Maps a FLAC__EntropyCodingMethodType to a C string. Using a FLAC__EntropyCodingMethodType as the index to this array will give the string equivalent. The contents should not be modified.

const unsigned FLAC__ENTROPY_CODING_METHOD_PARTITIONED_RICE_ORDER_LEN

| == 4 (bits)

const unsigned FLAC__ENTROPY_CODING_METHOD_PARTITIONED_RICE_PARAMETER_LEN

| == 4 (bits)

const unsigned FLAC__ENTROPY_CODING_METHOD_PARTITIONED_RICE_RAW_LEN

| == 5 (bits)

const unsigned FLAC__ENTROPY_CODING_METHOD_PARTITIONED_RICE_ESCAPE_PARAMETER

| == (1<<FLAC__ENTROPY_CODING_METHOD_PARTITIONED_RICE_PARAMETER_LEN)-1

const unsigned FLAC__ENTROPY_CODING_METHOD_TYPE_LEN

| == 2 (bits)

const char* const FLAC__SubframeTypeString[]

| Maps a FLAC__SubframeType to a C string. Using a FLAC__SubframeType as the index to this array will give the string equivalent. The contents should not be modified.

const unsigned FLAC__SUBFRAME_LPC_QLP_COEFF_PRECISION_LEN

| == 4 (bits)

const unsigned FLAC__SUBFRAME_LPC_QLP_SHIFT_LEN

| == 5 (bits)

const unsigned FLAC__SUBFRAME_ZERO_PAD_LEN

| == 1 (bit)

const unsigned FLAC__SUBFRAME_TYPE_LEN

| == 6 (bits)

const unsigned FLAC__SUBFRAME_WASTED_BITS_FLAG_LEN

| == 1 (bit)

const char* const FLAC__ChannelAssignmentString[]

| Maps a FLAC__ChannelAssignment to a C string. Using a FLAC__ChannelAssignment as the index to this array will give the string equivalent. The contents should not be modified.

const char* const FLAC__FrameNumberTypeString[]

| Maps a FLAC__FrameNumberType to a C string. Using a FLAC__FrameNumberType as the index to this array will give the string equivalent. The contents should not be modified.

const unsigned FLAC__FRAME_HEADER_SYNC

| == 0x3ffe; the frame header sync code

const unsigned FLAC__FRAME_HEADER_SYNC_LEN

| == 14 (bits)

const unsigned FLAC__FRAME_HEADER_RESERVED_LEN

| == 2 (bits)

const unsigned FLAC__FRAME_HEADER_BLOCK_SIZE_LEN

| == 4 (bits)

const unsigned FLAC__FRAME_HEADER_SAMPLE_RATE_LEN

| == 4 (bits)

const unsigned FLAC__FRAME_HEADER_CHANNEL_ASSIGNMENT_LEN

| == 4 (bits)

const unsigned FLAC__FRAME_HEADER_BITS_PER_SAMPLE_LEN

| == 3 (bits)

const unsigned FLAC__FRAME_HEADER_ZERO_PAD_LEN

| == 1 (bit)

const unsigned FLAC__FRAME_HEADER_CRC_LEN

| == 8 (bits)

const unsigned FLAC__FRAME_FOOTER_CRC_LEN

| == 16 (bits)

const char* const FLAC__MetadataTypeString[]

| Maps a FLAC__MetadataType to a C string. Using a FLAC__MetadataType as the index to this array will give the string equivalent. The contents should not be modified.

const unsigned FLAC__STREAM_METADATA_STREAMINFO_MIN_BLOCK_SIZE_LEN

| == 16 (bits)

const unsigned FLAC__STREAM_METADATA_STREAMINFO_MAX_BLOCK_SIZE_LEN

| == 16 (bits)

const unsigned FLAC__STREAM_METADATA_STREAMINFO_MIN_FRAME_SIZE_LEN

| == 24 (bits)

const unsigned FLAC__STREAM_METADATA_STREAMINFO_MAX_FRAME_SIZE_LEN

| == 24 (bits)

const unsigned FLAC__STREAM_METADATA_STREAMINFO_SAMPLE_RATE_LEN

| == 20 (bits)

const unsigned FLAC__STREAM_METADATA_STREAMINFO_CHANNELS_LEN

| == 3 (bits)

const unsigned FLAC__STREAM_METADATA_STREAMINFO_BITS_PER_SAMPLE_LEN

| == 5 (bits)

const unsigned FLAC__STREAM_METADATA_STREAMINFO_TOTAL_SAMPLES_LEN

| == 36 (bits)

const unsigned FLAC__STREAM_METADATA_STREAMINFO_MD5SUM_LEN

| == 128 (bits)

const unsigned FLAC__STREAM_METADATA_APPLICATION_ID_LEN

| == 32 (bits)

const unsigned FLAC__STREAM_METADATA_SEEKPOINT_SAMPLE_NUMBER_LEN

| == 64 (bits)

const unsigned FLAC__STREAM_METADATA_SEEKPOINT_STREAM_OFFSET_LEN

| == 64 (bits)

const unsigned FLAC__STREAM_METADATA_SEEKPOINT_FRAME_SAMPLES_LEN

| == 16 (bits)

const FLAC__uint64 FLAC__STREAM_METADATA_SEEKPOINT_PLACEHOLDER

| The value used in the sample_number field of FLAC__StreamMetadataSeekPoint used to indicate a placeholder point (== 0xffffffffffffffff).

const unsigned FLAC__STREAM_METADATA_VORBIS_COMMENT_ENTRY_LENGTH_LEN

| == 32 (bits)

const unsigned FLAC__STREAM_METADATA_VORBIS_COMMENT_NUM_COMMENTS_LEN

| == 32 (bits)

const unsigned FLAC__STREAM_METADATA_IS_LAST_LEN

| == 1 (bit)

const unsigned FLAC__STREAM_METADATA_TYPE_LEN

| == 7 (bits)

const unsigned FLAC__STREAM_METADATA_LENGTH_LEN

| == 24 (bits)