1 /* libFLAC - Free Lossless Audio Codec library
2 * Copyright (C) 2000,2001,2002 Josh Coalson
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Library General Public
6 * License as published by the Free Software Foundation; either
7 * version 2 of the License, or (at your option) any later version.
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Library General Public License for more details.
14 * You should have received a copy of the GNU Library General Public
15 * License along with this library; if not, write to the
16 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
17 * Boston, MA 02111-1307, USA.
20 #ifndef FLAC__FORMAT_H
21 #define FLAC__FORMAT_H
30 /** \file include/FLAC/format.h
33 * This module contains structure definitions for the representation
34 * of FLAC format components in memory. These are the basic
35 * structures used by the rest of the interfaces.
37 * See the detailed documentation in the
38 * \link flac_format format \endlink module.
41 /** \defgroup flac_format FLAC/format.h: format components
45 * This module contains structure definitions for the representation
46 * of FLAC format components in memory. These are the basic
47 * structures used by the rest of the interfaces.
49 * First, you should be familiar with the
50 * <A HREF="../format.html">FLAC format</A>. Many of the values here
51 * follow directly from the specification. As a user of libFLAC, the
52 * interesting parts really are the structures that describe the frame
53 * header and metadata blocks.
55 * The format structures here are very primitive, designed to store
56 * information in an efficient way. Reading information from the
57 * structures is easy but creating or modifying them directly is
58 * more complex. For the most part, as a user of a library, editing
59 * is not necessary; however, for metadata blocks it is, so there are
60 * convenience functions provided in the \link flac_metadata metadata
61 * module \endlink to simplify the manipulation of metadata blocks.
64 * It's not the best convention, but symbols ending in _LEN are in bits
65 * and _LENGTH are in bytes. _LENGTH symbols are \#defines instead of
66 * global variables because they are usually used when declaring byte
67 * arrays and some compilers require compile-time knowledge of array
68 * sizes when declared on the stack.
75 Most of the values described in this file are defined by the FLAC
76 format specification. There is nothing to tune here.
79 /** The minimum block size, in samples, permitted by the format. */
80 #define FLAC__MIN_BLOCK_SIZE (16u)
82 /** The maximum block size, in samples, permitted by the format. */
83 #define FLAC__MAX_BLOCK_SIZE (65535u)
85 /** The maximum number of channels permitted by the format. */
86 #define FLAC__MAX_CHANNELS (8u)
88 /** The minimum sample resolution permitted by the format. */
89 #define FLAC__MIN_BITS_PER_SAMPLE (4u)
91 /** The maximum sample resolution permitted by the format. */
92 #define FLAC__MAX_BITS_PER_SAMPLE (32u)
94 /** The maximum sample resolution permitted by libFLAC.
97 * FLAC__MAX_BITS_PER_SAMPLE is the limit of the FLAC format. However,
98 * the reference encoder/decoder is currently limited to 24 bits because
99 * of prevalent 32-bit math, so make sure and use this value when
102 #define FLAC__REFERENCE_CODEC_MAX_BITS_PER_SAMPLE (24u)
104 /** The maximum sample rate permitted by the format. The value is
105 * ((2 ^ 16) - 1) * 10; see <A HREF="../format.html">FLAC format</A>
108 #define FLAC__MAX_SAMPLE_RATE (655350u)
110 /** The maximum LPC order permitted by the format. */
111 #define FLAC__MAX_LPC_ORDER (32u)
113 /** The minimum quantized linear predictor coefficient precision
114 * permitted by the format.
116 #define FLAC__MIN_QLP_COEFF_PRECISION (5u)
118 /** The maximum quantized linear predictor coefficient precision
119 * permitted by the format.
121 #define FLAC__MAX_QLP_COEFF_PRECISION (15u)
123 /** The maximum order of the fixed predictors permitted by the format. */
124 #define FLAC__MAX_FIXED_ORDER (4u)
126 /** The maximum Rice partition order permitted by the format. */
127 #define FLAC__MAX_RICE_PARTITION_ORDER (15u)
129 /** The maximum Rice partition order permitted by the FLAC Subset. */
130 #define FLAC__SUBSET_MAX_RICE_PARTITION_ORDER (8u)
132 /** The version string of the release, stamped onto the libraries and binaries.
135 * This does not correspond to the shared library version number, which
136 * is used to determine binary compatibility.
138 extern FLAC_API const char *FLAC__VERSION_STRING;
140 /** The vendor string inserted by the encoder into the VORBIS_COMMENT block.
141 * This is a nulL-terminated ASCII string; when inserted into the
142 * VORBIS_COMMENT the trailing null is stripped.
144 extern FLAC_API const char *FLAC__VENDOR_STRING;
146 /** The byte string representation of the beginning of a FLAC stream. */
147 extern FLAC_API const FLAC__byte FLAC__STREAM_SYNC_STRING[4]; /* = "fLaC" */
149 /** The 32-bit integer big-endian representation of the beginning of
152 extern FLAC_API const unsigned FLAC__STREAM_SYNC; /* = 0x664C6143 */
154 /** The length of the FLAC signature in bits. */
155 extern FLAC_API const unsigned FLAC__STREAM_SYNC_LEN; /* = 32 bits */
157 /** The length of the FLAC signature in bytes. */
158 #define FLAC__STREAM_SYNC_LENGTH (4u)
161 /*****************************************************************************
163 * Subframe structures
165 *****************************************************************************/
167 /*****************************************************************************/
169 /** An enumeration of the available entropy coding methods. */
171 FLAC__ENTROPY_CODING_METHOD_PARTITIONED_RICE = 0
172 /**< Residual is coded by partitioning into contexts, each with it's own
174 } FLAC__EntropyCodingMethodType;
176 /** Maps a FLAC__EntropyCodingMethodType to a C string.
178 * Using a FLAC__EntropyCodingMethodType as the index to this array will
179 * give the string equivalent. The contents should not be modified.
181 extern FLAC_API const char * const FLAC__EntropyCodingMethodTypeString[];
184 /** Contents of a Rice partitioned residual
188 unsigned *parameters;
189 /**< The Rice parameters for each context. */
192 /**< Widths for escape-coded partitions. */
194 unsigned capacity_by_order;
195 /**< The capacity of the \a parameters and \a raw_bits arrays
196 * specified as an order, i.e. the number of array elements
197 * allocated is 2 ^ \a capacity_by_order.
199 } FLAC__EntropyCodingMethod_PartitionedRiceContents;
201 /** Header for a Rice partitioned residual. (c.f. <A HREF="../format.html#partitioned_rice">format specification</A>)
206 /**< The partition order, i.e. # of contexts = 2 ^ \a order. */
208 const FLAC__EntropyCodingMethod_PartitionedRiceContents *contents;
209 /**< The context's Rice parameters and/or raw bits. */
211 } FLAC__EntropyCodingMethod_PartitionedRice;
213 extern FLAC_API const unsigned FLAC__ENTROPY_CODING_METHOD_PARTITIONED_RICE_ORDER_LEN; /**< == 4 (bits) */
214 extern FLAC_API const unsigned FLAC__ENTROPY_CODING_METHOD_PARTITIONED_RICE_PARAMETER_LEN; /**< == 4 (bits) */
215 extern FLAC_API const unsigned FLAC__ENTROPY_CODING_METHOD_PARTITIONED_RICE_RAW_LEN; /**< == 5 (bits) */
217 extern FLAC_API const unsigned FLAC__ENTROPY_CODING_METHOD_PARTITIONED_RICE_ESCAPE_PARAMETER;
218 /**< == (1<<FLAC__ENTROPY_CODING_METHOD_PARTITIONED_RICE_PARAMETER_LEN)-1 */
220 /** Header for the entropy coding method. (c.f. <A HREF="../format.html#residual">format specification</A>)
223 FLAC__EntropyCodingMethodType type;
225 FLAC__EntropyCodingMethod_PartitionedRice partitioned_rice;
227 } FLAC__EntropyCodingMethod;
229 extern FLAC_API const unsigned FLAC__ENTROPY_CODING_METHOD_TYPE_LEN; /**< == 2 (bits) */
231 /*****************************************************************************/
233 /** An enumeration of the available subframe types. */
235 FLAC__SUBFRAME_TYPE_CONSTANT = 0, /**< constant signal */
236 FLAC__SUBFRAME_TYPE_VERBATIM = 1, /**< uncompressed signal */
237 FLAC__SUBFRAME_TYPE_FIXED = 2, /**< fixed polynomial prediction */
238 FLAC__SUBFRAME_TYPE_LPC = 3 /**< linear prediction */
239 } FLAC__SubframeType;
241 /** Maps a FLAC__SubframeType to a C string.
243 * Using a FLAC__SubframeType as the index to this array will
244 * give the string equivalent. The contents should not be modified.
246 extern FLAC_API const char * const FLAC__SubframeTypeString[];
249 /** CONSTANT subframe. (c.f. <A HREF="../format.html#subframe_constant">format specification</A>)
252 FLAC__int32 value; /**< The constant signal value. */
253 } FLAC__Subframe_Constant;
256 /** VERBATIM subframe. (c.f. <A HREF="../format.html#subframe_verbatim">format specification</A>)
259 const FLAC__int32 *data; /**< A pointer to verbatim signal. */
260 } FLAC__Subframe_Verbatim;
263 /** FIXED subframe. (c.f. <A HREF="../format.html#subframe_fixed">format specification</A>)
266 FLAC__EntropyCodingMethod entropy_coding_method;
267 /**< The residual coding method. */
270 /**< The polynomial order. */
272 FLAC__int32 warmup[FLAC__MAX_FIXED_ORDER];
273 /**< Warmup samples to prime the predictor, length == order. */
275 const FLAC__int32 *residual;
276 /**< The residual signal, length == (blocksize minus order) samples. */
277 } FLAC__Subframe_Fixed;
280 /** LPC subframe. (c.f. <A HREF="../format.html#subframe_lpc">format specification</A>)
283 FLAC__EntropyCodingMethod entropy_coding_method;
284 /**< The residual coding method. */
287 /**< The FIR order. */
289 unsigned qlp_coeff_precision;
290 /**< Quantized FIR filter coefficient precision in bits. */
292 int quantization_level;
293 /**< The qlp coeff shift needed. */
295 FLAC__int32 qlp_coeff[FLAC__MAX_LPC_ORDER];
296 /**< FIR filter coefficients. */
298 FLAC__int32 warmup[FLAC__MAX_LPC_ORDER];
299 /**< Warmup samples to prime the predictor, length == order. */
301 const FLAC__int32 *residual;
302 /**< The residual signal, length == (blocksize minus order) samples. */
303 } FLAC__Subframe_LPC;
305 extern FLAC_API const unsigned FLAC__SUBFRAME_LPC_QLP_COEFF_PRECISION_LEN; /**< == 4 (bits) */
306 extern FLAC_API const unsigned FLAC__SUBFRAME_LPC_QLP_SHIFT_LEN; /**< == 5 (bits) */
309 /** FLAC subframe structure. (c.f. <A HREF="../format.html#subframe">format specification</A>)
312 FLAC__SubframeType type;
314 FLAC__Subframe_Constant constant;
315 FLAC__Subframe_Fixed fixed;
316 FLAC__Subframe_LPC lpc;
317 FLAC__Subframe_Verbatim verbatim;
319 unsigned wasted_bits;
322 extern FLAC_API const unsigned FLAC__SUBFRAME_ZERO_PAD_LEN; /**< == 1 (bit) */
323 extern FLAC_API const unsigned FLAC__SUBFRAME_TYPE_LEN; /**< == 6 (bits) */
324 extern FLAC_API const unsigned FLAC__SUBFRAME_WASTED_BITS_FLAG_LEN; /**< == 1 (bit) */
326 extern FLAC_API const unsigned FLAC__SUBFRAME_TYPE_CONSTANT_BYTE_ALIGNED_MASK; /* = 0x00 */
327 extern FLAC_API const unsigned FLAC__SUBFRAME_TYPE_VERBATIM_BYTE_ALIGNED_MASK; /* = 0x02 */
328 extern FLAC_API const unsigned FLAC__SUBFRAME_TYPE_FIXED_BYTE_ALIGNED_MASK; /* = 0x10 */
329 extern FLAC_API const unsigned FLAC__SUBFRAME_TYPE_LPC_BYTE_ALIGNED_MASK; /* = 0x40 */
331 /*****************************************************************************/
334 /*****************************************************************************
338 *****************************************************************************/
340 /** An enumeration of the available channel assignments. */
342 FLAC__CHANNEL_ASSIGNMENT_INDEPENDENT = 0, /**< independent channels */
343 FLAC__CHANNEL_ASSIGNMENT_LEFT_SIDE = 1, /**< left+side stereo */
344 FLAC__CHANNEL_ASSIGNMENT_RIGHT_SIDE = 2, /**< right+side stereo */
345 FLAC__CHANNEL_ASSIGNMENT_MID_SIDE = 3 /**< mid+side stereo */
346 } FLAC__ChannelAssignment;
348 /** Maps a FLAC__ChannelAssignment to a C string.
350 * Using a FLAC__ChannelAssignment as the index to this array will
351 * give the string equivalent. The contents should not be modified.
353 extern FLAC_API const char * const FLAC__ChannelAssignmentString[];
355 /** An enumeration of the possible frame numbering methods. */
357 FLAC__FRAME_NUMBER_TYPE_FRAME_NUMBER, /**< number contains the frame number */
358 FLAC__FRAME_NUMBER_TYPE_SAMPLE_NUMBER /**< number contains the sample number of first sample in frame */
359 } FLAC__FrameNumberType;
361 /** Maps a FLAC__FrameNumberType to a C string.
363 * Using a FLAC__FrameNumberType as the index to this array will
364 * give the string equivalent. The contents should not be modified.
366 extern FLAC_API const char * const FLAC__FrameNumberTypeString[];
369 /** FLAC frame header structure. (c.f. <A HREF="../format.html#frame_header">format specification</A>)
373 /**< The number of samples per subframe. */
375 unsigned sample_rate;
376 /**< The sample rate in Hz. */
379 /**< The number of channels (== number of subframes). */
381 FLAC__ChannelAssignment channel_assignment;
382 /**< The channel assignment for the frame. */
384 unsigned bits_per_sample;
385 /**< The sample resolution. */
387 FLAC__FrameNumberType number_type;
388 /**< The numbering scheme used for the frame. */
391 FLAC__uint32 frame_number;
392 FLAC__uint64 sample_number;
394 /**< The frame number or sample number of first sample in frame;
395 * use the \a number_type value to determine which to use. */
398 /**< CRC-8 (polynomial = x^8 + x^2 + x^1 + x^0, initialized with 0)
399 * of the raw frame header bytes, meaning everything before the CRC byte
400 * including the sync code.
404 extern FLAC_API const unsigned FLAC__FRAME_HEADER_SYNC; /**< == 0x3ffe; the frame header sync code */
405 extern FLAC_API const unsigned FLAC__FRAME_HEADER_SYNC_LEN; /**< == 14 (bits) */
406 extern FLAC_API const unsigned FLAC__FRAME_HEADER_RESERVED_LEN; /**< == 2 (bits) */
407 extern FLAC_API const unsigned FLAC__FRAME_HEADER_BLOCK_SIZE_LEN; /**< == 4 (bits) */
408 extern FLAC_API const unsigned FLAC__FRAME_HEADER_SAMPLE_RATE_LEN; /**< == 4 (bits) */
409 extern FLAC_API const unsigned FLAC__FRAME_HEADER_CHANNEL_ASSIGNMENT_LEN; /**< == 4 (bits) */
410 extern FLAC_API const unsigned FLAC__FRAME_HEADER_BITS_PER_SAMPLE_LEN; /**< == 3 (bits) */
411 extern FLAC_API const unsigned FLAC__FRAME_HEADER_ZERO_PAD_LEN; /**< == 1 (bit) */
412 extern FLAC_API const unsigned FLAC__FRAME_HEADER_CRC_LEN; /**< == 8 (bits) */
415 /** FLAC frame footer structure. (c.f. <A HREF="../format.html#frame_footer">format specification</A>)
419 /**< CRC-16 (polynomial = x^16 + x^15 + x^2 + x^0, initialized with
420 * 0) of the bytes before the crc, back to and including the frame header
425 extern FLAC_API const unsigned FLAC__FRAME_FOOTER_CRC_LEN; /**< == 16 (bits) */
428 /** FLAC frame structure. (c.f. <A HREF="../format.html#frame">format specification</A>)
431 FLAC__FrameHeader header;
432 FLAC__Subframe subframes[FLAC__MAX_CHANNELS];
433 FLAC__FrameFooter footer;
436 /*****************************************************************************/
439 /*****************************************************************************
441 * Meta-data structures
443 *****************************************************************************/
445 /** An enumeration of the available metadata block types. */
448 FLAC__METADATA_TYPE_STREAMINFO = 0,
449 /**< <A HREF="../format.html#metadata_block_streaminfo">STREAMINFO</A> block */
451 FLAC__METADATA_TYPE_PADDING = 1,
452 /**< <A HREF="../format.html#metadata_block_padding"PADDING</A> block */
454 FLAC__METADATA_TYPE_APPLICATION = 2,
455 /**< <A HREF="../format.html#metadata_block_application"APPLICATION</A> block */
457 FLAC__METADATA_TYPE_SEEKTABLE = 3,
458 /**< <A HREF="../format.html#metadata_block_seektable"SEEKTABLE</A> block */
460 FLAC__METADATA_TYPE_VORBIS_COMMENT = 4,
461 /**< <A HREF="../format.html#metadata_block_vorbis_comment"VORBISCOMMENT</A> block */
463 } FLAC__MetadataType;
465 /** Maps a FLAC__MetadataType to a C string.
467 * Using a FLAC__MetadataType as the index to this array will
468 * give the string equivalent. The contents should not be modified.
470 extern FLAC_API const char * const FLAC__MetadataTypeString[];
473 /** FLAC STREAMINFO structure. (c.f. <A HREF="../format.html#metadata_block_streaminfo">format specification</A>)
476 unsigned min_blocksize, max_blocksize;
477 unsigned min_framesize, max_framesize;
478 unsigned sample_rate;
480 unsigned bits_per_sample;
481 FLAC__uint64 total_samples;
482 FLAC__byte md5sum[16];
483 } FLAC__StreamMetadata_StreamInfo;
485 extern FLAC_API const unsigned FLAC__STREAM_METADATA_STREAMINFO_MIN_BLOCK_SIZE_LEN; /**< == 16 (bits) */
486 extern FLAC_API const unsigned FLAC__STREAM_METADATA_STREAMINFO_MAX_BLOCK_SIZE_LEN; /**< == 16 (bits) */
487 extern FLAC_API const unsigned FLAC__STREAM_METADATA_STREAMINFO_MIN_FRAME_SIZE_LEN; /**< == 24 (bits) */
488 extern FLAC_API const unsigned FLAC__STREAM_METADATA_STREAMINFO_MAX_FRAME_SIZE_LEN; /**< == 24 (bits) */
489 extern FLAC_API const unsigned FLAC__STREAM_METADATA_STREAMINFO_SAMPLE_RATE_LEN; /**< == 20 (bits) */
490 extern FLAC_API const unsigned FLAC__STREAM_METADATA_STREAMINFO_CHANNELS_LEN; /**< == 3 (bits) */
491 extern FLAC_API const unsigned FLAC__STREAM_METADATA_STREAMINFO_BITS_PER_SAMPLE_LEN; /**< == 5 (bits) */
492 extern FLAC_API const unsigned FLAC__STREAM_METADATA_STREAMINFO_TOTAL_SAMPLES_LEN; /**< == 36 (bits) */
493 extern FLAC_API const unsigned FLAC__STREAM_METADATA_STREAMINFO_MD5SUM_LEN; /**< == 128 (bits) */
495 /** The total stream length of the STREAMINFO block in bytes. */
496 #define FLAC__STREAM_METADATA_STREAMINFO_LENGTH (34u)
498 /** FLAC PADDING structure. (c.f. <A HREF="../format.html#metadata_block_padding">format specification</A>)
502 /**< Conceptually this is an empty struct since we don't store the
503 * padding bytes. Empty structs are not allowed by some C compilers,
506 } FLAC__StreamMetadata_Padding;
509 /** FLAC APPLICATION structure. (c.f. <A HREF="../format.html#metadata_block_application">format specification</A>)
514 } FLAC__StreamMetadata_Application;
516 extern FLAC_API const unsigned FLAC__STREAM_METADATA_APPLICATION_ID_LEN; /**< == 32 (bits) */
518 /** SeekPoint structure used in SEEKTABLE blocks. (c.f. <A HREF="../format.html#seekpoint">format specification</A>)
521 FLAC__uint64 sample_number;
522 /**< The sample number of the target frame. */
524 FLAC__uint64 stream_offset;
525 /**< The offset, in bytes, of the target frame with respect to
526 * beginning of the first frame. */
528 unsigned frame_samples;
529 /**< The number of samples in the target frame. */
530 } FLAC__StreamMetadata_SeekPoint;
532 extern FLAC_API const unsigned FLAC__STREAM_METADATA_SEEKPOINT_SAMPLE_NUMBER_LEN; /**< == 64 (bits) */
533 extern FLAC_API const unsigned FLAC__STREAM_METADATA_SEEKPOINT_STREAM_OFFSET_LEN; /**< == 64 (bits) */
534 extern FLAC_API const unsigned FLAC__STREAM_METADATA_SEEKPOINT_FRAME_SAMPLES_LEN; /**< == 16 (bits) */
536 /** The total stream length of a seek point in bytes. */
537 #define FLAC__STREAM_METADATA_SEEKPOINT_LENGTH (18u)
539 /** The value used in the \a sample_number field of
540 * FLAC__StreamMetadataSeekPoint used to indicate a placeholder
541 * point (== 0xffffffffffffffff).
543 extern FLAC_API const FLAC__uint64 FLAC__STREAM_METADATA_SEEKPOINT_PLACEHOLDER;
546 /** FLAC SEEKTABLE structure. (c.f. <A HREF="../format.html#metadata_block_seektable">format specification</A>)
548 * \note From the format specification:
549 * - The seek points must be sorted by ascending sample number.
550 * - Each seek point's sample number must be the first sample of the
552 * - Each seek point's sample number must be unique within the table.
553 * - Existence of a SEEKTABLE block implies a correct setting of
554 * total_samples in the stream_info block.
555 * - Behavior is undefined when more than one SEEKTABLE block is
556 * present in a stream.
560 FLAC__StreamMetadata_SeekPoint *points;
561 } FLAC__StreamMetadata_SeekTable;
564 /** Vorbis comment entry structure used in VORBIS_COMMENT blocks. (c.f. <A HREF="../format.html#metadata_block_vorbis_comment">format specification</A>)
569 } FLAC__StreamMetadata_VorbisComment_Entry;
571 extern FLAC_API const unsigned FLAC__STREAM_METADATA_VORBIS_COMMENT_ENTRY_LENGTH_LEN; /**< == 32 (bits) */
574 /** FLAC VORBIS_COMMENT structure. (c.f. <A HREF="../format.html#metadata_block_vorbis_comment">format specification</A>)
577 FLAC__StreamMetadata_VorbisComment_Entry vendor_string;
578 FLAC__uint32 num_comments;
579 FLAC__StreamMetadata_VorbisComment_Entry *comments;
580 } FLAC__StreamMetadata_VorbisComment;
582 extern FLAC_API const unsigned FLAC__STREAM_METADATA_VORBIS_COMMENT_NUM_COMMENTS_LEN; /**< == 32 (bits) */
585 /** FLAC metadata block structure. (c.f. <A HREF="../format.html#metadata_block">format specification</A>)
588 FLAC__MetadataType type;
589 /**< The type of the metadata block; used determine which member of the
590 * \a data union to dereference. */
593 /**< \c true if this metadata block is the last, else \a false */
596 /**< Length, in bytes, of the block data as it appears in the stream. */
599 FLAC__StreamMetadata_StreamInfo stream_info;
600 FLAC__StreamMetadata_Padding padding;
601 FLAC__StreamMetadata_Application application;
602 FLAC__StreamMetadata_SeekTable seek_table;
603 FLAC__StreamMetadata_VorbisComment vorbis_comment;
605 /**< Polymorphic block data; use the \a type value to determine which
607 } FLAC__StreamMetadata;
609 extern FLAC_API const unsigned FLAC__STREAM_METADATA_IS_LAST_LEN; /**< == 1 (bit) */
610 extern FLAC_API const unsigned FLAC__STREAM_METADATA_TYPE_LEN; /**< == 7 (bits) */
611 extern FLAC_API const unsigned FLAC__STREAM_METADATA_LENGTH_LEN; /**< == 24 (bits) */
613 /** The total stream length of a metadata block header in bytes. */
614 #define FLAC__STREAM_METADATA_HEADER_LENGTH (4u)
616 /*****************************************************************************/
619 /*****************************************************************************
623 *****************************************************************************/
625 /** Tests that a sample rate is valid for FLAC. Since the rules for valid
626 * sample rates are slightly complex, they are encapsulated in this function.
628 * \param sample_rate The sample rate to test for compliance.
630 * \c true if the given sample rate conforms to the specification, else
633 FLAC_API FLAC__bool FLAC__format_sample_rate_is_valid(unsigned sample_rate);
635 /** Check a seek table to see if it conforms to the FLAC specification.
636 * See the format specification for limits on the contents of the
639 * \param seek_table A pointer to a seek table to be checked.
641 * \code seek_table != NULL \endcode
643 * \c false if seek table is illegal, else \c true.
645 FLAC_API FLAC__bool FLAC__format_seektable_is_legal(const FLAC__StreamMetadata_SeekTable *seek_table);
647 /** Sort a seek table's seek points according to the format specification.
648 * This includes a "unique-ification" step to remove duplicates, i.e.
649 * seek points with identical \a sample_number values. Duplicate seek
650 * points are converted into placeholder points and sorted to the end of
653 * \param seek_table A pointer to a seek table to be sorted.
655 * \code seek_table != NULL \endcode
657 * The number of duplicate seek points converted into placeholders.
659 FLAC_API unsigned FLAC__format_seektable_sort(FLAC__StreamMetadata_SeekTable *seek_table);