mirror of
https://github.com/claunia/flac.git
synced 2025-12-16 18:54:26 +00:00
revamp encoder/decoder interface to use set methods instead on args to init
This commit is contained in:
@@ -33,6 +33,7 @@ typedef enum {
|
||||
FLAC__FILE_DECODER_MD5_ERROR,
|
||||
FLAC__FILE_DECODER_STREAM_DECODER_ERROR,
|
||||
FLAC__FILE_DECODER_ALREADY_INITIALIZED,
|
||||
FLAC__FILE_DECODER_INVALID_CALLBACK,
|
||||
FLAC__FILE_DECODER_UNINITIALIZED
|
||||
} FLAC__FileDecoderState;
|
||||
extern const char *FLAC__FileDecoderStateString[];
|
||||
@@ -56,6 +57,17 @@ typedef struct {
|
||||
*
|
||||
***********************************************************************/
|
||||
|
||||
/*
|
||||
* Any parameters that are not set before FLAC__file_decoder_init()
|
||||
* 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__FileDecoder *FLAC__file_decoder_new();
|
||||
void FLAC__file_decoder_delete(FLAC__FileDecoder *);
|
||||
|
||||
@@ -66,34 +78,53 @@ void FLAC__file_decoder_delete(FLAC__FileDecoder *);
|
||||
***********************************************************************/
|
||||
|
||||
/*
|
||||
* Initialize the instance; should be called after construction and
|
||||
* before any other calls. Will set and return the decoder state,
|
||||
* which will be FLAC__FILE_DECODER_OK if initialization succeeded.
|
||||
* Various "set" methods. These may only be called when the decoder
|
||||
* is in the state FLAC__FILE_DECODER_UNINITIALIZED, i.e. after
|
||||
* FLAC__file_decoder_new() or FLAC__file_decoder_finish(), but
|
||||
* before FLAC__file_decoder_init(). If this is the case they will
|
||||
* return true, otherwise false.
|
||||
*
|
||||
* NOTE that these functions do not validate the values as many are
|
||||
* interdependent. The FLAC__file_decoder_init() function will do
|
||||
* this, so make sure to pay attention to the state returned by
|
||||
* FLAC__file_decoder_init().
|
||||
*
|
||||
* Any parameters that are not set before FLAC__file_decoder_init()
|
||||
* will take on the defaults from the constructor. NOTE that
|
||||
* FLAC__file_decoder_flush() or FLAC__file_decoder_reset() do
|
||||
* NOT reset the values to the constructor defaults.
|
||||
*/
|
||||
FLAC__FileDecoderState FLAC__file_decoder_init(
|
||||
FLAC__FileDecoder *decoder,
|
||||
bool check_md5,
|
||||
const char *filename,
|
||||
FLAC__StreamDecoderWriteStatus (*write_callback)(const FLAC__FileDecoder *decoder, const FLAC__Frame *frame, const int32 *buffer[], void *client_data),
|
||||
void (*metadata_callback)(const FLAC__FileDecoder *decoder, const FLAC__StreamMetaData *metadata, void *client_data),
|
||||
void (*error_callback)(const FLAC__FileDecoder *decoder, FLAC__StreamDecoderErrorStatus status, void *client_data),
|
||||
void *client_data
|
||||
);
|
||||
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);
|
||||
|
||||
/*
|
||||
* only returns false if check_md5 is set AND the stored MD5 sum
|
||||
* is non-zero AND the stored MD5 sum and computed MD5 sum do not
|
||||
* match
|
||||
* 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);
|
||||
|
||||
/*
|
||||
* Initialize the instance; should be called after construction and
|
||||
* 'set' calls but before any of the 'process' or 'seek' calls. Will
|
||||
* set and return the decoder state, which will be FLAC__FILE_DECODER_OK
|
||||
* if initializationsucceeded.
|
||||
*/
|
||||
FLAC__FileDecoderState FLAC__file_decoder_init(FLAC__FileDecoder *decoder);
|
||||
|
||||
/*
|
||||
* Flush the decoding buffer, release resources, and return the decoder
|
||||
* state to FLAC__FILE_DECODER_UNINITIALIZED. Only returns false if
|
||||
* 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);
|
||||
|
||||
/*
|
||||
* methods to return the file decoder state and check_md5 flag
|
||||
*/
|
||||
FLAC__FileDecoderState FLAC__file_decoder_state(const FLAC__FileDecoder *decoder);
|
||||
bool FLAC__file_decoder_check_md5(const FLAC__FileDecoder *decoder);
|
||||
|
||||
/*
|
||||
* methods for decoding the data
|
||||
* Methods for decoding the data
|
||||
*/
|
||||
bool FLAC__file_decoder_process_whole_file(FLAC__FileDecoder *decoder);
|
||||
bool FLAC__file_decoder_process_metadata(FLAC__FileDecoder *decoder);
|
||||
|
||||
@@ -32,6 +32,7 @@ typedef enum {
|
||||
FLAC__STREAM_DECODER_UNPARSEABLE_STREAM,
|
||||
FLAC__STREAM_DECODER_MEMORY_ALLOCATION_ERROR,
|
||||
FLAC__STREAM_DECODER_ALREADY_INITIALIZED,
|
||||
FLAC__STREAM_DECODER_INVALID_CALLBACK,
|
||||
FLAC__STREAM_DECODER_UNINITIALIZED
|
||||
} FLAC__StreamDecoderState;
|
||||
extern const char *FLAC__StreamDecoderStateString[];
|
||||
@@ -75,6 +76,17 @@ typedef struct {
|
||||
*
|
||||
***********************************************************************/
|
||||
|
||||
/*
|
||||
* Any parameters that are not set before FLAC__stream_decoder_init()
|
||||
* will take on the defaults from the constructor, shown below.
|
||||
* For more on what the parameters mean, see the documentation.
|
||||
*
|
||||
* (*read_callback)() (DEFAULT: NULL ) The callbacks are the only values that MUST be set before FLAC__stream_decoder_init()
|
||||
* (*write_callback)() (DEFAULT: NULL )
|
||||
* (*metadata_callback)() (DEFAULT: NULL )
|
||||
* (*error_callback)() (DEFAULT: NULL )
|
||||
* void* client_data (DEFAULT: NULL ) passed back through the callbacks
|
||||
*/
|
||||
FLAC__StreamDecoder *FLAC__stream_decoder_new();
|
||||
void FLAC__stream_decoder_delete(FLAC__StreamDecoder *);
|
||||
|
||||
@@ -85,32 +97,55 @@ void FLAC__stream_decoder_delete(FLAC__StreamDecoder *);
|
||||
***********************************************************************/
|
||||
|
||||
/*
|
||||
* Initialize the instance; should be called after construction and
|
||||
* before any other calls. Will set and return the decoder state which
|
||||
* will be FLAC__STREAM_DECODER_SEARCH_FOR_METADATA if initialization
|
||||
* succeeded.
|
||||
* Various "set" methods. These may only be called when the decoder
|
||||
* is in the state FLAC__STREAM_DECODER_UNINITIALIZED, i.e. after
|
||||
* FLAC__stream_decoder_new() or FLAC__stream_decoder_finish(), but
|
||||
* before FLAC__stream_decoder_init(). If this is the case they will
|
||||
* return true, otherwise false.
|
||||
*
|
||||
* NOTE that these functions do not validate the values as many are
|
||||
* interdependent. The FLAC__stream_decoder_init() function will do
|
||||
* this, so make sure to pay attention to the state returned by
|
||||
* FLAC__stream_decoder_init().
|
||||
*
|
||||
* Any parameters that are not set before FLAC__stream_decoder_init()
|
||||
* will take on the defaults from the constructor. NOTE that
|
||||
* FLAC__stream_decoder_flush() or FLAC__stream_decoder_reset() do
|
||||
* NOT reset the values to the constructor defaults.
|
||||
*/
|
||||
FLAC__StreamDecoderState FLAC__stream_decoder_init(
|
||||
FLAC__StreamDecoder *decoder,
|
||||
FLAC__StreamDecoderReadStatus (*read_callback)(const FLAC__StreamDecoder *decoder, byte buffer[], unsigned *bytes, void *client_data),
|
||||
FLAC__StreamDecoderWriteStatus (*write_callback)(const FLAC__StreamDecoder *decoder, const FLAC__Frame *frame, const int32 *buffer[], void *client_data),
|
||||
void (*metadata_callback)(const FLAC__StreamDecoder *decoder, const FLAC__StreamMetaData *metadata, void *client_data),
|
||||
void (*error_callback)(const FLAC__StreamDecoder *decoder, FLAC__StreamDecoderErrorStatus status, void *client_data),
|
||||
void *client_data
|
||||
);
|
||||
void FLAC__stream_decoder_finish(FLAC__StreamDecoder *decoder);
|
||||
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);
|
||||
|
||||
/*
|
||||
* methods to return the stream decoder state, number of channels,
|
||||
* channel assignment, bits-per-sample, sample rate in Hz, and
|
||||
* blocksize in samples.
|
||||
* Methods to return the current stream decoder state, number
|
||||
* of channels, channel assignment, bits-per-sample, sample
|
||||
* rate in Hz, and blocksize in samples. All but the decoder
|
||||
* state will only be valid after decoding has started.
|
||||
*/
|
||||
FLAC__StreamDecoderState FLAC__stream_decoder_state(const FLAC__StreamDecoder *decoder);
|
||||
unsigned FLAC__stream_decoder_channels(const FLAC__StreamDecoder *decoder);
|
||||
FLAC__ChannelAssignment FLAC__stream_decoder_channel_assignment(const FLAC__StreamDecoder *decoder);
|
||||
unsigned FLAC__stream_decoder_bits_per_sample(const FLAC__StreamDecoder *decoder);
|
||||
unsigned FLAC__stream_decoder_sample_rate(const FLAC__StreamDecoder *decoder);
|
||||
unsigned FLAC__stream_decoder_blocksize(const FLAC__StreamDecoder *decoder);
|
||||
FLAC__StreamDecoderState FLAC__stream_decoder_get_state(const FLAC__StreamDecoder *decoder);
|
||||
unsigned FLAC__stream_decoder_get_channels(const FLAC__StreamDecoder *decoder);
|
||||
FLAC__ChannelAssignment FLAC__stream_decoder_get_channel_assignment(const FLAC__StreamDecoder *decoder);
|
||||
unsigned FLAC__stream_decoder_get_bits_per_sample(const FLAC__StreamDecoder *decoder);
|
||||
unsigned FLAC__stream_decoder_get_sample_rate(const FLAC__StreamDecoder *decoder);
|
||||
unsigned FLAC__stream_decoder_get_blocksize(const FLAC__StreamDecoder *decoder);
|
||||
|
||||
/*
|
||||
* Initialize the instance; should be called after construction and
|
||||
* 'set' calls but before any of the 'process' calls. Will set and
|
||||
* return the decoder state, which will be
|
||||
* FLAC__STREAM_DECODER_SEARCH_FOR_METADATA if initialization
|
||||
* succeeded.
|
||||
*/
|
||||
FLAC__StreamDecoderState FLAC__stream_decoder_init(FLAC__StreamDecoder *decoder);
|
||||
|
||||
/*
|
||||
* Flush the decoding buffer, release resources, and return the decoder
|
||||
* state to FLAC__STREAM_DECODER_UNINITIALIZED.
|
||||
*/
|
||||
void FLAC__stream_decoder_finish(FLAC__StreamDecoder *decoder);
|
||||
|
||||
/*
|
||||
* state control methods
|
||||
@@ -119,7 +154,7 @@ bool FLAC__stream_decoder_flush(FLAC__StreamDecoder *decoder);
|
||||
bool FLAC__stream_decoder_reset(FLAC__StreamDecoder *decoder);
|
||||
|
||||
/*
|
||||
* methods for decoding the data
|
||||
* Methods for decoding the data
|
||||
*/
|
||||
bool FLAC__stream_decoder_process_whole_stream(FLAC__StreamDecoder *decoder);
|
||||
bool FLAC__stream_decoder_process_metadata(FLAC__StreamDecoder *decoder);
|
||||
|
||||
@@ -24,6 +24,7 @@
|
||||
|
||||
typedef enum {
|
||||
FLAC__STREAM_ENCODER_OK = 0,
|
||||
FLAC__STREAM_ENCODER_INVALID_CALLBACK,
|
||||
FLAC__STREAM_ENCODER_INVALID_NUMBER_OF_CHANNELS,
|
||||
FLAC__STREAM_ENCODER_INVALID_BITS_PER_SAMPLE,
|
||||
FLAC__STREAM_ENCODER_INVALID_SAMPLE_RATE,
|
||||
@@ -69,6 +70,35 @@ typedef struct {
|
||||
*
|
||||
***********************************************************************/
|
||||
|
||||
/*
|
||||
* Any parameters that are not set before FLAC__stream_encoder_init()
|
||||
* 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;
|
||||
* 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
|
||||
* 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
|
||||
* 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
|
||||
*/
|
||||
FLAC__StreamEncoder *FLAC__stream_encoder_new();
|
||||
void FLAC__stream_encoder_delete(FLAC__StreamEncoder *encoder);
|
||||
|
||||
@@ -79,59 +109,80 @@ void FLAC__stream_encoder_delete(FLAC__StreamEncoder *encoder);
|
||||
***********************************************************************/
|
||||
|
||||
/*
|
||||
* Initialize the instance; should be called after construction and
|
||||
* before any other calls. Will set and return the encoder state,
|
||||
* which will be FLAC__STREAM_ENCODER_OK if initialization succeeded.
|
||||
* Various "set" methods. These may only be called when the encoder
|
||||
* is in the state FLAC__STREAM_ENCODER_UNINITIALIZED, i.e. after
|
||||
* FLAC__stream_encoder_new() or FLAC__stream_encoder_finish(), but
|
||||
* before FLAC__stream_encoder_init(). If this is the case they will
|
||||
* return true, otherwise false.
|
||||
*
|
||||
* NOTE that these functions do not validate the values as many are
|
||||
* interdependent. The FLAC__stream_encoder_init() function will do
|
||||
* this, so make sure to pay attention to the state returned by
|
||||
* FLAC__stream_encoder_init().
|
||||
*
|
||||
* Any parameters that are not set before FLAC__stream_encoder_init()
|
||||
* will take on the defaults from the constructor. NOTE that
|
||||
* 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);
|
||||
|
||||
/*
|
||||
* 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);
|
||||
|
||||
/*
|
||||
* Initialize the instance; should be called after construction and
|
||||
* 'set' calls but before any of the 'process' calls. Will set and
|
||||
* return the encoder state, which will be FLAC__STREAM_ENCODER_OK
|
||||
* if initialization succeeded.
|
||||
*/
|
||||
FLAC__StreamEncoderState FLAC__stream_encoder_init(FLAC__StreamEncoder *encoder);
|
||||
|
||||
/*
|
||||
* Flush the encoding buffer, release resources, and return the encoder
|
||||
* state to FLAC__STREAM_ENCODER_UNINITIALIZED. Note that this can
|
||||
* generate one or more write_callback()s before returning.
|
||||
*/
|
||||
FLAC__StreamEncoderState FLAC__stream_encoder_init(
|
||||
FLAC__StreamEncoder *encoder,
|
||||
bool streamable_subset,
|
||||
bool do_mid_side_stereo, /* 0 or 1; 1 only if channels==2 */
|
||||
bool loose_mid_side_stereo, /* 0 or 1; 1 only if channels==2 and do_mid_side_stereo==true */
|
||||
unsigned channels, /* must be <= FLAC__MAX_CHANNELS */
|
||||
unsigned bits_per_sample, /* do not give the encoder wider data than what you specify here or bad things will happen! */
|
||||
unsigned sample_rate,
|
||||
unsigned blocksize,
|
||||
unsigned max_lpc_order, /* 0 => encoder will not try general LPC, only fixed predictors; must be <= FLAC__MAX_LPC_ORDER */
|
||||
unsigned qlp_coeff_precision, /* >= 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, /* 0 => use qlp_coeff_precision, 1 => search around qlp_coeff_precision, take best */
|
||||
bool do_exhaustive_model_search, /* 0 => use estimated bits per residual for scoring, 1 => generate all, take shortest */
|
||||
unsigned min_residual_partition_order, /* 0 => estimate Rice parameter based on residual variance; >0 => partition residual, use parameter for each */
|
||||
unsigned max_residual_partition_order, /* based on mean; min_ and max_ specify the min and max Rice partition order */
|
||||
unsigned rice_parameter_search_dist, /* 0 => try only calc'd parameter k; else try all [k-dist..k+dist] parameters, use best */
|
||||
uint64 total_samples_estimate, /* may be 0 if unknown. this will be a placeholder in the metadata block until the actual total is calculated */
|
||||
const FLAC__StreamMetaData_SeekTable *seek_table, /* optional seek_table to prepend, 0 => no seek table */
|
||||
unsigned padding, /* size of PADDING block to add (goes after seek table); 0 => do not add a PADDING block */
|
||||
bool last_metadata_is_last, /* 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 */
|
||||
FLAC__StreamEncoderWriteStatus (*write_callback)(const FLAC__StreamEncoder *encoder, const byte buffer[], unsigned bytes, unsigned samples, unsigned current_frame, void *client_data),
|
||||
void (*metadata_callback)(const FLAC__StreamEncoder *encoder, const FLAC__StreamMetaData *metadata, void *client_data),
|
||||
void *client_data
|
||||
);
|
||||
void FLAC__stream_encoder_finish(FLAC__StreamEncoder *encoder);
|
||||
|
||||
/*
|
||||
* various "get" methods
|
||||
*/
|
||||
FLAC__StreamEncoderState FLAC__stream_encoder_state(const FLAC__StreamEncoder *encoder);
|
||||
bool FLAC__stream_encoder_streamable_subset(const FLAC__StreamEncoder *encoder);
|
||||
bool FLAC__stream_encoder_do_mid_side_stereo(const FLAC__StreamEncoder *encoder);
|
||||
bool FLAC__stream_encoder_loose_mid_side_stereo(const FLAC__StreamEncoder *encoder);
|
||||
unsigned FLAC__stream_encoder_channels(const FLAC__StreamEncoder *encoder);
|
||||
unsigned FLAC__stream_encoder_bits_per_sample(const FLAC__StreamEncoder *encoder);
|
||||
unsigned FLAC__stream_encoder_sample_rate(const FLAC__StreamEncoder *encoder);
|
||||
unsigned FLAC__stream_encoder_blocksize(const FLAC__StreamEncoder *encoder);
|
||||
unsigned FLAC__stream_encoder_max_lpc_order(const FLAC__StreamEncoder *encoder);
|
||||
unsigned FLAC__stream_encoder_qlp_coeff_precision(const FLAC__StreamEncoder *encoder);
|
||||
bool FLAC__stream_encoder_do_qlp_coeff_prec_search(const FLAC__StreamEncoder *encoder);
|
||||
bool FLAC__stream_encoder_do_exhaustive_model_search(const FLAC__StreamEncoder *encoder);
|
||||
unsigned FLAC__stream_encoder_min_residual_partition_order(const FLAC__StreamEncoder *encoder);
|
||||
unsigned FLAC__stream_encoder_max_residual_partition_order(const FLAC__StreamEncoder *encoder);
|
||||
unsigned FLAC__stream_encoder_rice_parameter_search_dist(const FLAC__StreamEncoder *encoder);
|
||||
|
||||
/*
|
||||
* methods for encoding the data
|
||||
* 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);
|
||||
|
||||
Reference in New Issue
Block a user