Main Page | Modules | Class Hierarchy | Alphabetical List | Class List | File List | Class 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,2003  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 OggFLACPP__ENCODER_H
00033 #define OggFLACPP__ENCODER_H
00034 
00035 #include "export.h"
00036 
00037 #include "OggFLAC/stream_encoder.h"
00038 #include "decoder.h"
00039 // we only need these for the state abstractions really...
00040 #include "FLAC++/decoder.h"
00041 #include "FLAC++/encoder.h"
00042 
00043 
00071 namespace OggFLAC {
00072     namespace Encoder {
00073 
00074         // ============================================================
00075         //
00076         //  Equivalent: OggFLAC__StreamEncoder
00077         //
00078         // ============================================================
00079 
00093         class OggFLACPP_API Stream {
00094         public:
00095             class OggFLACPP_API State {
00096             public:
00097                 inline State(::OggFLAC__StreamEncoderState state): state_(state) { }
00098                 inline operator ::OggFLAC__StreamEncoderState() const { return state_; }
00099                 inline const char *as_cstring() const { return ::OggFLAC__StreamEncoderStateString[state_]; }
00100             protected:
00101                 ::OggFLAC__StreamEncoderState state_;
00102             };
00103 
00104             Stream();
00105             virtual ~Stream();
00106 
00107             bool is_valid() const;
00108             inline operator bool() const { return is_valid(); }
00109 
00110             bool set_serial_number(long value);
00111             bool set_verify(bool value);
00112             bool set_streamable_subset(bool value);
00113             bool set_do_mid_side_stereo(bool value);
00114             bool set_loose_mid_side_stereo(bool value);
00115             bool set_channels(unsigned value);
00116             bool set_bits_per_sample(unsigned value);
00117             bool set_sample_rate(unsigned value);
00118             bool set_blocksize(unsigned value);
00119             bool set_max_lpc_order(unsigned value);
00120             bool set_qlp_coeff_precision(unsigned value);
00121             bool set_do_qlp_coeff_prec_search(bool value);
00122             bool set_do_escape_coding(bool value);
00123             bool set_do_exhaustive_model_search(bool value);
00124             bool set_min_residual_partition_order(unsigned value);
00125             bool set_max_residual_partition_order(unsigned value);
00126             bool set_rice_parameter_search_dist(unsigned value);
00127             bool set_total_samples_estimate(FLAC__uint64 value);
00128             bool set_metadata(::FLAC__StreamMetadata **metadata, unsigned num_blocks);
00129 
00130             State    get_state() const;
00131             FLAC::Encoder::Stream::State get_FLAC_stream_encoder_state() const;
00132             FLAC::Decoder::Stream::State get_verify_decoder_state() const;
00133             void get_verify_decoder_error_stats(FLAC__uint64 *absolute_sample, unsigned *frame_number, unsigned *channel, unsigned *sample, FLAC__int32 *expected, FLAC__int32 *got);
00134             bool     get_verify() const;
00135             bool     get_streamable_subset() const;
00136             bool     get_do_mid_side_stereo() const;
00137             bool     get_loose_mid_side_stereo() const;
00138             unsigned get_channels() const;
00139             unsigned get_bits_per_sample() const;
00140             unsigned get_sample_rate() const;
00141             unsigned get_blocksize() const;
00142             unsigned get_max_lpc_order() const;
00143             unsigned get_qlp_coeff_precision() const;
00144             bool     get_do_qlp_coeff_prec_search() const;
00145             bool     get_do_escape_coding() const;
00146             bool     get_do_exhaustive_model_search() const;
00147             unsigned get_min_residual_partition_order() const;
00148             unsigned get_max_residual_partition_order() const;
00149             unsigned get_rice_parameter_search_dist() const;
00150             FLAC__uint64 get_total_samples_estimate() const;
00151 
00152             State init();
00153 
00154             void finish();
00155 
00156             bool process(const FLAC__int32 * const buffer[], unsigned samples);
00157             bool process_interleaved(const FLAC__int32 buffer[], unsigned samples);
00158         protected:
00159             virtual ::FLAC__StreamEncoderWriteStatus write_callback(const FLAC__byte buffer[], unsigned bytes, unsigned samples, unsigned current_frame) = 0;
00160 
00161             ::OggFLAC__StreamEncoder *encoder_;
00162         private:
00163             static ::FLAC__StreamEncoderWriteStatus write_callback_(const ::OggFLAC__StreamEncoder *encoder, const FLAC__byte buffer[], unsigned bytes, unsigned samples, unsigned current_frame, void *client_data);
00164 
00165             // Private and undefined so you can't use them:
00166             Stream(const Stream &);
00167             void operator=(const Stream &);
00168         };
00169 
00170         /* \} */
00171 
00172     };
00173 };
00174 
00175 #endif

Generated on Mon Jun 28 13:04:37 2004 for FLAC by doxygen 1.3.6