mirror of
https://github.com/claunia/flac.git
synced 2025-12-16 18:54:26 +00:00
merge libOggFLAC into libFLAC and libOggFLAC++ into FLAC++; documentation still needs work
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user