include/OggFLAC++/encoder.h Source File

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

# include/OggFLAC++/encoder.h

Go to the documentation of this file.

    00001 /* libOggFLAC++ - Free Lossless Audio Codec + Ogg library
    00002  * Copyright (C) 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 OggFLACPP__ENCODER_H
    00021 #define OggFLACPP__ENCODER_H
    00022
    00023 #include "OggFLAC/stream_encoder.h"
    00024 #include "decoder.h"
    00025 // we only need these for the state abstractions really...
    00026 #include "FLAC++/decoder.h"
    00027 #include "FLAC++/encoder.h"
    00028
    00029
    00057 namespace OggFLAC {
    00058     namespace Encoder {
    00059
    00060         // ============================================================
    00061         //
    00062         //  Equivalent: OggFLAC__StreamEncoder
    00063         //
    00064         // ============================================================
    00065
    00079         class Stream {
    00080         public:
    00081             class State {
    00082             public:
    00083                 inline State(::OggFLAC__StreamEncoderState state): state_(state) { }
    00084                 inline operator ::OggFLAC__StreamEncoderState() const { return state_; }
    00085                 inline const char *as_cstring() const { return ::OggFLAC__StreamEncoderStateString[state_]; }
    00086             protected:
    00087                 ::OggFLAC__StreamEncoderState state_;
    00088             };
    00089
    00090             Stream();
    00091             virtual ~Stream();
    00092
    00093             bool is_valid() const;
    00094             inline operator bool() const { return is_valid(); }
    00095
    00096             bool set_serial_number(long value);
    00097             bool set_verify(bool value);
    00098             bool set_streamable_subset(bool value);
    00099             bool set_do_mid_side_stereo(bool value);
    00100             bool set_loose_mid_side_stereo(bool value);
    00101             bool set_channels(unsigned value);
    00102             bool set_bits_per_sample(unsigned value);
    00103             bool set_sample_rate(unsigned value);
    00104             bool set_blocksize(unsigned value);
    00105             bool set_max_lpc_order(unsigned value);
    00106             bool set_qlp_coeff_precision(unsigned value);
    00107             bool set_do_qlp_coeff_prec_search(bool value);
    00108             bool set_do_escape_coding(bool value);
    00109             bool set_do_exhaustive_model_search(bool value);
    00110             bool set_min_residual_partition_order(unsigned value);
    00111             bool set_max_residual_partition_order(unsigned value);
    00112             bool set_rice_parameter_search_dist(unsigned value);
    00113             bool set_total_samples_estimate(FLAC__uint64 value);
    00114             bool set_metadata(::FLAC__StreamMetadata **metadata, unsigned num_blocks);
    00115
    00116             State    get_state() const;
    00117             FLAC::Encoder::Stream::State get_FLAC_stream_encoder_state() const;
    00118             FLAC::Decoder::Stream::State get_verify_decoder_state() const;
    00119             void get_verify_decoder_error_stats(FLAC__uint64 *absolute_sample, unsigned *frame_number, unsigned *channel, unsigned *sample, FLAC__int32 *expected, FLAC__int32 *got);
    00120             bool     get_verify() const;
    00121             bool     get_streamable_subset() const;
    00122             bool     get_do_mid_side_stereo() const;
    00123             bool     get_loose_mid_side_stereo() const;
    00124             unsigned get_channels() const;
    00125             unsigned get_bits_per_sample() const;
    00126             unsigned get_sample_rate() const;
    00127             unsigned get_blocksize() const;
    00128             unsigned get_max_lpc_order() const;
    00129             unsigned get_qlp_coeff_precision() const;
    00130             bool     get_do_qlp_coeff_prec_search() const;
    00131             bool     get_do_escape_coding() const;
    00132             bool     get_do_exhaustive_model_search() const;
    00133             unsigned get_min_residual_partition_order() const;
    00134             unsigned get_max_residual_partition_order() const;
    00135             unsigned get_rice_parameter_search_dist() const;
    00136             FLAC__uint64 get_total_samples_estimate() const;
    00137
    00138             State init();
    00139
    00140             void finish();
    00141
    00142             bool process(const FLAC__int32 * const buffer[], unsigned samples);
    00143             bool process_interleaved(const FLAC__int32 buffer[], unsigned samples);
    00144         protected:
    00145             virtual ::FLAC__StreamEncoderWriteStatus write_callback(const FLAC__byte buffer[], unsigned bytes, unsigned samples, unsigned current_frame) = 0;
    00146
    00147             ::OggFLAC__StreamEncoder *encoder_;
    00148         private:
    00149             static ::FLAC__StreamEncoderWriteStatus write_callback_(const ::OggFLAC__StreamEncoder *encoder, const FLAC__byte buffer[], unsigned bytes, unsigned samples, unsigned current_frame, void *client_data);
    00150
    00151             // Private and undefined so you can't use them:
    00152             Stream(const Stream &);
    00153             void operator=(const Stream &);
    00154         };
    00155
    00156         /* \} */
    00157
    00158     };
    00159 };
    00160
    00161 #endif