new seekable stream encoder and file encoder layers

This commit is contained in:
Josh Coalson 2002-08-02 06:26:37 +00:00
parent 3cec051d3f
commit ebd4a65cda

View File

@ -20,12 +20,14 @@
#ifndef FLACPP__ENCODER_H
#define FLACPP__ENCODER_H
#include "FLAC/file_encoder.h"
#include "FLAC/seekable_stream_encoder.h"
#include "FLAC/stream_encoder.h"
// ===============================================================
//
// Full documentation for the encoder interface can be found
// in the C layer in include/FLAC/stream_encoder.h
// Full documentation for the encoder interfaces can be found
// in the C layer in include/FLAC/ *_encoder.h
//
// ===============================================================
@ -155,6 +157,186 @@ namespace FLAC {
/* \} */
/** \defgroup flacpp_seekable_stream_encoder FLAC++/encoder.h: seekable stream encoder class
* \ingroup flacpp_encoder
*
* \brief
* Brief XXX.
*
* Detailed seekable stream encoder XXX.
* \{
*/
/** seekable stream encoder XXX.
*/
class SeekableStream {
public:
class State {
public:
inline State(::FLAC__SeekableStreamEncoderState state): state_(state) { }
inline operator ::FLAC__SeekableStreamEncoderState() const { return state_; }
inline const char *as_cstring() const { return ::FLAC__SeekableStreamEncoderStateString[state_]; }
protected:
::FLAC__SeekableStreamEncoderState state_;
};
SeekableStream();
virtual ~SeekableStream();
bool is_valid() const;
inline operator bool() const { return is_valid(); }
bool set_streamable_subset(bool value);
bool set_do_mid_side_stereo(bool value);
bool set_loose_mid_side_stereo(bool value);
bool set_channels(unsigned value);
bool set_bits_per_sample(unsigned value);
bool set_sample_rate(unsigned value);
bool set_blocksize(unsigned value);
bool set_max_lpc_order(unsigned value);
bool set_qlp_coeff_precision(unsigned value);
bool set_do_qlp_coeff_prec_search(bool value);
bool set_do_escape_coding(bool value);
bool set_do_exhaustive_model_search(bool value);
bool set_min_residual_partition_order(unsigned value);
bool set_max_residual_partition_order(unsigned value);
bool set_rice_parameter_search_dist(unsigned value);
bool set_total_samples_estimate(FLAC__uint64 value);
bool set_metadata(::FLAC__StreamMetadata **metadata, unsigned num_blocks);
State get_state() const;
Stream::State get_stream_encoder_state() const;
bool get_streamable_subset() const;
bool get_do_mid_side_stereo() const;
bool get_loose_mid_side_stereo() const;
unsigned get_channels() const;
unsigned get_bits_per_sample() const;
unsigned get_sample_rate() const;
unsigned get_blocksize() const;
unsigned get_max_lpc_order() const;
unsigned get_qlp_coeff_precision() const;
bool get_do_qlp_coeff_prec_search() const;
bool get_do_escape_coding() const;
bool get_do_exhaustive_model_search() const;
unsigned get_min_residual_partition_order() const;
unsigned get_max_residual_partition_order() const;
unsigned get_rice_parameter_search_dist() const;
// Initialize the instance; as with the C interface,
// init() should be called after construction and 'set'
// calls but before any of the 'process' calls.
State init();
void finish();
bool process(const FLAC__int32 * const buffer[], unsigned samples);
bool process_interleaved(const FLAC__int32 buffer[], unsigned samples);
protected:
virtual FLAC__SeekableStreamEncoderSeekStatus seek_callback(FLAC__uint64 absolute_byte_offset) = 0;
virtual FLAC__StreamEncoderWriteStatus write_callback(const FLAC__byte buffer[], unsigned bytes, unsigned samples, unsigned current_frame) = 0;
::FLAC__SeekableStreamEncoder *encoder_;
private:
static FLAC__SeekableStreamEncoderSeekStatus seek_callback_(const FLAC__SeekableStreamEncoder *encoder, FLAC__uint64 absolute_byte_offset, void *client_data);
static FLAC__StreamEncoderWriteStatus write_callback_(const FLAC__SeekableStreamEncoder *encoder, const FLAC__byte buffer[], unsigned bytes, unsigned samples, unsigned current_frame, void *client_data);
// Private and undefined so you can't use them:
SeekableStream(const SeekableStream &);
void operator=(const SeekableStream &);
};
/* \} */
/** \defgroup flacpp_file_encoder FLAC++/encoder.h: file encoder class
* \ingroup flacpp_encoder
*
* \brief
* Brief XXX.
*
* Detailed file encoder XXX.
* \{
*/
/** file encoder XXX.
*/
class File {
public:
class State {
public:
inline State(::FLAC__FileEncoderState state): state_(state) { }
inline operator ::FLAC__FileEncoderState() const { return state_; }
inline const char *as_cstring() const { return ::FLAC__FileEncoderStateString[state_]; }
protected:
::FLAC__FileEncoderState state_;
};
File();
virtual ~File();
bool is_valid() const;
inline operator bool() const { return is_valid(); }
bool set_streamable_subset(bool value);
bool set_do_mid_side_stereo(bool value);
bool set_loose_mid_side_stereo(bool value);
bool set_channels(unsigned value);
bool set_bits_per_sample(unsigned value);
bool set_sample_rate(unsigned value);
bool set_blocksize(unsigned value);
bool set_max_lpc_order(unsigned value);
bool set_qlp_coeff_precision(unsigned value);
bool set_do_qlp_coeff_prec_search(bool value);
bool set_do_escape_coding(bool value);
bool set_do_exhaustive_model_search(bool value);
bool set_min_residual_partition_order(unsigned value);
bool set_max_residual_partition_order(unsigned value);
bool set_rice_parameter_search_dist(unsigned value);
bool set_total_samples_estimate(FLAC__uint64 value);
bool set_metadata(::FLAC__StreamMetadata **metadata, unsigned num_blocks);
bool set_filename(const char *value);
State get_state() const;
SeekableStream::State get_seekable_stream_encoder_state() const;
Stream::State get_stream_encoder_state() const;
bool get_streamable_subset() const;
bool get_do_mid_side_stereo() const;
bool get_loose_mid_side_stereo() const;
unsigned get_channels() const;
unsigned get_bits_per_sample() const;
unsigned get_sample_rate() const;
unsigned get_blocksize() const;
unsigned get_max_lpc_order() const;
unsigned get_qlp_coeff_precision() const;
bool get_do_qlp_coeff_prec_search() const;
bool get_do_escape_coding() const;
bool get_do_exhaustive_model_search() const;
unsigned get_min_residual_partition_order() const;
unsigned get_max_residual_partition_order() const;
unsigned get_rice_parameter_search_dist() const;
// Initialize the instance; as with the C interface,
// init() should be called after construction and 'set'
// calls but before any of the 'process' calls.
State init();
void finish();
bool process(const FLAC__int32 * const buffer[], unsigned samples);
bool process_interleaved(const FLAC__int32 buffer[], unsigned samples);
protected:
//@@@@ progress callback
::FLAC__FileEncoder *encoder_;
private:
//@@@@ progress callback
// Private and undefined so you can't use them:
File(const Stream &);
void operator=(const Stream &);
};
/* \} */
};
};