2002-08-05 06:49:45 +00:00
|
|
|
/* libOggFLAC - Free Lossless Audio Codec + Ogg library
|
|
|
|
* Copyright (C) 2002 Josh Coalson
|
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Library General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Library General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Library General Public
|
|
|
|
* License along with this library; if not, write to the
|
|
|
|
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
|
|
|
* Boston, MA 02111-1307, USA.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef OggFLAC__STREAM_ENCODER_H
|
|
|
|
#define OggFLAC__STREAM_ENCODER_H
|
|
|
|
|
|
|
|
#include "FLAC/stream_encoder.h"
|
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
/** \file include/OggFLAC/stream_encoder.h
|
|
|
|
*
|
|
|
|
* \brief
|
|
|
|
* This module contains the functions which implement the stream
|
|
|
|
* encoder.
|
|
|
|
*
|
|
|
|
* See the detailed documentation in the
|
|
|
|
* \link oggflac_stream_encoder stream encoder \endlink module.
|
|
|
|
*/
|
|
|
|
|
|
|
|
/** \defgroup oggflac_encoder OggFLAC/ *_encoder.h: encoder interfaces
|
|
|
|
* \ingroup oggflac
|
|
|
|
*
|
|
|
|
* \brief
|
|
|
|
* This module describes the three encoder layers provided by libOggFLAC.
|
|
|
|
*
|
|
|
|
* libOggFLAC provides the same three layers of access as libFLAC and the
|
|
|
|
* interface is identical. See the \link flac_encoder FLAC encoder module
|
|
|
|
* \endlink for full documentation.
|
|
|
|
*/
|
|
|
|
|
|
|
|
/** \defgroup oggflac_stream_encoder OggFLAC/stream_encoder.h: stream encoder interface
|
|
|
|
* \ingroup oggflac_encoder
|
|
|
|
*
|
|
|
|
* \brief
|
|
|
|
* This module contains the functions which implement the stream
|
|
|
|
* encoder.
|
|
|
|
*
|
|
|
|
* The interface here is identical to FLAC's stream encoder. See the
|
|
|
|
* defaults, including the callbacks. See the \link flac_stream_encoder
|
|
|
|
* FLAC stream encoder module \endlink for full documentation.
|
2002-08-06 05:38:55 +00:00
|
|
|
*
|
2002-08-05 06:49:45 +00:00
|
|
|
* \{
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
2002-08-06 05:38:55 +00:00
|
|
|
/** State values for an OggFLAC__StreamEncoder
|
2002-08-05 06:49:45 +00:00
|
|
|
*
|
|
|
|
* The encoder's state can be obtained by calling OggFLAC__stream_encoder_get_state().
|
|
|
|
*/
|
|
|
|
typedef enum {
|
|
|
|
|
|
|
|
OggFLAC__STREAM_ENCODER_OK = 0,
|
|
|
|
/**< The encoder is in the normal OK state. */
|
|
|
|
|
2002-08-06 06:09:06 +00:00
|
|
|
OggFLAC__STREAM_ENCODER_OGG_ERROR,
|
|
|
|
/**< An error occurred in the underlying Ogg layer. */
|
|
|
|
|
2002-08-06 05:38:55 +00:00
|
|
|
OggFLAC__STREAM_ENCODER_FLAC_STREAM_ENCODER_ERROR,
|
2002-08-05 06:49:45 +00:00
|
|
|
/**< An error occurred in the underlying FLAC stream encoder;
|
2002-08-06 05:38:55 +00:00
|
|
|
* check OggFLAC__stream_encoder_get_FLAC_stream_encoder_state().
|
2002-08-05 06:49:45 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
OggFLAC__STREAM_ENCODER_INVALID_CALLBACK,
|
|
|
|
/**< The encoder was initialized before setting all the required callbacks. */
|
|
|
|
|
|
|
|
OggFLAC__STREAM_ENCODER_MEMORY_ALLOCATION_ERROR,
|
|
|
|
/**< Memory allocation failed. */
|
|
|
|
|
|
|
|
OggFLAC__STREAM_ENCODER_ALREADY_INITIALIZED,
|
|
|
|
/**< OggFLAC__stream_encoder_init() was called when the encoder was
|
|
|
|
* already initialized, usually because
|
|
|
|
* OggFLAC__stream_encoder_finish() was not called.
|
|
|
|
*/
|
|
|
|
|
|
|
|
OggFLAC__STREAM_ENCODER_UNINITIALIZED
|
|
|
|
/**< The encoder is in the uninitialized state. */
|
|
|
|
|
|
|
|
} OggFLAC__StreamEncoderState;
|
|
|
|
|
|
|
|
/** Maps an OggFLAC__StreamEncoderState to a C string.
|
|
|
|
*
|
2002-08-06 05:38:55 +00:00
|
|
|
* Using an OggFLAC__StreamEncoderState as the index to this array
|
2002-08-05 06:49:45 +00:00
|
|
|
* will give the string equivalent. The contents should not be modified.
|
|
|
|
*/
|
|
|
|
extern const char * const OggFLAC__StreamEncoderStateString[];
|
|
|
|
|
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
*
|
|
|
|
* class OggFLAC__StreamEncoder
|
|
|
|
*
|
|
|
|
***********************************************************************/
|
|
|
|
|
|
|
|
struct OggFLAC__StreamEncoderProtected;
|
|
|
|
struct OggFLAC__StreamEncoderPrivate;
|
|
|
|
/** The opaque structure definition for the stream encoder type.
|
|
|
|
* See the \link oggflac_stream_encoder stream encoder module \endlink
|
|
|
|
* for a detailed description.
|
|
|
|
*/
|
|
|
|
typedef struct {
|
|
|
|
struct OggFLAC__StreamEncoderProtected *protected_; /* avoid the C++ keyword 'protected' */
|
|
|
|
struct OggFLAC__StreamEncoderPrivate *private_; /* avoid the C++ keyword 'private' */
|
|
|
|
} OggFLAC__StreamEncoder;
|
|
|
|
|
|
|
|
/*@@@@ document: */
|
2002-08-07 17:39:24 +00:00
|
|
|
typedef FLAC__StreamEncoderWriteStatus (*OggFLAC__StreamEncoderWriteCallback)(const OggFLAC__StreamEncoder *encoder, const FLAC__byte buffer[], unsigned bytes, unsigned samples, unsigned current_frame, void *client_data);
|
2002-08-05 06:49:45 +00:00
|
|
|
|
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
*
|
|
|
|
* Class constructor/destructor
|
|
|
|
*
|
|
|
|
***********************************************************************/
|
|
|
|
|
|
|
|
/** Create a new stream encoder instance. The instance is created with
|
|
|
|
* default settings; see the individual OggFLAC__stream_encoder_set_*()
|
|
|
|
* functions for each setting's default.
|
|
|
|
*
|
|
|
|
* \retval OggFLAC__StreamEncoder*
|
|
|
|
* \c NULL if there was an error allocating memory, else the new instance.
|
|
|
|
*/
|
|
|
|
OggFLAC__StreamEncoder *OggFLAC__stream_encoder_new();
|
|
|
|
|
|
|
|
/** Free an encoder instance. Deletes the object pointed to by \a encoder.
|
|
|
|
*
|
|
|
|
* \param encoder A pointer to an existing encoder.
|
|
|
|
* \assert
|
|
|
|
* \code encoder != NULL \endcode
|
|
|
|
*/
|
|
|
|
void OggFLAC__stream_encoder_delete(OggFLAC__StreamEncoder *encoder);
|
|
|
|
|
2002-08-06 05:38:55 +00:00
|
|
|
|
2002-08-05 06:49:45 +00:00
|
|
|
/***********************************************************************
|
|
|
|
*
|
|
|
|
* Public class method prototypes
|
|
|
|
*
|
|
|
|
***********************************************************************/
|
|
|
|
|
2002-08-06 05:38:55 +00:00
|
|
|
/** This is inherited from FLAC__StreamEncoder; see FLAC__stream_encoder_set_verify()
|
|
|
|
*
|
|
|
|
* \default \c false
|
|
|
|
* \param encoder An encoder instance to set.
|
|
|
|
* \param value Flag value (see above).
|
|
|
|
* \assert
|
|
|
|
* \code encoder != NULL \endcode
|
|
|
|
* \retval FLAC__bool
|
|
|
|
* \c false if the encoder is already initialized, else \c true.
|
2002-08-05 06:49:45 +00:00
|
|
|
*/
|
|
|
|
FLAC__bool OggFLAC__stream_encoder_set_verify(OggFLAC__StreamEncoder *encoder, FLAC__bool value);
|
|
|
|
|
2002-08-06 05:38:55 +00:00
|
|
|
/** This is inherited from FLAC__StreamEncoder; see FLAC__stream_encoder_set_streamable_subset()
|
|
|
|
*
|
|
|
|
* \default \c true
|
|
|
|
* \param encoder An encoder instance to set.
|
|
|
|
* \param value Flag value (see above).
|
|
|
|
* \assert
|
|
|
|
* \code encoder != NULL \endcode
|
|
|
|
* \retval FLAC__bool
|
|
|
|
* \c false if the encoder is already initialized, else \c true.
|
2002-08-05 06:49:45 +00:00
|
|
|
*/
|
|
|
|
FLAC__bool OggFLAC__stream_encoder_set_streamable_subset(OggFLAC__StreamEncoder *encoder, FLAC__bool value);
|
|
|
|
|
2002-08-06 05:38:55 +00:00
|
|
|
/** This is inherited from FLAC__StreamEncoder; see FLAC__stream_encoder_set_do_mid_side_stereo()
|
|
|
|
*
|
|
|
|
* \default \c false
|
|
|
|
* \param encoder An encoder instance to set.
|
|
|
|
* \param value Flag value (see above).
|
|
|
|
* \assert
|
|
|
|
* \code encoder != NULL \endcode
|
|
|
|
* \retval FLAC__bool
|
|
|
|
* \c false if the encoder is already initialized, else \c true.
|
2002-08-05 06:49:45 +00:00
|
|
|
*/
|
|
|
|
FLAC__bool OggFLAC__stream_encoder_set_do_mid_side_stereo(OggFLAC__StreamEncoder *encoder, FLAC__bool value);
|
|
|
|
|
2002-08-06 05:38:55 +00:00
|
|
|
/** This is inherited from FLAC__StreamEncoder; see FLAC__stream_encoder_set_loose_mid_side_stereo()
|
|
|
|
*
|
|
|
|
* \default \c false
|
|
|
|
* \param encoder An encoder instance to set.
|
|
|
|
* \param value Flag value (see above).
|
|
|
|
* \assert
|
|
|
|
* \code encoder != NULL \endcode
|
|
|
|
* \retval FLAC__bool
|
|
|
|
* \c false if the encoder is already initialized, else \c true.
|
2002-08-05 06:49:45 +00:00
|
|
|
*/
|
|
|
|
FLAC__bool OggFLAC__stream_encoder_set_loose_mid_side_stereo(OggFLAC__StreamEncoder *encoder, FLAC__bool value);
|
|
|
|
|
2002-08-06 05:38:55 +00:00
|
|
|
/** This is inherited from FLAC__StreamEncoder; see FLAC__stream_encoder_set_channels()
|
|
|
|
*
|
|
|
|
* \default \c 2
|
|
|
|
* \param encoder An encoder instance to set.
|
|
|
|
* \param value See above.
|
|
|
|
* \assert
|
|
|
|
* \code encoder != NULL \endcode
|
|
|
|
* \retval FLAC__bool
|
|
|
|
* \c false if the encoder is already initialized, else \c true.
|
2002-08-05 06:49:45 +00:00
|
|
|
*/
|
|
|
|
FLAC__bool OggFLAC__stream_encoder_set_channels(OggFLAC__StreamEncoder *encoder, unsigned value);
|
|
|
|
|
2002-08-06 05:38:55 +00:00
|
|
|
/** This is inherited from FLAC__StreamEncoder; see FLAC__stream_encoder_set_bits_per_sample()
|
|
|
|
*
|
|
|
|
* \default \c 16
|
|
|
|
* \param encoder An encoder instance to set.
|
|
|
|
* \param value See above.
|
|
|
|
* \assert
|
|
|
|
* \code encoder != NULL \endcode
|
|
|
|
* \retval FLAC__bool
|
|
|
|
* \c false if the encoder is already initialized, else \c true.
|
2002-08-05 06:49:45 +00:00
|
|
|
*/
|
|
|
|
FLAC__bool OggFLAC__stream_encoder_set_bits_per_sample(OggFLAC__StreamEncoder *encoder, unsigned value);
|
|
|
|
|
2002-08-06 05:38:55 +00:00
|
|
|
/** This is inherited from FLAC__StreamEncoder; see FLAC__stream_encoder_set_sample_rate()
|
|
|
|
*
|
|
|
|
* \default \c 44100
|
|
|
|
* \param encoder An encoder instance to set.
|
|
|
|
* \param value See above.
|
|
|
|
* \assert
|
|
|
|
* \code encoder != NULL \endcode
|
|
|
|
* \retval FLAC__bool
|
|
|
|
* \c false if the encoder is already initialized, else \c true.
|
2002-08-05 06:49:45 +00:00
|
|
|
*/
|
|
|
|
FLAC__bool OggFLAC__stream_encoder_set_sample_rate(OggFLAC__StreamEncoder *encoder, unsigned value);
|
|
|
|
|
2002-08-06 05:38:55 +00:00
|
|
|
/** This is inherited from FLAC__StreamEncoder; see FLAC__stream_encoder_set_blocksize()
|
|
|
|
*
|
|
|
|
* \default \c 1152
|
|
|
|
* \param encoder An encoder instance to set.
|
|
|
|
* \param value See above.
|
|
|
|
* \assert
|
|
|
|
* \code encoder != NULL \endcode
|
|
|
|
* \retval FLAC__bool
|
|
|
|
* \c false if the encoder is already initialized, else \c true.
|
2002-08-05 06:49:45 +00:00
|
|
|
*/
|
|
|
|
FLAC__bool OggFLAC__stream_encoder_set_blocksize(OggFLAC__StreamEncoder *encoder, unsigned value);
|
|
|
|
|
2002-08-06 05:38:55 +00:00
|
|
|
/** This is inherited from FLAC__StreamEncoder; see FLAC__stream_encoder_set_max_lpc_order()
|
|
|
|
*
|
|
|
|
* \default \c 0
|
|
|
|
* \param encoder An encoder instance to set.
|
|
|
|
* \param value See above.
|
|
|
|
* \assert
|
|
|
|
* \code encoder != NULL \endcode
|
|
|
|
* \retval FLAC__bool
|
|
|
|
* \c false if the encoder is already initialized, else \c true.
|
2002-08-05 06:49:45 +00:00
|
|
|
*/
|
|
|
|
FLAC__bool OggFLAC__stream_encoder_set_max_lpc_order(OggFLAC__StreamEncoder *encoder, unsigned value);
|
|
|
|
|
2002-08-06 05:38:55 +00:00
|
|
|
/** This is inherited from FLAC__StreamEncoder; see FLAC__stream_encoder_set_qlp_coeff_precision()
|
|
|
|
*
|
|
|
|
* \default \c 0
|
|
|
|
* \param encoder An encoder instance to set.
|
|
|
|
* \param value See above.
|
|
|
|
* \assert
|
|
|
|
* \code encoder != NULL \endcode
|
|
|
|
* \retval FLAC__bool
|
|
|
|
* \c false if the encoder is already initialized, else \c true.
|
2002-08-05 06:49:45 +00:00
|
|
|
*/
|
|
|
|
FLAC__bool OggFLAC__stream_encoder_set_qlp_coeff_precision(OggFLAC__StreamEncoder *encoder, unsigned value);
|
|
|
|
|
2002-08-06 05:38:55 +00:00
|
|
|
/** This is inherited from FLAC__StreamEncoder; see FLAC__stream_encoder_set_qlp_coeff_prec_search()
|
|
|
|
*
|
|
|
|
* \default \c false
|
|
|
|
* \param encoder An encoder instance to set.
|
|
|
|
* \param value See above.
|
|
|
|
* \assert
|
|
|
|
* \code encoder != NULL \endcode
|
|
|
|
* \retval FLAC__bool
|
|
|
|
* \c false if the encoder is already initialized, else \c true.
|
2002-08-05 06:49:45 +00:00
|
|
|
*/
|
|
|
|
FLAC__bool OggFLAC__stream_encoder_set_do_qlp_coeff_prec_search(OggFLAC__StreamEncoder *encoder, FLAC__bool value);
|
|
|
|
|
2002-08-06 05:38:55 +00:00
|
|
|
/** This is inherited from FLAC__StreamEncoder; see FLAC__stream_encoder_set_do_escape_coding()
|
|
|
|
*
|
|
|
|
* \default \c false
|
|
|
|
* \param encoder An encoder instance to set.
|
|
|
|
* \param value See above.
|
|
|
|
* \assert
|
|
|
|
* \code encoder != NULL \endcode
|
|
|
|
* \retval FLAC__bool
|
|
|
|
* \c false if the encoder is already initialized, else \c true.
|
2002-08-05 06:49:45 +00:00
|
|
|
*/
|
|
|
|
FLAC__bool OggFLAC__stream_encoder_set_do_escape_coding(OggFLAC__StreamEncoder *encoder, FLAC__bool value);
|
|
|
|
|
2002-08-06 05:38:55 +00:00
|
|
|
/** This is inherited from FLAC__StreamEncoder; see FLAC__stream_encoder_set_do_exhaustive_model_search()
|
|
|
|
*
|
|
|
|
* \default \c false
|
|
|
|
* \param encoder An encoder instance to set.
|
|
|
|
* \param value See above.
|
|
|
|
* \assert
|
|
|
|
* \code encoder != NULL \endcode
|
|
|
|
* \retval FLAC__bool
|
|
|
|
* \c false if the encoder is already initialized, else \c true.
|
2002-08-05 06:49:45 +00:00
|
|
|
*/
|
|
|
|
FLAC__bool OggFLAC__stream_encoder_set_do_exhaustive_model_search(OggFLAC__StreamEncoder *encoder, FLAC__bool value);
|
|
|
|
|
2002-08-06 05:38:55 +00:00
|
|
|
/** This is inherited from FLAC__StreamEncoder; see FLAC__stream_encoder_set_min_residual_partition_order()
|
|
|
|
*
|
|
|
|
* \default \c 0
|
|
|
|
* \param encoder An encoder instance to set.
|
|
|
|
* \param value See above.
|
|
|
|
* \assert
|
|
|
|
* \code encoder != NULL \endcode
|
|
|
|
* \retval FLAC__bool
|
|
|
|
* \c false if the encoder is already initialized, else \c true.
|
2002-08-05 06:49:45 +00:00
|
|
|
*/
|
|
|
|
FLAC__bool OggFLAC__stream_encoder_set_min_residual_partition_order(OggFLAC__StreamEncoder *encoder, unsigned value);
|
|
|
|
|
2002-08-06 05:38:55 +00:00
|
|
|
/** This is inherited from FLAC__StreamEncoder; see FLAC__stream_encoder_set_max_residual_partition_order()
|
|
|
|
*
|
|
|
|
* \default \c 0
|
|
|
|
* \param encoder An encoder instance to set.
|
|
|
|
* \param value See above.
|
|
|
|
* \assert
|
|
|
|
* \code encoder != NULL \endcode
|
|
|
|
* \retval FLAC__bool
|
|
|
|
* \c false if the encoder is already initialized, else \c true.
|
2002-08-05 06:49:45 +00:00
|
|
|
*/
|
|
|
|
FLAC__bool OggFLAC__stream_encoder_set_max_residual_partition_order(OggFLAC__StreamEncoder *encoder, unsigned value);
|
|
|
|
|
2002-08-06 05:38:55 +00:00
|
|
|
/** This is inherited from FLAC__StreamEncoder; see FLAC__stream_encoder_set_rice_parameter_search_dist()
|
|
|
|
*
|
|
|
|
* \default \c 0
|
|
|
|
* \param encoder An encoder instance to set.
|
|
|
|
* \param value See above.
|
|
|
|
* \assert
|
|
|
|
* \code encoder != NULL \endcode
|
|
|
|
* \retval FLAC__bool
|
|
|
|
* \c false if the encoder is already initialized, else \c true.
|
2002-08-05 06:49:45 +00:00
|
|
|
*/
|
|
|
|
FLAC__bool OggFLAC__stream_encoder_set_rice_parameter_search_dist(OggFLAC__StreamEncoder *encoder, unsigned value);
|
|
|
|
|
2002-08-06 05:38:55 +00:00
|
|
|
/** This is inherited from FLAC__StreamEncoder; see FLAC__stream_encoder_set_total_samples_estimate()
|
|
|
|
*
|
|
|
|
* \default \c 0
|
|
|
|
* \param encoder An encoder instance to set.
|
|
|
|
* \param value See above.
|
|
|
|
* \assert
|
|
|
|
* \code encoder != NULL \endcode
|
|
|
|
* \retval FLAC__bool
|
|
|
|
* \c false if the encoder is already initialized, else \c true.
|
2002-08-05 06:49:45 +00:00
|
|
|
*/
|
|
|
|
FLAC__bool OggFLAC__stream_encoder_set_total_samples_estimate(OggFLAC__StreamEncoder *encoder, FLAC__uint64 value);
|
|
|
|
|
2002-08-06 05:38:55 +00:00
|
|
|
/** This is inherited from FLAC__StreamEncoder; see FLAC__stream_encoder_set_metadata()
|
|
|
|
*
|
|
|
|
* \default \c NULL, 0
|
|
|
|
* \param encoder An encoder instance to set.
|
|
|
|
* \param metadata See above.
|
|
|
|
* \param num_blocks See above.
|
|
|
|
* \assert
|
|
|
|
* \code encoder != NULL \endcode
|
|
|
|
* \retval FLAC__bool
|
|
|
|
* \c false if the encoder is already initialized, else \c true.
|
2002-08-05 06:49:45 +00:00
|
|
|
*/
|
2002-08-07 17:39:24 +00:00
|
|
|
FLAC__bool OggFLAC__stream_encoder_set_metadata(OggFLAC__StreamEncoder *encoder, FLAC__StreamMetadata **metadata, unsigned num_blocks);
|
2002-08-05 06:49:45 +00:00
|
|
|
|
2002-08-06 05:38:55 +00:00
|
|
|
/** Set the write callback.
|
|
|
|
*
|
|
|
|
* \note
|
|
|
|
* The callback is mandatory and must be set before initialization.
|
|
|
|
*
|
|
|
|
* \default \c NULL
|
|
|
|
* \param encoder An encoder instance to set.
|
|
|
|
* \param value See above.
|
|
|
|
* \assert
|
|
|
|
* \code encoder != NULL \endcode
|
|
|
|
* \code value != NULL \endcode
|
|
|
|
* \retval FLAC__bool
|
|
|
|
* \c false if the encoder is already initialized, else \c true.
|
2002-08-05 06:49:45 +00:00
|
|
|
*/
|
|
|
|
FLAC__bool OggFLAC__stream_encoder_set_write_callback(OggFLAC__StreamEncoder *encoder, OggFLAC__StreamEncoderWriteCallback value);
|
|
|
|
|
2002-08-06 05:38:55 +00:00
|
|
|
/** Set the client data to be passed back to callbacks.
|
|
|
|
* This value will be supplied to callbacks in their \a client_data
|
|
|
|
* argument.
|
|
|
|
*
|
|
|
|
* \default \c NULL
|
|
|
|
* \param encoder An encoder instance to set.
|
|
|
|
* \param value See above.
|
|
|
|
* \assert
|
|
|
|
* \code encoder != NULL \endcode
|
|
|
|
* \retval FLAC__bool
|
|
|
|
* \c false if the encoder is already initialized, else \c true.
|
2002-08-05 06:49:45 +00:00
|
|
|
*/
|
|
|
|
FLAC__bool OggFLAC__stream_encoder_set_client_data(OggFLAC__StreamEncoder *encoder, void *value);
|
|
|
|
|
2002-08-06 05:38:55 +00:00
|
|
|
/** Get the current encoder state.
|
|
|
|
*
|
|
|
|
* \param encoder An encoder instance to query.
|
|
|
|
* \assert
|
|
|
|
* \code encoder != NULL \endcode
|
|
|
|
* \retval OggFLAC__StreamEncoderState
|
|
|
|
* The current encoder state.
|
2002-08-05 06:49:45 +00:00
|
|
|
*/
|
|
|
|
OggFLAC__StreamEncoderState OggFLAC__stream_encoder_get_state(const OggFLAC__StreamEncoder *encoder);
|
|
|
|
|
2002-08-06 05:38:55 +00:00
|
|
|
/** Get the state of the underlying FLAC stream encoder.
|
2002-08-05 06:49:45 +00:00
|
|
|
* Useful when the stream encoder state is
|
2002-08-06 05:38:55 +00:00
|
|
|
* \c OggFLAC__STREAM_ENCODER_FLAC_STREAM_ENCODER_ERROR.
|
2002-08-05 06:49:45 +00:00
|
|
|
*
|
|
|
|
* \param encoder An encoder instance to query.
|
|
|
|
* \assert
|
|
|
|
* \code encoder != NULL \endcode
|
|
|
|
* \retval FLAC__StreamEncoderState
|
2002-08-06 05:38:55 +00:00
|
|
|
* The FLAC stream encoder state.
|
2002-08-05 06:49:45 +00:00
|
|
|
*/
|
2002-08-06 05:38:55 +00:00
|
|
|
FLAC__StreamEncoderState OggFLAC__stream_encoder_get_FLAC_stream_encoder_state(const OggFLAC__StreamEncoder *encoder);
|
2002-08-05 06:49:45 +00:00
|
|
|
|
2002-08-06 05:38:55 +00:00
|
|
|
/** Get the state of the underlying FLAC stream encoder's verify decoder.
|
2002-08-05 06:49:45 +00:00
|
|
|
* Useful when the stream encoder state is
|
2002-08-06 05:38:55 +00:00
|
|
|
* \c OggFLAC__STREAM_ENCODER_FLAC_STREAM_ENCODER_ERROR and the
|
|
|
|
* FLAC encoder state is \c FLAC__STREAM_ENCODER_VERIFY_DECODER_ERROR.
|
2002-08-05 06:49:45 +00:00
|
|
|
*
|
|
|
|
* \param encoder An encoder instance to query.
|
|
|
|
* \assert
|
|
|
|
* \code encoder != NULL \endcode
|
|
|
|
* \retval FLAC__StreamDecoderState
|
2002-08-06 05:38:55 +00:00
|
|
|
* The FLAC verify decoder state.
|
2002-08-05 06:49:45 +00:00
|
|
|
*/
|
|
|
|
FLAC__StreamDecoderState OggFLAC__stream_encoder_get_verify_decoder_state(const OggFLAC__StreamEncoder *encoder);
|
|
|
|
|
2002-08-06 05:38:55 +00:00
|
|
|
/* This is inherited from FLAC__StreamEncoder; see FLAC__stream_encoder_get_verify()
|
|
|
|
*
|
|
|
|
* \param encoder An encoder instance to query.
|
|
|
|
* \assert
|
|
|
|
* \code encoder != NULL \endcode
|
|
|
|
* \retval FLAC__bool
|
|
|
|
* See OggFLAC__stream_encoder_set_verify().
|
2002-08-05 06:49:45 +00:00
|
|
|
*/
|
|
|
|
FLAC__bool OggFLAC__stream_encoder_get_verify(const OggFLAC__StreamEncoder *encoder);
|
|
|
|
|
2002-08-06 05:38:55 +00:00
|
|
|
/* This is inherited from FLAC__StreamEncoder; see FLAC__stream_encoder_get_streamable_subset()
|
|
|
|
*
|
|
|
|
* \param encoder An encoder instance to query.
|
|
|
|
* \assert
|
|
|
|
* \code encoder != NULL \endcode
|
|
|
|
* \retval FLAC__bool
|
|
|
|
* See OggFLAC__stream_encoder_set_streamable_subset().
|
2002-08-05 06:49:45 +00:00
|
|
|
*/
|
|
|
|
FLAC__bool OggFLAC__stream_encoder_get_streamable_subset(const OggFLAC__StreamEncoder *encoder);
|
|
|
|
|
2002-08-06 05:38:55 +00:00
|
|
|
/* This is inherited from FLAC__StreamEncoder; see FLAC__stream_encoder_get_do_mid_side_stereo()
|
|
|
|
*
|
|
|
|
* \param encoder An encoder instance to query.
|
|
|
|
* \assert
|
|
|
|
* \code encoder != NULL \endcode
|
|
|
|
* \retval FLAC__bool
|
|
|
|
* See OggFLAC__stream_encoder_get_do_mid_side_stereo().
|
2002-08-05 06:49:45 +00:00
|
|
|
*/
|
|
|
|
FLAC__bool OggFLAC__stream_encoder_get_do_mid_side_stereo(const OggFLAC__StreamEncoder *encoder);
|
|
|
|
|
2002-08-06 05:38:55 +00:00
|
|
|
/* This is inherited from FLAC__StreamEncoder; see FLAC__stream_encoder_get_loose_mid_side_stereo()
|
|
|
|
*
|
|
|
|
* \param encoder An encoder instance to query.
|
|
|
|
* \assert
|
|
|
|
* \code encoder != NULL \endcode
|
|
|
|
* \retval FLAC__bool
|
|
|
|
* See OggFLAC__stream_encoder_set_loose_mid_side_stereo().
|
2002-08-05 06:49:45 +00:00
|
|
|
*/
|
|
|
|
FLAC__bool OggFLAC__stream_encoder_get_loose_mid_side_stereo(const OggFLAC__StreamEncoder *encoder);
|
|
|
|
|
2002-08-06 05:38:55 +00:00
|
|
|
/* This is inherited from FLAC__StreamEncoder; see FLAC__stream_encoder_get_channels()
|
|
|
|
*
|
|
|
|
* \param encoder An encoder instance to query.
|
|
|
|
* \assert
|
|
|
|
* \code encoder != NULL \endcode
|
|
|
|
* \retval unsigned
|
|
|
|
* See OggFLAC__stream_encoder_set_channels().
|
2002-08-05 06:49:45 +00:00
|
|
|
*/
|
|
|
|
unsigned OggFLAC__stream_encoder_get_channels(const OggFLAC__StreamEncoder *encoder);
|
|
|
|
|
2002-08-06 05:38:55 +00:00
|
|
|
/* This is inherited from FLAC__StreamEncoder; see FLAC__stream_encoder_get_bits_per_sample()
|
|
|
|
*
|
|
|
|
* \param encoder An encoder instance to query.
|
|
|
|
* \assert
|
|
|
|
* \code encoder != NULL \endcode
|
|
|
|
* \retval unsigned
|
|
|
|
* See OggFLAC__stream_encoder_set_bits_per_sample().
|
2002-08-05 06:49:45 +00:00
|
|
|
*/
|
|
|
|
unsigned OggFLAC__stream_encoder_get_bits_per_sample(const OggFLAC__StreamEncoder *encoder);
|
|
|
|
|
2002-08-06 05:38:55 +00:00
|
|
|
/* This is inherited from FLAC__StreamEncoder; see FLAC__stream_encoder_get_sample_rate()
|
|
|
|
*
|
|
|
|
* \param encoder An encoder instance to query.
|
|
|
|
* \assert
|
|
|
|
* \code encoder != NULL \endcode
|
|
|
|
* \retval unsigned
|
|
|
|
* See OggFLAC__stream_encoder_set_sample_rate().
|
2002-08-05 06:49:45 +00:00
|
|
|
*/
|
|
|
|
unsigned OggFLAC__stream_encoder_get_sample_rate(const OggFLAC__StreamEncoder *encoder);
|
|
|
|
|
2002-08-06 05:38:55 +00:00
|
|
|
/* This is inherited from FLAC__StreamEncoder; see FLAC__stream_encoder_get_blocksize()
|
|
|
|
*
|
|
|
|
* \param encoder An encoder instance to query.
|
|
|
|
* \assert
|
|
|
|
* \code encoder != NULL \endcode
|
|
|
|
* \retval unsigned
|
|
|
|
* See OggFLAC__stream_encoder_set_blocksize().
|
2002-08-05 06:49:45 +00:00
|
|
|
*/
|
|
|
|
unsigned OggFLAC__stream_encoder_get_blocksize(const OggFLAC__StreamEncoder *encoder);
|
|
|
|
|
2002-08-06 05:38:55 +00:00
|
|
|
/* This is inherited from FLAC__StreamEncoder; see FLAC__stream_encoder_get_max_lpc_order()
|
|
|
|
*
|
|
|
|
* \param encoder An encoder instance to query.
|
|
|
|
* \assert
|
|
|
|
* \code encoder != NULL \endcode
|
|
|
|
* \retval unsigned
|
|
|
|
* See OggFLAC__stream_encoder_set_max_lpc_order().
|
2002-08-05 06:49:45 +00:00
|
|
|
*/
|
|
|
|
unsigned OggFLAC__stream_encoder_get_max_lpc_order(const OggFLAC__StreamEncoder *encoder);
|
|
|
|
|
2002-08-06 05:38:55 +00:00
|
|
|
/* This is inherited from FLAC__StreamEncoder; see FLAC__stream_encoder_get_qlp_coeff_precision()
|
|
|
|
*
|
|
|
|
* \param encoder An encoder instance to query.
|
|
|
|
* \assert
|
|
|
|
* \code encoder != NULL \endcode
|
|
|
|
* \retval unsigned
|
|
|
|
* See OggFLAC__stream_encoder_set_qlp_coeff_precision().
|
2002-08-05 06:49:45 +00:00
|
|
|
*/
|
|
|
|
unsigned OggFLAC__stream_encoder_get_qlp_coeff_precision(const OggFLAC__StreamEncoder *encoder);
|
|
|
|
|
2002-08-06 05:38:55 +00:00
|
|
|
/* This is inherited from FLAC__StreamEncoder; see FLAC__stream_encoder_get_do_qlp_coeff_prec_search()
|
|
|
|
*
|
|
|
|
* \param encoder An encoder instance to query.
|
|
|
|
* \assert
|
|
|
|
* \code encoder != NULL \endcode
|
|
|
|
* \retval FLAC__bool
|
|
|
|
* See OggFLAC__stream_encoder_set_do_qlp_coeff_prec_search().
|
2002-08-05 06:49:45 +00:00
|
|
|
*/
|
|
|
|
FLAC__bool OggFLAC__stream_encoder_get_do_qlp_coeff_prec_search(const OggFLAC__StreamEncoder *encoder);
|
|
|
|
|
2002-08-06 05:38:55 +00:00
|
|
|
/* This is inherited from FLAC__StreamEncoder; see FLAC__stream_encoder_get_do_escape_coding()
|
|
|
|
*
|
|
|
|
* \param encoder An encoder instance to query.
|
|
|
|
* \assert
|
|
|
|
* \code encoder != NULL \endcode
|
|
|
|
* \retval FLAC__bool
|
|
|
|
* See OggFLAC__stream_encoder_set_do_escape_coding().
|
2002-08-05 06:49:45 +00:00
|
|
|
*/
|
|
|
|
FLAC__bool OggFLAC__stream_encoder_get_do_escape_coding(const OggFLAC__StreamEncoder *encoder);
|
|
|
|
|
2002-08-06 05:38:55 +00:00
|
|
|
/* This is inherited from FLAC__StreamEncoder; see FLAC__stream_encoder_get_do_exhaustive_model_search()
|
|
|
|
*
|
|
|
|
* \param encoder An encoder instance to query.
|
|
|
|
* \assert
|
|
|
|
* \code encoder != NULL \endcode
|
|
|
|
* \retval FLAC__bool
|
|
|
|
* See OggFLAC__stream_encoder_set_do_exhaustive_model_search().
|
2002-08-05 06:49:45 +00:00
|
|
|
*/
|
|
|
|
FLAC__bool OggFLAC__stream_encoder_get_do_exhaustive_model_search(const OggFLAC__StreamEncoder *encoder);
|
|
|
|
|
2002-08-06 05:38:55 +00:00
|
|
|
/* This is inherited from FLAC__StreamEncoder; see FLAC__stream_encoder_get_min_residual_partition_order()
|
|
|
|
*
|
|
|
|
* \param encoder An encoder instance to query.
|
|
|
|
* \assert
|
|
|
|
* \code encoder != NULL \endcode
|
|
|
|
* \retval unsigned
|
|
|
|
* See OggFLAC__stream_encoder_set_min_residual_partition_order().
|
2002-08-05 06:49:45 +00:00
|
|
|
*/
|
|
|
|
unsigned OggFLAC__stream_encoder_get_min_residual_partition_order(const OggFLAC__StreamEncoder *encoder);
|
|
|
|
|
2002-08-06 05:38:55 +00:00
|
|
|
/* This is inherited from FLAC__StreamEncoder; see FLAC__stream_encoder_get_man_residual_partition_order()
|
|
|
|
*
|
|
|
|
* \param encoder An encoder instance to query.
|
|
|
|
* \assert
|
|
|
|
* \code encoder != NULL \endcode
|
|
|
|
* \retval unsigned
|
|
|
|
* See OggFLAC__stream_encoder_set_max_residual_partition_order().
|
2002-08-05 06:49:45 +00:00
|
|
|
*/
|
|
|
|
unsigned OggFLAC__stream_encoder_get_max_residual_partition_order(const OggFLAC__StreamEncoder *encoder);
|
|
|
|
|
2002-08-06 05:38:55 +00:00
|
|
|
/* This is inherited from FLAC__StreamEncoder; see FLAC__stream_encoder_get_rice_parameter_search_dist()
|
|
|
|
*
|
|
|
|
* \param encoder An encoder instance to query.
|
|
|
|
* \assert
|
|
|
|
* \code encoder != NULL \endcode
|
|
|
|
* \retval unsigned
|
|
|
|
* See OggFLAC__stream_encoder_set_rice_parameter_search_dist().
|
2002-08-05 06:49:45 +00:00
|
|
|
*/
|
|
|
|
unsigned OggFLAC__stream_encoder_get_rice_parameter_search_dist(const OggFLAC__StreamEncoder *encoder);
|
|
|
|
|
2002-08-06 05:38:55 +00:00
|
|
|
/* This is inherited from FLAC__StreamEncoder; see FLAC__stream_encoder_get_total_samples_estimate()
|
|
|
|
*
|
|
|
|
* \param encoder An encoder instance to set.
|
|
|
|
* \assert
|
|
|
|
* \code encoder != NULL \endcode
|
|
|
|
* \retval FLAC__uint64
|
|
|
|
* See OggFLAC__stream_encoder_get_total_samples_estimate().
|
2002-08-05 06:49:45 +00:00
|
|
|
*/
|
|
|
|
FLAC__uint64 OggFLAC__stream_encoder_get_total_samples_estimate(const OggFLAC__StreamEncoder *encoder);
|
|
|
|
|
2002-08-06 05:38:55 +00:00
|
|
|
/** Initialize the encoder instance.
|
|
|
|
* Should be called after OggFLAC__stream_encoder_new() and
|
|
|
|
* OggFLAC__stream_encoder_set_*() but before OggFLAC__stream_encoder_process()
|
|
|
|
* or OggFLAC__stream_encoder_process_interleaved(). Will set and return
|
|
|
|
* the encoder state, which will be OggFLAC__STREAM_ENCODER_OK if
|
|
|
|
* initialization succeeded.
|
|
|
|
*
|
|
|
|
* The call to OggFLAC__stream_encoder_init() currently will also immediately
|
|
|
|
* call the write callback several times, once with the \c fLaC signature,
|
|
|
|
* and once for each encoded metadata block.
|
|
|
|
*
|
|
|
|
* \param encoder An uninitialized encoder instance.
|
|
|
|
* \assert
|
|
|
|
* \code encoder != NULL \endcode
|
|
|
|
* \retval OggFLAC__StreamEncoderState
|
|
|
|
* \c OggFLAC__STREAM_ENCODER_OK if initialization was successful; see
|
|
|
|
* OggFLAC__StreamEncoderState for the meanings of other return values.
|
2002-08-05 06:49:45 +00:00
|
|
|
*/
|
|
|
|
OggFLAC__StreamEncoderState OggFLAC__stream_encoder_init(OggFLAC__StreamEncoder *encoder);
|
|
|
|
|
2002-08-06 05:38:55 +00:00
|
|
|
/** Finish the encoding process.
|
|
|
|
* Flushes the encoding buffer, releases resources, resets the encoder
|
|
|
|
* settings to their defaults, and returns the encoder state to
|
|
|
|
* OggFLAC__STREAM_ENCODER_UNINITIALIZED. Note that this can generate
|
|
|
|
* one or more write callbacks before returning.
|
|
|
|
*
|
|
|
|
* In the event of a prematurely-terminated encode, it is not strictly
|
|
|
|
* necessary to call this immediately before OggFLAC__stream_encoder_delete()
|
|
|
|
* but it is good practice to match every OggFLAC__stream_encoder_init()
|
|
|
|
* with an OggFLAC__stream_encoder_finish().
|
|
|
|
*
|
|
|
|
* \param encoder An uninitialized encoder instance.
|
|
|
|
* \assert
|
|
|
|
* \code encoder != NULL \endcode
|
2002-08-05 06:49:45 +00:00
|
|
|
*/
|
|
|
|
void OggFLAC__stream_encoder_finish(OggFLAC__StreamEncoder *encoder);
|
|
|
|
|
2002-08-06 05:38:55 +00:00
|
|
|
/** Submit data for encoding.
|
|
|
|
* This is inherited from FLAC__StreamEncoder; see FLAC__stream_encoder_process().
|
|
|
|
*
|
|
|
|
* \param encoder An initialized encoder instance in the OK state.
|
|
|
|
* \param buffer An array of pointers to each channel's signal.
|
|
|
|
* \param samples The number of samples in one channel.
|
|
|
|
* \assert
|
|
|
|
* \code encoder != NULL \endcode
|
|
|
|
* \code OggFLAC__stream_encoder_get_state(encoder) == OggFLAC__STREAM_ENCODER_OK \endcode
|
|
|
|
* \retval FLAC__bool
|
|
|
|
* \c true if successful, else \c false; in this case, check the
|
|
|
|
* encoder state with OggFLAC__stream_encoder_get_state() to see what
|
|
|
|
* went wrong.
|
2002-08-05 06:49:45 +00:00
|
|
|
*/
|
|
|
|
FLAC__bool OggFLAC__stream_encoder_process(OggFLAC__StreamEncoder *encoder, const FLAC__int32 * const buffer[], unsigned samples);
|
|
|
|
|
2002-08-06 05:38:55 +00:00
|
|
|
/** Submit data for encoding.
|
|
|
|
* This is inherited from FLAC__StreamEncoder; see FLAC__stream_encoder_process_interleaved().
|
|
|
|
*
|
|
|
|
* \param encoder An initialized encoder instance in the OK state.
|
|
|
|
* \param buffer An array of channel-interleaved data (see above).
|
|
|
|
* \param samples The number of samples in one channel, the same as for
|
|
|
|
* OggFLAC__stream_encoder_process(). For example, if
|
|
|
|
* encoding two channels, \c 1000 \a samples corresponds
|
|
|
|
* to a \a buffer of 2000 values.
|
|
|
|
* \assert
|
|
|
|
* \code encoder != NULL \endcode
|
|
|
|
* \code OggFLAC__stream_encoder_get_state(encoder) == OggFLAC__STREAM_ENCODER_OK \endcode
|
|
|
|
* \retval FLAC__bool
|
|
|
|
* \c true if successful, else \c false; in this case, check the
|
|
|
|
* encoder state with OggFLAC__stream_encoder_get_state() to see what
|
|
|
|
* went wrong.
|
2002-08-05 06:49:45 +00:00
|
|
|
*/
|
|
|
|
FLAC__bool OggFLAC__stream_encoder_process_interleaved(OggFLAC__StreamEncoder *encoder, const FLAC__int32 buffer[], unsigned samples);
|
|
|
|
|
|
|
|
/* \} */
|
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#endif
|