Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Xiph.Org
flac
Commits
77e3f319
Commit
77e3f319
authored
Jun 23, 2001
by
Josh Coalson
Browse files
revamp the ordinal types
parent
3d094cd0
Changes
44
Expand all
Hide whitespace changes
Inline
Side-by-side
include/FLAC/file_decoder.h
View file @
77e3f319
...
...
@@ -62,11 +62,11 @@ typedef struct {
* will take on the defaults from the constructor, shown below.
* For more on what the parameters mean, see the documentation.
*
* bool
md5_checking (DEFAULT: false) MD5 checking will be turned off if a seek is requested
* (*write_callback)() (DEFAULT: NULL ) The callbacks are the only values that MUST be set before FLAC__file_decoder_init()
* (*metadata_callback)() (DEFAULT: NULL )
* (*error_callback)() (DEFAULT: NULL )
* void* client_data (DEFAULT: NULL ) passed back through the callbacks
*
FLAC__
bool md5_checking (DEFAULT: false) MD5 checking will be turned off if a seek is requested
*
(*write_callback)() (DEFAULT: NULL ) The callbacks are the only values that MUST be set before FLAC__file_decoder_init()
*
(*metadata_callback)() (DEFAULT: NULL )
*
(*error_callback)() (DEFAULT: NULL )
* void*
client_data (DEFAULT: NULL ) passed back through the callbacks
*/
FLAC__FileDecoder
*
FLAC__file_decoder_new
();
void
FLAC__file_decoder_delete
(
FLAC__FileDecoder
*
);
...
...
@@ -94,18 +94,18 @@ void FLAC__file_decoder_delete(FLAC__FileDecoder *);
* FLAC__file_decoder_flush() or FLAC__file_decoder_reset() do
* NOT reset the values to the constructor defaults.
*/
bool
FLAC__file_decoder_set_md5_checking
(
const
FLAC__FileDecoder
*
decoder
,
bool
value
);
bool
FLAC__file_decoder_set_filename
(
const
FLAC__FileDecoder
*
decoder
,
const
char
*
value
);
bool
FLAC__file_decoder_set_write_callback
(
const
FLAC__FileDecoder
*
decoder
,
FLAC__StreamDecoderWriteStatus
(
*
value
)(
const
FLAC__FileDecoder
*
decoder
,
const
FLAC__Frame
*
frame
,
const
int32
*
buffer
[],
void
*
client_data
));
bool
FLAC__file_decoder_set_metadata_callback
(
const
FLAC__FileDecoder
*
decoder
,
void
(
*
value
)(
const
FLAC__FileDecoder
*
decoder
,
const
FLAC__StreamMetaData
*
metadata
,
void
*
client_data
));
bool
FLAC__file_decoder_set_error_callback
(
const
FLAC__FileDecoder
*
decoder
,
void
(
*
value
)(
const
FLAC__FileDecoder
*
decoder
,
FLAC__StreamDecoderErrorStatus
status
,
void
*
client_data
));
bool
FLAC__file_decoder_set_client_data
(
const
FLAC__FileDecoder
*
decoder
,
void
*
value
);
FLAC__
bool
FLAC__file_decoder_set_md5_checking
(
const
FLAC__FileDecoder
*
decoder
,
FLAC__
bool
value
);
FLAC__
bool
FLAC__file_decoder_set_filename
(
const
FLAC__FileDecoder
*
decoder
,
const
char
*
value
);
FLAC__
bool
FLAC__file_decoder_set_write_callback
(
const
FLAC__FileDecoder
*
decoder
,
FLAC__StreamDecoderWriteStatus
(
*
value
)(
const
FLAC__FileDecoder
*
decoder
,
const
FLAC__Frame
*
frame
,
const
FLAC__
int32
*
buffer
[],
void
*
client_data
));
FLAC__
bool
FLAC__file_decoder_set_metadata_callback
(
const
FLAC__FileDecoder
*
decoder
,
void
(
*
value
)(
const
FLAC__FileDecoder
*
decoder
,
const
FLAC__StreamMetaData
*
metadata
,
void
*
client_data
));
FLAC__
bool
FLAC__file_decoder_set_error_callback
(
const
FLAC__FileDecoder
*
decoder
,
void
(
*
value
)(
const
FLAC__FileDecoder
*
decoder
,
FLAC__StreamDecoderErrorStatus
status
,
void
*
client_data
));
FLAC__
bool
FLAC__file_decoder_set_client_data
(
const
FLAC__FileDecoder
*
decoder
,
void
*
value
);
/*
* Various "get" methods
*/
FLAC__FileDecoderState
FLAC__file_decoder_get_state
(
const
FLAC__FileDecoder
*
decoder
);
bool
FLAC__file_decoder_get_md5_checking
(
const
FLAC__FileDecoder
*
decoder
);
FLAC__
bool
FLAC__file_decoder_get_md5_checking
(
const
FLAC__FileDecoder
*
decoder
);
/*
* Initialize the instance; should be called after construction and
...
...
@@ -121,16 +121,16 @@ FLAC__FileDecoderState FLAC__file_decoder_init(FLAC__FileDecoder *decoder);
* md5_checking is set AND the stored MD5 sum is non-zero AND the stored
* MD5 sum and computed MD5 sum do not match.
*/
bool
FLAC__file_decoder_finish
(
FLAC__FileDecoder
*
decoder
);
FLAC__
bool
FLAC__file_decoder_finish
(
FLAC__FileDecoder
*
decoder
);
/*
* Methods for decoding the data
*/
bool
FLAC__file_decoder_process_whole_file
(
FLAC__FileDecoder
*
decoder
);
bool
FLAC__file_decoder_process_metadata
(
FLAC__FileDecoder
*
decoder
);
bool
FLAC__file_decoder_process_one_frame
(
FLAC__FileDecoder
*
decoder
);
bool
FLAC__file_decoder_process_remaining_frames
(
FLAC__FileDecoder
*
decoder
);
FLAC__
bool
FLAC__file_decoder_process_whole_file
(
FLAC__FileDecoder
*
decoder
);
FLAC__
bool
FLAC__file_decoder_process_metadata
(
FLAC__FileDecoder
*
decoder
);
FLAC__
bool
FLAC__file_decoder_process_one_frame
(
FLAC__FileDecoder
*
decoder
);
FLAC__
bool
FLAC__file_decoder_process_remaining_frames
(
FLAC__FileDecoder
*
decoder
);
bool
FLAC__file_decoder_seek_absolute
(
FLAC__FileDecoder
*
decoder
,
uint64
sample
);
FLAC__
bool
FLAC__file_decoder_seek_absolute
(
FLAC__FileDecoder
*
decoder
,
FLAC__
uint64
sample
);
#endif
include/FLAC/format.h
View file @
77e3f319
...
...
@@ -27,7 +27,7 @@
#define FLAC__MAX_BLOCK_SIZE (65535u)
#define FLAC__MAX_CHANNELS (8u)
#define FLAC__MIN_BITS_PER_SAMPLE (4u)
/*NOTE: only up to 24 because of the current predictor coefficient quantization and the fact we use int32s for all work */
/*NOTE: only up to 24 because of the current predictor coefficient quantization and the fact we use
FLAC__
int32s for all work */
#define FLAC__MAX_BITS_PER_SAMPLE (24u)
/* the following is ((2 ** 20) - 1) div 10 */
#define FLAC__MAX_SAMPLE_RATE (1048570u)
...
...
@@ -42,7 +42,7 @@
#define FLAC__VERSION_STRING VERSION
#endif
extern
const
byte
FLAC__STREAM_SYNC_STRING
[
4
];
/* = "fLaC" */
;
extern
const
FLAC__
byte
FLAC__STREAM_SYNC_STRING
[
4
];
/* = "fLaC" */
;
extern
const
unsigned
FLAC__STREAM_SYNC
;
/* = 0x664C6143 */
;
extern
const
unsigned
FLAC__STREAM_SYNC_LEN
;
/* = 32 bits */
;
...
...
@@ -115,7 +115,7 @@ extern const char *FLAC__SubframeTypeString[];
* n: constant value for signal; n = frame's bits-per-sample
*/
typedef
struct
{
int32
value
;
FLAC__
int32
value
;
}
FLAC__Subframe_Constant
;
/*****************************************************************************
...
...
@@ -123,7 +123,7 @@ typedef struct {
* n*i: unencoded signal; n = frame's bits-per-sample, i = frame's blocksize
*/
typedef
struct
{
const
int32
*
data
;
const
FLAC__
int32
*
data
;
}
FLAC__Subframe_Verbatim
;
/*****************************************************************************
...
...
@@ -136,8 +136,8 @@ typedef struct {
typedef
struct
{
FLAC__EntropyCodingMethod
entropy_coding_method
;
unsigned
order
;
int32
warmup
[
FLAC__MAX_FIXED_ORDER
];
const
int32
*
residual
;
FLAC__
int32
warmup
[
FLAC__MAX_FIXED_ORDER
];
const
FLAC__
int32
*
residual
;
}
FLAC__Subframe_Fixed
;
/*****************************************************************************
...
...
@@ -155,9 +155,9 @@ typedef struct {
unsigned
order
;
unsigned
qlp_coeff_precision
;
int
quantization_level
;
int32
qlp_coeff
[
FLAC__MAX_LPC_ORDER
];
int32
warmup
[
FLAC__MAX_LPC_ORDER
];
const
int32
*
residual
;
FLAC__
int32
qlp_coeff
[
FLAC__MAX_LPC_ORDER
];
FLAC__
int32
warmup
[
FLAC__MAX_LPC_ORDER
];
const
FLAC__
int32
*
residual
;
}
FLAC__Subframe_LPC
;
extern
const
unsigned
FLAC__SUBFRAME_LPC_QLP_COEFF_PRECISION_LEN
;
/* = 4 bits */
...
...
@@ -278,10 +278,10 @@ typedef struct {
FLAC__ChannelAssignment
channel_assignment
;
unsigned
bits_per_sample
;
union
{
uint32
frame_number
;
uint64
sample_number
;
FLAC__
uint32
frame_number
;
FLAC__
uint64
sample_number
;
}
number
;
uint8
crc
;
FLAC__
uint8
crc
;
}
FLAC__FrameHeader
;
extern
const
unsigned
FLAC__FRAME_HEADER_SYNC
;
/* = 0x3ffe */
...
...
@@ -299,7 +299,7 @@ extern const unsigned FLAC__FRAME_HEADER_CRC_LEN; /* = 8 bits */
* 16: CRC-16 (polynomial = x^16 + x^15 + x^2 + x^0, initialized with 0) of everything before the crc, back to and including the frame header sync code
*/
typedef
struct
{
uint16
crc
;
FLAC__
uint16
crc
;
}
FLAC__FrameFooter
;
extern
const
unsigned
FLAC__FRAME_FOOTER_CRC_LEN
;
/* = 16 bits */
...
...
@@ -347,8 +347,8 @@ typedef struct {
unsigned
sample_rate
;
unsigned
channels
;
unsigned
bits_per_sample
;
uint64
total_samples
;
byte
md5sum
[
16
];
FLAC__
uint64
total_samples
;
FLAC__
byte
md5sum
[
16
];
}
FLAC__StreamMetaData_StreamInfo
;
extern
const
unsigned
FLAC__STREAM_METADATA_STREAMINFO_MIN_BLOCK_SIZE_LEN
;
/* = 16 bits */
...
...
@@ -381,8 +381,8 @@ typedef struct {
* 4+n/8 bytes total
*/
typedef
struct
{
byte
id
[
4
];
byte
*
data
;
FLAC__
byte
id
[
4
];
FLAC__
byte
*
data
;
}
FLAC__StreamMetaData_Application
;
extern
const
unsigned
FLAC__STREAM_METADATA_APPLICATION_ID_LEN
;
/* = 32 bits */
...
...
@@ -396,8 +396,8 @@ extern const unsigned FLAC__STREAM_METADATA_APPLICATION_ID_LEN; /* = 32 bits */
* 18 bytes total
*/
typedef
struct
{
uint64
sample_number
;
uint64
stream_offset
;
FLAC__
uint64
sample_number
;
FLAC__
uint64
stream_offset
;
unsigned
frame_samples
;
}
FLAC__StreamMetaData_SeekPoint
;
...
...
@@ -406,7 +406,7 @@ extern const unsigned FLAC__STREAM_METADATA_SEEKPOINT_STREAM_OFFSET_LEN; /* = 64
extern
const
unsigned
FLAC__STREAM_METADATA_SEEKPOINT_FRAME_SAMPLES_LEN
;
/* = 16 bits */
extern
const
unsigned
FLAC__STREAM_METADATA_SEEKPOINT_LEN
;
/* = 18 bytes */
extern
const
uint64
FLAC__STREAM_METADATA_SEEKPOINT_PLACEHOLDER
;
/* = 0xffffffffffffffff */
extern
const
FLAC__
uint64
FLAC__STREAM_METADATA_SEEKPOINT_PLACEHOLDER
;
/* = 0xffffffffffffffff */
/*****************************************************************************
*
...
...
@@ -436,7 +436,7 @@ typedef struct {
*/
typedef
struct
{
FLAC__MetaDataType
type
;
bool
is_last
;
FLAC__
bool
is_last
;
unsigned
length
;
/* in bytes */
union
{
FLAC__StreamMetaData_StreamInfo
stream_info
;
...
...
include/FLAC/ordinals.h
View file @
77e3f319
...
...
@@ -20,64 +20,30 @@
#ifndef FLAC__ORDINALS_H
#define FLAC__ORDINALS_H
#ifdef bool
#undef bool
#endif
#ifdef true
#undef true
#endif
#ifdef false
#undef false
#endif
#ifdef int8
#undef int8
#endif
#ifdef uint8
#undef uint8
#endif
#ifdef int16
#undef int16
#endif
#ifdef uint16
#undef uint16
#endif
#ifdef int32
#undef int32
#endif
#ifdef uint32
#undef uint32
#endif
#ifdef int64
#undef int64
#endif
#ifdef uint64
#undef uint64
#endif
#ifdef byte
#undef byte
#endif
#ifdef real
#undef real
#endif
#define true 1
#define false 0
typedef
int
bool
;
typedef
signed
char
int8
;
typedef
unsigned
char
uint8
;
typedef
signed
short
int16
;
typedef
unsigned
short
uint16
;
typedef
signed
int
int32
;
typedef
unsigned
int
uint32
;
typedef
int
FLAC__
bool
;
typedef
signed
char
FLAC__
int8
;
typedef
unsigned
char
FLAC__
uint8
;
typedef
signed
short
FLAC__
int16
;
typedef
unsigned
short
FLAC__
uint16
;
typedef
signed
int
FLAC__
int32
;
typedef
unsigned
int
FLAC__
uint32
;
#if defined _WIN32 && !defined __CYGWIN__
typedef
__int64
int64
;
typedef
unsigned
__int64
uint64
;
typedef
__int64
FLAC__
int64
;
typedef
unsigned
__int64
FLAC__
uint64
;
#else
typedef
long
long
int
int64
;
typedef
unsigned
long
long
uint64
;
typedef
long
long
int
FLAC__
int64
;
typedef
unsigned
long
long
FLAC__
uint64
;
#endif
typedef
uint8
byte
;
typedef
float
real
;
typedef
FLAC__uint8
FLAC__
byte
;
typedef
float
FLAC__
real
;
#endif
include/FLAC/seek_table.h
View file @
77e3f319
...
...
@@ -22,6 +22,6 @@
#include "format.h"
bool
FLAC__seek_table_is_valid
(
const
FLAC__StreamMetaData_SeekTable
*
seek_table
);
FLAC__
bool
FLAC__seek_table_is_valid
(
const
FLAC__StreamMetaData_SeekTable
*
seek_table
);
#endif
include/FLAC/stream_decoder.h
View file @
77e3f319
...
...
@@ -113,11 +113,11 @@ void FLAC__stream_decoder_delete(FLAC__StreamDecoder *);
* FLAC__stream_decoder_flush() or FLAC__stream_decoder_reset() do
* NOT reset the values to the constructor defaults.
*/
bool
FLAC__stream_decoder_set_read_callback
(
const
FLAC__StreamDecoder
*
decoder
,
FLAC__StreamDecoderReadStatus
(
*
value
)(
const
FLAC__StreamDecoder
*
decoder
,
byte
buffer
[],
unsigned
*
bytes
,
void
*
client_data
));
bool
FLAC__stream_decoder_set_write_callback
(
const
FLAC__StreamDecoder
*
decoder
,
FLAC__StreamDecoderWriteStatus
(
*
value
)(
const
FLAC__StreamDecoder
*
decoder
,
const
FLAC__Frame
*
frame
,
const
int32
*
buffer
[],
void
*
client_data
));
bool
FLAC__stream_decoder_set_metadata_callback
(
const
FLAC__StreamDecoder
*
decoder
,
void
(
*
value
)(
const
FLAC__StreamDecoder
*
decoder
,
const
FLAC__StreamMetaData
*
metadata
,
void
*
client_data
));
bool
FLAC__stream_decoder_set_error_callback
(
const
FLAC__StreamDecoder
*
decoder
,
void
(
*
value
)(
const
FLAC__StreamDecoder
*
decoder
,
FLAC__StreamDecoderErrorStatus
status
,
void
*
client_data
));
bool
FLAC__stream_decoder_set_client_data
(
const
FLAC__StreamDecoder
*
decoder
,
void
*
value
);
FLAC__
bool
FLAC__stream_decoder_set_read_callback
(
const
FLAC__StreamDecoder
*
decoder
,
FLAC__StreamDecoderReadStatus
(
*
value
)(
const
FLAC__StreamDecoder
*
decoder
,
FLAC__
byte
buffer
[],
unsigned
*
bytes
,
void
*
client_data
));
FLAC__
bool
FLAC__stream_decoder_set_write_callback
(
const
FLAC__StreamDecoder
*
decoder
,
FLAC__StreamDecoderWriteStatus
(
*
value
)(
const
FLAC__StreamDecoder
*
decoder
,
const
FLAC__Frame
*
frame
,
const
FLAC__
int32
*
buffer
[],
void
*
client_data
));
FLAC__
bool
FLAC__stream_decoder_set_metadata_callback
(
const
FLAC__StreamDecoder
*
decoder
,
void
(
*
value
)(
const
FLAC__StreamDecoder
*
decoder
,
const
FLAC__StreamMetaData
*
metadata
,
void
*
client_data
));
FLAC__
bool
FLAC__stream_decoder_set_error_callback
(
const
FLAC__StreamDecoder
*
decoder
,
void
(
*
value
)(
const
FLAC__StreamDecoder
*
decoder
,
FLAC__StreamDecoderErrorStatus
status
,
void
*
client_data
));
FLAC__
bool
FLAC__stream_decoder_set_client_data
(
const
FLAC__StreamDecoder
*
decoder
,
void
*
value
);
/*
* Methods to return the current stream decoder state, number
...
...
@@ -150,15 +150,15 @@ void FLAC__stream_decoder_finish(FLAC__StreamDecoder *decoder);
/*
* state control methods
*/
bool
FLAC__stream_decoder_flush
(
FLAC__StreamDecoder
*
decoder
);
bool
FLAC__stream_decoder_reset
(
FLAC__StreamDecoder
*
decoder
);
FLAC__
bool
FLAC__stream_decoder_flush
(
FLAC__StreamDecoder
*
decoder
);
FLAC__
bool
FLAC__stream_decoder_reset
(
FLAC__StreamDecoder
*
decoder
);
/*
* Methods for decoding the data
*/
bool
FLAC__stream_decoder_process_whole_stream
(
FLAC__StreamDecoder
*
decoder
);
bool
FLAC__stream_decoder_process_metadata
(
FLAC__StreamDecoder
*
decoder
);
bool
FLAC__stream_decoder_process_one_frame
(
FLAC__StreamDecoder
*
decoder
);
bool
FLAC__stream_decoder_process_remaining_frames
(
FLAC__StreamDecoder
*
decoder
);
FLAC__
bool
FLAC__stream_decoder_process_whole_stream
(
FLAC__StreamDecoder
*
decoder
);
FLAC__
bool
FLAC__stream_decoder_process_metadata
(
FLAC__StreamDecoder
*
decoder
);
FLAC__
bool
FLAC__stream_decoder_process_one_frame
(
FLAC__StreamDecoder
*
decoder
);
FLAC__
bool
FLAC__stream_decoder_process_remaining_frames
(
FLAC__StreamDecoder
*
decoder
);
#endif
include/FLAC/stream_encoder.h
View file @
77e3f319
...
...
@@ -75,29 +75,29 @@ typedef struct {
* will take on the defaults from the constructor, shown below.
* For more on what the parameters mean, see the documentation.
*
* bool
streamable_subset (DEFAULT: true ) true to limit encoder to generating a Subset stream, else false
* bool
do_mid_side_stereo (DEFAULT: false) if true then channels must be 2
* bool
loose_mid_side_stereo (DEFAULT: false) if true then do_mid_side_stereo must be true
* unsigned channels (DEFAULT: 2 ) must be <= FLAC__MAX_CHANNELS
* unsigned bits_per_sample (DEFAULT: 16 ) do not give the encoder wider data than what you specify here or bad things will happen!
* unsigned sample_rate (DEFAULT: 44100)
* unsigned blocksize (DEFAULT: 1152 )
* unsigned max_lpc_order (DEFAULT: 0 ) 0 => encoder will not try general LPC, only fixed predictors; must be <= FLAC__MAX_LPC_ORDER
* unsigned qlp_coeff_precision (DEFAULT: 0 ) >= FLAC__MIN_QLP_COEFF_PRECISION, or 0 to let encoder select based on blocksize;
*
FLAC__
bool streamable_subset (DEFAULT: true ) true to limit encoder to generating a Subset stream, else false
*
FLAC__
bool do_mid_side_stereo (DEFAULT: false) if true then channels must be 2
*
FLAC__
bool loose_mid_side_stereo (DEFAULT: false) if true then do_mid_side_stereo must be true
* unsigned
channels (DEFAULT: 2 ) must be <= FLAC__MAX_CHANNELS
* unsigned
bits_per_sample (DEFAULT: 16 ) do not give the encoder wider data than what you specify here or bad things will happen!
* unsigned
sample_rate (DEFAULT: 44100)
* unsigned
blocksize (DEFAULT: 1152 )
* unsigned
max_lpc_order (DEFAULT: 0 ) 0 => encoder will not try general LPC, only fixed predictors; must be <= FLAC__MAX_LPC_ORDER
* unsigned
qlp_coeff_precision (DEFAULT: 0 ) >= FLAC__MIN_QLP_COEFF_PRECISION, or 0 to let encoder select based on blocksize;
* qlp_coeff_precision+bits_per_sample must be < 32
* bool
do_qlp_coeff_prec_search (DEFAULT: false) false => use qlp_coeff_precision, true => search around qlp_coeff_precision, take best
* bool
do_exhaustive_model_search (DEFAULT: false) false => use estimated bits per residual for scoring, true => generate all, take shortest
* unsigned min_residual_partition_order (DEFAULT: 0 ) 0 => estimate Rice parameter based on residual variance; >0 => partition residual, use parameter
* unsigned max_residual_partition_order (DEFAULT: 0 ) for each based on mean; min_ and max_ specify the min and max Rice partition order
* unsigned rice_parameter_search_dist (DEFAULT: 0 ) 0 => try only calc'd parameter k; else try all [k-dist..k+dist] parameters, use best
* uint64
total_samples_estimate (DEFAULT: 0 ) may be 0 if unknown. acts as a placeholder in the STREAMINFO until the actual total is calculated
*
FLAC__
bool do_qlp_coeff_prec_search (DEFAULT: false) false => use qlp_coeff_precision, true => search around qlp_coeff_precision, take best
*
FLAC__
bool do_exhaustive_model_search (DEFAULT: false) false => use estimated bits per residual for scoring, true => generate all, take shortest
* unsigned
min_residual_partition_order (DEFAULT: 0 ) 0 => estimate Rice parameter based on residual variance; >0 => partition residual, use parameter
* unsigned
max_residual_partition_order (DEFAULT: 0 ) for each based on mean; min_ and max_ specify the min and max Rice partition order
* unsigned
rice_parameter_search_dist (DEFAULT: 0 ) 0 => try only calc'd parameter k; else try all [k-dist..k+dist] parameters, use best
*
FLAC__
uint64 total_samples_estimate (DEFAULT: 0 ) may be 0 if unknown. acts as a placeholder in the STREAMINFO until the actual total is calculated
* const FLAC__StreamMetaData_SeekTable *seek_table (DEFAULT: NULL) optional seek_table to prepend, NULL => no seek table
* unsigned padding (DEFAULT: 0 ) size of PADDING block to add (goes after seek table); 0 => do not add a PADDING block
* bool
last_metadata_is_last (DEFAULT: true ) the value the encoder will use for the 'is_last' flag of the last metadata block it writes; set
* unsigned
padding (DEFAULT: 0 ) size of PADDING block to add (goes after seek table); 0 => do not add a PADDING block
*
FLAC__
bool last_metadata_is_last (DEFAULT: true ) the value the encoder will use for the 'is_last' flag of the last metadata block it writes; set
* this to false if you will be adding more metadata blocks before the audio frames, else true
* (*write_callback)() (DEFAULT: NULL ) The callbacks are the only values that MUST be set before FLAC__stream_encoder_init()
* (*metadata_callback)() (DEFAULT: NULL )
* void* client_data (DEFAULT: NULL ) passed back through the callbacks
*
(*write_callback)() (DEFAULT: NULL ) The callbacks are the only values that MUST be set before FLAC__stream_encoder_init()
*
(*metadata_callback)() (DEFAULT: NULL )
* void*
client_data (DEFAULT: NULL ) passed back through the callbacks
*/
FLAC__StreamEncoder
*
FLAC__stream_encoder_new
();
void
FLAC__stream_encoder_delete
(
FLAC__StreamEncoder
*
encoder
);
...
...
@@ -125,46 +125,46 @@ void FLAC__stream_encoder_delete(FLAC__StreamEncoder *encoder);
* FLAC__stream_encoder_finish() does NOT reset the values to the
* constructor defaults.
*/
bool
FLAC__stream_encoder_set_streamable_subset
(
const
FLAC__StreamEncoder
*
encoder
,
bool
value
);
bool
FLAC__stream_encoder_set_do_mid_side_stereo
(
const
FLAC__StreamEncoder
*
encoder
,
bool
value
);
bool
FLAC__stream_encoder_set_loose_mid_side_stereo
(
const
FLAC__StreamEncoder
*
encoder
,
bool
value
);
bool
FLAC__stream_encoder_set_channels
(
const
FLAC__StreamEncoder
*
encoder
,
unsigned
value
);
bool
FLAC__stream_encoder_set_bits_per_sample
(
const
FLAC__StreamEncoder
*
encoder
,
unsigned
value
);
bool
FLAC__stream_encoder_set_sample_rate
(
const
FLAC__StreamEncoder
*
encoder
,
unsigned
value
);
bool
FLAC__stream_encoder_set_blocksize
(
const
FLAC__StreamEncoder
*
encoder
,
unsigned
value
);
bool
FLAC__stream_encoder_set_max_lpc_order
(
const
FLAC__StreamEncoder
*
encoder
,
unsigned
value
);
bool
FLAC__stream_encoder_set_qlp_coeff_precision
(
const
FLAC__StreamEncoder
*
encoder
,
unsigned
value
);
bool
FLAC__stream_encoder_set_do_qlp_coeff_prec_search
(
const
FLAC__StreamEncoder
*
encoder
,
bool
value
);
bool
FLAC__stream_encoder_set_do_exhaustive_model_search
(
const
FLAC__StreamEncoder
*
encoder
,
bool
value
);
bool
FLAC__stream_encoder_set_min_residual_partition_order
(
const
FLAC__StreamEncoder
*
encoder
,
unsigned
value
);
bool
FLAC__stream_encoder_set_max_residual_partition_order
(
const
FLAC__StreamEncoder
*
encoder
,
unsigned
value
);
bool
FLAC__stream_encoder_set_rice_parameter_search_dist
(
const
FLAC__StreamEncoder
*
encoder
,
unsigned
value
);
bool
FLAC__stream_encoder_set_total_samples_estimate
(
const
FLAC__StreamEncoder
*
encoder
,
uint64
value
);
bool
FLAC__stream_encoder_set_seek_table
(
const
FLAC__StreamEncoder
*
encoder
,
const
FLAC__StreamMetaData_SeekTable
*
value
);
bool
FLAC__stream_encoder_set_padding
(
const
FLAC__StreamEncoder
*
encoder
,
unsigned
value
);
bool
FLAC__stream_encoder_set_last_metadata_is_last
(
const
FLAC__StreamEncoder
*
encoder
,
bool
value
);
bool
FLAC__stream_encoder_set_write_callback
(
const
FLAC__StreamEncoder
*
encoder
,
FLAC__StreamEncoderWriteStatus
(
*
value
)(
const
FLAC__StreamEncoder
*
encoder
,
const
byte
buffer
[],
unsigned
bytes
,
unsigned
samples
,
unsigned
current_frame
,
void
*
client_data
));
bool
FLAC__stream_encoder_set_metadata_callback
(
const
FLAC__StreamEncoder
*
encoder
,
void
(
*
value
)(
const
FLAC__StreamEncoder
*
encoder
,
const
FLAC__StreamMetaData
*
metadata
,
void
*
client_data
));
bool
FLAC__stream_encoder_set_client_data
(
const
FLAC__StreamEncoder
*
encoder
,
void
*
value
);
FLAC__
bool
FLAC__stream_encoder_set_streamable_subset
(
const
FLAC__StreamEncoder
*
encoder
,
FLAC__
bool
value
);
FLAC__
bool
FLAC__stream_encoder_set_do_mid_side_stereo
(
const
FLAC__StreamEncoder
*
encoder
,
FLAC__
bool
value
);
FLAC__
bool
FLAC__stream_encoder_set_loose_mid_side_stereo
(
const
FLAC__StreamEncoder
*
encoder
,
FLAC__
bool
value
);
FLAC__
bool
FLAC__stream_encoder_set_channels
(
const
FLAC__StreamEncoder
*
encoder
,
unsigned
value
);
FLAC__
bool
FLAC__stream_encoder_set_bits_per_sample
(
const
FLAC__StreamEncoder
*
encoder
,
unsigned
value
);
FLAC__
bool
FLAC__stream_encoder_set_sample_rate
(
const
FLAC__StreamEncoder
*
encoder
,
unsigned
value
);
FLAC__
bool
FLAC__stream_encoder_set_blocksize
(
const
FLAC__StreamEncoder
*
encoder
,
unsigned
value
);
FLAC__
bool
FLAC__stream_encoder_set_max_lpc_order
(
const
FLAC__StreamEncoder
*
encoder
,
unsigned
value
);
FLAC__
bool
FLAC__stream_encoder_set_qlp_coeff_precision
(
const
FLAC__StreamEncoder
*
encoder
,
unsigned
value
);
FLAC__
bool
FLAC__stream_encoder_set_do_qlp_coeff_prec_search
(
const
FLAC__StreamEncoder
*
encoder
,
FLAC__
bool
value
);
FLAC__
bool
FLAC__stream_encoder_set_do_exhaustive_model_search
(
const
FLAC__StreamEncoder
*
encoder
,
FLAC__
bool
value
);
FLAC__
bool
FLAC__stream_encoder_set_min_residual_partition_order
(
const
FLAC__StreamEncoder
*
encoder
,
unsigned
value
);
FLAC__
bool
FLAC__stream_encoder_set_max_residual_partition_order
(
const
FLAC__StreamEncoder
*
encoder
,
unsigned
value
);
FLAC__
bool
FLAC__stream_encoder_set_rice_parameter_search_dist
(
const
FLAC__StreamEncoder
*
encoder
,
unsigned
value
);
FLAC__
bool
FLAC__stream_encoder_set_total_samples_estimate
(
const
FLAC__StreamEncoder
*
encoder
,
FLAC__
uint64
value
);
FLAC__
bool
FLAC__stream_encoder_set_seek_table
(
const
FLAC__StreamEncoder
*
encoder
,
const
FLAC__StreamMetaData_SeekTable
*
value
);
FLAC__
bool
FLAC__stream_encoder_set_padding
(
const
FLAC__StreamEncoder
*
encoder
,
unsigned
value
);
FLAC__
bool
FLAC__stream_encoder_set_last_metadata_is_last
(
const
FLAC__StreamEncoder
*
encoder
,
FLAC__
bool
value
);
FLAC__
bool
FLAC__stream_encoder_set_write_callback
(
const
FLAC__StreamEncoder
*
encoder
,
FLAC__StreamEncoderWriteStatus
(
*
value
)(
const
FLAC__StreamEncoder
*
encoder
,
const
FLAC__
byte
buffer
[],
unsigned
bytes
,
unsigned
samples
,
unsigned
current_frame
,
void
*
client_data
));
FLAC__
bool
FLAC__stream_encoder_set_metadata_callback
(
const
FLAC__StreamEncoder
*
encoder
,
void
(
*
value
)(
const
FLAC__StreamEncoder
*
encoder
,
const
FLAC__StreamMetaData
*
metadata
,
void
*
client_data
));
FLAC__
bool
FLAC__stream_encoder_set_client_data
(
const
FLAC__StreamEncoder
*
encoder
,
void
*
value
);
/*
* Various "get" methods
*/
FLAC__StreamEncoderState
FLAC__stream_encoder_get_state
(
const
FLAC__StreamEncoder
*
encoder
);
bool
FLAC__stream_encoder_get_streamable_subset
(
const
FLAC__StreamEncoder
*
encoder
);
bool
FLAC__stream_encoder_get_do_mid_side_stereo
(
const
FLAC__StreamEncoder
*
encoder
);
bool
FLAC__stream_encoder_get_loose_mid_side_stereo
(
const
FLAC__StreamEncoder
*
encoder
);
unsigned
FLAC__stream_encoder_get_channels
(
const
FLAC__StreamEncoder
*
encoder
);
unsigned
FLAC__stream_encoder_get_bits_per_sample
(
const
FLAC__StreamEncoder
*
encoder
);
unsigned
FLAC__stream_encoder_get_sample_rate
(
const
FLAC__StreamEncoder
*
encoder
);
unsigned
FLAC__stream_encoder_get_blocksize
(
const
FLAC__StreamEncoder
*
encoder
);
unsigned
FLAC__stream_encoder_get_max_lpc_order
(
const
FLAC__StreamEncoder
*
encoder
);
unsigned
FLAC__stream_encoder_get_qlp_coeff_precision
(
const
FLAC__StreamEncoder
*
encoder
);
bool
FLAC__stream_encoder_get_do_qlp_coeff_prec_search
(
const
FLAC__StreamEncoder
*
encoder
);
bool
FLAC__stream_encoder_get_do_exhaustive_model_search
(
const
FLAC__StreamEncoder
*
encoder
);
unsigned
FLAC__stream_encoder_get_min_residual_partition_order
(
const
FLAC__StreamEncoder
*
encoder
);
unsigned
FLAC__stream_encoder_get_max_residual_partition_order
(
const
FLAC__StreamEncoder
*
encoder
);
unsigned
FLAC__stream_encoder_get_rice_parameter_search_dist
(
const
FLAC__StreamEncoder
*
encoder
);
FLAC__
bool
FLAC__stream_encoder_get_streamable_subset
(
const
FLAC__StreamEncoder
*
encoder
);
FLAC__
bool
FLAC__stream_encoder_get_do_mid_side_stereo
(
const
FLAC__StreamEncoder
*
encoder
);
FLAC__
bool
FLAC__stream_encoder_get_loose_mid_side_stereo
(
const
FLAC__StreamEncoder
*
encoder
);
unsigned
FLAC__stream_encoder_get_channels
(
const
FLAC__StreamEncoder
*
encoder
);
unsigned
FLAC__stream_encoder_get_bits_per_sample
(
const
FLAC__StreamEncoder
*
encoder
);
unsigned
FLAC__stream_encoder_get_sample_rate
(
const
FLAC__StreamEncoder
*
encoder
);
unsigned
FLAC__stream_encoder_get_blocksize
(
const
FLAC__StreamEncoder
*
encoder
);
unsigned
FLAC__stream_encoder_get_max_lpc_order
(
const
FLAC__StreamEncoder
*
encoder
);
unsigned
FLAC__stream_encoder_get_qlp_coeff_precision
(
const
FLAC__StreamEncoder
*
encoder
);
FLAC__
bool
FLAC__stream_encoder_get_do_qlp_coeff_prec_search
(
const
FLAC__StreamEncoder
*
encoder
);
FLAC__
bool
FLAC__stream_encoder_get_do_exhaustive_model_search
(
const
FLAC__StreamEncoder
*
encoder
);
unsigned
FLAC__stream_encoder_get_min_residual_partition_order
(
const
FLAC__StreamEncoder
*
encoder
);
unsigned
FLAC__stream_encoder_get_max_residual_partition_order
(
const
FLAC__StreamEncoder
*
encoder
);
unsigned
FLAC__stream_encoder_get_rice_parameter_search_dist
(
const
FLAC__StreamEncoder
*
encoder
);
/*
* Initialize the instance; should be called after construction and
...
...
@@ -184,7 +184,7 @@ void FLAC__stream_encoder_finish(FLAC__StreamEncoder *encoder);
/*
* Methods for encoding the data
*/
bool
FLAC__stream_encoder_process
(
FLAC__StreamEncoder
*
encoder
,
const
int32
*
buf
[],
unsigned
samples
);
bool
FLAC__stream_encoder_process_interleaved
(
FLAC__StreamEncoder
*
encoder
,
const
int32
buf
[],
unsigned
samples
);
FLAC__
bool
FLAC__stream_encoder_process
(
FLAC__StreamEncoder
*
encoder
,
const
FLAC__
int32
*
buf
[],
unsigned
samples
);
FLAC__
bool
FLAC__stream_encoder_process_interleaved
(
FLAC__StreamEncoder
*
encoder
,
const
FLAC__
int32
buf
[],
unsigned
samples
);
#endif
src/flac/analyze.c
View file @
77e3f319
...
...
@@ -24,7 +24,7 @@
#include "analyze.h"
typedef
struct
{
int32
residual
;
FLAC__
int32
residual
;
unsigned
count
;
}
pair_t
;
...
...
@@ -42,9 +42,9 @@ typedef struct {
static
subframe_stats_t
all_
;
static
void
init_stats
(
subframe_stats_t
*
stats
);
static
void
update_stats
(
subframe_stats_t
*
stats
,
int32
residual
,
unsigned
incr
);
static
void
update_stats
(
subframe_stats_t
*
stats
,
FLAC__
int32
residual
,
unsigned
incr
);
static
void
compute_stats
(
subframe_stats_t
*
stats
);
static
bool
dump_stats
(
const
subframe_stats_t
*
stats
,
const
char
*
filename
);
static
FLAC__
bool
dump_stats
(
const
subframe_stats_t
*
stats
,
const
char
*
filename
);
void
flac__analyze_init
(
analysis_options
aopts
)
{
...
...
@@ -147,7 +147,7 @@ void init_stats(subframe_stats_t *stats)
stats
->
sos
=
0
.
0
;
}
void
update_stats
(
subframe_stats_t
*
stats
,
int32
residual
,
unsigned
incr
)
void
update_stats
(
subframe_stats_t
*
stats
,
FLAC__
int32
residual
,
unsigned
incr
)
{
unsigned
i
;
const
double
r
=
(
double
)
residual
,
a
=
r
*
incr
;
...
...
@@ -179,7 +179,7 @@ void compute_stats(subframe_stats_t *stats)
stats
->
stddev
=
sqrt
(
stats
->
variance
);
}
bool
dump_stats
(
const
subframe_stats_t
*
stats
,
const
char
*
filename
)
FLAC__
bool
dump_stats
(
const
subframe_stats_t
*
stats
,
const
char
*
filename
)
{
FILE
*
outfile
;
unsigned
i
;
...
...
src/flac/analyze.h
View file @
77e3f319
...
...
@@ -20,8 +20,8 @@
#define flac__analyze_h
typedef
struct
{
bool
do_residual_text
;
bool
do_residual_gnuplot
;
FLAC__
bool
do_residual_text
;
FLAC__
bool
do_residual_gnuplot
;
}
analysis_options
;
void
flac__analyze_init
(
analysis_options
aopts
);
...
...
src/flac/decode.c
View file @
77e3f319
...
...
@@ -32,39 +32,39 @@
typedef
struct
{
const
char
*
inbasefilename
;
FILE
*
fout
;
bool
abort_flag
;
bool
analysis_mode
;
FLAC__
bool
abort_flag
;
FLAC__
bool
analysis_mode
;
analysis_options
aopts
;
bool
test_only
;
bool
is_wave_out
;
bool
is_big_endian
;
bool
is_unsigned_samples
;
uint64
total_samples
;
FLAC__
bool
test_only
;
FLAC__
bool
is_wave_out
;
FLAC__
bool
is_big_endian
;
FLAC__
bool
is_unsigned_samples
;
FLAC__
uint64
total_samples
;
unsigned
bps
;
unsigned
channels
;
unsigned
sample_rate
;
bool
verbose
;
uint64
skip
;
bool
skip_count_too_high
;
uint64
samples_processed
;
FLAC__
bool
verbose
;
FLAC__
uint64
skip
;
FLAC__
bool
skip_count_too_high
;
FLAC__
uint64
samples_processed
;
unsigned
frame_counter
;
}
stream_info_struct
;
static
FLAC__FileDecoder
*
decoder
;
static
bool
is_big_endian_host
;
static
FLAC__
bool
is_big_endian_host
;
/* local routines */
static
bool
init
(
const
char
*
infilename
,
stream_info_struct
*
stream_info
);
static
bool
write_little_endian_uint16
(
FILE
*
f
,
uint16
val
);
static
bool
write_little_endian_uint32
(
FILE
*
f
,
uint32
val
);
static
FLAC__StreamDecoderWriteStatus
write_callback
(
const
FLAC__FileDecoder
*
decoder
,
const
FLAC__Frame
*
frame
,
const
int32
*
buffer
[],
void
*
client_data
);
static
FLAC__
bool
init
(
const
char
*
infilename
,
stream_info_struct
*
stream_info
);
static
FLAC__
bool
write_little_endian_uint16
(
FILE
*
f
,
FLAC__
uint16
val
);
static
FLAC__
bool
write_little_endian_uint32
(
FILE
*
f
,
FLAC__
uint32
val
);
static
FLAC__StreamDecoderWriteStatus
write_callback
(
const
FLAC__FileDecoder
*
decoder
,
const
FLAC__Frame
*
frame
,
const
FLAC__
int32
*
buffer
[],
void
*
client_data
);
static
void
metadata_callback
(
const
FLAC__FileDecoder
*
decoder
,
const
FLAC__StreamMetaData
*
metadata
,
void
*
client_data
);
static
void
error_callback
(
const
FLAC__FileDecoder
*
decoder
,
FLAC__StreamDecoderErrorStatus
status
,
void
*
client_data
);
static
void
print_stats
(
const
stream_info_struct
*
stream_info
);
int
flac__decode_wav
(
const
char
*
infile
,
const
char
*
outfile
,
bool
analysis_mode
,
analysis_options
aopts
,
bool
verbose
,
uint64
skip
)
int
flac__decode_wav
(
const
char
*
infile
,
const
char
*
outfile
,
FLAC__
bool
analysis_mode
,
analysis_options
aopts
,
FLAC__
bool
verbose
,
FLAC__
uint64
skip
)
{
bool
md5_failure
=
false
;
FLAC__
bool
md5_failure
=
false
;
stream_info_struct
stream_info
;
decoder
=
0
;
...
...
@@ -171,9 +171,9 @@ wav_abort_:
return
1
;
}
int
flac__decode_raw
(
const
char
*
infile
,
const
char
*
outfile
,
bool
analysis_mode
,
analysis_options
aopts
,
bool
verbose
,
uint64
skip
,
bool
is_big_endian
,
bool
is_unsigned_samples
)
int
flac__decode_raw
(
const
char
*
infile
,
const
char
*
outfile
,
FLAC__
bool
analysis_mode
,
analysis_options
aopts
,
FLAC__
bool
verbose
,
FLAC__
uint64
skip
,
FLAC__
bool
is_big_endian
,
FLAC__
bool
is_unsigned_samples
)
{
bool
md5_failure
=
false
;
FLAC__
bool
md5_failure
=
false
;
stream_info_struct
stream_info
;
decoder
=
0
;
...
...
@@ -282,11 +282,11 @@ raw_abort_:
return
1
;
}
bool
init
(
const
char
*
infilename
,
stream_info_struct
*
stream_info
)
FLAC__
bool
init
(
const
char
*
infilename
,
stream_info_struct
*
stream_info
)
{
uint32
test
=
1
;
FLAC__
uint32
test
=
1
;
is_big_endian_host
=
(
*
((
byte
*
)(
&
test
)))
?
false
:
true
;
is_big_endian_host
=
(
*
((
FLAC__
byte
*
)(
&
test
)))
?
false
:
true
;
decoder
=
FLAC__file_decoder_new
();
if
(
0
==
decoder
)
{
...
...
@@ -309,42 +309,42 @@ bool init(const char *infilename, stream_info_struct *stream_info)
return
true
;
}
bool
write_little_endian_uint16
(
FILE
*
f
,
uint16
val
)
FLAC__
bool
write_little_endian_uint16
(
FILE
*
f
,
FLAC__
uint16
val
)