merge libOggFLAC into libFLAC and libOggFLAC++ into FLAC++; documentation still needs work

This commit is contained in:
Josh Coalson
2006-10-15 04:24:05 +00:00
parent 03dbb26a27
commit 8da98c897b
120 changed files with 2581 additions and 12227 deletions

View File

@@ -129,6 +129,7 @@ namespace FLAC {
inline operator bool() const { return is_valid(); }
//@}
virtual bool set_serial_number(long value); ///< See FLAC__stream_decoder_set_serial_number()
virtual bool set_md5_checking(bool value); ///< See FLAC__stream_decoder_set_md5_checking()
virtual bool set_metadata_respond(::FLAC__MetadataType type); ///< See FLAC__stream_decoder_set_metadata_respond()
virtual bool set_metadata_respond_application(const FLAC__byte id[4]); ///< See FLAC__stream_decoder_set_metadata_respond_application()
@@ -147,13 +148,8 @@ namespace FLAC {
virtual unsigned get_sample_rate() const; ///< See FLAC__stream_decoder_get_sample_rate()
virtual unsigned get_blocksize() const; ///< See FLAC__stream_decoder_get_blocksize()
/** Initialize the instance; as with the C interface,
* init() should be called after construction and 'set'
* calls but before any of the 'process' calls.
*
* See FLAC__stream_decoder_init_stream().
*/
virtual ::FLAC__StreamDecoderInitStatus init();
virtual ::FLAC__StreamDecoderInitStatus init(); ///< Seek FLAC__stream_decoder_init_stream()
virtual ::FLAC__StreamDecoderInitStatus init_ogg(); ///< Seek FLAC__stream_decoder_init_ogg_stream()
virtual void finish(); ///< See FLAC__stream_decoder_finish()
@@ -250,18 +246,12 @@ namespace FLAC {
File();
virtual ~File();
//@{
/** Initialize the instance; as with the C interface,
* init() should be called after construction and 'set'
* calls but before any of the 'process' calls.
*
* See FLAC__stream_decoder_init_FILE() and
* FLAC__stream_decoder_init_file().
*/
::FLAC__StreamDecoderInitStatus init(FILE *file);
::FLAC__StreamDecoderInitStatus init(const char *filename);
::FLAC__StreamDecoderInitStatus init(const std::string &filename);
//@}
virtual ::FLAC__StreamDecoderInitStatus init(FILE *file); ///< See FLAC__stream_decoder_init_FILE()
virtual ::FLAC__StreamDecoderInitStatus init(const char *filename); ///< See FLAC__stream_decoder_init_file()
virtual ::FLAC__StreamDecoderInitStatus init(const std::string &filename); ///< See FLAC__stream_decoder_init_file()
virtual ::FLAC__StreamDecoderInitStatus init_ogg(FILE *file); ///< See FLAC__stream_decoder_init_ogg_FILE()
virtual ::FLAC__StreamDecoderInitStatus init_ogg(const char *filename); ///< See FLAC__stream_decoder_init_ogg_file()
virtual ::FLAC__StreamDecoderInitStatus init_ogg(const std::string &filename); ///< See FLAC__stream_decoder_init_ogg_file()
protected:
// this is a dummy implementation to satisfy the pure virtual in Stream that is actually supplied internally by the C layer
virtual ::FLAC__StreamDecoderReadStatus read_callback(FLAC__byte buffer[], unsigned *bytes);

View File

@@ -56,7 +56,7 @@
* This module describes the encoder layers provided by libFLAC++.
*
* The libFLAC++ encoder classes are object wrappers around their
* counterparts in libFLAC. All decoding layers available in
* counterparts in libFLAC. All encoding layers available in
* libFLAC are also provided here. The interface is very similar;
* make sure to read the \link flac_encoder libFLAC encoder module \endlink.
*
@@ -132,6 +132,7 @@ namespace FLAC {
inline operator bool() const { return is_valid(); }
//@}
virtual bool set_serial_number(long value); ///< See FLAC__stream_encoder_set_serial_number()
virtual bool set_verify(bool value); ///< See FLAC__stream_encoder_set_verify()
virtual bool set_streamable_subset(bool value); ///< See FLAC__stream_encoder_set_streamable_subset()
virtual bool set_do_mid_side_stereo(bool value); ///< See FLAC__stream_encoder_set_do_mid_side_stereo()
@@ -175,19 +176,17 @@ namespace FLAC {
virtual unsigned get_rice_parameter_search_dist() const; ///< See FLAC__stream_encoder_get_rice_parameter_search_dist()
virtual FLAC__uint64 get_total_samples_estimate() const; ///< See FLAC__stream_encoder_get_total_samples_estimate()
/** Initialize the instance; as with the C interface,
* init() should be called after construction and 'set'
* calls but before any of the 'process' calls.
*
* See FLAC__stream_encoder_init_stream().
*/
virtual ::FLAC__StreamEncoderInitStatus init();
virtual ::FLAC__StreamEncoderInitStatus init(); ///< See FLAC__stream_encoder_init_stream()
virtual ::FLAC__StreamEncoderInitStatus init_ogg(); ///< See FLAC__stream_encoder_init_ogg_stream()
virtual void finish(); ///< See FLAC__stream_encoder_finish()
virtual bool process(const FLAC__int32 * const buffer[], unsigned samples); ///< See FLAC__stream_encoder_process()
virtual bool process_interleaved(const FLAC__int32 buffer[], unsigned samples); ///< See FLAC__stream_encoder_process_interleaved()
protected:
/// See FLAC__StreamEncoderReadCallback
virtual ::FLAC__StreamEncoderReadStatus read_callback(FLAC__byte buffer[], unsigned *bytes);
/// See FLAC__StreamEncoderWriteCallback
virtual ::FLAC__StreamEncoderWriteStatus write_callback(const FLAC__byte buffer[], unsigned bytes, unsigned samples, unsigned current_frame) = 0;
@@ -209,6 +208,7 @@ namespace FLAC {
::FLAC__StreamEncoder *encoder_;
static ::FLAC__StreamEncoderReadStatus read_callback_(const ::FLAC__StreamEncoder *encoder, FLAC__byte buffer[], unsigned *bytes, void *client_data);
static ::FLAC__StreamEncoderWriteStatus write_callback_(const ::FLAC__StreamEncoder *encoder, const FLAC__byte buffer[], unsigned bytes, unsigned samples, unsigned current_frame, void *client_data);
static ::FLAC__StreamEncoderSeekStatus seek_callback_(const FLAC__StreamEncoder *encoder, FLAC__uint64 absolute_byte_offset, void *client_data);
static ::FLAC__StreamEncoderTellStatus tell_callback_(const FLAC__StreamEncoder *encoder, FLAC__uint64 *absolute_byte_offset, void *client_data);
@@ -256,18 +256,12 @@ namespace FLAC {
File();
virtual ~File();
//@{
/* Initialize the instance; as with the C interface,
* init() should be called after construction and 'set'
* calls but before any of the 'process' calls.
*
* See FLAC__stream_encoder_init_FILE() and
* FLAC__stream_encoder_init_file().
*/
::FLAC__StreamEncoderInitStatus init(FILE *file);
::FLAC__StreamEncoderInitStatus init(const char *filename);
::FLAC__StreamEncoderInitStatus init(const std::string &filename);
//@}
virtual ::FLAC__StreamEncoderInitStatus init(FILE *file); ///< See FLAC__stream_encoder_init_FILE()
virtual ::FLAC__StreamEncoderInitStatus init(const char *filename); ///< See FLAC__stream_encoder_init_file()
virtual ::FLAC__StreamEncoderInitStatus init(const std::string &filename); ///< See FLAC__stream_encoder_init_file()
virtual ::FLAC__StreamEncoderInitStatus init_ogg(FILE *file); ///< See FLAC__stream_encoder_init_ogg_FILE()
virtual ::FLAC__StreamEncoderInitStatus init_ogg(const char *filename); ///< See FLAC__stream_encoder_init_ogg_file()
virtual ::FLAC__StreamEncoderInitStatus init_ogg(const std::string &filename); ///< See FLAC__stream_encoder_init_ogg_file()
protected:
/// See FLAC__StreamEncoderProgressCallback
virtual void progress_callback(FLAC__uint64 bytes_written, FLAC__uint64 samples_written, unsigned frames_written, unsigned total_frames_estimate);
@@ -282,8 +276,6 @@ namespace FLAC {
void operator=(const Stream &);
};
/* \} */
}
}

View File

@@ -52,4 +52,7 @@
#define FLAC_API_VERSION_REVISION 0
#define FLAC_API_VERSION_AGE 0
/** \c 1 if the library has been compiled with support for Ogg FLAC, else \c 0. */
extern int FLAC_API_SUPPORTS_OGG_FLAC;
#endif

View File

@@ -208,6 +208,9 @@ typedef enum {
FLAC__STREAM_DECODER_END_OF_STREAM,
/**< The decoder has reached the end of the stream. */
FLAC__STREAM_DECODER_OGG_ERROR,
/**< An error occurred in the underlying Ogg layer. */
FLAC__STREAM_DECODER_SEEK_ERROR,
/**< An error occurred while seeking. The decoder must be flushed
* with FLAC__stream_decoder_flush() or reset with
@@ -245,6 +248,11 @@ typedef enum {
FLAC__STREAM_DECODER_INIT_STATUS_OK = 0,
/**< Initialization was successful. */
FLAC__STREAM_DECODER_INIT_STATUS_UNSUPPORTED_CONTAINER,
/**< The library was not compiled with support for the given container
* format.
*/
FLAC__STREAM_DECODER_INIT_STATUS_INVALID_CALLBACKS,
/**< A required callback was not supplied. */
@@ -659,6 +667,21 @@ FLAC_API void FLAC__stream_decoder_delete(FLAC__StreamDecoder *decoder);
*
***********************************************************************/
/** Set the serial number for the Ogg stream.
* The default behavior is to use the serial number of the first Ogg
* page. Setting a serial number here will explicitly specify which
* stream is to be decoded.
*
* \default \c use serial number of first page
* \param decoder A decoder instance to set.
* \param serial_number See above.
* \assert
* \code decoder != NULL \endcode
* \retval FLAC__bool
* \c false if the decoder is already initialized, else \c true.
*/
FLAC_API FLAC__bool FLAC__stream_decoder_set_serial_number(FLAC__StreamDecoder *decoder, long serial_number);
/** Set the "MD5 signature checking" flag. If \c true, the decoder will
* compute the MD5 signature of the unencoded audio data while decoding
* and compare it to the signature from the STREAMINFO block, if it
@@ -875,24 +898,28 @@ FLAC_API unsigned FLAC__stream_decoder_get_blocksize(const FLAC__StreamDecoder *
* there may still be undecoded bytes in the decoder's read FIFO.
* The returned position is correct even after a seek.
*
* \warning This function currently only works for native FLAC,
* not Ogg FLAC streams.
*
* \param decoder A decoder instance to query.
* \param position Address at which to return the desired position.
* \assert
* \code decoder != NULL \endcode
* \code position != NULL \endcode
* \retval FLAC__bool
* \c true if successful, \c false if there was an error from
* the 'tell' callback or it returned
* \c true if successful, \c false if the stream is not native FLAC,
* or there was an error from the 'tell' callback or it returned
* \c FLAC__STREAM_DECODER_TELL_STATUS_UNSUPPORTED.
*/
FLAC_API FLAC__bool FLAC__stream_decoder_get_decode_position(const FLAC__StreamDecoder *decoder, FLAC__uint64 *position);
/** Initialize the decoder instance.
/** Initialize the decoder instance to decode native FLAC streams.
*
* This flavor of initialization sets up the decoder to decode from a stream.
* I/O is performed via callbacks to the client. For decoding from a plain file
* via filename or open FILE*, FLAC__stream_decoder_init_file() and
* FLAC__stream_decoder_init_FILE() provide a simpler interface.
* This flavor of initialization sets up the decoder to decode from a
* native FLAC stream. I/O is performed via callbacks to the client.
* For decoding from a plain file via filename or open FILE*,
* FLAC__stream_decoder_init_file() and FLAC__stream_decoder_init_FILE()
* provide a simpler interface.
*
* This function should be called after FLAC__stream_decoder_new() and
* FLAC__stream_decoder_set_*() but before any of the
@@ -963,10 +990,91 @@ FLAC_API FLAC__StreamDecoderInitStatus FLAC__stream_decoder_init_stream(
void *client_data
);
/** Initialize the decoder instance.
/** Initialize the decoder instance to decode Ogg FLAC streams.
*
* This flavor of initialization sets up the decoder to decode from a plain
* file. For non-stdio streams, you must use
* This flavor of initialization sets up the decoder to decode from a
* FLAC stream in an Ogg container. I/O is performed via callbacks to the
* client. For decoding from a plain file via filename or open FILE*,
* FLAC__stream_decoder_init_ogg_file() and FLAC__stream_decoder_init_ogg_FILE()
* provide a simpler interface.
*
* This function should be called after FLAC__stream_decoder_new() and
* FLAC__stream_decoder_set_*() but before any of the
* FLAC__stream_decoder_process_*() functions. Will set and return the
* decoder state, which will be FLAC__STREAM_DECODER_SEARCH_FOR_METADATA
* if initialization succeeded.
*
* \note Support for Ogg FLAC in the library is optional. If this
* library has been built without support for Ogg FLAC, this function
* will return \c FLAC__STREAM_DECODER_INIT_STATUS_UNSUPPORTED_CONTAINER.
*
* \param decoder An uninitialized decoder instance.
* \param read_callback See FLAC__StreamDecoderReadCallback. This
* pointer must not be \c NULL.
* \param seek_callback See FLAC__StreamDecoderSeekCallback. This
* pointer may be \c NULL if seeking is not
* supported. If \a seek_callback is not \c NULL then a
* \a tell_callback, \a length_callback, and \a eof_callback must also be supplied.
* Alternatively, a dummy seek callback that just
* returns \c FLAC__STREAM_DECODER_SEEK_STATUS_UNSUPPORTED
* may also be supplied, all though this is slightly
* less efficient for the decoder.
* \param tell_callback See FLAC__StreamDecoderTellCallback. This
* pointer may be \c NULL if not supported by the client. If
* \a seek_callback is not \c NULL then a
* \a tell_callback must also be supplied.
* Alternatively, a dummy tell callback that just
* returns \c FLAC__STREAM_DECODER_TELL_STATUS_UNSUPPORTED
* may also be supplied, all though this is slightly
* less efficient for the decoder.
* \param length_callback See FLAC__StreamDecoderLengthCallback. This
* pointer may be \c NULL if not supported by the client. If
* \a seek_callback is not \c NULL then a
* \a length_callback must also be supplied.
* Alternatively, a dummy length callback that just
* returns \c FLAC__STREAM_DECODER_LENGTH_STATUS_UNSUPPORTED
* may also be supplied, all though this is slightly
* less efficient for the decoder.
* \param eof_callback See FLAC__StreamDecoderEofCallback. This
* pointer may be \c NULL if not supported by the client. If
* \a seek_callback is not \c NULL then a
* \a eof_callback must also be supplied.
* Alternatively, a dummy length callback that just
* returns \c false
* may also be supplied, all though this is slightly
* less efficient for the decoder.
* \param write_callback See FLAC__StreamDecoderWriteCallback. This
* pointer must not be \c NULL.
* \param metadata_callback See FLAC__StreamDecoderMetadataCallback. This
* pointer may be \c NULL if the callback is not
* desired.
* \param error_callback See FLAC__StreamDecoderErrorCallback. This
* pointer must not be \c NULL.
* \param client_data This value will be supplied to callbacks in their
* \a client_data argument.
* \assert
* \code decoder != NULL \endcode
* \retval FLAC__StreamDecoderInitStatus
* \c FLAC__STREAM_DECODER_INIT_STATUS_OK if initialization was successful;
* see FLAC__StreamDecoderInitStatus for the meanings of other return values.
*/
FLAC_API FLAC__StreamDecoderInitStatus FLAC__stream_decoder_init_ogg_stream(
FLAC__StreamDecoder *decoder,
FLAC__StreamDecoderReadCallback read_callback,
FLAC__StreamDecoderSeekCallback seek_callback,
FLAC__StreamDecoderTellCallback tell_callback,
FLAC__StreamDecoderLengthCallback length_callback,
FLAC__StreamDecoderEofCallback eof_callback,
FLAC__StreamDecoderWriteCallback write_callback,
FLAC__StreamDecoderMetadataCallback metadata_callback,
FLAC__StreamDecoderErrorCallback error_callback,
void *client_data
);
/** Initialize the decoder instance to decode native FLAC files.
*
* This flavor of initialization sets up the decoder to decode from a
* plain native FLAC file. For non-stdio streams, you must use
* FLAC__stream_decoder_init_stream() and provide callbacks for the I/O.
*
* This function should be called after FLAC__stream_decoder_new() and
@@ -1009,11 +1117,61 @@ FLAC_API FLAC__StreamDecoderInitStatus FLAC__stream_decoder_init_FILE(
void *client_data
);
/** Initialize the decoder instance.
/** Initialize the decoder instance to decode Ogg FLAC files.
*
* This flavor of initialization sets up the decoder to decode from a
* plain Ogg FLAC file. For non-stdio streams, you must use
* FLAC__stream_decoder_init_ogg_stream() and provide callbacks for the I/O.
*
* This function should be called after FLAC__stream_decoder_new() and
* FLAC__stream_decoder_set_*() but before any of the
* FLAC__stream_decoder_process_*() functions. Will set and return the
* decoder state, which will be FLAC__STREAM_DECODER_SEARCH_FOR_METADATA
* if initialization succeeded.
*
* \note Support for Ogg FLAC in the library is optional. If this
* library has been built without support for Ogg FLAC, this function
* will return \c FLAC__STREAM_DECODER_INIT_STATUS_UNSUPPORTED_CONTAINER.
*
* \param decoder An uninitialized decoder instance.
* \param file An open FLAC file. The file should have been
* opened with mode \c "rb" and rewound. The file
* becomes owned by the decoder and should not be
* manipulated by the client while decoding.
* Unless \a file is \c stdin, it will be closed
* when FLAC__stream_decoder_finish() is called.
* Note however that seeking will not work when
* decoding from \c stdout since it is not seekable.
* \param write_callback See FLAC__StreamDecoderWriteCallback. This
* pointer must not be \c NULL.
* \param metadata_callback See FLAC__StreamDecoderMetadataCallback. This
* pointer may be \c NULL if the callback is not
* desired.
* \param error_callback See FLAC__StreamDecoderErrorCallback. This
* pointer must not be \c NULL.
* \param client_data This value will be supplied to callbacks in their
* \a client_data argument.
* \assert
* \code decoder != NULL \endcode
* \code file != NULL \endcode
* \retval FLAC__StreamDecoderInitStatus
* \c FLAC__STREAM_DECODER_INIT_STATUS_OK if initialization was successful;
* see FLAC__StreamDecoderInitStatus for the meanings of other return values.
*/
FLAC_API FLAC__StreamDecoderInitStatus FLAC__stream_decoder_init_ogg_FILE(
FLAC__StreamDecoder *decoder,
FILE *file,
FLAC__StreamDecoderWriteCallback write_callback,
FLAC__StreamDecoderMetadataCallback metadata_callback,
FLAC__StreamDecoderErrorCallback error_callback,
void *client_data
);
/** Initialize the decoder instance to decode native FLAC files.
*
* This flavor of initialization sets up the decoder to decode from a plain
* file. If POSIX fopen() semantics are not sufficient, (for example, with
* Unicode filenames on Windows), you must use
* native FLAC file. If POSIX fopen() semantics are not sufficient, (for
* example, with Unicode filenames on Windows), you must use
* FLAC__stream_decoder_init_FILE(), or FLAC__stream_decoder_init_stream()
* and provide callbacks for the I/O.
*
@@ -1051,6 +1209,52 @@ FLAC_API FLAC__StreamDecoderInitStatus FLAC__stream_decoder_init_file(
void *client_data
);
/** Initialize the decoder instance to decode Ogg FLAC files.
*
* This flavor of initialization sets up the decoder to decode from a plain
* Ogg FLAC file. If POSIX fopen() semantics are not sufficient, (for
* example, with Unicode filenames on Windows), you must use
* FLAC__stream_decoder_init_ogg_FILE(), or FLAC__stream_decoder_init_ogg_stream()
* and provide callbacks for the I/O.
*
* This function should be called after FLAC__stream_decoder_new() and
* FLAC__stream_decoder_set_*() but before any of the
* FLAC__stream_decoder_process_*() functions. Will set and return the
* decoder state, which will be FLAC__STREAM_DECODER_SEARCH_FOR_METADATA
* if initialization succeeded.
*
* \note Support for Ogg FLAC in the library is optional. If this
* library has been built without support for Ogg FLAC, this function
* will return \c FLAC__STREAM_DECODER_INIT_STATUS_UNSUPPORTED_CONTAINER.
*
* \param decoder An uninitialized decoder instance.
* \param filename The name of the file to decode from. The file will
* be opened with fopen(). Use \c NULL to decode from
* \c stdin. Note that \c stdin is not seekable.
* \param write_callback See FLAC__StreamDecoderWriteCallback. This
* pointer must not be \c NULL.
* \param metadata_callback See FLAC__StreamDecoderMetadataCallback. This
* pointer may be \c NULL if the callback is not
* desired.
* \param error_callback See FLAC__StreamDecoderErrorCallback. This
* pointer must not be \c NULL.
* \param client_data This value will be supplied to callbacks in their
* \a client_data argument.
* \assert
* \code decoder != NULL \endcode
* \retval FLAC__StreamDecoderInitStatus
* \c FLAC__STREAM_DECODER_INIT_STATUS_OK if initialization was successful;
* see FLAC__StreamDecoderInitStatus for the meanings of other return values.
*/
FLAC_API FLAC__StreamDecoderInitStatus FLAC__stream_decoder_init_ogg_file(
FLAC__StreamDecoder *decoder,
const char *filename,
FLAC__StreamDecoderWriteCallback write_callback,
FLAC__StreamDecoderMetadataCallback metadata_callback,
FLAC__StreamDecoderErrorCallback error_callback,
void *client_data
);
/** Finish the decoding process.
* Flushes the decoding buffer, releases resources, resets the decoder
* settings to their defaults, and returns the decoder state to

View File

@@ -219,6 +219,9 @@ typedef enum {
* can be processed.
*/
FLAC__STREAM_ENCODER_OGG_ERROR,
/**< An error occurred in the underlying Ogg layer. */
FLAC__STREAM_ENCODER_VERIFY_DECODER_ERROR,
/**< An error occurred in the underlying verify stream decoder;
* check FLAC__stream_encoder_get_verify_decoder_state().
@@ -254,6 +257,7 @@ typedef enum {
*/
extern FLAC_API const char * const FLAC__StreamEncoderStateString[];
/** Possible return values for the FLAC__stream_encoder_init_*() functions.
*/
typedef enum {
@@ -264,6 +268,11 @@ typedef enum {
FLAC__STREAM_ENCODER_INIT_STATUS_ENCODER_ERROR,
/**< General failure to set up encoder; call FLAC__stream_encoder_get_state() for cause. */
FLAC__STREAM_ENCODER_INIT_STATUS_UNSUPPORTED_CONTAINER,
/**< The library was not compiled with support for the given container
* format.
*/
FLAC__STREAM_ENCODER_INIT_STATUS_INVALID_CALLBACKS,
/**< A required callback was not supplied. */
@@ -324,6 +333,33 @@ typedef enum {
*/
extern FLAC_API const char * const FLAC__StreamEncoderInitStatusString[];
/** Return values for the FLAC__StreamEncoder read callback.
*/
typedef enum {
FLAC__STREAM_ENCODER_READ_STATUS_CONTINUE,
/**< The read was OK and decoding can continue. */
FLAC__STREAM_ENCODER_READ_STATUS_END_OF_STREAM,
/**< The read was attempted at the end of the stream. */
FLAC__STREAM_ENCODER_READ_STATUS_ABORT,
/**< An unrecoverable error occurred. */
FLAC__STREAM_ENCODER_READ_STATUS_UNSUPPORTED
/**< Client does not support reading back from the output. */
} FLAC__StreamEncoderReadStatus;
/** Maps a FLAC__StreamEncoderReadStatus to a C string.
*
* Using a FLAC__StreamEncoderReadStatus as the index to this array
* will give the string equivalent. The contents should not be modified.
*/
extern FLAC_API const char * const FLAC__StreamEncoderReadStatusString[];
/** Return values for the FLAC__StreamEncoder write callback.
*/
typedef enum {
@@ -343,6 +379,7 @@ typedef enum {
*/
extern FLAC_API const char * const FLAC__StreamEncoderWriteStatusString[];
/** Return values for the FLAC__StreamEncoder seek callback.
*/
typedef enum {
@@ -406,6 +443,38 @@ typedef struct {
struct FLAC__StreamEncoderPrivate *private_; /* avoid the C++ keyword 'private' */
} FLAC__StreamEncoder;
/** Signature for the read callback.
*
* A function pointer matching this signature must be passed to
* FLAC__stream_encoder_init_ogg_stream() if seeking is supported.
* The supplied function will be called when the encoder needs to read back
* encoded data. This happens during the metadata callback, when the encoder
* has to read, modify, and rewrite the metadata (e.g. seekpoints) gathered
* while encoding. The address of the buffer to be filled is supplied, along
* with the number of bytes the buffer can hold. The callback may choose to
* supply less data and modify the byte count but must be careful not to
* overflow the buffer. The callback then returns a status code chosen from
* FLAC__StreamEncoderReadStatus.
*
* \note In general, FLAC__StreamEncoder functions which change the
* state should not be called on the \a encoder while in the callback.
*
* \param encoder The encoder instance calling the callback.
* \param buffer A pointer to a location for the callee to store
* data to be encoded.
* \param bytes A pointer to the size of the buffer. On entry
* to the callback, it contains the maximum number
* of bytes that may be stored in \a buffer. The
* callee must set it to the actual number of bytes
* stored (0 in case of error or end-of-stream) before
* returning.
* \param client_data The callee's client data set through
* FLAC__stream_encoder_set_client_data().
* \retval FLAC__StreamEncoderReadStatus
* The callee's return status.
*/
typedef FLAC__StreamEncoderReadStatus (*FLAC__StreamEncoderReadCallback)(const FLAC__StreamEncoder *encoder, FLAC__byte buffer[], unsigned *bytes, void *client_data);
/** Signature for the write callback.
*
* A function pointer matching this signature must be passed to
@@ -421,6 +490,13 @@ typedef struct {
* number that is being written; otherwise it indicates that the write
* callback is being called to write metadata.
*
* \note
* Unlike when writing to native FLAC, when writing to Ogg FLAC the
* write callback will be called twice when writing each audio
* frame; once for the page header, and once for the page body.
* When writing the page header, the \a samples argument to the
* write callback will be \c 0.
*
* \note In general, FLAC__StreamEncoder functions which change the
* state should not be called on the \a encoder while in the callback.
*
@@ -558,6 +634,25 @@ FLAC_API void FLAC__stream_encoder_delete(FLAC__StreamEncoder *encoder);
*
***********************************************************************/
/** Set the serial number for the FLAC stream to use in the Ogg container.
*
* \note
* This does not need to be set for native FLAC encoding.
*
* \note
* It is recommended to set a serial number explicitly as the default of '0'
* may collide with other streams.
*
* \default \c 0
* \param encoder An encoder instance to set.
* \param serial_number See above.
* \assert
* \code encoder != NULL \endcode
* \retval FLAC__bool
* \c false if the encoder is already initialized, else \c true.
*/
FLAC_API FLAC__bool FLAC__stream_encoder_set_serial_number(FLAC__StreamEncoder *encoder, long serial_number);
/** Set the "verify" flag. If \c true, the encoder will verify it's own
* encoded output by feeding it through an internal decoder and comparing
* the original signal against the decoded signal. If a mismatch occurs,
@@ -919,6 +1014,19 @@ FLAC_API FLAC__bool FLAC__stream_encoder_set_total_samples_estimate(FLAC__Stream
* block is present in the \a metadata array, libFLAC will write an
* empty one, containing only the vendor string.
*
* \note The Ogg FLAC mapping requires that the VORBIS_COMMENT block be
* the second metadata block of the stream. The encoder already supplies
* the STREAMINFO block automatically. If \a metadata does not contain a
* VORBIS_COMMENT block, the encoder will supply that too. Otherwise, if
* \a metadata does contain a VORBIS_COMMENT block and it is not the
* first, this function will reorder \a metadata by moving the
* VORBIS_COMMENT block to the front; the relative ordering of the other
* blocks will remain as they were.
*
* \note The Ogg FLAC mapping limits the number of metadata blocks per
* stream to \c 65535. If \a num_blocks exceeds this the function will
* return \c false.
*
* \default \c NULL, 0
* \param encoder An encoder instance to set.
* \param metadata See above.
@@ -927,6 +1035,8 @@ FLAC_API FLAC__bool FLAC__stream_encoder_set_total_samples_estimate(FLAC__Stream
* \code encoder != NULL \endcode
* \retval FLAC__bool
* \c false if the encoder is already initialized, else \c true.
* \c false if the encoder is already initialized, or if
* \a num_blocks > 65535 if encoding to Ogg FLAC, else \c true.
*/
FLAC_API FLAC__bool FLAC__stream_encoder_set_metadata(FLAC__StreamEncoder *encoder, FLAC__StreamMetadata **metadata, unsigned num_blocks);
@@ -1157,12 +1267,13 @@ FLAC_API unsigned FLAC__stream_encoder_get_rice_parameter_search_dist(const FLAC
*/
FLAC_API FLAC__uint64 FLAC__stream_encoder_get_total_samples_estimate(const FLAC__StreamEncoder *encoder);
/** Initialize the encoder instance.
/** Initialize the encoder instance to encode native FLAC streams.
*
* This flavor of initialization sets up the encoder to encode to a stream.
* I/O is performed via callbacks to the client. For encoding to a plain file
* via filename or open \c FILE*, FLAC__stream_encoder_init_file() and
* FLAC__stream_encoder_init_FILE() provide a simpler interface.
* This flavor of initialization sets up the encoder to encode to a
* native FLAC stream. I/O is performed via callbacks to the client.
* For encoding to a plain file via filename or open \c FILE*,
* FLAC__stream_encoder_init_file() and FLAC__stream_encoder_init_FILE()
* provide a simpler interface.
*
* This function should be called after FLAC__stream_encoder_new() and
* FLAC__stream_encoder_set_*() but before FLAC__stream_encoder_process()
@@ -1219,20 +1330,84 @@ FLAC_API FLAC__uint64 FLAC__stream_encoder_get_total_samples_estimate(const FLAC
*/
FLAC_API FLAC__StreamEncoderInitStatus FLAC__stream_encoder_init_stream(FLAC__StreamEncoder *encoder, FLAC__StreamEncoderWriteCallback write_callback, FLAC__StreamEncoderSeekCallback seek_callback, FLAC__StreamEncoderTellCallback tell_callback, FLAC__StreamEncoderMetadataCallback metadata_callback, void *client_data);
/** Initialize the encoder instance.
/** Initialize the encoder instance to encode Ogg FLAC streams.
*
* This flavor of initialization sets up the encoder to encode to a plain
* file. For non-stdio streams, you must use
* FLAC__stream_encoder_init_stream() and provide callbacks for the I/O.
* This flavor of initialization sets up the encoder to encode to a FLAC
* stream in an Ogg container. I/O is performed via callbacks to the
* client. For encoding to a plain file via filename or open \c FILE*,
* FLAC__stream_encoder_init_ogg_file() and FLAC__stream_encoder_init_ogg_FILE()
* provide a simpler interface.
*
* This function should be called after FLAC__stream_encoder_new() and
* FLAC__stream_encoder_set_*() but before FLAC__stream_encoder_process()
* or FLAC__stream_encoder_process_interleaved().
* initialization succeeded.
*
* The call to FLAC__stream_encoder_init_stream() currently will also immediately
* call the write callback several times, once with the \c fLaC signature,
* and once for each encoded metadata block.
* The call to FLAC__stream_encoder_init_ogg_stream() 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.
* \param read_callback See FLAC__StreamEncoderReadCallback. This
* pointer must not be \c NULL if \a seek_callback
* is non-NULL since they are both needed to be
* able to write data back to the Ogg FLAC stream
* in the post-encode phase.
* \param write_callback See FLAC__StreamEncoderWriteCallback. This
* pointer must not be \c NULL.
* \param seek_callback See FLAC__StreamEncoderSeekCallback. This
* pointer may be \c NULL if seeking is not
* supported. The encoder uses seeking to go back
* and write some some stream statistics to the
* STREAMINFO block; this is recommended but not
* necessary to create a valid FLAC stream. If
* \a seek_callback is not \c NULL then a
* \a tell_callback must also be supplied.
* Alternatively, a dummy seek callback that just
* returns \c FLAC__STREAM_ENCODER_SEEK_STATUS_UNSUPPORTED
* may also be supplied, all though this is slightly
* less efficient for the decoder.
* \param tell_callback See FLAC__StreamEncoderTellCallback. This
* pointer may be \c NULL if seeking is not
* supported. If \a seek_callback is \c NULL then
* this argument will be ignored. If
* \a seek_callback is not \c NULL then a
* \a tell_callback must also be supplied.
* Alternatively, a dummy tell callback that just
* returns \c FLAC__STREAM_ENCODER_TELL_STATUS_UNSUPPORTED
* may also be supplied, all though this is slightly
* less efficient for the decoder.
* \param metadata_callback See FLAC__StreamEncoderMetadataCallback. This
* pointer may be \c NULL if the callback is not
* desired. If the client provides a seek callback,
* this function is not necessary as the encoder
* will automatically seek back and update the
* STREAMINFO block. It may also be \c NULL if the
* client does not support seeking, since it will
* have no way of going back to update the
* STREAMINFO. However the client can still supply
* a callback if it would like to know the details
* from the STREAMINFO.
* \param client_data This value will be supplied to callbacks in their
* \a client_data argument.
* \assert
* \code encoder != NULL \endcode
* \retval FLAC__StreamEncoderInitStatus
* \c FLAC__STREAM_ENCODER_INIT_STATUS_OK if initialization was successful;
* see FLAC__StreamEncoderInitStatus for the meanings of other return values.
*/
FLAC_API FLAC__StreamEncoderInitStatus FLAC__stream_encoder_init_ogg_stream(FLAC__StreamEncoder *encoder, FLAC__StreamEncoderReadCallback read_callback, FLAC__StreamEncoderWriteCallback write_callback, FLAC__StreamEncoderSeekCallback seek_callback, FLAC__StreamEncoderTellCallback tell_callback, FLAC__StreamEncoderMetadataCallback metadata_callback, void *client_data);
/** Initialize the encoder instance to encode native FLAC files.
*
* This flavor of initialization sets up the encoder to encode to a
* plain native FLAC file. For non-stdio streams, you must use
* FLAC__stream_encoder_init_stream() and provide callbacks for the I/O.
*
* This function should be called after FLAC__stream_encoder_new() and
* FLAC__stream_encoder_set_*() but before FLAC__stream_encoder_process()
* or FLAC__stream_encoder_process_interleaved().
* initialization succeeded.
*
* \param encoder An uninitialized encoder instance.
* \param file An open file. The file should have been opened
@@ -1258,22 +1433,53 @@ FLAC_API FLAC__StreamEncoderInitStatus FLAC__stream_encoder_init_stream(FLAC__St
*/
FLAC_API FLAC__StreamEncoderInitStatus FLAC__stream_encoder_init_FILE(FLAC__StreamEncoder *encoder, FILE *file, FLAC__StreamEncoderProgressCallback progress_callback, void *client_data);
/** Initialize the encoder instance.
/** Initialize the encoder instance to encode Ogg FLAC files.
*
* This flavor of initialization sets up the encoder to encode to a plain
* file. If POSIX fopen() semantics are not sufficient (for example,
* with Unicode filenames on Windows), you must use
* FLAC__stream_encodeR_init_FILE(), or FLAC__stream_encoder_init_stream()
* and provide callbacks for the I/O.
* This flavor of initialization sets up the encoder to encode to a
* plain Ogg FLAC file. For non-stdio streams, you must use
* FLAC__stream_encoder_init_ogg_stream() and provide callbacks for the I/O.
*
* This function should be called after FLAC__stream_encoder_new() and
* FLAC__stream_encoder_set_*() but before FLAC__stream_encoder_process()
* or FLAC__stream_encoder_process_interleaved().
* initialization succeeded.
*
* The call to FLAC__stream_encoder_init_stream() 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.
* \param file An open file. The file should have been opened
* with mode \c "w+b" and rewound. The file
* becomes owned by the encoder and should not be
* manipulated by the client while encoding.
* Unless \a file is \c stdout, it will be closed
* when FLAC__stream_encoder_finish() is called.
* Note however that a proper SEEKTABLE cannot be
* created when encoding to \c stdout since it is
* not seekable.
* \param progress_callback See FLAC__StreamEncoderProgressCallback. This
* pointer may be \c NULL if the callback is not
* desired.
* \param client_data This value will be supplied to callbacks in their
* \a client_data argument.
* \assert
* \code encoder != NULL \endcode
* \code file != NULL \endcode
* \retval FLAC__StreamEncoderInitStatus
* \c FLAC__STREAM_ENCODER_INIT_STATUS_OK if initialization was successful;
* see FLAC__StreamEncoderInitStatus for the meanings of other return values.
*/
FLAC_API FLAC__StreamEncoderInitStatus FLAC__stream_encoder_init_ogg_FILE(FLAC__StreamEncoder *encoder, FILE *file, FLAC__StreamEncoderProgressCallback progress_callback, void *client_data);
/** Initialize the encoder instance to encode native FLAC files.
*
* This flavor of initialization sets up the encoder to encode to a plain
* FLAC file. If POSIX fopen() semantics are not sufficient (for example,
* with Unicode filenames on Windows), you must use
* FLAC__stream_encoder_init_FILE(), or FLAC__stream_encoder_init_stream()
* and provide callbacks for the I/O.
*
* This function should be called after FLAC__stream_encoder_new() and
* FLAC__stream_encoder_set_*() but before FLAC__stream_encoder_process()
* or FLAC__stream_encoder_process_interleaved().
* initialization succeeded.
*
* \param encoder An uninitialized encoder instance.
* \param filename The name of the file to encode to. The file will
@@ -1294,6 +1500,38 @@ FLAC_API FLAC__StreamEncoderInitStatus FLAC__stream_encoder_init_FILE(FLAC__Stre
*/
FLAC_API FLAC__StreamEncoderInitStatus FLAC__stream_encoder_init_file(FLAC__StreamEncoder *encoder, const char *filename, FLAC__StreamEncoderProgressCallback progress_callback, void *client_data);
/** Initialize the encoder instance to encode Ogg FLAC files.
*
* This flavor of initialization sets up the encoder to encode to a plain
* Ogg FLAC file. If POSIX fopen() semantics are not sufficient (for example,
* with Unicode filenames on Windows), you must use
* FLAC__stream_encoder_init_ogg_FILE(), or FLAC__stream_encoder_init_ogg_stream()
* and provide callbacks for the I/O.
*
* This function should be called after FLAC__stream_encoder_new() and
* FLAC__stream_encoder_set_*() but before FLAC__stream_encoder_process()
* or FLAC__stream_encoder_process_interleaved().
* initialization succeeded.
*
* \param encoder An uninitialized encoder instance.
* \param filename The name of the file to encode to. The file will
* be opened with fopen(). Use \c NULL to encode to
* \c stdout. Note however that a proper SEEKTABLE
* cannot be created when encoding to \c stdout since
* it is not seekable.
* \param progress_callback See FLAC__StreamEncoderProgressCallback. This
* pointer may be \c NULL if the callback is not
* desired.
* \param client_data This value will be supplied to callbacks in their
* \a client_data argument.
* \assert
* \code encoder != NULL \endcode
* \retval FLAC__StreamEncoderInitStatus
* \c FLAC__STREAM_ENCODER_INIT_STATUS_OK if initialization was successful;
* see FLAC__StreamEncoderInitStatus for the meanings of other return values.
*/
FLAC_API FLAC__StreamEncoderInitStatus FLAC__stream_encoder_init_ogg_file(FLAC__StreamEncoder *encoder, const char *filename, FLAC__StreamEncoderProgressCallback progress_callback, void *client_data);
/** Finish the encoding process.
* Flushes the encoding buffer, releases resources, resets the encoder
* settings to their defaults, and returns the encoder state to

View File

@@ -15,8 +15,4 @@
# restrictive of those mentioned above. See the file COPYING.Xiph in this
# distribution.
if FLaC__HAS_OGG
OGGFLAC_DIRS = OggFLAC OggFLAC++
endif
SUBDIRS = FLAC FLAC++ $(OGGFLAC_DIRS) share test_libs_common
SUBDIRS = FLAC FLAC++ share test_libs_common

View File

@@ -1,37 +0,0 @@
# libOggFLAC++ - Free Lossless Audio Codec + Ogg library
# Copyright (C) 2002,2003,2004,2005,2006 Josh Coalson
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# - Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
#
# - 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.
oggflaccppincludedir = $(includedir)/OggFLAC++
oggflaccppinclude_HEADERS = \
all.h \
decoder.h \
encoder.h \
export.h

View File

@@ -1,47 +0,0 @@
/* libOggFLAC++ - Free Lossless Audio Codec + Ogg library
* Copyright (C) 2002,2003,2004,2005,2006 Josh Coalson
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* - Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* - 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.
*/
#ifndef OggFLACPP__ALL_H
#define OggFLACPP__ALL_H
#include "export.h"
#include "encoder.h"
#include "decoder.h"
/** \defgroup oggflacpp OggFLAC C++ API
*
* The OggFLAC C++ API is the interface to libOggFLAC++, a set of classes
* that encapsulate the encoders and decoders in libOggFLAC.
*
*/
#endif

View File

@@ -1,267 +0,0 @@
/* libOggFLAC++ - Free Lossless Audio Codec + Ogg library
* Copyright (C) 2002,2003,2004,2005,2006 Josh Coalson
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* - Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* - 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.
*/
#ifndef OggFLACPP__DECODER_H
#define OggFLACPP__DECODER_H
#include "export.h"
#include "OggFLAC/stream_decoder.h"
// we only need this for the state abstraction really...
#include "FLAC++/decoder.h"
/** \file include/OggFLAC++/decoder.h
*
* \brief
* This module contains the classes which implement the various
* decoders.
*
* See the detailed documentation in the
* \link oggflacpp_decoder decoder \endlink module.
*/
/** \defgroup oggflacpp_decoder OggFLAC++/decoder.h: decoder classes
* \ingroup oggflacpp
*
* \brief
* This module describes the decoder layers provided by libOggFLAC++.
*
* The libOggFLAC++ decoder classes are object wrappers around their
* counterparts in libOggFLAC. All decoding layers available in
* libOggFLAC are also provided here. The interface is very similar;
* make sure to read the \link oggflac_decoder libOggFLAC decoder module \endlink.
*
* There are only two significant differences here. First, instead of
* passing in C function pointers for callbacks, you inherit from the
* decoder class and provide implementations for the callbacks in your
* derived class; because of this there is no need for a 'client_data'
* property.
*
* Second, there are two stream decoder classes. OggFLAC::Decoder::Stream
* is used for the same cases that OggFLAC__stream_decoder_init_stream() is
* used, and OggFLAC::Decoder::File is used for the same cases that
* OggFLAC__stream_decoder_init_FILE() and OggFLAC__stream_decoder_init_file()
* are used.
*
* Note that OggFLAC::Decoder::Stream inherits from FLAC::Decoder::Stream so
* it is possible to support both FLAC and Ogg FLAC decoding with only a
* little specialized code (just up to initialization). For example,
* \code
* class MyFLACDecoder: public FLAC::Decoder::Stream
* {
* // implement callbacks
* };
* FLAC::Decoder::Stream *flac = new MyFLACDecoder();
* if(*flac) {
* flac->set_...();
* // continue set_ calls()
* if(flac->init() == ::FLAC__STREAM_DECODER_INIT_STATUS_OK)
* my_process_stream(flac);
* }
*
* ...
*
* class MyOggFLACDecoder: public OggFLAC::Decoder::Stream
* {
* // implement callbacks
* };
* FLAC::Decoder::Stream *oggflac = new MyOggFLACDecoder();
* if(*oggflac) {
* oggflac->set_serial_number();
* // continue set_ calls()
* if(oggflac->init() == ::FLAC__STREAM_DECODER_INIT_STATUS_OK)
* my_process_stream(oggflac);
* }
* \endcode
*/
namespace OggFLAC {
namespace Decoder {
/** \defgroup oggflacpp_stream_decoder OggFLAC++/decoder.h: stream decoder class
* \ingroup oggflacpp_decoder
*
* \brief
* This class wraps the ::OggFLAC__StreamDecoder.
*
* See the \link oggflac_stream_decoder libOggFLAC stream decoder module \endlink
* for basic usage.
*
* \{
*/
/** This class wraps the ::OggFLAC__StreamDecoder. If you are
* decoding from a file, OggFLAC::Decoder::File may be more
* convenient.
*
* The usage of this class is similar to OggFLAC__StreamDecoder,
* except instead of providing callbacks to
* OggFLAC__stream_decoder_init_stream(), you will inherit from this
* class and override the virtual callback functions with your
* own implementations, then call Stream::init(). The rest of
* the calls work the same as in the C layer.
*
* Only the read, write, and error callbacks are mandatory. The
* others are optional; this class provides default
* implementations that do nothing. In order for seeking to work
* you must overide seek_callback(), tell_callback(),
* length_callback(), and eof_callback().
*/
class OggFLACPP_API Stream: public FLAC::Decoder::Stream {
public:
/** This class is a wrapper around OggFLAC__StreamDecoderState.
*/
class OggFLACPP_API State {
public:
inline State(::OggFLAC__StreamDecoderState state): state_(state) { }
inline operator ::OggFLAC__StreamDecoderState() const { return state_; }
inline const char *as_cstring() const { return ::OggFLAC__StreamDecoderStateString[state_]; }
inline const char *resolved_as_cstring(const Stream &decoder) const { return ::OggFLAC__stream_decoder_get_resolved_state_string((const OggFLAC__StreamDecoder*)decoder.decoder_); }
protected:
::OggFLAC__StreamDecoderState state_;
};
Stream();
virtual ~Stream();
bool set_serial_number(long value); ///< See OggFLAC__stream_decoder_set_serial_number()
bool set_md5_checking(bool value); ///< See OggFLAC__stream_decoder_set_md5_checking()
bool set_metadata_respond(::FLAC__MetadataType type); ///< See OggFLAC__stream_decoder_set_metadata_respond()
bool set_metadata_respond_application(const FLAC__byte id[4]); ///< See OggFLAC__stream_decoder_set_metadata_respond_application()
bool set_metadata_respond_all(); ///< See OggFLAC__stream_decoder_set_metadata_respond_all()
bool set_metadata_ignore(::FLAC__MetadataType type); ///< See OggFLAC__stream_decoder_set_metadata_ignore()
bool set_metadata_ignore_application(const FLAC__byte id[4]); ///< See OggFLAC__stream_decoder_set_metadata_ignore_application()
bool set_metadata_ignore_all(); ///< See OggFLAC__stream_decoder_set_metadata_ignore_all()
State get_state() const; ///< See OggFLAC__stream_decoder_get_state()
FLAC::Decoder::Stream::State get_FLAC_stream_decoder_state() const; ///< See OggFLAC__stream_decoder_get_FLAC_stream_decoder_state()
bool get_md5_checking() const; ///< See OggFLAC__stream_decoder_get_md5_checking()
FLAC__uint64 get_total_samples() const; ///< See OggFLAC__stream_decoder_get_total_samples()
unsigned get_channels() const; ///< See OggFLAC__stream_decoder_get_channels()
::FLAC__ChannelAssignment get_channel_assignment() const; ///< See OggFLAC__stream_decoder_get_channel_assignment()
unsigned get_bits_per_sample() const; ///< See OggFLAC__stream_decoder_get_bits_per_sample()
unsigned get_sample_rate() const; ///< See OggFLAC__stream_decoder_get_sample_rate()
unsigned get_blocksize() const; ///< See OggFLAC__stream_decoder_get_blocksize()
/** Initialize the instance; as with the C interface,
* init() should be called after construction and 'set'
* calls but before any of the 'process' calls.
*
* See OggFLAC__stream_decoder_init_stream().
*/
::FLAC__StreamDecoderInitStatus init();
void finish(); ///< See OggFLAC__stream_decoder_finish()
bool flush(); ///< See OggFLAC__stream_decoder_flush()
bool reset(); ///< See OggFLAC__stream_decoder_reset()
bool process_single(); ///< See OggFLAC__stream_decoder_process_single()
bool process_until_end_of_metadata(); ///< See OggFLAC__stream_decoder_process_until_end_of_metadata()
bool process_until_end_of_stream(); ///< See OggFLAC__stream_decoder_process_until_end_of_stream()
bool skip_single_frame(); ///< See OggFLAC__stream_decoder_skip_single_frame()
bool seek_absolute(FLAC__uint64 sample); ///< See OggFLAC__stream_decoder_seek_absolute()
protected:
#if (defined _MSC_VER) || (defined __GNUG__ && (__GNUG__ < 2 || (__GNUG__ == 2 && __GNUC_MINOR__ < 96))) || (defined __SUNPRO_CC)
// lame hack: some MSVC/GCC versions can't see a protected decoder_ from nested State::resolved_as_cstring()
friend State;
#endif
private:
// Private and undefined so you can't use them:
Stream(const Stream &);
void operator=(const Stream &);
};
/* \} */
/** \defgroup oggflacpp_file_decoder OggFLAC++/decoder.h: file decoder class
* \ingroup oggflacpp_decoder
*
* \brief
* This class wraps the ::OggFLAC__FileDecoder.
*
* See the \link oggflac_stream_decoder libOggFLAC stream decoder module \endlink
* for basic usage.
*
* \{
*/
/** This class wraps the ::OggFLAC__StreamDecoder. If you are
* not decoding from a file, you may need to use
* OggFLAC::Decoder::Stream.
*
* The usage of this class is similar to OggFLAC__StreamDecoder,
* except instead of providing callbacks to
* OggFLAC__stream_decoder_init_FILE() or
* OggFLAC__stream_decoder_init_file(), you will inherit from this
* class and override the virtual callback functions with your
* own implementations, then call File::init(). The rest of
* the calls work the same as in the C layer.
*
* Only the write, and error callbacks from OggFLAC::Decoder::Stream
* are mandatory. The others are optional; this class provides
* full working implementations for all other callbacks and
* supports seeking.
*/
class OggFLACPP_API File: public Stream {
public:
File();
virtual ~File();
//@{
/** Initialize the instance; as with the C interface,
* init() should be called after construction and 'set'
* calls but before any of the 'process' calls.
*
* See OggFLAC__stream_decoder_init_FILE() and
* OggFLAC__stream_decoder_init_file().
*/
::FLAC__StreamDecoderInitStatus init(FILE *file);
::FLAC__StreamDecoderInitStatus init(const char *filename);
::FLAC__StreamDecoderInitStatus init(const std::string &filename);
//@}
protected:
// this is a dummy implementation to satisfy the pure virtual in Stream that is actually supplied internally by the C layer
virtual ::FLAC__StreamDecoderReadStatus read_callback(FLAC__byte buffer[], unsigned *bytes);
private:
// Private and undefined so you can't use them:
File(const File &);
void operator=(const File &);
};
/* \} */
}
}
#endif

View File

@@ -1,298 +0,0 @@
/* libOggFLAC++ - Free Lossless Audio Codec + Ogg library
* Copyright (C) 2002,2003,2004,2005,2006 Josh Coalson
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* - Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* - 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.
*/
#ifndef OggFLACPP__ENCODER_H
#define OggFLACPP__ENCODER_H
#include "export.h"
#include "OggFLAC/stream_encoder.h"
#include "decoder.h"
// we only need these for the state abstractions really...
#include "FLAC++/decoder.h"
#include "FLAC++/encoder.h"
/** \file include/OggFLAC++/encoder.h
*
* \brief
* This module contains the classes which implement the various
* encoders.
*
* See the detailed documentation in the
* \link oggflacpp_encoder encoder \endlink module.
*/
/** \defgroup oggflacpp_encoder OggFLAC++/encoder.h: encoder classes
* \ingroup oggflacpp
*
* \brief
* This module describes the encoder layers provided by libOggFLAC++.
*
* The libOggFLAC++ encoder classes are object wrappers around their
* counterparts in libOggFLAC. All decoding layers available in
* libOggFLAC are also provided here. The interface is very similar;
* make sure to read the \link oggflac_encoder libOggFLAC encoder module \endlink.
*
* There are only two significant differences here. First, instead of
* passing in C function pointers for callbacks, you inherit from the
* encoder class and provide implementations for the callbacks in your
* derived class; because of this there is no need for a 'client_data'
* property.
*
* Second, there are two stream encoder classes. OggFLAC::Encoder::Stream
* is used for the same cases that OggFLAC__stream_encoder_init_stream() is
* used, and OggFLAC::Encoder::File is used for the same cases that
* OggFLAC__stream_encoder_init_FILE() and OggFLAC__stream_encoder_init_file()
* are used.
*
* Note that OggFLAC::Encoder::Stream inherits from FLAC::Encoder::Stream so
* it is possible to support both FLAC and Ogg FLAC encoding with only a
* little specialized code (just up to initialization). For example,
* \code
* class MyFLACEncoder: public FLAC::Encoder::Stream
* {
* // implement callbacks
* };
* FLAC::Encoder::Stream *flac = new MyFLACEncoder();
* if(*flac) {
* flac->set_...();
* // continue set_ calls()
* if(flac->init() == ::FLAC__STREAM_ENCODER_INIT_STATUS_OK)
* my_process_stream(flac);
* }
*
* ...
*
* class MyOggFLACEncoder: public OggFLAC::Encoder::Stream
* {
* // implement callbacks
* };
* FLAC::Encoder::Stream *oggflac = new MyOggFLACEncoder();
* if(*oggflac) {
* oggflac->set_serial_number();
* // continue set_ calls()
* if(oggflac->init() == ::FLAC__STREAM_ENCODER_INIT_STATUS_OK)
* my_process_stream(oggflac);
* }
* \endcode
*/
namespace OggFLAC {
namespace Encoder {
/** \defgroup oggflacpp_stream_encoder OggFLAC++/encoder.h: stream encoder class
* \ingroup oggflacpp_encoder
*
* \brief
* This class wraps the ::OggFLAC__StreamEncoder.
*
* See the \link oggflac_stream_encoder libOggFLAC stream encoder module \endlink
* for basic usage.
*
* \{
*/
/** This class wraps the ::OggFLAC__StreamEncoder. If you are
* encoding to a file, OggFLAC::Encoder::File may be more
* convenient.
*
* The usage of this class is similar to OggFLAC__StreamEncoder,
* except instead of providing callbacks to
* OggFLAC__stream_encoder_init_stream(), you will inherit from this
* class and override the virtual callback functions with your
* own implementations, then call Stream::init(). The rest of
* the calls work the same as in the C layer.
*
* Only the write callback is mandatory. The others are
* optional; this class provides default implementations that do
* nothing. In order for some STREAMINFO and SEEKTABLE data to
* be written properly, you must overide read_callback(), seek_callback() and
* tell_callback(); see OggFLAC__stream_encoder_init_stream() as to
* why.
*/
class OggFLACPP_API Stream: public FLAC::Encoder::Stream {
public:
/** This class is a wrapper around OggFLAC__StreamEncoderState.
*/
class OggFLACPP_API State {
public:
inline State(::OggFLAC__StreamEncoderState state): state_(state) { }
inline operator ::OggFLAC__StreamEncoderState() const { return state_; }
inline const char *as_cstring() const { return ::OggFLAC__StreamEncoderStateString[state_]; }
inline const char *resolved_as_cstring(const Stream &encoder) const { return ::OggFLAC__stream_encoder_get_resolved_state_string((const OggFLAC__StreamEncoder*)encoder.encoder_); }
protected:
::OggFLAC__StreamEncoderState state_;
};
Stream();
virtual ~Stream();
bool set_serial_number(long value); ///< See OggFLAC__stream_encoder_set_serial_number()
bool set_verify(bool value); ///< See OggFLAC__stream_encoder_set_verify()
bool set_streamable_subset(bool value); ///< See OggFLAC__stream_encoder_set_streamable_subset()
bool set_do_mid_side_stereo(bool value); ///< See OggFLAC__stream_encoder_set_do_mid_side_stereo()
bool set_loose_mid_side_stereo(bool value); ///< See OggFLAC__stream_encoder_set_loose_mid_side_stereo()
bool set_channels(unsigned value); ///< See OggFLAC__stream_encoder_set_channels()
bool set_bits_per_sample(unsigned value); ///< See OggFLAC__stream_encoder_set_bits_per_sample()
bool set_sample_rate(unsigned value); ///< See OggFLAC__stream_encoder_set_sample_rate()
bool set_blocksize(unsigned value); ///< See OggFLAC__stream_encoder_set_blocksize()
bool set_apodization(const char *specification); ///< See OggFLAC__stream_encoder_set_apodization()
bool set_max_lpc_order(unsigned value); ///< See OggFLAC__stream_encoder_set_max_lpc_order()
bool set_qlp_coeff_precision(unsigned value); ///< See OggFLAC__stream_encoder_set_qlp_coeff_precision()
bool set_do_qlp_coeff_prec_search(bool value); ///< See OggFLAC__stream_encoder_set_do_qlp_coeff_prec_search()
bool set_do_escape_coding(bool value); ///< See OggFLAC__stream_encoder_set_do_escape_coding()
bool set_do_exhaustive_model_search(bool value); ///< See OggFLAC__stream_encoder_set_do_exhaustive_model_search()
bool set_min_residual_partition_order(unsigned value); ///< See OggFLAC__stream_encoder_set_min_residual_partition_order()
bool set_max_residual_partition_order(unsigned value); ///< See OggFLAC__stream_encoder_set_max_residual_partition_order()
bool set_rice_parameter_search_dist(unsigned value); ///< See OggFLAC__stream_encoder_set_rice_parameter_search_dist()
bool set_total_samples_estimate(FLAC__uint64 value); ///< See OggFLAC__stream_encoder_set_total_samples_estimate()
bool set_metadata(::FLAC__StreamMetadata **metadata, unsigned num_blocks); ///< See OggFLAC__stream_encoder_set_metadata()
bool set_metadata(FLAC::Metadata::Prototype **metadata, unsigned num_blocks); ///< See OggFLAC__stream_encoder_set_metadata()
State get_state() const; ///< See OggFLAC__stream_encoder_get_state()
FLAC::Encoder::Stream::State get_FLAC_stream_encoder_state() const; ///< See OggFLAC__stream_encoder_get_FLAC_stream_encoder_state()
FLAC::Decoder::Stream::State get_verify_decoder_state() const; ///< See OggFLAC__stream_encoder_get_verify_decoder_state()
void get_verify_decoder_error_stats(FLAC__uint64 *absolute_sample, unsigned *frame_number, unsigned *channel, unsigned *sample, FLAC__int32 *expected, FLAC__int32 *got); ///< See OggFLAC__stream_encoder_get_verify_decoder_error_stats()
bool get_verify() const; ///< See OggFLAC__stream_encoder_get_verify()
bool get_streamable_subset() const; ///< See OggFLAC__stream_encoder_get_streamable_subset()
bool get_do_mid_side_stereo() const; ///< See OggFLAC__stream_encoder_get_do_mid_side_stereo()
bool get_loose_mid_side_stereo() const; ///< See OggFLAC__stream_encoder_get_loose_mid_side_stereo()
unsigned get_channels() const; ///< See OggFLAC__stream_encoder_get_channels()
unsigned get_bits_per_sample() const; ///< See OggFLAC__stream_encoder_get_bits_per_sample()
unsigned get_sample_rate() const; ///< See OggFLAC__stream_encoder_get_sample_rate()
unsigned get_blocksize() const; ///< See OggFLAC__stream_encoder_get_blocksize()
unsigned get_max_lpc_order() const; ///< See OggFLAC__stream_encoder_get_max_lpc_order()
unsigned get_qlp_coeff_precision() const; ///< See OggFLAC__stream_encoder_get_qlp_coeff_precision()
bool get_do_qlp_coeff_prec_search() const; ///< See OggFLAC__stream_encoder_get_do_qlp_coeff_prec_search()
bool get_do_escape_coding() const; ///< See OggFLAC__stream_encoder_get_do_escape_coding()
bool get_do_exhaustive_model_search() const; ///< See OggFLAC__stream_encoder_get_do_exhaustive_model_search()
unsigned get_min_residual_partition_order() const; ///< See OggFLAC__stream_encoder_get_min_residual_partition_order()
unsigned get_max_residual_partition_order() const; ///< See OggFLAC__stream_encoder_get_max_residual_partition_order()
unsigned get_rice_parameter_search_dist() const; ///< See OggFLAC__stream_encoder_get_rice_parameter_search_dist()
FLAC__uint64 get_total_samples_estimate() const; ///< See OggFLAC__stream_encoder_get_total_samples_estimate()
/** Initialize the instance; as with the C interface,
* init() should be called after construction and 'set'
* calls but before any of the 'process' calls.
*
* See OggFLAC__stream_encoder_init_stream().
*/
::FLAC__StreamEncoderInitStatus init();
void finish(); ///< See OggFLAC__stream_encoder_finish()
bool process(const FLAC__int32 * const buffer[], unsigned samples); ///< See OggFLAC__stream_encoder_process()
bool process_interleaved(const FLAC__int32 buffer[], unsigned samples); ///< See OggFLAC__stream_encoder_process_interleaved()
protected:
/// See OggFLAC__StreamEncoderReadCallback
virtual ::OggFLAC__StreamEncoderReadStatus read_callback(FLAC__byte buffer[], unsigned *bytes);
#if (defined _MSC_VER) || (defined __GNUG__ && (__GNUG__ < 2 || (__GNUG__ == 2 && __GNUC_MINOR__ < 96))) || (defined __SUNPRO_CC)
// lame hack: some MSVC/GCC versions can't see a protected encoder_ from nested State::resolved_as_cstring()
friend State;
#endif
static ::OggFLAC__StreamEncoderReadStatus read_callback_(const ::OggFLAC__StreamEncoder *encoder, FLAC__byte buffer[], unsigned *bytes, void *client_data);
private:
// Private and undefined so you can't use them:
Stream(const Stream &);
void operator=(const Stream &);
};
/* \} */
/** \defgroup oggflacpp_file_encoder OggFLAC++/encoder.h: file encoder class
* \ingroup oggflacpp_encoder
*
* \brief
* This class wraps the ::OggFLAC__FileEncoder.
*
* See the \link oggflac_stream_encoder libOggFLAC stream encoder module \endlink
* for basic usage.
*
* \{
*/
/** This class wraps the ::OggFLAC__StreamEncoder. If you are
* not encoding to a file, you may need to use
* OggFLAC::Encoder::Stream.
*
* The usage of this class is similar to OggFLAC__StreamEncoder,
* except instead of providing callbacks to
* OggFLAC__stream_encoder_init_FILE() or
* OggFLAC__stream_encoder_init_file(), you will inherit from this
* class and override the virtual callback functions with your
* own implementations, then call File::init(). The rest of
* the calls work the same as in the C layer.
*
* There are no mandatory callbacks; all the callbacks from
* OggFLAC::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.
*/
class OggFLACPP_API File: public Stream {
public:
File();
virtual ~File();
//@{
/** Initialize the instance; as with the C interface,
* init() should be called after construction and 'set'
* calls but before any of the 'process' calls.
*
* See OggFLAC__stream_encoder_init_FILE() and
* OggFLAC__stream_encoder_init_file().
*/
::FLAC__StreamEncoderInitStatus init(FILE *file);
::FLAC__StreamEncoderInitStatus init(const char *filename);
::FLAC__StreamEncoderInitStatus init(const std::string &filename);
//@}
protected:
/// See FLAC__StreamEncoderProgressCallback
virtual void progress_callback(FLAC__uint64 bytes_written, FLAC__uint64 samples_written, unsigned frames_written, unsigned total_frames_estimate);
/// This is a dummy implementation to satisfy the pure virtual in Stream that is actually supplied internally by the C layer
virtual ::FLAC__StreamEncoderWriteStatus write_callback(const FLAC__byte buffer[], unsigned bytes, unsigned samples, unsigned current_frame);
private:
static void progress_callback_(const ::FLAC__StreamEncoder *encoder, FLAC__uint64 bytes_written, FLAC__uint64 samples_written, unsigned frames_written, unsigned total_frames_estimate, void *client_data);
// Private and undefined so you can't use them:
File(const Stream &);
void operator=(const Stream &);
};
/* \} */
}
}
#endif

View File

@@ -1,55 +0,0 @@
/* libOggFLAC++ - Free Lossless Audio Codec + Ogg library
* Copyright (C) 2002,2003,2004,2005,2006 Josh Coalson
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* - Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* - 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.
*/
#ifndef OggFLACPP__EXPORT_H
#define OggFLACPP__EXPORT_H
#if defined(FLAC__NO_DLL) || !defined(_MSC_VER)
#define OggFLACPP_API
#else
#ifdef OggFLACPP_API_EXPORTS
#define OggFLACPP_API _declspec(dllexport)
#else
#define OggFLACPP_API _declspec(dllimport)
#endif
#endif
/* These #defines will mirror the libtool-based library version number, see
* http://www.gnu.org/software/libtool/manual.html#Libtool-versioning
*/
#define OggFLACPP_API_VERSION_CURRENT 3
#define OggFLACPP_API_VERSION_REVISION 0
#define OggFLACPP_API_VERSION_AGE 0
#endif

View File

@@ -1,40 +0,0 @@
# libOggFLAC - Free Lossless Audio Codec + Ogg library
# Copyright (C) 2002,2003,2004,2005,2006 Josh Coalson
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# - Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
#
# - 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.
oggflaccincludedir = $(includedir)/OggFLAC
# NOTE: file_decoder.h and seekable_stream_decoder.h are NOT ready
# for distribution yet.
oggflaccinclude_HEADERS = \
all.h \
export.h \
stream_decoder.h \
stream_encoder.h

View File

@@ -1,51 +0,0 @@
/* libOggFLAC - Free Lossless Audio Codec + Ogg library
* Copyright (C) 2002,2003,2004,2005,2006 Josh Coalson
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* - Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* - 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.
*/
#ifndef OggFLAC__ALL_H
#define OggFLAC__ALL_H
/* NOTE: file_decoder.h and seekable_stream_decoder.h are NOT ready
* for distribution yet.
*/
#include "export.h"
#include "stream_decoder.h"
#include "stream_encoder.h"
/** \defgroup oggflac OggFLAC C API
*
* The OggFLAC C API is the interface to libOggFLAC, a set of encoders
* and decoders that wrap around the libFLAC API to provide encoding
* to and decoding from FLAC streams in an Ogg transport.
*/
#endif

View File

@@ -1,55 +0,0 @@
/* libOggFLAC - Free Lossless Audio Codec + Ogg library
* Copyright (C) 2002,2003,2004,2005,2006 Josh Coalson
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* - Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* - 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.
*/
#ifndef OggFLAC__EXPORT_H
#define OggFLAC__EXPORT_H
#if defined(FLAC__NO_DLL) || !defined(_MSC_VER)
#define OggFLAC_API
#else
#ifdef OggFLAC_API_EXPORTS
#define OggFLAC_API _declspec(dllexport)
#else
#define OggFLAC_API _declspec(dllimport)
#endif
#endif
/* These #defines will mirror the libtool-based library version number, see
* http://www.gnu.org/software/libtool/manual.html#Libtool-versioning
*/
#define OggFLAC_API_VERSION_CURRENT 4
#define OggFLAC_API_VERSION_REVISION 0
#define OggFLAC_API_VERSION_AGE 0
#endif

View File

@@ -1,689 +0,0 @@
/* libOggFLAC - Free Lossless Audio Codec + Ogg library
* Copyright (C) 2002,2003,2004,2005,2006 Josh Coalson
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* - Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* - 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.
*/
#ifndef OggFLAC__STREAM_DECODER_H
#define OggFLAC__STREAM_DECODER_H
#include <stdio.h> /* for FILE */
#include "export.h"
#include "FLAC/stream_decoder.h"
#ifdef __cplusplus
extern "C" {
#endif
/** \file include/OggFLAC/stream_decoder.h
*
* \brief
* This module contains the functions which implement the stream
* decoder.
*
* See the detailed documentation in the
* \link oggflac_stream_decoder stream decoder \endlink module.
*/
/** \defgroup oggflac_decoder OggFLAC/ *_decoder.h: decoder interfaces
* \ingroup oggflac
*
* \brief
* This module describes the decoder layers provided by libOggFLAC.
*
* libOggFLAC currently provides the same layers of access as
* libFLAC; the interfaces are nearly identical, with th addition of a
* method for specifying the Ogg serial number. See the
* \link flac_decoder FLAC decoder module \endlink for full documentation.
*/
/** \defgroup oggflac_stream_decoder OggFLAC/stream_decoder.h: stream decoder interface
* \ingroup oggflac_decoder
*
* \brief
* This module contains the functions which implement the stream
* decoder.
*
* The interface here is nearly identical to FLAC's stream decoder,
* including the callbacks, with the addition of
* OggFLAC__stream_decoder_set_serial_number(). See the
* \link flac_stream_decoder FLAC stream decoder module \endlink
* for full documentation.
*
* \{
*/
/** State values for an OggFLAC__StreamDecoder
*
* The decoder's state can be obtained by calling OggFLAC__stream_decoder_get_state().
*/
typedef enum {
OggFLAC__STREAM_DECODER_OK = 0,
/**< The decoder is in the normal OK state. */
OggFLAC__STREAM_DECODER_END_OF_STREAM,
/**< The decoder has reached the end of the stream. */
OggFLAC__STREAM_DECODER_OGG_ERROR,
/**< An error occurred in the underlying Ogg layer. */
OggFLAC__STREAM_DECODER_FLAC_STREAM_DECODER_ERROR,
/**< An error occurred in the underlying FLAC stream decoder;
* check OggFLAC__stream_decoder_get_FLAC_stream_decoder_state().
*/
OggFLAC__STREAM_DECODER_SEEK_ERROR,
/**< An error occurred while seeking or the seek or tell
* callback returned an error. The decoder must be flushed with
* OggFLAC__stream_decoder_flush() or reset with
* OggFLAC__stream_decoder_reset() before decoding can continue.
*/
OggFLAC__STREAM_DECODER_READ_ERROR,
/**< The read callback returned an error. */
OggFLAC__STREAM_DECODER_MEMORY_ALLOCATION_ERROR,
/**< An error occurred allocating memory. The decoder is in an invalid
* state and can no longer be used.
*/
OggFLAC__STREAM_DECODER_UNINITIALIZED
/**< The decoder is in the uninitialized state; one of the
* OggFLAC__stream_decoder_init_*() functions must be called before samples
* can be processed.
*/
} OggFLAC__StreamDecoderState;
/** Maps an OggFLAC__StreamDecoderState to a C string.
*
* Using an OggFLAC__StreamDecoderState as the index to this array
* will give the string equivalent. The contents should not be modified.
*/
extern OggFLAC_API const char * const OggFLAC__StreamDecoderStateString[];
/***********************************************************************
*
* class OggFLAC__StreamDecoder
*
***********************************************************************/
struct OggFLAC__StreamDecoderProtected;
struct OggFLAC__StreamDecoderPrivate;
/** The opaque structure definition for the stream decoder type.
* See the \link oggflac_stream_decoder stream decoder module \endlink
* for a detailed description.
*/
typedef struct {
FLAC__StreamDecoder super_;
struct OggFLAC__StreamDecoderProtected *protected_; /* avoid the C++ keyword 'protected' */
struct OggFLAC__StreamDecoderPrivate *private_; /* avoid the C++ keyword 'private' */
} OggFLAC__StreamDecoder;
/***********************************************************************
*
* Class constructor/destructor
*
***********************************************************************/
/** Create a new stream decoder instance. The instance is created with
* default settings; see the individual OggFLAC__stream_decoder_set_*()
* functions for each setting's default.
*
* \retval OggFLAC__StreamDecoder*
* \c NULL if there was an error allocating memory, else the new instance.
*/
OggFLAC_API OggFLAC__StreamDecoder *OggFLAC__stream_decoder_new();
/** Free a decoder instance. Deletes the object pointed to by \a decoder.
*
* \param decoder A pointer to an existing decoder.
* \assert
* \code decoder != NULL \endcode
*/
OggFLAC_API void OggFLAC__stream_decoder_delete(OggFLAC__StreamDecoder *decoder);
/***********************************************************************
*
* Public class method prototypes
*
***********************************************************************/
/** Set the serial number for the Ogg stream.
* The default behavior is to use the serial number of the first Ogg
* page. Setting a serial number here will explicitly specify which
* stream is to be decoded.
*
* \default \c use serial number of first page
* \param decoder A decoder instance to set.
* \param serial_number See above.
* \assert
* \code decoder != NULL \endcode
* \retval FLAC__bool
* \c false if the decoder is already initialized, else \c true.
*/
OggFLAC_API FLAC__bool OggFLAC__stream_decoder_set_serial_number(OggFLAC__StreamDecoder *decoder, long serial_number);
/** Set the "MD5 signature checking" flag.
* This is inherited from FLAC__StreamDecoder; see FLAC__stream_decoder_set_md5_checking()
*
* \default \c false
* \param decoder A decoder instance to set.
* \param value Flag value (see above).
* \assert
* \code decoder != NULL \endcode
* \retval FLAC__bool
* \c false if the decoder is already initialized, else \c true.
*/
OggFLAC_API FLAC__bool OggFLAC__stream_decoder_set_md5_checking(OggFLAC__StreamDecoder *decoder, FLAC__bool value);
/** Direct the decoder to pass on all metadata blocks of type \a type.
* This is inherited from FLAC__StreamDecoder; see FLAC__stream_decoder_set_metadata_respond()
*
* \default By default, only the \c STREAMINFO block is returned via the
* metadata callback.
* \param decoder A decoder instance to set.
* \param type See above.
* \assert
* \code decoder != NULL \endcode
* \a type is valid
* \retval FLAC__bool
* \c false if the decoder is already initialized, else \c true.
*/
OggFLAC_API FLAC__bool OggFLAC__stream_decoder_set_metadata_respond(OggFLAC__StreamDecoder *decoder, FLAC__MetadataType type);
/** Direct the decoder to pass on all APPLICATION metadata blocks of the
* given \a id.
* This is inherited from FLAC__StreamDecoder; see FLAC__stream_decoder_set_metadata_respond_application()
*
* \default By default, only the \c STREAMINFO block is returned via the
* metadata callback.
* \param decoder A decoder instance to set.
* \param id See above.
* \assert
* \code decoder != NULL \endcode
* \code id != NULL \endcode
* \retval FLAC__bool
* \c false if the decoder is already initialized, else \c true.
*/
OggFLAC_API FLAC__bool OggFLAC__stream_decoder_set_metadata_respond_application(OggFLAC__StreamDecoder *decoder, const FLAC__byte id[4]);
/** Direct the decoder to pass on all metadata blocks of any type.
* This is inherited from FLAC__StreamDecoder; see FLAC__stream_decoder_set_metadata_respond_all()
*
* \default By default, only the \c STREAMINFO block is returned via the
* metadata callback.
* \param decoder A decoder instance to set.
* \assert
* \code decoder != NULL \endcode
* \retval FLAC__bool
* \c false if the decoder is already initialized, else \c true.
*/
OggFLAC_API FLAC__bool OggFLAC__stream_decoder_set_metadata_respond_all(OggFLAC__StreamDecoder *decoder);
/** Direct the decoder to filter out all metadata blocks of type \a type.
* This is inherited from FLAC__StreamDecoder; see FLAC__stream_decoder_set_metadata_ignore()
*
* \default By default, only the \c STREAMINFO block is returned via the
* metadata callback.
* \param decoder A decoder instance to set.
* \param type See above.
* \assert
* \code decoder != NULL \endcode
* \a type is valid
* \retval FLAC__bool
* \c false if the decoder is already initialized, else \c true.
*/
OggFLAC_API FLAC__bool OggFLAC__stream_decoder_set_metadata_ignore(OggFLAC__StreamDecoder *decoder, FLAC__MetadataType type);
/** Direct the decoder to filter out all APPLICATION metadata blocks of
* the given \a id.
* This is inherited from FLAC__StreamDecoder; see FLAC__stream_decoder_set_metadata_ignore_application()
*
* \default By default, only the \c STREAMINFO block is returned via the
* metadata callback.
* \param decoder A decoder instance to set.
* \param id See above.
* \assert
* \code decoder != NULL \endcode
* \code id != NULL \endcode
* \retval FLAC__bool
* \c false if the decoder is already initialized, else \c true.
*/
OggFLAC_API FLAC__bool OggFLAC__stream_decoder_set_metadata_ignore_application(OggFLAC__StreamDecoder *decoder, const FLAC__byte id[4]);
/** Direct the decoder to filter out all metadata blocks of any type.
* This is inherited from FLAC__StreamDecoder; see FLAC__stream_decoder_set_metadata_ignore_all()
*
* \default By default, only the \c STREAMINFO block is returned via the
* metadata callback.
* \param decoder A decoder instance to set.
* \assert
* \code decoder != NULL \endcode
* \retval FLAC__bool
* \c false if the decoder is already initialized, else \c true.
*/
OggFLAC_API FLAC__bool OggFLAC__stream_decoder_set_metadata_ignore_all(OggFLAC__StreamDecoder *decoder);
/** Get the current decoder state.
*
* \param decoder A decoder instance to query.
* \assert
* \code decoder != NULL \endcode
* \retval OggFLAC__StreamDecoderState
* The current decoder state.
*/
OggFLAC_API OggFLAC__StreamDecoderState OggFLAC__stream_decoder_get_state(const OggFLAC__StreamDecoder *decoder);
/** Get the state of the underlying FLAC stream decoder.
* Useful when the stream decoder state is
* \c OggFLAC__STREAM_DECODER_FLAC_STREAM_DECODER_ERROR.
*
* \param decoder A decoder instance to query.
* \assert
* \code decoder != NULL \endcode
* \retval FLAC__StreamDecoderState
* The FLAC stream decoder state.
*/
OggFLAC_API FLAC__StreamDecoderState OggFLAC__stream_decoder_get_FLAC_stream_decoder_state(const OggFLAC__StreamDecoder *decoder);
/** Get the current decoder state as a C string.
* This version automatically resolves
* \c OggFLAC__STREAM_DECODER_FLAC_STREAM_DECODER_ERROR
* by getting the FLAC stream decoder's state.
*
* \param decoder A decoder instance to query.
* \assert
* \code decoder != NULL \endcode
* \retval const char *
* The decoder state as a C string. Do not modify the contents.
*/
OggFLAC_API const char *OggFLAC__stream_decoder_get_resolved_state_string(const OggFLAC__StreamDecoder *decoder);
/** This is inherited from FLAC__StreamDecoder; see FLAC__stream_decoder_get_md5_checking()
*
* \param decoder A decoder instance to query.
* \assert
* \code decoder != NULL \endcode
* \retval FLAC__bool
* See above.
*/
OggFLAC_API FLAC__bool OggFLAC__stream_decoder_get_md5_checking(const OggFLAC__StreamDecoder *decoder);
/** This is inherited from FLAC__StreamDecoder; see FLAC__stream_decoder_get_total_samples()
*
* \param decoder A decoder instance to query.
* \assert
* \code decoder != NULL \endcode
* \retval unsigned
* See above.
*/
OggFLAC_API FLAC__uint64 OggFLAC__stream_decoder_get_total_samples(const OggFLAC__StreamDecoder *decoder);
/** This is inherited from FLAC__StreamDecoder; see FLAC__stream_decoder_get_channels()
*
* \param decoder A decoder instance to query.
* \assert
* \code decoder != NULL \endcode
* \retval unsigned
* See above.
*/
OggFLAC_API unsigned OggFLAC__stream_decoder_get_channels(const OggFLAC__StreamDecoder *decoder);
/** This is inherited from FLAC__StreamDecoder; see FLAC__stream_decoder_get_channel_assignment()
*
* \param decoder A decoder instance to query.
* \assert
* \code decoder != NULL \endcode
* \retval OggFLAC__ChannelAssignment
* See above.
*/
OggFLAC_API FLAC__ChannelAssignment OggFLAC__stream_decoder_get_channel_assignment(const OggFLAC__StreamDecoder *decoder);
/** This is inherited from FLAC__StreamDecoder; see FLAC__stream_decoder_get_bits_per_sample()
*
* \param decoder A decoder instance to query.
* \assert
* \code decoder != NULL \endcode
* \retval unsigned
* See above.
*/
OggFLAC_API unsigned OggFLAC__stream_decoder_get_bits_per_sample(const OggFLAC__StreamDecoder *decoder);
/** This is inherited from FLAC__StreamDecoder; see FLAC__stream_decoder_get_sample_rate()
*
* \param decoder A decoder instance to query.
* \assert
* \code decoder != NULL \endcode
* \retval unsigned
* See above.
*/
OggFLAC_API unsigned OggFLAC__stream_decoder_get_sample_rate(const OggFLAC__StreamDecoder *decoder);
/** This is inherited from FLAC__StreamDecoder; see FLAC__stream_decoder_get_blocksize()
*
* \param decoder A decoder instance to query.
* \assert
* \code decoder != NULL \endcode
* \retval unsigned
* See above.
*/
OggFLAC_API unsigned OggFLAC__stream_decoder_get_blocksize(const OggFLAC__StreamDecoder *decoder);
/** Initialize the decoder instance.
*
* This flavor of initialization sets up the decoder to decode from a stream.
* I/O is performed via callbacks to the client. For decoding from a plain file
* via filename or open FILE*, OggFLAC__stream_decoder_init_file() and
* OggFLAC__stream_decoder_init_FILE() provide a simpler interface.
*
* This function should be called after OggFLAC__stream_decoder_new() and
* OggFLAC__stream_decoder_set_*() but before any of the
* OggFLAC__stream_decoder_process_*() functions. Will set and return the
* decoder state, which will be OggFLAC__STREAM_DECODER_OK
* if initialization succeeded.
*
* \param decoder An uninitialized decoder instance.
* \param read_callback See FLAC__StreamDecoderReadCallback. This
* pointer must not be \c NULL.
* \param seek_callback See FLAC__StreamDecoderSeekCallback. This
* pointer may be \c NULL if seeking is not
* supported. If \a seek_callback is not \c NULL then a
* \a tell_callback, \a length_callback, and \a eof_callback must also be supplied.
* Alternatively, a dummy seek callback that just
* returns \c FLAC__STREAM_DECODER_SEEK_STATUS_UNSUPPORTED
* may also be supplied, all though this is slightly
* less efficient for the decoder.
* \param tell_callback See FLAC__StreamDecoderTellCallback. This
* pointer may be \c NULL if not supported by the client. If
* \a seek_callback is not \c NULL then a
* \a tell_callback must also be supplied.
* Alternatively, a dummy tell callback that just
* returns \c FLAC__STREAM_DECODER_TELL_STATUS_UNSUPPORTED
* may also be supplied, all though this is slightly
* less efficient for the decoder.
* \param length_callback See FLAC__StreamDecoderLengthCallback. This
* pointer may be \c NULL if not supported by the client. If
* \a seek_callback is not \c NULL then a
* \a length_callback must also be supplied.
* Alternatively, a dummy length callback that just
* returns \c FLAC__STREAM_DECODER_LENGTH_STATUS_UNSUPPORTED
* may also be supplied, all though this is slightly
* less efficient for the decoder.
* \param eof_callback See FLAC__StreamDecoderEofCallback. This
* pointer may be \c NULL if not supported by the client. If
* \a seek_callback is not \c NULL then a
* \a eof_callback must also be supplied.
* Alternatively, a dummy length callback that just
* returns \c false
* may also be supplied, all though this is slightly
* less efficient for the decoder.
* \param write_callback See FLAC__StreamDecoderWriteCallback. This
* pointer must not be \c NULL.
* \param metadata_callback See FLAC__StreamDecoderMetadataCallback. This
* pointer may be \c NULL if the callback is not
* desired.
* \param error_callback See FLAC__StreamDecoderErrorCallback. This
* pointer must not be \c NULL.
* \param client_data This value will be supplied to callbacks in their
* \a client_data argument.
* \assert
* \code decoder != NULL \endcode
* \retval FLAC__StreamDecoderInitStatus
* \c FLAC__STREAM_DECODER_INIT_STATUS_OK if initialization was successful;
* see FLAC__StreamDecoderInitStatus for the meanings of other return values.
*/
OggFLAC_API FLAC__StreamDecoderInitStatus OggFLAC__stream_decoder_init_stream(
OggFLAC__StreamDecoder *decoder,
FLAC__StreamDecoderReadCallback read_callback,
FLAC__StreamDecoderSeekCallback seek_callback,
FLAC__StreamDecoderTellCallback tell_callback,
FLAC__StreamDecoderLengthCallback length_callback,
FLAC__StreamDecoderEofCallback eof_callback,
FLAC__StreamDecoderWriteCallback write_callback,
FLAC__StreamDecoderMetadataCallback metadata_callback,
FLAC__StreamDecoderErrorCallback error_callback,
void *client_data
);
/** Initialize the decoder instance.
*
* This flavor of initialization sets up the decoder to decode from a plain
* file. For non-stdio streams, you must use
* OggFLAC__stream_decoder_init_stream() and provide callbacks for the I/O.
*
* This function should be called after OggFLAC__stream_decoder_new() and
* OggFLAC__stream_decoder_set_*() but before any of the
* OggFLAC__stream_decoder_process_*() functions. Will set and return the
* decoder state, which will be OggFLAC__STREAM_DECODER_OK
* if initialization succeeded.
*
* \param decoder An uninitialized decoder instance.
* \param file An open Ogg FLAC file. The file should have been
* opened with mode \c "rb" and rewound. The file
* becomes owned by the decoder and should not be
* manipulated by the client while decoding.
* Unless \a file is \c stdin, it will be closed
* when OggFLAC__stream_decoder_finish() is called.
* Note however that seeking will not work when
* decoding from \c stdout since it is not seekable.
* \param write_callback See FLAC__StreamDecoderWriteCallback. This
* pointer must not be \c NULL.
* \param metadata_callback See FLAC__StreamDecoderMetadataCallback. This
* pointer may be \c NULL if the callback is not
* desired.
* \param error_callback See FLAC__StreamDecoderErrorCallback. This
* pointer must not be \c NULL.
* \param client_data This value will be supplied to callbacks in their
* \a client_data argument.
* \assert
* \code decoder != NULL \endcode
* \code file != NULL \endcode
* \retval FLAC__StreamDecoderInitStatus
* \c FLAC__STREAM_DECODER_INIT_STATUS_OK if initialization was successful;
* see FLAC__StreamDecoderInitStatus for the meanings of other return values.
*/
OggFLAC_API FLAC__StreamDecoderInitStatus OggFLAC__stream_decoder_init_FILE(
OggFLAC__StreamDecoder *decoder,
FILE *file,
FLAC__StreamDecoderWriteCallback write_callback,
FLAC__StreamDecoderMetadataCallback metadata_callback,
FLAC__StreamDecoderErrorCallback error_callback,
void *client_data
);
/** Initialize the decoder instance.
*
* This flavor of initialization sets up the decoder to decode from a plain
* file. If POSIX fopen() semantics are not sufficient, (for example, with
* Unicode filenames on Windows), you must use
* OggFLAC__stream_decoder_init_FILE(), or OggFLAC__stream_decoder_init_stream()
* and provide callbacks for the I/O.
*
* This function should be called after OggFLAC__stream_decoder_new() and
* OggFLAC__stream_decoder_set_*() but before any of the
* OggFLAC__stream_decoder_process_*() functions. Will set and return the
* decoder state, which will be OggFLAC__STREAM_DECODER_OK
* if initialization succeeded.
*
* \param decoder An uninitialized decoder instance.
* \param filename The name of the file to decode from. The file will
* be opened with fopen(). Use \c NULL to decode from
* \c stdin. Note that \c stdin is not seekable.
* \param write_callback See FLAC__StreamDecoderWriteCallback. This
* pointer must not be \c NULL.
* \param metadata_callback See FLAC__StreamDecoderMetadataCallback. This
* pointer may be \c NULL if the callback is not
* desired.
* \param error_callback See FLAC__StreamDecoderErrorCallback. This
* pointer must not be \c NULL.
* \param client_data This value will be supplied to callbacks in their
* \a client_data argument.
* \assert
* \code decoder != NULL \endcode
* \retval FLAC__StreamDecoderInitStatus
* \c FLAC__STREAM_DECODER_INIT_STATUS_OK if initialization was successful;
* see FLAC__StreamDecoderInitStatus for the meanings of other return values.
*/
OggFLAC_API FLAC__StreamDecoderInitStatus OggFLAC__stream_decoder_init_file(
OggFLAC__StreamDecoder *decoder,
const char *filename,
FLAC__StreamDecoderWriteCallback write_callback,
FLAC__StreamDecoderMetadataCallback metadata_callback,
FLAC__StreamDecoderErrorCallback error_callback,
void *client_data
);
/** Finish the decoding process.
* Flushes the decoding buffer, releases resources, resets the decoder
* settings to their defaults, and returns the decoder state to
* OggFLAC__STREAM_DECODER_UNINITIALIZED.
*
* In the event of a prematurely-terminated decode, it is not strictly
* necessary to call this immediately before OggFLAC__stream_decoder_delete()
* but it is good practice to match every OggFLAC__stream_decoder_init()
* with an OggFLAC__stream_decoder_finish().
*
* \param decoder An uninitialized decoder instance.
* \assert
* \code decoder != NULL \endcode
*/
OggFLAC_API FLAC__bool OggFLAC__stream_decoder_finish(OggFLAC__StreamDecoder *decoder);
/** This is inherited from FLAC__StreamDecoder; see FLAC__stream_decoder_flush()
*
* \param decoder A decoder instance.
* \assert
* \code decoder != NULL \endcode
* \retval FLAC__bool
* \c true if successful, else \c false if a memory allocation
* error occurs.
*/
OggFLAC_API FLAC__bool OggFLAC__stream_decoder_flush(OggFLAC__StreamDecoder *decoder);
/** This is inherited from FLAC__StreamDecoder; see FLAC__stream_decoder_reset()
*
* \param decoder A decoder instance.
* \assert
* \code decoder != NULL \endcode
* \retval FLAC__bool
* \c true if successful, else \c false if a memory allocation
* or seek error occurs.
*/
OggFLAC_API FLAC__bool OggFLAC__stream_decoder_reset(OggFLAC__StreamDecoder *decoder);
/** Decode one metadata block or audio frame.
* This is inherited from FLAC__StreamDecoder; see FLAC__stream_decoder_process_single()
*
* \param decoder An initialized decoder instance in the state
* \c OggFLAC__STREAM_DECODER_OK.
* \assert
* \code decoder != NULL \endcode
* \code OggFLAC__stream_decoder_get_state(decoder) == OggFLAC__STREAM_DECODER_OK \endcode
* \retval FLAC__bool
* \c false if any fatal read, write, or memory allocation error
* occurred (meaning decoding must stop), else \c true; for more
* information about the decoder, check the decoder state with
* OggFLAC__stream_decoder_get_state().
*/
OggFLAC_API FLAC__bool OggFLAC__stream_decoder_process_single(OggFLAC__StreamDecoder *decoder);
/** Decode until the end of the metadata.
* This is inherited from FLAC__StreamDecoder; see FLAC__stream_decoder_process_until_end_of_metadata()
*
* \param decoder An initialized decoder instance in the state
* \c OggFLAC__STREAM_DECODER_OK.
* \assert
* \code decoder != NULL \endcode
* \code OggFLAC__stream_decoder_get_state(decoder) == OggFLAC__STREAM_DECODER_OK \endcode
* \retval FLAC__bool
* \c false if any fatal read, write, or memory allocation error
* occurred (meaning decoding must stop), else \c true; for more
* information about the decoder, check the decoder state with
* OggFLAC__stream_decoder_get_state().
*/
OggFLAC_API FLAC__bool OggFLAC__stream_decoder_process_until_end_of_metadata(OggFLAC__StreamDecoder *decoder);
/** Decode until the end of the stream.
* This is inherited from FLAC__StreamDecoder; see FLAC__stream_decoder_process_until_end_of_stream()
*
* \param decoder An initialized decoder instance in the state
* \c OggFLAC__STREAM_DECODER_OK.
* \assert
* \code decoder != NULL \endcode
* \code OggFLAC__stream_decoder_get_state(decoder) == OggFLAC__STREAM_DECODER_OK \endcode
* \retval FLAC__bool
* \c false if any fatal read, write, or memory allocation error
* occurred (meaning decoding must stop), else \c true; for more
* information about the decoder, check the decoder state with
* OggFLAC__stream_decoder_get_state().
*/
OggFLAC_API FLAC__bool OggFLAC__stream_decoder_process_until_end_of_stream(OggFLAC__StreamDecoder *decoder);
/** Skip one audio frame.
* This is inherited from FLAC__StreamDecoder; see FLAC__stream_decoder_skip_single_frame()
*
* \param decoder An initialized decoder instance not in a metadata
* state.
* \assert
* \code decoder != NULL \endcode
* \retval FLAC__bool
* \c false if any fatal read, write, or memory allocation error
* occurred (meaning decoding must stop), or if the underlying FLAC
* stream decoder is in the FLAC__STREAM_DECODER_SEARCH_FOR_METADATA or
* FLAC__STREAM_DECODER_READ_METADATA state, else \c true; for more
* information about the decoder, check the decoder state with
* OggFLAC__stream_decoder_get_FLAC_stream_decoder_state().
*/
OggFLAC_API FLAC__bool OggFLAC__stream_decoder_skip_single_frame(OggFLAC__StreamDecoder *decoder);
/** Flush the input and seek to an absolute sample.
* This is inherited from FLAC__StreamDecoder; see FLAC__stream_decoder_seek_absolute().
*
* \param decoder A decoder instance.
* \param sample The target sample number to seek to.
* \assert
* \code decoder != NULL \endcode
* \retval FLAC__bool
* \c true if successful, else \c false.
*/
OggFLAC_API FLAC__bool OggFLAC__stream_decoder_seek_absolute(OggFLAC__StreamDecoder *decoder, FLAC__uint64 sample);
/* \} */
#ifdef __cplusplus
}
#endif
#endif

View File

@@ -1,959 +0,0 @@
/* libOggFLAC - Free Lossless Audio Codec + Ogg library
* Copyright (C) 2002,2003,2004,2005,2006 Josh Coalson
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* - Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* - 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.
*/
#ifndef OggFLAC__STREAM_ENCODER_H
#define OggFLAC__STREAM_ENCODER_H
#include "export.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 encoder layers provided by libOggFLAC.
*
* libOggFLAC currently provides the same layers of access as libFLAC;
* the interfaces are nearly identical, with the addition of a method for
* specifying the Ogg serial number. 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 Ogg stream encoder is derived
* from the FLAC stream encoder.
*
* The interface here is nearly identical to FLAC's stream encoder,
* including the callbacks, with the addition of
* OggFLAC__stream_encoder_set_serial_number(). See the
* \link flac_stream_encoder FLAC stream encoder module \endlink
* for full documentation.
*
* \{
*/
/** State values for an OggFLAC__StreamEncoder
*
* 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 and samples can be processed. */
OggFLAC__STREAM_ENCODER_UNINITIALIZED,
/**< The encoder is in the uninitialized state; one of the
* OggFLAC__stream_encoder_init_*() functions must be called before samples
* can be processed.
*/
OggFLAC__STREAM_ENCODER_OGG_ERROR,
/**< An error occurred in the underlying Ogg layer. */
OggFLAC__STREAM_ENCODER_FLAC_STREAM_ENCODER_ERROR,
/**< An error occurred in the underlying FLAC stream encoder;
* check OggFLAC__stream_encoder_get_FLAC_stream_encoder_state().
*/
OggFLAC__STREAM_ENCODER_CLIENT_ERROR,
/**< One of the callbacks returned a fatal error. */
OggFLAC__STREAM_ENCODER_IO_ERROR,
/**< An I/O error occurred while opening/reading/writing a file.
* Check \c errno.
*/
OggFLAC__STREAM_ENCODER_MEMORY_ALLOCATION_ERROR
/**< Memory allocation failed. */
} OggFLAC__StreamEncoderState;
/** Maps an OggFLAC__StreamEncoderState to a C string.
*
* Using an OggFLAC__StreamEncoderState as the index to this array
* will give the string equivalent. The contents should not be modified.
*/
extern OggFLAC_API const char * const OggFLAC__StreamEncoderStateString[];
/** Return values for the OggFLAC__StreamEncoder read callback.
*/
typedef enum {
OggFLAC__STREAM_ENCODER_READ_STATUS_CONTINUE,
/**< The read was OK and decoding can continue. */
OggFLAC__STREAM_ENCODER_READ_STATUS_END_OF_STREAM,
/**< The read was attempted at the end of the stream. */
OggFLAC__STREAM_ENCODER_READ_STATUS_ABORT,
/**< An unrecoverable error occurred. */
OggFLAC__STREAM_ENCODER_READ_STATUS_UNSUPPORTED
/**< Client does not support reading back from the output. */
} OggFLAC__StreamEncoderReadStatus;
/** Maps a OggFLAC__StreamEncoderReadStatus to a C string.
*
* Using a OggFLAC__StreamEncoderReadStatus as the index to this array
* will give the string equivalent. The contents should not be modified.
*/
extern OggFLAC_API const char * const OggFLAC__StreamEncoderReadStatusString[];
/***********************************************************************
*
* 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 {
FLAC__StreamEncoder super_;
struct OggFLAC__StreamEncoderProtected *protected_; /* avoid the C++ keyword 'protected' */
struct OggFLAC__StreamEncoderPrivate *private_; /* avoid the C++ keyword 'private' */
} OggFLAC__StreamEncoder;
/** Signature for the read callback.
*
* A function pointer matching this signature must be passed to
* OggFLAC__stream_encoder_init_stream() if seeking is supported.
* The supplied function will be called when the encoder needs to read back
* encoded data. This happens during the metadata callback, when the encoder
* has to read, modify, and rewrite the metadata (e.g. seekpoints) gathered
* while encoding. The address of the buffer to be filled is supplied, along
* with the number of bytes the buffer can hold. The callback may choose to
* supply less data and modify the byte count but must be careful not to
* overflow the buffer. The callback then returns a status code chosen from
* OggFLAC__StreamEncoderReadStatus.
*
* \note In general, FLAC__StreamEncoder functions which change the
* state should not be called on the \a encoder while in the callback.
*
* \param encoder The encoder instance calling the callback.
* \param buffer A pointer to a location for the callee to store
* data to be encoded.
* \param bytes A pointer to the size of the buffer. On entry
* to the callback, it contains the maximum number
* of bytes that may be stored in \a buffer. The
* callee must set it to the actual number of bytes
* stored (0 in case of error or end-of-stream) before
* returning.
* \param client_data The callee's client data set through
* OggFLAC__stream_encoder_set_client_data().
* \retval OggFLAC__StreamEncoderReadStatus
* The callee's return status.
*/
typedef OggFLAC__StreamEncoderReadStatus (*OggFLAC__StreamEncoderReadCallback)(const OggFLAC__StreamEncoder *encoder, FLAC__byte buffer[], unsigned *bytes, void *client_data);
/***********************************************************************
*
* 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_API 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
*/
OggFLAC_API void OggFLAC__stream_encoder_delete(OggFLAC__StreamEncoder *encoder);
/***********************************************************************
*
* Public class method prototypes
*
***********************************************************************/
/** Set the serial number for the FLAC stream.
*
* \note
* It is recommended to set a serial number explicitly as the default of '0'
* may collide with other streams.
*
* \default \c 0
* \param encoder An encoder instance to set.
* \param serial_number See above.
* \assert
* \code encoder != NULL \endcode
* \retval FLAC__bool
* \c false if the encoder is already initialized, else \c true.
*/
OggFLAC_API FLAC__bool OggFLAC__stream_encoder_set_serial_number(OggFLAC__StreamEncoder *encoder, long serial_number);
/** 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.
*/
OggFLAC_API FLAC__bool OggFLAC__stream_encoder_set_verify(OggFLAC__StreamEncoder *encoder, FLAC__bool value);
/** 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.
*/
OggFLAC_API FLAC__bool OggFLAC__stream_encoder_set_streamable_subset(OggFLAC__StreamEncoder *encoder, FLAC__bool value);
/** 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.
*/
OggFLAC_API FLAC__bool OggFLAC__stream_encoder_set_do_mid_side_stereo(OggFLAC__StreamEncoder *encoder, FLAC__bool value);
/** 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.
*/
OggFLAC_API FLAC__bool OggFLAC__stream_encoder_set_loose_mid_side_stereo(OggFLAC__StreamEncoder *encoder, FLAC__bool value);
/** 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.
*/
OggFLAC_API FLAC__bool OggFLAC__stream_encoder_set_channels(OggFLAC__StreamEncoder *encoder, unsigned value);
/** 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.
*/
OggFLAC_API FLAC__bool OggFLAC__stream_encoder_set_bits_per_sample(OggFLAC__StreamEncoder *encoder, unsigned value);
/** 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.
*/
OggFLAC_API FLAC__bool OggFLAC__stream_encoder_set_sample_rate(OggFLAC__StreamEncoder *encoder, unsigned value);
/** 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.
*/
OggFLAC_API FLAC__bool OggFLAC__stream_encoder_set_blocksize(OggFLAC__StreamEncoder *encoder, unsigned value);
/** This is inherited from FLAC__StreamEncoder; see FLAC__stream_encoder_set_apodization()
*
* \default \c 0
* \param encoder An encoder instance to set.
* \param specification See above.
* \assert
* \code encoder != NULL \endcode
* \code specification != NULL \endcode
* \retval FLAC__bool
* \c false if the encoder is already initialized, else \c true.
*/
OggFLAC_API FLAC__bool OggFLAC__stream_encoder_set_apodization(OggFLAC__StreamEncoder *encoder, const char *specification);
/** 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.
*/
OggFLAC_API FLAC__bool OggFLAC__stream_encoder_set_max_lpc_order(OggFLAC__StreamEncoder *encoder, unsigned value);
/** 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.
*/
OggFLAC_API FLAC__bool OggFLAC__stream_encoder_set_qlp_coeff_precision(OggFLAC__StreamEncoder *encoder, unsigned value);
/** 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.
*/
OggFLAC_API FLAC__bool OggFLAC__stream_encoder_set_do_qlp_coeff_prec_search(OggFLAC__StreamEncoder *encoder, FLAC__bool value);
/** 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.
*/
OggFLAC_API FLAC__bool OggFLAC__stream_encoder_set_do_escape_coding(OggFLAC__StreamEncoder *encoder, FLAC__bool value);
/** 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.
*/
OggFLAC_API FLAC__bool OggFLAC__stream_encoder_set_do_exhaustive_model_search(OggFLAC__StreamEncoder *encoder, FLAC__bool value);
/** 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.
*/
OggFLAC_API FLAC__bool OggFLAC__stream_encoder_set_min_residual_partition_order(OggFLAC__StreamEncoder *encoder, unsigned value);
/** 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.
*/
OggFLAC_API FLAC__bool OggFLAC__stream_encoder_set_max_residual_partition_order(OggFLAC__StreamEncoder *encoder, unsigned value);
/** 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.
*/
OggFLAC_API FLAC__bool OggFLAC__stream_encoder_set_rice_parameter_search_dist(OggFLAC__StreamEncoder *encoder, unsigned value);
/** 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.
*/
OggFLAC_API FLAC__bool OggFLAC__stream_encoder_set_total_samples_estimate(OggFLAC__StreamEncoder *encoder, FLAC__uint64 value);
/** This is inherited from FLAC__StreamEncoder; see FLAC__stream_encoder_set_metadata()
*
* \note The Ogg FLAC mapping requires that the VORBIS_COMMENT block be
* the second metadata block of the stream. The encoder already supplies
* the STREAMINFO block automatically. If \a metadata does not contain a
* VORBIS_COMMENT block, the encoder will supply that too. Otherwise, if
* \a metadata does contain a VORBIS_COMMENT block and it is not the
* first, this function will reorder \a metadata by moving the
* VORBIS_COMMENT block to the front; the relative ordering of the other
* blocks will remain as they were.
*
* \note The Ogg FLAC mapping limits the number of metadata blocks per
* stream to \c 65535. If \a num_blocks exceeds this the function will
* return \c false.
*
* \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, or if
* \a num_blocks > 65535, else \c true.
*/
OggFLAC_API FLAC__bool OggFLAC__stream_encoder_set_metadata(OggFLAC__StreamEncoder *encoder, FLAC__StreamMetadata **metadata, unsigned num_blocks);
/** Get the current encoder state.
*
* \param encoder An encoder instance to query.
* \assert
* \code encoder != NULL \endcode
* \retval OggFLAC__StreamEncoderState
* The current encoder state.
*/
OggFLAC_API OggFLAC__StreamEncoderState OggFLAC__stream_encoder_get_state(const OggFLAC__StreamEncoder *encoder);
/** Get the state of the underlying FLAC stream encoder.
* Useful when the stream encoder state is
* \c OggFLAC__STREAM_ENCODER_FLAC_STREAM_ENCODER_ERROR.
*
* \param encoder An encoder instance to query.
* \assert
* \code encoder != NULL \endcode
* \retval FLAC__StreamEncoderState
* The FLAC stream encoder state.
*/
OggFLAC_API FLAC__StreamEncoderState OggFLAC__stream_encoder_get_FLAC_stream_encoder_state(const OggFLAC__StreamEncoder *encoder);
/** Get the state of the underlying FLAC stream encoder's verify decoder.
* Useful when the stream encoder state is
* \c OggFLAC__STREAM_ENCODER_FLAC_STREAM_ENCODER_ERROR and the
* FLAC encoder state is \c FLAC__STREAM_ENCODER_VERIFY_DECODER_ERROR.
*
* \param encoder An encoder instance to query.
* \assert
* \code encoder != NULL \endcode
* \retval FLAC__StreamDecoderState
* The FLAC verify decoder state.
*/
OggFLAC_API FLAC__StreamDecoderState OggFLAC__stream_encoder_get_verify_decoder_state(const OggFLAC__StreamEncoder *encoder);
/** Get the current encoder state as a C string.
* This version automatically resolves
* \c OggFLAC__STREAM_ENCODER_FLAC_STREAM_ENCODER_ERROR by getting the
* FLAC stream encoder's state.
*
* \param encoder A encoder instance to query.
* \assert
* \code encoder != NULL \endcode
* \retval const char *
* The encoder state as a C string. Do not modify the contents.
*/
OggFLAC_API const char *OggFLAC__stream_encoder_get_resolved_state_string(const OggFLAC__StreamEncoder *encoder);
/** Get relevant values about the nature of a verify decoder error.
* Inherited from FLAC__stream_encoder_get_verify_decoder_error_stats().
* Useful when the stream encoder state is
* \c OggFLAC__STREAM_ENCODER_FLAC_STREAM_ENCODER_ERROR and the
* FLAC stream encoder state is
* \c FLAC__STREAM_ENCODER_VERIFY_DECODER_ERROR.
*
* \param encoder An encoder instance to query.
* \param absolute_sample The absolute sample number of the mismatch.
* \param frame_number The number of the frame in which the mismatch occurred.
* \param channel The channel in which the mismatch occurred.
* \param sample The number of the sample (relative to the frame) in
* which the mismatch occurred.
* \param expected The expected value for the sample in question.
* \param got The actual value returned by the decoder.
* \assert
* \code encoder != NULL \endcode
* \code absolute_sample != NULL \endcode
* \code frame_number != NULL \endcode
* \code channel != NULL \endcode
* \code sample != NULL \endcode
* \code expected != NULL \endcode
*/
OggFLAC_API void OggFLAC__stream_encoder_get_verify_decoder_error_stats(const OggFLAC__StreamEncoder *encoder, FLAC__uint64 *absolute_sample, unsigned *frame_number, unsigned *channel, unsigned *sample, FLAC__int32 *expected, FLAC__int32 *got);
/** 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().
*/
OggFLAC_API FLAC__bool OggFLAC__stream_encoder_get_verify(const OggFLAC__StreamEncoder *encoder);
/** 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().
*/
OggFLAC_API FLAC__bool OggFLAC__stream_encoder_get_streamable_subset(const OggFLAC__StreamEncoder *encoder);
/** 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().
*/
OggFLAC_API FLAC__bool OggFLAC__stream_encoder_get_do_mid_side_stereo(const OggFLAC__StreamEncoder *encoder);
/** 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().
*/
OggFLAC_API FLAC__bool OggFLAC__stream_encoder_get_loose_mid_side_stereo(const OggFLAC__StreamEncoder *encoder);
/** 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().
*/
OggFLAC_API unsigned OggFLAC__stream_encoder_get_channels(const OggFLAC__StreamEncoder *encoder);
/** 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().
*/
OggFLAC_API unsigned OggFLAC__stream_encoder_get_bits_per_sample(const OggFLAC__StreamEncoder *encoder);
/** 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().
*/
OggFLAC_API unsigned OggFLAC__stream_encoder_get_sample_rate(const OggFLAC__StreamEncoder *encoder);
/** 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().
*/
OggFLAC_API unsigned OggFLAC__stream_encoder_get_blocksize(const OggFLAC__StreamEncoder *encoder);
/** 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().
*/
OggFLAC_API unsigned OggFLAC__stream_encoder_get_max_lpc_order(const OggFLAC__StreamEncoder *encoder);
/** 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().
*/
OggFLAC_API unsigned OggFLAC__stream_encoder_get_qlp_coeff_precision(const OggFLAC__StreamEncoder *encoder);
/** 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().
*/
OggFLAC_API FLAC__bool OggFLAC__stream_encoder_get_do_qlp_coeff_prec_search(const OggFLAC__StreamEncoder *encoder);
/** 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().
*/
OggFLAC_API FLAC__bool OggFLAC__stream_encoder_get_do_escape_coding(const OggFLAC__StreamEncoder *encoder);
/** 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().
*/
OggFLAC_API FLAC__bool OggFLAC__stream_encoder_get_do_exhaustive_model_search(const OggFLAC__StreamEncoder *encoder);
/** 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().
*/
OggFLAC_API unsigned OggFLAC__stream_encoder_get_min_residual_partition_order(const OggFLAC__StreamEncoder *encoder);
/** 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().
*/
OggFLAC_API unsigned OggFLAC__stream_encoder_get_max_residual_partition_order(const OggFLAC__StreamEncoder *encoder);
/** 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().
*/
OggFLAC_API unsigned OggFLAC__stream_encoder_get_rice_parameter_search_dist(const OggFLAC__StreamEncoder *encoder);
/** 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().
*/
OggFLAC_API FLAC__uint64 OggFLAC__stream_encoder_get_total_samples_estimate(const OggFLAC__StreamEncoder *encoder);
/** Initialize the encoder instance.
*
* This flavor of initialization sets up the encoder to encode to a stream.
* I/O is performed via callbacks to the client. For encoding to a plain file
* via filename or open \c FILE*, OggFLAC__stream_encoder_init_file() and
* OggFLAC__stream_encoder_init_FILE() provide a simpler interface.
*
* This function 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().
* initialization succeeded.
*
* The call to OggFLAC__stream_encoder_init_stream() currently will also immediately
* call the write callback several times, once with the \c fLaC signature,
* and once for each encoded metadata block.
*
* \note
* Unlike the FLAC stream encoder write callback, the Ogg stream
* encoder write callback will be called twice when writing each audio
* frame; once for the page header, and once for the page body.
* When writing the page header, the \a samples argument to the
* write callback will be \c 0.
*
* \param encoder An uninitialized encoder instance.
* \param read_callback See OggFLAC__StreamEncoderReadCallback. This
* pointer must not be \c NULL if \a seek_callback
* is non-NULL since they are both needed to be
* able to write data back to the Ogg FLAC stream
* in the post-encode phase.
* \param write_callback See FLAC__StreamEncoderWriteCallback. This
* pointer must not be \c NULL.
* \param seek_callback See FLAC__StreamEncoderSeekCallback. This
* pointer may be \c NULL if seeking is not
* supported. The encoder uses seeking to go back
* and write some some stream statistics to the
* STREAMINFO block; this is recommended but not
* necessary to create a valid FLAC stream. If
* \a seek_callback is not \c NULL then a
* \a tell_callback must also be supplied.
* Alternatively, a dummy seek callback that just
* returns \c FLAC__STREAM_ENCODER_SEEK_STATUS_UNSUPPORTED
* may also be supplied, all though this is slightly
* less efficient for the decoder.
* \param tell_callback See FLAC__StreamEncoderTellCallback. This
* pointer may be \c NULL if seeking is not
* supported. If \a seek_callback is \c NULL then
* this argument will be ignored. If
* \a seek_callback is not \c NULL then a
* \a tell_callback must also be supplied.
* Alternatively, a dummy tell callback that just
* returns \c FLAC__STREAM_ENCODER_TELL_STATUS_UNSUPPORTED
* may also be supplied, all though this is slightly
* less efficient for the decoder.
* \param metadata_callback See FLAC__StreamEncoderMetadataCallback. This
* pointer may be \c NULL if the callback is not
* desired. If the client provides a seek callback,
* this function is not necessary as the encoder
* will automatically seek back and update the
* STREAMINFO block. It may also be \c NULL if the
* client does not support seeking, since it will
* have no way of going back to update the
* STREAMINFO. However the client can still supply
* a callback if it would like to know the details
* from the STREAMINFO.
* \param client_data This value will be supplied to callbacks in their
* \a client_data argument.
* \assert
* \code encoder != NULL \endcode
* \retval FLAC__StreamEncoderInitStatus
* \c FLAC__STREAM_ENCODER_INIT_STATUS_OK if initialization was successful;
* see FLAC__StreamEncoderInitStatus for the meanings of other return values.
*/
OggFLAC_API FLAC__StreamEncoderInitStatus OggFLAC__stream_encoder_init_stream(OggFLAC__StreamEncoder *encoder, OggFLAC__StreamEncoderReadCallback read_callback, FLAC__StreamEncoderWriteCallback write_callback, FLAC__StreamEncoderSeekCallback seek_callback, FLAC__StreamEncoderTellCallback tell_callback, FLAC__StreamEncoderMetadataCallback metadata_callback, void *client_data);
/** Initialize the encoder instance.
*
* This flavor of initialization sets up the encoder to encode to a plain
* file. For non-stdio streams, you must use
* OggFLAC__stream_encoder_init_stream() and provide callbacks for the I/O.
*
* This function 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().
* initialization succeeded.
*
* The call to OggFLAC__stream_encoder_init_stream() currently will also immediately
* call the write callback several times, once with the \c fLaC signature,
* and once for each encoded metadata block.
*
* \note
* Unlike the FLAC stream encoder write callback, the Ogg stream
* encoder write callback will be called twice when writing each audio
* frame; once for the page header, and once for the page body.
* When writing the page header, the \a samples argument to the
* write callback will be \c 0.
*
* \param encoder An uninitialized encoder instance.
* \param file An open file. The file should have been opened
* with mode \c "w+b" and rewound. The file
* becomes owned by the encoder and should not be
* manipulated by the client while encoding.
* Unless \a file is \c stdout, it will be closed
* when OggFLAC__stream_encoder_finish() is called.
* Note however that a proper SEEKTABLE cannot be
* created when encoding to \c stdout since it is
* not seekable.
* \param progress_callback See FLAC__StreamEncoderProgressCallback. This
* pointer may be \c NULL if the callback is not
* desired.
* \param client_data This value will be supplied to callbacks in their
* \a client_data argument.
* \assert
* \code encoder != NULL \endcode
* \code file != NULL \endcode
* \retval FLAC__StreamEncoderInitStatus
* \c FLAC__STREAM_ENCODER_INIT_STATUS_OK if initialization was successful;
* see FLAC__StreamEncoderInitStatus for the meanings of other return values.
*/
OggFLAC_API FLAC__StreamEncoderInitStatus OggFLAC__stream_encoder_init_FILE(OggFLAC__StreamEncoder *encoder, FILE *file, FLAC__StreamEncoderProgressCallback progress_callback, void *client_data);
/** Initialize the encoder instance.
*
* This flavor of initialization sets up the encoder to encode to a plain
* file. If POSIX fopen() semantics are not sufficient (for example,
* with Unicode filenames on Windows), you must use
* OggFLAC__stream_encodeR_init_FILE(), or OggFLAC__stream_encoder_init_stream()
* and provide callbacks for the I/O.
*
* This function 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().
* initialization succeeded.
*
* The call to OggFLAC__stream_encoder_init_stream() currently will also immediately
* call the write callback several times, once with the \c fLaC signature,
* and once for each encoded metadata block.
*
* \note
* Unlike the FLAC stream encoder write callback, the Ogg stream
* encoder write callback will be called twice when writing each audio
* frame; once for the page header, and once for the page body.
* When writing the page header, the \a samples argument to the
* write callback will be \c 0.
*
* \param encoder An uninitialized encoder instance.
* \param filename The name of the file to encode to. The file will
* be opened with fopen(). Use \c NULL to encode to
* \c stdout. Note however that a proper SEEKTABLE
* cannot be created when encoding to \c stdout since
* it is not seekable.
* \param progress_callback See FLAC__StreamEncoderProgressCallback. This
* pointer may be \c NULL if the callback is not
* desired.
* \param client_data This value will be supplied to callbacks in their
* \a client_data argument.
* \assert
* \code encoder != NULL \endcode
* \retval FLAC__StreamEncoderInitStatus
* \c FLAC__STREAM_ENCODER_INIT_STATUS_OK if initialization was successful;
* see FLAC__StreamEncoderInitStatus for the meanings of other return values.
*/
OggFLAC_API FLAC__StreamEncoderInitStatus OggFLAC__stream_encoder_init_file(OggFLAC__StreamEncoder *encoder, const char *filename, FLAC__StreamEncoderProgressCallback progress_callback, void *client_data);
/** 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
*/
OggFLAC_API void OggFLAC__stream_encoder_finish(OggFLAC__StreamEncoder *encoder);
/** 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.
*/
OggFLAC_API FLAC__bool OggFLAC__stream_encoder_process(OggFLAC__StreamEncoder *encoder, const FLAC__int32 * const buffer[], unsigned samples);
/** 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.
*/
OggFLAC_API FLAC__bool OggFLAC__stream_encoder_process_interleaved(OggFLAC__StreamEncoder *encoder, const FLAC__int32 buffer[], unsigned samples);
/* \} */
#ifdef __cplusplus
}
#endif
#endif

View File

@@ -2,12 +2,6 @@
AUTOMAKE_OPTIONS = foreign
if FLaC__HAS_OGG
OGGFLAC_DIST = \
file_utils_oggflac.h
endif
EXTRA_DIST = \
file_utils_flac.h \
metadata_utils.h \
$(OGGFLAC_DIST)
metadata_utils.h

View File

@@ -27,6 +27,8 @@
#include "FLAC/format.h"
#include <sys/types.h> /* for off_t */
FLAC__bool file_utils__generate_flacfile(const char *output_filename, off_t *output_filesize, unsigned length, const FLAC__StreamMetadata *streaminfo, FLAC__StreamMetadata **metadata, unsigned num_metadata);
extern const long file_utils__ogg_serial_number;
FLAC__bool file_utils__generate_flacfile(FLAC__bool is_ogg, const char *output_filename, off_t *output_filesize, unsigned length, const FLAC__StreamMetadata *streaminfo, FLAC__StreamMetadata **metadata, unsigned num_metadata);
#endif

View File

@@ -1,34 +0,0 @@
/* test_libOggFLAC - Unit tester for libOggFLAC
* Copyright (C) 2002,2003,2004,2005,2006 Josh Coalson
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#ifndef OggFLAC__TEST_LIBOGGFLAC_FILE_UTILS_H
#define OggFLAC__TEST_LIBOGGFLAC_FILE_UTILS_H
/* needed because of off_t */
#if HAVE_CONFIG_H
# include <config.h>
#endif
#include "FLAC/format.h"
#include <sys/types.h> /* for off_t */
extern const long file_utils__serial_number;
FLAC__bool file_utils__generate_oggflacfile(const char *output_filename, off_t *output_filesize, unsigned length, const FLAC__StreamMetadata *streaminfo, FLAC__StreamMetadata **metadata, unsigned num_metadata);
#endif