new flac + fix protoc

This commit is contained in:
philippe44
2023-03-27 23:38:33 -07:00
parent 31184b6946
commit e070965990
20 changed files with 544 additions and 1584 deletions

View File

@@ -1,6 +1,6 @@
/* libFLAC - Free Lossless Audio Codec library /* libFLAC - Free Lossless Audio Codec library
* Copyright (C) 2000-2009 Josh Coalson * Copyright (C) 2000-2009 Josh Coalson
* Copyright (C) 2011-2014 Xiph.Org Foundation * Copyright (C) 2011-2022 Xiph.Org Foundation
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions * modification, are permitted provided that the following conditions
@@ -35,8 +35,8 @@
#include "export.h" #include "export.h"
#include "assert.h"
#include "callback.h" #include "callback.h"
#include "flac_assert.h"
#include "format.h" #include "format.h"
#include "metadata.h" #include "metadata.h"
#include "ordinals.h" #include "ordinals.h"
@@ -52,7 +52,7 @@
* level idea of the structure and how to find the information you * level idea of the structure and how to find the information you
* need. As a prerequisite you should have at least a basic * need. As a prerequisite you should have at least a basic
* knowledge of the FLAC format, documented * knowledge of the FLAC format, documented
* <A HREF="../format.html">here</A>. * <A HREF="https://xiph.org/flac/format.html">here</A>.
* *
* \section c_api FLAC C API * \section c_api FLAC C API
* *
@@ -64,7 +64,7 @@
* *
* By writing a little code and linking against libFLAC, it is * By writing a little code and linking against libFLAC, it is
* relatively easy to add FLAC support to another program. The * relatively easy to add FLAC support to another program. The
* library is licensed under <A HREF="../license.html">Xiph's BSD license</A>. * library is licensed under <A HREF="https://xiph.org/flac/license.html">Xiph's BSD license</A>.
* Complete source code of libFLAC as well as the command-line * Complete source code of libFLAC as well as the command-line
* encoder and plugins is available and is a useful source of * encoder and plugins is available and is a useful source of
* examples. * examples.
@@ -97,7 +97,7 @@
* example /usr/include/FLAC++/...). * example /usr/include/FLAC++/...).
* *
* libFLAC++ is also licensed under * libFLAC++ is also licensed under
* <A HREF="../license.html">Xiph's BSD license</A>. * <A HREF="https://xiph.org/flac/license.html">Xiph's BSD license</A>.
* *
* \section getting_started Getting Started * \section getting_started Getting Started
* *
@@ -113,7 +113,7 @@
* functions through the links in top bar across this page. * functions through the links in top bar across this page.
* *
* If you prefer a more hands-on approach, you can jump right to some * If you prefer a more hands-on approach, you can jump right to some
* <A HREF="../documentation_example_code.html">example code</A>. * <A HREF="https://xiph.org/flac/documentation_example_code.html">example code</A>.
* *
* \section porting_guide Porting Guide * \section porting_guide Porting Guide
* *
@@ -147,7 +147,7 @@
* library. * library.
* *
* Also, there are several places in the libFLAC code with comments marked * Also, there are several places in the libFLAC code with comments marked
* with "OPT:" where a #define can be changed to enable code that might be * with "OPT:" where a \#define can be changed to enable code that might be
* faster on a specific platform. Experimenting with these can yield faster * faster on a specific platform. Experimenting with these can yield faster
* binaries. * binaries.
*/ */
@@ -159,9 +159,9 @@
* the libraries to newer versions of FLAC. * the libraries to newer versions of FLAC.
* *
* One simple facility for making porting easier that has been added * One simple facility for making porting easier that has been added
* in FLAC 1.1.3 is a set of \c #defines in \c export.h of each * in FLAC 1.1.3 is a set of \#defines in \c export.h of each
* library's includes (e.g. \c include/FLAC/export.h). The * library's includes (e.g. \c include/FLAC/export.h). The
* \c #defines mirror the libraries' * \#defines mirror the libraries'
* <A HREF="http://www.gnu.org/software/libtool/manual/libtool.html#Libtool-versioning">libtool version numbers</A>, * <A HREF="http://www.gnu.org/software/libtool/manual/libtool.html#Libtool-versioning">libtool version numbers</A>,
* e.g. in libFLAC there are \c FLAC_API_VERSION_CURRENT, * e.g. in libFLAC there are \c FLAC_API_VERSION_CURRENT,
* \c FLAC_API_VERSION_REVISION, and \c FLAC_API_VERSION_AGE. * \c FLAC_API_VERSION_REVISION, and \c FLAC_API_VERSION_AGE.
@@ -176,7 +176,7 @@
* #endif * #endif
* \endcode * \endcode
* *
* The the source will work for multiple versions and the legacy code can * The source will work for multiple versions and the legacy code can
* easily be removed when the transition is complete. * easily be removed when the transition is complete.
* *
* Another available symbol is FLAC_API_SUPPORTS_OGG_FLAC (defined in * Another available symbol is FLAC_API_SUPPORTS_OGG_FLAC (defined in
@@ -321,7 +321,7 @@
* *
* The \a bytes parameter to FLAC__StreamDecoderReadCallback, * The \a bytes parameter to FLAC__StreamDecoderReadCallback,
* FLAC__StreamEncoderReadCallback, and FLAC__StreamEncoderWriteCallback * FLAC__StreamEncoderReadCallback, and FLAC__StreamEncoderWriteCallback
* is now \c size_t instead of \c unsigned. * is now \c size_t instead of \c uint32_t.
*/ */
/** \defgroup porting_1_1_3_to_1_1_4 Porting from FLAC 1.1.3 to 1.1.4 /** \defgroup porting_1_1_3_to_1_1_4 Porting from FLAC 1.1.3 to 1.1.4
@@ -357,6 +357,85 @@
* \c FLAC__FRAME_HEADER_BLOCKING_STRATEGY_LEN * \c FLAC__FRAME_HEADER_BLOCKING_STRATEGY_LEN
*/ */
/** \defgroup porting_1_3_4_to_1_4_0 Porting from FLAC 1.3.4 to 1.4.0
* \ingroup porting
*
* \brief
* This module describes porting from FLAC 1.3.4 to FLAC 1.4.0.
*
* \section porting_1_3_4_to_1_4_0_summary Summary
*
* Between FLAC 1.3.4 and FLAC 1.4.0, there have four breaking changes
* - the function get_client_data_from_decoder has been renamed to
* FLAC__get_decoder_client_data
* - some data types in the FLAC__Frame struct have changed
* - all functions resizing metadata blocks now return the object
* untouched if memory allocation fails, whereas previously the
* handling varied and was more or less undefined
* - all functions accepting a filename now take UTF-8 encoded filenames
* on Windows instead of filenames in the current codepage
*
* Furthermore, there have been the following additions
* - the functions FLAC__stream_encoder_set_limit_min_bitrate,
* FLAC__stream_encoder_get_limit_min_bitrate,
* FLAC::encoder::file::set_limit_min_bitrate() and
* FLAC::encoder::file::get_limit_min_bitrate() have been added
* - Added FLAC__STREAM_DECODER_ERROR_STATUS_BAD_METADATA to the
* FLAC__StreamDecoderErrorStatus enum
*
* \section porting_1_3_4_to_1_4_0_breaking Breaking changes
*
* The function \b get_client_data_from_decoder was added in FLAC 1.3.3
* but did not follow the API naming convention and was not properly
* exported. The function is now renamed and properly integrated as
* FLAC__stream_decoder_get_client_data
*
* To accomodate encoding and decoding 32-bit int PCM, some data types
* in the \b FLAC__frame struct were changed. Specifically, warmup
* in both the FLAC__Subframe_Fixed struc and the FLAC__Subframe_LPC
* struct is changed from FLAC__int32 to FLAC__int64. Also, value
* in the FLAC__Subframe_Constant is changed from FLAC__int32 to
* FLAC__int64. Finally, in FLAC__Subframe_Verbatim struct data is
* changes from a FLAC__int32 array to a union containing a FLAC__int32
* array and a FLAC__int64 array. Also, a new member is added,
* data_type, which clarifies whether the FLAC__int32 or FLAC__int64
* array is in use.
*
* Furthermore, the following functions now return the object untouched
* if memory allocation fails, whereas previously the handling varied
* and was more or less undefined
*
* - FLAC__metadata_object_seektable_resize_points
* - FLAC__metadata_object_vorbiscomment_resize_comments
* - FLAC__metadata_object_cuesheet_track_resize_indices
* - FLAC__metadata_object_cuesheet_resize_tracks
*
* The last breaking change is that all API functions taking a filename
* as an argument now, on Windows, must be supplied with that filename
* in the UTF-8 character encoding instead of using the current code
* page. libFLAC internally translates these UTF-8 encoded filenames to
* an appropriate representation to use with _wfopen. On all other
* systems, filename is passed to fopen without any translation, as it
* in libFLAC 1.3.4 and earlier.
*
* \section porting_1_3_4_to_1_4_0_additions Additions
*
* To aid in creating properly streamable FLAC files, a set of functions
* was added to make it possible to enfore a minimum bitrate to files
* created through libFLAC's stream_encoder.h interface. With this
* function enabled the resulting FLAC files have a minimum bitrate of
* 1bit/sample independent of the number of channels, i.e. 48kbit/s for
* 48kHz. This can be beneficial for streaming, as very low bitrates for
* silent sections compressed with 'constant' subframes can result in a
* bitrate of 1kbit/s, creating problems with clients that aren't aware
* of this possibility and buffer too much data.
*
* Finally, FLAC__STREAM_DECODER_ERROR_STATUS_BAD_METADATA was added to
* the FLAC__StreamDecoderErrorStatus enum to signal that the decoder
* encountered unreadable metadata.
*
*/
/** \defgroup flac FLAC C API /** \defgroup flac FLAC C API
* *
* The FLAC C API is the interface to libFLAC, a set of structures * The FLAC C API is the interface to libFLAC, a set of structures

View File

@@ -1,6 +1,6 @@
/* libFLAC - Free Lossless Audio Codec library /* libFLAC - Free Lossless Audio Codec library
* Copyright (C) 2001-2009 Josh Coalson * Copyright (C) 2001-2009 Josh Coalson
* Copyright (C) 2011-2014 Xiph.Org Foundation * Copyright (C) 2011-2022 Xiph.Org Foundation
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions * modification, are permitted provided that the following conditions
@@ -34,7 +34,11 @@
#define FLAC__ASSERT_H #define FLAC__ASSERT_H
/* we need this since some compilers (like MSVC) leave assert()s on release code (and we don't want to use their ASSERT) */ /* we need this since some compilers (like MSVC) leave assert()s on release code (and we don't want to use their ASSERT) */
#ifdef DEBUG #ifdef FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION
#define FLAC__ASSERT(x) if(!(x)) __builtin_abort();
#define FLAC__ASSERT_DECLARATION(x) x
#else
#ifndef NDEBUG
#include <assert.h> #include <assert.h>
#define FLAC__ASSERT(x) assert(x) #define FLAC__ASSERT(x) assert(x)
#define FLAC__ASSERT_DECLARATION(x) x #define FLAC__ASSERT_DECLARATION(x) x
@@ -42,5 +46,6 @@
#define FLAC__ASSERT(x) #define FLAC__ASSERT(x)
#define FLAC__ASSERT_DECLARATION(x) #define FLAC__ASSERT_DECLARATION(x)
#endif #endif
#endif
#endif #endif

View File

@@ -1,6 +1,6 @@
/* libFLAC - Free Lossless Audio Codec library /* libFLAC - Free Lossless Audio Codec library
* Copyright (C) 2004-2009 Josh Coalson * Copyright (C) 2004-2009 Josh Coalson
* Copyright (C) 2011-2014 Xiph.Org Foundation * Copyright (C) 2011-2022 Xiph.Org Foundation
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions * modification, are permitted provided that the following conditions
@@ -165,15 +165,15 @@ typedef int (*FLAC__IOCallback_Close) (FLAC__IOHandle handle);
* required may be set to NULL. * required may be set to NULL.
* *
* If the seek requirement for an interface is optional, you can signify that * If the seek requirement for an interface is optional, you can signify that
* a data sorce is not seekable by setting the \a seek field to \c NULL. * a data source is not seekable by setting the \a seek field to \c NULL.
*/ */
typedef struct { typedef struct {
FLAC__IOCallback_Read read; FLAC__IOCallback_Read read; /**< See FLAC__IOCallbacks */
FLAC__IOCallback_Write write; FLAC__IOCallback_Write write; /**< See FLAC__IOCallbacks */
FLAC__IOCallback_Seek seek; FLAC__IOCallback_Seek seek; /**< See FLAC__IOCallbacks */
FLAC__IOCallback_Tell tell; FLAC__IOCallback_Tell tell; /**< See FLAC__IOCallbacks */
FLAC__IOCallback_Eof eof; FLAC__IOCallback_Eof eof; /**< See FLAC__IOCallbacks */
FLAC__IOCallback_Close close; FLAC__IOCallback_Close close; /**< See FLAC__IOCallbacks */
} FLAC__IOCallbacks; } FLAC__IOCallbacks;
/* \} */ /* \} */

View File

@@ -1,6 +1,6 @@
/* libFLAC - Free Lossless Audio Codec library /* libFLAC - Free Lossless Audio Codec library
* Copyright (C) 2000-2009 Josh Coalson * Copyright (C) 2000-2009 Josh Coalson
* Copyright (C) 2011-2014 Xiph.Org Foundation * Copyright (C) 2011-2022 Xiph.Org Foundation
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions * modification, are permitted provided that the following conditions
@@ -36,7 +36,7 @@
/** \file include/FLAC/export.h /** \file include/FLAC/export.h
* *
* \brief * \brief
* This module contains #defines and symbols for exporting function * This module contains \#defines and symbols for exporting function
* calls, and providing version information and compiled-in features. * calls, and providing version information and compiled-in features.
* *
* See the \link flac_export export \endlink module. * See the \link flac_export export \endlink module.
@@ -46,25 +46,43 @@
* \ingroup flac * \ingroup flac
* *
* \brief * \brief
* This module contains #defines and symbols for exporting function * This module contains \#defines and symbols for exporting function
* calls, and providing version information and compiled-in features. * calls, and providing version information and compiled-in features.
* *
* If you are compiling with MSVC and will link to the static library * If you are compiling for Windows (with Visual Studio or MinGW for
* (libFLAC.lib) you should define FLAC__NO_DLL in your project to * example) and will link to the static library (libFLAC++.lib) you
* make sure the symbols are exported properly. * should define FLAC__NO_DLL in your project to make sure the symbols
* are exported properly.
* *
* \{ * \{
*/ */
#if defined(FLAC__NO_DLL) /** This \#define is used internally in libFLAC and its headers to make
#define FLAC_API * sure the correct symbols are exported when working with shared
* libraries. On Windows, this \#define is set to __declspec(dllexport)
* when compiling libFLAC into a library and to __declspec(dllimport)
* when the headers are used to link to that DLL. On non-Windows systems
* it is used to set symbol visibility.
*
* Because of this, the define FLAC__NO_DLL must be defined when linking
* to libFLAC statically or linking will fail.
*/
/* This has grown quite complicated. FLAC__NO_DLL is used by MSVC sln
* files and CMake, which build either static or shared. autotools can
* build static, shared or **both**. Therefore, DLL_EXPORT, which is set
* by libtool, must override FLAC__NO_DLL on building shared components
*/
#if defined(_WIN32)
#elif defined(_MSC_VER) #if defined(FLAC__NO_DLL) && !(defined(DLL_EXPORT))
#define FLAC_API
#else
#ifdef FLAC_API_EXPORTS #ifdef FLAC_API_EXPORTS
#define FLAC_API __declspec(dllexport) #define FLAC_API __declspec(dllexport)
#else #else
#define FLAC_API __declspec(dllimport) #define FLAC_API __declspec(dllimport)
#endif #endif
#endif
#elif defined(FLAC__USE_VISIBILITY_ATTR) #elif defined(FLAC__USE_VISIBILITY_ATTR)
#define FLAC_API __attribute__ ((visibility ("default"))) #define FLAC_API __attribute__ ((visibility ("default")))
@@ -74,12 +92,12 @@
#endif #endif
/** These #defines will mirror the libtool-based library version number, see /** These \#defines will mirror the libtool-based library version number, see
* http://www.gnu.org/software/libtool/manual/libtool.html#Libtool-versioning * http://www.gnu.org/software/libtool/manual/libtool.html#Libtool-versioning
*/ */
#define FLAC_API_VERSION_CURRENT 11 #define FLAC_API_VERSION_CURRENT 12
#define FLAC_API_VERSION_REVISION 0 /**< see above */ #define FLAC_API_VERSION_REVISION 0 /**< see above */
#define FLAC_API_VERSION_AGE 3 /**< see above */ #define FLAC_API_VERSION_AGE 0 /**< see above */
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {

View File

@@ -1,6 +1,6 @@
/* libFLAC - Free Lossless Audio Codec library /* libFLAC - Free Lossless Audio Codec library
* Copyright (C) 2000-2009 Josh Coalson * Copyright (C) 2000-2009 Josh Coalson
* Copyright (C) 2011-2014 Xiph.Org Foundation * Copyright (C) 2011-2022 Xiph.Org Foundation
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions * modification, are permitted provided that the following conditions
@@ -60,7 +60,7 @@ extern "C" {
* structures used by the rest of the interfaces. * structures used by the rest of the interfaces.
* *
* First, you should be familiar with the * First, you should be familiar with the
* <A HREF="../format.html">FLAC format</A>. Many of the values here * <A HREF="https://xiph.org/flac/format.html">FLAC format</A>. Many of the values here
* follow directly from the specification. As a user of libFLAC, the * follow directly from the specification. As a user of libFLAC, the
* interesting parts really are the structures that describe the frame * interesting parts really are the structures that describe the frame
* header and metadata blocks. * header and metadata blocks.
@@ -113,19 +113,16 @@ extern "C" {
/** The maximum sample resolution permitted by libFLAC. /** The maximum sample resolution permitted by libFLAC.
* *
* \warning
* FLAC__MAX_BITS_PER_SAMPLE is the limit of the FLAC format. However, * FLAC__MAX_BITS_PER_SAMPLE is the limit of the FLAC format. However,
* the reference encoder/decoder is currently limited to 24 bits because * the reference encoder/decoder used to be limited to 24 bits. This
* of prevalent 32-bit math, so make sure and use this value when * value was used to signal that limit.
* appropriate.
*/ */
#define FLAC__REFERENCE_CODEC_MAX_BITS_PER_SAMPLE (24u) #define FLAC__REFERENCE_CODEC_MAX_BITS_PER_SAMPLE (32u)
/** The maximum sample rate permitted by the format. The value is /** The maximum sample rate permitted by the format. The value is
* ((2 ^ 16) - 1) * 10; see <A HREF="../format.html">FLAC format</A> * ((2 ^ 20) - 1)
* as to why.
*/ */
#define FLAC__MAX_SAMPLE_RATE (655350u) #define FLAC__MAX_SAMPLE_RATE (1048575u)
/** The maximum LPC order permitted by the format. */ /** The maximum LPC order permitted by the format. */
#define FLAC__MAX_LPC_ORDER (32u) #define FLAC__MAX_LPC_ORDER (32u)
@@ -173,10 +170,10 @@ extern FLAC_API const FLAC__byte FLAC__STREAM_SYNC_STRING[4]; /* = "fLaC" */
/** The 32-bit integer big-endian representation of the beginning of /** The 32-bit integer big-endian representation of the beginning of
* a FLAC stream. * a FLAC stream.
*/ */
extern FLAC_API const unsigned FLAC__STREAM_SYNC; /* = 0x664C6143 */ extern FLAC_API const uint32_t FLAC__STREAM_SYNC; /* = 0x664C6143 */
/** The length of the FLAC signature in bits. */ /** The length of the FLAC signature in bits. */
extern FLAC_API const unsigned FLAC__STREAM_SYNC_LEN; /* = 32 bits */ extern FLAC_API const uint32_t FLAC__STREAM_SYNC_LEN; /* = 32 bits */
/** The length of the FLAC signature in bytes. */ /** The length of the FLAC signature in bytes. */
#define FLAC__STREAM_SYNC_LENGTH (4u) #define FLAC__STREAM_SYNC_LENGTH (4u)
@@ -213,26 +210,26 @@ extern FLAC_API const char * const FLAC__EntropyCodingMethodTypeString[];
*/ */
typedef struct { typedef struct {
unsigned *parameters; uint32_t *parameters;
/**< The Rice parameters for each context. */ /**< The Rice parameters for each context. */
unsigned *raw_bits; uint32_t *raw_bits;
/**< Widths for escape-coded partitions. Will be non-zero for escaped /**< Widths for escape-coded partitions. Will be non-zero for escaped
* partitions and zero for unescaped partitions. * partitions and zero for unescaped partitions.
*/ */
unsigned capacity_by_order; uint32_t capacity_by_order;
/**< The capacity of the \a parameters and \a raw_bits arrays /**< The capacity of the \a parameters and \a raw_bits arrays
* specified as an order, i.e. the number of array elements * specified as an order, i.e. the number of array elements
* allocated is 2 ^ \a capacity_by_order. * allocated is 2 ^ \a capacity_by_order.
*/ */
} FLAC__EntropyCodingMethod_PartitionedRiceContents; } FLAC__EntropyCodingMethod_PartitionedRiceContents;
/** Header for a Rice partitioned residual. (c.f. <A HREF="../format.html#partitioned_rice">format specification</A>) /** Header for a Rice partitioned residual. (c.f. <A HREF="https://xiph.org/flac/format.html#partitioned_rice">format specification</A>)
*/ */
typedef struct { typedef struct {
unsigned order; uint32_t order;
/**< The partition order, i.e. # of contexts = 2 ^ \a order. */ /**< The partition order, i.e. # of contexts = 2 ^ \a order. */
const FLAC__EntropyCodingMethod_PartitionedRiceContents *contents; const FLAC__EntropyCodingMethod_PartitionedRiceContents *contents;
@@ -240,17 +237,17 @@ typedef struct {
} FLAC__EntropyCodingMethod_PartitionedRice; } FLAC__EntropyCodingMethod_PartitionedRice;
extern FLAC_API const unsigned FLAC__ENTROPY_CODING_METHOD_PARTITIONED_RICE_ORDER_LEN; /**< == 4 (bits) */ extern FLAC_API const uint32_t FLAC__ENTROPY_CODING_METHOD_PARTITIONED_RICE_ORDER_LEN; /**< == 4 (bits) */
extern FLAC_API const unsigned FLAC__ENTROPY_CODING_METHOD_PARTITIONED_RICE_PARAMETER_LEN; /**< == 4 (bits) */ extern FLAC_API const uint32_t FLAC__ENTROPY_CODING_METHOD_PARTITIONED_RICE_PARAMETER_LEN; /**< == 4 (bits) */
extern FLAC_API const unsigned FLAC__ENTROPY_CODING_METHOD_PARTITIONED_RICE2_PARAMETER_LEN; /**< == 5 (bits) */ extern FLAC_API const uint32_t FLAC__ENTROPY_CODING_METHOD_PARTITIONED_RICE2_PARAMETER_LEN; /**< == 5 (bits) */
extern FLAC_API const unsigned FLAC__ENTROPY_CODING_METHOD_PARTITIONED_RICE_RAW_LEN; /**< == 5 (bits) */ extern FLAC_API const uint32_t FLAC__ENTROPY_CODING_METHOD_PARTITIONED_RICE_RAW_LEN; /**< == 5 (bits) */
extern FLAC_API const unsigned FLAC__ENTROPY_CODING_METHOD_PARTITIONED_RICE_ESCAPE_PARAMETER; extern FLAC_API const uint32_t FLAC__ENTROPY_CODING_METHOD_PARTITIONED_RICE_ESCAPE_PARAMETER;
/**< == (1<<FLAC__ENTROPY_CODING_METHOD_PARTITIONED_RICE_PARAMETER_LEN)-1 */ /**< == (1<<FLAC__ENTROPY_CODING_METHOD_PARTITIONED_RICE_PARAMETER_LEN)-1 */
extern FLAC_API const unsigned FLAC__ENTROPY_CODING_METHOD_PARTITIONED_RICE2_ESCAPE_PARAMETER; extern FLAC_API const uint32_t FLAC__ENTROPY_CODING_METHOD_PARTITIONED_RICE2_ESCAPE_PARAMETER;
/**< == (1<<FLAC__ENTROPY_CODING_METHOD_PARTITIONED_RICE2_PARAMETER_LEN)-1 */ /**< == (1<<FLAC__ENTROPY_CODING_METHOD_PARTITIONED_RICE2_PARAMETER_LEN)-1 */
/** Header for the entropy coding method. (c.f. <A HREF="../format.html#residual">format specification</A>) /** Header for the entropy coding method. (c.f. <A HREF="https://xiph.org/flac/format.html#residual">format specification</A>)
*/ */
typedef struct { typedef struct {
FLAC__EntropyCodingMethodType type; FLAC__EntropyCodingMethodType type;
@@ -259,7 +256,7 @@ typedef struct {
} data; } data;
} FLAC__EntropyCodingMethod; } FLAC__EntropyCodingMethod;
extern FLAC_API const unsigned FLAC__ENTROPY_CODING_METHOD_TYPE_LEN; /**< == 2 (bits) */ extern FLAC_API const uint32_t FLAC__ENTROPY_CODING_METHOD_TYPE_LEN; /**< == 2 (bits) */
/*****************************************************************************/ /*****************************************************************************/
@@ -279,30 +276,40 @@ typedef enum {
extern FLAC_API const char * const FLAC__SubframeTypeString[]; extern FLAC_API const char * const FLAC__SubframeTypeString[];
/** CONSTANT subframe. (c.f. <A HREF="../format.html#subframe_constant">format specification</A>) /** CONSTANT subframe. (c.f. <A HREF="https://xiph.org/flac/format.html#subframe_constant">format specification</A>)
*/ */
typedef struct { typedef struct {
FLAC__int32 value; /**< The constant signal value. */ FLAC__int64 value; /**< The constant signal value. */
} FLAC__Subframe_Constant; } FLAC__Subframe_Constant;
/** An enumeration of the possible verbatim subframe data types. */
typedef enum {
FLAC__VERBATIM_SUBFRAME_DATA_TYPE_INT32, /**< verbatim subframe has 32-bit int */
FLAC__VERBATIM_SUBFRAME_DATA_TYPE_INT64 /**< verbatim subframe has 64-bit int */
} FLAC__VerbatimSubframeDataType;
/** VERBATIM subframe. (c.f. <A HREF="../format.html#subframe_verbatim">format specification</A>)
/** VERBATIM subframe. (c.f. <A HREF="https://xiph.org/flac/format.html#subframe_verbatim">format specification</A>)
*/ */
typedef struct { typedef struct {
const FLAC__int32 *data; /**< A pointer to verbatim signal. */ union {
const FLAC__int32 *int32; /**< A FLAC__int32 pointer to verbatim signal. */
const FLAC__int64 *int64; /**< A FLAC__int64 pointer to verbatim signal. */
} data;
FLAC__VerbatimSubframeDataType data_type;
} FLAC__Subframe_Verbatim; } FLAC__Subframe_Verbatim;
/** FIXED subframe. (c.f. <A HREF="../format.html#subframe_fixed">format specification</A>) /** FIXED subframe. (c.f. <A HREF="https://xiph.org/flac/format.html#subframe_fixed">format specification</A>)
*/ */
typedef struct { typedef struct {
FLAC__EntropyCodingMethod entropy_coding_method; FLAC__EntropyCodingMethod entropy_coding_method;
/**< The residual coding method. */ /**< The residual coding method. */
unsigned order; uint32_t order;
/**< The polynomial order. */ /**< The polynomial order. */
FLAC__int32 warmup[FLAC__MAX_FIXED_ORDER]; FLAC__int64 warmup[FLAC__MAX_FIXED_ORDER];
/**< Warmup samples to prime the predictor, length == order. */ /**< Warmup samples to prime the predictor, length == order. */
const FLAC__int32 *residual; const FLAC__int32 *residual;
@@ -310,16 +317,16 @@ typedef struct {
} FLAC__Subframe_Fixed; } FLAC__Subframe_Fixed;
/** LPC subframe. (c.f. <A HREF="../format.html#subframe_lpc">format specification</A>) /** LPC subframe. (c.f. <A HREF="https://xiph.org/flac/format.html#subframe_lpc">format specification</A>)
*/ */
typedef struct { typedef struct {
FLAC__EntropyCodingMethod entropy_coding_method; FLAC__EntropyCodingMethod entropy_coding_method;
/**< The residual coding method. */ /**< The residual coding method. */
unsigned order; uint32_t order;
/**< The FIR order. */ /**< The FIR order. */
unsigned qlp_coeff_precision; uint32_t qlp_coeff_precision;
/**< Quantized FIR filter coefficient precision in bits. */ /**< Quantized FIR filter coefficient precision in bits. */
int quantization_level; int quantization_level;
@@ -328,18 +335,18 @@ typedef struct {
FLAC__int32 qlp_coeff[FLAC__MAX_LPC_ORDER]; FLAC__int32 qlp_coeff[FLAC__MAX_LPC_ORDER];
/**< FIR filter coefficients. */ /**< FIR filter coefficients. */
FLAC__int32 warmup[FLAC__MAX_LPC_ORDER]; FLAC__int64 warmup[FLAC__MAX_LPC_ORDER];
/**< Warmup samples to prime the predictor, length == order. */ /**< Warmup samples to prime the predictor, length == order. */
const FLAC__int32 *residual; const FLAC__int32 *residual;
/**< The residual signal, length == (blocksize minus order) samples. */ /**< The residual signal, length == (blocksize minus order) samples. */
} FLAC__Subframe_LPC; } FLAC__Subframe_LPC;
extern FLAC_API const unsigned FLAC__SUBFRAME_LPC_QLP_COEFF_PRECISION_LEN; /**< == 4 (bits) */ extern FLAC_API const uint32_t FLAC__SUBFRAME_LPC_QLP_COEFF_PRECISION_LEN; /**< == 4 (bits) */
extern FLAC_API const unsigned FLAC__SUBFRAME_LPC_QLP_SHIFT_LEN; /**< == 5 (bits) */ extern FLAC_API const uint32_t FLAC__SUBFRAME_LPC_QLP_SHIFT_LEN; /**< == 5 (bits) */
/** FLAC subframe structure. (c.f. <A HREF="../format.html#subframe">format specification</A>) /** FLAC subframe structure. (c.f. <A HREF="https://xiph.org/flac/format.html#subframe">format specification</A>)
*/ */
typedef struct { typedef struct {
FLAC__SubframeType type; FLAC__SubframeType type;
@@ -349,7 +356,7 @@ typedef struct {
FLAC__Subframe_LPC lpc; FLAC__Subframe_LPC lpc;
FLAC__Subframe_Verbatim verbatim; FLAC__Subframe_Verbatim verbatim;
} data; } data;
unsigned wasted_bits; uint32_t wasted_bits;
} FLAC__Subframe; } FLAC__Subframe;
/** == 1 (bit) /** == 1 (bit)
@@ -359,14 +366,14 @@ typedef struct {
* mandatory value of \c 0 but in the future may take on the value \c 0 or \c 1 * mandatory value of \c 0 but in the future may take on the value \c 0 or \c 1
* to mean something else. * to mean something else.
*/ */
extern FLAC_API const unsigned FLAC__SUBFRAME_ZERO_PAD_LEN; extern FLAC_API const uint32_t FLAC__SUBFRAME_ZERO_PAD_LEN;
extern FLAC_API const unsigned FLAC__SUBFRAME_TYPE_LEN; /**< == 6 (bits) */ extern FLAC_API const uint32_t FLAC__SUBFRAME_TYPE_LEN; /**< == 6 (bits) */
extern FLAC_API const unsigned FLAC__SUBFRAME_WASTED_BITS_FLAG_LEN; /**< == 1 (bit) */ extern FLAC_API const uint32_t FLAC__SUBFRAME_WASTED_BITS_FLAG_LEN; /**< == 1 (bit) */
extern FLAC_API const unsigned FLAC__SUBFRAME_TYPE_CONSTANT_BYTE_ALIGNED_MASK; /**< = 0x00 */ extern FLAC_API const uint32_t FLAC__SUBFRAME_TYPE_CONSTANT_BYTE_ALIGNED_MASK; /**< = 0x00 */
extern FLAC_API const unsigned FLAC__SUBFRAME_TYPE_VERBATIM_BYTE_ALIGNED_MASK; /**< = 0x02 */ extern FLAC_API const uint32_t FLAC__SUBFRAME_TYPE_VERBATIM_BYTE_ALIGNED_MASK; /**< = 0x02 */
extern FLAC_API const unsigned FLAC__SUBFRAME_TYPE_FIXED_BYTE_ALIGNED_MASK; /**< = 0x10 */ extern FLAC_API const uint32_t FLAC__SUBFRAME_TYPE_FIXED_BYTE_ALIGNED_MASK; /**< = 0x10 */
extern FLAC_API const unsigned FLAC__SUBFRAME_TYPE_LPC_BYTE_ALIGNED_MASK; /**< = 0x40 */ extern FLAC_API const uint32_t FLAC__SUBFRAME_TYPE_LPC_BYTE_ALIGNED_MASK; /**< = 0x40 */
/*****************************************************************************/ /*****************************************************************************/
@@ -406,22 +413,22 @@ typedef enum {
extern FLAC_API const char * const FLAC__FrameNumberTypeString[]; extern FLAC_API const char * const FLAC__FrameNumberTypeString[];
/** FLAC frame header structure. (c.f. <A HREF="../format.html#frame_header">format specification</A>) /** FLAC frame header structure. (c.f. <A HREF="https://xiph.org/flac/format.html#frame_header">format specification</A>)
*/ */
typedef struct { typedef struct {
unsigned blocksize; uint32_t blocksize;
/**< The number of samples per subframe. */ /**< The number of samples per subframe. */
unsigned sample_rate; uint32_t sample_rate;
/**< The sample rate in Hz. */ /**< The sample rate in Hz. */
unsigned channels; uint32_t channels;
/**< The number of channels (== number of subframes). */ /**< The number of channels (== number of subframes). */
FLAC__ChannelAssignment channel_assignment; FLAC__ChannelAssignment channel_assignment;
/**< The channel assignment for the frame. */ /**< The channel assignment for the frame. */
unsigned bits_per_sample; uint32_t bits_per_sample;
/**< The sample resolution. */ /**< The sample resolution. */
FLAC__FrameNumberType number_type; FLAC__FrameNumberType number_type;
@@ -443,19 +450,19 @@ typedef struct {
*/ */
} FLAC__FrameHeader; } FLAC__FrameHeader;
extern FLAC_API const unsigned FLAC__FRAME_HEADER_SYNC; /**< == 0x3ffe; the frame header sync code */ extern FLAC_API const uint32_t FLAC__FRAME_HEADER_SYNC; /**< == 0x3ffe; the frame header sync code */
extern FLAC_API const unsigned FLAC__FRAME_HEADER_SYNC_LEN; /**< == 14 (bits) */ extern FLAC_API const uint32_t FLAC__FRAME_HEADER_SYNC_LEN; /**< == 14 (bits) */
extern FLAC_API const unsigned FLAC__FRAME_HEADER_RESERVED_LEN; /**< == 1 (bits) */ extern FLAC_API const uint32_t FLAC__FRAME_HEADER_RESERVED_LEN; /**< == 1 (bits) */
extern FLAC_API const unsigned FLAC__FRAME_HEADER_BLOCKING_STRATEGY_LEN; /**< == 1 (bits) */ extern FLAC_API const uint32_t FLAC__FRAME_HEADER_BLOCKING_STRATEGY_LEN; /**< == 1 (bits) */
extern FLAC_API const unsigned FLAC__FRAME_HEADER_BLOCK_SIZE_LEN; /**< == 4 (bits) */ extern FLAC_API const uint32_t FLAC__FRAME_HEADER_BLOCK_SIZE_LEN; /**< == 4 (bits) */
extern FLAC_API const unsigned FLAC__FRAME_HEADER_SAMPLE_RATE_LEN; /**< == 4 (bits) */ extern FLAC_API const uint32_t FLAC__FRAME_HEADER_SAMPLE_RATE_LEN; /**< == 4 (bits) */
extern FLAC_API const unsigned FLAC__FRAME_HEADER_CHANNEL_ASSIGNMENT_LEN; /**< == 4 (bits) */ extern FLAC_API const uint32_t FLAC__FRAME_HEADER_CHANNEL_ASSIGNMENT_LEN; /**< == 4 (bits) */
extern FLAC_API const unsigned FLAC__FRAME_HEADER_BITS_PER_SAMPLE_LEN; /**< == 3 (bits) */ extern FLAC_API const uint32_t FLAC__FRAME_HEADER_BITS_PER_SAMPLE_LEN; /**< == 3 (bits) */
extern FLAC_API const unsigned FLAC__FRAME_HEADER_ZERO_PAD_LEN; /**< == 1 (bit) */ extern FLAC_API const uint32_t FLAC__FRAME_HEADER_ZERO_PAD_LEN; /**< == 1 (bit) */
extern FLAC_API const unsigned FLAC__FRAME_HEADER_CRC_LEN; /**< == 8 (bits) */ extern FLAC_API const uint32_t FLAC__FRAME_HEADER_CRC_LEN; /**< == 8 (bits) */
/** FLAC frame footer structure. (c.f. <A HREF="../format.html#frame_footer">format specification</A>) /** FLAC frame footer structure. (c.f. <A HREF="https://xiph.org/flac/format.html#frame_footer">format specification</A>)
*/ */
typedef struct { typedef struct {
FLAC__uint16 crc; FLAC__uint16 crc;
@@ -465,10 +472,10 @@ typedef struct {
*/ */
} FLAC__FrameFooter; } FLAC__FrameFooter;
extern FLAC_API const unsigned FLAC__FRAME_FOOTER_CRC_LEN; /**< == 16 (bits) */ extern FLAC_API const uint32_t FLAC__FRAME_FOOTER_CRC_LEN; /**< == 16 (bits) */
/** FLAC frame structure. (c.f. <A HREF="../format.html#frame">format specification</A>) /** FLAC frame structure. (c.f. <A HREF="https://xiph.org/flac/format.html#frame">format specification</A>)
*/ */
typedef struct { typedef struct {
FLAC__FrameHeader header; FLAC__FrameHeader header;
@@ -489,31 +496,31 @@ typedef struct {
typedef enum { typedef enum {
FLAC__METADATA_TYPE_STREAMINFO = 0, FLAC__METADATA_TYPE_STREAMINFO = 0,
/**< <A HREF="../format.html#metadata_block_streaminfo">STREAMINFO</A> block */ /**< <A HREF="https://xiph.org/flac/format.html#metadata_block_streaminfo">STREAMINFO</A> block */
FLAC__METADATA_TYPE_PADDING = 1, FLAC__METADATA_TYPE_PADDING = 1,
/**< <A HREF="../format.html#metadata_block_padding">PADDING</A> block */ /**< <A HREF="https://xiph.org/flac/format.html#metadata_block_padding">PADDING</A> block */
FLAC__METADATA_TYPE_APPLICATION = 2, FLAC__METADATA_TYPE_APPLICATION = 2,
/**< <A HREF="../format.html#metadata_block_application">APPLICATION</A> block */ /**< <A HREF="https://xiph.org/flac/format.html#metadata_block_application">APPLICATION</A> block */
FLAC__METADATA_TYPE_SEEKTABLE = 3, FLAC__METADATA_TYPE_SEEKTABLE = 3,
/**< <A HREF="../format.html#metadata_block_seektable">SEEKTABLE</A> block */ /**< <A HREF="https://xiph.org/flac/format.html#metadata_block_seektable">SEEKTABLE</A> block */
FLAC__METADATA_TYPE_VORBIS_COMMENT = 4, FLAC__METADATA_TYPE_VORBIS_COMMENT = 4,
/**< <A HREF="../format.html#metadata_block_vorbis_comment">VORBISCOMMENT</A> block (a.k.a. FLAC tags) */ /**< <A HREF="https://xiph.org/flac/format.html#metadata_block_vorbis_comment">VORBISCOMMENT</A> block (a.k.a. FLAC tags) */
FLAC__METADATA_TYPE_CUESHEET = 5, FLAC__METADATA_TYPE_CUESHEET = 5,
/**< <A HREF="../format.html#metadata_block_cuesheet">CUESHEET</A> block */ /**< <A HREF="https://xiph.org/flac/format.html#metadata_block_cuesheet">CUESHEET</A> block */
FLAC__METADATA_TYPE_PICTURE = 6, FLAC__METADATA_TYPE_PICTURE = 6,
/**< <A HREF="../format.html#metadata_block_picture">PICTURE</A> block */ /**< <A HREF="https://xiph.org/flac/format.html#metadata_block_picture">PICTURE</A> block */
FLAC__METADATA_TYPE_UNDEFINED = 7, FLAC__METADATA_TYPE_UNDEFINED = 7,
/**< marker to denote beginning of undefined type range; this number will increase as new metadata types are added */ /**< marker to denote beginning of undefined type range; this number will increase as new metadata types are added */
FLAC__MAX_METADATA_TYPE = FLAC__MAX_METADATA_TYPE_CODE, FLAC__MAX_METADATA_TYPE = FLAC__MAX_METADATA_TYPE_CODE,
/**< No type will ever be greater than this. There is not enough room in the protocol block. */ /**< No type will ever be greater than this. There is not enough room in the protocol block. */
} FLAC__MetadataType; } FLAC__MetadataType;
/** Maps a FLAC__MetadataType to a C string. /** Maps a FLAC__MetadataType to a C string.
@@ -524,32 +531,32 @@ typedef enum {
extern FLAC_API const char * const FLAC__MetadataTypeString[]; extern FLAC_API const char * const FLAC__MetadataTypeString[];
/** FLAC STREAMINFO structure. (c.f. <A HREF="../format.html#metadata_block_streaminfo">format specification</A>) /** FLAC STREAMINFO structure. (c.f. <A HREF="https://xiph.org/flac/format.html#metadata_block_streaminfo">format specification</A>)
*/ */
typedef struct { typedef struct {
unsigned min_blocksize, max_blocksize; uint32_t min_blocksize, max_blocksize;
unsigned min_framesize, max_framesize; uint32_t min_framesize, max_framesize;
unsigned sample_rate; uint32_t sample_rate;
unsigned channels; uint32_t channels;
unsigned bits_per_sample; uint32_t bits_per_sample;
FLAC__uint64 total_samples; FLAC__uint64 total_samples;
FLAC__byte md5sum[16]; FLAC__byte md5sum[16];
} FLAC__StreamMetadata_StreamInfo; } FLAC__StreamMetadata_StreamInfo;
extern FLAC_API const unsigned FLAC__STREAM_METADATA_STREAMINFO_MIN_BLOCK_SIZE_LEN; /**< == 16 (bits) */ extern FLAC_API const uint32_t FLAC__STREAM_METADATA_STREAMINFO_MIN_BLOCK_SIZE_LEN; /**< == 16 (bits) */
extern FLAC_API const unsigned FLAC__STREAM_METADATA_STREAMINFO_MAX_BLOCK_SIZE_LEN; /**< == 16 (bits) */ extern FLAC_API const uint32_t FLAC__STREAM_METADATA_STREAMINFO_MAX_BLOCK_SIZE_LEN; /**< == 16 (bits) */
extern FLAC_API const unsigned FLAC__STREAM_METADATA_STREAMINFO_MIN_FRAME_SIZE_LEN; /**< == 24 (bits) */ extern FLAC_API const uint32_t FLAC__STREAM_METADATA_STREAMINFO_MIN_FRAME_SIZE_LEN; /**< == 24 (bits) */
extern FLAC_API const unsigned FLAC__STREAM_METADATA_STREAMINFO_MAX_FRAME_SIZE_LEN; /**< == 24 (bits) */ extern FLAC_API const uint32_t FLAC__STREAM_METADATA_STREAMINFO_MAX_FRAME_SIZE_LEN; /**< == 24 (bits) */
extern FLAC_API const unsigned FLAC__STREAM_METADATA_STREAMINFO_SAMPLE_RATE_LEN; /**< == 20 (bits) */ extern FLAC_API const uint32_t FLAC__STREAM_METADATA_STREAMINFO_SAMPLE_RATE_LEN; /**< == 20 (bits) */
extern FLAC_API const unsigned FLAC__STREAM_METADATA_STREAMINFO_CHANNELS_LEN; /**< == 3 (bits) */ extern FLAC_API const uint32_t FLAC__STREAM_METADATA_STREAMINFO_CHANNELS_LEN; /**< == 3 (bits) */
extern FLAC_API const unsigned FLAC__STREAM_METADATA_STREAMINFO_BITS_PER_SAMPLE_LEN; /**< == 5 (bits) */ extern FLAC_API const uint32_t FLAC__STREAM_METADATA_STREAMINFO_BITS_PER_SAMPLE_LEN; /**< == 5 (bits) */
extern FLAC_API const unsigned FLAC__STREAM_METADATA_STREAMINFO_TOTAL_SAMPLES_LEN; /**< == 36 (bits) */ extern FLAC_API const uint32_t FLAC__STREAM_METADATA_STREAMINFO_TOTAL_SAMPLES_LEN; /**< == 36 (bits) */
extern FLAC_API const unsigned FLAC__STREAM_METADATA_STREAMINFO_MD5SUM_LEN; /**< == 128 (bits) */ extern FLAC_API const uint32_t FLAC__STREAM_METADATA_STREAMINFO_MD5SUM_LEN; /**< == 128 (bits) */
/** The total stream length of the STREAMINFO block in bytes. */ /** The total stream length of the STREAMINFO block in bytes. */
#define FLAC__STREAM_METADATA_STREAMINFO_LENGTH (34u) #define FLAC__STREAM_METADATA_STREAMINFO_LENGTH (34u)
/** FLAC PADDING structure. (c.f. <A HREF="../format.html#metadata_block_padding">format specification</A>) /** FLAC PADDING structure. (c.f. <A HREF="https://xiph.org/flac/format.html#metadata_block_padding">format specification</A>)
*/ */
typedef struct { typedef struct {
int dummy; int dummy;
@@ -560,16 +567,16 @@ typedef struct {
} FLAC__StreamMetadata_Padding; } FLAC__StreamMetadata_Padding;
/** FLAC APPLICATION structure. (c.f. <A HREF="../format.html#metadata_block_application">format specification</A>) /** FLAC APPLICATION structure. (c.f. <A HREF="https://xiph.org/flac/format.html#metadata_block_application">format specification</A>)
*/ */
typedef struct { typedef struct {
FLAC__byte id[4]; FLAC__byte id[4];
FLAC__byte *data; FLAC__byte *data;
} FLAC__StreamMetadata_Application; } FLAC__StreamMetadata_Application;
extern FLAC_API const unsigned FLAC__STREAM_METADATA_APPLICATION_ID_LEN; /**< == 32 (bits) */ extern FLAC_API const uint32_t FLAC__STREAM_METADATA_APPLICATION_ID_LEN; /**< == 32 (bits) */
/** SeekPoint structure used in SEEKTABLE blocks. (c.f. <A HREF="../format.html#seekpoint">format specification</A>) /** SeekPoint structure used in SEEKTABLE blocks. (c.f. <A HREF="https://xiph.org/flac/format.html#seekpoint">format specification</A>)
*/ */
typedef struct { typedef struct {
FLAC__uint64 sample_number; FLAC__uint64 sample_number;
@@ -579,13 +586,13 @@ typedef struct {
/**< The offset, in bytes, of the target frame with respect to /**< The offset, in bytes, of the target frame with respect to
* beginning of the first frame. */ * beginning of the first frame. */
unsigned frame_samples; uint32_t frame_samples;
/**< The number of samples in the target frame. */ /**< The number of samples in the target frame. */
} FLAC__StreamMetadata_SeekPoint; } FLAC__StreamMetadata_SeekPoint;
extern FLAC_API const unsigned FLAC__STREAM_METADATA_SEEKPOINT_SAMPLE_NUMBER_LEN; /**< == 64 (bits) */ extern FLAC_API const uint32_t FLAC__STREAM_METADATA_SEEKPOINT_SAMPLE_NUMBER_LEN; /**< == 64 (bits) */
extern FLAC_API const unsigned FLAC__STREAM_METADATA_SEEKPOINT_STREAM_OFFSET_LEN; /**< == 64 (bits) */ extern FLAC_API const uint32_t FLAC__STREAM_METADATA_SEEKPOINT_STREAM_OFFSET_LEN; /**< == 64 (bits) */
extern FLAC_API const unsigned FLAC__STREAM_METADATA_SEEKPOINT_FRAME_SAMPLES_LEN; /**< == 16 (bits) */ extern FLAC_API const uint32_t FLAC__STREAM_METADATA_SEEKPOINT_FRAME_SAMPLES_LEN; /**< == 16 (bits) */
/** The total stream length of a seek point in bytes. */ /** The total stream length of a seek point in bytes. */
#define FLAC__STREAM_METADATA_SEEKPOINT_LENGTH (18u) #define FLAC__STREAM_METADATA_SEEKPOINT_LENGTH (18u)
@@ -597,7 +604,7 @@ extern FLAC_API const unsigned FLAC__STREAM_METADATA_SEEKPOINT_FRAME_SAMPLES_LEN
extern FLAC_API const FLAC__uint64 FLAC__STREAM_METADATA_SEEKPOINT_PLACEHOLDER; extern FLAC_API const FLAC__uint64 FLAC__STREAM_METADATA_SEEKPOINT_PLACEHOLDER;
/** FLAC SEEKTABLE structure. (c.f. <A HREF="../format.html#metadata_block_seektable">format specification</A>) /** FLAC SEEKTABLE structure. (c.f. <A HREF="https://xiph.org/flac/format.html#metadata_block_seektable">format specification</A>)
* *
* \note From the format specification: * \note From the format specification:
* - The seek points must be sorted by ascending sample number. * - The seek points must be sorted by ascending sample number.
@@ -610,12 +617,12 @@ extern FLAC_API const FLAC__uint64 FLAC__STREAM_METADATA_SEEKPOINT_PLACEHOLDER;
* present in a stream. * present in a stream.
*/ */
typedef struct { typedef struct {
unsigned num_points; uint32_t num_points;
FLAC__StreamMetadata_SeekPoint *points; FLAC__StreamMetadata_SeekPoint *points;
} FLAC__StreamMetadata_SeekTable; } FLAC__StreamMetadata_SeekTable;
/** Vorbis comment entry structure used in VORBIS_COMMENT blocks. (c.f. <A HREF="../format.html#metadata_block_vorbis_comment">format specification</A>) /** Vorbis comment entry structure used in VORBIS_COMMENT blocks. (c.f. <A HREF="https://xiph.org/flac/format.html#metadata_block_vorbis_comment">format specification</A>)
* *
* For convenience, the APIs maintain a trailing NUL character at the end of * For convenience, the APIs maintain a trailing NUL character at the end of
* \a entry which is not counted toward \a length, i.e. * \a entry which is not counted toward \a length, i.e.
@@ -626,10 +633,10 @@ typedef struct {
FLAC__byte *entry; FLAC__byte *entry;
} FLAC__StreamMetadata_VorbisComment_Entry; } FLAC__StreamMetadata_VorbisComment_Entry;
extern FLAC_API const unsigned FLAC__STREAM_METADATA_VORBIS_COMMENT_ENTRY_LENGTH_LEN; /**< == 32 (bits) */ extern FLAC_API const uint32_t FLAC__STREAM_METADATA_VORBIS_COMMENT_ENTRY_LENGTH_LEN; /**< == 32 (bits) */
/** FLAC VORBIS_COMMENT structure. (c.f. <A HREF="../format.html#metadata_block_vorbis_comment">format specification</A>) /** FLAC VORBIS_COMMENT structure. (c.f. <A HREF="https://xiph.org/flac/format.html#metadata_block_vorbis_comment">format specification</A>)
*/ */
typedef struct { typedef struct {
FLAC__StreamMetadata_VorbisComment_Entry vendor_string; FLAC__StreamMetadata_VorbisComment_Entry vendor_string;
@@ -637,11 +644,11 @@ typedef struct {
FLAC__StreamMetadata_VorbisComment_Entry *comments; FLAC__StreamMetadata_VorbisComment_Entry *comments;
} FLAC__StreamMetadata_VorbisComment; } FLAC__StreamMetadata_VorbisComment;
extern FLAC_API const unsigned FLAC__STREAM_METADATA_VORBIS_COMMENT_NUM_COMMENTS_LEN; /**< == 32 (bits) */ extern FLAC_API const uint32_t FLAC__STREAM_METADATA_VORBIS_COMMENT_NUM_COMMENTS_LEN; /**< == 32 (bits) */
/** FLAC CUESHEET track index structure. (See the /** FLAC CUESHEET track index structure. (See the
* <A HREF="../format.html#cuesheet_track_index">format specification</A> for * <A HREF="https://xiph.org/flac/format.html#cuesheet_track_index">format specification</A> for
* the full description of each field.) * the full description of each field.)
*/ */
typedef struct { typedef struct {
@@ -654,13 +661,13 @@ typedef struct {
/**< The index point number. */ /**< The index point number. */
} FLAC__StreamMetadata_CueSheet_Index; } FLAC__StreamMetadata_CueSheet_Index;
extern FLAC_API const unsigned FLAC__STREAM_METADATA_CUESHEET_INDEX_OFFSET_LEN; /**< == 64 (bits) */ extern FLAC_API const uint32_t FLAC__STREAM_METADATA_CUESHEET_INDEX_OFFSET_LEN; /**< == 64 (bits) */
extern FLAC_API const unsigned FLAC__STREAM_METADATA_CUESHEET_INDEX_NUMBER_LEN; /**< == 8 (bits) */ extern FLAC_API const uint32_t FLAC__STREAM_METADATA_CUESHEET_INDEX_NUMBER_LEN; /**< == 8 (bits) */
extern FLAC_API const unsigned FLAC__STREAM_METADATA_CUESHEET_INDEX_RESERVED_LEN; /**< == 3*8 (bits) */ extern FLAC_API const uint32_t FLAC__STREAM_METADATA_CUESHEET_INDEX_RESERVED_LEN; /**< == 3*8 (bits) */
/** FLAC CUESHEET track structure. (See the /** FLAC CUESHEET track structure. (See the
* <A HREF="../format.html#cuesheet_track">format specification</A> for * <A HREF="https://xiph.org/flac/format.html#cuesheet_track">format specification</A> for
* the full description of each field.) * the full description of each field.)
*/ */
typedef struct { typedef struct {
@@ -673,10 +680,10 @@ typedef struct {
char isrc[13]; char isrc[13];
/**< Track ISRC. This is a 12-digit alphanumeric code plus a trailing \c NUL byte */ /**< Track ISRC. This is a 12-digit alphanumeric code plus a trailing \c NUL byte */
unsigned type:1; uint32_t type:1;
/**< The track type: 0 for audio, 1 for non-audio. */ /**< The track type: 0 for audio, 1 for non-audio. */
unsigned pre_emphasis:1; uint32_t pre_emphasis:1;
/**< The pre-emphasis flag: 0 for no pre-emphasis, 1 for pre-emphasis. */ /**< The pre-emphasis flag: 0 for no pre-emphasis, 1 for pre-emphasis. */
FLAC__byte num_indices; FLAC__byte num_indices;
@@ -687,17 +694,17 @@ typedef struct {
} FLAC__StreamMetadata_CueSheet_Track; } FLAC__StreamMetadata_CueSheet_Track;
extern FLAC_API const unsigned FLAC__STREAM_METADATA_CUESHEET_TRACK_OFFSET_LEN; /**< == 64 (bits) */ extern FLAC_API const uint32_t FLAC__STREAM_METADATA_CUESHEET_TRACK_OFFSET_LEN; /**< == 64 (bits) */
extern FLAC_API const unsigned FLAC__STREAM_METADATA_CUESHEET_TRACK_NUMBER_LEN; /**< == 8 (bits) */ extern FLAC_API const uint32_t FLAC__STREAM_METADATA_CUESHEET_TRACK_NUMBER_LEN; /**< == 8 (bits) */
extern FLAC_API const unsigned FLAC__STREAM_METADATA_CUESHEET_TRACK_ISRC_LEN; /**< == 12*8 (bits) */ extern FLAC_API const uint32_t FLAC__STREAM_METADATA_CUESHEET_TRACK_ISRC_LEN; /**< == 12*8 (bits) */
extern FLAC_API const unsigned FLAC__STREAM_METADATA_CUESHEET_TRACK_TYPE_LEN; /**< == 1 (bit) */ extern FLAC_API const uint32_t FLAC__STREAM_METADATA_CUESHEET_TRACK_TYPE_LEN; /**< == 1 (bit) */
extern FLAC_API const unsigned FLAC__STREAM_METADATA_CUESHEET_TRACK_PRE_EMPHASIS_LEN; /**< == 1 (bit) */ extern FLAC_API const uint32_t FLAC__STREAM_METADATA_CUESHEET_TRACK_PRE_EMPHASIS_LEN; /**< == 1 (bit) */
extern FLAC_API const unsigned FLAC__STREAM_METADATA_CUESHEET_TRACK_RESERVED_LEN; /**< == 6+13*8 (bits) */ extern FLAC_API const uint32_t FLAC__STREAM_METADATA_CUESHEET_TRACK_RESERVED_LEN; /**< == 6+13*8 (bits) */
extern FLAC_API const unsigned FLAC__STREAM_METADATA_CUESHEET_TRACK_NUM_INDICES_LEN; /**< == 8 (bits) */ extern FLAC_API const uint32_t FLAC__STREAM_METADATA_CUESHEET_TRACK_NUM_INDICES_LEN; /**< == 8 (bits) */
/** FLAC CUESHEET structure. (See the /** FLAC CUESHEET structure. (See the
* <A HREF="../format.html#metadata_block_cuesheet">format specification</A> * <A HREF="https://xiph.org/flac/format.html#metadata_block_cuesheet">format specification</A>
* for the full description of each field.) * for the full description of each field.)
*/ */
typedef struct { typedef struct {
@@ -713,7 +720,7 @@ typedef struct {
FLAC__bool is_cd; FLAC__bool is_cd;
/**< \c true if CUESHEET corresponds to a Compact Disc, else \c false. */ /**< \c true if CUESHEET corresponds to a Compact Disc, else \c false. */
unsigned num_tracks; uint32_t num_tracks;
/**< The number of tracks. */ /**< The number of tracks. */
FLAC__StreamMetadata_CueSheet_Track *tracks; FLAC__StreamMetadata_CueSheet_Track *tracks;
@@ -721,11 +728,11 @@ typedef struct {
} FLAC__StreamMetadata_CueSheet; } FLAC__StreamMetadata_CueSheet;
extern FLAC_API const unsigned FLAC__STREAM_METADATA_CUESHEET_MEDIA_CATALOG_NUMBER_LEN; /**< == 128*8 (bits) */ extern FLAC_API const uint32_t FLAC__STREAM_METADATA_CUESHEET_MEDIA_CATALOG_NUMBER_LEN; /**< == 128*8 (bits) */
extern FLAC_API const unsigned FLAC__STREAM_METADATA_CUESHEET_LEAD_IN_LEN; /**< == 64 (bits) */ extern FLAC_API const uint32_t FLAC__STREAM_METADATA_CUESHEET_LEAD_IN_LEN; /**< == 64 (bits) */
extern FLAC_API const unsigned FLAC__STREAM_METADATA_CUESHEET_IS_CD_LEN; /**< == 1 (bit) */ extern FLAC_API const uint32_t FLAC__STREAM_METADATA_CUESHEET_IS_CD_LEN; /**< == 1 (bit) */
extern FLAC_API const unsigned FLAC__STREAM_METADATA_CUESHEET_RESERVED_LEN; /**< == 7+258*8 (bits) */ extern FLAC_API const uint32_t FLAC__STREAM_METADATA_CUESHEET_RESERVED_LEN; /**< == 7+258*8 (bits) */
extern FLAC_API const unsigned FLAC__STREAM_METADATA_CUESHEET_NUM_TRACKS_LEN; /**< == 8 (bits) */ extern FLAC_API const uint32_t FLAC__STREAM_METADATA_CUESHEET_NUM_TRACKS_LEN; /**< == 8 (bits) */
/** An enumeration of the PICTURE types (see FLAC__StreamMetadataPicture and id3 v2.4 APIC tag). */ /** An enumeration of the PICTURE types (see FLAC__StreamMetadataPicture and id3 v2.4 APIC tag). */
@@ -763,7 +770,7 @@ typedef enum {
extern FLAC_API const char * const FLAC__StreamMetadata_Picture_TypeString[]; extern FLAC_API const char * const FLAC__StreamMetadata_Picture_TypeString[];
/** FLAC PICTURE structure. (See the /** FLAC PICTURE structure. (See the
* <A HREF="../format.html#metadata_block_picture">format specification</A> * <A HREF="https://xiph.org/flac/format.html#metadata_block_picture">format specification</A>
* for the full description of each field.) * for the full description of each field.)
*/ */
typedef struct { typedef struct {
@@ -810,14 +817,14 @@ typedef struct {
} FLAC__StreamMetadata_Picture; } FLAC__StreamMetadata_Picture;
extern FLAC_API const unsigned FLAC__STREAM_METADATA_PICTURE_TYPE_LEN; /**< == 32 (bits) */ extern FLAC_API const uint32_t FLAC__STREAM_METADATA_PICTURE_TYPE_LEN; /**< == 32 (bits) */
extern FLAC_API const unsigned FLAC__STREAM_METADATA_PICTURE_MIME_TYPE_LENGTH_LEN; /**< == 32 (bits) */ extern FLAC_API const uint32_t FLAC__STREAM_METADATA_PICTURE_MIME_TYPE_LENGTH_LEN; /**< == 32 (bits) */
extern FLAC_API const unsigned FLAC__STREAM_METADATA_PICTURE_DESCRIPTION_LENGTH_LEN; /**< == 32 (bits) */ extern FLAC_API const uint32_t FLAC__STREAM_METADATA_PICTURE_DESCRIPTION_LENGTH_LEN; /**< == 32 (bits) */
extern FLAC_API const unsigned FLAC__STREAM_METADATA_PICTURE_WIDTH_LEN; /**< == 32 (bits) */ extern FLAC_API const uint32_t FLAC__STREAM_METADATA_PICTURE_WIDTH_LEN; /**< == 32 (bits) */
extern FLAC_API const unsigned FLAC__STREAM_METADATA_PICTURE_HEIGHT_LEN; /**< == 32 (bits) */ extern FLAC_API const uint32_t FLAC__STREAM_METADATA_PICTURE_HEIGHT_LEN; /**< == 32 (bits) */
extern FLAC_API const unsigned FLAC__STREAM_METADATA_PICTURE_DEPTH_LEN; /**< == 32 (bits) */ extern FLAC_API const uint32_t FLAC__STREAM_METADATA_PICTURE_DEPTH_LEN; /**< == 32 (bits) */
extern FLAC_API const unsigned FLAC__STREAM_METADATA_PICTURE_COLORS_LEN; /**< == 32 (bits) */ extern FLAC_API const uint32_t FLAC__STREAM_METADATA_PICTURE_COLORS_LEN; /**< == 32 (bits) */
extern FLAC_API const unsigned FLAC__STREAM_METADATA_PICTURE_DATA_LENGTH_LEN; /**< == 32 (bits) */ extern FLAC_API const uint32_t FLAC__STREAM_METADATA_PICTURE_DATA_LENGTH_LEN; /**< == 32 (bits) */
/** Structure that is used when a metadata block of unknown type is loaded. /** Structure that is used when a metadata block of unknown type is loaded.
@@ -829,9 +836,9 @@ typedef struct {
} FLAC__StreamMetadata_Unknown; } FLAC__StreamMetadata_Unknown;
/** FLAC metadata block structure. (c.f. <A HREF="../format.html#metadata_block">format specification</A>) /** FLAC metadata block structure. (c.f. <A HREF="https://xiph.org/flac/format.html#metadata_block">format specification</A>)
*/ */
typedef struct { typedef struct FLAC__StreamMetadata {
FLAC__MetadataType type; FLAC__MetadataType type;
/**< The type of the metadata block; used determine which member of the /**< The type of the metadata block; used determine which member of the
* \a data union to dereference. If type >= FLAC__METADATA_TYPE_UNDEFINED * \a data union to dereference. If type >= FLAC__METADATA_TYPE_UNDEFINED
@@ -840,7 +847,7 @@ typedef struct {
FLAC__bool is_last; FLAC__bool is_last;
/**< \c true if this metadata block is the last, else \a false */ /**< \c true if this metadata block is the last, else \a false */
unsigned length; uint32_t length;
/**< Length, in bytes, of the block data as it appears in the stream. */ /**< Length, in bytes, of the block data as it appears in the stream. */
union { union {
@@ -857,9 +864,9 @@ typedef struct {
* to use. */ * to use. */
} FLAC__StreamMetadata; } FLAC__StreamMetadata;
extern FLAC_API const unsigned FLAC__STREAM_METADATA_IS_LAST_LEN; /**< == 1 (bit) */ extern FLAC_API const uint32_t FLAC__STREAM_METADATA_IS_LAST_LEN; /**< == 1 (bit) */
extern FLAC_API const unsigned FLAC__STREAM_METADATA_TYPE_LEN; /**< == 7 (bits) */ extern FLAC_API const uint32_t FLAC__STREAM_METADATA_TYPE_LEN; /**< == 7 (bits) */
extern FLAC_API const unsigned FLAC__STREAM_METADATA_LENGTH_LEN; /**< == 24 (bits) */ extern FLAC_API const uint32_t FLAC__STREAM_METADATA_LENGTH_LEN; /**< == 24 (bits) */
/** The total stream length of a metadata block header in bytes. */ /** The total stream length of a metadata block header in bytes. */
#define FLAC__STREAM_METADATA_HEADER_LENGTH (4u) #define FLAC__STREAM_METADATA_HEADER_LENGTH (4u)
@@ -880,7 +887,7 @@ extern FLAC_API const unsigned FLAC__STREAM_METADATA_LENGTH_LEN; /**< == 24 (bit
* \c true if the given sample rate conforms to the specification, else * \c true if the given sample rate conforms to the specification, else
* \c false. * \c false.
*/ */
FLAC_API FLAC__bool FLAC__format_sample_rate_is_valid(unsigned sample_rate); FLAC_API FLAC__bool FLAC__format_sample_rate_is_valid(uint32_t sample_rate);
/** Tests that a blocksize at the given sample rate is valid for the FLAC /** Tests that a blocksize at the given sample rate is valid for the FLAC
* subset. * subset.
@@ -892,7 +899,7 @@ FLAC_API FLAC__bool FLAC__format_sample_rate_is_valid(unsigned sample_rate);
* \c true if the given blocksize conforms to the specification for the * \c true if the given blocksize conforms to the specification for the
* subset at the given sample rate, else \c false. * subset at the given sample rate, else \c false.
*/ */
FLAC_API FLAC__bool FLAC__format_blocksize_is_subset(unsigned blocksize, unsigned sample_rate); FLAC_API FLAC__bool FLAC__format_blocksize_is_subset(uint32_t blocksize, uint32_t sample_rate);
/** Tests that a sample rate is valid for the FLAC subset. The subset rules /** Tests that a sample rate is valid for the FLAC subset. The subset rules
* for valid sample rates are slightly more complex since the rate has to * for valid sample rates are slightly more complex since the rate has to
@@ -903,7 +910,7 @@ FLAC_API FLAC__bool FLAC__format_blocksize_is_subset(unsigned blocksize, unsigne
* \c true if the given sample rate conforms to the specification for the * \c true if the given sample rate conforms to the specification for the
* subset, else \c false. * subset, else \c false.
*/ */
FLAC_API FLAC__bool FLAC__format_sample_rate_is_subset(unsigned sample_rate); FLAC_API FLAC__bool FLAC__format_sample_rate_is_subset(uint32_t sample_rate);
/** Check a Vorbis comment entry name to see if it conforms to the Vorbis /** Check a Vorbis comment entry name to see if it conforms to the Vorbis
* comment specification. * comment specification.
@@ -926,14 +933,14 @@ FLAC_API FLAC__bool FLAC__format_vorbiscomment_entry_name_is_legal(const char *n
* *
* \param value A string to be checked. * \param value A string to be checked.
* \param length A the length of \a value in bytes. May be * \param length A the length of \a value in bytes. May be
* \c (unsigned)(-1) to indicate that \a value is a plain * \c (uint32_t)(-1) to indicate that \a value is a plain
* UTF-8 NUL-terminated string. * UTF-8 NUL-terminated string.
* \assert * \assert
* \code value != NULL \endcode * \code value != NULL \endcode
* \retval FLAC__bool * \retval FLAC__bool
* \c false if entry name is illegal, else \c true. * \c false if entry name is illegal, else \c true.
*/ */
FLAC_API FLAC__bool FLAC__format_vorbiscomment_entry_value_is_legal(const FLAC__byte *value, unsigned length); FLAC_API FLAC__bool FLAC__format_vorbiscomment_entry_value_is_legal(const FLAC__byte *value, uint32_t length);
/** Check a Vorbis comment entry to see if it conforms to the Vorbis /** Check a Vorbis comment entry to see if it conforms to the Vorbis
* comment specification. * comment specification.
@@ -950,7 +957,7 @@ FLAC_API FLAC__bool FLAC__format_vorbiscomment_entry_value_is_legal(const FLAC__
* \retval FLAC__bool * \retval FLAC__bool
* \c false if entry name is illegal, else \c true. * \c false if entry name is illegal, else \c true.
*/ */
FLAC_API FLAC__bool FLAC__format_vorbiscomment_entry_is_legal(const FLAC__byte *entry, unsigned length); FLAC_API FLAC__bool FLAC__format_vorbiscomment_entry_is_legal(const FLAC__byte *entry, uint32_t length);
/** Check a seek table to see if it conforms to the FLAC specification. /** Check a seek table to see if it conforms to the FLAC specification.
* See the format specification for limits on the contents of the * See the format specification for limits on the contents of the
@@ -973,10 +980,10 @@ FLAC_API FLAC__bool FLAC__format_seektable_is_legal(const FLAC__StreamMetadata_S
* \param seek_table A pointer to a seek table to be sorted. * \param seek_table A pointer to a seek table to be sorted.
* \assert * \assert
* \code seek_table != NULL \endcode * \code seek_table != NULL \endcode
* \retval unsigned * \retval uint32_t
* The number of duplicate seek points converted into placeholders. * The number of duplicate seek points converted into placeholders.
*/ */
FLAC_API unsigned FLAC__format_seektable_sort(FLAC__StreamMetadata_SeekTable *seek_table); FLAC_API uint32_t FLAC__format_seektable_sort(FLAC__StreamMetadata_SeekTable *seek_table);
/** Check a cue sheet to see if it conforms to the FLAC specification. /** Check a cue sheet to see if it conforms to the FLAC specification.
* See the format specification for limits on the contents of the * See the format specification for limits on the contents of the

View File

@@ -1,6 +1,6 @@
/* libFLAC - Free Lossless Audio Codec library /* libFLAC - Free Lossless Audio Codec library
* Copyright (C) 2001-2009 Josh Coalson * Copyright (C) 2001-2009 Josh Coalson
* Copyright (C) 2011-2014 Xiph.Org Foundation * Copyright (C) 2011-2022 Xiph.Org Foundation
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions * modification, are permitted provided that the following conditions
@@ -93,7 +93,7 @@
* Efficient means the whole file is rewritten at most one time, and only * Efficient means the whole file is rewritten at most one time, and only
* when necessary. Level 1 is not efficient only in the case that you * when necessary. Level 1 is not efficient only in the case that you
* cause more than one metadata block to grow or shrink beyond what can * cause more than one metadata block to grow or shrink beyond what can
* be accomodated by padding. In this case you should probably use level * be accommodated by padding. In this case you should probably use level
* 2, which allows you to edit all the metadata for a file in memory and * 2, which allows you to edit all the metadata for a file in memory and
* write it out all at once. * write it out all at once.
* *
@@ -134,6 +134,11 @@ extern "C" {
* STREAMINFO, VORBIS_COMMENT, CUESHEET, and PICTURE blocks, requiring * STREAMINFO, VORBIS_COMMENT, CUESHEET, and PICTURE blocks, requiring
* only a filename. * only a filename.
* *
* On Windows, filename must be a UTF-8 encoded filename, which libFLAC
* internally translates to an appropriate representation to use with
* _wfopen. On all other systems, filename is passed to fopen without
* any translation.
*
* They try to skip any ID3v2 tag at the head of the file. * They try to skip any ID3v2 tag at the head of the file.
* *
* \{ * \{
@@ -217,13 +222,13 @@ FLAC_API FLAC__bool FLAC__metadata_get_cuesheet(const char *filename, FLAC__Stre
* matched exactly. Use \c NULL to mean "any * matched exactly. Use \c NULL to mean "any
* description". * description".
* \param max_width The maximum width in pixels desired. Use * \param max_width The maximum width in pixels desired. Use
* \c (unsigned)(-1) to mean "any width". * \c (uint32_t)(-1) to mean "any width".
* \param max_height The maximum height in pixels desired. Use * \param max_height The maximum height in pixels desired. Use
* \c (unsigned)(-1) to mean "any height". * \c (uint32_t)(-1) to mean "any height".
* \param max_depth The maximum color depth in bits-per-pixel desired. * \param max_depth The maximum color depth in bits-per-pixel desired.
* Use \c (unsigned)(-1) to mean "any depth". * Use \c (uint32_t)(-1) to mean "any depth".
* \param max_colors The maximum number of colors desired. Use * \param max_colors The maximum number of colors desired. Use
* \c (unsigned)(-1) to mean "any number of colors". * \c (uint32_t)(-1) to mean "any number of colors".
* \assert * \assert
* \code filename != NULL \endcode * \code filename != NULL \endcode
* \code picture != NULL \endcode * \code picture != NULL \endcode
@@ -234,7 +239,7 @@ FLAC_API FLAC__bool FLAC__metadata_get_cuesheet(const char *filename, FLAC__Stre
* error, a file decoder error, or the file contained no PICTURE * error, a file decoder error, or the file contained no PICTURE
* block, and \a *picture will be set to \c NULL. * block, and \a *picture will be set to \c NULL.
*/ */
FLAC_API FLAC__bool FLAC__metadata_get_picture(const char *filename, FLAC__StreamMetadata **picture, FLAC__StreamMetadata_Picture_Type type, const char *mime_type, const FLAC__byte *description, unsigned max_width, unsigned max_height, unsigned max_depth, unsigned max_colors); FLAC_API FLAC__bool FLAC__metadata_get_picture(const char *filename, FLAC__StreamMetadata **picture, FLAC__StreamMetadata_Picture_Type type, const char *mime_type, const FLAC__byte *description, uint32_t max_width, uint32_t max_height, uint32_t max_depth, uint32_t max_colors);
/* \} */ /* \} */
@@ -387,6 +392,11 @@ FLAC_API FLAC__Metadata_SimpleIteratorStatus FLAC__metadata_simple_iterator_stat
/** Initialize the iterator to point to the first metadata block in the /** Initialize the iterator to point to the first metadata block in the
* given FLAC file. * given FLAC file.
* *
* On Windows, filename must be a UTF-8 encoded filename, which libFLAC
* internally translates to an appropriate representation to use with
* _wfopen. On all other systems, filename is passed to fopen without
* any translation.
*
* \param iterator A pointer to an existing iterator. * \param iterator A pointer to an existing iterator.
* \param filename The path to the FLAC file. * \param filename The path to the FLAC file.
* \param read_only If \c true, the FLAC file will be opened * \param read_only If \c true, the FLAC file will be opened
@@ -497,13 +507,13 @@ FLAC_API FLAC__MetadataType FLAC__metadata_simple_iterator_get_block_type(const
* \code iterator != NULL \endcode * \code iterator != NULL \endcode
* \a iterator has been successfully initialized with * \a iterator has been successfully initialized with
* FLAC__metadata_simple_iterator_init() * FLAC__metadata_simple_iterator_init()
* \retval unsigned * \retval uint32_t
* The length of the metadata block at the current iterator position. * The length of the metadata block at the current iterator position.
* The is same length as that in the * The is same length as that in the
* <a href="http://xiph.org/flac/format.html#metadata_block_header">metadata block header</a>, * <a href="http://xiph.org/flhttps://xiph.org/flac/format.html#metadata_block_header">metadata block header</a>,
* i.e. the length of the metadata body that follows the header. * i.e. the length of the metadata body that follows the header.
*/ */
FLAC_API unsigned FLAC__metadata_simple_iterator_get_block_length(const FLAC__Metadata_SimpleIterator *iterator); FLAC_API uint32_t FLAC__metadata_simple_iterator_get_block_length(const FLAC__Metadata_SimpleIterator *iterator);
/** Get the application ID of the \c APPLICATION block at the current /** Get the application ID of the \c APPLICATION block at the current
* position. This avoids reading the actual block data which can save * position. This avoids reading the actual block data which can save
@@ -667,7 +677,7 @@ FLAC_API FLAC__bool FLAC__metadata_simple_iterator_delete_block(FLAC__Metadata_S
* *
* - Create a new chain using FLAC__metadata_chain_new(). A chain is a * - Create a new chain using FLAC__metadata_chain_new(). A chain is a
* linked list of FLAC metadata blocks. * linked list of FLAC metadata blocks.
* - Read all metadata into the the chain from a FLAC file using * - Read all metadata into the chain from a FLAC file using
* FLAC__metadata_chain_read() or FLAC__metadata_chain_read_ogg() and * FLAC__metadata_chain_read() or FLAC__metadata_chain_read_ogg() and
* check the status. * check the status.
* - Optionally, consolidate the padding using * - Optionally, consolidate the padding using
@@ -819,6 +829,11 @@ FLAC_API void FLAC__metadata_chain_delete(FLAC__Metadata_Chain *chain);
FLAC_API FLAC__Metadata_ChainStatus FLAC__metadata_chain_status(FLAC__Metadata_Chain *chain); FLAC_API FLAC__Metadata_ChainStatus FLAC__metadata_chain_status(FLAC__Metadata_Chain *chain);
/** Read all metadata from a FLAC file into the chain. /** Read all metadata from a FLAC file into the chain.
*
* On Windows, filename must be a UTF-8 encoded filename, which libFLAC
* internally translates to an appropriate representation to use with
* _wfopen. On all other systems, filename is passed to fopen without
* any translation.
* *
* \param chain A pointer to an existing chain. * \param chain A pointer to an existing chain.
* \param filename The path to the FLAC file to read. * \param filename The path to the FLAC file to read.
@@ -833,6 +848,11 @@ FLAC_API FLAC__Metadata_ChainStatus FLAC__metadata_chain_status(FLAC__Metadata_C
FLAC_API FLAC__bool FLAC__metadata_chain_read(FLAC__Metadata_Chain *chain, const char *filename); FLAC_API FLAC__bool FLAC__metadata_chain_read(FLAC__Metadata_Chain *chain, const char *filename);
/** Read all metadata from an Ogg FLAC file into the chain. /** Read all metadata from an Ogg FLAC file into the chain.
*
* On Windows, filename must be a UTF-8 encoded filename, which libFLAC
* internally translates to an appropriate representation to use with
* _wfopen. On all other systems, filename is passed to fopen without
* any translation.
* *
* \note Ogg FLAC metadata data writing is not supported yet and * \note Ogg FLAC metadata data writing is not supported yet and
* FLAC__metadata_chain_write() will fail. * FLAC__metadata_chain_write() will fail.
@@ -1373,12 +1393,13 @@ FLAC_API FLAC__bool FLAC__metadata_object_is_equal(const FLAC__StreamMetadata *b
* \retval FLAC__bool * \retval FLAC__bool
* \c false if \a copy is \c true and malloc() fails, else \c true. * \c false if \a copy is \c true and malloc() fails, else \c true.
*/ */
FLAC_API FLAC__bool FLAC__metadata_object_application_set_data(FLAC__StreamMetadata *object, FLAC__byte *data, unsigned length, FLAC__bool copy); FLAC_API FLAC__bool FLAC__metadata_object_application_set_data(FLAC__StreamMetadata *object, FLAC__byte *data, uint32_t length, FLAC__bool copy);
/** Resize the seekpoint array. /** Resize the seekpoint array.
* *
* If the size shrinks, elements will truncated; if it grows, new placeholder * If the size shrinks, elements will truncated; if it grows, new placeholder
* points will be added to the end. * points will be added to the end. If this function returns false, the
* object is left untouched.
* *
* \param object A pointer to an existing SEEKTABLE object. * \param object A pointer to an existing SEEKTABLE object.
* \param new_num_points The desired length of the array; may be \c 0. * \param new_num_points The desired length of the array; may be \c 0.
@@ -1390,7 +1411,7 @@ FLAC_API FLAC__bool FLAC__metadata_object_application_set_data(FLAC__StreamMetad
* \retval FLAC__bool * \retval FLAC__bool
* \c false if memory allocation error, else \c true. * \c false if memory allocation error, else \c true.
*/ */
FLAC_API FLAC__bool FLAC__metadata_object_seektable_resize_points(FLAC__StreamMetadata *object, unsigned new_num_points); FLAC_API FLAC__bool FLAC__metadata_object_seektable_resize_points(FLAC__StreamMetadata *object, uint32_t new_num_points);
/** Set a seekpoint in a seektable. /** Set a seekpoint in a seektable.
* *
@@ -1402,7 +1423,7 @@ FLAC_API FLAC__bool FLAC__metadata_object_seektable_resize_points(FLAC__StreamMe
* \code object->type == FLAC__METADATA_TYPE_SEEKTABLE \endcode * \code object->type == FLAC__METADATA_TYPE_SEEKTABLE \endcode
* \code object->data.seek_table.num_points > point_num \endcode * \code object->data.seek_table.num_points > point_num \endcode
*/ */
FLAC_API void FLAC__metadata_object_seektable_set_point(FLAC__StreamMetadata *object, unsigned point_num, FLAC__StreamMetadata_SeekPoint point); FLAC_API void FLAC__metadata_object_seektable_set_point(FLAC__StreamMetadata *object, uint32_t point_num, FLAC__StreamMetadata_SeekPoint point);
/** Insert a seekpoint into a seektable. /** Insert a seekpoint into a seektable.
* *
@@ -1416,7 +1437,7 @@ FLAC_API void FLAC__metadata_object_seektable_set_point(FLAC__StreamMetadata *ob
* \retval FLAC__bool * \retval FLAC__bool
* \c false if memory allocation error, else \c true. * \c false if memory allocation error, else \c true.
*/ */
FLAC_API FLAC__bool FLAC__metadata_object_seektable_insert_point(FLAC__StreamMetadata *object, unsigned point_num, FLAC__StreamMetadata_SeekPoint point); FLAC_API FLAC__bool FLAC__metadata_object_seektable_insert_point(FLAC__StreamMetadata *object, uint32_t point_num, FLAC__StreamMetadata_SeekPoint point);
/** Delete a seekpoint from a seektable. /** Delete a seekpoint from a seektable.
* *
@@ -1429,7 +1450,7 @@ FLAC_API FLAC__bool FLAC__metadata_object_seektable_insert_point(FLAC__StreamMet
* \retval FLAC__bool * \retval FLAC__bool
* \c false if memory allocation error, else \c true. * \c false if memory allocation error, else \c true.
*/ */
FLAC_API FLAC__bool FLAC__metadata_object_seektable_delete_point(FLAC__StreamMetadata *object, unsigned point_num); FLAC_API FLAC__bool FLAC__metadata_object_seektable_delete_point(FLAC__StreamMetadata *object, uint32_t point_num);
/** Check a seektable to see if it conforms to the FLAC specification. /** Check a seektable to see if it conforms to the FLAC specification.
* See the format specification for limits on the contents of the * See the format specification for limits on the contents of the
@@ -1459,7 +1480,7 @@ FLAC_API FLAC__bool FLAC__metadata_object_seektable_is_legal(const FLAC__StreamM
* \retval FLAC__bool * \retval FLAC__bool
* \c false if memory allocation fails, else \c true. * \c false if memory allocation fails, else \c true.
*/ */
FLAC_API FLAC__bool FLAC__metadata_object_seektable_template_append_placeholders(FLAC__StreamMetadata *object, unsigned num); FLAC_API FLAC__bool FLAC__metadata_object_seektable_template_append_placeholders(FLAC__StreamMetadata *object, uint32_t num);
/** Append a specific seek point template to the end of a seek table. /** Append a specific seek point template to the end of a seek table.
* *
@@ -1494,7 +1515,7 @@ FLAC_API FLAC__bool FLAC__metadata_object_seektable_template_append_point(FLAC__
* \retval FLAC__bool * \retval FLAC__bool
* \c false if memory allocation fails, else \c true. * \c false if memory allocation fails, else \c true.
*/ */
FLAC_API FLAC__bool FLAC__metadata_object_seektable_template_append_points(FLAC__StreamMetadata *object, FLAC__uint64 sample_numbers[], unsigned num); FLAC_API FLAC__bool FLAC__metadata_object_seektable_template_append_points(FLAC__StreamMetadata *object, FLAC__uint64 sample_numbers[], uint32_t num);
/** Append a set of evenly-spaced seek point templates to the end of a /** Append a set of evenly-spaced seek point templates to the end of a
* seek table. * seek table.
@@ -1516,7 +1537,7 @@ FLAC_API FLAC__bool FLAC__metadata_object_seektable_template_append_points(FLAC_
* \retval FLAC__bool * \retval FLAC__bool
* \c false if memory allocation fails, else \c true. * \c false if memory allocation fails, else \c true.
*/ */
FLAC_API FLAC__bool FLAC__metadata_object_seektable_template_append_spaced_points(FLAC__StreamMetadata *object, unsigned num, FLAC__uint64 total_samples); FLAC_API FLAC__bool FLAC__metadata_object_seektable_template_append_spaced_points(FLAC__StreamMetadata *object, uint32_t num, FLAC__uint64 total_samples);
/** Append a set of evenly-spaced seek point templates to the end of a /** Append a set of evenly-spaced seek point templates to the end of a
* seek table. * seek table.
@@ -1544,7 +1565,7 @@ FLAC_API FLAC__bool FLAC__metadata_object_seektable_template_append_spaced_point
* \retval FLAC__bool * \retval FLAC__bool
* \c false if memory allocation fails, else \c true. * \c false if memory allocation fails, else \c true.
*/ */
FLAC_API FLAC__bool FLAC__metadata_object_seektable_template_append_spaced_points_by_samples(FLAC__StreamMetadata *object, unsigned samples, FLAC__uint64 total_samples); FLAC_API FLAC__bool FLAC__metadata_object_seektable_template_append_spaced_points_by_samples(FLAC__StreamMetadata *object, uint32_t samples, FLAC__uint64 total_samples);
/** Sort a seek table's seek points according to the format specification, /** Sort a seek table's seek points according to the format specification,
* removing duplicates. * removing duplicates.
@@ -1591,7 +1612,8 @@ FLAC_API FLAC__bool FLAC__metadata_object_vorbiscomment_set_vendor_string(FLAC__
/** Resize the comment array. /** Resize the comment array.
* *
* If the size shrinks, elements will truncated; if it grows, new empty * If the size shrinks, elements will truncated; if it grows, new empty
* fields will be added to the end. * fields will be added to the end. If this function returns false, the
* object is left untouched.
* *
* \param object A pointer to an existing VORBIS_COMMENT object. * \param object A pointer to an existing VORBIS_COMMENT object.
* \param new_num_comments The desired length of the array; may be \c 0. * \param new_num_comments The desired length of the array; may be \c 0.
@@ -1603,7 +1625,7 @@ FLAC_API FLAC__bool FLAC__metadata_object_vorbiscomment_set_vendor_string(FLAC__
* \retval FLAC__bool * \retval FLAC__bool
* \c false if memory allocation fails, else \c true. * \c false if memory allocation fails, else \c true.
*/ */
FLAC_API FLAC__bool FLAC__metadata_object_vorbiscomment_resize_comments(FLAC__StreamMetadata *object, unsigned new_num_comments); FLAC_API FLAC__bool FLAC__metadata_object_vorbiscomment_resize_comments(FLAC__StreamMetadata *object, uint32_t new_num_comments);
/** Sets a comment in a VORBIS_COMMENT block. /** Sets a comment in a VORBIS_COMMENT block.
* *
@@ -1630,7 +1652,7 @@ FLAC_API FLAC__bool FLAC__metadata_object_vorbiscomment_resize_comments(FLAC__St
* \c false if memory allocation fails or \a entry does not comply with the * \c false if memory allocation fails or \a entry does not comply with the
* Vorbis comment specification, else \c true. * Vorbis comment specification, else \c true.
*/ */
FLAC_API FLAC__bool FLAC__metadata_object_vorbiscomment_set_comment(FLAC__StreamMetadata *object, unsigned comment_num, FLAC__StreamMetadata_VorbisComment_Entry entry, FLAC__bool copy); FLAC_API FLAC__bool FLAC__metadata_object_vorbiscomment_set_comment(FLAC__StreamMetadata *object, uint32_t comment_num, FLAC__StreamMetadata_VorbisComment_Entry entry, FLAC__bool copy);
/** Insert a comment in a VORBIS_COMMENT block at the given index. /** Insert a comment in a VORBIS_COMMENT block at the given index.
* *
@@ -1660,7 +1682,7 @@ FLAC_API FLAC__bool FLAC__metadata_object_vorbiscomment_set_comment(FLAC__Stream
* \c false if memory allocation fails or \a entry does not comply with the * \c false if memory allocation fails or \a entry does not comply with the
* Vorbis comment specification, else \c true. * Vorbis comment specification, else \c true.
*/ */
FLAC_API FLAC__bool FLAC__metadata_object_vorbiscomment_insert_comment(FLAC__StreamMetadata *object, unsigned comment_num, FLAC__StreamMetadata_VorbisComment_Entry entry, FLAC__bool copy); FLAC_API FLAC__bool FLAC__metadata_object_vorbiscomment_insert_comment(FLAC__StreamMetadata *object, uint32_t comment_num, FLAC__StreamMetadata_VorbisComment_Entry entry, FLAC__bool copy);
/** Appends a comment to a VORBIS_COMMENT block. /** Appends a comment to a VORBIS_COMMENT block.
* *
@@ -1692,7 +1714,7 @@ FLAC_API FLAC__bool FLAC__metadata_object_vorbiscomment_append_comment(FLAC__Str
* For convenience, a trailing NUL is added to the entry if it doesn't have * For convenience, a trailing NUL is added to the entry if it doesn't have
* one already. * one already.
* *
* Depending on the the value of \a all, either all or just the first comment * Depending on the value of \a all, either all or just the first comment
* whose field name(s) match the given entry's name will be replaced by the * whose field name(s) match the given entry's name will be replaced by the
* given entry. If no comments match, \a entry will simply be appended. * given entry. If no comments match, \a entry will simply be appended.
* *
@@ -1733,7 +1755,7 @@ FLAC_API FLAC__bool FLAC__metadata_object_vorbiscomment_replace_comment(FLAC__St
* \retval FLAC__bool * \retval FLAC__bool
* \c false if realloc() fails, else \c true. * \c false if realloc() fails, else \c true.
*/ */
FLAC_API FLAC__bool FLAC__metadata_object_vorbiscomment_delete_comment(FLAC__StreamMetadata *object, unsigned comment_num); FLAC_API FLAC__bool FLAC__metadata_object_vorbiscomment_delete_comment(FLAC__StreamMetadata *object, uint32_t comment_num);
/** Creates a Vorbis comment entry from NUL-terminated name and value strings. /** Creates a Vorbis comment entry from NUL-terminated name and value strings.
* *
@@ -1789,7 +1811,7 @@ FLAC_API FLAC__bool FLAC__metadata_object_vorbiscomment_entry_to_name_value_pair
* \retval FLAC__bool * \retval FLAC__bool
* \c true if the field names match, else \c false * \c true if the field names match, else \c false
*/ */
FLAC_API FLAC__bool FLAC__metadata_object_vorbiscomment_entry_matches(const FLAC__StreamMetadata_VorbisComment_Entry entry, const char *field_name, unsigned field_name_length); FLAC_API FLAC__bool FLAC__metadata_object_vorbiscomment_entry_matches(const FLAC__StreamMetadata_VorbisComment_Entry entry, const char *field_name, uint32_t field_name_length);
/** Find a Vorbis comment with the given field name. /** Find a Vorbis comment with the given field name.
* *
@@ -1808,7 +1830,7 @@ FLAC_API FLAC__bool FLAC__metadata_object_vorbiscomment_entry_matches(const FLAC
* The offset in the comment array of the first comment whose field * The offset in the comment array of the first comment whose field
* name matches \a field_name, or \c -1 if no match was found. * name matches \a field_name, or \c -1 if no match was found.
*/ */
FLAC_API int FLAC__metadata_object_vorbiscomment_find_entry_from(const FLAC__StreamMetadata *object, unsigned offset, const char *field_name); FLAC_API int FLAC__metadata_object_vorbiscomment_find_entry_from(const FLAC__StreamMetadata *object, uint32_t offset, const char *field_name);
/** Remove first Vorbis comment matching the given field name. /** Remove first Vorbis comment matching the given field name.
* *
@@ -1871,7 +1893,8 @@ FLAC_API void FLAC__metadata_object_cuesheet_track_delete(FLAC__StreamMetadata_C
/** Resize a track's index point array. /** Resize a track's index point array.
* *
* If the size shrinks, elements will truncated; if it grows, new blank * If the size shrinks, elements will truncated; if it grows, new blank
* indices will be added to the end. * indices will be added to the end. If this function returns false, the
* track object is left untouched.
* *
* \param object A pointer to an existing CUESHEET object. * \param object A pointer to an existing CUESHEET object.
* \param track_num The index of the track to modify. NOTE: this is not * \param track_num The index of the track to modify. NOTE: this is not
@@ -1886,7 +1909,7 @@ FLAC_API void FLAC__metadata_object_cuesheet_track_delete(FLAC__StreamMetadata_C
* \retval FLAC__bool * \retval FLAC__bool
* \c false if memory allocation error, else \c true. * \c false if memory allocation error, else \c true.
*/ */
FLAC_API FLAC__bool FLAC__metadata_object_cuesheet_track_resize_indices(FLAC__StreamMetadata *object, unsigned track_num, unsigned new_num_indices); FLAC_API FLAC__bool FLAC__metadata_object_cuesheet_track_resize_indices(FLAC__StreamMetadata *object, uint32_t track_num, uint32_t new_num_indices);
/** Insert an index point in a CUESHEET track at the given index. /** Insert an index point in a CUESHEET track at the given index.
* *
@@ -1909,7 +1932,7 @@ FLAC_API FLAC__bool FLAC__metadata_object_cuesheet_track_resize_indices(FLAC__St
* \retval FLAC__bool * \retval FLAC__bool
* \c false if realloc() fails, else \c true. * \c false if realloc() fails, else \c true.
*/ */
FLAC_API FLAC__bool FLAC__metadata_object_cuesheet_track_insert_index(FLAC__StreamMetadata *object, unsigned track_num, unsigned index_num, FLAC__StreamMetadata_CueSheet_Index index); FLAC_API FLAC__bool FLAC__metadata_object_cuesheet_track_insert_index(FLAC__StreamMetadata *object, uint32_t track_num, uint32_t index_num, FLAC__StreamMetadata_CueSheet_Index index);
/** Insert a blank index point in a CUESHEET track at the given index. /** Insert a blank index point in a CUESHEET track at the given index.
* *
@@ -1933,7 +1956,7 @@ FLAC_API FLAC__bool FLAC__metadata_object_cuesheet_track_insert_index(FLAC__Stre
* \retval FLAC__bool * \retval FLAC__bool
* \c false if realloc() fails, else \c true. * \c false if realloc() fails, else \c true.
*/ */
FLAC_API FLAC__bool FLAC__metadata_object_cuesheet_track_insert_blank_index(FLAC__StreamMetadata *object, unsigned track_num, unsigned index_num); FLAC_API FLAC__bool FLAC__metadata_object_cuesheet_track_insert_blank_index(FLAC__StreamMetadata *object, uint32_t track_num, uint32_t index_num);
/** Delete an index point in a CUESHEET track at the given index. /** Delete an index point in a CUESHEET track at the given index.
* *
@@ -1952,12 +1975,13 @@ FLAC_API FLAC__bool FLAC__metadata_object_cuesheet_track_insert_blank_index(FLAC
* \retval FLAC__bool * \retval FLAC__bool
* \c false if realloc() fails, else \c true. * \c false if realloc() fails, else \c true.
*/ */
FLAC_API FLAC__bool FLAC__metadata_object_cuesheet_track_delete_index(FLAC__StreamMetadata *object, unsigned track_num, unsigned index_num); FLAC_API FLAC__bool FLAC__metadata_object_cuesheet_track_delete_index(FLAC__StreamMetadata *object, uint32_t track_num, uint32_t index_num);
/** Resize the track array. /** Resize the track array.
* *
* If the size shrinks, elements will truncated; if it grows, new blank * If the size shrinks, elements will truncated; if it grows, new blank
* tracks will be added to the end. * tracks will be added to the end. If this function returns false, the
* object is left untouched.
* *
* \param object A pointer to an existing CUESHEET object. * \param object A pointer to an existing CUESHEET object.
* \param new_num_tracks The desired length of the array; may be \c 0. * \param new_num_tracks The desired length of the array; may be \c 0.
@@ -1969,7 +1993,7 @@ FLAC_API FLAC__bool FLAC__metadata_object_cuesheet_track_delete_index(FLAC__Stre
* \retval FLAC__bool * \retval FLAC__bool
* \c false if memory allocation error, else \c true. * \c false if memory allocation error, else \c true.
*/ */
FLAC_API FLAC__bool FLAC__metadata_object_cuesheet_resize_tracks(FLAC__StreamMetadata *object, unsigned new_num_tracks); FLAC_API FLAC__bool FLAC__metadata_object_cuesheet_resize_tracks(FLAC__StreamMetadata *object, uint32_t new_num_tracks);
/** Sets a track in a CUESHEET block. /** Sets a track in a CUESHEET block.
* *
@@ -1991,7 +2015,7 @@ FLAC_API FLAC__bool FLAC__metadata_object_cuesheet_resize_tracks(FLAC__StreamMet
* \retval FLAC__bool * \retval FLAC__bool
* \c false if \a copy is \c true and malloc() fails, else \c true. * \c false if \a copy is \c true and malloc() fails, else \c true.
*/ */
FLAC_API FLAC__bool FLAC__metadata_object_cuesheet_set_track(FLAC__StreamMetadata *object, unsigned track_num, FLAC__StreamMetadata_CueSheet_Track *track, FLAC__bool copy); FLAC_API FLAC__bool FLAC__metadata_object_cuesheet_set_track(FLAC__StreamMetadata *object, uint32_t track_num, FLAC__StreamMetadata_CueSheet_Track *track, FLAC__bool copy);
/** Insert a track in a CUESHEET block at the given index. /** Insert a track in a CUESHEET block at the given index.
* *
@@ -2014,7 +2038,7 @@ FLAC_API FLAC__bool FLAC__metadata_object_cuesheet_set_track(FLAC__StreamMetadat
* \retval FLAC__bool * \retval FLAC__bool
* \c false if \a copy is \c true and malloc() fails, else \c true. * \c false if \a copy is \c true and malloc() fails, else \c true.
*/ */
FLAC_API FLAC__bool FLAC__metadata_object_cuesheet_insert_track(FLAC__StreamMetadata *object, unsigned track_num, FLAC__StreamMetadata_CueSheet_Track *track, FLAC__bool copy); FLAC_API FLAC__bool FLAC__metadata_object_cuesheet_insert_track(FLAC__StreamMetadata *object, uint32_t track_num, FLAC__StreamMetadata_CueSheet_Track *track, FLAC__bool copy);
/** Insert a blank track in a CUESHEET block at the given index. /** Insert a blank track in a CUESHEET block at the given index.
* *
@@ -2033,7 +2057,7 @@ FLAC_API FLAC__bool FLAC__metadata_object_cuesheet_insert_track(FLAC__StreamMeta
* \retval FLAC__bool * \retval FLAC__bool
* \c false if \a copy is \c true and malloc() fails, else \c true. * \c false if \a copy is \c true and malloc() fails, else \c true.
*/ */
FLAC_API FLAC__bool FLAC__metadata_object_cuesheet_insert_blank_track(FLAC__StreamMetadata *object, unsigned track_num); FLAC_API FLAC__bool FLAC__metadata_object_cuesheet_insert_blank_track(FLAC__StreamMetadata *object, uint32_t track_num);
/** Delete a track in a CUESHEET block at the given index. /** Delete a track in a CUESHEET block at the given index.
* *
@@ -2048,7 +2072,7 @@ FLAC_API FLAC__bool FLAC__metadata_object_cuesheet_insert_blank_track(FLAC__Stre
* \retval FLAC__bool * \retval FLAC__bool
* \c false if realloc() fails, else \c true. * \c false if realloc() fails, else \c true.
*/ */
FLAC_API FLAC__bool FLAC__metadata_object_cuesheet_delete_track(FLAC__StreamMetadata *object, unsigned track_num); FLAC_API FLAC__bool FLAC__metadata_object_cuesheet_delete_track(FLAC__StreamMetadata *object, uint32_t track_num);
/** Check a cue sheet to see if it conforms to the FLAC specification. /** Check a cue sheet to see if it conforms to the FLAC specification.
* See the format specification for limits on the contents of the * See the format specification for limits on the contents of the
@@ -2173,6 +2197,34 @@ FLAC_API FLAC__bool FLAC__metadata_object_picture_set_data(FLAC__StreamMetadata
*/ */
FLAC_API FLAC__bool FLAC__metadata_object_picture_is_legal(const FLAC__StreamMetadata *object, const char **violation); FLAC_API FLAC__bool FLAC__metadata_object_picture_is_legal(const FLAC__StreamMetadata *object, const char **violation);
/** Get the raw (binary) representation of a FLAC__StreamMetadata objeect.
* After use, free() the returned buffer. The length of the buffer is
* the length of the input metadata object plus 4 bytes for the header.
*
* \param object A pointer to metadata block to be converted.
* \assert
* \code object != NULL \endcode
* \retval FLAC__byte*
* \c NULL if there was an error, else a pointer to a buffer holding
* the requested data.
*/
FLAC_API FLAC__byte * FLAC__metadata_object_get_raw(const FLAC__StreamMetadata *object);
/** Turn a raw (binary) representation into a FLAC__StreamMetadata objeect.
* The returned object must be deleted with FLAC__metadata_object_delete()
* after use.
*
* \param buffer A pointer to a buffer containing a binary representation
* to be converted to a FLAC__StreamMetadata object
* \param length The length of the supplied buffer
* \retval FLAC__StreamMetadata*
* \c NULL if there was an error, else a pointer to a FLAC__StreamMetadata
* holding the requested data.
*/
FLAC_API FLAC__StreamMetadata * FLAC__metadata_object_set_raw(FLAC__byte *buffer, FLAC__uint32 length);
/* \} */ /* \} */
#ifdef __cplusplus #ifdef __cplusplus

View File

@@ -1,6 +1,6 @@
/* libFLAC - Free Lossless Audio Codec library /* libFLAC - Free Lossless Audio Codec library
* Copyright (C) 2000-2009 Josh Coalson * Copyright (C) 2000-2009 Josh Coalson
* Copyright (C) 2011-2014 Xiph.Org Foundation * Copyright (C) 2011-2022 Xiph.Org Foundation
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions * modification, are permitted provided that the following conditions
@@ -33,27 +33,10 @@
#ifndef FLAC__ORDINALS_H #ifndef FLAC__ORDINALS_H
#define FLAC__ORDINALS_H #define FLAC__ORDINALS_H
#if defined(_MSC_VER) && _MSC_VER < 1600 /* This of course assumes C99 headers */
/* Microsoft Visual Studio earlier than the 2010 version did not provide
* the 1999 ISO C Standard header file <stdint.h>.
*/
typedef __int8 FLAC__int8;
typedef unsigned __int8 FLAC__uint8;
typedef __int16 FLAC__int16;
typedef __int32 FLAC__int32;
typedef __int64 FLAC__int64;
typedef unsigned __int16 FLAC__uint16;
typedef unsigned __int32 FLAC__uint32;
typedef unsigned __int64 FLAC__uint64;
#else
/* For MSVC 2010 and everything else which provides <stdint.h>. */
#include <stdint.h> #include <stdint.h>
#include <stdbool.h>
typedef int8_t FLAC__int8; typedef int8_t FLAC__int8;
typedef uint8_t FLAC__uint8; typedef uint8_t FLAC__uint8;
@@ -65,22 +48,8 @@ typedef uint16_t FLAC__uint16;
typedef uint32_t FLAC__uint32; typedef uint32_t FLAC__uint32;
typedef uint64_t FLAC__uint64; typedef uint64_t FLAC__uint64;
#endif
typedef int FLAC__bool; typedef int FLAC__bool;
typedef FLAC__uint8 FLAC__byte; typedef FLAC__uint8 FLAC__byte;
#ifdef true
#undef true
#endif
#ifdef false
#undef false
#endif
#ifndef __cplusplus
#define true 1
#define false 0
#endif
#endif #endif

View File

@@ -1,6 +1,6 @@
/* libFLAC - Free Lossless Audio Codec library /* libFLAC - Free Lossless Audio Codec library
* Copyright (C) 2000-2009 Josh Coalson * Copyright (C) 2000-2009 Josh Coalson
* Copyright (C) 2011-2014 Xiph.Org Foundation * Copyright (C) 2011-2022 Xiph.Org Foundation
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions * modification, are permitted provided that the following conditions
@@ -228,7 +228,7 @@ typedef enum {
*/ */
FLAC__STREAM_DECODER_ABORTED, FLAC__STREAM_DECODER_ABORTED,
/**< The decoder was aborted by the read callback. */ /**< The decoder was aborted by the read or write callback. */
FLAC__STREAM_DECODER_MEMORY_ALLOCATION_ERROR, FLAC__STREAM_DECODER_MEMORY_ALLOCATION_ERROR,
/**< An error occurred allocating memory. The decoder is in an invalid /**< An error occurred allocating memory. The decoder is in an invalid
@@ -422,7 +422,11 @@ extern FLAC_API const char * const FLAC__StreamDecoderWriteStatusString[];
* could be because the decoder encountered a valid frame made by a future * could be because the decoder encountered a valid frame made by a future
* version of the encoder which it cannot parse, or because of a false * version of the encoder which it cannot parse, or because of a false
* sync making it appear as though an encountered frame was generated by * sync making it appear as though an encountered frame was generated by
* a future encoder. * a future encoder. \c FLAC__STREAM_DECODER_ERROR_STATUS_BAD_METADATA is
* caused by finding data that doesn't fit a metadata block (too large
* or too small) or finding inconsistencies in the metadata, for example
* a PICTURE block with an image that exceeds the size of the metadata
* block.
*/ */
typedef enum { typedef enum {
@@ -435,9 +439,12 @@ typedef enum {
FLAC__STREAM_DECODER_ERROR_STATUS_FRAME_CRC_MISMATCH, FLAC__STREAM_DECODER_ERROR_STATUS_FRAME_CRC_MISMATCH,
/**< The frame's data did not match the CRC in the footer. */ /**< The frame's data did not match the CRC in the footer. */
FLAC__STREAM_DECODER_ERROR_STATUS_UNPARSEABLE_STREAM FLAC__STREAM_DECODER_ERROR_STATUS_UNPARSEABLE_STREAM,
/**< The decoder encountered reserved fields in use in the stream. */ /**< The decoder encountered reserved fields in use in the stream. */
FLAC__STREAM_DECODER_ERROR_STATUS_BAD_METADATA
/**< The decoder encountered a corrupted metadata block. */
} FLAC__StreamDecoderErrorStatus; } FLAC__StreamDecoderErrorStatus;
/** Maps a FLAC__StreamDecoderErrorStatus to a C string. /** Maps a FLAC__StreamDecoderErrorStatus to a C string.
@@ -674,7 +681,7 @@ typedef FLAC__bool (*FLAC__StreamDecoderEofCallback)(const FLAC__StreamDecoder *
* samples of length \a frame->header.blocksize. * samples of length \a frame->header.blocksize.
* Channels will be ordered according to the FLAC * Channels will be ordered according to the FLAC
* specification; see the documentation for the * specification; see the documentation for the
* <A HREF="../format.html#frame_header">frame header</A>. * <A HREF="https://xiph.org/flac/format.html#frame_header">frame header</A>.
* \param client_data The callee's client data set through * \param client_data The callee's client data set through
* FLAC__stream_decoder_init_*(). * FLAC__stream_decoder_init_*().
* \retval FLAC__StreamDecoderWriteStatus * \retval FLAC__StreamDecoderWriteStatus
@@ -920,7 +927,7 @@ FLAC_API FLAC__bool FLAC__stream_decoder_get_md5_checking(const FLAC__StreamDeco
* \param decoder A decoder instance to query. * \param decoder A decoder instance to query.
* \assert * \assert
* \code decoder != NULL \endcode * \code decoder != NULL \endcode
* \retval unsigned * \retval uint32_t
* See above. * See above.
*/ */
FLAC_API FLAC__uint64 FLAC__stream_decoder_get_total_samples(const FLAC__StreamDecoder *decoder); FLAC_API FLAC__uint64 FLAC__stream_decoder_get_total_samples(const FLAC__StreamDecoder *decoder);
@@ -932,10 +939,10 @@ FLAC_API FLAC__uint64 FLAC__stream_decoder_get_total_samples(const FLAC__StreamD
* \param decoder A decoder instance to query. * \param decoder A decoder instance to query.
* \assert * \assert
* \code decoder != NULL \endcode * \code decoder != NULL \endcode
* \retval unsigned * \retval uint32_t
* See above. * See above.
*/ */
FLAC_API unsigned FLAC__stream_decoder_get_channels(const FLAC__StreamDecoder *decoder); FLAC_API uint32_t FLAC__stream_decoder_get_channels(const FLAC__StreamDecoder *decoder);
/** Get the current channel assignment in the stream being decoded. /** Get the current channel assignment in the stream being decoded.
* Will only be valid after decoding has started and will contain the * Will only be valid after decoding has started and will contain the
@@ -956,10 +963,10 @@ FLAC_API FLAC__ChannelAssignment FLAC__stream_decoder_get_channel_assignment(con
* \param decoder A decoder instance to query. * \param decoder A decoder instance to query.
* \assert * \assert
* \code decoder != NULL \endcode * \code decoder != NULL \endcode
* \retval unsigned * \retval uint32_t
* See above. * See above.
*/ */
FLAC_API unsigned FLAC__stream_decoder_get_bits_per_sample(const FLAC__StreamDecoder *decoder); FLAC_API uint32_t FLAC__stream_decoder_get_bits_per_sample(const FLAC__StreamDecoder *decoder);
/** Get the current sample rate in Hz of the stream being decoded. /** Get the current sample rate in Hz of the stream being decoded.
* Will only be valid after decoding has started and will contain the * Will only be valid after decoding has started and will contain the
@@ -968,10 +975,10 @@ FLAC_API unsigned FLAC__stream_decoder_get_bits_per_sample(const FLAC__StreamDec
* \param decoder A decoder instance to query. * \param decoder A decoder instance to query.
* \assert * \assert
* \code decoder != NULL \endcode * \code decoder != NULL \endcode
* \retval unsigned * \retval uint32_t
* See above. * See above.
*/ */
FLAC_API unsigned FLAC__stream_decoder_get_sample_rate(const FLAC__StreamDecoder *decoder); FLAC_API uint32_t FLAC__stream_decoder_get_sample_rate(const FLAC__StreamDecoder *decoder);
/** Get the current blocksize of the stream being decoded. /** Get the current blocksize of the stream being decoded.
* Will only be valid after decoding has started and will contain the * Will only be valid after decoding has started and will contain the
@@ -980,10 +987,10 @@ FLAC_API unsigned FLAC__stream_decoder_get_sample_rate(const FLAC__StreamDecoder
* \param decoder A decoder instance to query. * \param decoder A decoder instance to query.
* \assert * \assert
* \code decoder != NULL \endcode * \code decoder != NULL \endcode
* \retval unsigned * \retval uint32_t
* See above. * See above.
*/ */
FLAC_API unsigned FLAC__stream_decoder_get_blocksize(const FLAC__StreamDecoder *decoder); FLAC_API uint32_t FLAC__stream_decoder_get_blocksize(const FLAC__StreamDecoder *decoder);
/** Returns the decoder's current read position within the stream. /** Returns the decoder's current read position within the stream.
* The position is the byte offset from the start of the stream. * The position is the byte offset from the start of the stream.
@@ -1006,6 +1013,16 @@ FLAC_API unsigned FLAC__stream_decoder_get_blocksize(const FLAC__StreamDecoder *
*/ */
FLAC_API FLAC__bool FLAC__stream_decoder_get_decode_position(const FLAC__StreamDecoder *decoder, FLAC__uint64 *position); FLAC_API FLAC__bool FLAC__stream_decoder_get_decode_position(const FLAC__StreamDecoder *decoder, FLAC__uint64 *position);
/** Return client_data from decoder.
* The data pointed to by the pointer should not be modified.
*
* \param decoder A decoder instance.
* \retval const void *
* The callee's client data set through FLAC__stream_decoder_init_*().
* Do not modify the contents.
*/
FLAC_API const void *FLAC__stream_decoder_get_client_data(FLAC__StreamDecoder *decoder);
/** Initialize the decoder instance to decode native FLAC streams. /** Initialize the decoder instance to decode native FLAC streams.
* *
* This flavor of initialization sets up the decoder to decode from a * This flavor of initialization sets up the decoder to decode from a
@@ -1184,7 +1201,7 @@ FLAC_API FLAC__StreamDecoderInitStatus FLAC__stream_decoder_init_ogg_stream(
* Unless \a file is \c stdin, it will be closed * Unless \a file is \c stdin, it will be closed
* when FLAC__stream_decoder_finish() is called. * when FLAC__stream_decoder_finish() is called.
* Note however that seeking will not work when * Note however that seeking will not work when
* decoding from \c stdout since it is not seekable. * decoding from \c stdin since it is not seekable.
* \param write_callback See FLAC__StreamDecoderWriteCallback. This * \param write_callback See FLAC__StreamDecoderWriteCallback. This
* pointer must not be \c NULL. * pointer must not be \c NULL.
* \param metadata_callback See FLAC__StreamDecoderMetadataCallback. This * \param metadata_callback See FLAC__StreamDecoderMetadataCallback. This
@@ -1234,7 +1251,7 @@ FLAC_API FLAC__StreamDecoderInitStatus FLAC__stream_decoder_init_FILE(
* Unless \a file is \c stdin, it will be closed * Unless \a file is \c stdin, it will be closed
* when FLAC__stream_decoder_finish() is called. * when FLAC__stream_decoder_finish() is called.
* Note however that seeking will not work when * Note however that seeking will not work when
* decoding from \c stdout since it is not seekable. * decoding from \c stdin since it is not seekable.
* \param write_callback See FLAC__StreamDecoderWriteCallback. This * \param write_callback See FLAC__StreamDecoderWriteCallback. This
* pointer must not be \c NULL. * pointer must not be \c NULL.
* \param metadata_callback See FLAC__StreamDecoderMetadataCallback. This * \param metadata_callback See FLAC__StreamDecoderMetadataCallback. This
@@ -1263,11 +1280,15 @@ FLAC_API FLAC__StreamDecoderInitStatus FLAC__stream_decoder_init_ogg_FILE(
/** Initialize the decoder instance to decode native FLAC files. /** Initialize the decoder instance to decode native FLAC files.
* *
* This flavor of initialization sets up the decoder to decode from a plain * This flavor of initialization sets up the decoder to decode from a plain
* native FLAC file. If POSIX fopen() semantics are not sufficient, (for * native FLAC file. If POSIX fopen() semantics are not sufficient, you must
* example, with Unicode filenames on Windows), you must use * use FLAC__stream_decoder_init_FILE(), or FLAC__stream_decoder_init_stream()
* FLAC__stream_decoder_init_FILE(), or FLAC__stream_decoder_init_stream()
* and provide callbacks for the I/O. * and provide callbacks for the I/O.
* *
* On Windows, filename must be a UTF-8 encoded filename, which libFLAC
* internally translates to an appropriate representation to use with
* _wfopen. On all other systems, filename is passed to fopen without
* any translation.
*
* This function should be called after FLAC__stream_decoder_new() and * This function should be called after FLAC__stream_decoder_new() and
* FLAC__stream_decoder_set_*() but before any of the * FLAC__stream_decoder_set_*() but before any of the
* FLAC__stream_decoder_process_*() functions. Will set and return the * FLAC__stream_decoder_process_*() functions. Will set and return the
@@ -1305,11 +1326,15 @@ FLAC_API FLAC__StreamDecoderInitStatus FLAC__stream_decoder_init_file(
/** Initialize the decoder instance to decode Ogg FLAC files. /** Initialize the decoder instance to decode Ogg FLAC files.
* *
* This flavor of initialization sets up the decoder to decode from a plain * This flavor of initialization sets up the decoder to decode from a plain
* Ogg FLAC file. If POSIX fopen() semantics are not sufficient, (for * Ogg FLAC file. If POSIX fopen() semantics are not sufficient, you must use
* example, with Unicode filenames on Windows), you must use
* FLAC__stream_decoder_init_ogg_FILE(), or FLAC__stream_decoder_init_ogg_stream() * FLAC__stream_decoder_init_ogg_FILE(), or FLAC__stream_decoder_init_ogg_stream()
* and provide callbacks for the I/O. * and provide callbacks for the I/O.
* *
* On Windows, filename must be a UTF-8 encoded filename, which libFLAC
* internally translates to an appropriate representation to use with
* _wfopen. On all other systems, filename is passed to fopen without
* any translation.
*
* This function should be called after FLAC__stream_decoder_new() and * This function should be called after FLAC__stream_decoder_new() and
* FLAC__stream_decoder_set_*() but before any of the * FLAC__stream_decoder_set_*() but before any of the
* FLAC__stream_decoder_process_*() functions. Will set and return the * FLAC__stream_decoder_process_*() functions. Will set and return the
@@ -1403,8 +1428,7 @@ FLAC_API FLAC__bool FLAC__stream_decoder_flush(FLAC__StreamDecoder *decoder);
* and is not seekable (i.e. no seek callback was provided or the seek * and is not seekable (i.e. no seek callback was provided or the seek
* callback returns \c FLAC__STREAM_DECODER_SEEK_STATUS_UNSUPPORTED), it * callback returns \c FLAC__STREAM_DECODER_SEEK_STATUS_UNSUPPORTED), it
* is the duty of the client to start feeding data from the beginning of * is the duty of the client to start feeding data from the beginning of
* the stream on the next FLAC__stream_decoder_process() or * the stream on the next FLAC__stream_decoder_process_*() call.
* FLAC__stream_decoder_process_interleaved() call.
* *
* \param decoder A decoder instance. * \param decoder A decoder instance.
* \assert * \assert

View File

@@ -1,6 +1,6 @@
/* libFLAC - Free Lossless Audio Codec library /* libFLAC - Free Lossless Audio Codec library
* Copyright (C) 2000-2009 Josh Coalson * Copyright (C) 2000-2009 Josh Coalson
* Copyright (C) 2011-2014 Xiph.Org Foundation * Copyright (C) 2011-2022 Xiph.Org Foundation
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions * modification, are permitted provided that the following conditions
@@ -129,8 +129,8 @@ extern "C" {
* Unlike the decoders, the stream encoder has many options that can * Unlike the decoders, the stream encoder has many options that can
* affect the speed and compression ratio. When setting these parameters * affect the speed and compression ratio. When setting these parameters
* you should have some basic knowledge of the format (see the * you should have some basic knowledge of the format (see the
* <A HREF="../documentation_format_overview.html">user-level documentation</A> * <A HREF="https://xiph.org/flac/documentation_format_overview.html">user-level documentation</A>
* or the <A HREF="../format.html">formal description</A>). The * or the <A HREF="https://xiph.org/flac/format.html">formal description</A>). The
* FLAC__stream_encoder_set_*() functions themselves do not validate the * FLAC__stream_encoder_set_*() functions themselves do not validate the
* values as many are interdependent. The FLAC__stream_encoder_init_*() * values as many are interdependent. The FLAC__stream_encoder_init_*()
* functions will do this, so make sure to pay attention to the state * functions will do this, so make sure to pay attention to the state
@@ -311,8 +311,7 @@ typedef enum {
FLAC__STREAM_ENCODER_INIT_STATUS_INVALID_BITS_PER_SAMPLE, FLAC__STREAM_ENCODER_INIT_STATUS_INVALID_BITS_PER_SAMPLE,
/**< The encoder has an invalid setting for bits-per-sample. /**< The encoder has an invalid setting for bits-per-sample.
* FLAC supports 4-32 bps but the reference encoder currently supports * FLAC supports 4-32 bps.
* only up to 24 bps.
*/ */
FLAC__STREAM_ENCODER_INIT_STATUS_INVALID_SAMPLE_RATE, FLAC__STREAM_ENCODER_INIT_STATUS_INVALID_SAMPLE_RATE,
@@ -331,7 +330,7 @@ typedef enum {
/**< The specified block size is less than the maximum LPC order. */ /**< The specified block size is less than the maximum LPC order. */
FLAC__STREAM_ENCODER_INIT_STATUS_NOT_STREAMABLE, FLAC__STREAM_ENCODER_INIT_STATUS_NOT_STREAMABLE,
/**< The encoder is bound to the <A HREF="../format.html#subset">Subset</A> but other settings violate it. */ /**< The encoder is bound to the <A HREF="https://xiph.org/flac/format.html#subset">Subset</A> but other settings violate it. */
FLAC__STREAM_ENCODER_INIT_STATUS_INVALID_METADATA, FLAC__STREAM_ENCODER_INIT_STATUS_INVALID_METADATA,
/**< The metadata input to the encoder is invalid, in one of the following ways: /**< The metadata input to the encoder is invalid, in one of the following ways:
@@ -554,7 +553,7 @@ typedef FLAC__StreamEncoderReadStatus (*FLAC__StreamEncoderReadCallback)(const F
* \retval FLAC__StreamEncoderWriteStatus * \retval FLAC__StreamEncoderWriteStatus
* The callee's return status. * The callee's return status.
*/ */
typedef FLAC__StreamEncoderWriteStatus (*FLAC__StreamEncoderWriteCallback)(const FLAC__StreamEncoder *encoder, const FLAC__byte buffer[], size_t bytes, unsigned samples, unsigned current_frame, void *client_data); typedef FLAC__StreamEncoderWriteStatus (*FLAC__StreamEncoderWriteCallback)(const FLAC__StreamEncoder *encoder, const FLAC__byte buffer[], size_t bytes, uint32_t samples, uint32_t current_frame, void *client_data);
/** Signature for the seek callback. /** Signature for the seek callback.
* *
@@ -675,7 +674,7 @@ typedef void (*FLAC__StreamEncoderMetadataCallback)(const FLAC__StreamEncoder *e
* \param client_data The callee's client data set through * \param client_data The callee's client data set through
* FLAC__stream_encoder_init_*(). * FLAC__stream_encoder_init_*().
*/ */
typedef void (*FLAC__StreamEncoderProgressCallback)(const FLAC__StreamEncoder *encoder, FLAC__uint64 bytes_written, FLAC__uint64 samples_written, unsigned frames_written, unsigned total_frames_estimate, void *client_data); typedef void (*FLAC__StreamEncoderProgressCallback)(const FLAC__StreamEncoder *encoder, FLAC__uint64 bytes_written, FLAC__uint64 samples_written, uint32_t frames_written, uint32_t total_frames_estimate, void *client_data);
/*********************************************************************** /***********************************************************************
@@ -743,7 +742,7 @@ FLAC_API FLAC__bool FLAC__stream_encoder_set_ogg_serial_number(FLAC__StreamEncod
*/ */
FLAC_API FLAC__bool FLAC__stream_encoder_set_verify(FLAC__StreamEncoder *encoder, FLAC__bool value); FLAC_API FLAC__bool FLAC__stream_encoder_set_verify(FLAC__StreamEncoder *encoder, FLAC__bool value);
/** Set the <A HREF="../format.html#subset">Subset</A> flag. If \c true, /** Set the <A HREF="https://xiph.org/flac/format.html#subset">Subset</A> flag. If \c true,
* the encoder will comply with the Subset and will check the * the encoder will comply with the Subset and will check the
* settings during FLAC__stream_encoder_init_*() to see if all settings * settings during FLAC__stream_encoder_init_*() to see if all settings
* comply. If \c false, the settings may take advantage of the full * comply. If \c false, the settings may take advantage of the full
@@ -771,7 +770,7 @@ FLAC_API FLAC__bool FLAC__stream_encoder_set_streamable_subset(FLAC__StreamEncod
* \retval FLAC__bool * \retval FLAC__bool
* \c false if the encoder is already initialized, else \c true. * \c false if the encoder is already initialized, else \c true.
*/ */
FLAC_API FLAC__bool FLAC__stream_encoder_set_channels(FLAC__StreamEncoder *encoder, unsigned value); FLAC_API FLAC__bool FLAC__stream_encoder_set_channels(FLAC__StreamEncoder *encoder, uint32_t value);
/** Set the sample resolution of the input to be encoded. /** Set the sample resolution of the input to be encoded.
* *
@@ -787,7 +786,7 @@ FLAC_API FLAC__bool FLAC__stream_encoder_set_channels(FLAC__StreamEncoder *encod
* \retval FLAC__bool * \retval FLAC__bool
* \c false if the encoder is already initialized, else \c true. * \c false if the encoder is already initialized, else \c true.
*/ */
FLAC_API FLAC__bool FLAC__stream_encoder_set_bits_per_sample(FLAC__StreamEncoder *encoder, unsigned value); FLAC_API FLAC__bool FLAC__stream_encoder_set_bits_per_sample(FLAC__StreamEncoder *encoder, uint32_t value);
/** Set the sample rate (in Hz) of the input to be encoded. /** Set the sample rate (in Hz) of the input to be encoded.
* *
@@ -799,7 +798,7 @@ FLAC_API FLAC__bool FLAC__stream_encoder_set_bits_per_sample(FLAC__StreamEncoder
* \retval FLAC__bool * \retval FLAC__bool
* \c false if the encoder is already initialized, else \c true. * \c false if the encoder is already initialized, else \c true.
*/ */
FLAC_API FLAC__bool FLAC__stream_encoder_set_sample_rate(FLAC__StreamEncoder *encoder, unsigned value); FLAC_API FLAC__bool FLAC__stream_encoder_set_sample_rate(FLAC__StreamEncoder *encoder, uint32_t value);
/** Set the compression level /** Set the compression level
* *
@@ -843,15 +842,15 @@ FLAC_API FLAC__bool FLAC__stream_encoder_set_sample_rate(FLAC__StreamEncoder *en
* <td>max residual partition order</td> * <td>max residual partition order</td>
* <td>rice parameter search dist</td> * <td>rice parameter search dist</td>
* </tr> * </tr>
* <tr> <td><b>0</b></td> <td>false</td> <td>false</td> <td>tukey(0.5)<td> <td>0</td> <td>0</td> <td>false</td> <td>false</td> <td>false</td> <td>0</td> <td>3</td> <td>0</td> </tr> * <tr> <td><b>0</b></td> <td>false</td> <td>false</td> <td>tukey(0.5)</td> <td>0</td> <td>0</td> <td>false</td> <td>false</td> <td>false</td> <td>0</td> <td>3</td> <td>0</td> </tr>
* <tr> <td><b>1</b></td> <td>true</td> <td>true</td> <td>tukey(0.5)<td> <td>0</td> <td>0</td> <td>false</td> <td>false</td> <td>false</td> <td>0</td> <td>3</td> <td>0</td> </tr> * <tr> <td><b>1</b></td> <td>true</td> <td>true</td> <td>tukey(0.5)</td> <td>0</td> <td>0</td> <td>false</td> <td>false</td> <td>false</td> <td>0</td> <td>3</td> <td>0</td> </tr>
* <tr> <td><b>2</b></td> <td>true</td> <td>false</td> <td>tukey(0.5)<td> <td>0</td> <td>0</td> <td>false</td> <td>false</td> <td>false</td> <td>0</td> <td>3</td> <td>0</td> </tr> * <tr> <td><b>2</b></td> <td>true</td> <td>false</td> <td>tukey(0.5)</td> <td>0</td> <td>0</td> <td>false</td> <td>false</td> <td>false</td> <td>0</td> <td>3</td> <td>0</td> </tr>
* <tr> <td><b>3</b></td> <td>false</td> <td>false</td> <td>tukey(0.5)<td> <td>6</td> <td>0</td> <td>false</td> <td>false</td> <td>false</td> <td>0</td> <td>4</td> <td>0</td> </tr> * <tr> <td><b>3</b></td> <td>false</td> <td>false</td> <td>tukey(0.5)</td> <td>6</td> <td>0</td> <td>false</td> <td>false</td> <td>false</td> <td>0</td> <td>4</td> <td>0</td> </tr>
* <tr> <td><b>4</b></td> <td>true</td> <td>true</td> <td>tukey(0.5)<td> <td>8</td> <td>0</td> <td>false</td> <td>false</td> <td>false</td> <td>0</td> <td>4</td> <td>0</td> </tr> * <tr> <td><b>4</b></td> <td>true</td> <td>true</td> <td>tukey(0.5)</td> <td>8</td> <td>0</td> <td>false</td> <td>false</td> <td>false</td> <td>0</td> <td>4</td> <td>0</td> </tr>
* <tr> <td><b>5</b></td> <td>true</td> <td>false</td> <td>tukey(0.5)<td> <td>8</td> <td>0</td> <td>false</td> <td>false</td> <td>false</td> <td>0</td> <td>5</td> <td>0</td> </tr> * <tr> <td><b>5</b></td> <td>true</td> <td>false</td> <td>tukey(0.5)</td> <td>8</td> <td>0</td> <td>false</td> <td>false</td> <td>false</td> <td>0</td> <td>5</td> <td>0</td> </tr>
* <tr> <td><b>6</b></td> <td>true</td> <td>false</td> <td>tukey(0.5);partial_tukey(2)<td> <td>8</td> <td>0</td> <td>false</td> <td>false</td> <td>false</td> <td>0</td> <td>6</td> <td>0</td> </tr> * <tr> <td><b>6</b></td> <td>true</td> <td>false</td> <td>subdivide_tukey(2)</td> <td>8</td> <td>0</td> <td>false</td> <td>false</td> <td>false</td> <td>0</td> <td>6</td> <td>0</td> </tr>
* <tr> <td><b>7</b></td> <td>true</td> <td>false</td> <td>tukey(0.5);partial_tukey(2)<td> <td>12</td> <td>0</td> <td>false</td> <td>false</td> <td>false</td> <td>0</td> <td>6</td> <td>0</td> </tr> * <tr> <td><b>7</b></td> <td>true</td> <td>false</td> <td>subdivide_tukey(2)</td> <td>12</td> <td>0</td> <td>false</td> <td>false</td> <td>false</td> <td>0</td> <td>6</td> <td>0</td> </tr>
* <tr> <td><b>8</b></td> <td>true</td> <td>false</td> <td>tukey(0.5);partial_tukey(2);punchout_tukey(3)</td> <td>12</td> <td>0</td> <td>false</td> <td>false</td> <td>false</td> <td>0</td> <td>6</td> <td>0</td> </tr> * <tr> <td><b>8</b></td> <td>true</td> <td>false</td> <td>subdivide_tukey(2)</td> <td>12</td> <td>0</td> <td>false</td> <td>false</td> <td>false</td> <td>0</td> <td>6</td> <td>0</td> </tr>
* </table> * </table>
* *
* \default \c 5 * \default \c 5
@@ -862,7 +861,7 @@ FLAC_API FLAC__bool FLAC__stream_encoder_set_sample_rate(FLAC__StreamEncoder *en
* \retval FLAC__bool * \retval FLAC__bool
* \c false if the encoder is already initialized, else \c true. * \c false if the encoder is already initialized, else \c true.
*/ */
FLAC_API FLAC__bool FLAC__stream_encoder_set_compression_level(FLAC__StreamEncoder *encoder, unsigned value); FLAC_API FLAC__bool FLAC__stream_encoder_set_compression_level(FLAC__StreamEncoder *encoder, uint32_t value);
/** Set the blocksize to use while encoding. /** Set the blocksize to use while encoding.
* *
@@ -877,13 +876,13 @@ FLAC_API FLAC__bool FLAC__stream_encoder_set_compression_level(FLAC__StreamEncod
* \retval FLAC__bool * \retval FLAC__bool
* \c false if the encoder is already initialized, else \c true. * \c false if the encoder is already initialized, else \c true.
*/ */
FLAC_API FLAC__bool FLAC__stream_encoder_set_blocksize(FLAC__StreamEncoder *encoder, unsigned value); FLAC_API FLAC__bool FLAC__stream_encoder_set_blocksize(FLAC__StreamEncoder *encoder, uint32_t value);
/** Set to \c true to enable mid-side encoding on stereo input. The /** Set to \c true to enable mid-side encoding on stereo input. The
* number of channels must be 2 for this to have any effect. Set to * number of channels must be 2 for this to have any effect. Set to
* \c false to use only independent channel coding. * \c false to use only independent channel coding.
* *
* \default \c false * \default \c true
* \param encoder An encoder instance to set. * \param encoder An encoder instance to set.
* \param value Flag value (see above). * \param value Flag value (see above).
* \assert * \assert
@@ -921,7 +920,7 @@ FLAC_API FLAC__bool FLAC__stream_encoder_set_loose_mid_side_stereo(FLAC__StreamE
* \c blackman, \c blackman_harris_4term_92db, \c connes, \c flattop, * \c blackman, \c blackman_harris_4term_92db, \c connes, \c flattop,
* \c gauss(STDDEV), \c hamming, \c hann, \c kaiser_bessel, \c nuttall, * \c gauss(STDDEV), \c hamming, \c hann, \c kaiser_bessel, \c nuttall,
* \c rectangle, \c triangle, \c tukey(P), \c partial_tukey(n[/ov[/P]]), * \c rectangle, \c triangle, \c tukey(P), \c partial_tukey(n[/ov[/P]]),
* \c punchout_tukey(n[/ov[/P]]), \c welch. * \c punchout_tukey(n[/ov[/P]]), \c subdivide_tukey(n[/P]), \c welch.
* *
* For \c gauss(STDDEV), STDDEV specifies the standard deviation * For \c gauss(STDDEV), STDDEV specifies the standard deviation
* (0<STDDEV<=0.5). * (0<STDDEV<=0.5).
@@ -948,6 +947,20 @@ FLAC_API FLAC__bool FLAC__stream_encoder_set_loose_mid_side_stereo(FLAC__StreamE
* and partial_tukey(3/0.3/0.5) are all valid. ov should be smaller than 1 * and partial_tukey(3/0.3/0.5) are all valid. ov should be smaller than 1
* and can be negative. * and can be negative.
* *
* subdivide_tukey(n) is a more efficient reimplementation of
* partial_tukey and punchout_tukey taken together, recycling as much data
* as possible. It combines all possible non-redundant partial_tukey(n)
* and punchout_tukey(n) up to the n specified. Specifying
* subdivide_tukey(3) is equivalent to specifying tukey, partial_tukey(2),
* partial_tukey(3) and punchout_tukey(3), specifying subdivide_tukey(5)
* equivalently adds partial_tukey(4), punchout_tukey(4), partial_tukey(5)
* and punchout_tukey(5). To be able to reuse data as much as possible,
* the tukey taper is taken equal for all windows, and the P specified is
* applied for the smallest used window. In other words,
* subdivide_tukey(2/0.5) results in a taper equal to that of tukey(0.25)
* and subdivide_tukey(5) in a taper equal to that of tukey(0.1). The
* default P for subdivide_tukey when none is specified is 0.5.
*
* Example specifications are \c "blackman" or * Example specifications are \c "blackman" or
* \c "hann;triangle;tukey(0.5);tukey(0.25);tukey(0.125)" * \c "hann;triangle;tukey(0.5);tukey(0.25);tukey(0.125)"
* *
@@ -963,6 +976,8 @@ FLAC_API FLAC__bool FLAC__stream_encoder_set_loose_mid_side_stereo(FLAC__StreamE
* floating point array in which to store the window. Also note that the * floating point array in which to store the window. Also note that the
* values of P, STDDEV and ov are locale-specific, so if the comma * values of P, STDDEV and ov are locale-specific, so if the comma
* separator specified by the locale is a comma, a comma should be used. * separator specified by the locale is a comma, a comma should be used.
* A locale-independent way is to specify using scientific notation,
* e.g. 5e-1 instad of 0.5 or 0,5.
* *
* \default \c "tukey(0.5)" * \default \c "tukey(0.5)"
* \param encoder An encoder instance to set. * \param encoder An encoder instance to set.
@@ -977,7 +992,7 @@ FLAC_API FLAC__bool FLAC__stream_encoder_set_apodization(FLAC__StreamEncoder *en
/** Set the maximum LPC order, or \c 0 to use only the fixed predictors. /** Set the maximum LPC order, or \c 0 to use only the fixed predictors.
* *
* \default \c 0 * \default \c 8
* \param encoder An encoder instance to set. * \param encoder An encoder instance to set.
* \param value See above. * \param value See above.
* \assert * \assert
@@ -985,16 +1000,12 @@ FLAC_API FLAC__bool FLAC__stream_encoder_set_apodization(FLAC__StreamEncoder *en
* \retval FLAC__bool * \retval FLAC__bool
* \c false if the encoder is already initialized, else \c true. * \c false if the encoder is already initialized, else \c true.
*/ */
FLAC_API FLAC__bool FLAC__stream_encoder_set_max_lpc_order(FLAC__StreamEncoder *encoder, unsigned value); FLAC_API FLAC__bool FLAC__stream_encoder_set_max_lpc_order(FLAC__StreamEncoder *encoder, uint32_t value);
/** Set the precision, in bits, of the quantized linear predictor /** Set the precision, in bits, of the quantized linear predictor
* coefficients, or \c 0 to let the encoder select it based on the * coefficients, or \c 0 to let the encoder select it based on the
* blocksize. * blocksize.
* *
* \note
* In the current implementation, qlp_coeff_precision + bits_per_sample must
* be less than 32.
*
* \default \c 0 * \default \c 0
* \param encoder An encoder instance to set. * \param encoder An encoder instance to set.
* \param value See above. * \param value See above.
@@ -1003,7 +1014,7 @@ FLAC_API FLAC__bool FLAC__stream_encoder_set_max_lpc_order(FLAC__StreamEncoder *
* \retval FLAC__bool * \retval FLAC__bool
* \c false if the encoder is already initialized, else \c true. * \c false if the encoder is already initialized, else \c true.
*/ */
FLAC_API FLAC__bool FLAC__stream_encoder_set_qlp_coeff_precision(FLAC__StreamEncoder *encoder, unsigned value); FLAC_API FLAC__bool FLAC__stream_encoder_set_qlp_coeff_precision(FLAC__StreamEncoder *encoder, uint32_t value);
/** Set to \c false to use only the specified quantized linear predictor /** Set to \c false to use only the specified quantized linear predictor
* coefficient precision, or \c true to search neighboring precision * coefficient precision, or \c true to search neighboring precision
@@ -1066,7 +1077,7 @@ FLAC_API FLAC__bool FLAC__stream_encoder_set_do_exhaustive_model_search(FLAC__St
* \retval FLAC__bool * \retval FLAC__bool
* \c false if the encoder is already initialized, else \c true. * \c false if the encoder is already initialized, else \c true.
*/ */
FLAC_API FLAC__bool FLAC__stream_encoder_set_min_residual_partition_order(FLAC__StreamEncoder *encoder, unsigned value); FLAC_API FLAC__bool FLAC__stream_encoder_set_min_residual_partition_order(FLAC__StreamEncoder *encoder, uint32_t value);
/** Set the maximum partition order to search when coding the residual. /** Set the maximum partition order to search when coding the residual.
* This is used in tandem with * This is used in tandem with
@@ -1081,7 +1092,7 @@ FLAC_API FLAC__bool FLAC__stream_encoder_set_min_residual_partition_order(FLAC__
* all orders, using the mean of each context for its Rice parameter, * all orders, using the mean of each context for its Rice parameter,
* and use the best. * and use the best.
* *
* \default \c 0 * \default \c 5
* \param encoder An encoder instance to set. * \param encoder An encoder instance to set.
* \param value See above. * \param value See above.
* \assert * \assert
@@ -1089,7 +1100,7 @@ FLAC_API FLAC__bool FLAC__stream_encoder_set_min_residual_partition_order(FLAC__
* \retval FLAC__bool * \retval FLAC__bool
* \c false if the encoder is already initialized, else \c true. * \c false if the encoder is already initialized, else \c true.
*/ */
FLAC_API FLAC__bool FLAC__stream_encoder_set_max_residual_partition_order(FLAC__StreamEncoder *encoder, unsigned value); FLAC_API FLAC__bool FLAC__stream_encoder_set_max_residual_partition_order(FLAC__StreamEncoder *encoder, uint32_t value);
/** Deprecated. Setting this value has no effect. /** Deprecated. Setting this value has no effect.
* *
@@ -1101,7 +1112,7 @@ FLAC_API FLAC__bool FLAC__stream_encoder_set_max_residual_partition_order(FLAC__
* \retval FLAC__bool * \retval FLAC__bool
* \c false if the encoder is already initialized, else \c true. * \c false if the encoder is already initialized, else \c true.
*/ */
FLAC_API FLAC__bool FLAC__stream_encoder_set_rice_parameter_search_dist(FLAC__StreamEncoder *encoder, unsigned value); FLAC_API FLAC__bool FLAC__stream_encoder_set_rice_parameter_search_dist(FLAC__StreamEncoder *encoder, uint32_t value);
/** Set an estimate of the total samples that will be encoded. /** Set an estimate of the total samples that will be encoded.
* This is merely an estimate and may be set to \c 0 if unknown. * This is merely an estimate and may be set to \c 0 if unknown.
@@ -1200,7 +1211,25 @@ FLAC_API FLAC__bool FLAC__stream_encoder_set_total_samples_estimate(FLAC__Stream
* \c false if the encoder is already initialized, or if * \c false if the encoder is already initialized, or if
* \a num_blocks > 65535 if encoding to Ogg FLAC, else \c true. * \a num_blocks > 65535 if encoding to Ogg FLAC, else \c true.
*/ */
FLAC_API FLAC__bool FLAC__stream_encoder_set_metadata(FLAC__StreamEncoder *encoder, FLAC__StreamMetadata **metadata, unsigned num_blocks); FLAC_API FLAC__bool FLAC__stream_encoder_set_metadata(FLAC__StreamEncoder *encoder, FLAC__StreamMetadata **metadata, uint32_t num_blocks);
/** Set to \c true to make the encoder not output frames which contain
* only constant subframes. This is beneficial for streaming
* applications: very small frames can cause problems with buffering
* as bitrates can drop as low 1kbit/s for CDDA audio encoded within
* subset. The minimum bitrate for a FLAC file encoded with this
* function used is raised to 1bit/sample (i.e. 48kbit/s for 48kHz
* material).
*
* \default \c false
* \param encoder An encoder instance to set.
* \param value Flag value (see above).
* \assert
* \code encoder != NULL \endcode
* \retval FLAC__bool
* \c false if the encoder is already initialized, else \c true.
*/
FLAC_API FLAC__bool FLAC__stream_encoder_set_limit_min_bitrate(FLAC__StreamEncoder *encoder, FLAC__bool value);
/** Get the current encoder state. /** Get the current encoder state.
* *
@@ -1254,7 +1283,7 @@ FLAC_API const char *FLAC__stream_encoder_get_resolved_state_string(const FLAC__
* \assert * \assert
* \code encoder != NULL \endcode * \code encoder != NULL \endcode
*/ */
FLAC_API void FLAC__stream_encoder_get_verify_decoder_error_stats(const FLAC__StreamEncoder *encoder, FLAC__uint64 *absolute_sample, unsigned *frame_number, unsigned *channel, unsigned *sample, FLAC__int32 *expected, FLAC__int32 *got); FLAC_API void FLAC__stream_encoder_get_verify_decoder_error_stats(const FLAC__StreamEncoder *encoder, FLAC__uint64 *absolute_sample, uint32_t *frame_number, uint32_t *channel, uint32_t *sample, FLAC__int32 *expected, FLAC__int32 *got);
/** Get the "verify" flag. /** Get the "verify" flag.
* *
@@ -1266,7 +1295,7 @@ FLAC_API void FLAC__stream_encoder_get_verify_decoder_error_stats(const FLAC__St
*/ */
FLAC_API FLAC__bool FLAC__stream_encoder_get_verify(const FLAC__StreamEncoder *encoder); FLAC_API FLAC__bool FLAC__stream_encoder_get_verify(const FLAC__StreamEncoder *encoder);
/** Get the <A HREF="../format.html#subset>Subset</A> flag. /** Get the <A HREF="https://xiph.org/flac/format.html#subset">Subset</A> flag.
* *
* \param encoder An encoder instance to query. * \param encoder An encoder instance to query.
* \assert * \assert
@@ -1281,40 +1310,40 @@ FLAC_API FLAC__bool FLAC__stream_encoder_get_streamable_subset(const FLAC__Strea
* \param encoder An encoder instance to query. * \param encoder An encoder instance to query.
* \assert * \assert
* \code encoder != NULL \endcode * \code encoder != NULL \endcode
* \retval unsigned * \retval uint32_t
* See FLAC__stream_encoder_set_channels(). * See FLAC__stream_encoder_set_channels().
*/ */
FLAC_API unsigned FLAC__stream_encoder_get_channels(const FLAC__StreamEncoder *encoder); FLAC_API uint32_t FLAC__stream_encoder_get_channels(const FLAC__StreamEncoder *encoder);
/** Get the input sample resolution setting. /** Get the input sample resolution setting.
* *
* \param encoder An encoder instance to query. * \param encoder An encoder instance to query.
* \assert * \assert
* \code encoder != NULL \endcode * \code encoder != NULL \endcode
* \retval unsigned * \retval uint32_t
* See FLAC__stream_encoder_set_bits_per_sample(). * See FLAC__stream_encoder_set_bits_per_sample().
*/ */
FLAC_API unsigned FLAC__stream_encoder_get_bits_per_sample(const FLAC__StreamEncoder *encoder); FLAC_API uint32_t FLAC__stream_encoder_get_bits_per_sample(const FLAC__StreamEncoder *encoder);
/** Get the input sample rate setting. /** Get the input sample rate setting.
* *
* \param encoder An encoder instance to query. * \param encoder An encoder instance to query.
* \assert * \assert
* \code encoder != NULL \endcode * \code encoder != NULL \endcode
* \retval unsigned * \retval uint32_t
* See FLAC__stream_encoder_set_sample_rate(). * See FLAC__stream_encoder_set_sample_rate().
*/ */
FLAC_API unsigned FLAC__stream_encoder_get_sample_rate(const FLAC__StreamEncoder *encoder); FLAC_API uint32_t FLAC__stream_encoder_get_sample_rate(const FLAC__StreamEncoder *encoder);
/** Get the blocksize setting. /** Get the blocksize setting.
* *
* \param encoder An encoder instance to query. * \param encoder An encoder instance to query.
* \assert * \assert
* \code encoder != NULL \endcode * \code encoder != NULL \endcode
* \retval unsigned * \retval uint32_t
* See FLAC__stream_encoder_set_blocksize(). * See FLAC__stream_encoder_set_blocksize().
*/ */
FLAC_API unsigned FLAC__stream_encoder_get_blocksize(const FLAC__StreamEncoder *encoder); FLAC_API uint32_t FLAC__stream_encoder_get_blocksize(const FLAC__StreamEncoder *encoder);
/** Get the "mid/side stereo coding" flag. /** Get the "mid/side stereo coding" flag.
* *
@@ -1341,20 +1370,20 @@ FLAC_API FLAC__bool FLAC__stream_encoder_get_loose_mid_side_stereo(const FLAC__S
* \param encoder An encoder instance to query. * \param encoder An encoder instance to query.
* \assert * \assert
* \code encoder != NULL \endcode * \code encoder != NULL \endcode
* \retval unsigned * \retval uint32_t
* See FLAC__stream_encoder_set_max_lpc_order(). * See FLAC__stream_encoder_set_max_lpc_order().
*/ */
FLAC_API unsigned FLAC__stream_encoder_get_max_lpc_order(const FLAC__StreamEncoder *encoder); FLAC_API uint32_t FLAC__stream_encoder_get_max_lpc_order(const FLAC__StreamEncoder *encoder);
/** Get the quantized linear predictor coefficient precision setting. /** Get the quantized linear predictor coefficient precision setting.
* *
* \param encoder An encoder instance to query. * \param encoder An encoder instance to query.
* \assert * \assert
* \code encoder != NULL \endcode * \code encoder != NULL \endcode
* \retval unsigned * \retval uint32_t
* See FLAC__stream_encoder_set_qlp_coeff_precision(). * See FLAC__stream_encoder_set_qlp_coeff_precision().
*/ */
FLAC_API unsigned FLAC__stream_encoder_get_qlp_coeff_precision(const FLAC__StreamEncoder *encoder); FLAC_API uint32_t FLAC__stream_encoder_get_qlp_coeff_precision(const FLAC__StreamEncoder *encoder);
/** Get the qlp coefficient precision search flag. /** Get the qlp coefficient precision search flag.
* *
@@ -1391,30 +1420,30 @@ FLAC_API FLAC__bool FLAC__stream_encoder_get_do_exhaustive_model_search(const FL
* \param encoder An encoder instance to query. * \param encoder An encoder instance to query.
* \assert * \assert
* \code encoder != NULL \endcode * \code encoder != NULL \endcode
* \retval unsigned * \retval uint32_t
* See FLAC__stream_encoder_set_min_residual_partition_order(). * See FLAC__stream_encoder_set_min_residual_partition_order().
*/ */
FLAC_API unsigned FLAC__stream_encoder_get_min_residual_partition_order(const FLAC__StreamEncoder *encoder); FLAC_API uint32_t FLAC__stream_encoder_get_min_residual_partition_order(const FLAC__StreamEncoder *encoder);
/** Get maximum residual partition order setting. /** Get maximum residual partition order setting.
* *
* \param encoder An encoder instance to query. * \param encoder An encoder instance to query.
* \assert * \assert
* \code encoder != NULL \endcode * \code encoder != NULL \endcode
* \retval unsigned * \retval uint32_t
* See FLAC__stream_encoder_set_max_residual_partition_order(). * See FLAC__stream_encoder_set_max_residual_partition_order().
*/ */
FLAC_API unsigned FLAC__stream_encoder_get_max_residual_partition_order(const FLAC__StreamEncoder *encoder); FLAC_API uint32_t FLAC__stream_encoder_get_max_residual_partition_order(const FLAC__StreamEncoder *encoder);
/** Get the Rice parameter search distance setting. /** Get the Rice parameter search distance setting.
* *
* \param encoder An encoder instance to query. * \param encoder An encoder instance to query.
* \assert * \assert
* \code encoder != NULL \endcode * \code encoder != NULL \endcode
* \retval unsigned * \retval uint32_t
* See FLAC__stream_encoder_set_rice_parameter_search_dist(). * See FLAC__stream_encoder_set_rice_parameter_search_dist().
*/ */
FLAC_API unsigned FLAC__stream_encoder_get_rice_parameter_search_dist(const FLAC__StreamEncoder *encoder); FLAC_API uint32_t FLAC__stream_encoder_get_rice_parameter_search_dist(const FLAC__StreamEncoder *encoder);
/** Get the previously set estimate of the total samples to be encoded. /** Get the previously set estimate of the total samples to be encoded.
* The encoder merely mimics back the value given to * The encoder merely mimics back the value given to
@@ -1429,6 +1458,16 @@ FLAC_API unsigned FLAC__stream_encoder_get_rice_parameter_search_dist(const FLAC
*/ */
FLAC_API FLAC__uint64 FLAC__stream_encoder_get_total_samples_estimate(const FLAC__StreamEncoder *encoder); FLAC_API FLAC__uint64 FLAC__stream_encoder_get_total_samples_estimate(const FLAC__StreamEncoder *encoder);
/** Get the "limit_min_bitrate" flag.
*
* \param encoder An encoder instance to query.
* \assert
* \code encoder != NULL \endcode
* \retval FLAC__bool
* See FLAC__stream_encoder_set_limit_min_bitrate().
*/
FLAC_API FLAC__bool FLAC__stream_encoder_get_limit_min_bitrate(const FLAC__StreamEncoder *encoder);
/** Initialize the encoder instance to encode native FLAC streams. /** Initialize the encoder instance to encode native FLAC streams.
* *
* This flavor of initialization sets up the encoder to encode to a * This flavor of initialization sets up the encoder to encode to a
@@ -1633,11 +1672,15 @@ FLAC_API FLAC__StreamEncoderInitStatus FLAC__stream_encoder_init_ogg_FILE(FLAC__
/** Initialize the encoder instance to encode native FLAC files. /** Initialize the encoder instance to encode native FLAC files.
* *
* This flavor of initialization sets up the encoder to encode to a plain * This flavor of initialization sets up the encoder to encode to a plain
* FLAC file. If POSIX fopen() semantics are not sufficient (for example, * FLAC file. If POSIX fopen() semantics are not sufficient you must use
* with Unicode filenames on Windows), you must use
* FLAC__stream_encoder_init_FILE(), or FLAC__stream_encoder_init_stream() * FLAC__stream_encoder_init_FILE(), or FLAC__stream_encoder_init_stream()
* and provide callbacks for the I/O. * and provide callbacks for the I/O.
* *
* On Windows, filename must be a UTF-8 encoded filename, which libFLAC
* internally translates to an appropriate representation to use with
* _wfopen. On all other systems, filename is passed to fopen without
* any translation.
*
* This function should be called after FLAC__stream_encoder_new() and * This function should be called after FLAC__stream_encoder_new() and
* FLAC__stream_encoder_set_*() but before FLAC__stream_encoder_process() * FLAC__stream_encoder_set_*() but before FLAC__stream_encoder_process()
* or FLAC__stream_encoder_process_interleaved(). * or FLAC__stream_encoder_process_interleaved().
@@ -1665,11 +1708,15 @@ FLAC_API FLAC__StreamEncoderInitStatus FLAC__stream_encoder_init_file(FLAC__Stre
/** Initialize the encoder instance to encode Ogg FLAC files. /** Initialize the encoder instance to encode Ogg FLAC files.
* *
* This flavor of initialization sets up the encoder to encode to a plain * This flavor of initialization sets up the encoder to encode to a plain
* Ogg FLAC file. If POSIX fopen() semantics are not sufficient (for example, * Ogg FLAC file. If POSIX fopen() semantics are not sufficient, you must use
* with Unicode filenames on Windows), you must use
* FLAC__stream_encoder_init_ogg_FILE(), or FLAC__stream_encoder_init_ogg_stream() * FLAC__stream_encoder_init_ogg_FILE(), or FLAC__stream_encoder_init_ogg_stream()
* and provide callbacks for the I/O. * and provide callbacks for the I/O.
* *
* On Windows, filename must be a UTF-8 encoded filename, which libFLAC
* internally translates to an appropriate representation to use with
* _wfopen. On all other systems, filename is passed to fopen without
* any translation.
*
* This function should be called after FLAC__stream_encoder_new() and * This function should be called after FLAC__stream_encoder_new() and
* FLAC__stream_encoder_set_*() but before FLAC__stream_encoder_process() * FLAC__stream_encoder_set_*() but before FLAC__stream_encoder_process()
* or FLAC__stream_encoder_process_interleaved(). * or FLAC__stream_encoder_process_interleaved().
@@ -1734,7 +1781,7 @@ FLAC_API FLAC__bool FLAC__stream_encoder_finish(FLAC__StreamEncoder *encoder);
* *
* For applications where channel order is important, channels must * For applications where channel order is important, channels must
* follow the order as described in the * follow the order as described in the
* <A HREF="../format.html#frame_header">frame header</A>. * <A HREF="https://xiph.org/flac/format.html#frame_header">frame header</A>.
* *
* \param encoder An initialized encoder instance in the OK state. * \param encoder An initialized encoder instance in the OK state.
* \param buffer An array of pointers to each channel's signal. * \param buffer An array of pointers to each channel's signal.
@@ -1747,7 +1794,7 @@ FLAC_API FLAC__bool FLAC__stream_encoder_finish(FLAC__StreamEncoder *encoder);
* encoder state with FLAC__stream_encoder_get_state() to see what * encoder state with FLAC__stream_encoder_get_state() to see what
* went wrong. * went wrong.
*/ */
FLAC_API FLAC__bool FLAC__stream_encoder_process(FLAC__StreamEncoder *encoder, const FLAC__int32 * const buffer[], unsigned samples); FLAC_API FLAC__bool FLAC__stream_encoder_process(FLAC__StreamEncoder *encoder, const FLAC__int32 * const buffer[], uint32_t samples);
/** Submit data for encoding. /** Submit data for encoding.
* This version allows you to supply the input data where the channels * This version allows you to supply the input data where the channels
@@ -1763,7 +1810,7 @@ FLAC_API FLAC__bool FLAC__stream_encoder_process(FLAC__StreamEncoder *encoder, c
* *
* For applications where channel order is important, channels must * For applications where channel order is important, channels must
* follow the order as described in the * follow the order as described in the
* <A HREF="../format.html#frame_header">frame header</A>. * <A HREF="https://xiph.org/flac/format.html#frame_header">frame header</A>.
* *
* \param encoder An initialized encoder instance in the OK state. * \param encoder An initialized encoder instance in the OK state.
* \param buffer An array of channel-interleaved data (see above). * \param buffer An array of channel-interleaved data (see above).
@@ -1779,7 +1826,7 @@ FLAC_API FLAC__bool FLAC__stream_encoder_process(FLAC__StreamEncoder *encoder, c
* encoder state with FLAC__stream_encoder_get_state() to see what * encoder state with FLAC__stream_encoder_get_state() to see what
* went wrong. * went wrong.
*/ */
FLAC_API FLAC__bool FLAC__stream_encoder_process_interleaved(FLAC__StreamEncoder *encoder, const FLAC__int32 buffer[], unsigned samples); FLAC_API FLAC__bool FLAC__stream_encoder_process_interleaved(FLAC__StreamEncoder *encoder, const FLAC__int32 buffer[], uint32_t samples);
/* \} */ /* \} */

Binary file not shown.

View File

@@ -1,21 +0,0 @@
/* Automatically generated nanopb constant definitions */
/* Generated by nanopb-0.4.6-dev */
#include "protobuf/authentication.pb.h"
#if PB_PROTO_HEADER_VERSION != 40
#error Regenerate this file with the current version of nanopb generator.
#endif
PB_BIND(SystemInfo, SystemInfo, 2)
PB_BIND(LoginCredentials, LoginCredentials, 2)
PB_BIND(ClientResponseEncrypted, ClientResponseEncrypted, 2)

View File

@@ -1,164 +0,0 @@
/* Automatically generated nanopb header */
/* Generated by nanopb-0.4.6-dev */
#ifndef PB_PROTOBUF_AUTHENTICATION_PB_H_INCLUDED
#define PB_PROTOBUF_AUTHENTICATION_PB_H_INCLUDED
#include <pb.h>
#if PB_PROTO_HEADER_VERSION != 40
#error Regenerate this file with the current version of nanopb generator.
#endif
/* Enum definitions */
typedef enum _CpuFamily {
CpuFamily_CPU_UNKNOWN = 0,
CpuFamily_CPU_X86 = 1,
CpuFamily_CPU_X86_64 = 2,
CpuFamily_CPU_PPC = 3,
CpuFamily_CPU_PPC_64 = 4,
CpuFamily_CPU_ARM = 5,
CpuFamily_CPU_IA64 = 6,
CpuFamily_CPU_SH = 7,
CpuFamily_CPU_MIPS = 8,
CpuFamily_CPU_BLACKFIN = 9
} CpuFamily;
typedef enum _Os {
Os_OS_UNKNOWN = 0,
Os_OS_WINDOWS = 1,
Os_OS_OSX = 2,
Os_OS_IPHONE = 3,
Os_OS_S60 = 4,
Os_OS_LINUX = 5,
Os_OS_WINDOWS_CE = 6,
Os_OS_ANDROID = 7,
Os_OS_PALM = 8,
Os_OS_FREEBSD = 9,
Os_OS_BLACKBERRY = 10,
Os_OS_SONOS = 11,
Os_OS_LOGITECH = 12,
Os_OS_WP7 = 13,
Os_OS_ONKYO = 14,
Os_OS_PHILIPS = 15,
Os_OS_WD = 16,
Os_OS_VOLVO = 17,
Os_OS_TIVO = 18,
Os_OS_AWOX = 19,
Os_OS_MEEGO = 20,
Os_OS_QNXNTO = 21,
Os_OS_BCO = 22
} Os;
typedef enum _AuthenticationType {
AuthenticationType_AUTHENTICATION_USER_PASS = 0,
AuthenticationType_AUTHENTICATION_STORED_SPOTIFY_CREDENTIALS = 1,
AuthenticationType_AUTHENTICATION_STORED_FACEBOOK_CREDENTIALS = 2,
AuthenticationType_AUTHENTICATION_SPOTIFY_TOKEN = 3,
AuthenticationType_AUTHENTICATION_FACEBOOK_TOKEN = 4
} AuthenticationType;
/* Struct definitions */
typedef PB_BYTES_ARRAY_T(512) LoginCredentials_auth_data_t;
typedef struct _LoginCredentials {
char username[30];
AuthenticationType typ;
LoginCredentials_auth_data_t auth_data;
} LoginCredentials;
typedef struct _SystemInfo {
CpuFamily cpu_family;
Os os;
char system_information_string[16];
char device_id[50];
} SystemInfo;
typedef struct _ClientResponseEncrypted {
LoginCredentials login_credentials;
SystemInfo system_info;
bool has_version_string;
char version_string[32];
} ClientResponseEncrypted;
/* Helper constants for enums */
#define _CpuFamily_MIN CpuFamily_CPU_UNKNOWN
#define _CpuFamily_MAX CpuFamily_CPU_BLACKFIN
#define _CpuFamily_ARRAYSIZE ((CpuFamily)(CpuFamily_CPU_BLACKFIN+1))
#define _Os_MIN Os_OS_UNKNOWN
#define _Os_MAX Os_OS_BCO
#define _Os_ARRAYSIZE ((Os)(Os_OS_BCO+1))
#define _AuthenticationType_MIN AuthenticationType_AUTHENTICATION_USER_PASS
#define _AuthenticationType_MAX AuthenticationType_AUTHENTICATION_FACEBOOK_TOKEN
#define _AuthenticationType_ARRAYSIZE ((AuthenticationType)(AuthenticationType_AUTHENTICATION_FACEBOOK_TOKEN+1))
#ifdef __cplusplus
extern "C" {
#endif
/* Initializer values for message structs */
#define SystemInfo_init_default {_CpuFamily_MIN, _Os_MIN, "", ""}
#define LoginCredentials_init_default {"", _AuthenticationType_MIN, {0, {0}}}
#define ClientResponseEncrypted_init_default {LoginCredentials_init_default, SystemInfo_init_default, false, ""}
#define SystemInfo_init_zero {_CpuFamily_MIN, _Os_MIN, "", ""}
#define LoginCredentials_init_zero {"", _AuthenticationType_MIN, {0, {0}}}
#define ClientResponseEncrypted_init_zero {LoginCredentials_init_zero, SystemInfo_init_zero, false, ""}
/* Field tags (for use in manual encoding/decoding) */
#define LoginCredentials_username_tag 10
#define LoginCredentials_typ_tag 20
#define LoginCredentials_auth_data_tag 30
#define SystemInfo_cpu_family_tag 10
#define SystemInfo_os_tag 60
#define SystemInfo_system_information_string_tag 90
#define SystemInfo_device_id_tag 100
#define ClientResponseEncrypted_login_credentials_tag 10
#define ClientResponseEncrypted_system_info_tag 50
#define ClientResponseEncrypted_version_string_tag 70
/* Struct field encoding specification for nanopb */
#define SystemInfo_FIELDLIST(X, a) \
X(a, STATIC, REQUIRED, UENUM, cpu_family, 10) \
X(a, STATIC, REQUIRED, UENUM, os, 60) \
X(a, STATIC, REQUIRED, STRING, system_information_string, 90) \
X(a, STATIC, REQUIRED, STRING, device_id, 100)
#define SystemInfo_CALLBACK NULL
#define SystemInfo_DEFAULT NULL
#define LoginCredentials_FIELDLIST(X, a) \
X(a, STATIC, REQUIRED, STRING, username, 10) \
X(a, STATIC, REQUIRED, UENUM, typ, 20) \
X(a, STATIC, REQUIRED, BYTES, auth_data, 30)
#define LoginCredentials_CALLBACK NULL
#define LoginCredentials_DEFAULT NULL
#define ClientResponseEncrypted_FIELDLIST(X, a) \
X(a, STATIC, REQUIRED, MESSAGE, login_credentials, 10) \
X(a, STATIC, REQUIRED, MESSAGE, system_info, 50) \
X(a, STATIC, OPTIONAL, STRING, version_string, 70)
#define ClientResponseEncrypted_CALLBACK NULL
#define ClientResponseEncrypted_DEFAULT NULL
#define ClientResponseEncrypted_login_credentials_MSGTYPE LoginCredentials
#define ClientResponseEncrypted_system_info_MSGTYPE SystemInfo
extern const pb_msgdesc_t SystemInfo_msg;
extern const pb_msgdesc_t LoginCredentials_msg;
extern const pb_msgdesc_t ClientResponseEncrypted_msg;
/* Defines for backwards compatibility with code written before nanopb-0.4.0 */
#define SystemInfo_fields &SystemInfo_msg
#define LoginCredentials_fields &LoginCredentials_msg
#define ClientResponseEncrypted_fields &ClientResponseEncrypted_msg
/* Maximum encoded size of messages (where known) */
#define ClientResponseEncrypted_size 665
#define LoginCredentials_size 550
#define SystemInfo_size 75
#ifdef __cplusplus
} /* extern "C" */
#endif
#endif

View File

@@ -1,54 +0,0 @@
/* Automatically generated nanopb constant definitions */
/* Generated by nanopb-0.4.6-dev */
#include "protobuf/keyexchange.pb.h"
#if PB_PROTO_HEADER_VERSION != 40
#error Regenerate this file with the current version of nanopb generator.
#endif
PB_BIND(LoginCryptoDiffieHellmanChallenge, LoginCryptoDiffieHellmanChallenge, AUTO)
PB_BIND(LoginCryptoChallengeUnion, LoginCryptoChallengeUnion, AUTO)
PB_BIND(LoginCryptoDiffieHellmanHello, LoginCryptoDiffieHellmanHello, AUTO)
PB_BIND(LoginCryptoHelloUnion, LoginCryptoHelloUnion, AUTO)
PB_BIND(BuildInfo, BuildInfo, AUTO)
PB_BIND(FeatureSet, FeatureSet, AUTO)
PB_BIND(APChallenge, APChallenge, AUTO)
PB_BIND(APResponseMessage, APResponseMessage, AUTO)
PB_BIND(LoginCryptoDiffieHellmanResponse, LoginCryptoDiffieHellmanResponse, AUTO)
PB_BIND(LoginCryptoResponseUnion, LoginCryptoResponseUnion, AUTO)
PB_BIND(CryptoResponseUnion, CryptoResponseUnion, AUTO)
PB_BIND(PoWResponseUnion, PoWResponseUnion, AUTO)
PB_BIND(ClientResponsePlaintext, ClientResponsePlaintext, AUTO)
PB_BIND(ClientHello, ClientHello, 2)

View File

@@ -1,343 +0,0 @@
/* Automatically generated nanopb header */
/* Generated by nanopb-0.4.6-dev */
#ifndef PB_PROTOBUF_KEYEXCHANGE_PB_H_INCLUDED
#define PB_PROTOBUF_KEYEXCHANGE_PB_H_INCLUDED
#include <pb.h>
#if PB_PROTO_HEADER_VERSION != 40
#error Regenerate this file with the current version of nanopb generator.
#endif
/* Enum definitions */
typedef enum _Product {
Product_PRODUCT_CLIENT = 0,
Product_PRODUCT_LIBSPOTIFY = 1,
Product_PRODUCT_MOBILE = 2,
Product_PRODUCT_PARTNER = 3,
Product_PRODUCT_LIBSPOTIFY_EMBEDDED = 5
} Product;
typedef enum _Platform2 {
Platform2_PLATFORM_WIN32_X86 = 0,
Platform2_PLATFORM_OSX_X86 = 1,
Platform2_PLATFORM_LINUX_X86 = 2,
Platform2_PLATFORM_IPHONE_ARM = 3,
Platform2_PLATFORM_S60_ARM = 4,
Platform2_PLATFORM_OSX_PPC = 5,
Platform2_PLATFORM_ANDROID_ARM = 6,
Platform2_PLATFORM_WINDOWS_CE_ARM = 7,
Platform2_PLATFORM_LINUX_X86_64 = 8,
Platform2_PLATFORM_OSX_X86_64 = 9,
Platform2_PLATFORM_PALM_ARM = 10,
Platform2_PLATFORM_LINUX_SH = 11,
Platform2_PLATFORM_FREEBSD_X86 = 12,
Platform2_PLATFORM_FREEBSD_X86_64 = 13,
Platform2_PLATFORM_BLACKBERRY_ARM = 14,
Platform2_PLATFORM_SONOS = 15,
Platform2_PLATFORM_LINUX_MIPS = 16,
Platform2_PLATFORM_LINUX_ARM = 17,
Platform2_PLATFORM_LOGITECH_ARM = 18,
Platform2_PLATFORM_LINUX_BLACKFIN = 19,
Platform2_PLATFORM_WP7_ARM = 20,
Platform2_PLATFORM_ONKYO_ARM = 21,
Platform2_PLATFORM_QNXNTO_ARM = 22,
Platform2_PLATFORM_BCO_ARM = 23
} Platform2;
typedef enum _Cryptosuite {
Cryptosuite_CRYPTO_SUITE_SHANNON = 0,
Cryptosuite_CRYPTO_SUITE_RC4_SHA1_HMAC = 1
} Cryptosuite;
/* Struct definitions */
typedef struct _CryptoResponseUnion {
char dummy_field;
} CryptoResponseUnion;
typedef struct _PoWResponseUnion {
char dummy_field;
} PoWResponseUnion;
typedef struct _BuildInfo {
Product product;
Platform2 platform;
uint64_t version;
} BuildInfo;
typedef struct _FeatureSet {
bool has_autoupdate2;
bool autoupdate2;
} FeatureSet;
typedef struct _LoginCryptoDiffieHellmanChallenge {
pb_byte_t gs[96];
} LoginCryptoDiffieHellmanChallenge;
typedef struct _LoginCryptoDiffieHellmanHello {
pb_byte_t gc[96];
uint32_t server_keys_known;
} LoginCryptoDiffieHellmanHello;
typedef struct _LoginCryptoDiffieHellmanResponse {
pb_byte_t hmac[20];
} LoginCryptoDiffieHellmanResponse;
typedef struct _LoginCryptoChallengeUnion {
bool has_diffie_hellman;
LoginCryptoDiffieHellmanChallenge diffie_hellman;
} LoginCryptoChallengeUnion;
typedef struct _LoginCryptoHelloUnion {
bool has_diffie_hellman;
LoginCryptoDiffieHellmanHello diffie_hellman;
} LoginCryptoHelloUnion;
typedef struct _LoginCryptoResponseUnion {
bool has_diffie_hellman;
LoginCryptoDiffieHellmanResponse diffie_hellman;
} LoginCryptoResponseUnion;
typedef struct _APChallenge {
LoginCryptoChallengeUnion login_crypto_challenge;
} APChallenge;
typedef struct _ClientHello {
BuildInfo build_info;
Cryptosuite cryptosuites_supported[1];
LoginCryptoHelloUnion login_crypto_hello;
pb_byte_t client_nonce[16];
bool has_padding;
pb_byte_t padding[1];
bool has_feature_set;
FeatureSet feature_set;
} ClientHello;
typedef struct _ClientResponsePlaintext {
LoginCryptoResponseUnion login_crypto_response;
PoWResponseUnion pow_response;
CryptoResponseUnion crypto_response;
} ClientResponsePlaintext;
typedef struct _APResponseMessage {
bool has_challenge;
APChallenge challenge;
} APResponseMessage;
/* Helper constants for enums */
#define _Product_MIN Product_PRODUCT_CLIENT
#define _Product_MAX Product_PRODUCT_LIBSPOTIFY_EMBEDDED
#define _Product_ARRAYSIZE ((Product)(Product_PRODUCT_LIBSPOTIFY_EMBEDDED+1))
#define _Platform2_MIN Platform2_PLATFORM_WIN32_X86
#define _Platform2_MAX Platform2_PLATFORM_BCO_ARM
#define _Platform2_ARRAYSIZE ((Platform2)(Platform2_PLATFORM_BCO_ARM+1))
#define _Cryptosuite_MIN Cryptosuite_CRYPTO_SUITE_SHANNON
#define _Cryptosuite_MAX Cryptosuite_CRYPTO_SUITE_RC4_SHA1_HMAC
#define _Cryptosuite_ARRAYSIZE ((Cryptosuite)(Cryptosuite_CRYPTO_SUITE_RC4_SHA1_HMAC+1))
#ifdef __cplusplus
extern "C" {
#endif
/* Initializer values for message structs */
#define LoginCryptoDiffieHellmanChallenge_init_default {{0}}
#define LoginCryptoChallengeUnion_init_default {false, LoginCryptoDiffieHellmanChallenge_init_default}
#define LoginCryptoDiffieHellmanHello_init_default {{0}, 0}
#define LoginCryptoHelloUnion_init_default {false, LoginCryptoDiffieHellmanHello_init_default}
#define BuildInfo_init_default {_Product_MIN, _Platform2_MIN, 0}
#define FeatureSet_init_default {false, 0}
#define APChallenge_init_default {LoginCryptoChallengeUnion_init_default}
#define APResponseMessage_init_default {false, APChallenge_init_default}
#define LoginCryptoDiffieHellmanResponse_init_default {{0}}
#define LoginCryptoResponseUnion_init_default {false, LoginCryptoDiffieHellmanResponse_init_default}
#define CryptoResponseUnion_init_default {0}
#define PoWResponseUnion_init_default {0}
#define ClientResponsePlaintext_init_default {LoginCryptoResponseUnion_init_default, PoWResponseUnion_init_default, CryptoResponseUnion_init_default}
#define ClientHello_init_default {BuildInfo_init_default, {_Cryptosuite_MIN}, LoginCryptoHelloUnion_init_default, {0}, false, {0}, false, FeatureSet_init_default}
#define LoginCryptoDiffieHellmanChallenge_init_zero {{0}}
#define LoginCryptoChallengeUnion_init_zero {false, LoginCryptoDiffieHellmanChallenge_init_zero}
#define LoginCryptoDiffieHellmanHello_init_zero {{0}, 0}
#define LoginCryptoHelloUnion_init_zero {false, LoginCryptoDiffieHellmanHello_init_zero}
#define BuildInfo_init_zero {_Product_MIN, _Platform2_MIN, 0}
#define FeatureSet_init_zero {false, 0}
#define APChallenge_init_zero {LoginCryptoChallengeUnion_init_zero}
#define APResponseMessage_init_zero {false, APChallenge_init_zero}
#define LoginCryptoDiffieHellmanResponse_init_zero {{0}}
#define LoginCryptoResponseUnion_init_zero {false, LoginCryptoDiffieHellmanResponse_init_zero}
#define CryptoResponseUnion_init_zero {0}
#define PoWResponseUnion_init_zero {0}
#define ClientResponsePlaintext_init_zero {LoginCryptoResponseUnion_init_zero, PoWResponseUnion_init_zero, CryptoResponseUnion_init_zero}
#define ClientHello_init_zero {BuildInfo_init_zero, {_Cryptosuite_MIN}, LoginCryptoHelloUnion_init_zero, {0}, false, {0}, false, FeatureSet_init_zero}
/* Field tags (for use in manual encoding/decoding) */
#define BuildInfo_product_tag 10
#define BuildInfo_platform_tag 30
#define BuildInfo_version_tag 40
#define FeatureSet_autoupdate2_tag 1
#define LoginCryptoDiffieHellmanChallenge_gs_tag 10
#define LoginCryptoDiffieHellmanHello_gc_tag 10
#define LoginCryptoDiffieHellmanHello_server_keys_known_tag 20
#define LoginCryptoDiffieHellmanResponse_hmac_tag 10
#define LoginCryptoChallengeUnion_diffie_hellman_tag 10
#define LoginCryptoHelloUnion_diffie_hellman_tag 10
#define LoginCryptoResponseUnion_diffie_hellman_tag 10
#define APChallenge_login_crypto_challenge_tag 10
#define ClientHello_build_info_tag 10
#define ClientHello_cryptosuites_supported_tag 30
#define ClientHello_login_crypto_hello_tag 50
#define ClientHello_client_nonce_tag 60
#define ClientHello_padding_tag 70
#define ClientHello_feature_set_tag 80
#define ClientResponsePlaintext_login_crypto_response_tag 10
#define ClientResponsePlaintext_pow_response_tag 20
#define ClientResponsePlaintext_crypto_response_tag 30
#define APResponseMessage_challenge_tag 10
/* Struct field encoding specification for nanopb */
#define LoginCryptoDiffieHellmanChallenge_FIELDLIST(X, a) \
X(a, STATIC, REQUIRED, FIXED_LENGTH_BYTES, gs, 10)
#define LoginCryptoDiffieHellmanChallenge_CALLBACK NULL
#define LoginCryptoDiffieHellmanChallenge_DEFAULT NULL
#define LoginCryptoChallengeUnion_FIELDLIST(X, a) \
X(a, STATIC, OPTIONAL, MESSAGE, diffie_hellman, 10)
#define LoginCryptoChallengeUnion_CALLBACK NULL
#define LoginCryptoChallengeUnion_DEFAULT NULL
#define LoginCryptoChallengeUnion_diffie_hellman_MSGTYPE LoginCryptoDiffieHellmanChallenge
#define LoginCryptoDiffieHellmanHello_FIELDLIST(X, a) \
X(a, STATIC, REQUIRED, FIXED_LENGTH_BYTES, gc, 10) \
X(a, STATIC, REQUIRED, UINT32, server_keys_known, 20)
#define LoginCryptoDiffieHellmanHello_CALLBACK NULL
#define LoginCryptoDiffieHellmanHello_DEFAULT NULL
#define LoginCryptoHelloUnion_FIELDLIST(X, a) \
X(a, STATIC, OPTIONAL, MESSAGE, diffie_hellman, 10)
#define LoginCryptoHelloUnion_CALLBACK NULL
#define LoginCryptoHelloUnion_DEFAULT NULL
#define LoginCryptoHelloUnion_diffie_hellman_MSGTYPE LoginCryptoDiffieHellmanHello
#define BuildInfo_FIELDLIST(X, a) \
X(a, STATIC, REQUIRED, UENUM, product, 10) \
X(a, STATIC, REQUIRED, UENUM, platform, 30) \
X(a, STATIC, REQUIRED, UINT64, version, 40)
#define BuildInfo_CALLBACK NULL
#define BuildInfo_DEFAULT NULL
#define FeatureSet_FIELDLIST(X, a) \
X(a, STATIC, OPTIONAL, BOOL, autoupdate2, 1)
#define FeatureSet_CALLBACK NULL
#define FeatureSet_DEFAULT NULL
#define APChallenge_FIELDLIST(X, a) \
X(a, STATIC, REQUIRED, MESSAGE, login_crypto_challenge, 10)
#define APChallenge_CALLBACK NULL
#define APChallenge_DEFAULT NULL
#define APChallenge_login_crypto_challenge_MSGTYPE LoginCryptoChallengeUnion
#define APResponseMessage_FIELDLIST(X, a) \
X(a, STATIC, OPTIONAL, MESSAGE, challenge, 10)
#define APResponseMessage_CALLBACK NULL
#define APResponseMessage_DEFAULT NULL
#define APResponseMessage_challenge_MSGTYPE APChallenge
#define LoginCryptoDiffieHellmanResponse_FIELDLIST(X, a) \
X(a, STATIC, REQUIRED, FIXED_LENGTH_BYTES, hmac, 10)
#define LoginCryptoDiffieHellmanResponse_CALLBACK NULL
#define LoginCryptoDiffieHellmanResponse_DEFAULT NULL
#define LoginCryptoResponseUnion_FIELDLIST(X, a) \
X(a, STATIC, OPTIONAL, MESSAGE, diffie_hellman, 10)
#define LoginCryptoResponseUnion_CALLBACK NULL
#define LoginCryptoResponseUnion_DEFAULT NULL
#define LoginCryptoResponseUnion_diffie_hellman_MSGTYPE LoginCryptoDiffieHellmanResponse
#define CryptoResponseUnion_FIELDLIST(X, a) \
#define CryptoResponseUnion_CALLBACK NULL
#define CryptoResponseUnion_DEFAULT NULL
#define PoWResponseUnion_FIELDLIST(X, a) \
#define PoWResponseUnion_CALLBACK NULL
#define PoWResponseUnion_DEFAULT NULL
#define ClientResponsePlaintext_FIELDLIST(X, a) \
X(a, STATIC, REQUIRED, MESSAGE, login_crypto_response, 10) \
X(a, STATIC, REQUIRED, MESSAGE, pow_response, 20) \
X(a, STATIC, REQUIRED, MESSAGE, crypto_response, 30)
#define ClientResponsePlaintext_CALLBACK NULL
#define ClientResponsePlaintext_DEFAULT NULL
#define ClientResponsePlaintext_login_crypto_response_MSGTYPE LoginCryptoResponseUnion
#define ClientResponsePlaintext_pow_response_MSGTYPE PoWResponseUnion
#define ClientResponsePlaintext_crypto_response_MSGTYPE CryptoResponseUnion
#define ClientHello_FIELDLIST(X, a) \
X(a, STATIC, REQUIRED, MESSAGE, build_info, 10) \
X(a, STATIC, FIXARRAY, UENUM, cryptosuites_supported, 30) \
X(a, STATIC, REQUIRED, MESSAGE, login_crypto_hello, 50) \
X(a, STATIC, REQUIRED, FIXED_LENGTH_BYTES, client_nonce, 60) \
X(a, STATIC, OPTIONAL, FIXED_LENGTH_BYTES, padding, 70) \
X(a, STATIC, OPTIONAL, MESSAGE, feature_set, 80)
#define ClientHello_CALLBACK NULL
#define ClientHello_DEFAULT NULL
#define ClientHello_build_info_MSGTYPE BuildInfo
#define ClientHello_login_crypto_hello_MSGTYPE LoginCryptoHelloUnion
#define ClientHello_feature_set_MSGTYPE FeatureSet
extern const pb_msgdesc_t LoginCryptoDiffieHellmanChallenge_msg;
extern const pb_msgdesc_t LoginCryptoChallengeUnion_msg;
extern const pb_msgdesc_t LoginCryptoDiffieHellmanHello_msg;
extern const pb_msgdesc_t LoginCryptoHelloUnion_msg;
extern const pb_msgdesc_t BuildInfo_msg;
extern const pb_msgdesc_t FeatureSet_msg;
extern const pb_msgdesc_t APChallenge_msg;
extern const pb_msgdesc_t APResponseMessage_msg;
extern const pb_msgdesc_t LoginCryptoDiffieHellmanResponse_msg;
extern const pb_msgdesc_t LoginCryptoResponseUnion_msg;
extern const pb_msgdesc_t CryptoResponseUnion_msg;
extern const pb_msgdesc_t PoWResponseUnion_msg;
extern const pb_msgdesc_t ClientResponsePlaintext_msg;
extern const pb_msgdesc_t ClientHello_msg;
/* Defines for backwards compatibility with code written before nanopb-0.4.0 */
#define LoginCryptoDiffieHellmanChallenge_fields &LoginCryptoDiffieHellmanChallenge_msg
#define LoginCryptoChallengeUnion_fields &LoginCryptoChallengeUnion_msg
#define LoginCryptoDiffieHellmanHello_fields &LoginCryptoDiffieHellmanHello_msg
#define LoginCryptoHelloUnion_fields &LoginCryptoHelloUnion_msg
#define BuildInfo_fields &BuildInfo_msg
#define FeatureSet_fields &FeatureSet_msg
#define APChallenge_fields &APChallenge_msg
#define APResponseMessage_fields &APResponseMessage_msg
#define LoginCryptoDiffieHellmanResponse_fields &LoginCryptoDiffieHellmanResponse_msg
#define LoginCryptoResponseUnion_fields &LoginCryptoResponseUnion_msg
#define CryptoResponseUnion_fields &CryptoResponseUnion_msg
#define PoWResponseUnion_fields &PoWResponseUnion_msg
#define ClientResponsePlaintext_fields &ClientResponsePlaintext_msg
#define ClientHello_fields &ClientHello_msg
/* Maximum encoded size of messages (where known) */
#define APChallenge_size 102
#define APResponseMessage_size 104
#define BuildInfo_size 17
#define ClientHello_size 161
#define ClientResponsePlaintext_size 32
#define CryptoResponseUnion_size 0
#define FeatureSet_size 2
#define LoginCryptoChallengeUnion_size 100
#define LoginCryptoDiffieHellmanChallenge_size 98
#define LoginCryptoDiffieHellmanHello_size 105
#define LoginCryptoDiffieHellmanResponse_size 22
#define LoginCryptoHelloUnion_size 107
#define LoginCryptoResponseUnion_size 24
#define PoWResponseUnion_size 0
#ifdef __cplusplus
} /* extern "C" */
#endif
#endif

View File

@@ -1,12 +0,0 @@
/* Automatically generated nanopb constant definitions */
/* Generated by nanopb-0.4.6-dev */
#include "protobuf/mercury.pb.h"
#if PB_PROTO_HEADER_VERSION != 40
#error Regenerate this file with the current version of nanopb generator.
#endif
PB_BIND(Header, Header, 2)

View File

@@ -1,52 +0,0 @@
/* Automatically generated nanopb header */
/* Generated by nanopb-0.4.6-dev */
#ifndef PB_PROTOBUF_MERCURY_PB_H_INCLUDED
#define PB_PROTOBUF_MERCURY_PB_H_INCLUDED
#include <pb.h>
#if PB_PROTO_HEADER_VERSION != 40
#error Regenerate this file with the current version of nanopb generator.
#endif
/* Struct definitions */
typedef struct _Header {
bool has_uri;
char uri[256];
bool has_method;
char method[64];
} Header;
#ifdef __cplusplus
extern "C" {
#endif
/* Initializer values for message structs */
#define Header_init_default {false, "", false, ""}
#define Header_init_zero {false, "", false, ""}
/* Field tags (for use in manual encoding/decoding) */
#define Header_uri_tag 1
#define Header_method_tag 3
/* Struct field encoding specification for nanopb */
#define Header_FIELDLIST(X, a) \
X(a, STATIC, OPTIONAL, STRING, uri, 1) \
X(a, STATIC, OPTIONAL, STRING, method, 3)
#define Header_CALLBACK NULL
#define Header_DEFAULT NULL
extern const pb_msgdesc_t Header_msg;
/* Defines for backwards compatibility with code written before nanopb-0.4.0 */
#define Header_fields &Header_msg
/* Maximum encoded size of messages (where known) */
#define Header_size 323
#ifdef __cplusplus
} /* extern "C" */
#endif
#endif

View File

@@ -1,34 +0,0 @@
/* Automatically generated nanopb constant definitions */
/* Generated by nanopb-0.4.6-dev */
#include "protobuf/metadata.pb.h"
#if PB_PROTO_HEADER_VERSION != 40
#error Regenerate this file with the current version of nanopb generator.
#endif
PB_BIND(AudioFile, AudioFile, AUTO)
PB_BIND(Restriction, Restriction, AUTO)
PB_BIND(Image, Image, AUTO)
PB_BIND(ImageGroup, ImageGroup, AUTO)
PB_BIND(Album, Album, AUTO)
PB_BIND(Artist, Artist, AUTO)
PB_BIND(Track, Track, AUTO)
PB_BIND(Episode, Episode, 2)

View File

@@ -1,240 +0,0 @@
/* Automatically generated nanopb header */
/* Generated by nanopb-0.4.6-dev */
#ifndef PB_PROTOBUF_METADATA_PB_H_INCLUDED
#define PB_PROTOBUF_METADATA_PB_H_INCLUDED
#include <pb.h>
#if PB_PROTO_HEADER_VERSION != 40
#error Regenerate this file with the current version of nanopb generator.
#endif
/* Enum definitions */
typedef enum _AudioFormat {
AudioFormat_OGG_VORBIS_96 = 0,
AudioFormat_OGG_VORBIS_160 = 1,
AudioFormat_OGG_VORBIS_320 = 2,
AudioFormat_MP3_256 = 3,
AudioFormat_MP3_320 = 4,
AudioFormat_MP3_160 = 5,
AudioFormat_MP3_96 = 6,
AudioFormat_MP3_160_ENC = 7,
AudioFormat_AAC_24 = 8,
AudioFormat_AAC_48 = 9
} AudioFormat;
/* Struct definitions */
typedef struct _Artist {
pb_bytes_array_t *gid;
char *name;
} Artist;
typedef struct _Image {
pb_bytes_array_t *file_id;
} Image;
typedef struct _ImageGroup {
pb_size_t image_count;
struct _Image *image;
} ImageGroup;
typedef struct _Restriction {
char *countries_allowed;
char *countries_forbidden;
} Restriction;
typedef struct _Album {
pb_callback_t gid;
char *name;
bool has_cover_group;
ImageGroup cover_group;
} Album;
typedef struct _AudioFile {
pb_bytes_array_t *file_id;
bool has_format;
AudioFormat format;
} AudioFile;
typedef struct _Episode {
pb_bytes_array_t *gid;
char *name;
bool has_duration;
int32_t duration;
pb_size_t audio_count;
struct _AudioFile *audio;
struct _ImageGroup *covers;
} Episode;
typedef struct _Track {
pb_bytes_array_t *gid;
char *name;
bool has_album;
Album album;
pb_size_t artist_count;
struct _Artist *artist;
bool has_duration;
int32_t duration;
pb_size_t restriction_count;
struct _Restriction *restriction;
pb_size_t file_count;
struct _AudioFile *file;
pb_size_t alternative_count;
struct _Track *alternative;
} Track;
/* Helper constants for enums */
#define _AudioFormat_MIN AudioFormat_OGG_VORBIS_96
#define _AudioFormat_MAX AudioFormat_AAC_48
#define _AudioFormat_ARRAYSIZE ((AudioFormat)(AudioFormat_AAC_48+1))
#ifdef __cplusplus
extern "C" {
#endif
/* Initializer values for message structs */
#define AudioFile_init_default {NULL, false, _AudioFormat_MIN}
#define Restriction_init_default {NULL, NULL}
#define Image_init_default {NULL}
#define ImageGroup_init_default {0, NULL}
#define Album_init_default {{{NULL}, NULL}, NULL, false, ImageGroup_init_default}
#define Artist_init_default {NULL, NULL}
#define Track_init_default {NULL, NULL, false, Album_init_default, 0, NULL, false, 0, 0, NULL, 0, NULL, 0, NULL}
#define Episode_init_default {NULL, NULL, false, 0, 0, NULL, NULL}
#define AudioFile_init_zero {NULL, false, _AudioFormat_MIN}
#define Restriction_init_zero {NULL, NULL}
#define Image_init_zero {NULL}
#define ImageGroup_init_zero {0, NULL}
#define Album_init_zero {{{NULL}, NULL}, NULL, false, ImageGroup_init_zero}
#define Artist_init_zero {NULL, NULL}
#define Track_init_zero {NULL, NULL, false, Album_init_zero, 0, NULL, false, 0, 0, NULL, 0, NULL, 0, NULL}
#define Episode_init_zero {NULL, NULL, false, 0, 0, NULL, NULL}
/* Field tags (for use in manual encoding/decoding) */
#define Artist_gid_tag 1
#define Artist_name_tag 2
#define Image_file_id_tag 1
#define ImageGroup_image_tag 1
#define Restriction_countries_allowed_tag 2
#define Restriction_countries_forbidden_tag 3
#define Album_gid_tag 1
#define Album_name_tag 2
#define Album_cover_group_tag 17
#define AudioFile_file_id_tag 1
#define AudioFile_format_tag 2
#define Episode_gid_tag 1
#define Episode_name_tag 2
#define Episode_duration_tag 7
#define Episode_audio_tag 12
#define Episode_covers_tag 68
#define Track_gid_tag 1
#define Track_name_tag 2
#define Track_album_tag 3
#define Track_artist_tag 4
#define Track_duration_tag 7
#define Track_restriction_tag 11
#define Track_file_tag 12
#define Track_alternative_tag 13
/* Struct field encoding specification for nanopb */
#define AudioFile_FIELDLIST(X, a) \
X(a, POINTER, OPTIONAL, BYTES, file_id, 1) \
X(a, STATIC, OPTIONAL, UENUM, format, 2)
#define AudioFile_CALLBACK NULL
#define AudioFile_DEFAULT NULL
#define Restriction_FIELDLIST(X, a) \
X(a, POINTER, OPTIONAL, STRING, countries_allowed, 2) \
X(a, POINTER, OPTIONAL, STRING, countries_forbidden, 3)
#define Restriction_CALLBACK NULL
#define Restriction_DEFAULT NULL
#define Image_FIELDLIST(X, a) \
X(a, POINTER, OPTIONAL, BYTES, file_id, 1)
#define Image_CALLBACK NULL
#define Image_DEFAULT NULL
#define ImageGroup_FIELDLIST(X, a) \
X(a, POINTER, REPEATED, MESSAGE, image, 1)
#define ImageGroup_CALLBACK NULL
#define ImageGroup_DEFAULT NULL
#define ImageGroup_image_MSGTYPE Image
#define Album_FIELDLIST(X, a) \
X(a, CALLBACK, OPTIONAL, BYTES, gid, 1) \
X(a, POINTER, OPTIONAL, STRING, name, 2) \
X(a, STATIC, OPTIONAL, MESSAGE, cover_group, 17)
#define Album_CALLBACK pb_default_field_callback
#define Album_DEFAULT NULL
#define Album_cover_group_MSGTYPE ImageGroup
#define Artist_FIELDLIST(X, a) \
X(a, POINTER, OPTIONAL, BYTES, gid, 1) \
X(a, POINTER, OPTIONAL, STRING, name, 2)
#define Artist_CALLBACK NULL
#define Artist_DEFAULT NULL
#define Track_FIELDLIST(X, a) \
X(a, POINTER, OPTIONAL, BYTES, gid, 1) \
X(a, POINTER, OPTIONAL, STRING, name, 2) \
X(a, STATIC, OPTIONAL, MESSAGE, album, 3) \
X(a, POINTER, REPEATED, MESSAGE, artist, 4) \
X(a, STATIC, OPTIONAL, SINT32, duration, 7) \
X(a, POINTER, REPEATED, MESSAGE, restriction, 11) \
X(a, POINTER, REPEATED, MESSAGE, file, 12) \
X(a, POINTER, REPEATED, MESSAGE, alternative, 13)
#define Track_CALLBACK NULL
#define Track_DEFAULT NULL
#define Track_album_MSGTYPE Album
#define Track_artist_MSGTYPE Artist
#define Track_restriction_MSGTYPE Restriction
#define Track_file_MSGTYPE AudioFile
#define Track_alternative_MSGTYPE Track
#define Episode_FIELDLIST(X, a) \
X(a, POINTER, OPTIONAL, BYTES, gid, 1) \
X(a, POINTER, OPTIONAL, STRING, name, 2) \
X(a, STATIC, OPTIONAL, SINT32, duration, 7) \
X(a, POINTER, REPEATED, MESSAGE, audio, 12) \
X(a, POINTER, OPTIONAL, MESSAGE, covers, 68)
#define Episode_CALLBACK NULL
#define Episode_DEFAULT NULL
#define Episode_audio_MSGTYPE AudioFile
#define Episode_covers_MSGTYPE ImageGroup
extern const pb_msgdesc_t AudioFile_msg;
extern const pb_msgdesc_t Restriction_msg;
extern const pb_msgdesc_t Image_msg;
extern const pb_msgdesc_t ImageGroup_msg;
extern const pb_msgdesc_t Album_msg;
extern const pb_msgdesc_t Artist_msg;
extern const pb_msgdesc_t Track_msg;
extern const pb_msgdesc_t Episode_msg;
/* Defines for backwards compatibility with code written before nanopb-0.4.0 */
#define AudioFile_fields &AudioFile_msg
#define Restriction_fields &Restriction_msg
#define Image_fields &Image_msg
#define ImageGroup_fields &ImageGroup_msg
#define Album_fields &Album_msg
#define Artist_fields &Artist_msg
#define Track_fields &Track_msg
#define Episode_fields &Episode_msg
/* Maximum encoded size of messages (where known) */
/* AudioFile_size depends on runtime parameters */
/* Restriction_size depends on runtime parameters */
/* Image_size depends on runtime parameters */
/* ImageGroup_size depends on runtime parameters */
/* Album_size depends on runtime parameters */
/* Artist_size depends on runtime parameters */
/* Track_size depends on runtime parameters */
/* Episode_size depends on runtime parameters */
#ifdef __cplusplus
} /* extern "C" */
#endif
#endif

View File

@@ -1,27 +0,0 @@
/* Automatically generated nanopb constant definitions */
/* Generated by nanopb-0.4.6-dev */
#include "protobuf/spirc.pb.h"
#if PB_PROTO_HEADER_VERSION != 40
#error Regenerate this file with the current version of nanopb generator.
#endif
PB_BIND(TrackRef, TrackRef, AUTO)
PB_BIND(State, State, AUTO)
PB_BIND(Capability, Capability, 2)
PB_BIND(DeviceState, DeviceState, 4)
PB_BIND(Frame, Frame, 4)

View File

@@ -1,294 +0,0 @@
/* Automatically generated nanopb header */
/* Generated by nanopb-0.4.6-dev */
#ifndef PB_PROTOBUF_SPIRC_PB_H_INCLUDED
#define PB_PROTOBUF_SPIRC_PB_H_INCLUDED
#include <pb.h>
#if PB_PROTO_HEADER_VERSION != 40
#error Regenerate this file with the current version of nanopb generator.
#endif
/* Enum definitions */
typedef enum _MessageType {
MessageType_kMessageTypeHello = 1,
MessageType_kMessageTypeGoodbye = 2,
MessageType_kMessageTypeProbe = 3,
MessageType_kMessageTypeNotify = 10,
MessageType_kMessageTypeLoad = 20,
MessageType_kMessageTypePlay = 21,
MessageType_kMessageTypePause = 22,
MessageType_kMessageTypePlayPause = 23,
MessageType_kMessageTypeSeek = 24,
MessageType_kMessageTypePrev = 25,
MessageType_kMessageTypeNext = 26,
MessageType_kMessageTypeVolume = 27,
MessageType_kMessageTypeShuffle = 28,
MessageType_kMessageTypeRepeat = 29,
MessageType_kMessageTypeVolumeDown = 31,
MessageType_kMessageTypeVolumeUp = 32,
MessageType_kMessageTypeReplace = 33,
MessageType_kMessageTypeLogout = 34,
MessageType_kMessageTypeAction = 35
} MessageType;
typedef enum _PlayStatus {
PlayStatus_kPlayStatusStop = 0,
PlayStatus_kPlayStatusPlay = 1,
PlayStatus_kPlayStatusPause = 2,
PlayStatus_kPlayStatusLoading = 3
} PlayStatus;
typedef enum _CapabilityType {
CapabilityType_kSupportedContexts = 1,
CapabilityType_kCanBePlayer = 2,
CapabilityType_kRestrictToLocal = 3,
CapabilityType_kDeviceType = 4,
CapabilityType_kGaiaEqConnectId = 5,
CapabilityType_kSupportsLogout = 6,
CapabilityType_kIsObservable = 7,
CapabilityType_kVolumeSteps = 8,
CapabilityType_kSupportedTypes = 9,
CapabilityType_kCommandAcks = 10
} CapabilityType;
/* Struct definitions */
typedef struct _Capability {
bool has_typ;
CapabilityType typ;
pb_size_t intValue_count;
int64_t intValue[50];
pb_size_t stringValue_count;
char stringValue[50][50];
} Capability;
typedef struct _State {
char *context_uri;
bool has_index;
uint32_t index;
bool has_position_ms;
uint32_t position_ms;
bool has_status;
PlayStatus status;
bool has_position_measured_at;
uint64_t position_measured_at;
pb_callback_t context_description;
bool has_shuffle;
bool shuffle;
bool has_repeat;
bool repeat;
bool has_playing_track_index;
uint32_t playing_track_index;
pb_size_t track_count;
struct _TrackRef *track;
} State;
typedef struct _TrackRef {
pb_bytes_array_t *gid;
char *uri;
bool has_queued;
bool queued;
char *context;
} TrackRef;
typedef struct _DeviceState {
char *sw_version;
bool has_is_active;
bool is_active;
bool has_can_play;
bool can_play;
bool has_volume;
uint32_t volume;
char *name;
bool has_error_code;
uint32_t error_code;
bool has_became_active_at;
int64_t became_active_at;
pb_callback_t error_message;
pb_size_t capabilities_count;
Capability capabilities[17];
pb_callback_t local_uris;
} DeviceState;
typedef struct _Frame {
bool has_version;
uint32_t version;
char *ident;
char *protocol_version;
bool has_seq_nr;
uint32_t seq_nr;
bool has_typ;
MessageType typ;
bool has_device_state;
DeviceState device_state;
bool has_state;
State state;
bool has_position;
uint32_t position;
bool has_volume;
uint32_t volume;
bool has_state_update_id;
int64_t state_update_id;
pb_size_t recipient_count;
char **recipient;
} Frame;
/* Helper constants for enums */
#define _MessageType_MIN MessageType_kMessageTypeHello
#define _MessageType_MAX MessageType_kMessageTypeAction
#define _MessageType_ARRAYSIZE ((MessageType)(MessageType_kMessageTypeAction+1))
#define _PlayStatus_MIN PlayStatus_kPlayStatusStop
#define _PlayStatus_MAX PlayStatus_kPlayStatusLoading
#define _PlayStatus_ARRAYSIZE ((PlayStatus)(PlayStatus_kPlayStatusLoading+1))
#define _CapabilityType_MIN CapabilityType_kSupportedContexts
#define _CapabilityType_MAX CapabilityType_kCommandAcks
#define _CapabilityType_ARRAYSIZE ((CapabilityType)(CapabilityType_kCommandAcks+1))
#ifdef __cplusplus
extern "C" {
#endif
/* Initializer values for message structs */
#define TrackRef_init_default {NULL, NULL, false, 0, NULL}
#define State_init_default {NULL, false, 0, false, 0, false, _PlayStatus_MIN, false, 0, {{NULL}, NULL}, false, 0, false, 0, false, 0, 0, NULL}
#define Capability_init_default {false, _CapabilityType_MIN, 0, {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, 0, {"", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", ""}}
#define DeviceState_init_default {NULL, false, 0, false, 0, false, 0, NULL, false, 0, false, 0, {{NULL}, NULL}, 0, {Capability_init_default, Capability_init_default, Capability_init_default, Capability_init_default, Capability_init_default, Capability_init_default, Capability_init_default, Capability_init_default, Capability_init_default, Capability_init_default, Capability_init_default, Capability_init_default, Capability_init_default, Capability_init_default, Capability_init_default, Capability_init_default, Capability_init_default}, {{NULL}, NULL}}
#define Frame_init_default {false, 0, NULL, NULL, false, 0, false, _MessageType_MIN, false, DeviceState_init_default, false, State_init_default, false, 0, false, 0, false, 0, 0, NULL}
#define TrackRef_init_zero {NULL, NULL, false, 0, NULL}
#define State_init_zero {NULL, false, 0, false, 0, false, _PlayStatus_MIN, false, 0, {{NULL}, NULL}, false, 0, false, 0, false, 0, 0, NULL}
#define Capability_init_zero {false, _CapabilityType_MIN, 0, {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, 0, {"", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", ""}}
#define DeviceState_init_zero {NULL, false, 0, false, 0, false, 0, NULL, false, 0, false, 0, {{NULL}, NULL}, 0, {Capability_init_zero, Capability_init_zero, Capability_init_zero, Capability_init_zero, Capability_init_zero, Capability_init_zero, Capability_init_zero, Capability_init_zero, Capability_init_zero, Capability_init_zero, Capability_init_zero, Capability_init_zero, Capability_init_zero, Capability_init_zero, Capability_init_zero, Capability_init_zero, Capability_init_zero}, {{NULL}, NULL}}
#define Frame_init_zero {false, 0, NULL, NULL, false, 0, false, _MessageType_MIN, false, DeviceState_init_zero, false, State_init_zero, false, 0, false, 0, false, 0, 0, NULL}
/* Field tags (for use in manual encoding/decoding) */
#define Capability_typ_tag 1
#define Capability_intValue_tag 2
#define Capability_stringValue_tag 3
#define State_context_uri_tag 2
#define State_index_tag 3
#define State_position_ms_tag 4
#define State_status_tag 5
#define State_position_measured_at_tag 7
#define State_context_description_tag 8
#define State_shuffle_tag 13
#define State_repeat_tag 14
#define State_playing_track_index_tag 26
#define State_track_tag 27
#define TrackRef_gid_tag 1
#define TrackRef_uri_tag 2
#define TrackRef_queued_tag 3
#define TrackRef_context_tag 4
#define DeviceState_sw_version_tag 1
#define DeviceState_is_active_tag 10
#define DeviceState_can_play_tag 11
#define DeviceState_volume_tag 12
#define DeviceState_name_tag 13
#define DeviceState_error_code_tag 14
#define DeviceState_became_active_at_tag 15
#define DeviceState_error_message_tag 16
#define DeviceState_capabilities_tag 17
#define DeviceState_local_uris_tag 18
#define Frame_version_tag 1
#define Frame_ident_tag 2
#define Frame_protocol_version_tag 3
#define Frame_seq_nr_tag 4
#define Frame_typ_tag 5
#define Frame_device_state_tag 7
#define Frame_state_tag 12
#define Frame_position_tag 13
#define Frame_volume_tag 14
#define Frame_state_update_id_tag 17
#define Frame_recipient_tag 18
/* Struct field encoding specification for nanopb */
#define TrackRef_FIELDLIST(X, a) \
X(a, POINTER, OPTIONAL, BYTES, gid, 1) \
X(a, POINTER, OPTIONAL, STRING, uri, 2) \
X(a, STATIC, OPTIONAL, BOOL, queued, 3) \
X(a, POINTER, OPTIONAL, STRING, context, 4)
#define TrackRef_CALLBACK NULL
#define TrackRef_DEFAULT NULL
#define State_FIELDLIST(X, a) \
X(a, POINTER, OPTIONAL, STRING, context_uri, 2) \
X(a, STATIC, OPTIONAL, UINT32, index, 3) \
X(a, STATIC, OPTIONAL, UINT32, position_ms, 4) \
X(a, STATIC, OPTIONAL, UENUM, status, 5) \
X(a, STATIC, OPTIONAL, UINT64, position_measured_at, 7) \
X(a, CALLBACK, OPTIONAL, STRING, context_description, 8) \
X(a, STATIC, OPTIONAL, BOOL, shuffle, 13) \
X(a, STATIC, OPTIONAL, BOOL, repeat, 14) \
X(a, STATIC, OPTIONAL, UINT32, playing_track_index, 26) \
X(a, POINTER, REPEATED, MESSAGE, track, 27)
#define State_CALLBACK pb_default_field_callback
#define State_DEFAULT NULL
#define State_track_MSGTYPE TrackRef
#define Capability_FIELDLIST(X, a) \
X(a, STATIC, OPTIONAL, UENUM, typ, 1) \
X(a, STATIC, REPEATED, INT64, intValue, 2) \
X(a, STATIC, REPEATED, STRING, stringValue, 3)
#define Capability_CALLBACK NULL
#define Capability_DEFAULT (const pb_byte_t*)"\x08\x01\x00"
#define DeviceState_FIELDLIST(X, a) \
X(a, POINTER, OPTIONAL, STRING, sw_version, 1) \
X(a, STATIC, OPTIONAL, BOOL, is_active, 10) \
X(a, STATIC, OPTIONAL, BOOL, can_play, 11) \
X(a, STATIC, OPTIONAL, UINT32, volume, 12) \
X(a, POINTER, OPTIONAL, STRING, name, 13) \
X(a, STATIC, OPTIONAL, UINT32, error_code, 14) \
X(a, STATIC, OPTIONAL, INT64, became_active_at, 15) \
X(a, CALLBACK, OPTIONAL, STRING, error_message, 16) \
X(a, STATIC, REPEATED, MESSAGE, capabilities, 17) \
X(a, CALLBACK, REPEATED, STRING, local_uris, 18)
#define DeviceState_CALLBACK pb_default_field_callback
#define DeviceState_DEFAULT NULL
#define DeviceState_capabilities_MSGTYPE Capability
#define Frame_FIELDLIST(X, a) \
X(a, STATIC, OPTIONAL, UINT32, version, 1) \
X(a, POINTER, OPTIONAL, STRING, ident, 2) \
X(a, POINTER, OPTIONAL, STRING, protocol_version, 3) \
X(a, STATIC, OPTIONAL, UINT32, seq_nr, 4) \
X(a, STATIC, OPTIONAL, UENUM, typ, 5) \
X(a, STATIC, OPTIONAL, MESSAGE, device_state, 7) \
X(a, STATIC, OPTIONAL, MESSAGE, state, 12) \
X(a, STATIC, OPTIONAL, UINT32, position, 13) \
X(a, STATIC, OPTIONAL, UINT32, volume, 14) \
X(a, STATIC, OPTIONAL, INT64, state_update_id, 17) \
X(a, POINTER, REPEATED, STRING, recipient, 18)
#define Frame_CALLBACK NULL
#define Frame_DEFAULT (const pb_byte_t*)"\x28\x01\x00"
#define Frame_device_state_MSGTYPE DeviceState
#define Frame_state_MSGTYPE State
extern const pb_msgdesc_t TrackRef_msg;
extern const pb_msgdesc_t State_msg;
extern const pb_msgdesc_t Capability_msg;
extern const pb_msgdesc_t DeviceState_msg;
extern const pb_msgdesc_t Frame_msg;
/* Defines for backwards compatibility with code written before nanopb-0.4.0 */
#define TrackRef_fields &TrackRef_msg
#define State_fields &State_msg
#define Capability_fields &Capability_msg
#define DeviceState_fields &DeviceState_msg
#define Frame_fields &Frame_msg
/* Maximum encoded size of messages (where known) */
/* TrackRef_size depends on runtime parameters */
/* State_size depends on runtime parameters */
/* DeviceState_size depends on runtime parameters */
/* Frame_size depends on runtime parameters */
#define Capability_size 3102
#ifdef __cplusplus
} /* extern "C" */
#endif
#endif