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