📄 stream_encoder.h
字号:
* \c false if the encoder is already initialized, else \c true. */FLAC_API FLAC__bool FLAC__stream_encoder_set_write_callback(FLAC__StreamEncoder *encoder, FLAC__StreamEncoderWriteCallback value);/** Set the metadata callback. * The supplied function will be called once at the end of encoding with * the populated STREAMINFO structure. This is so file encoders can seek * back to the beginning of the file and write the STREAMINFO block with * the correct statistics after encoding (like minimum/maximum frame size * and total samples). * * \note * The callback is mandatory and must be set before initialization. * * \default \c NULL * \param encoder An encoder instance to set. * \param value See above. * \assert * \code encoder != NULL \endcode * \code value != NULL \endcode * \retval FLAC__bool * \c false if the encoder is already initialized, else \c true. */FLAC_API FLAC__bool FLAC__stream_encoder_set_metadata_callback(FLAC__StreamEncoder *encoder, FLAC__StreamEncoderMetadataCallback value);/** Set the client data to be passed back to callbacks. * This value will be supplied to callbacks in their \a client_data * argument. * * \default \c NULL * \param encoder An encoder instance to set. * \param 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_client_data(FLAC__StreamEncoder *encoder, void *value);/** Get the current encoder state. * * \param encoder An encoder instance to query. * \assert * \code encoder != NULL \endcode * \retval FLAC__StreamEncoderState * The current encoder state. */FLAC_API FLAC__StreamEncoderState FLAC__stream_encoder_get_state(const FLAC__StreamEncoder *encoder);/** Get the state of the verify stream decoder. * Useful when the stream encoder state is * \c FLAC__STREAM_ENCODER_VERIFY_DECODER_ERROR. * * \param encoder An encoder instance to query. * \assert * \code encoder != NULL \endcode * \retval FLAC__StreamDecoderState * The verify stream decoder state. */FLAC_API FLAC__StreamDecoderState FLAC__stream_encoder_get_verify_decoder_state(const FLAC__StreamEncoder *encoder);/** Get the current encoder state as a C string. * This version automatically resolves * \c FLAC__STREAM_ENCODER_VERIFY_DECODER_ERROR by getting the * verify decoder's state. * * \param encoder A encoder instance to query. * \assert * \code encoder != NULL \endcode * \retval const char * * The encoder state as a C string. Do not modify the contents. */FLAC_API const char *FLAC__stream_encoder_get_resolved_state_string(const FLAC__StreamEncoder *encoder);/** Get relevant values about the nature of a verify decoder error. * Useful when the stream encoder state is * \c FLAC__STREAM_ENCODER_VERIFY_DECODER_ERROR. The arguments should * be addresses in which the stats will be returned, or NULL if value * is not desired. * * \param encoder An encoder instance to query. * \param absolute_sample The absolute sample number of the mismatch. * \param frame_number The number of the frame in which the mismatch occurred. * \param channel The channel in which the mismatch occurred. * \param sample The number of the sample (relative to the frame) in * which the mismatch occurred. * \param expected The expected value for the sample in question. * \param got The actual value returned by the decoder. * \assert * \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);/** Get the "verify" flag. * * \param encoder An encoder instance to query. * \assert * \code encoder != NULL \endcode * \retval FLAC__bool * See FLAC__stream_encoder_set_verify(). */FLAC_API FLAC__bool FLAC__stream_encoder_get_verify(const FLAC__StreamEncoder *encoder);/** Get the "streamable subset" flag. * * \param encoder An encoder instance to query. * \assert * \code encoder != NULL \endcode * \retval FLAC__bool * See FLAC__stream_encoder_set_streamable_subset(). */FLAC_API FLAC__bool FLAC__stream_encoder_get_streamable_subset(const FLAC__StreamEncoder *encoder);/** Get the "mid/side stereo coding" flag. * * \param encoder An encoder instance to query. * \assert * \code encoder != NULL \endcode * \retval FLAC__bool * See FLAC__stream_encoder_get_do_mid_side_stereo(). */FLAC_API FLAC__bool FLAC__stream_encoder_get_do_mid_side_stereo(const FLAC__StreamEncoder *encoder);/** Get the "adaptive mid/side switching" flag. * * \param encoder An encoder instance to query. * \assert * \code encoder != NULL \endcode * \retval FLAC__bool * See FLAC__stream_encoder_set_loose_mid_side_stereo(). */FLAC_API FLAC__bool FLAC__stream_encoder_get_loose_mid_side_stereo(const FLAC__StreamEncoder *encoder);/** Get the number of input channels being processed. * * \param encoder An encoder instance to query. * \assert * \code encoder != NULL \endcode * \retval unsigned * See FLAC__stream_encoder_set_channels(). */FLAC_API unsigned FLAC__stream_encoder_get_channels(const FLAC__StreamEncoder *encoder);/** Get the input sample resolution setting. * * \param encoder An encoder instance to query. * \assert * \code encoder != NULL \endcode * \retval unsigned * See FLAC__stream_encoder_set_bits_per_sample(). */FLAC_API unsigned FLAC__stream_encoder_get_bits_per_sample(const FLAC__StreamEncoder *encoder);/** Get the input sample rate setting. * * \param encoder An encoder instance to query. * \assert * \code encoder != NULL \endcode * \retval unsigned * See FLAC__stream_encoder_set_sample_rate(). */FLAC_API unsigned FLAC__stream_encoder_get_sample_rate(const FLAC__StreamEncoder *encoder);/** Get the blocksize setting. * * \param encoder An encoder instance to query. * \assert * \code encoder != NULL \endcode * \retval unsigned * See FLAC__stream_encoder_set_blocksize(). */FLAC_API unsigned FLAC__stream_encoder_get_blocksize(const FLAC__StreamEncoder *encoder);/** Get the maximum LPC order setting. * * \param encoder An encoder instance to query. * \assert * \code encoder != NULL \endcode * \retval unsigned * See FLAC__stream_encoder_set_max_lpc_order(). */FLAC_API unsigned FLAC__stream_encoder_get_max_lpc_order(const FLAC__StreamEncoder *encoder);/** Get the quantized linear predictor coefficient precision setting. * * \param encoder An encoder instance to query. * \assert * \code encoder != NULL \endcode * \retval unsigned * See FLAC__stream_encoder_set_qlp_coeff_precision(). */FLAC_API unsigned FLAC__stream_encoder_get_qlp_coeff_precision(const FLAC__StreamEncoder *encoder);/** Get the qlp coefficient precision search flag. * * \param encoder An encoder instance to query. * \assert * \code encoder != NULL \endcode * \retval FLAC__bool * See FLAC__stream_encoder_set_do_qlp_coeff_prec_search(). */FLAC_API FLAC__bool FLAC__stream_encoder_get_do_qlp_coeff_prec_search(const FLAC__StreamEncoder *encoder);/** Get the "escape coding" flag. * * \param encoder An encoder instance to query. * \assert * \code encoder != NULL \endcode * \retval FLAC__bool * See FLAC__stream_encoder_set_do_escape_coding(). */FLAC_API FLAC__bool FLAC__stream_encoder_get_do_escape_coding(const FLAC__StreamEncoder *encoder);/** Get the exhaustive model search flag. * * \param encoder An encoder instance to query. * \assert * \code encoder != NULL \endcode * \retval FLAC__bool * See FLAC__stream_encoder_set_do_exhaustive_model_search(). */FLAC_API FLAC__bool FLAC__stream_encoder_get_do_exhaustive_model_search(const FLAC__StreamEncoder *encoder);/** Get the minimum residual partition order setting. * * \param encoder An encoder instance to query. * \assert * \code encoder != NULL \endcode * \retval unsigned * See FLAC__stream_encoder_set_min_residual_partition_order(). */FLAC_API unsigned FLAC__stream_encoder_get_min_residual_partition_order(const FLAC__StreamEncoder *encoder);/** Get maximum residual partition order setting. * * \param encoder An encoder instance to query. * \assert * \code encoder != NULL \endcode * \retval unsigned * See FLAC__stream_encoder_set_max_residual_partition_order(). */FLAC_API unsigned FLAC__stream_encoder_get_max_residual_partition_order(const FLAC__StreamEncoder *encoder);/** Get the Rice parameter search distance setting. * * \param encoder An encoder instance to query. * \assert * \code encoder != NULL \endcode * \retval unsigned * See FLAC__stream_encoder_set_rice_parameter_search_dist(). */FLAC_API unsigned FLAC__stream_encoder_get_rice_parameter_search_dist(const FLAC__StreamEncoder *encoder);/** Get the previously set estimate of the total samples to be encoded. * The encoder merely mimics back the value given to * FLAC__stream_encoder_set_total_samples_estimate() since it has no * other way of knowing how many samples the user will encode. * * \param encoder An encoder instance to set. * \assert * \code encoder != NULL \endcode * \retval FLAC__uint64 * See FLAC__stream_encoder_get_total_samples_estimate(). */FLAC_API FLAC__uint64 FLAC__stream_encoder_get_total_samples_estimate(const FLAC__StreamEncoder *encoder);/** Initialize the encoder instance. * Should be called after FLAC__stream_encoder_new() and * FLAC__stream_encoder_set_*() but before FLAC__stream_encoder_process() * or FLAC__stream_encoder_process_interleaved(). Will set and return * the encoder state, which will be FLAC__STREAM_ENCODER_OK if * initialization succeeded. * * The call to FLAC__stream_encoder_init() currently will also immediately * call the write callback several times, once with the \c fLaC signature, * and once for each encoded metadata block. * * \param encoder An uninitialized encoder instance. * \assert * \code encoder != NULL \endcode * \retval FLAC__StreamEncoderState * \c FLAC__STREAM_ENCODER_OK if initialization was successful; see * FLAC__StreamEncoderState for the meanings of other return values. */FLAC_API FLAC__StreamEncoderState FLAC__stream_encoder_init(FLAC__StreamEncoder *encoder);/** Finish the encoding process. * Flushes the encoding buffer, releases resources, resets the encoder * settings to their defaults, and returns the encoder state to * FLAC__STREAM_ENCODER_UNINITIALIZED. Note that this can generate * one or more write callbacks before returning, and will generate * a metadata callback. * * In the event of a prematurely-terminated encode, it is not strictly * necessary to call this immediately before FLAC__stream_encoder_delete() * but it is good practice to match every FLAC__stream_encoder_init() * with a FLAC__stream_encoder_finish(). * * \param encoder An uninitialized encoder instance. * \assert * \code encoder != NULL \endcode */FLAC_API void FLAC__stream_encoder_finish(FLAC__StreamEncoder *encoder);/** Submit data for encoding. * This version allows you to supply the input data via an array of * pointers, each pointer pointing to an array of \a samples samples * representing one channel. The samples need not be block-aligned, * but each channel should have the same number of samples. * * \param encoder An initialized encoder instance in the OK state. * \param buffer An array of pointers to each channel's signal. * \param samples The number of samples in one channel. * \assert * \code encoder != NULL \endcode * \code FLAC__stream_encoder_get_state(encoder) == FLAC__STREAM_ENCODER_OK \endcode * \retval FLAC__bool * \c true if successful, else \c false; in this case, check the * encoder state with FLAC__stream_encoder_get_state() to see what * went wrong. */FLAC_API FLAC__bool FLAC__stream_encoder_process(FLAC__StreamEncoder *encoder, const FLAC__int32 * const buffer[], unsigned samples);/** Submit data for encoding. * This version allows you to supply the input data where the channels * are interleaved into a single array (i.e. channel0_sample0, * channel1_sample0, ... , channelN_sample0, channel0_sample1, ...). * The samples need not be block-aligned but they must be * sample-aligned, i.e. the first value should be channel0_sample0 * and the last value channelN_sampleM. * * \param encoder An initialized encoder instance in the OK state. * \param buffer An array of channel-interleaved data (see above). * \param samples The number of samples in one channel, the same as for * FLAC__stream_encoder_process(). For example, if * encoding two channels, \c 1000 \a samples corresponds * to a \a buffer of 2000 values. * \assert * \code encoder != NULL \endcode * \code FLAC__stream_encoder_get_state(encoder) == FLAC__STREAM_ENCODER_OK \endcode * \retval FLAC__bool * \c true if successful, else \c false; in this case, check the * encoder state with FLAC__stream_encoder_get_state() to see what * went wrong. */FLAC_API FLAC__bool FLAC__stream_encoder_process_interleaved(FLAC__StreamEncoder *encoder, const FLAC__int32 buffer[], unsigned samples);/* \} */#ifdef __cplusplus}#endif#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -