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  Josh Coalson
    00003  *
    00004  * This library is free software; you can redistribute it and/or
    00005  * modify it under the terms of the GNU Library General Public
    00006  * License as published by the Free Software Foundation; either
    00007  * version 2 of the License, or (at your option) any later version.
    00008  *
    00009  * This library is distributed in the hope that it will be useful,
    00010  * but WITHOUT ANY WARRANTY; without even the implied warranty of
    00011  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
    00012  * Library General Public License for more details.
    00013  *
    00014  * You should have received a copy of the GNU Library General Public
    00015  * License along with this library; if not, write to the
    00016  * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
    00017  * Boston, MA  02111-1307, USA.
    00018  */
    00019
    00020 #ifndef FLAC__STREAM_ENCODER_H
    00021 #define FLAC__STREAM_ENCODER_H
    00022
    00023 #include "export.h"
    00024 #include "format.h"
    00025 #include "stream_decoder.h"
    00026
    00027 #ifdef __cplusplus
    00028 extern "C" {
    00029 #endif
    00030
    00031
    00175 typedef enum {
    00176
    00177     FLAC__STREAM_ENCODER_OK = 0,
    00180     FLAC__STREAM_ENCODER_VERIFY_DECODER_ERROR,
    00185     FLAC__STREAM_ENCODER_VERIFY_MISMATCH_IN_AUDIO_DATA,
    00190     FLAC__STREAM_ENCODER_INVALID_CALLBACK,
    00193     FLAC__STREAM_ENCODER_INVALID_NUMBER_OF_CHANNELS,
    00196     FLAC__STREAM_ENCODER_INVALID_BITS_PER_SAMPLE,
    00202     FLAC__STREAM_ENCODER_INVALID_SAMPLE_RATE,
    00205     FLAC__STREAM_ENCODER_INVALID_BLOCK_SIZE,
    00208     FLAC__STREAM_ENCODER_INVALID_MAX_LPC_ORDER,
    00211     FLAC__STREAM_ENCODER_INVALID_QLP_COEFF_PRECISION,
    00214     FLAC__STREAM_ENCODER_MID_SIDE_CHANNELS_MISMATCH,
    00217     FLAC__STREAM_ENCODER_MID_SIDE_SAMPLE_SIZE_MISMATCH,
    00220     FLAC__STREAM_ENCODER_ILLEGAL_MID_SIDE_FORCE,
    00223     FLAC__STREAM_ENCODER_BLOCK_SIZE_TOO_SMALL_FOR_LPC_ORDER,
    00226     FLAC__STREAM_ENCODER_NOT_STREAMABLE,
    00229     FLAC__STREAM_ENCODER_FRAMING_ERROR,
    00232     FLAC__STREAM_ENCODER_INVALID_METADATA,
    00241     FLAC__STREAM_ENCODER_FATAL_ERROR_WHILE_ENCODING,
    00244     FLAC__STREAM_ENCODER_FATAL_ERROR_WHILE_WRITING,
    00247     FLAC__STREAM_ENCODER_MEMORY_ALLOCATION_ERROR,
    00250     FLAC__STREAM_ENCODER_ALREADY_INITIALIZED,
    00256     FLAC__STREAM_ENCODER_UNINITIALIZED
    00259 } FLAC__StreamEncoderState;
    00260
    00266 extern FLAC_API const char * const FLAC__StreamEncoderStateString[];
    00267
    00270 typedef enum {
    00271
    00272     FLAC__STREAM_ENCODER_WRITE_STATUS_OK = 0,
    00275     FLAC__STREAM_ENCODER_WRITE_STATUS_FATAL_ERROR
    00278 } FLAC__StreamEncoderWriteStatus;
    00279
    00285 extern FLAC_API const char * const FLAC__StreamEncoderWriteStatusString[];
    00286
    00287
    00288 /***********************************************************************
    00289  *
    00290  * class FLAC__StreamEncoder
    00291  *
    00292  ***********************************************************************/
    00293
    00294 struct FLAC__StreamEncoderProtected;
    00295 struct FLAC__StreamEncoderPrivate;
    00300 typedef struct {
    00301     struct FLAC__StreamEncoderProtected *protected_; /* avoid the C++ keyword 'protected' */
    00302     struct FLAC__StreamEncoderPrivate *private_; /* avoid the C++ keyword 'private' */
    00303 } FLAC__StreamEncoder;
    00304
    00320 typedef FLAC__StreamEncoderWriteStatus (*FLAC__StreamEncoderWriteCallback)(const FLAC__StreamEncoder *encoder, const FLAC__byte buffer[], unsigned bytes, unsigned samples, unsigned current_frame, void *client_data);
    00321
    00330 typedef void (*FLAC__StreamEncoderMetadataCallback)(const FLAC__StreamEncoder *encoder, const FLAC__StreamMetadata *metadata, void *client_data);
    00331
    00332
    00333 /***********************************************************************
    00334  *
    00335  * Class constructor/destructor
    00336  *
    00337  ***********************************************************************/
    00338
    00346 FLAC_API FLAC__StreamEncoder *FLAC__stream_encoder_new();
    00347
    00354 FLAC_API void FLAC__stream_encoder_delete(FLAC__StreamEncoder *encoder);
    00355
    00356 /***********************************************************************
    00357  *
    00358  * Public class method prototypes
    00359  *
    00360  ***********************************************************************/
    00361
    00376 FLAC_API FLAC__bool FLAC__stream_encoder_set_verify(FLAC__StreamEncoder *encoder, FLAC__bool value);
    00377
    00394 FLAC_API FLAC__bool FLAC__stream_encoder_set_streamable_subset(FLAC__StreamEncoder *encoder, FLAC__bool value);
    00395
    00408 FLAC_API FLAC__bool FLAC__stream_encoder_set_do_mid_side_stereo(FLAC__StreamEncoder *encoder, FLAC__bool value);
    00409
    00423 FLAC_API FLAC__bool FLAC__stream_encoder_set_loose_mid_side_stereo(FLAC__StreamEncoder *encoder, FLAC__bool value);
    00424
    00435 FLAC_API FLAC__bool FLAC__stream_encoder_set_channels(FLAC__StreamEncoder *encoder, unsigned value);
    00436
    00451 FLAC_API FLAC__bool FLAC__stream_encoder_set_bits_per_sample(FLAC__StreamEncoder *encoder, unsigned value);
    00452
    00463 FLAC_API FLAC__bool FLAC__stream_encoder_set_sample_rate(FLAC__StreamEncoder *encoder, unsigned value);
    00464
    00475 FLAC_API FLAC__bool FLAC__stream_encoder_set_blocksize(FLAC__StreamEncoder *encoder, unsigned value);
    00476
    00487 FLAC_API FLAC__bool FLAC__stream_encoder_set_max_lpc_order(FLAC__StreamEncoder *encoder, unsigned value);
    00488
    00505 FLAC_API FLAC__bool FLAC__stream_encoder_set_qlp_coeff_precision(FLAC__StreamEncoder *encoder, unsigned value);
    00506
    00519 FLAC_API FLAC__bool FLAC__stream_encoder_set_do_qlp_coeff_prec_search(FLAC__StreamEncoder *encoder, FLAC__bool value);
    00520
    00531 FLAC_API FLAC__bool FLAC__stream_encoder_set_do_escape_coding(FLAC__StreamEncoder *encoder, FLAC__bool value);
    00532
    00545 FLAC_API FLAC__bool FLAC__stream_encoder_set_do_exhaustive_model_search(FLAC__StreamEncoder *encoder, FLAC__bool value);
    00546
    00568 FLAC_API FLAC__bool FLAC__stream_encoder_set_min_residual_partition_order(FLAC__StreamEncoder *encoder, unsigned value);
    00569
    00591 FLAC_API FLAC__bool FLAC__stream_encoder_set_max_residual_partition_order(FLAC__StreamEncoder *encoder, unsigned value);
    00592
    00603 FLAC_API FLAC__bool FLAC__stream_encoder_set_rice_parameter_search_dist(FLAC__StreamEncoder *encoder, unsigned value);
    00604
    00619 FLAC_API FLAC__bool FLAC__stream_encoder_set_total_samples_estimate(FLAC__StreamEncoder *encoder, FLAC__uint64 value);
    00620
    00662 FLAC_API FLAC__bool FLAC__stream_encoder_set_metadata(FLAC__StreamEncoder *encoder, FLAC__StreamMetadata **metadata, unsigned num_blocks);
    00663
    00689 FLAC_API FLAC__bool FLAC__stream_encoder_set_write_callback(FLAC__StreamEncoder *encoder, FLAC__StreamEncoderWriteCallback value);
    00690
    00710 FLAC_API FLAC__bool FLAC__stream_encoder_set_metadata_callback(FLAC__StreamEncoder *encoder, FLAC__StreamEncoderMetadataCallback value);
    00711
    00724 FLAC_API FLAC__bool FLAC__stream_encoder_set_client_data(FLAC__StreamEncoder *encoder, void *value);
    00725
    00734 FLAC_API FLAC__StreamEncoderState FLAC__stream_encoder_get_state(const FLAC__StreamEncoder *encoder);
    00735
    00746 FLAC_API FLAC__StreamDecoderState FLAC__stream_encoder_get_verify_decoder_state(const FLAC__StreamEncoder *encoder);
    00747
    00759 FLAC_API const char *FLAC__stream_encoder_get_resolved_state_string(const FLAC__StreamEncoder *encoder);
    00760
    00778 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);
    00779
    00788 FLAC_API FLAC__bool FLAC__stream_encoder_get_verify(const FLAC__StreamEncoder *encoder);
    00789
    00798 FLAC_API FLAC__bool FLAC__stream_encoder_get_streamable_subset(const FLAC__StreamEncoder *encoder);
    00799
    00808 FLAC_API FLAC__bool FLAC__stream_encoder_get_do_mid_side_stereo(const FLAC__StreamEncoder *encoder);
    00809
    00818 FLAC_API FLAC__bool FLAC__stream_encoder_get_loose_mid_side_stereo(const FLAC__StreamEncoder *encoder);
    00819
    00828 FLAC_API unsigned FLAC__stream_encoder_get_channels(const FLAC__StreamEncoder *encoder);
    00829
    00838 FLAC_API unsigned FLAC__stream_encoder_get_bits_per_sample(const FLAC__StreamEncoder *encoder);
    00839
    00848 FLAC_API unsigned FLAC__stream_encoder_get_sample_rate(const FLAC__StreamEncoder *encoder);
    00849
    00858 FLAC_API unsigned FLAC__stream_encoder_get_blocksize(const FLAC__StreamEncoder *encoder);
    00859
    00868 FLAC_API unsigned FLAC__stream_encoder_get_max_lpc_order(const FLAC__StreamEncoder *encoder);
    00869
    00878 FLAC_API unsigned FLAC__stream_encoder_get_qlp_coeff_precision(const FLAC__StreamEncoder *encoder);
    00879
    00888 FLAC_API FLAC__bool FLAC__stream_encoder_get_do_qlp_coeff_prec_search(const FLAC__StreamEncoder *encoder);
    00889
    00898 FLAC_API FLAC__bool FLAC__stream_encoder_get_do_escape_coding(const FLAC__StreamEncoder *encoder);
    00899
    00908 FLAC_API FLAC__bool FLAC__stream_encoder_get_do_exhaustive_model_search(const FLAC__StreamEncoder *encoder);
    00909
    00918 FLAC_API unsigned FLAC__stream_encoder_get_min_residual_partition_order(const FLAC__StreamEncoder *encoder);
    00919
    00928 FLAC_API unsigned FLAC__stream_encoder_get_max_residual_partition_order(const FLAC__StreamEncoder *encoder);
    00929
    00938 FLAC_API unsigned FLAC__stream_encoder_get_rice_parameter_search_dist(const FLAC__StreamEncoder *encoder);
    00939
    00951 FLAC_API FLAC__uint64 FLAC__stream_encoder_get_total_samples_estimate(const FLAC__StreamEncoder *encoder);
    00952
    00971 FLAC_API FLAC__StreamEncoderState FLAC__stream_encoder_init(FLAC__StreamEncoder *encoder);
    00972
    00989 FLAC_API void FLAC__stream_encoder_finish(FLAC__StreamEncoder *encoder);
    00990
    01008 FLAC_API FLAC__bool FLAC__stream_encoder_process(FLAC__StreamEncoder *encoder, const FLAC__int32 * const buffer[], unsigned samples);
    01009
    01032 FLAC_API FLAC__bool FLAC__stream_encoder_process_interleaved(FLAC__StreamEncoder *encoder, const FLAC__int32 buffer[], unsigned samples);
    01033
    01034 /* \} */
    01035
    01036 #ifdef __cplusplus
    01037 }
    01038 #endif
    01039
    01040 #endif