1*600f14f4SXin Li /* libFLAC - Free Lossless Audio Codec library 2*600f14f4SXin Li * Copyright (C) 2000-2009 Josh Coalson 3*600f14f4SXin Li * Copyright (C) 2011-2023 Xiph.Org Foundation 4*600f14f4SXin Li * 5*600f14f4SXin Li * Redistribution and use in source and binary forms, with or without 6*600f14f4SXin Li * modification, are permitted provided that the following conditions 7*600f14f4SXin Li * are met: 8*600f14f4SXin Li * 9*600f14f4SXin Li * - Redistributions of source code must retain the above copyright 10*600f14f4SXin Li * notice, this list of conditions and the following disclaimer. 11*600f14f4SXin Li * 12*600f14f4SXin Li * - Redistributions in binary form must reproduce the above copyright 13*600f14f4SXin Li * notice, this list of conditions and the following disclaimer in the 14*600f14f4SXin Li * documentation and/or other materials provided with the distribution. 15*600f14f4SXin Li * 16*600f14f4SXin Li * - Neither the name of the Xiph.org Foundation nor the names of its 17*600f14f4SXin Li * contributors may be used to endorse or promote products derived from 18*600f14f4SXin Li * this software without specific prior written permission. 19*600f14f4SXin Li * 20*600f14f4SXin Li * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 21*600f14f4SXin Li * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 22*600f14f4SXin Li * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 23*600f14f4SXin Li * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR 24*600f14f4SXin Li * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 25*600f14f4SXin Li * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 26*600f14f4SXin Li * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 27*600f14f4SXin Li * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 28*600f14f4SXin Li * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 29*600f14f4SXin Li * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 30*600f14f4SXin Li * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 31*600f14f4SXin Li */ 32*600f14f4SXin Li 33*600f14f4SXin Li #ifndef FLAC__FORMAT_H 34*600f14f4SXin Li #define FLAC__FORMAT_H 35*600f14f4SXin Li 36*600f14f4SXin Li #include "export.h" 37*600f14f4SXin Li #include "ordinals.h" 38*600f14f4SXin Li 39*600f14f4SXin Li #ifdef __cplusplus 40*600f14f4SXin Li extern "C" { 41*600f14f4SXin Li #endif 42*600f14f4SXin Li 43*600f14f4SXin Li /** \file include/FLAC/format.h 44*600f14f4SXin Li * 45*600f14f4SXin Li * \brief 46*600f14f4SXin Li * This module contains structure definitions for the representation 47*600f14f4SXin Li * of FLAC format components in memory. These are the basic 48*600f14f4SXin Li * structures used by the rest of the interfaces. 49*600f14f4SXin Li * 50*600f14f4SXin Li * See the detailed documentation in the 51*600f14f4SXin Li * \link flac_format format \endlink module. 52*600f14f4SXin Li */ 53*600f14f4SXin Li 54*600f14f4SXin Li /** \defgroup flac_format FLAC/format.h: format components 55*600f14f4SXin Li * \ingroup flac 56*600f14f4SXin Li * 57*600f14f4SXin Li * \brief 58*600f14f4SXin Li * This module contains structure definitions for the representation 59*600f14f4SXin Li * of FLAC format components in memory. These are the basic 60*600f14f4SXin Li * structures used by the rest of the interfaces. 61*600f14f4SXin Li * 62*600f14f4SXin Li * First, you should be familiar with the 63*600f14f4SXin Li * <A HREF="https://xiph.org/flac/format.html">FLAC format</A>. Many of the values here 64*600f14f4SXin Li * follow directly from the specification. As a user of libFLAC, the 65*600f14f4SXin Li * interesting parts really are the structures that describe the frame 66*600f14f4SXin Li * header and metadata blocks. 67*600f14f4SXin Li * 68*600f14f4SXin Li * The format structures here are very primitive, designed to store 69*600f14f4SXin Li * information in an efficient way. Reading information from the 70*600f14f4SXin Li * structures is easy but creating or modifying them directly is 71*600f14f4SXin Li * more complex. For the most part, as a user of a library, editing 72*600f14f4SXin Li * is not necessary; however, for metadata blocks it is, so there are 73*600f14f4SXin Li * convenience functions provided in the \link flac_metadata metadata 74*600f14f4SXin Li * module \endlink to simplify the manipulation of metadata blocks. 75*600f14f4SXin Li * 76*600f14f4SXin Li * \note 77*600f14f4SXin Li * It's not the best convention, but symbols ending in _LEN are in bits 78*600f14f4SXin Li * and _LENGTH are in bytes. _LENGTH symbols are \#defines instead of 79*600f14f4SXin Li * global variables because they are usually used when declaring byte 80*600f14f4SXin Li * arrays and some compilers require compile-time knowledge of array 81*600f14f4SXin Li * sizes when declared on the stack. 82*600f14f4SXin Li * 83*600f14f4SXin Li * \{ 84*600f14f4SXin Li */ 85*600f14f4SXin Li 86*600f14f4SXin Li 87*600f14f4SXin Li /* 88*600f14f4SXin Li Most of the values described in this file are defined by the FLAC 89*600f14f4SXin Li format specification. There is nothing to tune here. 90*600f14f4SXin Li */ 91*600f14f4SXin Li 92*600f14f4SXin Li /** The largest legal metadata type code. */ 93*600f14f4SXin Li #define FLAC__MAX_METADATA_TYPE_CODE (126u) 94*600f14f4SXin Li 95*600f14f4SXin Li /** The minimum block size, in samples, permitted by the format. */ 96*600f14f4SXin Li #define FLAC__MIN_BLOCK_SIZE (16u) 97*600f14f4SXin Li 98*600f14f4SXin Li /** The maximum block size, in samples, permitted by the format. */ 99*600f14f4SXin Li #define FLAC__MAX_BLOCK_SIZE (65535u) 100*600f14f4SXin Li 101*600f14f4SXin Li /** The maximum block size, in samples, permitted by the FLAC subset for 102*600f14f4SXin Li * sample rates up to 48kHz. */ 103*600f14f4SXin Li #define FLAC__SUBSET_MAX_BLOCK_SIZE_48000HZ (4608u) 104*600f14f4SXin Li 105*600f14f4SXin Li /** The maximum number of channels permitted by the format. */ 106*600f14f4SXin Li #define FLAC__MAX_CHANNELS (8u) 107*600f14f4SXin Li 108*600f14f4SXin Li /** The minimum sample resolution permitted by the format. */ 109*600f14f4SXin Li #define FLAC__MIN_BITS_PER_SAMPLE (4u) 110*600f14f4SXin Li 111*600f14f4SXin Li /** The maximum sample resolution permitted by the format. */ 112*600f14f4SXin Li #define FLAC__MAX_BITS_PER_SAMPLE (32u) 113*600f14f4SXin Li 114*600f14f4SXin Li /** The maximum sample resolution permitted by libFLAC. 115*600f14f4SXin Li * 116*600f14f4SXin Li * FLAC__MAX_BITS_PER_SAMPLE is the limit of the FLAC format. However, 117*600f14f4SXin Li * the reference encoder/decoder used to be limited to 24 bits. This 118*600f14f4SXin Li * value was used to signal that limit. 119*600f14f4SXin Li */ 120*600f14f4SXin Li #define FLAC__REFERENCE_CODEC_MAX_BITS_PER_SAMPLE (32u) 121*600f14f4SXin Li 122*600f14f4SXin Li /** The maximum sample rate permitted by the format. The value is 123*600f14f4SXin Li * ((2 ^ 20) - 1) 124*600f14f4SXin Li */ 125*600f14f4SXin Li #define FLAC__MAX_SAMPLE_RATE (1048575u) 126*600f14f4SXin Li 127*600f14f4SXin Li /** The maximum LPC order permitted by the format. */ 128*600f14f4SXin Li #define FLAC__MAX_LPC_ORDER (32u) 129*600f14f4SXin Li 130*600f14f4SXin Li /** The maximum LPC order permitted by the FLAC subset for sample rates 131*600f14f4SXin Li * up to 48kHz. */ 132*600f14f4SXin Li #define FLAC__SUBSET_MAX_LPC_ORDER_48000HZ (12u) 133*600f14f4SXin Li 134*600f14f4SXin Li /** The minimum quantized linear predictor coefficient precision 135*600f14f4SXin Li * permitted by the format. 136*600f14f4SXin Li */ 137*600f14f4SXin Li #define FLAC__MIN_QLP_COEFF_PRECISION (5u) 138*600f14f4SXin Li 139*600f14f4SXin Li /** The maximum quantized linear predictor coefficient precision 140*600f14f4SXin Li * permitted by the format. 141*600f14f4SXin Li */ 142*600f14f4SXin Li #define FLAC__MAX_QLP_COEFF_PRECISION (15u) 143*600f14f4SXin Li 144*600f14f4SXin Li /** The maximum order of the fixed predictors permitted by the format. */ 145*600f14f4SXin Li #define FLAC__MAX_FIXED_ORDER (4u) 146*600f14f4SXin Li 147*600f14f4SXin Li /** The maximum Rice partition order permitted by the format. */ 148*600f14f4SXin Li #define FLAC__MAX_RICE_PARTITION_ORDER (15u) 149*600f14f4SXin Li 150*600f14f4SXin Li /** The maximum Rice partition order permitted by the FLAC Subset. */ 151*600f14f4SXin Li #define FLAC__SUBSET_MAX_RICE_PARTITION_ORDER (8u) 152*600f14f4SXin Li 153*600f14f4SXin Li /** The version string of the release, stamped onto the libraries and binaries. 154*600f14f4SXin Li * 155*600f14f4SXin Li * \note 156*600f14f4SXin Li * This does not correspond to the shared library version number, which 157*600f14f4SXin Li * is used to determine binary compatibility. 158*600f14f4SXin Li */ 159*600f14f4SXin Li extern FLAC_API const char *FLAC__VERSION_STRING; 160*600f14f4SXin Li 161*600f14f4SXin Li /** The vendor string inserted by the encoder into the VORBIS_COMMENT block. 162*600f14f4SXin Li * This is a NUL-terminated ASCII string; when inserted into the 163*600f14f4SXin Li * VORBIS_COMMENT the trailing null is stripped. 164*600f14f4SXin Li */ 165*600f14f4SXin Li extern FLAC_API const char *FLAC__VENDOR_STRING; 166*600f14f4SXin Li 167*600f14f4SXin Li /** The byte string representation of the beginning of a FLAC stream. */ 168*600f14f4SXin Li extern FLAC_API const FLAC__byte FLAC__STREAM_SYNC_STRING[4]; /* = "fLaC" */ 169*600f14f4SXin Li 170*600f14f4SXin Li /** The 32-bit integer big-endian representation of the beginning of 171*600f14f4SXin Li * a FLAC stream. 172*600f14f4SXin Li */ 173*600f14f4SXin Li extern FLAC_API const uint32_t FLAC__STREAM_SYNC; /* = 0x664C6143 */ 174*600f14f4SXin Li 175*600f14f4SXin Li /** The length of the FLAC signature in bits. */ 176*600f14f4SXin Li extern FLAC_API const uint32_t FLAC__STREAM_SYNC_LEN; /* = 32 bits */ 177*600f14f4SXin Li 178*600f14f4SXin Li /** The length of the FLAC signature in bytes. */ 179*600f14f4SXin Li #define FLAC__STREAM_SYNC_LENGTH (4u) 180*600f14f4SXin Li 181*600f14f4SXin Li 182*600f14f4SXin Li /***************************************************************************** 183*600f14f4SXin Li * 184*600f14f4SXin Li * Subframe structures 185*600f14f4SXin Li * 186*600f14f4SXin Li *****************************************************************************/ 187*600f14f4SXin Li 188*600f14f4SXin Li /*****************************************************************************/ 189*600f14f4SXin Li 190*600f14f4SXin Li /** An enumeration of the available entropy coding methods. */ 191*600f14f4SXin Li typedef enum { 192*600f14f4SXin Li FLAC__ENTROPY_CODING_METHOD_PARTITIONED_RICE = 0, 193*600f14f4SXin Li /**< Residual is coded by partitioning into contexts, each with it's own 194*600f14f4SXin Li * 4-bit Rice parameter. */ 195*600f14f4SXin Li 196*600f14f4SXin Li FLAC__ENTROPY_CODING_METHOD_PARTITIONED_RICE2 = 1 197*600f14f4SXin Li /**< Residual is coded by partitioning into contexts, each with it's own 198*600f14f4SXin Li * 5-bit Rice parameter. */ 199*600f14f4SXin Li } FLAC__EntropyCodingMethodType; 200*600f14f4SXin Li 201*600f14f4SXin Li /** Maps a FLAC__EntropyCodingMethodType to a C string. 202*600f14f4SXin Li * 203*600f14f4SXin Li * Using a FLAC__EntropyCodingMethodType as the index to this array will 204*600f14f4SXin Li * give the string equivalent. The contents should not be modified. 205*600f14f4SXin Li */ 206*600f14f4SXin Li extern FLAC_API const char * const FLAC__EntropyCodingMethodTypeString[]; 207*600f14f4SXin Li 208*600f14f4SXin Li 209*600f14f4SXin Li /** Contents of a Rice partitioned residual 210*600f14f4SXin Li */ 211*600f14f4SXin Li typedef struct { 212*600f14f4SXin Li 213*600f14f4SXin Li uint32_t *parameters; 214*600f14f4SXin Li /**< The Rice parameters for each context. */ 215*600f14f4SXin Li 216*600f14f4SXin Li uint32_t *raw_bits; 217*600f14f4SXin Li /**< Widths for escape-coded partitions. Will be non-zero for escaped 218*600f14f4SXin Li * partitions and zero for unescaped partitions. 219*600f14f4SXin Li */ 220*600f14f4SXin Li 221*600f14f4SXin Li uint32_t capacity_by_order; 222*600f14f4SXin Li /**< The capacity of the \a parameters and \a raw_bits arrays 223*600f14f4SXin Li * specified as an order, i.e. the number of array elements 224*600f14f4SXin Li * allocated is 2 ^ \a capacity_by_order. 225*600f14f4SXin Li */ 226*600f14f4SXin Li } FLAC__EntropyCodingMethod_PartitionedRiceContents; 227*600f14f4SXin Li 228*600f14f4SXin Li /** Header for a Rice partitioned residual. (c.f. <A HREF="https://xiph.org/flac/format.html#partitioned_rice">format specification</A>) 229*600f14f4SXin Li */ 230*600f14f4SXin Li typedef struct { 231*600f14f4SXin Li 232*600f14f4SXin Li uint32_t order; 233*600f14f4SXin Li /**< The partition order, i.e. # of contexts = 2 ^ \a order. */ 234*600f14f4SXin Li 235*600f14f4SXin Li const FLAC__EntropyCodingMethod_PartitionedRiceContents *contents; 236*600f14f4SXin Li /**< The context's Rice parameters and/or raw bits. */ 237*600f14f4SXin Li 238*600f14f4SXin Li } FLAC__EntropyCodingMethod_PartitionedRice; 239*600f14f4SXin Li 240*600f14f4SXin Li extern FLAC_API const uint32_t FLAC__ENTROPY_CODING_METHOD_PARTITIONED_RICE_ORDER_LEN; /**< == 4 (bits) */ 241*600f14f4SXin Li extern FLAC_API const uint32_t FLAC__ENTROPY_CODING_METHOD_PARTITIONED_RICE_PARAMETER_LEN; /**< == 4 (bits) */ 242*600f14f4SXin Li extern FLAC_API const uint32_t FLAC__ENTROPY_CODING_METHOD_PARTITIONED_RICE2_PARAMETER_LEN; /**< == 5 (bits) */ 243*600f14f4SXin Li extern FLAC_API const uint32_t FLAC__ENTROPY_CODING_METHOD_PARTITIONED_RICE_RAW_LEN; /**< == 5 (bits) */ 244*600f14f4SXin Li 245*600f14f4SXin Li extern FLAC_API const uint32_t FLAC__ENTROPY_CODING_METHOD_PARTITIONED_RICE_ESCAPE_PARAMETER; 246*600f14f4SXin Li /**< == (1<<FLAC__ENTROPY_CODING_METHOD_PARTITIONED_RICE_PARAMETER_LEN)-1 */ 247*600f14f4SXin Li extern FLAC_API const uint32_t FLAC__ENTROPY_CODING_METHOD_PARTITIONED_RICE2_ESCAPE_PARAMETER; 248*600f14f4SXin Li /**< == (1<<FLAC__ENTROPY_CODING_METHOD_PARTITIONED_RICE2_PARAMETER_LEN)-1 */ 249*600f14f4SXin Li 250*600f14f4SXin Li /** Header for the entropy coding method. (c.f. <A HREF="https://xiph.org/flac/format.html#residual">format specification</A>) 251*600f14f4SXin Li */ 252*600f14f4SXin Li typedef struct { 253*600f14f4SXin Li FLAC__EntropyCodingMethodType type; 254*600f14f4SXin Li union { 255*600f14f4SXin Li FLAC__EntropyCodingMethod_PartitionedRice partitioned_rice; 256*600f14f4SXin Li } data; 257*600f14f4SXin Li } FLAC__EntropyCodingMethod; 258*600f14f4SXin Li 259*600f14f4SXin Li extern FLAC_API const uint32_t FLAC__ENTROPY_CODING_METHOD_TYPE_LEN; /**< == 2 (bits) */ 260*600f14f4SXin Li 261*600f14f4SXin Li /*****************************************************************************/ 262*600f14f4SXin Li 263*600f14f4SXin Li /** An enumeration of the available subframe types. */ 264*600f14f4SXin Li typedef enum { 265*600f14f4SXin Li FLAC__SUBFRAME_TYPE_CONSTANT = 0, /**< constant signal */ 266*600f14f4SXin Li FLAC__SUBFRAME_TYPE_VERBATIM = 1, /**< uncompressed signal */ 267*600f14f4SXin Li FLAC__SUBFRAME_TYPE_FIXED = 2, /**< fixed polynomial prediction */ 268*600f14f4SXin Li FLAC__SUBFRAME_TYPE_LPC = 3 /**< linear prediction */ 269*600f14f4SXin Li } FLAC__SubframeType; 270*600f14f4SXin Li 271*600f14f4SXin Li /** Maps a FLAC__SubframeType to a C string. 272*600f14f4SXin Li * 273*600f14f4SXin Li * Using a FLAC__SubframeType as the index to this array will 274*600f14f4SXin Li * give the string equivalent. The contents should not be modified. 275*600f14f4SXin Li */ 276*600f14f4SXin Li extern FLAC_API const char * const FLAC__SubframeTypeString[]; 277*600f14f4SXin Li 278*600f14f4SXin Li 279*600f14f4SXin Li /** CONSTANT subframe. (c.f. <A HREF="https://xiph.org/flac/format.html#subframe_constant">format specification</A>) 280*600f14f4SXin Li */ 281*600f14f4SXin Li typedef struct { 282*600f14f4SXin Li FLAC__int64 value; /**< The constant signal value. */ 283*600f14f4SXin Li } FLAC__Subframe_Constant; 284*600f14f4SXin Li 285*600f14f4SXin Li /** An enumeration of the possible verbatim subframe data types. */ 286*600f14f4SXin Li typedef enum { 287*600f14f4SXin Li FLAC__VERBATIM_SUBFRAME_DATA_TYPE_INT32, /**< verbatim subframe has 32-bit int */ 288*600f14f4SXin Li FLAC__VERBATIM_SUBFRAME_DATA_TYPE_INT64 /**< verbatim subframe has 64-bit int */ 289*600f14f4SXin Li } FLAC__VerbatimSubframeDataType; 290*600f14f4SXin Li 291*600f14f4SXin Li 292*600f14f4SXin Li /** VERBATIM subframe. (c.f. <A HREF="https://xiph.org/flac/format.html#subframe_verbatim">format specification</A>) 293*600f14f4SXin Li */ 294*600f14f4SXin Li typedef struct { 295*600f14f4SXin Li union { 296*600f14f4SXin Li const FLAC__int32 *int32; /**< A FLAC__int32 pointer to verbatim signal. */ 297*600f14f4SXin Li const FLAC__int64 *int64; /**< A FLAC__int64 pointer to verbatim signal. */ 298*600f14f4SXin Li } data; 299*600f14f4SXin Li FLAC__VerbatimSubframeDataType data_type; 300*600f14f4SXin Li } FLAC__Subframe_Verbatim; 301*600f14f4SXin Li 302*600f14f4SXin Li 303*600f14f4SXin Li /** FIXED subframe. (c.f. <A HREF="https://xiph.org/flac/format.html#subframe_fixed">format specification</A>) 304*600f14f4SXin Li */ 305*600f14f4SXin Li typedef struct { 306*600f14f4SXin Li FLAC__EntropyCodingMethod entropy_coding_method; 307*600f14f4SXin Li /**< The residual coding method. */ 308*600f14f4SXin Li 309*600f14f4SXin Li uint32_t order; 310*600f14f4SXin Li /**< The polynomial order. */ 311*600f14f4SXin Li 312*600f14f4SXin Li FLAC__int64 warmup[FLAC__MAX_FIXED_ORDER]; 313*600f14f4SXin Li /**< Warmup samples to prime the predictor, length == order. */ 314*600f14f4SXin Li 315*600f14f4SXin Li const FLAC__int32 *residual; 316*600f14f4SXin Li /**< The residual signal, length == (blocksize minus order) samples. */ 317*600f14f4SXin Li } FLAC__Subframe_Fixed; 318*600f14f4SXin Li 319*600f14f4SXin Li 320*600f14f4SXin Li /** LPC subframe. (c.f. <A HREF="https://xiph.org/flac/format.html#subframe_lpc">format specification</A>) 321*600f14f4SXin Li */ 322*600f14f4SXin Li typedef struct { 323*600f14f4SXin Li FLAC__EntropyCodingMethod entropy_coding_method; 324*600f14f4SXin Li /**< The residual coding method. */ 325*600f14f4SXin Li 326*600f14f4SXin Li uint32_t order; 327*600f14f4SXin Li /**< The FIR order. */ 328*600f14f4SXin Li 329*600f14f4SXin Li uint32_t qlp_coeff_precision; 330*600f14f4SXin Li /**< Quantized FIR filter coefficient precision in bits. */ 331*600f14f4SXin Li 332*600f14f4SXin Li int quantization_level; 333*600f14f4SXin Li /**< The qlp coeff shift needed. */ 334*600f14f4SXin Li 335*600f14f4SXin Li FLAC__int32 qlp_coeff[FLAC__MAX_LPC_ORDER]; 336*600f14f4SXin Li /**< FIR filter coefficients. */ 337*600f14f4SXin Li 338*600f14f4SXin Li FLAC__int64 warmup[FLAC__MAX_LPC_ORDER]; 339*600f14f4SXin Li /**< Warmup samples to prime the predictor, length == order. */ 340*600f14f4SXin Li 341*600f14f4SXin Li const FLAC__int32 *residual; 342*600f14f4SXin Li /**< The residual signal, length == (blocksize minus order) samples. */ 343*600f14f4SXin Li } FLAC__Subframe_LPC; 344*600f14f4SXin Li 345*600f14f4SXin Li extern FLAC_API const uint32_t FLAC__SUBFRAME_LPC_QLP_COEFF_PRECISION_LEN; /**< == 4 (bits) */ 346*600f14f4SXin Li extern FLAC_API const uint32_t FLAC__SUBFRAME_LPC_QLP_SHIFT_LEN; /**< == 5 (bits) */ 347*600f14f4SXin Li 348*600f14f4SXin Li 349*600f14f4SXin Li /** FLAC subframe structure. (c.f. <A HREF="https://xiph.org/flac/format.html#subframe">format specification</A>) 350*600f14f4SXin Li */ 351*600f14f4SXin Li typedef struct { 352*600f14f4SXin Li FLAC__SubframeType type; 353*600f14f4SXin Li union { 354*600f14f4SXin Li FLAC__Subframe_Constant constant; 355*600f14f4SXin Li FLAC__Subframe_Fixed fixed; 356*600f14f4SXin Li FLAC__Subframe_LPC lpc; 357*600f14f4SXin Li FLAC__Subframe_Verbatim verbatim; 358*600f14f4SXin Li } data; 359*600f14f4SXin Li uint32_t wasted_bits; 360*600f14f4SXin Li } FLAC__Subframe; 361*600f14f4SXin Li 362*600f14f4SXin Li /** == 1 (bit) 363*600f14f4SXin Li * 364*600f14f4SXin Li * This used to be a zero-padding bit (hence the name 365*600f14f4SXin Li * FLAC__SUBFRAME_ZERO_PAD_LEN) but is now a reserved bit. It still has a 366*600f14f4SXin Li * mandatory value of \c 0 but in the future may take on the value \c 0 or \c 1 367*600f14f4SXin Li * to mean something else. 368*600f14f4SXin Li */ 369*600f14f4SXin Li extern FLAC_API const uint32_t FLAC__SUBFRAME_ZERO_PAD_LEN; 370*600f14f4SXin Li extern FLAC_API const uint32_t FLAC__SUBFRAME_TYPE_LEN; /**< == 6 (bits) */ 371*600f14f4SXin Li extern FLAC_API const uint32_t FLAC__SUBFRAME_WASTED_BITS_FLAG_LEN; /**< == 1 (bit) */ 372*600f14f4SXin Li 373*600f14f4SXin Li extern FLAC_API const uint32_t FLAC__SUBFRAME_TYPE_CONSTANT_BYTE_ALIGNED_MASK; /**< = 0x00 */ 374*600f14f4SXin Li extern FLAC_API const uint32_t FLAC__SUBFRAME_TYPE_VERBATIM_BYTE_ALIGNED_MASK; /**< = 0x02 */ 375*600f14f4SXin Li extern FLAC_API const uint32_t FLAC__SUBFRAME_TYPE_FIXED_BYTE_ALIGNED_MASK; /**< = 0x10 */ 376*600f14f4SXin Li extern FLAC_API const uint32_t FLAC__SUBFRAME_TYPE_LPC_BYTE_ALIGNED_MASK; /**< = 0x40 */ 377*600f14f4SXin Li 378*600f14f4SXin Li /*****************************************************************************/ 379*600f14f4SXin Li 380*600f14f4SXin Li 381*600f14f4SXin Li /***************************************************************************** 382*600f14f4SXin Li * 383*600f14f4SXin Li * Frame structures 384*600f14f4SXin Li * 385*600f14f4SXin Li *****************************************************************************/ 386*600f14f4SXin Li 387*600f14f4SXin Li /** An enumeration of the available channel assignments. */ 388*600f14f4SXin Li typedef enum { 389*600f14f4SXin Li FLAC__CHANNEL_ASSIGNMENT_INDEPENDENT = 0, /**< independent channels */ 390*600f14f4SXin Li FLAC__CHANNEL_ASSIGNMENT_LEFT_SIDE = 1, /**< left+side stereo */ 391*600f14f4SXin Li FLAC__CHANNEL_ASSIGNMENT_RIGHT_SIDE = 2, /**< right+side stereo */ 392*600f14f4SXin Li FLAC__CHANNEL_ASSIGNMENT_MID_SIDE = 3 /**< mid+side stereo */ 393*600f14f4SXin Li } FLAC__ChannelAssignment; 394*600f14f4SXin Li 395*600f14f4SXin Li /** Maps a FLAC__ChannelAssignment to a C string. 396*600f14f4SXin Li * 397*600f14f4SXin Li * Using a FLAC__ChannelAssignment as the index to this array will 398*600f14f4SXin Li * give the string equivalent. The contents should not be modified. 399*600f14f4SXin Li */ 400*600f14f4SXin Li extern FLAC_API const char * const FLAC__ChannelAssignmentString[]; 401*600f14f4SXin Li 402*600f14f4SXin Li /** An enumeration of the possible frame numbering methods. */ 403*600f14f4SXin Li typedef enum { 404*600f14f4SXin Li FLAC__FRAME_NUMBER_TYPE_FRAME_NUMBER, /**< number contains the frame number */ 405*600f14f4SXin Li FLAC__FRAME_NUMBER_TYPE_SAMPLE_NUMBER /**< number contains the sample number of first sample in frame */ 406*600f14f4SXin Li } FLAC__FrameNumberType; 407*600f14f4SXin Li 408*600f14f4SXin Li /** Maps a FLAC__FrameNumberType to a C string. 409*600f14f4SXin Li * 410*600f14f4SXin Li * Using a FLAC__FrameNumberType as the index to this array will 411*600f14f4SXin Li * give the string equivalent. The contents should not be modified. 412*600f14f4SXin Li */ 413*600f14f4SXin Li extern FLAC_API const char * const FLAC__FrameNumberTypeString[]; 414*600f14f4SXin Li 415*600f14f4SXin Li 416*600f14f4SXin Li /** FLAC frame header structure. (c.f. <A HREF="https://xiph.org/flac/format.html#frame_header">format specification</A>) 417*600f14f4SXin Li */ 418*600f14f4SXin Li typedef struct { 419*600f14f4SXin Li uint32_t blocksize; 420*600f14f4SXin Li /**< The number of samples per subframe. */ 421*600f14f4SXin Li 422*600f14f4SXin Li uint32_t sample_rate; 423*600f14f4SXin Li /**< The sample rate in Hz. */ 424*600f14f4SXin Li 425*600f14f4SXin Li uint32_t channels; 426*600f14f4SXin Li /**< The number of channels (== number of subframes). */ 427*600f14f4SXin Li 428*600f14f4SXin Li FLAC__ChannelAssignment channel_assignment; 429*600f14f4SXin Li /**< The channel assignment for the frame. */ 430*600f14f4SXin Li 431*600f14f4SXin Li uint32_t bits_per_sample; 432*600f14f4SXin Li /**< The sample resolution. */ 433*600f14f4SXin Li 434*600f14f4SXin Li FLAC__FrameNumberType number_type; 435*600f14f4SXin Li /**< The numbering scheme used for the frame. As a convenience, the 436*600f14f4SXin Li * decoder will always convert a frame number to a sample number because 437*600f14f4SXin Li * the rules are complex. */ 438*600f14f4SXin Li 439*600f14f4SXin Li union { 440*600f14f4SXin Li FLAC__uint32 frame_number; 441*600f14f4SXin Li FLAC__uint64 sample_number; 442*600f14f4SXin Li } number; 443*600f14f4SXin Li /**< The frame number or sample number of first sample in frame; 444*600f14f4SXin Li * use the \a number_type value to determine which to use. */ 445*600f14f4SXin Li 446*600f14f4SXin Li FLAC__uint8 crc; 447*600f14f4SXin Li /**< CRC-8 (polynomial = x^8 + x^2 + x^1 + x^0, initialized with 0) 448*600f14f4SXin Li * of the raw frame header bytes, meaning everything before the CRC byte 449*600f14f4SXin Li * including the sync code. 450*600f14f4SXin Li */ 451*600f14f4SXin Li } FLAC__FrameHeader; 452*600f14f4SXin Li 453*600f14f4SXin Li extern FLAC_API const uint32_t FLAC__FRAME_HEADER_SYNC; /**< == 0x3ffe; the frame header sync code */ 454*600f14f4SXin Li extern FLAC_API const uint32_t FLAC__FRAME_HEADER_SYNC_LEN; /**< == 14 (bits) */ 455*600f14f4SXin Li extern FLAC_API const uint32_t FLAC__FRAME_HEADER_RESERVED_LEN; /**< == 1 (bits) */ 456*600f14f4SXin Li extern FLAC_API const uint32_t FLAC__FRAME_HEADER_BLOCKING_STRATEGY_LEN; /**< == 1 (bits) */ 457*600f14f4SXin Li extern FLAC_API const uint32_t FLAC__FRAME_HEADER_BLOCK_SIZE_LEN; /**< == 4 (bits) */ 458*600f14f4SXin Li extern FLAC_API const uint32_t FLAC__FRAME_HEADER_SAMPLE_RATE_LEN; /**< == 4 (bits) */ 459*600f14f4SXin Li extern FLAC_API const uint32_t FLAC__FRAME_HEADER_CHANNEL_ASSIGNMENT_LEN; /**< == 4 (bits) */ 460*600f14f4SXin Li extern FLAC_API const uint32_t FLAC__FRAME_HEADER_BITS_PER_SAMPLE_LEN; /**< == 3 (bits) */ 461*600f14f4SXin Li extern FLAC_API const uint32_t FLAC__FRAME_HEADER_ZERO_PAD_LEN; /**< == 1 (bit) */ 462*600f14f4SXin Li extern FLAC_API const uint32_t FLAC__FRAME_HEADER_CRC_LEN; /**< == 8 (bits) */ 463*600f14f4SXin Li 464*600f14f4SXin Li 465*600f14f4SXin Li /** FLAC frame footer structure. (c.f. <A HREF="https://xiph.org/flac/format.html#frame_footer">format specification</A>) 466*600f14f4SXin Li */ 467*600f14f4SXin Li typedef struct { 468*600f14f4SXin Li FLAC__uint16 crc; 469*600f14f4SXin Li /**< CRC-16 (polynomial = x^16 + x^15 + x^2 + x^0, initialized with 470*600f14f4SXin Li * 0) of the bytes before the crc, back to and including the frame header 471*600f14f4SXin Li * sync code. 472*600f14f4SXin Li */ 473*600f14f4SXin Li } FLAC__FrameFooter; 474*600f14f4SXin Li 475*600f14f4SXin Li extern FLAC_API const uint32_t FLAC__FRAME_FOOTER_CRC_LEN; /**< == 16 (bits) */ 476*600f14f4SXin Li 477*600f14f4SXin Li 478*600f14f4SXin Li /** FLAC frame structure. (c.f. <A HREF="https://xiph.org/flac/format.html#frame">format specification</A>) 479*600f14f4SXin Li */ 480*600f14f4SXin Li typedef struct { 481*600f14f4SXin Li FLAC__FrameHeader header; 482*600f14f4SXin Li FLAC__Subframe subframes[FLAC__MAX_CHANNELS]; 483*600f14f4SXin Li FLAC__FrameFooter footer; 484*600f14f4SXin Li } FLAC__Frame; 485*600f14f4SXin Li 486*600f14f4SXin Li /*****************************************************************************/ 487*600f14f4SXin Li 488*600f14f4SXin Li 489*600f14f4SXin Li /***************************************************************************** 490*600f14f4SXin Li * 491*600f14f4SXin Li * Meta-data structures 492*600f14f4SXin Li * 493*600f14f4SXin Li *****************************************************************************/ 494*600f14f4SXin Li 495*600f14f4SXin Li /** An enumeration of the available metadata block types. */ 496*600f14f4SXin Li typedef enum { 497*600f14f4SXin Li 498*600f14f4SXin Li FLAC__METADATA_TYPE_STREAMINFO = 0, 499*600f14f4SXin Li /**< <A HREF="https://xiph.org/flac/format.html#metadata_block_streaminfo">STREAMINFO</A> block */ 500*600f14f4SXin Li 501*600f14f4SXin Li FLAC__METADATA_TYPE_PADDING = 1, 502*600f14f4SXin Li /**< <A HREF="https://xiph.org/flac/format.html#metadata_block_padding">PADDING</A> block */ 503*600f14f4SXin Li 504*600f14f4SXin Li FLAC__METADATA_TYPE_APPLICATION = 2, 505*600f14f4SXin Li /**< <A HREF="https://xiph.org/flac/format.html#metadata_block_application">APPLICATION</A> block */ 506*600f14f4SXin Li 507*600f14f4SXin Li FLAC__METADATA_TYPE_SEEKTABLE = 3, 508*600f14f4SXin Li /**< <A HREF="https://xiph.org/flac/format.html#metadata_block_seektable">SEEKTABLE</A> block */ 509*600f14f4SXin Li 510*600f14f4SXin Li FLAC__METADATA_TYPE_VORBIS_COMMENT = 4, 511*600f14f4SXin Li /**< <A HREF="https://xiph.org/flac/format.html#metadata_block_vorbis_comment">VORBISCOMMENT</A> block (a.k.a. FLAC tags) */ 512*600f14f4SXin Li 513*600f14f4SXin Li FLAC__METADATA_TYPE_CUESHEET = 5, 514*600f14f4SXin Li /**< <A HREF="https://xiph.org/flac/format.html#metadata_block_cuesheet">CUESHEET</A> block */ 515*600f14f4SXin Li 516*600f14f4SXin Li FLAC__METADATA_TYPE_PICTURE = 6, 517*600f14f4SXin Li /**< <A HREF="https://xiph.org/flac/format.html#metadata_block_picture">PICTURE</A> block */ 518*600f14f4SXin Li 519*600f14f4SXin Li FLAC__METADATA_TYPE_UNDEFINED = 7, 520*600f14f4SXin Li /**< marker to denote beginning of undefined type range; this number will increase as new metadata types are added */ 521*600f14f4SXin Li 522*600f14f4SXin Li FLAC__MAX_METADATA_TYPE = FLAC__MAX_METADATA_TYPE_CODE, 523*600f14f4SXin Li /**< No type will ever be greater than this. There is not enough room in the protocol block. */ 524*600f14f4SXin Li } FLAC__MetadataType; 525*600f14f4SXin Li 526*600f14f4SXin Li /** Maps a FLAC__MetadataType to a C string. 527*600f14f4SXin Li * 528*600f14f4SXin Li * Using a FLAC__MetadataType as the index to this array will 529*600f14f4SXin Li * give the string equivalent. The contents should not be modified. 530*600f14f4SXin Li */ 531*600f14f4SXin Li extern FLAC_API const char * const FLAC__MetadataTypeString[]; 532*600f14f4SXin Li 533*600f14f4SXin Li 534*600f14f4SXin Li /** FLAC STREAMINFO structure. (c.f. <A HREF="https://xiph.org/flac/format.html#metadata_block_streaminfo">format specification</A>) 535*600f14f4SXin Li */ 536*600f14f4SXin Li typedef struct { 537*600f14f4SXin Li uint32_t min_blocksize, max_blocksize; 538*600f14f4SXin Li uint32_t min_framesize, max_framesize; 539*600f14f4SXin Li uint32_t sample_rate; 540*600f14f4SXin Li uint32_t channels; 541*600f14f4SXin Li uint32_t bits_per_sample; 542*600f14f4SXin Li FLAC__uint64 total_samples; 543*600f14f4SXin Li FLAC__byte md5sum[16]; 544*600f14f4SXin Li } FLAC__StreamMetadata_StreamInfo; 545*600f14f4SXin Li 546*600f14f4SXin Li extern FLAC_API const uint32_t FLAC__STREAM_METADATA_STREAMINFO_MIN_BLOCK_SIZE_LEN; /**< == 16 (bits) */ 547*600f14f4SXin Li extern FLAC_API const uint32_t FLAC__STREAM_METADATA_STREAMINFO_MAX_BLOCK_SIZE_LEN; /**< == 16 (bits) */ 548*600f14f4SXin Li extern FLAC_API const uint32_t FLAC__STREAM_METADATA_STREAMINFO_MIN_FRAME_SIZE_LEN; /**< == 24 (bits) */ 549*600f14f4SXin Li extern FLAC_API const uint32_t FLAC__STREAM_METADATA_STREAMINFO_MAX_FRAME_SIZE_LEN; /**< == 24 (bits) */ 550*600f14f4SXin Li extern FLAC_API const uint32_t FLAC__STREAM_METADATA_STREAMINFO_SAMPLE_RATE_LEN; /**< == 20 (bits) */ 551*600f14f4SXin Li extern FLAC_API const uint32_t FLAC__STREAM_METADATA_STREAMINFO_CHANNELS_LEN; /**< == 3 (bits) */ 552*600f14f4SXin Li extern FLAC_API const uint32_t FLAC__STREAM_METADATA_STREAMINFO_BITS_PER_SAMPLE_LEN; /**< == 5 (bits) */ 553*600f14f4SXin Li extern FLAC_API const uint32_t FLAC__STREAM_METADATA_STREAMINFO_TOTAL_SAMPLES_LEN; /**< == 36 (bits) */ 554*600f14f4SXin Li extern FLAC_API const uint32_t FLAC__STREAM_METADATA_STREAMINFO_MD5SUM_LEN; /**< == 128 (bits) */ 555*600f14f4SXin Li 556*600f14f4SXin Li /** The total stream length of the STREAMINFO block in bytes. */ 557*600f14f4SXin Li #define FLAC__STREAM_METADATA_STREAMINFO_LENGTH (34u) 558*600f14f4SXin Li 559*600f14f4SXin Li /** FLAC PADDING structure. (c.f. <A HREF="https://xiph.org/flac/format.html#metadata_block_padding">format specification</A>) 560*600f14f4SXin Li */ 561*600f14f4SXin Li typedef struct { 562*600f14f4SXin Li int dummy; 563*600f14f4SXin Li /**< Conceptually this is an empty struct since we don't store the 564*600f14f4SXin Li * padding bytes. Empty structs are not allowed by some C compilers, 565*600f14f4SXin Li * hence the dummy. 566*600f14f4SXin Li */ 567*600f14f4SXin Li } FLAC__StreamMetadata_Padding; 568*600f14f4SXin Li 569*600f14f4SXin Li 570*600f14f4SXin Li /** FLAC APPLICATION structure. (c.f. <A HREF="https://xiph.org/flac/format.html#metadata_block_application">format specification</A>) 571*600f14f4SXin Li */ 572*600f14f4SXin Li typedef struct { 573*600f14f4SXin Li FLAC__byte id[4]; 574*600f14f4SXin Li FLAC__byte *data; 575*600f14f4SXin Li } FLAC__StreamMetadata_Application; 576*600f14f4SXin Li 577*600f14f4SXin Li extern FLAC_API const uint32_t FLAC__STREAM_METADATA_APPLICATION_ID_LEN; /**< == 32 (bits) */ 578*600f14f4SXin Li 579*600f14f4SXin Li /** SeekPoint structure used in SEEKTABLE blocks. (c.f. <A HREF="https://xiph.org/flac/format.html#seekpoint">format specification</A>) 580*600f14f4SXin Li */ 581*600f14f4SXin Li typedef struct { 582*600f14f4SXin Li FLAC__uint64 sample_number; 583*600f14f4SXin Li /**< The sample number of the target frame. */ 584*600f14f4SXin Li 585*600f14f4SXin Li FLAC__uint64 stream_offset; 586*600f14f4SXin Li /**< The offset, in bytes, of the target frame with respect to 587*600f14f4SXin Li * beginning of the first frame. */ 588*600f14f4SXin Li 589*600f14f4SXin Li uint32_t frame_samples; 590*600f14f4SXin Li /**< The number of samples in the target frame. */ 591*600f14f4SXin Li } FLAC__StreamMetadata_SeekPoint; 592*600f14f4SXin Li 593*600f14f4SXin Li extern FLAC_API const uint32_t FLAC__STREAM_METADATA_SEEKPOINT_SAMPLE_NUMBER_LEN; /**< == 64 (bits) */ 594*600f14f4SXin Li extern FLAC_API const uint32_t FLAC__STREAM_METADATA_SEEKPOINT_STREAM_OFFSET_LEN; /**< == 64 (bits) */ 595*600f14f4SXin Li extern FLAC_API const uint32_t FLAC__STREAM_METADATA_SEEKPOINT_FRAME_SAMPLES_LEN; /**< == 16 (bits) */ 596*600f14f4SXin Li 597*600f14f4SXin Li /** The total stream length of a seek point in bytes. */ 598*600f14f4SXin Li #define FLAC__STREAM_METADATA_SEEKPOINT_LENGTH (18u) 599*600f14f4SXin Li 600*600f14f4SXin Li /** The value used in the \a sample_number field of 601*600f14f4SXin Li * FLAC__StreamMetadataSeekPoint used to indicate a placeholder 602*600f14f4SXin Li * point (== 0xffffffffffffffff). 603*600f14f4SXin Li */ 604*600f14f4SXin Li extern FLAC_API const FLAC__uint64 FLAC__STREAM_METADATA_SEEKPOINT_PLACEHOLDER; 605*600f14f4SXin Li 606*600f14f4SXin Li 607*600f14f4SXin Li /** FLAC SEEKTABLE structure. (c.f. <A HREF="https://xiph.org/flac/format.html#metadata_block_seektable">format specification</A>) 608*600f14f4SXin Li * 609*600f14f4SXin Li * \note From the format specification: 610*600f14f4SXin Li * - The seek points must be sorted by ascending sample number. 611*600f14f4SXin Li * - Each seek point's sample number must be the first sample of the 612*600f14f4SXin Li * target frame. 613*600f14f4SXin Li * - Each seek point's sample number must be unique within the table. 614*600f14f4SXin Li * - Existence of a SEEKTABLE block implies a correct setting of 615*600f14f4SXin Li * total_samples in the stream_info block. 616*600f14f4SXin Li * - Behavior is undefined when more than one SEEKTABLE block is 617*600f14f4SXin Li * present in a stream. 618*600f14f4SXin Li */ 619*600f14f4SXin Li typedef struct { 620*600f14f4SXin Li uint32_t num_points; 621*600f14f4SXin Li FLAC__StreamMetadata_SeekPoint *points; 622*600f14f4SXin Li } FLAC__StreamMetadata_SeekTable; 623*600f14f4SXin Li 624*600f14f4SXin Li 625*600f14f4SXin Li /** Vorbis comment entry structure used in VORBIS_COMMENT blocks. (c.f. <A HREF="https://xiph.org/flac/format.html#metadata_block_vorbis_comment">format specification</A>) 626*600f14f4SXin Li * 627*600f14f4SXin Li * For convenience, the APIs maintain a trailing NUL character at the end of 628*600f14f4SXin Li * \a entry which is not counted toward \a length, i.e. 629*600f14f4SXin Li * \code strlen(entry) == length \endcode 630*600f14f4SXin Li */ 631*600f14f4SXin Li typedef struct { 632*600f14f4SXin Li FLAC__uint32 length; 633*600f14f4SXin Li FLAC__byte *entry; 634*600f14f4SXin Li } FLAC__StreamMetadata_VorbisComment_Entry; 635*600f14f4SXin Li 636*600f14f4SXin Li extern FLAC_API const uint32_t FLAC__STREAM_METADATA_VORBIS_COMMENT_ENTRY_LENGTH_LEN; /**< == 32 (bits) */ 637*600f14f4SXin Li 638*600f14f4SXin Li 639*600f14f4SXin Li /** FLAC VORBIS_COMMENT structure. (c.f. <A HREF="https://xiph.org/flac/format.html#metadata_block_vorbis_comment">format specification</A>) 640*600f14f4SXin Li */ 641*600f14f4SXin Li typedef struct { 642*600f14f4SXin Li FLAC__StreamMetadata_VorbisComment_Entry vendor_string; 643*600f14f4SXin Li FLAC__uint32 num_comments; 644*600f14f4SXin Li FLAC__StreamMetadata_VorbisComment_Entry *comments; 645*600f14f4SXin Li } FLAC__StreamMetadata_VorbisComment; 646*600f14f4SXin Li 647*600f14f4SXin Li extern FLAC_API const uint32_t FLAC__STREAM_METADATA_VORBIS_COMMENT_NUM_COMMENTS_LEN; /**< == 32 (bits) */ 648*600f14f4SXin Li 649*600f14f4SXin Li 650*600f14f4SXin Li /** FLAC CUESHEET track index structure. (See the 651*600f14f4SXin Li * <A HREF="https://xiph.org/flac/format.html#cuesheet_track_index">format specification</A> for 652*600f14f4SXin Li * the full description of each field.) 653*600f14f4SXin Li */ 654*600f14f4SXin Li typedef struct { 655*600f14f4SXin Li FLAC__uint64 offset; 656*600f14f4SXin Li /**< Offset in samples, relative to the track offset, of the index 657*600f14f4SXin Li * point. 658*600f14f4SXin Li */ 659*600f14f4SXin Li 660*600f14f4SXin Li FLAC__byte number; 661*600f14f4SXin Li /**< The index point number. */ 662*600f14f4SXin Li } FLAC__StreamMetadata_CueSheet_Index; 663*600f14f4SXin Li 664*600f14f4SXin Li extern FLAC_API const uint32_t FLAC__STREAM_METADATA_CUESHEET_INDEX_OFFSET_LEN; /**< == 64 (bits) */ 665*600f14f4SXin Li extern FLAC_API const uint32_t FLAC__STREAM_METADATA_CUESHEET_INDEX_NUMBER_LEN; /**< == 8 (bits) */ 666*600f14f4SXin Li extern FLAC_API const uint32_t FLAC__STREAM_METADATA_CUESHEET_INDEX_RESERVED_LEN; /**< == 3*8 (bits) */ 667*600f14f4SXin Li 668*600f14f4SXin Li 669*600f14f4SXin Li /** FLAC CUESHEET track structure. (See the 670*600f14f4SXin Li * <A HREF="https://xiph.org/flac/format.html#cuesheet_track">format specification</A> for 671*600f14f4SXin Li * the full description of each field.) 672*600f14f4SXin Li */ 673*600f14f4SXin Li typedef struct { 674*600f14f4SXin Li FLAC__uint64 offset; 675*600f14f4SXin Li /**< Track offset in samples, relative to the beginning of the FLAC audio stream. */ 676*600f14f4SXin Li 677*600f14f4SXin Li FLAC__byte number; 678*600f14f4SXin Li /**< The track number. */ 679*600f14f4SXin Li 680*600f14f4SXin Li char isrc[13]; 681*600f14f4SXin Li /**< Track ISRC. This is a 12-digit alphanumeric code plus a trailing \c NUL byte */ 682*600f14f4SXin Li 683*600f14f4SXin Li uint32_t type:1; 684*600f14f4SXin Li /**< The track type: 0 for audio, 1 for non-audio. */ 685*600f14f4SXin Li 686*600f14f4SXin Li uint32_t pre_emphasis:1; 687*600f14f4SXin Li /**< The pre-emphasis flag: 0 for no pre-emphasis, 1 for pre-emphasis. */ 688*600f14f4SXin Li 689*600f14f4SXin Li FLAC__byte num_indices; 690*600f14f4SXin Li /**< The number of track index points. */ 691*600f14f4SXin Li 692*600f14f4SXin Li FLAC__StreamMetadata_CueSheet_Index *indices; 693*600f14f4SXin Li /**< NULL if num_indices == 0, else pointer to array of index points. */ 694*600f14f4SXin Li 695*600f14f4SXin Li } FLAC__StreamMetadata_CueSheet_Track; 696*600f14f4SXin Li 697*600f14f4SXin Li extern FLAC_API const uint32_t FLAC__STREAM_METADATA_CUESHEET_TRACK_OFFSET_LEN; /**< == 64 (bits) */ 698*600f14f4SXin Li extern FLAC_API const uint32_t FLAC__STREAM_METADATA_CUESHEET_TRACK_NUMBER_LEN; /**< == 8 (bits) */ 699*600f14f4SXin Li extern FLAC_API const uint32_t FLAC__STREAM_METADATA_CUESHEET_TRACK_ISRC_LEN; /**< == 12*8 (bits) */ 700*600f14f4SXin Li extern FLAC_API const uint32_t FLAC__STREAM_METADATA_CUESHEET_TRACK_TYPE_LEN; /**< == 1 (bit) */ 701*600f14f4SXin Li extern FLAC_API const uint32_t FLAC__STREAM_METADATA_CUESHEET_TRACK_PRE_EMPHASIS_LEN; /**< == 1 (bit) */ 702*600f14f4SXin Li extern FLAC_API const uint32_t FLAC__STREAM_METADATA_CUESHEET_TRACK_RESERVED_LEN; /**< == 6+13*8 (bits) */ 703*600f14f4SXin Li extern FLAC_API const uint32_t FLAC__STREAM_METADATA_CUESHEET_TRACK_NUM_INDICES_LEN; /**< == 8 (bits) */ 704*600f14f4SXin Li 705*600f14f4SXin Li 706*600f14f4SXin Li /** FLAC CUESHEET structure. (See the 707*600f14f4SXin Li * <A HREF="https://xiph.org/flac/format.html#metadata_block_cuesheet">format specification</A> 708*600f14f4SXin Li * for the full description of each field.) 709*600f14f4SXin Li */ 710*600f14f4SXin Li typedef struct { 711*600f14f4SXin Li char media_catalog_number[129]; 712*600f14f4SXin Li /**< Media catalog number, in ASCII printable characters 0x20-0x7e. In 713*600f14f4SXin Li * general, the media catalog number may be 0 to 128 bytes long; any 714*600f14f4SXin Li * unused characters should be right-padded with NUL characters. 715*600f14f4SXin Li */ 716*600f14f4SXin Li 717*600f14f4SXin Li FLAC__uint64 lead_in; 718*600f14f4SXin Li /**< The number of lead-in samples. */ 719*600f14f4SXin Li 720*600f14f4SXin Li FLAC__bool is_cd; 721*600f14f4SXin Li /**< \c true if CUESHEET corresponds to a Compact Disc, else \c false. */ 722*600f14f4SXin Li 723*600f14f4SXin Li uint32_t num_tracks; 724*600f14f4SXin Li /**< The number of tracks. */ 725*600f14f4SXin Li 726*600f14f4SXin Li FLAC__StreamMetadata_CueSheet_Track *tracks; 727*600f14f4SXin Li /**< NULL if num_tracks == 0, else pointer to array of tracks. */ 728*600f14f4SXin Li 729*600f14f4SXin Li } FLAC__StreamMetadata_CueSheet; 730*600f14f4SXin Li 731*600f14f4SXin Li extern FLAC_API const uint32_t FLAC__STREAM_METADATA_CUESHEET_MEDIA_CATALOG_NUMBER_LEN; /**< == 128*8 (bits) */ 732*600f14f4SXin Li extern FLAC_API const uint32_t FLAC__STREAM_METADATA_CUESHEET_LEAD_IN_LEN; /**< == 64 (bits) */ 733*600f14f4SXin Li extern FLAC_API const uint32_t FLAC__STREAM_METADATA_CUESHEET_IS_CD_LEN; /**< == 1 (bit) */ 734*600f14f4SXin Li extern FLAC_API const uint32_t FLAC__STREAM_METADATA_CUESHEET_RESERVED_LEN; /**< == 7+258*8 (bits) */ 735*600f14f4SXin Li extern FLAC_API const uint32_t FLAC__STREAM_METADATA_CUESHEET_NUM_TRACKS_LEN; /**< == 8 (bits) */ 736*600f14f4SXin Li 737*600f14f4SXin Li 738*600f14f4SXin Li /** An enumeration of the PICTURE types (see FLAC__StreamMetadataPicture and id3 v2.4 APIC tag). */ 739*600f14f4SXin Li typedef enum { 740*600f14f4SXin Li FLAC__STREAM_METADATA_PICTURE_TYPE_OTHER = 0, /**< Other */ 741*600f14f4SXin Li FLAC__STREAM_METADATA_PICTURE_TYPE_FILE_ICON_STANDARD = 1, /**< 32x32 pixels 'file icon' (PNG only) */ 742*600f14f4SXin Li FLAC__STREAM_METADATA_PICTURE_TYPE_FILE_ICON = 2, /**< Other file icon */ 743*600f14f4SXin Li FLAC__STREAM_METADATA_PICTURE_TYPE_FRONT_COVER = 3, /**< Cover (front) */ 744*600f14f4SXin Li FLAC__STREAM_METADATA_PICTURE_TYPE_BACK_COVER = 4, /**< Cover (back) */ 745*600f14f4SXin Li FLAC__STREAM_METADATA_PICTURE_TYPE_LEAFLET_PAGE = 5, /**< Leaflet page */ 746*600f14f4SXin Li FLAC__STREAM_METADATA_PICTURE_TYPE_MEDIA = 6, /**< Media (e.g. label side of CD) */ 747*600f14f4SXin Li FLAC__STREAM_METADATA_PICTURE_TYPE_LEAD_ARTIST = 7, /**< Lead artist/lead performer/soloist */ 748*600f14f4SXin Li FLAC__STREAM_METADATA_PICTURE_TYPE_ARTIST = 8, /**< Artist/performer */ 749*600f14f4SXin Li FLAC__STREAM_METADATA_PICTURE_TYPE_CONDUCTOR = 9, /**< Conductor */ 750*600f14f4SXin Li FLAC__STREAM_METADATA_PICTURE_TYPE_BAND = 10, /**< Band/Orchestra */ 751*600f14f4SXin Li FLAC__STREAM_METADATA_PICTURE_TYPE_COMPOSER = 11, /**< Composer */ 752*600f14f4SXin Li FLAC__STREAM_METADATA_PICTURE_TYPE_LYRICIST = 12, /**< Lyricist/text writer */ 753*600f14f4SXin Li FLAC__STREAM_METADATA_PICTURE_TYPE_RECORDING_LOCATION = 13, /**< Recording Location */ 754*600f14f4SXin Li FLAC__STREAM_METADATA_PICTURE_TYPE_DURING_RECORDING = 14, /**< During recording */ 755*600f14f4SXin Li FLAC__STREAM_METADATA_PICTURE_TYPE_DURING_PERFORMANCE = 15, /**< During performance */ 756*600f14f4SXin Li FLAC__STREAM_METADATA_PICTURE_TYPE_VIDEO_SCREEN_CAPTURE = 16, /**< Movie/video screen capture */ 757*600f14f4SXin Li FLAC__STREAM_METADATA_PICTURE_TYPE_FISH = 17, /**< A bright coloured fish */ 758*600f14f4SXin Li FLAC__STREAM_METADATA_PICTURE_TYPE_ILLUSTRATION = 18, /**< Illustration */ 759*600f14f4SXin Li FLAC__STREAM_METADATA_PICTURE_TYPE_BAND_LOGOTYPE = 19, /**< Band/artist logotype */ 760*600f14f4SXin Li FLAC__STREAM_METADATA_PICTURE_TYPE_PUBLISHER_LOGOTYPE = 20, /**< Publisher/Studio logotype */ 761*600f14f4SXin Li FLAC__STREAM_METADATA_PICTURE_TYPE_UNDEFINED 762*600f14f4SXin Li } FLAC__StreamMetadata_Picture_Type; 763*600f14f4SXin Li 764*600f14f4SXin Li /** Maps a FLAC__StreamMetadata_Picture_Type to a C string. 765*600f14f4SXin Li * 766*600f14f4SXin Li * Using a FLAC__StreamMetadata_Picture_Type as the index to this array 767*600f14f4SXin Li * will give the string equivalent. The contents should not be 768*600f14f4SXin Li * modified. 769*600f14f4SXin Li */ 770*600f14f4SXin Li extern FLAC_API const char * const FLAC__StreamMetadata_Picture_TypeString[]; 771*600f14f4SXin Li 772*600f14f4SXin Li /** FLAC PICTURE structure. (See the 773*600f14f4SXin Li * <A HREF="https://xiph.org/flac/format.html#metadata_block_picture">format specification</A> 774*600f14f4SXin Li * for the full description of each field.) 775*600f14f4SXin Li */ 776*600f14f4SXin Li typedef struct { 777*600f14f4SXin Li FLAC__StreamMetadata_Picture_Type type; 778*600f14f4SXin Li /**< The kind of picture stored. */ 779*600f14f4SXin Li 780*600f14f4SXin Li char *mime_type; 781*600f14f4SXin Li /**< Picture data's MIME type, in ASCII printable characters 782*600f14f4SXin Li * 0x20-0x7e, NUL terminated. For best compatibility with players, 783*600f14f4SXin Li * use picture data of MIME type \c image/jpeg or \c image/png. A 784*600f14f4SXin Li * MIME type of '-->' is also allowed, in which case the picture 785*600f14f4SXin Li * data should be a complete URL. In file storage, the MIME type is 786*600f14f4SXin Li * stored as a 32-bit length followed by the ASCII string with no NUL 787*600f14f4SXin Li * terminator, but is converted to a plain C string in this structure 788*600f14f4SXin Li * for convenience. 789*600f14f4SXin Li */ 790*600f14f4SXin Li 791*600f14f4SXin Li FLAC__byte *description; 792*600f14f4SXin Li /**< Picture's description in UTF-8, NUL terminated. In file storage, 793*600f14f4SXin Li * the description is stored as a 32-bit length followed by the UTF-8 794*600f14f4SXin Li * string with no NUL terminator, but is converted to a plain C string 795*600f14f4SXin Li * in this structure for convenience. 796*600f14f4SXin Li */ 797*600f14f4SXin Li 798*600f14f4SXin Li FLAC__uint32 width; 799*600f14f4SXin Li /**< Picture's width in pixels. */ 800*600f14f4SXin Li 801*600f14f4SXin Li FLAC__uint32 height; 802*600f14f4SXin Li /**< Picture's height in pixels. */ 803*600f14f4SXin Li 804*600f14f4SXin Li FLAC__uint32 depth; 805*600f14f4SXin Li /**< Picture's color depth in bits-per-pixel. */ 806*600f14f4SXin Li 807*600f14f4SXin Li FLAC__uint32 colors; 808*600f14f4SXin Li /**< For indexed palettes (like GIF), picture's number of colors (the 809*600f14f4SXin Li * number of palette entries), or \c 0 for non-indexed (i.e. 2^depth). 810*600f14f4SXin Li */ 811*600f14f4SXin Li 812*600f14f4SXin Li FLAC__uint32 data_length; 813*600f14f4SXin Li /**< Length of binary picture data in bytes. */ 814*600f14f4SXin Li 815*600f14f4SXin Li FLAC__byte *data; 816*600f14f4SXin Li /**< Binary picture data. */ 817*600f14f4SXin Li 818*600f14f4SXin Li } FLAC__StreamMetadata_Picture; 819*600f14f4SXin Li 820*600f14f4SXin Li extern FLAC_API const uint32_t FLAC__STREAM_METADATA_PICTURE_TYPE_LEN; /**< == 32 (bits) */ 821*600f14f4SXin Li extern FLAC_API const uint32_t FLAC__STREAM_METADATA_PICTURE_MIME_TYPE_LENGTH_LEN; /**< == 32 (bits) */ 822*600f14f4SXin Li extern FLAC_API const uint32_t FLAC__STREAM_METADATA_PICTURE_DESCRIPTION_LENGTH_LEN; /**< == 32 (bits) */ 823*600f14f4SXin Li extern FLAC_API const uint32_t FLAC__STREAM_METADATA_PICTURE_WIDTH_LEN; /**< == 32 (bits) */ 824*600f14f4SXin Li extern FLAC_API const uint32_t FLAC__STREAM_METADATA_PICTURE_HEIGHT_LEN; /**< == 32 (bits) */ 825*600f14f4SXin Li extern FLAC_API const uint32_t FLAC__STREAM_METADATA_PICTURE_DEPTH_LEN; /**< == 32 (bits) */ 826*600f14f4SXin Li extern FLAC_API const uint32_t FLAC__STREAM_METADATA_PICTURE_COLORS_LEN; /**< == 32 (bits) */ 827*600f14f4SXin Li extern FLAC_API const uint32_t FLAC__STREAM_METADATA_PICTURE_DATA_LENGTH_LEN; /**< == 32 (bits) */ 828*600f14f4SXin Li 829*600f14f4SXin Li 830*600f14f4SXin Li /** Structure that is used when a metadata block of unknown type is loaded. 831*600f14f4SXin Li * The contents are opaque. The structure is used only internally to 832*600f14f4SXin Li * correctly handle unknown metadata. 833*600f14f4SXin Li */ 834*600f14f4SXin Li typedef struct { 835*600f14f4SXin Li FLAC__byte *data; 836*600f14f4SXin Li } FLAC__StreamMetadata_Unknown; 837*600f14f4SXin Li 838*600f14f4SXin Li 839*600f14f4SXin Li /** FLAC metadata block structure. (c.f. <A HREF="https://xiph.org/flac/format.html#metadata_block">format specification</A>) 840*600f14f4SXin Li */ 841*600f14f4SXin Li typedef struct FLAC__StreamMetadata { 842*600f14f4SXin Li FLAC__MetadataType type; 843*600f14f4SXin Li /**< The type of the metadata block; used determine which member of the 844*600f14f4SXin Li * \a data union to dereference. If type >= FLAC__METADATA_TYPE_UNDEFINED 845*600f14f4SXin Li * then \a data.unknown must be used. */ 846*600f14f4SXin Li 847*600f14f4SXin Li FLAC__bool is_last; 848*600f14f4SXin Li /**< \c true if this metadata block is the last, else \a false */ 849*600f14f4SXin Li 850*600f14f4SXin Li uint32_t length; 851*600f14f4SXin Li /**< Length, in bytes, of the block data as it appears in the stream. */ 852*600f14f4SXin Li 853*600f14f4SXin Li union { 854*600f14f4SXin Li FLAC__StreamMetadata_StreamInfo stream_info; 855*600f14f4SXin Li FLAC__StreamMetadata_Padding padding; 856*600f14f4SXin Li FLAC__StreamMetadata_Application application; 857*600f14f4SXin Li FLAC__StreamMetadata_SeekTable seek_table; 858*600f14f4SXin Li FLAC__StreamMetadata_VorbisComment vorbis_comment; 859*600f14f4SXin Li FLAC__StreamMetadata_CueSheet cue_sheet; 860*600f14f4SXin Li FLAC__StreamMetadata_Picture picture; 861*600f14f4SXin Li FLAC__StreamMetadata_Unknown unknown; 862*600f14f4SXin Li } data; 863*600f14f4SXin Li /**< Polymorphic block data; use the \a type value to determine which 864*600f14f4SXin Li * to use. */ 865*600f14f4SXin Li } FLAC__StreamMetadata; 866*600f14f4SXin Li 867*600f14f4SXin Li extern FLAC_API const uint32_t FLAC__STREAM_METADATA_IS_LAST_LEN; /**< == 1 (bit) */ 868*600f14f4SXin Li extern FLAC_API const uint32_t FLAC__STREAM_METADATA_TYPE_LEN; /**< == 7 (bits) */ 869*600f14f4SXin Li extern FLAC_API const uint32_t FLAC__STREAM_METADATA_LENGTH_LEN; /**< == 24 (bits) */ 870*600f14f4SXin Li 871*600f14f4SXin Li /** The total stream length of a metadata block header in bytes. */ 872*600f14f4SXin Li #define FLAC__STREAM_METADATA_HEADER_LENGTH (4u) 873*600f14f4SXin Li 874*600f14f4SXin Li /*****************************************************************************/ 875*600f14f4SXin Li 876*600f14f4SXin Li 877*600f14f4SXin Li /***************************************************************************** 878*600f14f4SXin Li * 879*600f14f4SXin Li * Utility functions 880*600f14f4SXin Li * 881*600f14f4SXin Li *****************************************************************************/ 882*600f14f4SXin Li 883*600f14f4SXin Li /** Tests that a sample rate is valid for FLAC. 884*600f14f4SXin Li * 885*600f14f4SXin Li * \param sample_rate The sample rate to test for compliance. 886*600f14f4SXin Li * \retval FLAC__bool 887*600f14f4SXin Li * \c true if the given sample rate conforms to the specification, else 888*600f14f4SXin Li * \c false. 889*600f14f4SXin Li */ 890*600f14f4SXin Li FLAC_API FLAC__bool FLAC__format_sample_rate_is_valid(uint32_t sample_rate); 891*600f14f4SXin Li 892*600f14f4SXin Li /** Tests that a blocksize at the given sample rate is valid for the FLAC 893*600f14f4SXin Li * subset. 894*600f14f4SXin Li * 895*600f14f4SXin Li * \param blocksize The blocksize to test for compliance. 896*600f14f4SXin Li * \param sample_rate The sample rate is needed, since the valid subset 897*600f14f4SXin Li * blocksize depends on the sample rate. 898*600f14f4SXin Li * \retval FLAC__bool 899*600f14f4SXin Li * \c true if the given blocksize conforms to the specification for the 900*600f14f4SXin Li * subset at the given sample rate, else \c false. 901*600f14f4SXin Li */ 902*600f14f4SXin Li FLAC_API FLAC__bool FLAC__format_blocksize_is_subset(uint32_t blocksize, uint32_t sample_rate); 903*600f14f4SXin Li 904*600f14f4SXin Li /** Tests that a sample rate is valid for the FLAC subset. The subset rules 905*600f14f4SXin Li * for valid sample rates are slightly more complex since the rate has to 906*600f14f4SXin Li * be expressible completely in the frame header. 907*600f14f4SXin Li * 908*600f14f4SXin Li * \param sample_rate The sample rate to test for compliance. 909*600f14f4SXin Li * \retval FLAC__bool 910*600f14f4SXin Li * \c true if the given sample rate conforms to the specification for the 911*600f14f4SXin Li * subset, else \c false. 912*600f14f4SXin Li */ 913*600f14f4SXin Li FLAC_API FLAC__bool FLAC__format_sample_rate_is_subset(uint32_t sample_rate); 914*600f14f4SXin Li 915*600f14f4SXin Li /** Check a Vorbis comment entry name to see if it conforms to the Vorbis 916*600f14f4SXin Li * comment specification. 917*600f14f4SXin Li * 918*600f14f4SXin Li * Vorbis comment names must be composed only of characters from 919*600f14f4SXin Li * [0x20-0x3C,0x3E-0x7D]. 920*600f14f4SXin Li * 921*600f14f4SXin Li * \param name A NUL-terminated string to be checked. 922*600f14f4SXin Li * \assert 923*600f14f4SXin Li * \code name != NULL \endcode 924*600f14f4SXin Li * \retval FLAC__bool 925*600f14f4SXin Li * \c false if entry name is illegal, else \c true. 926*600f14f4SXin Li */ 927*600f14f4SXin Li FLAC_API FLAC__bool FLAC__format_vorbiscomment_entry_name_is_legal(const char *name); 928*600f14f4SXin Li 929*600f14f4SXin Li /** Check a Vorbis comment entry value to see if it conforms to the Vorbis 930*600f14f4SXin Li * comment specification. 931*600f14f4SXin Li * 932*600f14f4SXin Li * Vorbis comment values must be valid UTF-8 sequences. 933*600f14f4SXin Li * 934*600f14f4SXin Li * \param value A string to be checked. 935*600f14f4SXin Li * \param length A the length of \a value in bytes. May be 936*600f14f4SXin Li * \c (uint32_t)(-1) to indicate that \a value is a plain 937*600f14f4SXin Li * UTF-8 NUL-terminated string. 938*600f14f4SXin Li * \assert 939*600f14f4SXin Li * \code value != NULL \endcode 940*600f14f4SXin Li * \retval FLAC__bool 941*600f14f4SXin Li * \c false if entry name is illegal, else \c true. 942*600f14f4SXin Li */ 943*600f14f4SXin Li FLAC_API FLAC__bool FLAC__format_vorbiscomment_entry_value_is_legal(const FLAC__byte *value, uint32_t length); 944*600f14f4SXin Li 945*600f14f4SXin Li /** Check a Vorbis comment entry to see if it conforms to the Vorbis 946*600f14f4SXin Li * comment specification. 947*600f14f4SXin Li * 948*600f14f4SXin Li * Vorbis comment entries must be of the form 'name=value', and 'name' and 949*600f14f4SXin Li * 'value' must be legal according to 950*600f14f4SXin Li * FLAC__format_vorbiscomment_entry_name_is_legal() and 951*600f14f4SXin Li * FLAC__format_vorbiscomment_entry_value_is_legal() respectively. 952*600f14f4SXin Li * 953*600f14f4SXin Li * \param entry An entry to be checked. 954*600f14f4SXin Li * \param length The length of \a entry in bytes. 955*600f14f4SXin Li * \assert 956*600f14f4SXin Li * \code value != NULL \endcode 957*600f14f4SXin Li * \retval FLAC__bool 958*600f14f4SXin Li * \c false if entry name is illegal, else \c true. 959*600f14f4SXin Li */ 960*600f14f4SXin Li FLAC_API FLAC__bool FLAC__format_vorbiscomment_entry_is_legal(const FLAC__byte *entry, uint32_t length); 961*600f14f4SXin Li 962*600f14f4SXin Li /** Check a seek table to see if it conforms to the FLAC specification. 963*600f14f4SXin Li * See the format specification for limits on the contents of the 964*600f14f4SXin Li * seek table. 965*600f14f4SXin Li * 966*600f14f4SXin Li * \param seek_table A pointer to a seek table to be checked. 967*600f14f4SXin Li * \assert 968*600f14f4SXin Li * \code seek_table != NULL \endcode 969*600f14f4SXin Li * \retval FLAC__bool 970*600f14f4SXin Li * \c false if seek table is illegal, else \c true. 971*600f14f4SXin Li */ 972*600f14f4SXin Li FLAC_API FLAC__bool FLAC__format_seektable_is_legal(const FLAC__StreamMetadata_SeekTable *seek_table); 973*600f14f4SXin Li 974*600f14f4SXin Li /** Sort a seek table's seek points according to the format specification. 975*600f14f4SXin Li * This includes a "unique-ification" step to remove duplicates, i.e. 976*600f14f4SXin Li * seek points with identical \a sample_number values. Duplicate seek 977*600f14f4SXin Li * points are converted into placeholder points and sorted to the end of 978*600f14f4SXin Li * the table. 979*600f14f4SXin Li * 980*600f14f4SXin Li * \param seek_table A pointer to a seek table to be sorted. 981*600f14f4SXin Li * \assert 982*600f14f4SXin Li * \code seek_table != NULL \endcode 983*600f14f4SXin Li * \retval uint32_t 984*600f14f4SXin Li * The number of duplicate seek points converted into placeholders. 985*600f14f4SXin Li */ 986*600f14f4SXin Li FLAC_API uint32_t FLAC__format_seektable_sort(FLAC__StreamMetadata_SeekTable *seek_table); 987*600f14f4SXin Li 988*600f14f4SXin Li /** Check a cue sheet to see if it conforms to the FLAC specification. 989*600f14f4SXin Li * See the format specification for limits on the contents of the 990*600f14f4SXin Li * cue sheet. 991*600f14f4SXin Li * 992*600f14f4SXin Li * \param cue_sheet A pointer to an existing cue sheet to be checked. 993*600f14f4SXin Li * \param check_cd_da_subset If \c true, check CUESHEET against more 994*600f14f4SXin Li * stringent requirements for a CD-DA (audio) disc. 995*600f14f4SXin Li * \param violation Address of a pointer to a string. If there is a 996*600f14f4SXin Li * violation, a pointer to a string explanation of the 997*600f14f4SXin Li * violation will be returned here. \a violation may be 998*600f14f4SXin Li * \c NULL if you don't need the returned string. Do not 999*600f14f4SXin Li * free the returned string; it will always point to static 1000*600f14f4SXin Li * data. 1001*600f14f4SXin Li * \assert 1002*600f14f4SXin Li * \code cue_sheet != NULL \endcode 1003*600f14f4SXin Li * \retval FLAC__bool 1004*600f14f4SXin Li * \c false if cue sheet is illegal, else \c true. 1005*600f14f4SXin Li */ 1006*600f14f4SXin Li FLAC_API FLAC__bool FLAC__format_cuesheet_is_legal(const FLAC__StreamMetadata_CueSheet *cue_sheet, FLAC__bool check_cd_da_subset, const char **violation); 1007*600f14f4SXin Li 1008*600f14f4SXin Li /** Check picture data to see if it conforms to the FLAC specification. 1009*600f14f4SXin Li * See the format specification for limits on the contents of the 1010*600f14f4SXin Li * PICTURE block. 1011*600f14f4SXin Li * 1012*600f14f4SXin Li * \param picture A pointer to existing picture data to be checked. 1013*600f14f4SXin Li * \param violation Address of a pointer to a string. If there is a 1014*600f14f4SXin Li * violation, a pointer to a string explanation of the 1015*600f14f4SXin Li * violation will be returned here. \a violation may be 1016*600f14f4SXin Li * \c NULL if you don't need the returned string. Do not 1017*600f14f4SXin Li * free the returned string; it will always point to static 1018*600f14f4SXin Li * data. 1019*600f14f4SXin Li * \assert 1020*600f14f4SXin Li * \code picture != NULL \endcode 1021*600f14f4SXin Li * \retval FLAC__bool 1022*600f14f4SXin Li * \c false if picture data is illegal, else \c true. 1023*600f14f4SXin Li */ 1024*600f14f4SXin Li FLAC_API FLAC__bool FLAC__format_picture_is_legal(const FLAC__StreamMetadata_Picture *picture, const char **violation); 1025*600f14f4SXin Li 1026*600f14f4SXin Li /* \} */ 1027*600f14f4SXin Li 1028*600f14f4SXin Li #ifdef __cplusplus 1029*600f14f4SXin Li } 1030*600f14f4SXin Li #endif 1031*600f14f4SXin Li 1032*600f14f4SXin Li #endif 1033