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