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