2002-05-29 05:49:50 +00:00
|
|
|
/* libFLAC++ - Free Lossless Audio Codec library
|
2006-04-25 06:59:33 +00:00
|
|
|
* Copyright (C) 2002,2003,2004,2005,2006 Josh Coalson
|
2002-05-29 05:49:50 +00:00
|
|
|
*
|
2003-01-31 23:34:56 +00:00
|
|
|
* Redistribution and use in source and binary forms, with or without
|
|
|
|
|
* modification, are permitted provided that the following conditions
|
|
|
|
|
* are met:
|
2002-05-29 05:49:50 +00:00
|
|
|
*
|
2003-01-31 23:34:56 +00:00
|
|
|
* - Redistributions of source code must retain the above copyright
|
|
|
|
|
* notice, this list of conditions and the following disclaimer.
|
2002-05-29 05:49:50 +00:00
|
|
|
*
|
2003-01-31 23:34:56 +00:00
|
|
|
* - Redistributions in binary form must reproduce the above copyright
|
|
|
|
|
* notice, this list of conditions and the following disclaimer in the
|
|
|
|
|
* documentation and/or other materials provided with the distribution.
|
|
|
|
|
*
|
|
|
|
|
* - Neither the name of the Xiph.org Foundation nor the names of its
|
|
|
|
|
* contributors may be used to endorse or promote products derived from
|
|
|
|
|
* this software without specific prior written permission.
|
|
|
|
|
*
|
|
|
|
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
|
|
|
|
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
|
|
|
|
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
|
|
|
|
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR
|
|
|
|
|
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
|
|
|
|
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
|
|
|
|
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
|
|
|
|
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
|
|
|
|
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
|
|
|
|
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
|
|
|
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
2002-05-29 05:49:50 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
#include "FLAC++/encoder.h"
|
2004-07-22 01:04:22 +00:00
|
|
|
#include "FLAC++/metadata.h"
|
2002-05-29 05:49:50 +00:00
|
|
|
#include "FLAC/assert.h"
|
|
|
|
|
|
2003-12-18 05:16:44 +00:00
|
|
|
#ifdef _MSC_VER
|
|
|
|
|
// warning C4800: 'int' : forcing to bool 'true' or 'false' (performance warning)
|
|
|
|
|
#pragma warning ( disable : 4800 )
|
|
|
|
|
#endif
|
|
|
|
|
|
2002-05-29 05:49:50 +00:00
|
|
|
namespace FLAC {
|
|
|
|
|
namespace Encoder {
|
|
|
|
|
|
|
|
|
|
Stream::Stream():
|
|
|
|
|
encoder_(::FLAC__stream_encoder_new())
|
|
|
|
|
{ }
|
|
|
|
|
|
|
|
|
|
Stream::~Stream()
|
|
|
|
|
{
|
|
|
|
|
if(0 != encoder_) {
|
|
|
|
|
::FLAC__stream_encoder_finish(encoder_);
|
|
|
|
|
::FLAC__stream_encoder_delete(encoder_);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool Stream::is_valid() const
|
|
|
|
|
{
|
|
|
|
|
return 0 != encoder_;
|
|
|
|
|
}
|
|
|
|
|
|
2002-08-03 21:56:15 +00:00
|
|
|
bool Stream::set_verify(bool value)
|
|
|
|
|
{
|
|
|
|
|
FLAC__ASSERT(is_valid());
|
|
|
|
|
return (bool)::FLAC__stream_encoder_set_verify(encoder_, value);
|
|
|
|
|
}
|
|
|
|
|
|
2002-05-29 05:49:50 +00:00
|
|
|
bool Stream::set_streamable_subset(bool value)
|
|
|
|
|
{
|
|
|
|
|
FLAC__ASSERT(is_valid());
|
2002-06-01 06:31:27 +00:00
|
|
|
return (bool)::FLAC__stream_encoder_set_streamable_subset(encoder_, value);
|
2002-05-29 05:49:50 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool Stream::set_do_mid_side_stereo(bool value)
|
|
|
|
|
{
|
|
|
|
|
FLAC__ASSERT(is_valid());
|
2002-06-01 06:31:27 +00:00
|
|
|
return (bool)::FLAC__stream_encoder_set_do_mid_side_stereo(encoder_, value);
|
2002-05-29 05:49:50 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool Stream::set_loose_mid_side_stereo(bool value)
|
|
|
|
|
{
|
|
|
|
|
FLAC__ASSERT(is_valid());
|
2002-06-01 06:31:27 +00:00
|
|
|
return (bool)::FLAC__stream_encoder_set_loose_mid_side_stereo(encoder_, value);
|
2002-05-29 05:49:50 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool Stream::set_channels(unsigned value)
|
|
|
|
|
{
|
|
|
|
|
FLAC__ASSERT(is_valid());
|
2002-06-01 06:31:27 +00:00
|
|
|
return (bool)::FLAC__stream_encoder_set_channels(encoder_, value);
|
2002-05-29 05:49:50 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool Stream::set_bits_per_sample(unsigned value)
|
|
|
|
|
{
|
|
|
|
|
FLAC__ASSERT(is_valid());
|
2002-06-01 06:31:27 +00:00
|
|
|
return (bool)::FLAC__stream_encoder_set_bits_per_sample(encoder_, value);
|
2002-05-29 05:49:50 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool Stream::set_sample_rate(unsigned value)
|
|
|
|
|
{
|
|
|
|
|
FLAC__ASSERT(is_valid());
|
2002-06-01 06:31:27 +00:00
|
|
|
return (bool)::FLAC__stream_encoder_set_sample_rate(encoder_, value);
|
2002-05-29 05:49:50 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool Stream::set_blocksize(unsigned value)
|
|
|
|
|
{
|
|
|
|
|
FLAC__ASSERT(is_valid());
|
2002-06-01 06:31:27 +00:00
|
|
|
return (bool)::FLAC__stream_encoder_set_blocksize(encoder_, value);
|
2002-05-29 05:49:50 +00:00
|
|
|
}
|
|
|
|
|
|
2006-05-03 00:20:47 +00:00
|
|
|
bool Stream::set_apodization(const char *specification)
|
2006-05-01 05:27:13 +00:00
|
|
|
{
|
|
|
|
|
FLAC__ASSERT(is_valid());
|
|
|
|
|
return (bool)::FLAC__stream_encoder_set_apodization(encoder_, specification);
|
|
|
|
|
}
|
|
|
|
|
|
2002-05-29 05:49:50 +00:00
|
|
|
bool Stream::set_max_lpc_order(unsigned value)
|
|
|
|
|
{
|
|
|
|
|
FLAC__ASSERT(is_valid());
|
2002-06-01 06:31:27 +00:00
|
|
|
return (bool)::FLAC__stream_encoder_set_max_lpc_order(encoder_, value);
|
2002-05-29 05:49:50 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool Stream::set_qlp_coeff_precision(unsigned value)
|
|
|
|
|
{
|
|
|
|
|
FLAC__ASSERT(is_valid());
|
2002-06-01 06:31:27 +00:00
|
|
|
return (bool)::FLAC__stream_encoder_set_qlp_coeff_precision(encoder_, value);
|
2002-05-29 05:49:50 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool Stream::set_do_qlp_coeff_prec_search(bool value)
|
|
|
|
|
{
|
|
|
|
|
FLAC__ASSERT(is_valid());
|
2002-06-01 06:31:27 +00:00
|
|
|
return (bool)::FLAC__stream_encoder_set_do_qlp_coeff_prec_search(encoder_, value);
|
2002-05-29 05:49:50 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool Stream::set_do_escape_coding(bool value)
|
|
|
|
|
{
|
|
|
|
|
FLAC__ASSERT(is_valid());
|
2002-06-01 06:31:27 +00:00
|
|
|
return (bool)::FLAC__stream_encoder_set_do_escape_coding(encoder_, value);
|
2002-05-29 05:49:50 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool Stream::set_do_exhaustive_model_search(bool value)
|
|
|
|
|
{
|
|
|
|
|
FLAC__ASSERT(is_valid());
|
2002-06-01 06:31:27 +00:00
|
|
|
return (bool)::FLAC__stream_encoder_set_do_exhaustive_model_search(encoder_, value);
|
2002-05-29 05:49:50 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool Stream::set_min_residual_partition_order(unsigned value)
|
|
|
|
|
{
|
|
|
|
|
FLAC__ASSERT(is_valid());
|
2002-06-01 06:31:27 +00:00
|
|
|
return (bool)::FLAC__stream_encoder_set_min_residual_partition_order(encoder_, value);
|
2002-05-29 05:49:50 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool Stream::set_max_residual_partition_order(unsigned value)
|
|
|
|
|
{
|
|
|
|
|
FLAC__ASSERT(is_valid());
|
2002-06-01 06:31:27 +00:00
|
|
|
return (bool)::FLAC__stream_encoder_set_max_residual_partition_order(encoder_, value);
|
2002-05-29 05:49:50 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool Stream::set_rice_parameter_search_dist(unsigned value)
|
|
|
|
|
{
|
|
|
|
|
FLAC__ASSERT(is_valid());
|
2002-06-01 06:31:27 +00:00
|
|
|
return (bool)::FLAC__stream_encoder_set_rice_parameter_search_dist(encoder_, value);
|
2002-05-29 05:49:50 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool Stream::set_total_samples_estimate(FLAC__uint64 value)
|
|
|
|
|
{
|
|
|
|
|
FLAC__ASSERT(is_valid());
|
2002-06-01 06:31:27 +00:00
|
|
|
return (bool)::FLAC__stream_encoder_set_total_samples_estimate(encoder_, value);
|
2002-05-29 05:49:50 +00:00
|
|
|
}
|
|
|
|
|
|
2002-06-08 04:53:42 +00:00
|
|
|
bool Stream::set_metadata(::FLAC__StreamMetadata **metadata, unsigned num_blocks)
|
2002-05-29 05:49:50 +00:00
|
|
|
{
|
|
|
|
|
FLAC__ASSERT(is_valid());
|
2002-06-01 06:31:27 +00:00
|
|
|
return (bool)::FLAC__stream_encoder_set_metadata(encoder_, metadata, num_blocks);
|
2002-05-29 05:49:50 +00:00
|
|
|
}
|
|
|
|
|
|
2004-07-22 01:04:22 +00:00
|
|
|
bool Stream::set_metadata(FLAC::Metadata::Prototype **metadata, unsigned num_blocks)
|
|
|
|
|
{
|
|
|
|
|
FLAC__ASSERT(is_valid());
|
2005-01-27 03:55:35 +00:00
|
|
|
#if (defined _MSC_VER) || (defined __SUNPRO_CC)
|
2004-07-23 05:16:11 +00:00
|
|
|
// MSVC++ can't handle:
|
|
|
|
|
// ::FLAC__StreamMetadata *m[num_blocks];
|
|
|
|
|
// so we do this ugly workaround
|
|
|
|
|
::FLAC__StreamMetadata **m = new ::FLAC__StreamMetadata*[num_blocks];
|
|
|
|
|
#else
|
2004-07-22 01:04:22 +00:00
|
|
|
::FLAC__StreamMetadata *m[num_blocks];
|
2004-07-23 05:16:11 +00:00
|
|
|
#endif
|
2004-07-22 01:04:22 +00:00
|
|
|
for(unsigned i = 0; i < num_blocks; i++) {
|
2006-09-13 01:42:27 +00:00
|
|
|
// we can get away with the const_cast since we know the encoder will only correct the is_last flags
|
|
|
|
|
m[i] = const_cast< ::FLAC__StreamMetadata*>((const ::FLAC__StreamMetadata*)metadata[i]);
|
2004-07-22 01:04:22 +00:00
|
|
|
}
|
2005-01-27 03:55:35 +00:00
|
|
|
#if (defined _MSC_VER) || (defined __SUNPRO_CC)
|
2004-07-23 05:16:11 +00:00
|
|
|
// complete the hack
|
|
|
|
|
const bool ok = (bool)::FLAC__stream_encoder_set_metadata(encoder_, m, num_blocks);
|
|
|
|
|
delete [] m;
|
|
|
|
|
return ok;
|
|
|
|
|
#else
|
2004-07-22 01:04:22 +00:00
|
|
|
return (bool)::FLAC__stream_encoder_set_metadata(encoder_, m, num_blocks);
|
2004-07-23 05:16:11 +00:00
|
|
|
#endif
|
2004-07-22 01:04:22 +00:00
|
|
|
}
|
|
|
|
|
|
2002-05-29 05:49:50 +00:00
|
|
|
Stream::State Stream::get_state() const
|
|
|
|
|
{
|
|
|
|
|
FLAC__ASSERT(is_valid());
|
|
|
|
|
return State(::FLAC__stream_encoder_get_state(encoder_));
|
|
|
|
|
}
|
|
|
|
|
|
2002-08-03 21:56:15 +00:00
|
|
|
Decoder::Stream::State Stream::get_verify_decoder_state() const
|
|
|
|
|
{
|
|
|
|
|
FLAC__ASSERT(is_valid());
|
|
|
|
|
return Decoder::Stream::State(::FLAC__stream_encoder_get_verify_decoder_state(encoder_));
|
|
|
|
|
}
|
|
|
|
|
|
2002-08-07 23:54:55 +00:00
|
|
|
void Stream::get_verify_decoder_error_stats(FLAC__uint64 *absolute_sample, unsigned *frame_number, unsigned *channel, unsigned *sample, FLAC__int32 *expected, FLAC__int32 *got)
|
|
|
|
|
{
|
|
|
|
|
FLAC__ASSERT(is_valid());
|
2002-08-21 05:27:01 +00:00
|
|
|
::FLAC__stream_encoder_get_verify_decoder_error_stats(encoder_, absolute_sample, frame_number, channel, sample, expected, got);
|
2002-08-07 23:54:55 +00:00
|
|
|
}
|
|
|
|
|
|
2002-08-03 21:56:15 +00:00
|
|
|
bool Stream::get_verify() const
|
|
|
|
|
{
|
|
|
|
|
FLAC__ASSERT(is_valid());
|
|
|
|
|
return (bool)::FLAC__stream_encoder_get_verify(encoder_);
|
|
|
|
|
}
|
|
|
|
|
|
2002-05-29 05:49:50 +00:00
|
|
|
bool Stream::get_streamable_subset() const
|
|
|
|
|
{
|
|
|
|
|
FLAC__ASSERT(is_valid());
|
2002-06-01 06:31:27 +00:00
|
|
|
return (bool)::FLAC__stream_encoder_get_streamable_subset(encoder_);
|
2002-05-29 05:49:50 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool Stream::get_do_mid_side_stereo() const
|
|
|
|
|
{
|
|
|
|
|
FLAC__ASSERT(is_valid());
|
2002-06-01 06:31:27 +00:00
|
|
|
return (bool)::FLAC__stream_encoder_get_do_mid_side_stereo(encoder_);
|
2002-05-29 05:49:50 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool Stream::get_loose_mid_side_stereo() const
|
|
|
|
|
{
|
|
|
|
|
FLAC__ASSERT(is_valid());
|
2002-06-01 06:31:27 +00:00
|
|
|
return (bool)::FLAC__stream_encoder_get_loose_mid_side_stereo(encoder_);
|
2002-05-29 05:49:50 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
unsigned Stream::get_channels() const
|
|
|
|
|
{
|
|
|
|
|
FLAC__ASSERT(is_valid());
|
|
|
|
|
return ::FLAC__stream_encoder_get_channels(encoder_);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
unsigned Stream::get_bits_per_sample() const
|
|
|
|
|
{
|
|
|
|
|
FLAC__ASSERT(is_valid());
|
|
|
|
|
return ::FLAC__stream_encoder_get_bits_per_sample(encoder_);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
unsigned Stream::get_sample_rate() const
|
|
|
|
|
{
|
|
|
|
|
FLAC__ASSERT(is_valid());
|
|
|
|
|
return ::FLAC__stream_encoder_get_sample_rate(encoder_);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
unsigned Stream::get_blocksize() const
|
|
|
|
|
{
|
|
|
|
|
FLAC__ASSERT(is_valid());
|
|
|
|
|
return ::FLAC__stream_encoder_get_blocksize(encoder_);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
unsigned Stream::get_max_lpc_order() const
|
|
|
|
|
{
|
|
|
|
|
FLAC__ASSERT(is_valid());
|
|
|
|
|
return ::FLAC__stream_encoder_get_max_lpc_order(encoder_);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
unsigned Stream::get_qlp_coeff_precision() const
|
|
|
|
|
{
|
|
|
|
|
FLAC__ASSERT(is_valid());
|
|
|
|
|
return ::FLAC__stream_encoder_get_qlp_coeff_precision(encoder_);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool Stream::get_do_qlp_coeff_prec_search() const
|
|
|
|
|
{
|
|
|
|
|
FLAC__ASSERT(is_valid());
|
2002-06-01 06:31:27 +00:00
|
|
|
return (bool)::FLAC__stream_encoder_get_do_qlp_coeff_prec_search(encoder_);
|
2002-05-29 05:49:50 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool Stream::get_do_escape_coding() const
|
|
|
|
|
{
|
|
|
|
|
FLAC__ASSERT(is_valid());
|
2002-06-01 06:31:27 +00:00
|
|
|
return (bool)::FLAC__stream_encoder_get_do_escape_coding(encoder_);
|
2002-05-29 05:49:50 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool Stream::get_do_exhaustive_model_search() const
|
|
|
|
|
{
|
|
|
|
|
FLAC__ASSERT(is_valid());
|
2002-06-01 06:31:27 +00:00
|
|
|
return (bool)::FLAC__stream_encoder_get_do_exhaustive_model_search(encoder_);
|
2002-05-29 05:49:50 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
unsigned Stream::get_min_residual_partition_order() const
|
|
|
|
|
{
|
|
|
|
|
FLAC__ASSERT(is_valid());
|
|
|
|
|
return ::FLAC__stream_encoder_get_min_residual_partition_order(encoder_);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
unsigned Stream::get_max_residual_partition_order() const
|
|
|
|
|
{
|
|
|
|
|
FLAC__ASSERT(is_valid());
|
|
|
|
|
return ::FLAC__stream_encoder_get_max_residual_partition_order(encoder_);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
unsigned Stream::get_rice_parameter_search_dist() const
|
|
|
|
|
{
|
|
|
|
|
FLAC__ASSERT(is_valid());
|
|
|
|
|
return ::FLAC__stream_encoder_get_rice_parameter_search_dist(encoder_);
|
|
|
|
|
}
|
|
|
|
|
|
2002-08-02 07:38:20 +00:00
|
|
|
FLAC__uint64 Stream::get_total_samples_estimate() const
|
|
|
|
|
{
|
|
|
|
|
FLAC__ASSERT(is_valid());
|
|
|
|
|
return ::FLAC__stream_encoder_get_total_samples_estimate(encoder_);
|
|
|
|
|
}
|
|
|
|
|
|
2006-09-13 01:42:27 +00:00
|
|
|
::FLAC__StreamEncoderInitStatus Stream::init()
|
2002-05-29 05:49:50 +00:00
|
|
|
{
|
|
|
|
|
FLAC__ASSERT(is_valid());
|
2006-09-13 01:42:27 +00:00
|
|
|
return ::FLAC__stream_encoder_init_stream(encoder_, write_callback_, seek_callback_, tell_callback_, metadata_callback_, /*client_data=*/(void*)this);
|
2002-05-29 05:49:50 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void Stream::finish()
|
|
|
|
|
{
|
|
|
|
|
FLAC__ASSERT(is_valid());
|
|
|
|
|
::FLAC__stream_encoder_finish(encoder_);
|
|
|
|
|
}
|
|
|
|
|
|
2002-06-07 05:27:37 +00:00
|
|
|
bool Stream::process(const FLAC__int32 * const buffer[], unsigned samples)
|
2002-05-29 05:49:50 +00:00
|
|
|
{
|
|
|
|
|
FLAC__ASSERT(is_valid());
|
2002-06-07 05:27:37 +00:00
|
|
|
return (bool)::FLAC__stream_encoder_process(encoder_, buffer, samples);
|
2002-05-29 05:49:50 +00:00
|
|
|
}
|
|
|
|
|
|
2002-06-07 05:27:37 +00:00
|
|
|
bool Stream::process_interleaved(const FLAC__int32 buffer[], unsigned samples)
|
2002-05-29 05:49:50 +00:00
|
|
|
{
|
|
|
|
|
FLAC__ASSERT(is_valid());
|
2002-06-07 05:27:37 +00:00
|
|
|
return (bool)::FLAC__stream_encoder_process_interleaved(encoder_, buffer, samples);
|
2002-05-29 05:49:50 +00:00
|
|
|
}
|
|
|
|
|
|
2006-09-13 01:42:27 +00:00
|
|
|
::FLAC__StreamEncoderSeekStatus Stream::seek_callback(FLAC__uint64 absolute_byte_offset)
|
|
|
|
|
{
|
|
|
|
|
(void)absolute_byte_offset;
|
|
|
|
|
return ::FLAC__STREAM_ENCODER_SEEK_STATUS_UNSUPPORTED;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
::FLAC__StreamEncoderTellStatus Stream::tell_callback(FLAC__uint64 *absolute_byte_offset)
|
|
|
|
|
{
|
|
|
|
|
(void)absolute_byte_offset;
|
|
|
|
|
return ::FLAC__STREAM_ENCODER_TELL_STATUS_UNSUPPORTED;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void Stream::metadata_callback(const ::FLAC__StreamMetadata *metadata)
|
|
|
|
|
{
|
|
|
|
|
(void)metadata;
|
|
|
|
|
}
|
|
|
|
|
|
2002-05-29 05:49:50 +00:00
|
|
|
::FLAC__StreamEncoderWriteStatus Stream::write_callback_(const ::FLAC__StreamEncoder *encoder, const FLAC__byte buffer[], unsigned bytes, unsigned samples, unsigned current_frame, void *client_data)
|
|
|
|
|
{
|
|
|
|
|
(void)encoder;
|
|
|
|
|
FLAC__ASSERT(0 != client_data);
|
|
|
|
|
Stream *instance = reinterpret_cast<Stream *>(client_data);
|
|
|
|
|
FLAC__ASSERT(0 != instance);
|
|
|
|
|
return instance->write_callback(buffer, bytes, samples, current_frame);
|
|
|
|
|
}
|
|
|
|
|
|
2006-09-13 01:42:27 +00:00
|
|
|
::FLAC__StreamEncoderSeekStatus Stream::seek_callback_(const ::FLAC__StreamEncoder *encoder, FLAC__uint64 absolute_byte_offset, void *client_data)
|
|
|
|
|
{
|
|
|
|
|
(void)encoder;
|
|
|
|
|
FLAC__ASSERT(0 != client_data);
|
|
|
|
|
Stream *instance = reinterpret_cast<Stream *>(client_data);
|
|
|
|
|
FLAC__ASSERT(0 != instance);
|
|
|
|
|
return instance->seek_callback(absolute_byte_offset);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
::FLAC__StreamEncoderTellStatus Stream::tell_callback_(const ::FLAC__StreamEncoder *encoder, FLAC__uint64 *absolute_byte_offset, void *client_data)
|
|
|
|
|
{
|
|
|
|
|
(void)encoder;
|
|
|
|
|
FLAC__ASSERT(0 != client_data);
|
|
|
|
|
Stream *instance = reinterpret_cast<Stream *>(client_data);
|
|
|
|
|
FLAC__ASSERT(0 != instance);
|
|
|
|
|
return instance->tell_callback(absolute_byte_offset);
|
|
|
|
|
}
|
|
|
|
|
|
2002-06-08 04:53:42 +00:00
|
|
|
void Stream::metadata_callback_(const ::FLAC__StreamEncoder *encoder, const ::FLAC__StreamMetadata *metadata, void *client_data)
|
2002-05-29 05:49:50 +00:00
|
|
|
{
|
|
|
|
|
(void)encoder;
|
|
|
|
|
FLAC__ASSERT(0 != client_data);
|
|
|
|
|
Stream *instance = reinterpret_cast<Stream *>(client_data);
|
|
|
|
|
FLAC__ASSERT(0 != instance);
|
|
|
|
|
instance->metadata_callback(metadata);
|
|
|
|
|
}
|
|
|
|
|
|
2005-01-25 02:27:20 +00:00
|
|
|
}
|
|
|
|
|
}
|