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

Dependencies:   GR-PEACH_video R_BSP TLV320_RBSP USBHost_custom

Fork of GR-PEACH_Audio_Playback_Sample by Renesas

Note

For a sample program of without LCD Board, please refer to GR-PEACH_Audio_Playback_Sample.

Introduction

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

1. Overview of the Sample Code

1.1 Software Block Diagram

Figure 1.1 shows the software block diagram.

/media/uploads/1050186/lcd_figure1_1.png

1.2 Pin Definitions

Table 1.1 shows the pins used in this sample code.

/media/uploads/1050186/lcd_table1_1.png

2. Sample Code Operating Environment

In order to operate this sample code, GR-PEACH, Audio Camera Shield and 7.1 inch LCD Shield must be needed. For details on Audio Camera Shield and 7.1 inch LCD Shield, please refer to the following links, respectively:

In this section, it is described that how board is configured and to control audio playback via command line and touch screen.

2.1 Operating Environment

Figure 2.1 shows the overview of the operating environment for this sample code.

/media/uploads/1050186/lcd_figure2_1.png

Figure 2.2 and 2.3 show how to configure GR-PEACH, Audio Camera Shield and 7.1 inch LCD shield when using USB0 and USB1, respectively.

/media/uploads/1050186/lcd_figure2_2.png /media/uploads/1050186/lcd_figure2_3.png

Table 2.1 lists the overview of Graphical User Interface (GUI) of this sample code.

/media/uploads/1050186/lcd_table2_1.png

2.2 List of User Operations

Table 2.2 shows the relationship among Audio Playback, Command Line and Onboard Switch.

/media/uploads/1050186/lcd_table2_2.png

3. Function Outline

Table 3.1, 3.2 and 3.3 shows the overview of functions implemented in this sample code.

/media/uploads/1050186/lcd_table3_1.png /media/uploads/1050186/lcd_table3_2.png /media/uploads/1050186/lcd_table3_3.png /media/uploads/1050186/lcd_figure3_1.png

3.1 Playback Control

This sample program supports the operation "play", "pause", "stop", "play next song" and "play previous song".

3.2 Trick Play Control

In order to enable/disable Repeat Mode, user need to type "repeat" on command line or click the corresponding icon shown in Table 2.2. By derault, Repeat Mode is enabled. When Repeat Mode is enabled, the first song is played back after the playback of the last song is finished. Otherwise, the playback is shopped when finishing to play back the last song.

3.3 How to see Song Information

The information of the song being played back can be seen by typing playinfo on command line. Table 3.4 lists the items user can see on the terminal.

/media/uploads/dkato/audioplayback_table3_4.png

3.4 How to analyze the folder structure in USB stick

In this sample code, the folder structure in USB stick is analyzed in the breadth-first order. Table 3.5 shows how the files in USB stick are numbered.

/media/uploads/dkato/audioplayback_table3_5.png

4.Others

4.1 Serial Communication Setting

With respect to the default serial communication related setting on mbed, please refer to the follwing link:
https://developer.mbed.org/teams/Renesas/wiki/GR-PEACH-Getting-Started#install-the-usb-serial-communication
Please set up the terminal software you would like to use on your PC in consideration of the above. For example, 9600 should be specified for the baud rate on the terminal in order to control this sample via command line.

4.2 Necessary modification when using GCC ARM Embedded

If you would like to use GCC ARM Embedded, you must revise the following linker script incorporated in mbed OS 5 package as follows:

  • Linker Script to be modified
    $(PROJECT_ROOT)/mbed-os/targets/TARGET_RENESAS/TARGET_RZ_A1H/device/TOOLCHAIN_GCC_ARM/RZA1H.ld

    Please note that $(PROJECT_ROOT) in the above denotes the root directory of this sample code

  • Before Modification

RZA1H.ld

/* Linker script for mbed RZ_A1H */

/* Linker script to configure memory regions. */
MEMORY
{
  ROM   (rx)  : ORIGIN = 0x00000000, LENGTH = 0x02000000
  BOOT_LOADER (rx) : ORIGIN = 0x18000000, LENGTH = 0x00004000 
  SFLASH (rx) : ORIGIN = 0x18004000, LENGTH = 0x07FFC000 
  L_TTB (rw)  : ORIGIN = 0x20000000, LENGTH = 0x00004000 
  RAM (rwx) : ORIGIN = 0x20020000, LENGTH = 0x00700000
  RAM_NC (rwx) : ORIGIN = 0x20900000, LENGTH = 0x00100000
}
(snip)
  • After Modification

RZA1H.ld

/* Linker script for mbed RZ_A1H */

/* Linker script to configure memory regions. */
MEMORY
{
  ROM   (rx)  : ORIGIN = 0x00000000, LENGTH = 0x02000000
  BOOT_LOADER (rx) : ORIGIN = 0x18000000, LENGTH = 0x00004000 
  SFLASH (rx) : ORIGIN = 0x18004000, LENGTH = 0x07FFC000 
  L_TTB (rw)  : ORIGIN = 0x20000000, LENGTH = 0x00004000 
  RAM (rwx) : ORIGIN = 0x20020000, LENGTH = 0x00180000
  RAM_NC (rwx) : ORIGIN = 0x20200000, LENGTH = 0x00680000
}
(snip)
Committer:
Osamu Nakamura
Date:
Tue Apr 11 12:42:10 2017 +0900
Revision:
6:a957aaa284f0
Parent:
0:ee40da884cfc
Update R-BSP from rev. cbb9d60c8748 to fb9eda52224e so that this program can be compiled with IAR toolchain.

Who changed what in which revision?

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