The "GR-PEACH_Audio_Playback_7InchLCD_Sample" is a sample code that can provides high-resolution audio playback of FLAC format files. It also allows the user to audio-playback control functions such as play, pause, and stop by manipulating key switches.

Dependencies:   GR-PEACH_video R_BSP TLV320_RBSP USBHost_custom

Fork of GR-PEACH_Audio_Playback_Sample by Renesas

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers format.h Source File

format.h

Go to the documentation of this file.
00001 /* libFLAC - Free Lossless Audio Codec library
00002  * Copyright (C) 2000-2009  Josh Coalson
00003  * Copyright (C) 2011-2014  Xiph.Org Foundation
00004  *
00005  * Redistribution and use in source and binary forms, with or without
00006  * modification, are permitted provided that the following conditions
00007  * are met:
00008  *
00009  * - Redistributions of source code must retain the above copyright
00010  * notice, this list of conditions and the following disclaimer.
00011  *
00012  * - Redistributions in binary form must reproduce the above copyright
00013  * notice, this list of conditions and the following disclaimer in the
00014  * documentation and/or other materials provided with the distribution.
00015  *
00016  * - Neither the name of the Xiph.org Foundation nor the names of its
00017  * contributors may be used to endorse or promote products derived from
00018  * this software without specific prior written permission.
00019  *
00020  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
00021  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
00022  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
00023  * A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR
00024  * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
00025  * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
00026  * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
00027  * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
00028  * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
00029  * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
00030  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
00031  */
00032 
00033 #ifndef FLAC__FORMAT_H
00034 #define FLAC__FORMAT_H
00035 
00036 #include "export.h"
00037 #include "ordinals.h"
00038 
00039 #ifdef __cplusplus
00040 extern "C" {
00041 #endif
00042 
00043 /** \file include/FLAC/format.h
00044  *
00045  *  \brief
00046  *  This module contains structure definitions for the representation
00047  *  of FLAC format components in memory.  These are the basic
00048  *  structures used by the rest of the interfaces.
00049  *
00050  *  See the detailed documentation in the
00051  *  \link flac_format format \endlink module.
00052  */
00053 
00054 /** \defgroup flac_format FLAC/format.h: format components
00055  *  \ingroup flac
00056  *
00057  *  \brief
00058  *  This module contains structure definitions for the representation
00059  *  of FLAC format components in memory.  These are the basic
00060  *  structures used by the rest of the interfaces.
00061  *
00062  *  First, you should be familiar with the
00063  *  <A HREF="../format.html">FLAC format</A>.  Many of the values here
00064  *  follow directly from the specification.  As a user of libFLAC, the
00065  *  interesting parts really are the structures that describe the frame
00066  *  header and metadata blocks.
00067  *
00068  *  The format structures here are very primitive, designed to store
00069  *  information in an efficient way.  Reading information from the
00070  *  structures is easy but creating or modifying them directly is
00071  *  more complex.  For the most part, as a user of a library, editing
00072  *  is not necessary; however, for metadata blocks it is, so there are
00073  *  convenience functions provided in the \link flac_metadata metadata
00074  *  module \endlink to simplify the manipulation of metadata blocks.
00075  *
00076  * \note
00077  * It's not the best convention, but symbols ending in _LEN are in bits
00078  * and _LENGTH are in bytes.  _LENGTH symbols are \#defines instead of
00079  * global variables because they are usually used when declaring byte
00080  * arrays and some compilers require compile-time knowledge of array
00081  * sizes when declared on the stack.
00082  *
00083  * \{
00084  */
00085 
00086 
00087 /*
00088     Most of the values described in this file are defined by the FLAC
00089     format specification.  There is nothing to tune here.
00090 */
00091 
00092 /** The largest legal metadata type code. */
00093 #define FLAC__MAX_METADATA_TYPE_CODE (126u)
00094 
00095 /** The minimum block size, in samples, permitted by the format. */
00096 #define FLAC__MIN_BLOCK_SIZE (16u)
00097 
00098 /** The maximum block size, in samples, permitted by the format. */
00099 #define FLAC__MAX_BLOCK_SIZE (65535u)
00100 
00101 /** The maximum block size, in samples, permitted by the FLAC subset for
00102  *  sample rates up to 48kHz. */
00103 #define FLAC__SUBSET_MAX_BLOCK_SIZE_48000HZ (4608u)
00104 
00105 /** The maximum number of channels permitted by the format. */
00106 #define FLAC__MAX_CHANNELS (8u)
00107 
00108 /** The minimum sample resolution permitted by the format. */
00109 #define FLAC__MIN_BITS_PER_SAMPLE (4u)
00110 
00111 /** The maximum sample resolution permitted by the format. */
00112 #define FLAC__MAX_BITS_PER_SAMPLE (32u)
00113 
00114 /** The maximum sample resolution permitted by libFLAC.
00115  *
00116  * \warning
00117  * FLAC__MAX_BITS_PER_SAMPLE is the limit of the FLAC format.  However,
00118  * the reference encoder/decoder is currently limited to 24 bits because
00119  * of prevalent 32-bit math, so make sure and use this value when
00120  * appropriate.
00121  */
00122 #define FLAC__REFERENCE_CODEC_MAX_BITS_PER_SAMPLE (24u)
00123 
00124 /** The maximum sample rate permitted by the format.  The value is
00125  *  ((2 ^ 16) - 1) * 10; see <A HREF="../format.html">FLAC format</A>
00126  *  as to why.
00127  */
00128 #define FLAC__MAX_SAMPLE_RATE (655350u)
00129 
00130 /** The maximum LPC order permitted by the format. */
00131 #define FLAC__MAX_LPC_ORDER (32u)
00132 
00133 /** The maximum LPC order permitted by the FLAC subset for sample rates
00134  *  up to 48kHz. */
00135 #define FLAC__SUBSET_MAX_LPC_ORDER_48000HZ (12u)
00136 
00137 /** The minimum quantized linear predictor coefficient precision
00138  *  permitted by the format.
00139  */
00140 #define FLAC__MIN_QLP_COEFF_PRECISION (5u)
00141 
00142 /** The maximum quantized linear predictor coefficient precision
00143  *  permitted by the format.
00144  */
00145 #define FLAC__MAX_QLP_COEFF_PRECISION (15u)
00146 
00147 /** The maximum order of the fixed predictors permitted by the format. */
00148 #define FLAC__MAX_FIXED_ORDER (4u)
00149 
00150 /** The maximum Rice partition order permitted by the format. */
00151 #define FLAC__MAX_RICE_PARTITION_ORDER (15u)
00152 
00153 /** The maximum Rice partition order permitted by the FLAC Subset. */
00154 #define FLAC__SUBSET_MAX_RICE_PARTITION_ORDER (8u)
00155 
00156 /** The version string of the release, stamped onto the libraries and binaries.
00157  *
00158  * \note
00159  * This does not correspond to the shared library version number, which
00160  * is used to determine binary compatibility.
00161  */
00162 extern FLAC_API const char *FLAC__VERSION_STRING;
00163 
00164 /** The vendor string inserted by the encoder into the VORBIS_COMMENT block.
00165  *  This is a NUL-terminated ASCII string; when inserted into the
00166  *  VORBIS_COMMENT the trailing null is stripped.
00167  */
00168 extern FLAC_API const char *FLAC__VENDOR_STRING;
00169 
00170 /** The byte string representation of the beginning of a FLAC stream. */
00171 extern FLAC_API const FLAC__byte FLAC__STREAM_SYNC_STRING[4]; /* = "fLaC" */
00172 
00173 /** The 32-bit integer big-endian representation of the beginning of
00174  *  a FLAC stream.
00175  */
00176 extern FLAC_API const unsigned FLAC__STREAM_SYNC; /* = 0x664C6143 */
00177 
00178 /** The length of the FLAC signature in bits. */
00179 extern FLAC_API const unsigned FLAC__STREAM_SYNC_LEN; /* = 32 bits */
00180 
00181 /** The length of the FLAC signature in bytes. */
00182 #define FLAC__STREAM_SYNC_LENGTH (4u)
00183 
00184 
00185 /*****************************************************************************
00186  *
00187  * Subframe structures
00188  *
00189  *****************************************************************************/
00190 
00191 /*****************************************************************************/
00192 
00193 /** An enumeration of the available entropy coding methods. */
00194 typedef enum {
00195     FLAC__ENTROPY_CODING_METHOD_PARTITIONED_RICE = 0,
00196     /**< Residual is coded by partitioning into contexts, each with it's own
00197      * 4-bit Rice parameter. */
00198 
00199     FLAC__ENTROPY_CODING_METHOD_PARTITIONED_RICE2 = 1
00200     /**< Residual is coded by partitioning into contexts, each with it's own
00201      * 5-bit Rice parameter. */
00202 } FLAC__EntropyCodingMethodType;
00203 
00204 /** Maps a FLAC__EntropyCodingMethodType to a C string.
00205  *
00206  *  Using a FLAC__EntropyCodingMethodType as the index to this array will
00207  *  give the string equivalent.  The contents should not be modified.
00208  */
00209 extern FLAC_API const char * const FLAC__EntropyCodingMethodTypeString[];
00210 
00211 
00212 /** Contents of a Rice partitioned residual
00213  */
00214 typedef struct {
00215 
00216     unsigned *parameters;
00217     /**< The Rice parameters for each context. */
00218 
00219     unsigned *raw_bits;
00220     /**< Widths for escape-coded partitions.  Will be non-zero for escaped
00221      * partitions and zero for unescaped partitions.
00222      */
00223 
00224     unsigned capacity_by_order;
00225     /**< The capacity of the \a parameters and \a raw_bits arrays
00226      * specified as an order, i.e. the number of array elements
00227      * allocated is 2 ^ \a capacity_by_order.
00228      */
00229 } FLAC__EntropyCodingMethod_PartitionedRiceContents;
00230 
00231 /** Header for a Rice partitioned residual.  (c.f. <A HREF="../format.html#partitioned_rice">format specification</A>)
00232  */
00233 typedef struct {
00234 
00235     unsigned order;
00236     /**< The partition order, i.e. # of contexts = 2 ^ \a order. */
00237 
00238     const FLAC__EntropyCodingMethod_PartitionedRiceContents *contents;
00239     /**< The context's Rice parameters and/or raw bits. */
00240 
00241 } FLAC__EntropyCodingMethod_PartitionedRice;
00242 
00243 extern FLAC_API const unsigned FLAC__ENTROPY_CODING_METHOD_PARTITIONED_RICE_ORDER_LEN; /**< == 4 (bits) */
00244 extern FLAC_API const unsigned FLAC__ENTROPY_CODING_METHOD_PARTITIONED_RICE_PARAMETER_LEN; /**< == 4 (bits) */
00245 extern FLAC_API const unsigned FLAC__ENTROPY_CODING_METHOD_PARTITIONED_RICE2_PARAMETER_LEN; /**< == 5 (bits) */
00246 extern FLAC_API const unsigned FLAC__ENTROPY_CODING_METHOD_PARTITIONED_RICE_RAW_LEN; /**< == 5 (bits) */
00247 
00248 extern FLAC_API const unsigned FLAC__ENTROPY_CODING_METHOD_PARTITIONED_RICE_ESCAPE_PARAMETER;
00249 /**< == (1<<FLAC__ENTROPY_CODING_METHOD_PARTITIONED_RICE_PARAMETER_LEN)-1 */
00250 extern FLAC_API const unsigned FLAC__ENTROPY_CODING_METHOD_PARTITIONED_RICE2_ESCAPE_PARAMETER;
00251 /**< == (1<<FLAC__ENTROPY_CODING_METHOD_PARTITIONED_RICE2_PARAMETER_LEN)-1 */
00252 
00253 /** Header for the entropy coding method.  (c.f. <A HREF="../format.html#residual">format specification</A>)
00254  */
00255 typedef struct {
00256     FLAC__EntropyCodingMethodType type;
00257     union {
00258         FLAC__EntropyCodingMethod_PartitionedRice partitioned_rice;
00259     } data;
00260 } FLAC__EntropyCodingMethod;
00261 
00262 extern FLAC_API const unsigned FLAC__ENTROPY_CODING_METHOD_TYPE_LEN; /**< == 2 (bits) */
00263 
00264 /*****************************************************************************/
00265 
00266 /** An enumeration of the available subframe types. */
00267 typedef enum {
00268     FLAC__SUBFRAME_TYPE_CONSTANT = 0, /**< constant signal */
00269     FLAC__SUBFRAME_TYPE_VERBATIM = 1, /**< uncompressed signal */
00270     FLAC__SUBFRAME_TYPE_FIXED = 2, /**< fixed polynomial prediction */
00271     FLAC__SUBFRAME_TYPE_LPC = 3 /**< linear prediction */
00272 } FLAC__SubframeType;
00273 
00274 /** Maps a FLAC__SubframeType to a C string.
00275  *
00276  *  Using a FLAC__SubframeType as the index to this array will
00277  *  give the string equivalent.  The contents should not be modified.
00278  */
00279 extern FLAC_API const char * const FLAC__SubframeTypeString[];
00280 
00281 
00282 /** CONSTANT subframe.  (c.f. <A HREF="../format.html#subframe_constant">format specification</A>)
00283  */
00284 typedef struct {
00285     FLAC__int32 value; /**< The constant signal value. */
00286 } FLAC__Subframe_Constant;
00287 
00288 
00289 /** VERBATIM subframe.  (c.f. <A HREF="../format.html#subframe_verbatim">format specification</A>)
00290  */
00291 typedef struct {
00292     const FLAC__int32 *data; /**< A pointer to verbatim signal. */
00293 } FLAC__Subframe_Verbatim;
00294 
00295 
00296 /** FIXED subframe.  (c.f. <A HREF="../format.html#subframe_fixed">format specification</A>)
00297  */
00298 typedef struct {
00299     FLAC__EntropyCodingMethod entropy_coding_method;
00300     /**< The residual coding method. */
00301 
00302     unsigned order;
00303     /**< The polynomial order. */
00304 
00305     FLAC__int32 warmup[FLAC__MAX_FIXED_ORDER];
00306     /**< Warmup samples to prime the predictor, length == order. */
00307 
00308     const FLAC__int32 *residual;
00309     /**< The residual signal, length == (blocksize minus order) samples. */
00310 } FLAC__Subframe_Fixed;
00311 
00312 
00313 /** LPC subframe.  (c.f. <A HREF="../format.html#subframe_lpc">format specification</A>)
00314  */
00315 typedef struct {
00316     FLAC__EntropyCodingMethod entropy_coding_method;
00317     /**< The residual coding method. */
00318 
00319     unsigned order;
00320     /**< The FIR order. */
00321 
00322     unsigned qlp_coeff_precision;
00323     /**< Quantized FIR filter coefficient precision in bits. */
00324 
00325     int quantization_level;
00326     /**< The qlp coeff shift needed. */
00327 
00328     FLAC__int32 qlp_coeff[FLAC__MAX_LPC_ORDER];
00329     /**< FIR filter coefficients. */
00330 
00331     FLAC__int32 warmup[FLAC__MAX_LPC_ORDER];
00332     /**< Warmup samples to prime the predictor, length == order. */
00333 
00334     const FLAC__int32 *residual;
00335     /**< The residual signal, length == (blocksize minus order) samples. */
00336 } FLAC__Subframe_LPC;
00337 
00338 extern FLAC_API const unsigned FLAC__SUBFRAME_LPC_QLP_COEFF_PRECISION_LEN; /**< == 4 (bits) */
00339 extern FLAC_API const unsigned FLAC__SUBFRAME_LPC_QLP_SHIFT_LEN; /**< == 5 (bits) */
00340 
00341 
00342 /** FLAC subframe structure.  (c.f. <A HREF="../format.html#subframe">format specification</A>)
00343  */
00344 typedef struct {
00345     FLAC__SubframeType type;
00346     union {
00347         FLAC__Subframe_Constant constant;
00348         FLAC__Subframe_Fixed fixed;
00349         FLAC__Subframe_LPC lpc;
00350         FLAC__Subframe_Verbatim verbatim;
00351     } data;
00352     unsigned wasted_bits;
00353 } FLAC__Subframe;
00354 
00355 /** == 1 (bit)
00356  *
00357  * This used to be a zero-padding bit (hence the name
00358  * FLAC__SUBFRAME_ZERO_PAD_LEN) but is now a reserved bit.  It still has a
00359  * mandatory value of \c 0 but in the future may take on the value \c 0 or \c 1
00360  * to mean something else.
00361  */
00362 extern FLAC_API const unsigned FLAC__SUBFRAME_ZERO_PAD_LEN;
00363 extern FLAC_API const unsigned FLAC__SUBFRAME_TYPE_LEN; /**< == 6 (bits) */
00364 extern FLAC_API const unsigned FLAC__SUBFRAME_WASTED_BITS_FLAG_LEN; /**< == 1 (bit) */
00365 
00366 extern FLAC_API const unsigned FLAC__SUBFRAME_TYPE_CONSTANT_BYTE_ALIGNED_MASK; /**< = 0x00 */
00367 extern FLAC_API const unsigned FLAC__SUBFRAME_TYPE_VERBATIM_BYTE_ALIGNED_MASK; /**< = 0x02 */
00368 extern FLAC_API const unsigned FLAC__SUBFRAME_TYPE_FIXED_BYTE_ALIGNED_MASK; /**< = 0x10 */
00369 extern FLAC_API const unsigned FLAC__SUBFRAME_TYPE_LPC_BYTE_ALIGNED_MASK; /**< = 0x40 */
00370 
00371 /*****************************************************************************/
00372 
00373 
00374 /*****************************************************************************
00375  *
00376  * Frame structures
00377  *
00378  *****************************************************************************/
00379 
00380 /** An enumeration of the available channel assignments. */
00381 typedef enum {
00382     FLAC__CHANNEL_ASSIGNMENT_INDEPENDENT = 0, /**< independent channels */
00383     FLAC__CHANNEL_ASSIGNMENT_LEFT_SIDE = 1, /**< left+side stereo */
00384     FLAC__CHANNEL_ASSIGNMENT_RIGHT_SIDE = 2, /**< right+side stereo */
00385     FLAC__CHANNEL_ASSIGNMENT_MID_SIDE = 3 /**< mid+side stereo */
00386 } FLAC__ChannelAssignment;
00387 
00388 /** Maps a FLAC__ChannelAssignment to a C string.
00389  *
00390  *  Using a FLAC__ChannelAssignment as the index to this array will
00391  *  give the string equivalent.  The contents should not be modified.
00392  */
00393 extern FLAC_API const char * const FLAC__ChannelAssignmentString[];
00394 
00395 /** An enumeration of the possible frame numbering methods. */
00396 typedef enum {
00397     FLAC__FRAME_NUMBER_TYPE_FRAME_NUMBER, /**< number contains the frame number */
00398     FLAC__FRAME_NUMBER_TYPE_SAMPLE_NUMBER /**< number contains the sample number of first sample in frame */
00399 } FLAC__FrameNumberType;
00400 
00401 /** Maps a FLAC__FrameNumberType to a C string.
00402  *
00403  *  Using a FLAC__FrameNumberType as the index to this array will
00404  *  give the string equivalent.  The contents should not be modified.
00405  */
00406 extern FLAC_API const char * const FLAC__FrameNumberTypeString[];
00407 
00408 
00409 /** FLAC frame header structure.  (c.f. <A HREF="../format.html#frame_header">format specification</A>)
00410  */
00411 typedef struct {
00412     unsigned blocksize;
00413     /**< The number of samples per subframe. */
00414 
00415     unsigned sample_rate;
00416     /**< The sample rate in Hz. */
00417 
00418     unsigned channels;
00419     /**< The number of channels (== number of subframes). */
00420 
00421     FLAC__ChannelAssignment channel_assignment;
00422     /**< The channel assignment for the frame. */
00423 
00424     unsigned bits_per_sample;
00425     /**< The sample resolution. */
00426 
00427     FLAC__FrameNumberType number_type;
00428     /**< The numbering scheme used for the frame.  As a convenience, the
00429      * decoder will always convert a frame number to a sample number because
00430      * the rules are complex. */
00431 
00432     union {
00433         FLAC__uint32 frame_number;
00434         FLAC__uint64 sample_number;
00435     } number;
00436     /**< The frame number or sample number of first sample in frame;
00437      * use the \a number_type value to determine which to use. */
00438 
00439     FLAC__uint8 crc;
00440     /**< CRC-8 (polynomial = x^8 + x^2 + x^1 + x^0, initialized with 0)
00441      * of the raw frame header bytes, meaning everything before the CRC byte
00442      * including the sync code.
00443      */
00444 } FLAC__FrameHeader;
00445 
00446 extern FLAC_API const unsigned FLAC__FRAME_HEADER_SYNC; /**< == 0x3ffe; the frame header sync code */
00447 extern FLAC_API const unsigned FLAC__FRAME_HEADER_SYNC_LEN; /**< == 14 (bits) */
00448 extern FLAC_API const unsigned FLAC__FRAME_HEADER_RESERVED_LEN; /**< == 1 (bits) */
00449 extern FLAC_API const unsigned FLAC__FRAME_HEADER_BLOCKING_STRATEGY_LEN; /**< == 1 (bits) */
00450 extern FLAC_API const unsigned FLAC__FRAME_HEADER_BLOCK_SIZE_LEN; /**< == 4 (bits) */
00451 extern FLAC_API const unsigned FLAC__FRAME_HEADER_SAMPLE_RATE_LEN; /**< == 4 (bits) */
00452 extern FLAC_API const unsigned FLAC__FRAME_HEADER_CHANNEL_ASSIGNMENT_LEN; /**< == 4 (bits) */
00453 extern FLAC_API const unsigned FLAC__FRAME_HEADER_BITS_PER_SAMPLE_LEN; /**< == 3 (bits) */
00454 extern FLAC_API const unsigned FLAC__FRAME_HEADER_ZERO_PAD_LEN; /**< == 1 (bit) */
00455 extern FLAC_API const unsigned FLAC__FRAME_HEADER_CRC_LEN; /**< == 8 (bits) */
00456 
00457 
00458 /** FLAC frame footer structure.  (c.f. <A HREF="../format.html#frame_footer">format specification</A>)
00459  */
00460 typedef struct {
00461     FLAC__uint16 crc;
00462     /**< CRC-16 (polynomial = x^16 + x^15 + x^2 + x^0, initialized with
00463      * 0) of the bytes before the crc, back to and including the frame header
00464      * sync code.
00465      */
00466 } FLAC__FrameFooter;
00467 
00468 extern FLAC_API const unsigned FLAC__FRAME_FOOTER_CRC_LEN; /**< == 16 (bits) */
00469 
00470 
00471 /** FLAC frame structure.  (c.f. <A HREF="../format.html#frame">format specification</A>)
00472  */
00473 typedef struct {
00474     FLAC__FrameHeader header;
00475     FLAC__Subframe subframes[FLAC__MAX_CHANNELS];
00476     FLAC__FrameFooter footer;
00477 } FLAC__Frame;
00478 
00479 /*****************************************************************************/
00480 
00481 
00482 /*****************************************************************************
00483  *
00484  * Meta-data structures
00485  *
00486  *****************************************************************************/
00487 
00488 /** An enumeration of the available metadata block types. */
00489 typedef enum {
00490 
00491     FLAC__METADATA_TYPE_STREAMINFO = 0,
00492     /**< <A HREF="../format.html#metadata_block_streaminfo">STREAMINFO</A> block */
00493 
00494     FLAC__METADATA_TYPE_PADDING = 1,
00495     /**< <A HREF="../format.html#metadata_block_padding">PADDING</A> block */
00496 
00497     FLAC__METADATA_TYPE_APPLICATION = 2,
00498     /**< <A HREF="../format.html#metadata_block_application">APPLICATION</A> block */
00499 
00500     FLAC__METADATA_TYPE_SEEKTABLE = 3,
00501     /**< <A HREF="../format.html#metadata_block_seektable">SEEKTABLE</A> block */
00502 
00503     FLAC__METADATA_TYPE_VORBIS_COMMENT = 4,
00504     /**< <A HREF="../format.html#metadata_block_vorbis_comment">VORBISCOMMENT</A> block (a.k.a. FLAC tags) */
00505 
00506     FLAC__METADATA_TYPE_CUESHEET = 5,
00507     /**< <A HREF="../format.html#metadata_block_cuesheet">CUESHEET</A> block */
00508 
00509     FLAC__METADATA_TYPE_PICTURE = 6,
00510     /**< <A HREF="../format.html#metadata_block_picture">PICTURE</A> block */
00511 
00512     FLAC__METADATA_TYPE_UNDEFINED = 7,
00513     /**< marker to denote beginning of undefined type range; this number will increase as new metadata types are added */
00514 
00515         FLAC__MAX_METADATA_TYPE = FLAC__MAX_METADATA_TYPE_CODE,
00516         /**< No type will ever be greater than this. There is not enough room in the protocol block. */
00517 } FLAC__MetadataType;
00518 
00519 /** Maps a FLAC__MetadataType to a C string.
00520  *
00521  *  Using a FLAC__MetadataType as the index to this array will
00522  *  give the string equivalent.  The contents should not be modified.
00523  */
00524 extern FLAC_API const char * const FLAC__MetadataTypeString[];
00525 
00526 
00527 /** FLAC STREAMINFO structure.  (c.f. <A HREF="../format.html#metadata_block_streaminfo">format specification</A>)
00528  */
00529 typedef struct {
00530     unsigned min_blocksize, max_blocksize;
00531     unsigned min_framesize, max_framesize;
00532     unsigned sample_rate;
00533     unsigned channels;
00534     unsigned bits_per_sample;
00535     FLAC__uint64 total_samples;
00536     FLAC__byte md5sum[16];
00537 } FLAC__StreamMetadata_StreamInfo;
00538 
00539 extern FLAC_API const unsigned FLAC__STREAM_METADATA_STREAMINFO_MIN_BLOCK_SIZE_LEN; /**< == 16 (bits) */
00540 extern FLAC_API const unsigned FLAC__STREAM_METADATA_STREAMINFO_MAX_BLOCK_SIZE_LEN; /**< == 16 (bits) */
00541 extern FLAC_API const unsigned FLAC__STREAM_METADATA_STREAMINFO_MIN_FRAME_SIZE_LEN; /**< == 24 (bits) */
00542 extern FLAC_API const unsigned FLAC__STREAM_METADATA_STREAMINFO_MAX_FRAME_SIZE_LEN; /**< == 24 (bits) */
00543 extern FLAC_API const unsigned FLAC__STREAM_METADATA_STREAMINFO_SAMPLE_RATE_LEN; /**< == 20 (bits) */
00544 extern FLAC_API const unsigned FLAC__STREAM_METADATA_STREAMINFO_CHANNELS_LEN; /**< == 3 (bits) */
00545 extern FLAC_API const unsigned FLAC__STREAM_METADATA_STREAMINFO_BITS_PER_SAMPLE_LEN; /**< == 5 (bits) */
00546 extern FLAC_API const unsigned FLAC__STREAM_METADATA_STREAMINFO_TOTAL_SAMPLES_LEN; /**< == 36 (bits) */
00547 extern FLAC_API const unsigned FLAC__STREAM_METADATA_STREAMINFO_MD5SUM_LEN; /**< == 128 (bits) */
00548 
00549 /** The total stream length of the STREAMINFO block in bytes. */
00550 #define FLAC__STREAM_METADATA_STREAMINFO_LENGTH (34u)
00551 
00552 /** FLAC PADDING structure.  (c.f. <A HREF="../format.html#metadata_block_padding">format specification</A>)
00553  */
00554 typedef struct {
00555     int dummy;
00556     /**< Conceptually this is an empty struct since we don't store the
00557      * padding bytes.  Empty structs are not allowed by some C compilers,
00558      * hence the dummy.
00559      */
00560 } FLAC__StreamMetadata_Padding;
00561 
00562 
00563 /** FLAC APPLICATION structure.  (c.f. <A HREF="../format.html#metadata_block_application">format specification</A>)
00564  */
00565 typedef struct {
00566     FLAC__byte id[4];
00567     FLAC__byte *data;
00568 } FLAC__StreamMetadata_Application;
00569 
00570 extern FLAC_API const unsigned FLAC__STREAM_METADATA_APPLICATION_ID_LEN; /**< == 32 (bits) */
00571 
00572 /** SeekPoint structure used in SEEKTABLE blocks.  (c.f. <A HREF="../format.html#seekpoint">format specification</A>)
00573  */
00574 typedef struct {
00575     FLAC__uint64 sample_number;
00576     /**<  The sample number of the target frame. */
00577 
00578     FLAC__uint64 stream_offset;
00579     /**< The offset, in bytes, of the target frame with respect to
00580      * beginning of the first frame. */
00581 
00582     unsigned frame_samples;
00583     /**< The number of samples in the target frame. */
00584 } FLAC__StreamMetadata_SeekPoint;
00585 
00586 extern FLAC_API const unsigned FLAC__STREAM_METADATA_SEEKPOINT_SAMPLE_NUMBER_LEN; /**< == 64 (bits) */
00587 extern FLAC_API const unsigned FLAC__STREAM_METADATA_SEEKPOINT_STREAM_OFFSET_LEN; /**< == 64 (bits) */
00588 extern FLAC_API const unsigned FLAC__STREAM_METADATA_SEEKPOINT_FRAME_SAMPLES_LEN; /**< == 16 (bits) */
00589 
00590 /** The total stream length of a seek point in bytes. */
00591 #define FLAC__STREAM_METADATA_SEEKPOINT_LENGTH (18u)
00592 
00593 /** The value used in the \a sample_number field of
00594  *  FLAC__StreamMetadataSeekPoint used to indicate a placeholder
00595  *  point (== 0xffffffffffffffff).
00596  */
00597 extern FLAC_API const FLAC__uint64 FLAC__STREAM_METADATA_SEEKPOINT_PLACEHOLDER;
00598 
00599 
00600 /** FLAC SEEKTABLE structure.  (c.f. <A HREF="../format.html#metadata_block_seektable">format specification</A>)
00601  *
00602  * \note From the format specification:
00603  * - The seek points must be sorted by ascending sample number.
00604  * - Each seek point's sample number must be the first sample of the
00605  *   target frame.
00606  * - Each seek point's sample number must be unique within the table.
00607  * - Existence of a SEEKTABLE block implies a correct setting of
00608  *   total_samples in the stream_info block.
00609  * - Behavior is undefined when more than one SEEKTABLE block is
00610  *   present in a stream.
00611  */
00612 typedef struct {
00613     unsigned num_points;
00614     FLAC__StreamMetadata_SeekPoint *points;
00615 } FLAC__StreamMetadata_SeekTable;
00616 
00617 
00618 /** Vorbis comment entry structure used in VORBIS_COMMENT blocks.  (c.f. <A HREF="../format.html#metadata_block_vorbis_comment">format specification</A>)
00619  *
00620  *  For convenience, the APIs maintain a trailing NUL character at the end of
00621  *  \a entry which is not counted toward \a length, i.e.
00622  *  \code strlen(entry) == length \endcode
00623  */
00624 typedef struct {
00625     FLAC__uint32 length;
00626     FLAC__byte *entry;
00627 } FLAC__StreamMetadata_VorbisComment_Entry;
00628 
00629 extern FLAC_API const unsigned FLAC__STREAM_METADATA_VORBIS_COMMENT_ENTRY_LENGTH_LEN; /**< == 32 (bits) */
00630 
00631 
00632 /** FLAC VORBIS_COMMENT structure.  (c.f. <A HREF="../format.html#metadata_block_vorbis_comment">format specification</A>)
00633  */
00634 typedef struct {
00635     FLAC__StreamMetadata_VorbisComment_Entry vendor_string;
00636     FLAC__uint32 num_comments;
00637     FLAC__StreamMetadata_VorbisComment_Entry *comments;
00638 } FLAC__StreamMetadata_VorbisComment;
00639 
00640 extern FLAC_API const unsigned FLAC__STREAM_METADATA_VORBIS_COMMENT_NUM_COMMENTS_LEN; /**< == 32 (bits) */
00641 
00642 
00643 /** FLAC CUESHEET track index structure.  (See the
00644  * <A HREF="../format.html#cuesheet_track_index">format specification</A> for
00645  * the full description of each field.)
00646  */
00647 typedef struct {
00648     FLAC__uint64 offset;
00649     /**< Offset in samples, relative to the track offset, of the index
00650      * point.
00651      */
00652 
00653     FLAC__byte number;
00654     /**< The index point number. */
00655 } FLAC__StreamMetadata_CueSheet_Index;
00656 
00657 extern FLAC_API const unsigned FLAC__STREAM_METADATA_CUESHEET_INDEX_OFFSET_LEN; /**< == 64 (bits) */
00658 extern FLAC_API const unsigned FLAC__STREAM_METADATA_CUESHEET_INDEX_NUMBER_LEN; /**< == 8 (bits) */
00659 extern FLAC_API const unsigned FLAC__STREAM_METADATA_CUESHEET_INDEX_RESERVED_LEN; /**< == 3*8 (bits) */
00660 
00661 
00662 /** FLAC CUESHEET track structure.  (See the
00663  * <A HREF="../format.html#cuesheet_track">format specification</A> for
00664  * the full description of each field.)
00665  */
00666 typedef struct {
00667     FLAC__uint64 offset;
00668     /**< Track offset in samples, relative to the beginning of the FLAC audio stream. */
00669 
00670     FLAC__byte number;
00671     /**< The track number. */
00672 
00673     char isrc[13];
00674     /**< Track ISRC.  This is a 12-digit alphanumeric code plus a trailing \c NUL byte */
00675 
00676     unsigned type:1;
00677     /**< The track type: 0 for audio, 1 for non-audio. */
00678 
00679     unsigned pre_emphasis:1;
00680     /**< The pre-emphasis flag: 0 for no pre-emphasis, 1 for pre-emphasis. */
00681 
00682     FLAC__byte num_indices;
00683     /**< The number of track index points. */
00684 
00685     FLAC__StreamMetadata_CueSheet_Index *indices;
00686     /**< NULL if num_indices == 0, else pointer to array of index points. */
00687 
00688 } FLAC__StreamMetadata_CueSheet_Track;
00689 
00690 extern FLAC_API const unsigned FLAC__STREAM_METADATA_CUESHEET_TRACK_OFFSET_LEN; /**< == 64 (bits) */
00691 extern FLAC_API const unsigned FLAC__STREAM_METADATA_CUESHEET_TRACK_NUMBER_LEN; /**< == 8 (bits) */
00692 extern FLAC_API const unsigned FLAC__STREAM_METADATA_CUESHEET_TRACK_ISRC_LEN; /**< == 12*8 (bits) */
00693 extern FLAC_API const unsigned FLAC__STREAM_METADATA_CUESHEET_TRACK_TYPE_LEN; /**< == 1 (bit) */
00694 extern FLAC_API const unsigned FLAC__STREAM_METADATA_CUESHEET_TRACK_PRE_EMPHASIS_LEN; /**< == 1 (bit) */
00695 extern FLAC_API const unsigned FLAC__STREAM_METADATA_CUESHEET_TRACK_RESERVED_LEN; /**< == 6+13*8 (bits) */
00696 extern FLAC_API const unsigned FLAC__STREAM_METADATA_CUESHEET_TRACK_NUM_INDICES_LEN; /**< == 8 (bits) */
00697 
00698 
00699 /** FLAC CUESHEET structure.  (See the
00700  * <A HREF="../format.html#metadata_block_cuesheet">format specification</A>
00701  * for the full description of each field.)
00702  */
00703 typedef struct {
00704     char media_catalog_number[129];
00705     /**< Media catalog number, in ASCII printable characters 0x20-0x7e.  In
00706      * general, the media catalog number may be 0 to 128 bytes long; any
00707      * unused characters should be right-padded with NUL characters.
00708      */
00709 
00710     FLAC__uint64 lead_in;
00711     /**< The number of lead-in samples. */
00712 
00713     FLAC__bool is_cd;
00714     /**< \c true if CUESHEET corresponds to a Compact Disc, else \c false. */
00715 
00716     unsigned num_tracks;
00717     /**< The number of tracks. */
00718 
00719     FLAC__StreamMetadata_CueSheet_Track *tracks;
00720     /**< NULL if num_tracks == 0, else pointer to array of tracks. */
00721 
00722 } FLAC__StreamMetadata_CueSheet;
00723 
00724 extern FLAC_API const unsigned FLAC__STREAM_METADATA_CUESHEET_MEDIA_CATALOG_NUMBER_LEN; /**< == 128*8 (bits) */
00725 extern FLAC_API const unsigned FLAC__STREAM_METADATA_CUESHEET_LEAD_IN_LEN; /**< == 64 (bits) */
00726 extern FLAC_API const unsigned FLAC__STREAM_METADATA_CUESHEET_IS_CD_LEN; /**< == 1 (bit) */
00727 extern FLAC_API const unsigned FLAC__STREAM_METADATA_CUESHEET_RESERVED_LEN; /**< == 7+258*8 (bits) */
00728 extern FLAC_API const unsigned FLAC__STREAM_METADATA_CUESHEET_NUM_TRACKS_LEN; /**< == 8 (bits) */
00729 
00730 
00731 /** An enumeration of the PICTURE types (see FLAC__StreamMetadataPicture and id3 v2.4 APIC tag). */
00732 typedef enum {
00733     FLAC__STREAM_METADATA_PICTURE_TYPE_OTHER = 0, /**< Other */
00734     FLAC__STREAM_METADATA_PICTURE_TYPE_FILE_ICON_STANDARD = 1, /**< 32x32 pixels 'file icon' (PNG only) */
00735     FLAC__STREAM_METADATA_PICTURE_TYPE_FILE_ICON = 2, /**< Other file icon */
00736     FLAC__STREAM_METADATA_PICTURE_TYPE_FRONT_COVER = 3, /**< Cover (front) */
00737     FLAC__STREAM_METADATA_PICTURE_TYPE_BACK_COVER = 4, /**< Cover (back) */
00738     FLAC__STREAM_METADATA_PICTURE_TYPE_LEAFLET_PAGE = 5, /**< Leaflet page */
00739     FLAC__STREAM_METADATA_PICTURE_TYPE_MEDIA = 6, /**< Media (e.g. label side of CD) */
00740     FLAC__STREAM_METADATA_PICTURE_TYPE_LEAD_ARTIST = 7, /**< Lead artist/lead performer/soloist */
00741     FLAC__STREAM_METADATA_PICTURE_TYPE_ARTIST = 8, /**< Artist/performer */
00742     FLAC__STREAM_METADATA_PICTURE_TYPE_CONDUCTOR = 9, /**< Conductor */
00743     FLAC__STREAM_METADATA_PICTURE_TYPE_BAND = 10, /**< Band/Orchestra */
00744     FLAC__STREAM_METADATA_PICTURE_TYPE_COMPOSER = 11, /**< Composer */
00745     FLAC__STREAM_METADATA_PICTURE_TYPE_LYRICIST = 12, /**< Lyricist/text writer */
00746     FLAC__STREAM_METADATA_PICTURE_TYPE_RECORDING_LOCATION = 13, /**< Recording Location */
00747     FLAC__STREAM_METADATA_PICTURE_TYPE_DURING_RECORDING = 14, /**< During recording */
00748     FLAC__STREAM_METADATA_PICTURE_TYPE_DURING_PERFORMANCE = 15, /**< During performance */
00749     FLAC__STREAM_METADATA_PICTURE_TYPE_VIDEO_SCREEN_CAPTURE = 16, /**< Movie/video screen capture */
00750     FLAC__STREAM_METADATA_PICTURE_TYPE_FISH = 17, /**< A bright coloured fish */
00751     FLAC__STREAM_METADATA_PICTURE_TYPE_ILLUSTRATION = 18, /**< Illustration */
00752     FLAC__STREAM_METADATA_PICTURE_TYPE_BAND_LOGOTYPE = 19, /**< Band/artist logotype */
00753     FLAC__STREAM_METADATA_PICTURE_TYPE_PUBLISHER_LOGOTYPE = 20, /**< Publisher/Studio logotype */
00754     FLAC__STREAM_METADATA_PICTURE_TYPE_UNDEFINED
00755 } FLAC__StreamMetadata_Picture_Type;
00756 
00757 /** Maps a FLAC__StreamMetadata_Picture_Type to a C string.
00758  *
00759  *  Using a FLAC__StreamMetadata_Picture_Type as the index to this array
00760  *  will give the string equivalent.  The contents should not be
00761  *  modified.
00762  */
00763 extern FLAC_API const char * const FLAC__StreamMetadata_Picture_TypeString[];
00764 
00765 /** FLAC PICTURE structure.  (See the
00766  * <A HREF="../format.html#metadata_block_picture">format specification</A>
00767  * for the full description of each field.)
00768  */
00769 typedef struct {
00770     FLAC__StreamMetadata_Picture_Type type;
00771     /**< The kind of picture stored. */
00772 
00773     char *mime_type;
00774     /**< Picture data's MIME type, in ASCII printable characters
00775      * 0x20-0x7e, NUL terminated.  For best compatibility with players,
00776      * use picture data of MIME type \c image/jpeg or \c image/png.  A
00777      * MIME type of '-->' is also allowed, in which case the picture
00778      * data should be a complete URL.  In file storage, the MIME type is
00779      * stored as a 32-bit length followed by the ASCII string with no NUL
00780      * terminator, but is converted to a plain C string in this structure
00781      * for convenience.
00782      */
00783 
00784     FLAC__byte *description;
00785     /**< Picture's description in UTF-8, NUL terminated.  In file storage,
00786      * the description is stored as a 32-bit length followed by the UTF-8
00787      * string with no NUL terminator, but is converted to a plain C string
00788      * in this structure for convenience.
00789      */
00790 
00791     FLAC__uint32 width;
00792     /**< Picture's width in pixels. */
00793 
00794     FLAC__uint32 height;
00795     /**< Picture's height in pixels. */
00796 
00797     FLAC__uint32 depth;
00798     /**< Picture's color depth in bits-per-pixel. */
00799 
00800     FLAC__uint32 colors;
00801     /**< For indexed palettes (like GIF), picture's number of colors (the
00802      * number of palette entries), or \c 0 for non-indexed (i.e. 2^depth).
00803      */
00804 
00805     FLAC__uint32 data_length;
00806     /**< Length of binary picture data in bytes. */
00807 
00808     FLAC__byte *data;
00809     /**< Binary picture data. */
00810 
00811 } FLAC__StreamMetadata_Picture;
00812 
00813 extern FLAC_API const unsigned FLAC__STREAM_METADATA_PICTURE_TYPE_LEN; /**< == 32 (bits) */
00814 extern FLAC_API const unsigned FLAC__STREAM_METADATA_PICTURE_MIME_TYPE_LENGTH_LEN; /**< == 32 (bits) */
00815 extern FLAC_API const unsigned FLAC__STREAM_METADATA_PICTURE_DESCRIPTION_LENGTH_LEN; /**< == 32 (bits) */
00816 extern FLAC_API const unsigned FLAC__STREAM_METADATA_PICTURE_WIDTH_LEN; /**< == 32 (bits) */
00817 extern FLAC_API const unsigned FLAC__STREAM_METADATA_PICTURE_HEIGHT_LEN; /**< == 32 (bits) */
00818 extern FLAC_API const unsigned FLAC__STREAM_METADATA_PICTURE_DEPTH_LEN; /**< == 32 (bits) */
00819 extern FLAC_API const unsigned FLAC__STREAM_METADATA_PICTURE_COLORS_LEN; /**< == 32 (bits) */
00820 extern FLAC_API const unsigned FLAC__STREAM_METADATA_PICTURE_DATA_LENGTH_LEN; /**< == 32 (bits) */
00821 
00822 
00823 /** Structure that is used when a metadata block of unknown type is loaded.
00824  *  The contents are opaque.  The structure is used only internally to
00825  *  correctly handle unknown metadata.
00826  */
00827 typedef struct {
00828     FLAC__byte *data;
00829 } FLAC__StreamMetadata_Unknown;
00830 
00831 
00832 /** FLAC metadata block structure.  (c.f. <A HREF="../format.html#metadata_block">format specification</A>)
00833  */
00834 typedef struct {
00835     FLAC__MetadataType type;
00836     /**< The type of the metadata block; used determine which member of the
00837      * \a data union to dereference.  If type >= FLAC__METADATA_TYPE_UNDEFINED
00838      * then \a data.unknown must be used. */
00839 
00840     FLAC__bool is_last;
00841     /**< \c true if this metadata block is the last, else \a false */
00842 
00843     unsigned length;
00844     /**< Length, in bytes, of the block data as it appears in the stream. */
00845 
00846     union {
00847         FLAC__StreamMetadata_StreamInfo stream_info;
00848         FLAC__StreamMetadata_Padding padding;
00849         FLAC__StreamMetadata_Application application;
00850         FLAC__StreamMetadata_SeekTable seek_table;
00851         FLAC__StreamMetadata_VorbisComment vorbis_comment;
00852         FLAC__StreamMetadata_CueSheet cue_sheet;
00853         FLAC__StreamMetadata_Picture picture;
00854         FLAC__StreamMetadata_Unknown unknown;
00855     } data;
00856     /**< Polymorphic block data; use the \a type value to determine which
00857      * to use. */
00858 } FLAC__StreamMetadata;
00859 
00860 extern FLAC_API const unsigned FLAC__STREAM_METADATA_IS_LAST_LEN; /**< == 1 (bit) */
00861 extern FLAC_API const unsigned FLAC__STREAM_METADATA_TYPE_LEN; /**< == 7 (bits) */
00862 extern FLAC_API const unsigned FLAC__STREAM_METADATA_LENGTH_LEN; /**< == 24 (bits) */
00863 
00864 /** The total stream length of a metadata block header in bytes. */
00865 #define FLAC__STREAM_METADATA_HEADER_LENGTH (4u)
00866 
00867 /*****************************************************************************/
00868 
00869 
00870 /*****************************************************************************
00871  *
00872  * Utility functions
00873  *
00874  *****************************************************************************/
00875 
00876 /** Tests that a sample rate is valid for FLAC.
00877  *
00878  * \param sample_rate  The sample rate to test for compliance.
00879  * \retval FLAC__bool
00880  *    \c true if the given sample rate conforms to the specification, else
00881  *    \c false.
00882  */
00883 FLAC_API FLAC__bool FLAC__format_sample_rate_is_valid(unsigned sample_rate);
00884 
00885 /** Tests that a blocksize at the given sample rate is valid for the FLAC
00886  *  subset.
00887  *
00888  * \param blocksize    The blocksize to test for compliance.
00889  * \param sample_rate  The sample rate is needed, since the valid subset
00890  *                     blocksize depends on the sample rate.
00891  * \retval FLAC__bool
00892  *    \c true if the given blocksize conforms to the specification for the
00893  *    subset at the given sample rate, else \c false.
00894  */
00895 FLAC_API FLAC__bool FLAC__format_blocksize_is_subset(unsigned blocksize, unsigned sample_rate);
00896 
00897 /** Tests that a sample rate is valid for the FLAC subset.  The subset rules
00898  *  for valid sample rates are slightly more complex since the rate has to
00899  *  be expressible completely in the frame header.
00900  *
00901  * \param sample_rate  The sample rate to test for compliance.
00902  * \retval FLAC__bool
00903  *    \c true if the given sample rate conforms to the specification for the
00904  *    subset, else \c false.
00905  */
00906 FLAC_API FLAC__bool FLAC__format_sample_rate_is_subset(unsigned sample_rate);
00907 
00908 /** Check a Vorbis comment entry name to see if it conforms to the Vorbis
00909  *  comment specification.
00910  *
00911  *  Vorbis comment names must be composed only of characters from
00912  *  [0x20-0x3C,0x3E-0x7D].
00913  *
00914  * \param name       A NUL-terminated string to be checked.
00915  * \assert
00916  *    \code name != NULL \endcode
00917  * \retval FLAC__bool
00918  *    \c false if entry name is illegal, else \c true.
00919  */
00920 FLAC_API FLAC__bool FLAC__format_vorbiscomment_entry_name_is_legal(const char *name);
00921 
00922 /** Check a Vorbis comment entry value to see if it conforms to the Vorbis
00923  *  comment specification.
00924  *
00925  *  Vorbis comment values must be valid UTF-8 sequences.
00926  *
00927  * \param value      A string to be checked.
00928  * \param length     A the length of \a value in bytes.  May be
00929  *                   \c (unsigned)(-1) to indicate that \a value is a plain
00930  *                   UTF-8 NUL-terminated string.
00931  * \assert
00932  *    \code value != NULL \endcode
00933  * \retval FLAC__bool
00934  *    \c false if entry name is illegal, else \c true.
00935  */
00936 FLAC_API FLAC__bool FLAC__format_vorbiscomment_entry_value_is_legal(const FLAC__byte *value, unsigned length);
00937 
00938 /** Check a Vorbis comment entry to see if it conforms to the Vorbis
00939  *  comment specification.
00940  *
00941  *  Vorbis comment entries must be of the form 'name=value', and 'name' and
00942  *  'value' must be legal according to
00943  *  FLAC__format_vorbiscomment_entry_name_is_legal() and
00944  *  FLAC__format_vorbiscomment_entry_value_is_legal() respectively.
00945  *
00946  * \param entry      An entry to be checked.
00947  * \param length     The length of \a entry in bytes.
00948  * \assert
00949  *    \code value != NULL \endcode
00950  * \retval FLAC__bool
00951  *    \c false if entry name is illegal, else \c true.
00952  */
00953 FLAC_API FLAC__bool FLAC__format_vorbiscomment_entry_is_legal(const FLAC__byte *entry, unsigned length);
00954 
00955 /** Check a seek table to see if it conforms to the FLAC specification.
00956  *  See the format specification for limits on the contents of the
00957  *  seek table.
00958  *
00959  * \param seek_table  A pointer to a seek table to be checked.
00960  * \assert
00961  *    \code seek_table != NULL \endcode
00962  * \retval FLAC__bool
00963  *    \c false if seek table is illegal, else \c true.
00964  */
00965 FLAC_API FLAC__bool FLAC__format_seektable_is_legal(const FLAC__StreamMetadata_SeekTable *seek_table);
00966 
00967 /** Sort a seek table's seek points according to the format specification.
00968  *  This includes a "unique-ification" step to remove duplicates, i.e.
00969  *  seek points with identical \a sample_number values.  Duplicate seek
00970  *  points are converted into placeholder points and sorted to the end of
00971  *  the table.
00972  *
00973  * \param seek_table  A pointer to a seek table to be sorted.
00974  * \assert
00975  *    \code seek_table != NULL \endcode
00976  * \retval unsigned
00977  *    The number of duplicate seek points converted into placeholders.
00978  */
00979 FLAC_API unsigned FLAC__format_seektable_sort(FLAC__StreamMetadata_SeekTable *seek_table);
00980 
00981 /** Check a cue sheet to see if it conforms to the FLAC specification.
00982  *  See the format specification for limits on the contents of the
00983  *  cue sheet.
00984  *
00985  * \param cue_sheet  A pointer to an existing cue sheet to be checked.
00986  * \param check_cd_da_subset  If \c true, check CUESHEET against more
00987  *                   stringent requirements for a CD-DA (audio) disc.
00988  * \param violation  Address of a pointer to a string.  If there is a
00989  *                   violation, a pointer to a string explanation of the
00990  *                   violation will be returned here. \a violation may be
00991  *                   \c NULL if you don't need the returned string.  Do not
00992  *                   free the returned string; it will always point to static
00993  *                   data.
00994  * \assert
00995  *    \code cue_sheet != NULL \endcode
00996  * \retval FLAC__bool
00997  *    \c false if cue sheet is illegal, else \c true.
00998  */
00999 FLAC_API FLAC__bool FLAC__format_cuesheet_is_legal(const FLAC__StreamMetadata_CueSheet *cue_sheet, FLAC__bool check_cd_da_subset, const char **violation);
01000 
01001 /** Check picture data to see if it conforms to the FLAC specification.
01002  *  See the format specification for limits on the contents of the
01003  *  PICTURE block.
01004  *
01005  * \param picture    A pointer to existing picture data to be checked.
01006  * \param violation  Address of a pointer to a string.  If there is a
01007  *                   violation, a pointer to a string explanation of the
01008  *                   violation will be returned here. \a violation may be
01009  *                   \c NULL if you don't need the returned string.  Do not
01010  *                   free the returned string; it will always point to static
01011  *                   data.
01012  * \assert
01013  *    \code picture != NULL \endcode
01014  * \retval FLAC__bool
01015  *    \c false if picture data is illegal, else \c true.
01016  */
01017 FLAC_API FLAC__bool FLAC__format_picture_is_legal(const FLAC__StreamMetadata_Picture *picture, const char **violation);
01018 
01019 /* \} */
01020 
01021 #ifdef __cplusplus
01022 }
01023 #endif
01024 
01025 #endif