00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
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
00040 #include "FLAC++/decoder.h"
00041 #include "FLAC++/encoder.h"
00042
00043
00071 namespace OggFLAC {
00072 namespace Encoder {
00073
00074
00075
00076
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
00166 Stream(const Stream &);
00167 void operator=(const Stream &);
00168 };
00169
00170
00171
00172 };
00173 };
00174
00175 #endif