Main Page Modules Class Hierarchy Alphabetical List Compound List File List Compound Members File Members

# include/FLAC/stream_encoder.h

Go to the documentation of this file.

    00001 /* libFLAC - Free Lossless Audio Codec library
    00002  * Copyright (C) 2000,2001,2002,2003,2004,2005  Josh Coalson
    00003  *
    00004  * Redistribution and use in source and binary forms, with or without
    00005  * modification, are permitted provided that the following conditions
    00006  * are met:
    00007  *
    00008  * - Redistributions of source code must retain the above copyright
    00009  * notice, this list of conditions and the following disclaimer.
    00010  *
    00011  * - Redistributions in binary form must reproduce the above copyright
    00012  * notice, this list of conditions and the following disclaimer in the
    00013  * documentation and/or other materials provided with the distribution.
    00014  *
    00015  * - Neither the name of the Xiph.org Foundation nor the names of its
    00016  * contributors may be used to endorse or promote products derived from
    00017  * this software without specific prior written permission.
    00018  *
    00019  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
    00020  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
    00021  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
    00022  * A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR
    00023  * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
    00024  * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
    00025  * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
    00026  * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
    00027  * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
    00028  * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
    00029  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
    00030  */
    00031
    00032 #ifndef FLAC__STREAM_ENCODER_H
    00033 #define FLAC__STREAM_ENCODER_H
    00034
    00035 #include "export.h"
    00036 #include "format.h"
    00037 #include "stream_decoder.h"
    00038
    00039 #ifdef __cplusplus
    00040 extern "C" {
    00041 #endif
    00042
    00043
    00198 typedef enum {
    00199
    00200     FLAC__STREAM_ENCODER_OK = 0,
    00203     FLAC__STREAM_ENCODER_VERIFY_DECODER_ERROR,
    00208     FLAC__STREAM_ENCODER_VERIFY_MISMATCH_IN_AUDIO_DATA,
    00213     FLAC__STREAM_ENCODER_INVALID_CALLBACK,
    00216     FLAC__STREAM_ENCODER_INVALID_NUMBER_OF_CHANNELS,
    00219     FLAC__STREAM_ENCODER_INVALID_BITS_PER_SAMPLE,
    00225     FLAC__STREAM_ENCODER_INVALID_SAMPLE_RATE,
    00228     FLAC__STREAM_ENCODER_INVALID_BLOCK_SIZE,
    00231     FLAC__STREAM_ENCODER_INVALID_MAX_LPC_ORDER,
    00234     FLAC__STREAM_ENCODER_INVALID_QLP_COEFF_PRECISION,
    00237     FLAC__STREAM_ENCODER_MID_SIDE_CHANNELS_MISMATCH,
    00240     FLAC__STREAM_ENCODER_MID_SIDE_SAMPLE_SIZE_MISMATCH,
    00243     FLAC__STREAM_ENCODER_ILLEGAL_MID_SIDE_FORCE,
    00246     FLAC__STREAM_ENCODER_BLOCK_SIZE_TOO_SMALL_FOR_LPC_ORDER,
    00249     FLAC__STREAM_ENCODER_NOT_STREAMABLE,
    00252     FLAC__STREAM_ENCODER_FRAMING_ERROR,
    00255     FLAC__STREAM_ENCODER_INVALID_METADATA,
    00264     FLAC__STREAM_ENCODER_FATAL_ERROR_WHILE_ENCODING,
    00267     FLAC__STREAM_ENCODER_FATAL_ERROR_WHILE_WRITING,
    00270     FLAC__STREAM_ENCODER_MEMORY_ALLOCATION_ERROR,
    00273     FLAC__STREAM_ENCODER_ALREADY_INITIALIZED,
    00279     FLAC__STREAM_ENCODER_UNINITIALIZED
    00282 } FLAC__StreamEncoderState;
    00283
    00289 extern FLAC_API const char * const FLAC__StreamEncoderStateString[];
    00290
    00293 typedef enum {
    00294
    00295     FLAC__STREAM_ENCODER_WRITE_STATUS_OK = 0,
    00298     FLAC__STREAM_ENCODER_WRITE_STATUS_FATAL_ERROR
    00301 } FLAC__StreamEncoderWriteStatus;
    00302
    00308 extern FLAC_API const char * const FLAC__StreamEncoderWriteStatusString[];
    00309
    00310
    00311 /***********************************************************************
    00312  *
    00313  * class FLAC__StreamEncoder
    00314  *
    00315  ***********************************************************************/
    00316
    00317 struct FLAC__StreamEncoderProtected;
    00318 struct FLAC__StreamEncoderPrivate;
    00323 typedef struct {
    00324     struct FLAC__StreamEncoderProtected *protected_; /* avoid the C++ keyword 'protected' */
    00325     struct FLAC__StreamEncoderPrivate *private_; /* avoid the C++ keyword 'private' */
    00326 } FLAC__StreamEncoder;
    00327
    00343 typedef FLAC__StreamEncoderWriteStatus (*FLAC__StreamEncoderWriteCallback)(const FLAC__StreamEncoder *encoder, const FLAC__byte buffer[], unsigned bytes, unsigned samples, unsigned current_frame, void *client_data);
    00344
    00353 typedef void (*FLAC__StreamEncoderMetadataCallback)(const FLAC__StreamEncoder *encoder, const FLAC__StreamMetadata *metadata, void *client_data);
    00354
    00355
    00356 /***********************************************************************
    00357  *
    00358  * Class constructor/destructor
    00359  *
    00360  ***********************************************************************/
    00361
    00369 FLAC_API FLAC__StreamEncoder *FLAC__stream_encoder_new();
    00370
    00377 FLAC_API void FLAC__stream_encoder_delete(FLAC__StreamEncoder *encoder);
    00378
    00379
    00380 /***********************************************************************
    00381  *
    00382  * Public class method prototypes
    00383  *
    00384  ***********************************************************************/
    00385
    00400 FLAC_API FLAC__bool FLAC__stream_encoder_set_verify(FLAC__StreamEncoder *encoder, FLAC__bool value);
    00401
    00418 FLAC_API FLAC__bool FLAC__stream_encoder_set_streamable_subset(FLAC__StreamEncoder *encoder, FLAC__bool value);
    00419
    00432 FLAC_API FLAC__bool FLAC__stream_encoder_set_do_mid_side_stereo(FLAC__StreamEncoder *encoder, FLAC__bool value);
    00433
    00447 FLAC_API FLAC__bool FLAC__stream_encoder_set_loose_mid_side_stereo(FLAC__StreamEncoder *encoder, FLAC__bool value);
    00448
    00459 FLAC_API FLAC__bool FLAC__stream_encoder_set_channels(FLAC__StreamEncoder *encoder, unsigned value);
    00460
    00475 FLAC_API FLAC__bool FLAC__stream_encoder_set_bits_per_sample(FLAC__StreamEncoder *encoder, unsigned value);
    00476
    00487 FLAC_API FLAC__bool FLAC__stream_encoder_set_sample_rate(FLAC__StreamEncoder *encoder, unsigned value);
    00488
    00499 FLAC_API FLAC__bool FLAC__stream_encoder_set_blocksize(FLAC__StreamEncoder *encoder, unsigned value);
    00500
    00511 FLAC_API FLAC__bool FLAC__stream_encoder_set_max_lpc_order(FLAC__StreamEncoder *encoder, unsigned value);
    00512
    00529 FLAC_API FLAC__bool FLAC__stream_encoder_set_qlp_coeff_precision(FLAC__StreamEncoder *encoder, unsigned value);
    00530
    00543 FLAC_API FLAC__bool FLAC__stream_encoder_set_do_qlp_coeff_prec_search(FLAC__StreamEncoder *encoder, FLAC__bool value);
    00544
    00555 FLAC_API FLAC__bool FLAC__stream_encoder_set_do_escape_coding(FLAC__StreamEncoder *encoder, FLAC__bool value);
    00556
    00569 FLAC_API FLAC__bool FLAC__stream_encoder_set_do_exhaustive_model_search(FLAC__StreamEncoder *encoder, FLAC__bool value);
    00570
    00592 FLAC_API FLAC__bool FLAC__stream_encoder_set_min_residual_partition_order(FLAC__StreamEncoder *encoder, unsigned value);
    00593
    00615 FLAC_API FLAC__bool FLAC__stream_encoder_set_max_residual_partition_order(FLAC__StreamEncoder *encoder, unsigned value);
    00616
    00627 FLAC_API FLAC__bool FLAC__stream_encoder_set_rice_parameter_search_dist(FLAC__StreamEncoder *encoder, unsigned value);
    00628
    00643 FLAC_API FLAC__bool FLAC__stream_encoder_set_total_samples_estimate(FLAC__StreamEncoder *encoder, FLAC__uint64 value);
    00644
    00686 FLAC_API FLAC__bool FLAC__stream_encoder_set_metadata(FLAC__StreamEncoder *encoder, FLAC__StreamMetadata **metadata, unsigned num_blocks);
    00687
    00713 FLAC_API FLAC__bool FLAC__stream_encoder_set_write_callback(FLAC__StreamEncoder *encoder, FLAC__StreamEncoderWriteCallback value);
    00714
    00734 FLAC_API FLAC__bool FLAC__stream_encoder_set_metadata_callback(FLAC__StreamEncoder *encoder, FLAC__StreamEncoderMetadataCallback value);
    00735
    00748 FLAC_API FLAC__bool FLAC__stream_encoder_set_client_data(FLAC__StreamEncoder *encoder, void *value);
    00749
    00758 FLAC_API FLAC__StreamEncoderState FLAC__stream_encoder_get_state(const FLAC__StreamEncoder *encoder);
    00759
    00770 FLAC_API FLAC__StreamDecoderState FLAC__stream_encoder_get_verify_decoder_state(const FLAC__StreamEncoder *encoder);
    00771
    00783 FLAC_API const char *FLAC__stream_encoder_get_resolved_state_string(const FLAC__StreamEncoder *encoder);
    00784
    00802 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);
    00803
    00812 FLAC_API FLAC__bool FLAC__stream_encoder_get_verify(const FLAC__StreamEncoder *encoder);
    00813
    00822 FLAC_API FLAC__bool FLAC__stream_encoder_get_streamable_subset(const FLAC__StreamEncoder *encoder);
    00823
    00832 FLAC_API FLAC__bool FLAC__stream_encoder_get_do_mid_side_stereo(const FLAC__StreamEncoder *encoder);
    00833
    00842 FLAC_API FLAC__bool FLAC__stream_encoder_get_loose_mid_side_stereo(const FLAC__StreamEncoder *encoder);
    00843
    00852 FLAC_API unsigned FLAC__stream_encoder_get_channels(const FLAC__StreamEncoder *encoder);
    00853
    00862 FLAC_API unsigned FLAC__stream_encoder_get_bits_per_sample(const FLAC__StreamEncoder *encoder);
    00863
    00872 FLAC_API unsigned FLAC__stream_encoder_get_sample_rate(const FLAC__StreamEncoder *encoder);
    00873
    00882 FLAC_API unsigned FLAC__stream_encoder_get_blocksize(const FLAC__StreamEncoder *encoder);
    00883
    00892 FLAC_API unsigned FLAC__stream_encoder_get_max_lpc_order(const FLAC__StreamEncoder *encoder);
    00893
    00902 FLAC_API unsigned FLAC__stream_encoder_get_qlp_coeff_precision(const FLAC__StreamEncoder *encoder);
    00903
    00912 FLAC_API FLAC__bool FLAC__stream_encoder_get_do_qlp_coeff_prec_search(const FLAC__StreamEncoder *encoder);
    00913
    00922 FLAC_API FLAC__bool FLAC__stream_encoder_get_do_escape_coding(const FLAC__StreamEncoder *encoder);
    00923
    00932 FLAC_API FLAC__bool FLAC__stream_encoder_get_do_exhaustive_model_search(const FLAC__StreamEncoder *encoder);
    00933
    00942 FLAC_API unsigned FLAC__stream_encoder_get_min_residual_partition_order(const FLAC__StreamEncoder *encoder);
    00943
    00952 FLAC_API unsigned FLAC__stream_encoder_get_max_residual_partition_order(const FLAC__StreamEncoder *encoder);
    00953
    00962 FLAC_API unsigned FLAC__stream_encoder_get_rice_parameter_search_dist(const FLAC__StreamEncoder *encoder);
    00963
    00975 FLAC_API FLAC__uint64 FLAC__stream_encoder_get_total_samples_estimate(const FLAC__StreamEncoder *encoder);
    00976
    00995 FLAC_API FLAC__StreamEncoderState FLAC__stream_encoder_init(FLAC__StreamEncoder *encoder);
    00996
    01013 FLAC_API void FLAC__stream_encoder_finish(FLAC__StreamEncoder *encoder);
    01014
    01032 FLAC_API FLAC__bool FLAC__stream_encoder_process(FLAC__StreamEncoder *encoder, const FLAC__int32 * const buffer[], unsigned samples);
    01033
    01056 FLAC_API FLAC__bool FLAC__stream_encoder_process_interleaved(FLAC__StreamEncoder *encoder, const FLAC__int32 buffer[], unsigned samples);
    01057
    01058 /* \} */
    01059
    01060 #ifdef __cplusplus
    01061 }
    01062 #endif
    01063
    01064 #endif