1 /* libOggFLAC - Free Lossless Audio Codec + Ogg library
2 * Copyright (C) 2002,2003,2004,2005 Josh Coalson
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions
8 * - Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
11 * - Redistributions in binary form must reproduce the above copyright
12 * notice, this list of conditions and the following disclaimer in the
13 * documentation and/or other materials provided with the distribution.
15 * - Neither the name of the Xiph.org Foundation nor the names of its
16 * contributors may be used to endorse or promote products derived from
17 * this software without specific prior written permission.
19 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
20 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
21 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
22 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR
23 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
24 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
25 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
26 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
27 * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
28 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
29 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
32 #ifndef OggFLAC__STREAM_ENCODER_H
33 #define OggFLAC__STREAM_ENCODER_H
37 #include "FLAC/stream_encoder.h"
44 /** \file include/OggFLAC/stream_encoder.h
47 * This module contains the functions which implement the stream
50 * See the detailed documentation in the
51 * \link oggflac_stream_encoder stream encoder \endlink module.
54 /** \defgroup oggflac_encoder OggFLAC/ *_encoder.h: encoder interfaces
58 * This module describes the three encoder layers provided by libOggFLAC.
60 * libOggFLAC currently provides the same three layers of access as libFLAC;
61 * the interfaces are nearly identical, with the addition of a method for
62 * specifying the Ogg serial number. See the \link flac_encoder FLAC
63 * encoder module \endlink for full documentation.
66 /** \defgroup oggflac_stream_encoder OggFLAC/stream_encoder.h: stream encoder interface
67 * \ingroup oggflac_encoder
70 * This module contains the functions which implement the stream
71 * encoder. The Ogg stream encoder is derived
72 * from the FLAC stream encoder.
74 * The interface here is nearly identical to FLAC's stream encoder,
75 * including the callbacks, with the addition of
76 * OggFLAC__stream_encoder_set_serial_number(). See the
77 * \link flac_stream_encoder FLAC stream encoder module \endlink
78 * for full documentation.
84 /** State values for an OggFLAC__StreamEncoder
86 * The encoder's state can be obtained by calling OggFLAC__stream_encoder_get_state().
90 OggFLAC__STREAM_ENCODER_OK = 0,
91 /**< The encoder is in the normal OK state. */
93 OggFLAC__STREAM_ENCODER_OGG_ERROR,
94 /**< An error occurred in the underlying Ogg layer. */
96 OggFLAC__STREAM_ENCODER_FLAC_STREAM_ENCODER_ERROR,
97 /**< An error occurred in the underlying FLAC stream encoder;
98 * check OggFLAC__stream_encoder_get_FLAC_stream_encoder_state().
101 OggFLAC__STREAM_ENCODER_INVALID_CALLBACK,
102 /**< The encoder was initialized before setting all the required callbacks. */
104 OggFLAC__STREAM_ENCODER_MEMORY_ALLOCATION_ERROR,
105 /**< Memory allocation failed. */
107 OggFLAC__STREAM_ENCODER_ALREADY_INITIALIZED,
108 /**< OggFLAC__stream_encoder_init() was called when the encoder was
109 * already initialized, usually because
110 * OggFLAC__stream_encoder_finish() was not called.
113 OggFLAC__STREAM_ENCODER_UNINITIALIZED
114 /**< The encoder is in the uninitialized state. */
116 } OggFLAC__StreamEncoderState;
118 /** Maps an OggFLAC__StreamEncoderState to a C string.
120 * Using an OggFLAC__StreamEncoderState as the index to this array
121 * will give the string equivalent. The contents should not be modified.
123 extern OggFLAC_API const char * const OggFLAC__StreamEncoderStateString[];
126 /***********************************************************************
128 * class OggFLAC__StreamEncoder
130 ***********************************************************************/
132 struct OggFLAC__StreamEncoderProtected;
133 struct OggFLAC__StreamEncoderPrivate;
134 /** The opaque structure definition for the stream encoder type.
135 * See the \link oggflac_stream_encoder stream encoder module \endlink
136 * for a detailed description.
139 struct OggFLAC__StreamEncoderProtected *protected_; /* avoid the C++ keyword 'protected' */
140 struct OggFLAC__StreamEncoderPrivate *private_; /* avoid the C++ keyword 'private' */
141 } OggFLAC__StreamEncoder;
143 /** Signature for the write callback.
144 * See OggFLAC__stream_encoder_set_write_callback()
145 * and FLAC__StreamEncoderWriteCallback for more info.
147 * \param encoder The encoder instance calling the callback.
148 * \param buffer An array of encoded data of length \a bytes.
149 * \param bytes The byte length of \a buffer.
150 * \param samples The number of samples encoded by \a buffer.
151 * \c 0 has a special meaning; see
152 * OggFLAC__stream_encoder_set_write_callback().
153 * \param current_frame The number of current frame being encoded.
154 * \param client_data The callee's client data set through
155 * OggFLAC__stream_encoder_set_client_data().
156 * \retval FLAC__StreamEncoderWriteStatus
157 * The callee's return status.
159 typedef FLAC__StreamEncoderWriteStatus (*OggFLAC__StreamEncoderWriteCallback)(const OggFLAC__StreamEncoder *encoder, const FLAC__byte buffer[], unsigned bytes, unsigned samples, unsigned current_frame, void *client_data);
161 /** Signature for the metadata callback.
162 * See OggFLAC__stream_encoder_set_metadata_callback()
163 * and FLAC__stream_encoder_set_metadata_callback() for more info.
165 * \param encoder The encoder instance calling the callback.
166 * \param metadata The final populated STREAMINFO block.
167 * \param client_data The callee's client data set through
168 * FLAC__stream_encoder_set_client_data().
170 typedef void (*OggFLAC__StreamEncoderMetadataCallback)(const OggFLAC__StreamEncoder *encoder, const FLAC__StreamMetadata *metadata, void *client_data);
173 /***********************************************************************
175 * Class constructor/destructor
177 ***********************************************************************/
179 /** Create a new stream encoder instance. The instance is created with
180 * default settings; see the individual OggFLAC__stream_encoder_set_*()
181 * functions for each setting's default.
183 * \retval OggFLAC__StreamEncoder*
184 * \c NULL if there was an error allocating memory, else the new instance.
186 OggFLAC_API OggFLAC__StreamEncoder *OggFLAC__stream_encoder_new();
188 /** Free an encoder instance. Deletes the object pointed to by \a encoder.
190 * \param encoder A pointer to an existing encoder.
192 * \code encoder != NULL \endcode
194 OggFLAC_API void OggFLAC__stream_encoder_delete(OggFLAC__StreamEncoder *encoder);
197 /***********************************************************************
199 * Public class method prototypes
201 ***********************************************************************/
203 /** Set the serial number for the FLAC stream.
206 * It is recommended to set a serial number explicitly as the default of '0'
207 * may collide with other streams.
210 * \param encoder An encoder instance to set.
211 * \param serial_number See above.
213 * \code encoder != NULL \endcode
215 * \c false if the encoder is already initialized, else \c true.
217 OggFLAC_API FLAC__bool OggFLAC__stream_encoder_set_serial_number(OggFLAC__StreamEncoder *encoder, long serial_number);
219 /** This is inherited from FLAC__StreamEncoder; see FLAC__stream_encoder_set_verify()
222 * \param encoder An encoder instance to set.
223 * \param value Flag value (see above).
225 * \code encoder != NULL \endcode
227 * \c false if the encoder is already initialized, else \c true.
229 OggFLAC_API FLAC__bool OggFLAC__stream_encoder_set_verify(OggFLAC__StreamEncoder *encoder, FLAC__bool value);
231 /** This is inherited from FLAC__StreamEncoder; see FLAC__stream_encoder_set_streamable_subset()
234 * \param encoder An encoder instance to set.
235 * \param value Flag value (see above).
237 * \code encoder != NULL \endcode
239 * \c false if the encoder is already initialized, else \c true.
241 OggFLAC_API FLAC__bool OggFLAC__stream_encoder_set_streamable_subset(OggFLAC__StreamEncoder *encoder, FLAC__bool value);
243 /** This is inherited from FLAC__StreamEncoder; see FLAC__stream_encoder_set_do_mid_side_stereo()
246 * \param encoder An encoder instance to set.
247 * \param value Flag value (see above).
249 * \code encoder != NULL \endcode
251 * \c false if the encoder is already initialized, else \c true.
253 OggFLAC_API FLAC__bool OggFLAC__stream_encoder_set_do_mid_side_stereo(OggFLAC__StreamEncoder *encoder, FLAC__bool value);
255 /** This is inherited from FLAC__StreamEncoder; see FLAC__stream_encoder_set_loose_mid_side_stereo()
258 * \param encoder An encoder instance to set.
259 * \param value Flag value (see above).
261 * \code encoder != NULL \endcode
263 * \c false if the encoder is already initialized, else \c true.
265 OggFLAC_API FLAC__bool OggFLAC__stream_encoder_set_loose_mid_side_stereo(OggFLAC__StreamEncoder *encoder, FLAC__bool value);
267 /** This is inherited from FLAC__StreamEncoder; see FLAC__stream_encoder_set_channels()
270 * \param encoder An encoder instance to set.
271 * \param value See above.
273 * \code encoder != NULL \endcode
275 * \c false if the encoder is already initialized, else \c true.
277 OggFLAC_API FLAC__bool OggFLAC__stream_encoder_set_channels(OggFLAC__StreamEncoder *encoder, unsigned value);
279 /** This is inherited from FLAC__StreamEncoder; see FLAC__stream_encoder_set_bits_per_sample()
282 * \param encoder An encoder instance to set.
283 * \param value See above.
285 * \code encoder != NULL \endcode
287 * \c false if the encoder is already initialized, else \c true.
289 OggFLAC_API FLAC__bool OggFLAC__stream_encoder_set_bits_per_sample(OggFLAC__StreamEncoder *encoder, unsigned value);
291 /** This is inherited from FLAC__StreamEncoder; see FLAC__stream_encoder_set_sample_rate()
294 * \param encoder An encoder instance to set.
295 * \param value See above.
297 * \code encoder != NULL \endcode
299 * \c false if the encoder is already initialized, else \c true.
301 OggFLAC_API FLAC__bool OggFLAC__stream_encoder_set_sample_rate(OggFLAC__StreamEncoder *encoder, unsigned value);
303 /** This is inherited from FLAC__StreamEncoder; see FLAC__stream_encoder_set_blocksize()
306 * \param encoder An encoder instance to set.
307 * \param value See above.
309 * \code encoder != NULL \endcode
311 * \c false if the encoder is already initialized, else \c true.
313 OggFLAC_API FLAC__bool OggFLAC__stream_encoder_set_blocksize(OggFLAC__StreamEncoder *encoder, unsigned value);
315 /** This is inherited from FLAC__StreamEncoder; see FLAC__stream_encoder_set_apodization()
318 * \param encoder An encoder instance to set.
319 * \param specification See above.
321 * \code encoder != NULL \endcode
322 * \code specification != NULL \endcode
324 * \c false if the encoder is already initialized, else \c true.
326 OggFLAC_API FLAC__bool OggFLAC__stream_encoder_set_apodization(OggFLAC__StreamEncoder *encoder, const char *specification);
328 /** This is inherited from FLAC__StreamEncoder; see FLAC__stream_encoder_set_max_lpc_order()
331 * \param encoder An encoder instance to set.
332 * \param value See above.
334 * \code encoder != NULL \endcode
336 * \c false if the encoder is already initialized, else \c true.
338 OggFLAC_API FLAC__bool OggFLAC__stream_encoder_set_max_lpc_order(OggFLAC__StreamEncoder *encoder, unsigned value);
340 /** This is inherited from FLAC__StreamEncoder; see FLAC__stream_encoder_set_qlp_coeff_precision()
343 * \param encoder An encoder instance to set.
344 * \param value See above.
346 * \code encoder != NULL \endcode
348 * \c false if the encoder is already initialized, else \c true.
350 OggFLAC_API FLAC__bool OggFLAC__stream_encoder_set_qlp_coeff_precision(OggFLAC__StreamEncoder *encoder, unsigned value);
352 /** This is inherited from FLAC__StreamEncoder; see FLAC__stream_encoder_set_qlp_coeff_prec_search()
355 * \param encoder An encoder instance to set.
356 * \param value See above.
358 * \code encoder != NULL \endcode
360 * \c false if the encoder is already initialized, else \c true.
362 OggFLAC_API FLAC__bool OggFLAC__stream_encoder_set_do_qlp_coeff_prec_search(OggFLAC__StreamEncoder *encoder, FLAC__bool value);
364 /** This is inherited from FLAC__StreamEncoder; see FLAC__stream_encoder_set_do_escape_coding()
367 * \param encoder An encoder instance to set.
368 * \param value See above.
370 * \code encoder != NULL \endcode
372 * \c false if the encoder is already initialized, else \c true.
374 OggFLAC_API FLAC__bool OggFLAC__stream_encoder_set_do_escape_coding(OggFLAC__StreamEncoder *encoder, FLAC__bool value);
376 /** This is inherited from FLAC__StreamEncoder; see FLAC__stream_encoder_set_do_exhaustive_model_search()
379 * \param encoder An encoder instance to set.
380 * \param value See above.
382 * \code encoder != NULL \endcode
384 * \c false if the encoder is already initialized, else \c true.
386 OggFLAC_API FLAC__bool OggFLAC__stream_encoder_set_do_exhaustive_model_search(OggFLAC__StreamEncoder *encoder, FLAC__bool value);
388 /** This is inherited from FLAC__StreamEncoder; see FLAC__stream_encoder_set_min_residual_partition_order()
391 * \param encoder An encoder instance to set.
392 * \param value See above.
394 * \code encoder != NULL \endcode
396 * \c false if the encoder is already initialized, else \c true.
398 OggFLAC_API FLAC__bool OggFLAC__stream_encoder_set_min_residual_partition_order(OggFLAC__StreamEncoder *encoder, unsigned value);
400 /** This is inherited from FLAC__StreamEncoder; see FLAC__stream_encoder_set_max_residual_partition_order()
403 * \param encoder An encoder instance to set.
404 * \param value See above.
406 * \code encoder != NULL \endcode
408 * \c false if the encoder is already initialized, else \c true.
410 OggFLAC_API FLAC__bool OggFLAC__stream_encoder_set_max_residual_partition_order(OggFLAC__StreamEncoder *encoder, unsigned value);
412 /** This is inherited from FLAC__StreamEncoder; see FLAC__stream_encoder_set_rice_parameter_search_dist()
415 * \param encoder An encoder instance to set.
416 * \param value See above.
418 * \code encoder != NULL \endcode
420 * \c false if the encoder is already initialized, else \c true.
422 OggFLAC_API FLAC__bool OggFLAC__stream_encoder_set_rice_parameter_search_dist(OggFLAC__StreamEncoder *encoder, unsigned value);
424 /** This is inherited from FLAC__StreamEncoder; see FLAC__stream_encoder_set_total_samples_estimate()
427 * \param encoder An encoder instance to set.
428 * \param value See above.
430 * \code encoder != NULL \endcode
432 * \c false if the encoder is already initialized, else \c true.
434 OggFLAC_API FLAC__bool OggFLAC__stream_encoder_set_total_samples_estimate(OggFLAC__StreamEncoder *encoder, FLAC__uint64 value);
436 /** This is inherited from FLAC__StreamEncoder; see FLAC__stream_encoder_set_metadata()
438 * \note The Ogg FLAC mapping requires that the VORBIS_COMMENT block be
439 * the second metadata block of the stream. The encoder already supplies
440 * the STREAMINFO block automatically. If \a metadata does not contain a
441 * VORBIS_COMMENT block, the encoder will supply that too. Otherwise, if
442 * \a metadata does contain a VORBIS_COMMENT block and it is not the
443 * first, this function will reorder \a metadata by moving the
444 * VORBIS_COMMENT block to the front; the relative ordering of the other
445 * blocks will remain as they were.
447 * \note The Ogg FLAC mapping limits the number of metadata blocks per
448 * stream to \c 65535. If \a num_blocks exceeds this the function will
451 * \default \c NULL, 0
452 * \param encoder An encoder instance to set.
453 * \param metadata See above.
454 * \param num_blocks See above.
456 * \code encoder != NULL \endcode
458 * \c false if the encoder is already initialized, or if
459 * \a num_blocks > 65535, else \c true.
461 OggFLAC_API FLAC__bool OggFLAC__stream_encoder_set_metadata(OggFLAC__StreamEncoder *encoder, FLAC__StreamMetadata **metadata, unsigned num_blocks);
463 /** Set the write callback.
464 * This is inherited from FLAC__StreamEncoder; see
465 * FLAC__stream_encoder_set_write_callback().
468 * Unlike the FLAC stream encoder write callback, the Ogg stream
469 * encoder write callback will be called twice when writing audio
470 * frames; once for the page header, and once for the page body.
471 * When writing the page header, the \a samples argument to the
472 * write callback will be \c 0.
475 * The callback is mandatory and must be set before initialization.
478 * \param encoder An encoder instance to set.
479 * \param value See above.
481 * \code encoder != NULL \endcode
482 * \code value != NULL \endcode
484 * \c false if the encoder is already initialized, else \c true.
486 OggFLAC_API FLAC__bool OggFLAC__stream_encoder_set_write_callback(OggFLAC__StreamEncoder *encoder, OggFLAC__StreamEncoderWriteCallback value);
488 /** Set the metadata callback.
489 * This is inherited from FLAC__StreamEncoder; see
490 * FLAC__stream_encoder_set_metadata_callback().
493 * The callback is mandatory and must be set before initialization.
496 * \param encoder An encoder instance to set.
497 * \param value See above.
499 * \code encoder != NULL \endcode
500 * \code value != NULL \endcode
502 * \c false if the encoder is already initialized, else \c true.
504 OggFLAC_API FLAC__bool OggFLAC__stream_encoder_set_metadata_callback(OggFLAC__StreamEncoder *encoder, OggFLAC__StreamEncoderMetadataCallback value);
506 /** Set the client data to be passed back to callbacks.
507 * This value will be supplied to callbacks in their \a client_data
511 * \param encoder An encoder instance to set.
512 * \param value See above.
514 * \code encoder != NULL \endcode
516 * \c false if the encoder is already initialized, else \c true.
518 OggFLAC_API FLAC__bool OggFLAC__stream_encoder_set_client_data(OggFLAC__StreamEncoder *encoder, void *value);
520 /** Get the current encoder state.
522 * \param encoder An encoder instance to query.
524 * \code encoder != NULL \endcode
525 * \retval OggFLAC__StreamEncoderState
526 * The current encoder state.
528 OggFLAC_API OggFLAC__StreamEncoderState OggFLAC__stream_encoder_get_state(const OggFLAC__StreamEncoder *encoder);
530 /** Get the state of the underlying FLAC stream encoder.
531 * Useful when the stream encoder state is
532 * \c OggFLAC__STREAM_ENCODER_FLAC_STREAM_ENCODER_ERROR.
534 * \param encoder An encoder instance to query.
536 * \code encoder != NULL \endcode
537 * \retval FLAC__StreamEncoderState
538 * The FLAC stream encoder state.
540 OggFLAC_API FLAC__StreamEncoderState OggFLAC__stream_encoder_get_FLAC_stream_encoder_state(const OggFLAC__StreamEncoder *encoder);
542 /** Get the state of the underlying FLAC stream encoder's verify decoder.
543 * Useful when the stream encoder state is
544 * \c OggFLAC__STREAM_ENCODER_FLAC_STREAM_ENCODER_ERROR and the
545 * FLAC encoder state is \c FLAC__STREAM_ENCODER_VERIFY_DECODER_ERROR.
547 * \param encoder An encoder instance to query.
549 * \code encoder != NULL \endcode
550 * \retval FLAC__StreamDecoderState
551 * The FLAC verify decoder state.
553 OggFLAC_API FLAC__StreamDecoderState OggFLAC__stream_encoder_get_verify_decoder_state(const OggFLAC__StreamEncoder *encoder);
555 /** Get the current encoder state as a C string.
556 * This version automatically resolves
557 * \c OggFLAC__STREAM_ENCODER_FLAC_STREAM_ENCODER_ERROR by getting the
558 * FLAC stream encoder's state.
560 * \param encoder A encoder instance to query.
562 * \code encoder != NULL \endcode
563 * \retval const char *
564 * The encoder state as a C string. Do not modify the contents.
566 OggFLAC_API const char *OggFLAC__stream_encoder_get_resolved_state_string(const OggFLAC__StreamEncoder *encoder);
568 /** Get relevant values about the nature of a verify decoder error.
569 * Inherited from FLAC__stream_encoder_get_verify_decoder_error_stats().
570 * Useful when the stream encoder state is
571 * \c OggFLAC__STREAM_ENCODER_FLAC_STREAM_ENCODER_ERROR and the
572 * FLAC stream encoder state is
573 * \c FLAC__STREAM_ENCODER_VERIFY_DECODER_ERROR.
575 * \param encoder An encoder instance to query.
576 * \param absolute_sample The absolute sample number of the mismatch.
577 * \param frame_number The number of the frame in which the mismatch occurred.
578 * \param channel The channel in which the mismatch occurred.
579 * \param sample The number of the sample (relative to the frame) in
580 * which the mismatch occurred.
581 * \param expected The expected value for the sample in question.
582 * \param got The actual value returned by the decoder.
584 * \code encoder != NULL \endcode
585 * \code absolute_sample != NULL \endcode
586 * \code frame_number != NULL \endcode
587 * \code channel != NULL \endcode
588 * \code sample != NULL \endcode
589 * \code expected != NULL \endcode
591 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);
593 /** This is inherited from FLAC__StreamEncoder; see FLAC__stream_encoder_get_verify()
595 * \param encoder An encoder instance to query.
597 * \code encoder != NULL \endcode
599 * See OggFLAC__stream_encoder_set_verify().
601 OggFLAC_API FLAC__bool OggFLAC__stream_encoder_get_verify(const OggFLAC__StreamEncoder *encoder);
603 /** This is inherited from FLAC__StreamEncoder; see FLAC__stream_encoder_get_streamable_subset()
605 * \param encoder An encoder instance to query.
607 * \code encoder != NULL \endcode
609 * See OggFLAC__stream_encoder_set_streamable_subset().
611 OggFLAC_API FLAC__bool OggFLAC__stream_encoder_get_streamable_subset(const OggFLAC__StreamEncoder *encoder);
613 /** This is inherited from FLAC__StreamEncoder; see FLAC__stream_encoder_get_do_mid_side_stereo()
615 * \param encoder An encoder instance to query.
617 * \code encoder != NULL \endcode
619 * See OggFLAC__stream_encoder_get_do_mid_side_stereo().
621 OggFLAC_API FLAC__bool OggFLAC__stream_encoder_get_do_mid_side_stereo(const OggFLAC__StreamEncoder *encoder);
623 /** This is inherited from FLAC__StreamEncoder; see FLAC__stream_encoder_get_loose_mid_side_stereo()
625 * \param encoder An encoder instance to query.
627 * \code encoder != NULL \endcode
629 * See OggFLAC__stream_encoder_set_loose_mid_side_stereo().
631 OggFLAC_API FLAC__bool OggFLAC__stream_encoder_get_loose_mid_side_stereo(const OggFLAC__StreamEncoder *encoder);
633 /** This is inherited from FLAC__StreamEncoder; see FLAC__stream_encoder_get_channels()
635 * \param encoder An encoder instance to query.
637 * \code encoder != NULL \endcode
639 * See OggFLAC__stream_encoder_set_channels().
641 OggFLAC_API unsigned OggFLAC__stream_encoder_get_channels(const OggFLAC__StreamEncoder *encoder);
643 /** This is inherited from FLAC__StreamEncoder; see FLAC__stream_encoder_get_bits_per_sample()
645 * \param encoder An encoder instance to query.
647 * \code encoder != NULL \endcode
649 * See OggFLAC__stream_encoder_set_bits_per_sample().
651 OggFLAC_API unsigned OggFLAC__stream_encoder_get_bits_per_sample(const OggFLAC__StreamEncoder *encoder);
653 /** This is inherited from FLAC__StreamEncoder; see FLAC__stream_encoder_get_sample_rate()
655 * \param encoder An encoder instance to query.
657 * \code encoder != NULL \endcode
659 * See OggFLAC__stream_encoder_set_sample_rate().
661 OggFLAC_API unsigned OggFLAC__stream_encoder_get_sample_rate(const OggFLAC__StreamEncoder *encoder);
663 /** This is inherited from FLAC__StreamEncoder; see FLAC__stream_encoder_get_blocksize()
665 * \param encoder An encoder instance to query.
667 * \code encoder != NULL \endcode
669 * See OggFLAC__stream_encoder_set_blocksize().
671 OggFLAC_API unsigned OggFLAC__stream_encoder_get_blocksize(const OggFLAC__StreamEncoder *encoder);
673 /** This is inherited from FLAC__StreamEncoder; see FLAC__stream_encoder_get_max_lpc_order()
675 * \param encoder An encoder instance to query.
677 * \code encoder != NULL \endcode
679 * See OggFLAC__stream_encoder_set_max_lpc_order().
681 OggFLAC_API unsigned OggFLAC__stream_encoder_get_max_lpc_order(const OggFLAC__StreamEncoder *encoder);
683 /** This is inherited from FLAC__StreamEncoder; see FLAC__stream_encoder_get_qlp_coeff_precision()
685 * \param encoder An encoder instance to query.
687 * \code encoder != NULL \endcode
689 * See OggFLAC__stream_encoder_set_qlp_coeff_precision().
691 OggFLAC_API unsigned OggFLAC__stream_encoder_get_qlp_coeff_precision(const OggFLAC__StreamEncoder *encoder);
693 /** This is inherited from FLAC__StreamEncoder; see FLAC__stream_encoder_get_do_qlp_coeff_prec_search()
695 * \param encoder An encoder instance to query.
697 * \code encoder != NULL \endcode
699 * See OggFLAC__stream_encoder_set_do_qlp_coeff_prec_search().
701 OggFLAC_API FLAC__bool OggFLAC__stream_encoder_get_do_qlp_coeff_prec_search(const OggFLAC__StreamEncoder *encoder);
703 /** This is inherited from FLAC__StreamEncoder; see FLAC__stream_encoder_get_do_escape_coding()
705 * \param encoder An encoder instance to query.
707 * \code encoder != NULL \endcode
709 * See OggFLAC__stream_encoder_set_do_escape_coding().
711 OggFLAC_API FLAC__bool OggFLAC__stream_encoder_get_do_escape_coding(const OggFLAC__StreamEncoder *encoder);
713 /** This is inherited from FLAC__StreamEncoder; see FLAC__stream_encoder_get_do_exhaustive_model_search()
715 * \param encoder An encoder instance to query.
717 * \code encoder != NULL \endcode
719 * See OggFLAC__stream_encoder_set_do_exhaustive_model_search().
721 OggFLAC_API FLAC__bool OggFLAC__stream_encoder_get_do_exhaustive_model_search(const OggFLAC__StreamEncoder *encoder);
723 /** This is inherited from FLAC__StreamEncoder; see FLAC__stream_encoder_get_min_residual_partition_order()
725 * \param encoder An encoder instance to query.
727 * \code encoder != NULL \endcode
729 * See OggFLAC__stream_encoder_set_min_residual_partition_order().
731 OggFLAC_API unsigned OggFLAC__stream_encoder_get_min_residual_partition_order(const OggFLAC__StreamEncoder *encoder);
733 /** This is inherited from FLAC__StreamEncoder; see FLAC__stream_encoder_get_man_residual_partition_order()
735 * \param encoder An encoder instance to query.
737 * \code encoder != NULL \endcode
739 * See OggFLAC__stream_encoder_set_max_residual_partition_order().
741 OggFLAC_API unsigned OggFLAC__stream_encoder_get_max_residual_partition_order(const OggFLAC__StreamEncoder *encoder);
743 /** This is inherited from FLAC__StreamEncoder; see FLAC__stream_encoder_get_rice_parameter_search_dist()
745 * \param encoder An encoder instance to query.
747 * \code encoder != NULL \endcode
749 * See OggFLAC__stream_encoder_set_rice_parameter_search_dist().
751 OggFLAC_API unsigned OggFLAC__stream_encoder_get_rice_parameter_search_dist(const OggFLAC__StreamEncoder *encoder);
753 /** This is inherited from FLAC__StreamEncoder; see FLAC__stream_encoder_get_total_samples_estimate()
755 * \param encoder An encoder instance to set.
757 * \code encoder != NULL \endcode
758 * \retval FLAC__uint64
759 * See OggFLAC__stream_encoder_get_total_samples_estimate().
761 OggFLAC_API FLAC__uint64 OggFLAC__stream_encoder_get_total_samples_estimate(const OggFLAC__StreamEncoder *encoder);
763 /** Initialize the encoder instance.
764 * Should be called after OggFLAC__stream_encoder_new() and
765 * OggFLAC__stream_encoder_set_*() but before OggFLAC__stream_encoder_process()
766 * or OggFLAC__stream_encoder_process_interleaved(). Will set and return
767 * the encoder state, which will be OggFLAC__STREAM_ENCODER_OK if
768 * initialization succeeded.
770 * The call to OggFLAC__stream_encoder_init() currently will also immediately
771 * call the write callback several times, once with the \c fLaC signature,
772 * and once for each encoded metadata block.
774 * \param encoder An uninitialized encoder instance.
776 * \code encoder != NULL \endcode
777 * \retval OggFLAC__StreamEncoderState
778 * \c OggFLAC__STREAM_ENCODER_OK if initialization was successful; see
779 * OggFLAC__StreamEncoderState for the meanings of other return values.
781 OggFLAC_API OggFLAC__StreamEncoderState OggFLAC__stream_encoder_init(OggFLAC__StreamEncoder *encoder);
783 /** Finish the encoding process.
784 * Flushes the encoding buffer, releases resources, resets the encoder
785 * settings to their defaults, and returns the encoder state to
786 * OggFLAC__STREAM_ENCODER_UNINITIALIZED. Note that this can generate
787 * one or more write callbacks before returning.
789 * In the event of a prematurely-terminated encode, it is not strictly
790 * necessary to call this immediately before OggFLAC__stream_encoder_delete()
791 * but it is good practice to match every OggFLAC__stream_encoder_init()
792 * with an OggFLAC__stream_encoder_finish().
794 * \param encoder An uninitialized encoder instance.
796 * \code encoder != NULL \endcode
798 OggFLAC_API void OggFLAC__stream_encoder_finish(OggFLAC__StreamEncoder *encoder);
800 /** Submit data for encoding.
801 * This is inherited from FLAC__StreamEncoder; see FLAC__stream_encoder_process().
803 * \param encoder An initialized encoder instance in the OK state.
804 * \param buffer An array of pointers to each channel's signal.
805 * \param samples The number of samples in one channel.
807 * \code encoder != NULL \endcode
808 * \code OggFLAC__stream_encoder_get_state(encoder) == OggFLAC__STREAM_ENCODER_OK \endcode
810 * \c true if successful, else \c false; in this case, check the
811 * encoder state with OggFLAC__stream_encoder_get_state() to see what
814 OggFLAC_API FLAC__bool OggFLAC__stream_encoder_process(OggFLAC__StreamEncoder *encoder, const FLAC__int32 * const buffer[], unsigned samples);
816 /** Submit data for encoding.
817 * This is inherited from FLAC__StreamEncoder; see FLAC__stream_encoder_process_interleaved().
819 * \param encoder An initialized encoder instance in the OK state.
820 * \param buffer An array of channel-interleaved data (see above).
821 * \param samples The number of samples in one channel, the same as for
822 * OggFLAC__stream_encoder_process(). For example, if
823 * encoding two channels, \c 1000 \a samples corresponds
824 * to a \a buffer of 2000 values.
826 * \code encoder != NULL \endcode
827 * \code OggFLAC__stream_encoder_get_state(encoder) == OggFLAC__STREAM_ENCODER_OK \endcode
829 * \c true if successful, else \c false; in this case, check the
830 * encoder state with OggFLAC__stream_encoder_get_state() to see what
833 OggFLAC_API FLAC__bool OggFLAC__stream_encoder_process_interleaved(OggFLAC__StreamEncoder *encoder, const FLAC__int32 buffer[], unsigned samples);