include/FLAC/stream_encoder.h Source File

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  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 "format.h"
    00024 #include "stream_decoder.h"
    00025
    00026 #ifdef __cplusplus
    00027 extern "C" {
    00028 #endif
    00029
    00030
    00174 typedef enum {
    00175
    00176     FLAC__STREAM_ENCODER_OK = 0,
    00179     FLAC__STREAM_ENCODER_VERIFY_DECODER_ERROR,
    00184     FLAC__STREAM_ENCODER_VERIFY_MISMATCH_IN_AUDIO_DATA,
    00189     FLAC__STREAM_ENCODER_INVALID_CALLBACK,
    00192     FLAC__STREAM_ENCODER_INVALID_NUMBER_OF_CHANNELS,
    00195     FLAC__STREAM_ENCODER_INVALID_BITS_PER_SAMPLE,
    00201     FLAC__STREAM_ENCODER_INVALID_SAMPLE_RATE,
    00204     FLAC__STREAM_ENCODER_INVALID_BLOCK_SIZE,
    00207     FLAC__STREAM_ENCODER_INVALID_MAX_LPC_ORDER,
    00210     FLAC__STREAM_ENCODER_INVALID_QLP_COEFF_PRECISION,
    00213     FLAC__STREAM_ENCODER_MID_SIDE_CHANNELS_MISMATCH,
    00216     FLAC__STREAM_ENCODER_MID_SIDE_SAMPLE_SIZE_MISMATCH,
    00219     FLAC__STREAM_ENCODER_ILLEGAL_MID_SIDE_FORCE,
    00222     FLAC__STREAM_ENCODER_BLOCK_SIZE_TOO_SMALL_FOR_LPC_ORDER,
    00225     FLAC__STREAM_ENCODER_NOT_STREAMABLE,
    00228     FLAC__STREAM_ENCODER_FRAMING_ERROR,
    00231     FLAC__STREAM_ENCODER_INVALID_METADATA,
    00238     FLAC__STREAM_ENCODER_FATAL_ERROR_WHILE_ENCODING,
    00241     FLAC__STREAM_ENCODER_FATAL_ERROR_WHILE_WRITING,
    00244     FLAC__STREAM_ENCODER_MEMORY_ALLOCATION_ERROR,
    00247     FLAC__STREAM_ENCODER_ALREADY_INITIALIZED,
    00253     FLAC__STREAM_ENCODER_UNINITIALIZED
    00256 } FLAC__StreamEncoderState;
    00257
    00263 extern const char * const FLAC__StreamEncoderStateString[];
    00264
    00267 typedef enum {
    00268
    00269     FLAC__STREAM_ENCODER_WRITE_STATUS_OK = 0,
    00272     FLAC__STREAM_ENCODER_WRITE_STATUS_FATAL_ERROR
    00275 } FLAC__StreamEncoderWriteStatus;
    00276
    00282 extern const char * const FLAC__StreamEncoderWriteStatusString[];
    00283
    00284
    00285 /***********************************************************************
    00286  *
    00287  * class FLAC__StreamEncoder
    00288  *
    00289  ***********************************************************************/
    00290
    00291 struct FLAC__StreamEncoderProtected;
    00292 struct FLAC__StreamEncoderPrivate;
    00297 typedef struct {
    00298     struct FLAC__StreamEncoderProtected *protected_; /* avoid the C++ keyword 'protected' */
    00299     struct FLAC__StreamEncoderPrivate *private_; /* avoid the C++ keyword 'private' */
    00300 } FLAC__StreamEncoder;
    00301
    00317 typedef FLAC__StreamEncoderWriteStatus (*FLAC__StreamEncoderWriteCallback)(const FLAC__StreamEncoder *encoder, const FLAC__byte buffer[], unsigned bytes, unsigned samples, unsigned current_frame, void *client_data);
    00318
    00327 typedef void (*FLAC__StreamEncoderMetadataCallback)(const FLAC__StreamEncoder *encoder, const FLAC__StreamMetadata *metadata, void *client_data);
    00328
    00329
    00330 /***********************************************************************
    00331  *
    00332  * Class constructor/destructor
    00333  *
    00334  ***********************************************************************/
    00335
    00343 FLAC__StreamEncoder *FLAC__stream_encoder_new();
    00344
    00351 void FLAC__stream_encoder_delete(FLAC__StreamEncoder *encoder);
    00352
    00353 /***********************************************************************
    00354  *
    00355  * Public class method prototypes
    00356  *
    00357  ***********************************************************************/
    00358
    00373 FLAC__bool FLAC__stream_encoder_set_verify(FLAC__StreamEncoder *encoder, FLAC__bool value);
    00374
    00391 FLAC__bool FLAC__stream_encoder_set_streamable_subset(FLAC__StreamEncoder *encoder, FLAC__bool value);
    00392
    00405 FLAC__bool FLAC__stream_encoder_set_do_mid_side_stereo(FLAC__StreamEncoder *encoder, FLAC__bool value);
    00406
    00420 FLAC__bool FLAC__stream_encoder_set_loose_mid_side_stereo(FLAC__StreamEncoder *encoder, FLAC__bool value);
    00421
    00432 FLAC__bool FLAC__stream_encoder_set_channels(FLAC__StreamEncoder *encoder, unsigned value);
    00433
    00448 FLAC__bool FLAC__stream_encoder_set_bits_per_sample(FLAC__StreamEncoder *encoder, unsigned value);
    00449
    00460 FLAC__bool FLAC__stream_encoder_set_sample_rate(FLAC__StreamEncoder *encoder, unsigned value);
    00461
    00472 FLAC__bool FLAC__stream_encoder_set_blocksize(FLAC__StreamEncoder *encoder, unsigned value);
    00473
    00484 FLAC__bool FLAC__stream_encoder_set_max_lpc_order(FLAC__StreamEncoder *encoder, unsigned value);
    00485
    00502 FLAC__bool FLAC__stream_encoder_set_qlp_coeff_precision(FLAC__StreamEncoder *encoder, unsigned value);
    00503
    00516 FLAC__bool FLAC__stream_encoder_set_do_qlp_coeff_prec_search(FLAC__StreamEncoder *encoder, FLAC__bool value);
    00517
    00528 FLAC__bool FLAC__stream_encoder_set_do_escape_coding(FLAC__StreamEncoder *encoder, FLAC__bool value);
    00529
    00542 FLAC__bool FLAC__stream_encoder_set_do_exhaustive_model_search(FLAC__StreamEncoder *encoder, FLAC__bool value);
    00543
    00565 FLAC__bool FLAC__stream_encoder_set_min_residual_partition_order(FLAC__StreamEncoder *encoder, unsigned value);
    00566
    00588 FLAC__bool FLAC__stream_encoder_set_max_residual_partition_order(FLAC__StreamEncoder *encoder, unsigned value);
    00589
    00600 FLAC__bool FLAC__stream_encoder_set_rice_parameter_search_dist(FLAC__StreamEncoder *encoder, unsigned value);
    00601
    00616 FLAC__bool FLAC__stream_encoder_set_total_samples_estimate(FLAC__StreamEncoder *encoder, FLAC__uint64 value);
    00617
    00659 FLAC__bool FLAC__stream_encoder_set_metadata(FLAC__StreamEncoder *encoder, FLAC__StreamMetadata **metadata, unsigned num_blocks);
    00660
    00686 FLAC__bool FLAC__stream_encoder_set_write_callback(FLAC__StreamEncoder *encoder, FLAC__StreamEncoderWriteCallback value);
    00687
    00707 FLAC__bool FLAC__stream_encoder_set_metadata_callback(FLAC__StreamEncoder *encoder, FLAC__StreamEncoderMetadataCallback value);
    00708
    00721 FLAC__bool FLAC__stream_encoder_set_client_data(FLAC__StreamEncoder *encoder, void *value);
    00722
    00731 FLAC__StreamEncoderState FLAC__stream_encoder_get_state(const FLAC__StreamEncoder *encoder);
    00732
    00743 FLAC__StreamDecoderState FLAC__stream_encoder_get_verify_decoder_state(const FLAC__StreamEncoder *encoder);
    00744
    00762 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);
    00763
    00772 FLAC__bool FLAC__stream_encoder_get_verify(const FLAC__StreamEncoder *encoder);
    00773
    00782 FLAC__bool FLAC__stream_encoder_get_streamable_subset(const FLAC__StreamEncoder *encoder);
    00783
    00792 FLAC__bool FLAC__stream_encoder_get_do_mid_side_stereo(const FLAC__StreamEncoder *encoder);
    00793
    00802 FLAC__bool FLAC__stream_encoder_get_loose_mid_side_stereo(const FLAC__StreamEncoder *encoder);
    00803
    00812 unsigned FLAC__stream_encoder_get_channels(const FLAC__StreamEncoder *encoder);
    00813
    00822 unsigned FLAC__stream_encoder_get_bits_per_sample(const FLAC__StreamEncoder *encoder);
    00823
    00832 unsigned FLAC__stream_encoder_get_sample_rate(const FLAC__StreamEncoder *encoder);
    00833
    00842 unsigned FLAC__stream_encoder_get_blocksize(const FLAC__StreamEncoder *encoder);
    00843
    00852 unsigned FLAC__stream_encoder_get_max_lpc_order(const FLAC__StreamEncoder *encoder);
    00853
    00862 unsigned FLAC__stream_encoder_get_qlp_coeff_precision(const FLAC__StreamEncoder *encoder);
    00863
    00872 FLAC__bool FLAC__stream_encoder_get_do_qlp_coeff_prec_search(const FLAC__StreamEncoder *encoder);
    00873
    00882 FLAC__bool FLAC__stream_encoder_get_do_escape_coding(const FLAC__StreamEncoder *encoder);
    00883
    00892 FLAC__bool FLAC__stream_encoder_get_do_exhaustive_model_search(const FLAC__StreamEncoder *encoder);
    00893
    00902 unsigned FLAC__stream_encoder_get_min_residual_partition_order(const FLAC__StreamEncoder *encoder);
    00903
    00912 unsigned FLAC__stream_encoder_get_max_residual_partition_order(const FLAC__StreamEncoder *encoder);
    00913
    00922 unsigned FLAC__stream_encoder_get_rice_parameter_search_dist(const FLAC__StreamEncoder *encoder);
    00923
    00935 FLAC__uint64 FLAC__stream_encoder_get_total_samples_estimate(const FLAC__StreamEncoder *encoder);
    00936
    00955 FLAC__StreamEncoderState FLAC__stream_encoder_init(FLAC__StreamEncoder *encoder);
    00956
    00973 void FLAC__stream_encoder_finish(FLAC__StreamEncoder *encoder);
    00974
    00992 FLAC__bool FLAC__stream_encoder_process(FLAC__StreamEncoder *encoder, const FLAC__int32 * const buffer[], unsigned samples);
    00993
    01016 FLAC__bool FLAC__stream_encoder_process_interleaved(FLAC__StreamEncoder *encoder, const FLAC__int32 buffer[], unsigned samples);
    01017
    01018 /* \} */
    01019
    01020 #ifdef __cplusplus
    01021 }
    01022 #endif
    01023
    01024 #endif