FLAC 1.4.2 Free Lossless Audio Codec

Public Member Functions | Protected Member Functions | Static Protected Member Functions | Protected Attributes | List of all members
FLAC::Encoder::File Class Reference
FLAC C++ API » FLAC++/encoder.h: encoder classes

`#include <encoder.h>`

Inheritance diagram for FLAC::Encoder::File:

## Public Member Functions
virtual ::FLAC__StreamEncoderInitStatus | init (FILE *file)
virtual ::FLAC__StreamEncoderInitStatus | init (const char *filename)
virtual ::FLAC__StreamEncoderInitStatus | init (const std::string &filename)
virtual ::FLAC__StreamEncoderInitStatus | init_ogg (FILE *file)
virtual ::FLAC__StreamEncoderInitStatus | init_ogg (const char *filename)
virtual ::FLAC__StreamEncoderInitStatus | init_ogg (const std::string &filename)
virtual ::FLAC__StreamEncoderInitStatus | init ()
virtual ::FLAC__StreamEncoderInitStatus | init_ogg ()
virtual bool | is_valid () const
| operator bool () const
virtual bool | set_ogg_serial_number (long value)
virtual bool | set_verify (bool value)
virtual bool | set_streamable_subset (bool value)
virtual bool | set_channels (uint32_t value)
virtual bool | set_bits_per_sample (uint32_t value)
virtual bool | set_sample_rate (uint32_t value)
virtual bool | set_compression_level (uint32_t value)
virtual bool | set_blocksize (uint32_t value)
virtual bool | set_do_mid_side_stereo (bool value)
virtual bool | set_loose_mid_side_stereo (bool value)
virtual bool | set_apodization (const char *specification)
virtual bool | set_max_lpc_order (uint32_t value)
virtual bool | set_qlp_coeff_precision (uint32_t value)
virtual bool | set_do_qlp_coeff_prec_search (bool value)
virtual bool | set_do_escape_coding (bool value)
virtual bool | set_do_exhaustive_model_search (bool value)
virtual bool | set_min_residual_partition_order (uint32_t value)
virtual bool | set_max_residual_partition_order (uint32_t value)
virtual bool | set_rice_parameter_search_dist (uint32_t value)
virtual bool | set_total_samples_estimate (FLAC__uint64 value)
virtual bool | set_metadata (::FLAC__StreamMetadata **metadata, uint32_t num_blocks)
virtual bool | set_metadata (FLAC::Metadata::Prototype **metadata, uint32_t num_blocks)
virtual bool | set_limit_min_bitrate (bool value)
State | get_state () const
virtual Decoder::Stream::State | get_verify_decoder_state () const
virtual void | get_verify_decoder_error_stats (FLAC__uint64 *absolute_sample, uint32_t *frame_number, uint32_t *channel, uint32_t *sample, FLAC__int32 *expected, FLAC__int32 *got)
virtual bool | get_verify () const
virtual bool | get_streamable_subset () const
virtual bool | get_do_mid_side_stereo () const
virtual bool | get_loose_mid_side_stereo () const
virtual uint32_t | get_channels () const
virtual uint32_t | get_bits_per_sample () const
virtual uint32_t | get_sample_rate () const
virtual uint32_t | get_blocksize () const
virtual uint32_t | get_max_lpc_order () const
virtual uint32_t | get_qlp_coeff_precision () const
virtual bool | get_do_qlp_coeff_prec_search () const
virtual bool | get_do_escape_coding () const
virtual bool | get_do_exhaustive_model_search () const
virtual uint32_t | get_min_residual_partition_order () const
virtual uint32_t | get_max_residual_partition_order () const
virtual uint32_t | get_rice_parameter_search_dist () const
virtual FLAC__uint64 | get_total_samples_estimate () const
virtual bool | get_limit_min_bitrate () const
virtual bool | finish ()
virtual bool | process (const FLAC__int32 *const buffer[], uint32_t samples)
virtual bool | process_interleaved (const FLAC__int32 buffer[], uint32_t samples)

## Protected Member Functions
virtual void | progress_callback (FLAC__uint64 bytes_written, FLAC__uint64 samples_written, uint32_t frames_written, uint32_t total_frames_estimate)
virtual ::FLAC__StreamEncoderWriteStatus | write_callback (const FLAC__byte buffer[], size_t bytes, uint32_t samples, uint32_t current_frame)
virtual ::FLAC__StreamEncoderReadStatus | read_callback (FLAC__byte buffer[], size_t *bytes)
virtual ::FLAC__StreamEncoderSeekStatus | seek_callback (FLAC__uint64 absolute_byte_offset)
virtual ::FLAC__StreamEncoderTellStatus | tell_callback (FLAC__uint64 *absolute_byte_offset)
virtual void | metadata_callback (const ::FLAC__StreamMetadata *metadata)

## Static Protected Member Functions
::FLAC__StreamEncoderReadStatus | read_callback_ (const ::FLAC__StreamEncoder *encoder, FLAC__byte buffer[], size_t *bytes, void *client_data)
::FLAC__StreamEncoderWriteStatus | write_callback_ (const ::FLAC__StreamEncoder *encoder, const FLAC__byte buffer[], size_t bytes, uint32_t samples, uint32_t current_frame, void *client_data)
::FLAC__StreamEncoderSeekStatus | seek_callback_ (const FLAC__StreamEncoder *encoder, FLAC__uint64 absolute_byte_offset, void *client_data)
::FLAC__StreamEncoderTellStatus | tell_callback_ (const FLAC__StreamEncoder *encoder, FLAC__uint64 *absolute_byte_offset, void *client_data)
static void | metadata_callback_ (const ::FLAC__StreamEncoder *encoder, const ::FLAC__StreamMetadata *metadata, void *client_data)

## Protected Attributes
::FLAC__StreamEncoder * | encoder_

## Detailed Description

This class wraps the FLAC__StreamEncoder. If you are not encoding to a file, you may need to use FLAC::Encoder::Stream.

The usage of this class is similar to FLAC__StreamEncoder, except instead of providing callbacks to FLAC__stream_encoder_init*_FILE() or FLAC__stream_encoder_init*_file(), you will inherit from this class and override the virtual callback functions with your own implementations, then call init() or init_ogg(). The rest of the calls work the same as in the C layer.

There are no mandatory callbacks; all the callbacks from FLAC::Encoder::Stream are implemented here fully and support full post-encode STREAMINFO and SEEKTABLE updating. There is only an optional progress callback which you may override to get periodic reports on the progress of the encode.

## Member Function Documentation

## ◆ init() [1/4]

virtual ::FLAC__StreamEncoderInitStatus FLAC::Encoder::File::init | ( | FILE * | file | ) |

See FLAC__stream_encoder_init_FILE()

## ◆ init() [2/4]

virtual ::FLAC__StreamEncoderInitStatus FLAC::Encoder::File::init | ( | const char * | filename | ) |

See FLAC__stream_encoder_init_file()

## ◆ init() [3/4]

virtual ::FLAC__StreamEncoderInitStatus FLAC::Encoder::File::init | ( | const std::string & | filename | ) |

See FLAC__stream_encoder_init_file()

## ◆ init_ogg() [1/4]

virtual ::FLAC__StreamEncoderInitStatus FLAC::Encoder::File::init_ogg | ( | FILE * | file | ) |

See FLAC__stream_encoder_init_ogg_FILE()

## ◆ init_ogg() [2/4]

virtual ::FLAC__StreamEncoderInitStatus FLAC::Encoder::File::init_ogg | ( | const char * | filename | ) |

See FLAC__stream_encoder_init_ogg_file()

## ◆ init_ogg() [3/4]

virtual ::FLAC__StreamEncoderInitStatus FLAC::Encoder::File::init_ogg | ( | const std::string & | filename | ) |

See FLAC__stream_encoder_init_ogg_file()

## ◆ progress_callback()

virtual void FLAC::Encoder::File::progress_callback | ( | FLAC__uint64 | bytes_written,
|  | FLAC__uint64 | samples_written,
|  | uint32_t | frames_written,
|  | uint32_t | total_frames_estimate
| ) |  |
| protected virtual

See FLAC__StreamEncoderProgressCallback.

## ◆ write_callback()

virtual ::FLAC__StreamEncoderWriteStatus FLAC::Encoder::File::write_callback | ( | const FLAC__byte | buffer[],
|  | size_t | bytes,
|  | uint32_t | samples,
|  | uint32_t | current_frame
| ) |  |
| protected virtual

This is a dummy implementation to satisfy the pure virtual in Stream that is actually supplied internally by the C layer.

Implements FLAC::Encoder::Stream.

## ◆ init() [4/4]

virtual ::FLAC__StreamEncoderInitStatus FLAC::Encoder::Stream::init | ( |  | ) |

See FLAC__stream_encoder_init_stream()

## ◆ init_ogg() [4/4]

virtual ::FLAC__StreamEncoderInitStatus FLAC::Encoder::Stream::init_ogg | ( |  | ) |

See FLAC__stream_encoder_init_ogg_stream()

## ◆ is_valid()

virtual bool FLAC::Encoder::Stream::is_valid | ( |  | ) | const
| virtual inherited

Call after construction to check that the object was created successfully. If not, use get_state() to find out why not.

## ◆ operator bool()

FLAC::Encoder::Stream::operator bool | ( |  | ) | const
| inline inherited

See is_valid()

## ◆ set_ogg_serial_number()

virtual bool FLAC::Encoder::Stream::set_ogg_serial_number | ( | long | value | ) |
| virtual inherited

See FLAC__stream_encoder_set_ogg_serial_number()

## ◆ set_verify()

virtual bool FLAC::Encoder::Stream::set_verify | ( | bool | value | ) |
| virtual inherited

See FLAC__stream_encoder_set_verify()

## ◆ set_streamable_subset()

virtual bool FLAC::Encoder::Stream::set_streamable_subset | ( | bool | value | ) |
| virtual inherited

See FLAC__stream_encoder_set_streamable_subset()

## ◆ set_channels()

virtual bool FLAC::Encoder::Stream::set_channels | ( | uint32_t | value | ) |
| virtual inherited

See FLAC__stream_encoder_set_channels()

## ◆ set_bits_per_sample()

virtual bool FLAC::Encoder::Stream::set_bits_per_sample | ( | uint32_t | value | ) |
| virtual inherited

See FLAC__stream_encoder_set_bits_per_sample()

## ◆ set_sample_rate()

virtual bool FLAC::Encoder::Stream::set_sample_rate | ( | uint32_t | value | ) |
| virtual inherited

See FLAC__stream_encoder_set_sample_rate()

## ◆ set_compression_level()

virtual bool FLAC::Encoder::Stream::set_compression_level | ( | uint32_t | value | ) |
| virtual inherited

See FLAC__stream_encoder_set_compression_level()

## ◆ set_blocksize()

virtual bool FLAC::Encoder::Stream::set_blocksize | ( | uint32_t | value | ) |
| virtual inherited

See FLAC__stream_encoder_set_blocksize()

## ◆ set_do_mid_side_stereo()

virtual bool FLAC::Encoder::Stream::set_do_mid_side_stereo | ( | bool | value | ) |
| virtual inherited

See FLAC__stream_encoder_set_do_mid_side_stereo()

## ◆ set_loose_mid_side_stereo()

virtual bool FLAC::Encoder::Stream::set_loose_mid_side_stereo | ( | bool | value | ) |
| virtual inherited

See FLAC__stream_encoder_set_loose_mid_side_stereo()

## ◆ set_apodization()

virtual bool FLAC::Encoder::Stream::set_apodization | ( | const char * | specification | ) |
| virtual inherited

See FLAC__stream_encoder_set_apodization()

## ◆ set_max_lpc_order()

virtual bool FLAC::Encoder::Stream::set_max_lpc_order | ( | uint32_t | value | ) |
| virtual inherited

See FLAC__stream_encoder_set_max_lpc_order()

## ◆ set_qlp_coeff_precision()

virtual bool FLAC::Encoder::Stream::set_qlp_coeff_precision | ( | uint32_t | value | ) |
| virtual inherited

See FLAC__stream_encoder_set_qlp_coeff_precision()

## ◆ set_do_qlp_coeff_prec_search()

virtual bool FLAC::Encoder::Stream::set_do_qlp_coeff_prec_search | ( | bool | value | ) |
| virtual inherited

See FLAC__stream_encoder_set_do_qlp_coeff_prec_search()

## ◆ set_do_escape_coding()

virtual bool FLAC::Encoder::Stream::set_do_escape_coding | ( | bool | value | ) |
| virtual inherited

See FLAC__stream_encoder_set_do_escape_coding()

## ◆ set_do_exhaustive_model_search()

virtual bool FLAC::Encoder::Stream::set_do_exhaustive_model_search | ( | bool | value | ) |
| virtual inherited

See FLAC__stream_encoder_set_do_exhaustive_model_search()

## ◆ set_min_residual_partition_order()

virtual bool FLAC::Encoder::Stream::set_min_residual_partition_order | ( | uint32_t | value | ) |
| virtual inherited

See FLAC__stream_encoder_set_min_residual_partition_order()

## ◆ set_max_residual_partition_order()

virtual bool FLAC::Encoder::Stream::set_max_residual_partition_order | ( | uint32_t | value | ) |
| virtual inherited

See FLAC__stream_encoder_set_max_residual_partition_order()

## ◆ set_rice_parameter_search_dist()

virtual bool FLAC::Encoder::Stream::set_rice_parameter_search_dist | ( | uint32_t | value | ) |
| virtual inherited

See FLAC__stream_encoder_set_rice_parameter_search_dist()

## ◆ set_total_samples_estimate()

virtual bool FLAC::Encoder::Stream::set_total_samples_estimate | ( | FLAC__uint64 | value | ) |
| virtual inherited

See FLAC__stream_encoder_set_total_samples_estimate()

## ◆ set_metadata() [1/2]

virtual bool FLAC::Encoder::Stream::set_metadata | ( | ::FLAC__StreamMetadata ** | metadata,
|  | uint32_t | num_blocks
| ) |  |
| virtual inherited

See FLAC__stream_encoder_set_metadata()

## ◆ set_metadata() [2/2]

virtual bool FLAC::Encoder::Stream::set_metadata | ( | FLAC::Metadata::Prototype ** | metadata,
|  | uint32_t | num_blocks
| ) |  |
| virtual inherited

See FLAC__stream_encoder_set_metadata()

## ◆ set_limit_min_bitrate()

virtual bool FLAC::Encoder::Stream::set_limit_min_bitrate | ( | bool | value | ) |
| virtual inherited

See FLAC__stream_encoder_set_limit_min_bitrate()

## ◆ get_state()

State FLAC::Encoder::Stream::get_state | ( |  | ) | const
| inherited

See FLAC__stream_encoder_get_state()

## ◆ get_verify_decoder_state()

virtual Decoder::Stream::State FLAC::Encoder::Stream::get_verify_decoder_state | ( |  | ) | const
| virtual inherited

See FLAC__stream_encoder_get_verify_decoder_state()

## ◆ get_verify_decoder_error_stats()

virtual void FLAC::Encoder::Stream::get_verify_decoder_error_stats | ( | FLAC__uint64 * | absolute_sample,
|  | uint32_t * | frame_number,
|  | uint32_t * | channel,
|  | uint32_t * | sample,
|  | FLAC__int32 * | expected,
|  | FLAC__int32 * | got
| ) |  |
| virtual inherited

See FLAC__stream_encoder_get_verify_decoder_error_stats()

## ◆ get_verify()

virtual bool FLAC::Encoder::Stream::get_verify | ( |  | ) | const
| virtual inherited

See FLAC__stream_encoder_get_verify()

## ◆ get_streamable_subset()

virtual bool FLAC::Encoder::Stream::get_streamable_subset | ( |  | ) | const
| virtual inherited

See FLAC__stream_encoder_get_streamable_subset()

## ◆ get_do_mid_side_stereo()

virtual bool FLAC::Encoder::Stream::get_do_mid_side_stereo | ( |  | ) | const
| virtual inherited

See FLAC__stream_encoder_get_do_mid_side_stereo()

## ◆ get_loose_mid_side_stereo()

virtual bool FLAC::Encoder::Stream::get_loose_mid_side_stereo | ( |  | ) | const
| virtual inherited

See FLAC__stream_encoder_get_loose_mid_side_stereo()

## ◆ get_channels()

virtual uint32_t FLAC::Encoder::Stream::get_channels | ( |  | ) | const
| virtual inherited

See FLAC__stream_encoder_get_channels()

## ◆ get_bits_per_sample()

virtual uint32_t FLAC::Encoder::Stream::get_bits_per_sample | ( |  | ) | const
| virtual inherited

See FLAC__stream_encoder_get_bits_per_sample()

## ◆ get_sample_rate()

virtual uint32_t FLAC::Encoder::Stream::get_sample_rate | ( |  | ) | const
| virtual inherited

See FLAC__stream_encoder_get_sample_rate()

## ◆ get_blocksize()

virtual uint32_t FLAC::Encoder::Stream::get_blocksize | ( |  | ) | const
| virtual inherited

See FLAC__stream_encoder_get_blocksize()

## ◆ get_max_lpc_order()

virtual uint32_t FLAC::Encoder::Stream::get_max_lpc_order | ( |  | ) | const
| virtual inherited

See FLAC__stream_encoder_get_max_lpc_order()

## ◆ get_qlp_coeff_precision()

virtual uint32_t FLAC::Encoder::Stream::get_qlp_coeff_precision | ( |  | ) | const
| virtual inherited

See FLAC__stream_encoder_get_qlp_coeff_precision()

## ◆ get_do_qlp_coeff_prec_search()

virtual bool FLAC::Encoder::Stream::get_do_qlp_coeff_prec_search | ( |  | ) | const
| virtual inherited

See FLAC__stream_encoder_get_do_qlp_coeff_prec_search()

## ◆ get_do_escape_coding()

virtual bool FLAC::Encoder::Stream::get_do_escape_coding | ( |  | ) | const
| virtual inherited

See FLAC__stream_encoder_get_do_escape_coding()

## ◆ get_do_exhaustive_model_search()

virtual bool FLAC::Encoder::Stream::get_do_exhaustive_model_search | ( |  | ) | const
| virtual inherited

See FLAC__stream_encoder_get_do_exhaustive_model_search()

## ◆ get_min_residual_partition_order()

virtual uint32_t FLAC::Encoder::Stream::get_min_residual_partition_order | ( |  | ) | const
| virtual inherited

See FLAC__stream_encoder_get_min_residual_partition_order()

## ◆ get_max_residual_partition_order()

virtual uint32_t FLAC::Encoder::Stream::get_max_residual_partition_order | ( |  | ) | const
| virtual inherited

See FLAC__stream_encoder_get_max_residual_partition_order()

## ◆ get_rice_parameter_search_dist()

virtual uint32_t FLAC::Encoder::Stream::get_rice_parameter_search_dist | ( |  | ) | const
| virtual inherited

See FLAC__stream_encoder_get_rice_parameter_search_dist()

## ◆ get_total_samples_estimate()

virtual FLAC__uint64 FLAC::Encoder::Stream::get_total_samples_estimate | ( |  | ) | const
| virtual inherited

See FLAC__stream_encoder_get_total_samples_estimate()

## ◆ get_limit_min_bitrate()

virtual bool FLAC::Encoder::Stream::get_limit_min_bitrate | ( |  | ) | const
| virtual inherited

See FLAC__stream_encoder_get_limit_min_bitrate()

## ◆ finish()

virtual bool FLAC::Encoder::Stream::finish | ( |  | ) |
| virtual inherited

See FLAC__stream_encoder_finish()

## ◆ process()

virtual bool FLAC::Encoder::Stream::process | ( | const FLAC__int32 *const | buffer[],
|  | uint32_t | samples
| ) |  |
| virtual inherited

See FLAC__stream_encoder_process()

## ◆ process_interleaved()

virtual bool FLAC::Encoder::Stream::process_interleaved | ( | const FLAC__int32 | buffer[],
|  | uint32_t | samples
| ) |  |
| virtual inherited

See FLAC__stream_encoder_process_interleaved()

## ◆ read_callback()

virtual ::FLAC__StreamEncoderReadStatus FLAC::Encoder::Stream::read_callback | ( | FLAC__byte | buffer[],
|  | size_t * | bytes
| ) |  |
| protected inherited

See FLAC__StreamEncoderReadCallback.

## ◆ seek_callback()

virtual ::FLAC__StreamEncoderSeekStatus FLAC::Encoder::Stream::seek_callback | ( | FLAC__uint64 | absolute_byte_offset | ) |
| protected inherited

See FLAC__StreamEncoderSeekCallback.

## ◆ tell_callback()

virtual ::FLAC__StreamEncoderTellStatus FLAC::Encoder::Stream::tell_callback | ( | FLAC__uint64 * | absolute_byte_offset | ) |
| protected inherited

See FLAC__StreamEncoderTellCallback.

## ◆ metadata_callback()

virtual void FLAC::Encoder::Stream::metadata_callback | ( | const ::FLAC__StreamMetadata * | metadata | ) |
| protected virtual inherited

See FLAC__StreamEncoderMetadataCallback.

The documentation for this class was generated from the following file:

- include/FLAC++/encoder.h

Copyright (c) 2000-2009 Josh Coalson Copyright (c) 2011-2022 Xiph.Org Foundation