default window to tukey(0.5) instead of hann
[platform/upstream/flac.git] / include / FLAC / stream_encoder.h
1 /* libFLAC - Free Lossless Audio Codec library
2  * Copyright (C) 2000,2001,2002,2003,2004,2005,2006 Josh Coalson
3  *
4  * Redistribution and use in source and binary forms, with or without
5  * modification, are permitted provided that the following conditions
6  * are met:
7  *
8  * - Redistributions of source code must retain the above copyright
9  * notice, this list of conditions and the following disclaimer.
10  *
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.
14  *
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.
18  *
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.
30  */
31
32 #ifndef FLAC__STREAM_ENCODER_H
33 #define FLAC__STREAM_ENCODER_H
34
35 #include "export.h"
36 #include "format.h"
37 #include "stream_decoder.h"
38
39 #ifdef __cplusplus
40 extern "C" {
41 #endif
42
43
44 /** \file include/FLAC/stream_encoder.h
45  *
46  *  \brief
47  *  This module contains the functions which implement the stream
48  *  encoder.
49  *
50  *  See the detailed documentation in the
51  *  \link flac_stream_encoder stream encoder \endlink module.
52  */
53
54 /** \defgroup flac_encoder FLAC/ *_encoder.h: encoder interfaces
55  *  \ingroup flac
56  *
57  *  \brief
58  *  This module describes the two encoder layers provided by libFLAC.
59  *
60  * For encoding FLAC streams, libFLAC provides three layers of access.  The
61  * lowest layer is non-seekable stream-level encoding, the next is seekable
62  * stream-level encoding, and the highest layer is file-level encoding.  The
63  * interfaces are described in the \link flac_stream_encoder stream encoder
64  * \endlink, \link flac_seekable_stream_encoder seekable stream encoder
65  * \endlink, and \link flac_file_encoder file encoder \endlink modules
66  * respectively.  Typically you will choose the highest layer that your input
67  * source will support.
68  * The stream encoder relies on callbacks for writing the data and
69  * metadata. The file encoder provides these callbacks internally and you
70  * need only supply the filename.
71  *
72  * The stream encoder relies on callbacks for writing the data and has no
73  * provisions for seeking the output.  The seekable stream encoder wraps
74  * the stream encoder and also automaticallay handles the writing back of
75  * metadata discovered while encoding.  However, you must provide extra
76  * callbacks for seek-related operations on your output, like seek and
77  * tell.  The file encoder wraps the seekable stream encoder and supplies
78  * all of the callbacks internally, simplifying the processing of standard
79  * files.  The only callback exposed is for progress reporting, and that
80  * is optional.
81  */
82
83 /** \defgroup flac_stream_encoder FLAC/stream_encoder.h: stream encoder interface
84  *  \ingroup flac_encoder
85  *
86  *  \brief
87  *  This module contains the functions which implement the stream
88  *  encoder.
89  *
90  * The basic usage of this encoder is as follows:
91  * - The program creates an instance of an encoder using
92  *   FLAC__stream_encoder_new().
93  * - The program overrides the default settings and sets callbacks using
94  *   FLAC__stream_encoder_set_*() functions.
95  * - The program initializes the instance to validate the settings and
96  *   prepare for encoding using FLAC__stream_encoder_init().
97  * - The program calls FLAC__stream_encoder_process() or
98  *   FLAC__stream_encoder_process_interleaved() to encode data, which
99  *   subsequently calls the callbacks when there is encoder data ready
100  *   to be written.
101  * - The program finishes the encoding with FLAC__stream_encoder_finish(),
102  *   which causes the encoder to encode any data still in its input pipe,
103  *   call the metadata callback with the final encoding statistics, and
104  *   finally reset the encoder to the uninitialized state.
105  * - The instance may be used again or deleted with
106  *   FLAC__stream_encoder_delete().
107  *
108  * In more detail, the stream encoder functions similarly to the
109  * \link flac_stream_decoder stream decoder \endlink, but has fewer
110  * callbacks and more options.  Typically the user will create a new
111  * instance by calling FLAC__stream_encoder_new(), then set the necessary
112  * parameters and callbacks with FLAC__stream_encoder_set_*(), and
113  * initialize it by calling FLAC__stream_encoder_init().
114  *
115  * Unlike the decoders, the stream encoder has many options that can
116  * affect the speed and compression ratio.  When setting these parameters
117  * you should have some basic knowledge of the format (see the
118  * <A HREF="../documentation.html#format">user-level documentation</A>
119  * or the <A HREF="../format.html">formal description</A>).  The
120  * FLAC__stream_encoder_set_*() functions themselves do not validate the
121  * values as many are interdependent.  The FLAC__stream_encoder_init()
122  * function will do this, so make sure to pay attention to the state
123  * returned by FLAC__stream_encoder_init() to make sure that it is
124  * FLAC__STREAM_ENCODER_OK.  Any parameters that are not set before
125  * FLAC__stream_encoder_init() will take on the defaults from the
126  * constructor.
127  *
128  * The user must provide function pointers for the following callbacks:
129  *
130  * - Write callback - This function is called by the encoder anytime there
131  *   is raw encoded data to write.  It may include metadata mixed with
132  *   encoded audio frames and the data is not guaranteed to be aligned on
133  *   frame or metadata block boundaries.
134  * - Metadata callback - This function is called once at the end of
135  *   encoding with the populated STREAMINFO structure.  This is so file
136  *   encoders can seek back to the beginning of the file and write the
137  *   STREAMINFO block with the correct statistics after encoding (like
138  *   minimum/maximum frame size).
139  *
140  * The call to FLAC__stream_encoder_init() currently will also immediately
141  * call the write callback several times, once with the \c fLaC signature,
142  * and once for each encoded metadata block.
143  *
144  * After initializing the instance, the user may feed audio data to the
145  * encoder in one of two ways:
146  *
147  * - Channel separate, through FLAC__stream_encoder_process() - The user
148  *   will pass an array of pointers to buffers, one for each channel, to
149  *   the encoder, each of the same length.  The samples need not be
150  *   block-aligned.
151  * - Channel interleaved, through
152  *   FLAC__stream_encoder_process_interleaved() - The user will pass a single
153  *   pointer to data that is channel-interleaved (i.e. channel0_sample0,
154  *   channel1_sample0, ... , channelN_sample0, channel0_sample1, ...).
155  *   Again, the samples need not be block-aligned but they must be
156  *   sample-aligned, i.e. the first value should be channel0_sample0 and
157  *   the last value channelN_sampleM.
158  *
159  * When the user is finished encoding data, it calls
160  * FLAC__stream_encoder_finish(), which causes the encoder to encode any
161  * data still in its input pipe, and call the metadata callback with the
162  * final encoding statistics.  Then the instance may be deleted with
163  * FLAC__stream_encoder_delete() or initialized again to encode another
164  * stream.
165  *
166  * For programs that write their own metadata, but that do not know the
167  * actual metadata until after encoding, it is advantageous to instruct
168  * the encoder to write a PADDING block of the correct size, so that
169  * instead of rewriting the whole stream after encoding, the program can
170  * just overwrite the PADDING block.  If only the maximum size of the
171  * metadata is known, the program can write a slightly larger padding
172  * block, then split it after encoding.
173  *
174  * Make sure you understand how lengths are calculated.  All FLAC metadata
175  * blocks have a 4 byte header which contains the type and length.  This
176  * length does not include the 4 bytes of the header.  See the format page
177  * for the specification of metadata blocks and their lengths.
178  *
179  * \note
180  * The "set" functions may only be called when the encoder is in the
181  * state FLAC__STREAM_ENCODER_UNINITIALIZED, i.e. after
182  * FLAC__stream_encoder_new() or FLAC__stream_encoder_finish(), but
183  * before FLAC__stream_encoder_init().  If this is the case they will
184  * return \c true, otherwise \c false.
185  *
186  * \note
187  * FLAC__stream_encoder_finish() resets all settings to the constructor
188  * defaults, including the callbacks.
189  *
190  * \{
191  */
192
193
194 /** State values for a FLAC__StreamEncoder
195  *
196  *  The encoder's state can be obtained by calling FLAC__stream_encoder_get_state().
197  */
198 typedef enum {
199
200         FLAC__STREAM_ENCODER_OK = 0,
201         /**< The encoder is in the normal OK state. */
202
203         FLAC__STREAM_ENCODER_VERIFY_DECODER_ERROR,
204         /**< An error occurred in the underlying verify stream decoder;
205          * check FLAC__stream_encoder_get_verify_decoder_state().
206          */
207
208         FLAC__STREAM_ENCODER_VERIFY_MISMATCH_IN_AUDIO_DATA,
209         /**< The verify decoder detected a mismatch between the original
210          * audio signal and the decoded audio signal.
211          */
212
213         FLAC__STREAM_ENCODER_INVALID_CALLBACK,
214         /**< The encoder was initialized before setting all the required callbacks. */
215
216         FLAC__STREAM_ENCODER_INVALID_NUMBER_OF_CHANNELS,
217         /**< The encoder has an invalid setting for number of channels. */
218
219         FLAC__STREAM_ENCODER_INVALID_BITS_PER_SAMPLE,
220         /**< The encoder has an invalid setting for bits-per-sample.
221          * FLAC supports 4-32 bps but the reference encoder currently supports
222          * only up to 24 bps.
223          */
224
225         FLAC__STREAM_ENCODER_INVALID_SAMPLE_RATE,
226         /**< The encoder has an invalid setting for the input sample rate. */
227
228         FLAC__STREAM_ENCODER_INVALID_BLOCK_SIZE,
229         /**< The encoder has an invalid setting for the block size. */
230
231         FLAC__STREAM_ENCODER_INVALID_MAX_LPC_ORDER,
232         /**< The encoder has an invalid setting for the maximum LPC order. */
233
234         FLAC__STREAM_ENCODER_INVALID_QLP_COEFF_PRECISION,
235         /**< The encoder has an invalid setting for the precision of the quantized linear predictor coefficients. */
236
237         FLAC__STREAM_ENCODER_MID_SIDE_CHANNELS_MISMATCH,
238         /**< Mid/side coding was specified but the number of channels is not equal to 2. */
239
240         FLAC__STREAM_ENCODER_MID_SIDE_SAMPLE_SIZE_MISMATCH,
241         /**< Deprecated. */
242
243         FLAC__STREAM_ENCODER_ILLEGAL_MID_SIDE_FORCE,
244         /**< Loose mid/side coding was specified but mid/side coding was not. */
245
246         FLAC__STREAM_ENCODER_BLOCK_SIZE_TOO_SMALL_FOR_LPC_ORDER,
247         /**< The specified block size is less than the maximum LPC order. */
248
249         FLAC__STREAM_ENCODER_NOT_STREAMABLE,
250         /**< The encoder is bound to the "streamable subset" but other settings violate it. */
251
252         FLAC__STREAM_ENCODER_FRAMING_ERROR,
253         /**< An error occurred while writing the stream; usually, the write_callback returned an error. */
254
255         FLAC__STREAM_ENCODER_INVALID_METADATA,
256         /**< The metadata input to the encoder is invalid, in one of the following ways:
257          * - FLAC__stream_encoder_set_metadata() was called with a null pointer but a block count > 0
258          * - One of the metadata blocks contains an undefined type
259          * - It contains an illegal CUESHEET as checked by FLAC__format_cuesheet_is_legal()
260          * - It contains an illegal SEEKTABLE as checked by FLAC__format_seektable_is_legal()
261          * - It contains more than one SEEKTABLE block or more than one VORBIS_COMMENT block
262          */
263
264         FLAC__STREAM_ENCODER_FATAL_ERROR_WHILE_ENCODING,
265         /**< An error occurred while writing the stream; usually, the write_callback returned an error. */
266
267         FLAC__STREAM_ENCODER_FATAL_ERROR_WHILE_WRITING,
268         /**< The write_callback returned an error. */
269
270         FLAC__STREAM_ENCODER_MEMORY_ALLOCATION_ERROR,
271         /**< Memory allocation failed. */
272
273         FLAC__STREAM_ENCODER_ALREADY_INITIALIZED,
274         /**< FLAC__stream_encoder_init() was called when the encoder was
275          * already initialized, usually because
276          * FLAC__stream_encoder_finish() was not called.
277          */
278
279         FLAC__STREAM_ENCODER_UNINITIALIZED
280         /**< The encoder is in the uninitialized state. */
281
282 } FLAC__StreamEncoderState;
283
284 /** Maps a FLAC__StreamEncoderState to a C string.
285  *
286  *  Using a FLAC__StreamEncoderState as the index to this array
287  *  will give the string equivalent.  The contents should not be modified.
288  */
289 extern FLAC_API const char * const FLAC__StreamEncoderStateString[];
290
291 /** Return values for the FLAC__StreamEncoder write callback.
292  */
293 typedef enum {
294
295         FLAC__STREAM_ENCODER_WRITE_STATUS_OK = 0,
296         /**< The write was OK and encoding can continue. */
297
298         FLAC__STREAM_ENCODER_WRITE_STATUS_FATAL_ERROR
299         /**< An unrecoverable error occurred.  The encoder will return from the process call. */
300
301 } FLAC__StreamEncoderWriteStatus;
302
303 /** Maps a FLAC__StreamEncoderWriteStatus to a C string.
304  *
305  *  Using a FLAC__StreamEncoderWriteStatus as the index to this array
306  *  will give the string equivalent.  The contents should not be modified.
307  */
308 extern FLAC_API const char * const FLAC__StreamEncoderWriteStatusString[];
309
310
311 /***********************************************************************
312  *
313  * class FLAC__StreamEncoder
314  *
315  ***********************************************************************/
316
317 struct FLAC__StreamEncoderProtected;
318 struct FLAC__StreamEncoderPrivate;
319 /** The opaque structure definition for the stream encoder type.
320  *  See the \link flac_stream_encoder stream encoder module \endlink
321  *  for a detailed description.
322  */
323 typedef struct {
324         struct FLAC__StreamEncoderProtected *protected_; /* avoid the C++ keyword 'protected' */
325         struct FLAC__StreamEncoderPrivate *private_; /* avoid the C++ keyword 'private' */
326 } FLAC__StreamEncoder;
327
328 /** Signature for the write callback.
329  *  See FLAC__stream_encoder_set_write_callback() for more info.
330  *
331  * \param  encoder  The encoder instance calling the callback.
332  * \param  buffer   An array of encoded data of length \a bytes.
333  * \param  bytes    The byte length of \a buffer.
334  * \param  samples  The number of samples encoded by \a buffer.
335  *                  \c 0 has a special meaning; see
336  *                  FLAC__stream_encoder_set_write_callback().
337  * \param  current_frame  The number of the current frame being encoded.
338  * \param  client_data  The callee's client data set through
339  *                      FLAC__stream_encoder_set_client_data().
340  * \retval FLAC__StreamEncoderWriteStatus
341  *    The callee's return status.
342  */
343 typedef FLAC__StreamEncoderWriteStatus (*FLAC__StreamEncoderWriteCallback)(const FLAC__StreamEncoder *encoder, const FLAC__byte buffer[], unsigned bytes, unsigned samples, unsigned current_frame, void *client_data);
344
345 /** Signature for the metadata callback.
346  *  See FLAC__stream_encoder_set_metadata_callback() for more info.
347  *
348  * \param  encoder      The encoder instance calling the callback.
349  * \param  metadata     The final populated STREAMINFO block.
350  * \param  client_data  The callee's client data set through
351  *                      FLAC__stream_encoder_set_client_data().
352  */
353 typedef void (*FLAC__StreamEncoderMetadataCallback)(const FLAC__StreamEncoder *encoder, const FLAC__StreamMetadata *metadata, void *client_data);
354
355
356 /***********************************************************************
357  *
358  * Class constructor/destructor
359  *
360  ***********************************************************************/
361
362 /** Create a new stream encoder instance.  The instance is created with
363  *  default settings; see the individual FLAC__stream_encoder_set_*()
364  *  functions for each setting's default.
365  *
366  * \retval FLAC__StreamEncoder*
367  *    \c NULL if there was an error allocating memory, else the new instance.
368  */
369 FLAC_API FLAC__StreamEncoder *FLAC__stream_encoder_new();
370
371 /** Free an encoder instance.  Deletes the object pointed to by \a encoder.
372  *
373  * \param encoder  A pointer to an existing encoder.
374  * \assert
375  *    \code encoder != NULL \endcode
376  */
377 FLAC_API void FLAC__stream_encoder_delete(FLAC__StreamEncoder *encoder);
378
379
380 /***********************************************************************
381  *
382  * Public class method prototypes
383  *
384  ***********************************************************************/
385
386 /** Set the "verify" flag.  If \c true, the encoder will verify it's own
387  *  encoded output by feeding it through an internal decoder and comparing
388  *  the original signal against the decoded signal.  If a mismatch occurs,
389  *  the process call will return \c false.  Note that this will slow the
390  *  encoding process by the extra time required for decoding and comparison.
391  *
392  * \default \c false
393  * \param  encoder  An encoder instance to set.
394  * \param  value    Flag value (see above).
395  * \assert
396  *    \code encoder != NULL \endcode
397  * \retval FLAC__bool
398  *    \c false if the encoder is already initialized, else \c true.
399  */
400 FLAC_API FLAC__bool FLAC__stream_encoder_set_verify(FLAC__StreamEncoder *encoder, FLAC__bool value);
401
402 /** Set the "streamable subset" flag.  If \c true, the encoder will comply
403  *  with the subset (see the format specification) and will check the
404  *  settings during FLAC__stream_encoder_init() to see if all settings
405  *  comply.  If \c false, the settings may take advantage of the full
406  *  range that the format allows.
407  *
408  *  Make sure you know what it entails before setting this to \c false.
409  *
410  * \default \c true
411  * \param  encoder  An encoder instance to set.
412  * \param  value    Flag value (see above).
413  * \assert
414  *    \code encoder != NULL \endcode
415  * \retval FLAC__bool
416  *    \c false if the encoder is already initialized, else \c true.
417  */
418 FLAC_API FLAC__bool FLAC__stream_encoder_set_streamable_subset(FLAC__StreamEncoder *encoder, FLAC__bool value);
419
420 /** Set to \c true to enable mid-side encoding on stereo input.  The
421  *  number of channels must be 2.  Set to \c false to use only
422  *  independent channel coding.
423  *
424  * \default \c false
425  * \param  encoder  An encoder instance to set.
426  * \param  value    Flag value (see above).
427  * \assert
428  *    \code encoder != NULL \endcode
429  * \retval FLAC__bool
430  *    \c false if the encoder is already initialized, else \c true.
431  */
432 FLAC_API FLAC__bool FLAC__stream_encoder_set_do_mid_side_stereo(FLAC__StreamEncoder *encoder, FLAC__bool value);
433
434 /** Set to \c true to enable adaptive switching between mid-side and
435  *  left-right encoding on stereo input.  The number of channels must
436  *  be 2.  Set to \c false to use exhaustive searching.  In either
437  *  case, the mid/side stereo setting must be \c true.
438  *
439  * \default \c false
440  * \param  encoder  An encoder instance to set.
441  * \param  value    Flag value (see above).
442  * \assert
443  *    \code encoder != NULL \endcode
444  * \retval FLAC__bool
445  *    \c false if the encoder is already initialized, else \c true.
446  */
447 FLAC_API FLAC__bool FLAC__stream_encoder_set_loose_mid_side_stereo(FLAC__StreamEncoder *encoder, FLAC__bool value);
448
449 /** Set the number of channels to be encoded.
450  *
451  * \default \c 2
452  * \param  encoder  An encoder instance to set.
453  * \param  value    See above.
454  * \assert
455  *    \code encoder != NULL \endcode
456  * \retval FLAC__bool
457  *    \c false if the encoder is already initialized, else \c true.
458  */
459 FLAC_API FLAC__bool FLAC__stream_encoder_set_channels(FLAC__StreamEncoder *encoder, unsigned value);
460
461 /** Set the sample resolution of the input to be encoded.
462  *
463  * \warning
464  * Do not feed the encoder data that is wider than the value you
465  * set here or you will generate an invalid stream.
466  *
467  * \default \c 16
468  * \param  encoder  An encoder instance to set.
469  * \param  value    See above.
470  * \assert
471  *    \code encoder != NULL \endcode
472  * \retval FLAC__bool
473  *    \c false if the encoder is already initialized, else \c true.
474  */
475 FLAC_API FLAC__bool FLAC__stream_encoder_set_bits_per_sample(FLAC__StreamEncoder *encoder, unsigned value);
476
477 /** Set the sample rate (in Hz) of the input to be encoded.
478  *
479  * \default \c 44100
480  * \param  encoder  An encoder instance to set.
481  * \param  value    See above.
482  * \assert
483  *    \code encoder != NULL \endcode
484  * \retval FLAC__bool
485  *    \c false if the encoder is already initialized, else \c true.
486  */
487 FLAC_API FLAC__bool FLAC__stream_encoder_set_sample_rate(FLAC__StreamEncoder *encoder, unsigned value);
488
489 /** Set the blocksize to use while encoding.
490  *
491  * \default \c 1152
492  * \param  encoder  An encoder instance to set.
493  * \param  value    See above.
494  * \assert
495  *    \code encoder != NULL \endcode
496  * \retval FLAC__bool
497  *    \c false if the encoder is already initialized, else \c true.
498  */
499 FLAC_API FLAC__bool FLAC__stream_encoder_set_blocksize(FLAC__StreamEncoder *encoder, unsigned value);
500
501 /** Sets the apodization function(s) the encoder will use when windowing
502  *  audio data for LPC analysis.
503  *
504  * The \a specification is a plain ASCII string which specifies exactly
505  * which functions to use.  There may be more than one (up to 32),
506  * separated by \c ';' characters.  Some functions take one or more
507  * comma-separated arguments in parentheses.
508  *
509  * The available functions are \c bartlett, \c bartlett_hann,
510  * \c blackman, \c blackman_harris_4term_92db, \c connes, \c flattop,
511  * \c gauss(STDDEV), \c hamming, \c hann, \c kaiser_bessel, \c nuttall,
512  * \c rectangle, \c triangle, \c tukey(P), \c welch.
513  *
514  * For \c gauss(STDDEV), STDDEV specifies the standard deviation
515  * (0<STDDEV<=0.5).
516  *
517  * For \c tukey(P), P specifies the fraction of the window that is
518  * tapered (0<=P<=1).  P=0 corresponds to \c rectangle and P=1
519  * corresponds to \c hann.
520  *
521  * Example specifications are \c "blackman" or
522  * \c "hann;triangle;tukey(0.5);tukey(0.25);tukey(0.125)"
523  *
524  * Any function that is specified erroneously is silently dropped.  Up
525  * to 32 functions are kept, the rest are dropped.  If the specification
526  * is empty the encoder defaults to \c "tukey(0.5)".
527  *
528  * When more than one function is specified, then for every subframe the
529  * encoder will try each of them separately and choose the window that
530  * results in the smallest compressed subframe.
531  *
532  * Note that each function specified causes the encoder to occupy a
533  * floating point array in which to store the window.
534  *
535  * \default \c "tukey(0.5)"
536  * \param  encoder        An encoder instance to set.
537  * \param  specification  See above.
538  * \assert
539  *    \code encoder != NULL \endcode
540  *    \code specification != NULL \endcode
541  * \retval FLAC__bool
542  *    \c false if the encoder is already initialized, else \c true.
543  */
544 /* @@@@add to unit tests*/
545 FLAC_API FLAC__bool FLAC__stream_encoder_set_apodization(FLAC__StreamEncoder *encoder, const char *specification);
546
547 /** Set the maximum LPC order, or \c 0 to use only the fixed predictors.
548  *
549  * \default \c 0
550  * \param  encoder  An encoder instance to set.
551  * \param  value    See above.
552  * \assert
553  *    \code encoder != NULL \endcode
554  * \retval FLAC__bool
555  *    \c false if the encoder is already initialized, else \c true.
556  */
557 FLAC_API FLAC__bool FLAC__stream_encoder_set_max_lpc_order(FLAC__StreamEncoder *encoder, unsigned value);
558
559 /** Set the precision, in bits, of the quantized linear predictor
560  *  coefficients, or \c 0 to let the encoder select it based on the
561  *  blocksize.
562  *
563  * \note
564  * In the current implementation, qlp_coeff_precision + bits_per_sample must
565  * be less than 32.
566  *
567  * \default \c 0
568  * \param  encoder  An encoder instance to set.
569  * \param  value    See above.
570  * \assert
571  *    \code encoder != NULL \endcode
572  * \retval FLAC__bool
573  *    \c false if the encoder is already initialized, else \c true.
574  */
575 FLAC_API FLAC__bool FLAC__stream_encoder_set_qlp_coeff_precision(FLAC__StreamEncoder *encoder, unsigned value);
576
577 /** Set to \c false to use only the specified quantized linear predictor
578  *  coefficient precision, or \c true to search neighboring precision
579  *  values and use the best one.
580  *
581  * \default \c false
582  * \param  encoder  An encoder instance to set.
583  * \param  value    See above.
584  * \assert
585  *    \code encoder != NULL \endcode
586  * \retval FLAC__bool
587  *    \c false if the encoder is already initialized, else \c true.
588  */
589 FLAC_API FLAC__bool FLAC__stream_encoder_set_do_qlp_coeff_prec_search(FLAC__StreamEncoder *encoder, FLAC__bool value);
590
591 /** Deprecated.  Setting this value has no effect.
592  *
593  * \default \c false
594  * \param  encoder  An encoder instance to set.
595  * \param  value    See above.
596  * \assert
597  *    \code encoder != NULL \endcode
598  * \retval FLAC__bool
599  *    \c false if the encoder is already initialized, else \c true.
600  */
601 FLAC_API FLAC__bool FLAC__stream_encoder_set_do_escape_coding(FLAC__StreamEncoder *encoder, FLAC__bool value);
602
603 /** Set to \c false to let the encoder estimate the best model order
604  *  based on the residual signal energy, or \c true to force the
605  *  encoder to evaluate all order models and select the best.
606  *
607  * \default \c false
608  * \param  encoder  An encoder instance to set.
609  * \param  value    See above.
610  * \assert
611  *    \code encoder != NULL \endcode
612  * \retval FLAC__bool
613  *    \c false if the encoder is already initialized, else \c true.
614  */
615 FLAC_API FLAC__bool FLAC__stream_encoder_set_do_exhaustive_model_search(FLAC__StreamEncoder *encoder, FLAC__bool value);
616
617 /** Set the minimum partition order to search when coding the residual.
618  *  This is used in tandem with
619  *  FLAC__stream_encoder_set_max_residual_partition_order().
620  *
621  *  The partition order determines the context size in the residual.
622  *  The context size will be approximately <tt>blocksize / (2 ^ order)</tt>.
623  *
624  *  Set both min and max values to \c 0 to force a single context,
625  *  whose Rice parameter is based on the residual signal variance.
626  *  Otherwise, set a min and max order, and the encoder will search
627  *  all orders, using the mean of each context for its Rice parameter,
628  *  and use the best.
629  *
630  * \default \c 0
631  * \param  encoder  An encoder instance to set.
632  * \param  value    See above.
633  * \assert
634  *    \code encoder != NULL \endcode
635  * \retval FLAC__bool
636  *    \c false if the encoder is already initialized, else \c true.
637  */
638 FLAC_API FLAC__bool FLAC__stream_encoder_set_min_residual_partition_order(FLAC__StreamEncoder *encoder, unsigned value);
639
640 /** Set the maximum partition order to search when coding the residual.
641  *  This is used in tandem with
642  *  FLAC__stream_encoder_set_min_residual_partition_order().
643  *
644  *  The partition order determines the context size in the residual.
645  *  The context size will be approximately <tt>blocksize / (2 ^ order)</tt>.
646  *
647  *  Set both min and max values to \c 0 to force a single context,
648  *  whose Rice parameter is based on the residual signal variance.
649  *  Otherwise, set a min and max order, and the encoder will search
650  *  all orders, using the mean of each context for its Rice parameter,
651  *  and use the best.
652  *
653  * \default \c 0
654  * \param  encoder  An encoder instance to set.
655  * \param  value    See above.
656  * \assert
657  *    \code encoder != NULL \endcode
658  * \retval FLAC__bool
659  *    \c false if the encoder is already initialized, else \c true.
660  */
661 FLAC_API FLAC__bool FLAC__stream_encoder_set_max_residual_partition_order(FLAC__StreamEncoder *encoder, unsigned value);
662
663 /** Deprecated.  Setting this value has no effect.
664  *
665  * \default \c 0
666  * \param  encoder  An encoder instance to set.
667  * \param  value    See above.
668  * \assert
669  *    \code encoder != NULL \endcode
670  * \retval FLAC__bool
671  *    \c false if the encoder is already initialized, else \c true.
672  */
673 FLAC_API FLAC__bool FLAC__stream_encoder_set_rice_parameter_search_dist(FLAC__StreamEncoder *encoder, unsigned value);
674
675 /** Set an estimate of the total samples that will be encoded.
676  *  This is merely an estimate and may be set to \c 0 if unknown.
677  *  This value will be written to the STREAMINFO block before encoding,
678  *  and can remove the need for the caller to rewrite the value later
679  *  if the value is known before encoding.
680  *
681  * \default \c 0
682  * \param  encoder  An encoder instance to set.
683  * \param  value    See above.
684  * \assert
685  *    \code encoder != NULL \endcode
686  * \retval FLAC__bool
687  *    \c false if the encoder is already initialized, else \c true.
688  */
689 FLAC_API FLAC__bool FLAC__stream_encoder_set_total_samples_estimate(FLAC__StreamEncoder *encoder, FLAC__uint64 value);
690
691 /** Set the metadata blocks to be emitted to the stream before encoding.
692  *  A value of \c NULL, \c 0 implies no metadata; otherwise, supply an
693  *  array of pointers to metadata blocks.  The array is non-const since
694  *  the encoder may need to change the \a is_last flag inside them.
695  *  Otherwise, the encoder will not modify or free the blocks.  It is up
696  *  to the caller to free the metadata blocks after encoding.
697  *
698  * \note
699  * The encoder stores only the \a metadata pointer; the passed-in array
700  * must survive at least until after FLAC__stream_encoder_init() returns.
701  * Do not modify the array or free the blocks until then.
702  *
703  * \note
704  * The STREAMINFO block is always written and no STREAMINFO block may
705  * occur in the supplied array.
706  *
707  * \note
708  * By default the encoder does not create a SEEKTABLE.  If one is supplied
709  * in the \a metadata array it will be written verbatim.  However by itself
710  * this is not very useful as the user will not know the stream offsets for
711  * the seekpoints ahead of time.  You must use the seekable stream encoder
712  * to generate a legal seektable
713  * (see FLAC__seekable_stream_encoder_set_metadata())
714  *
715  * \note
716  * A VORBIS_COMMENT block may be supplied.  The vendor string in it
717  * will be ignored.  libFLAC will use it's own vendor string. libFLAC
718  * will not modify the passed-in VORBIS_COMMENT's vendor string, it
719  * will simply write it's own into the stream.  If no VORBIS_COMMENT
720  * block is present in the \a metadata array, libFLAC will write an
721  * empty one, containing only the vendor string.
722  *
723  * \default \c NULL, 0
724  * \param  encoder     An encoder instance to set.
725  * \param  metadata    See above.
726  * \param  num_blocks  See above.
727  * \assert
728  *    \code encoder != NULL \endcode
729  * \retval FLAC__bool
730  *    \c false if the encoder is already initialized, else \c true.
731  */
732 FLAC_API FLAC__bool FLAC__stream_encoder_set_metadata(FLAC__StreamEncoder *encoder, FLAC__StreamMetadata **metadata, unsigned num_blocks);
733
734 /** Set the write callback.
735  *  The supplied function will be called by the encoder anytime there is raw
736  *  encoded data ready to write.  It may include metadata mixed with encoded
737  *  audio frames and the data is not guaranteed to be aligned on frame or
738  *  metadata block boundaries.
739  *
740  *  The only duty of the callback is to write out the \a bytes worth of data
741  *  in \a buffer to the current position in the output stream.  The arguments
742  *  \a samples and \a current_frame are purely informational.  If \a samples
743  *  is greater than \c 0, then \a current_frame will hold the current frame
744  *  number that is being written; otherwise, the write callback is being called
745  *  to write metadata.
746  *
747  * \note
748  * The callback is mandatory and must be set before initialization.
749  *
750  * \default \c NULL
751  * \param  encoder  An encoder instance to set.
752  * \param  value    See above.
753  * \assert
754  *    \code encoder != NULL \endcode
755  *    \code value != NULL \endcode
756  * \retval FLAC__bool
757  *    \c false if the encoder is already initialized, else \c true.
758  */
759 FLAC_API FLAC__bool FLAC__stream_encoder_set_write_callback(FLAC__StreamEncoder *encoder, FLAC__StreamEncoderWriteCallback value);
760
761 /** Set the metadata callback.
762  *  The supplied function will be called once at the end of encoding with
763  *  the populated STREAMINFO structure.  This is so file encoders can seek
764  *  back to the beginning of the file and write the STREAMINFO block with
765  *  the correct statistics after encoding (like minimum/maximum frame size
766  *  and total samples).
767  *
768  * \note
769  * The callback is mandatory and must be set before initialization.
770  *
771  * \default \c NULL
772  * \param  encoder  An encoder instance to set.
773  * \param  value    See above.
774  * \assert
775  *    \code encoder != NULL \endcode
776  *    \code value != NULL \endcode
777  * \retval FLAC__bool
778  *    \c false if the encoder is already initialized, else \c true.
779  */
780 FLAC_API FLAC__bool FLAC__stream_encoder_set_metadata_callback(FLAC__StreamEncoder *encoder, FLAC__StreamEncoderMetadataCallback value);
781
782 /** Set the client data to be passed back to callbacks.
783  *  This value will be supplied to callbacks in their \a client_data
784  *  argument.
785  *
786  * \default \c NULL
787  * \param  encoder  An encoder instance to set.
788  * \param  value    See above.
789  * \assert
790  *    \code encoder != NULL \endcode
791  * \retval FLAC__bool
792  *    \c false if the encoder is already initialized, else \c true.
793  */
794 FLAC_API FLAC__bool FLAC__stream_encoder_set_client_data(FLAC__StreamEncoder *encoder, void *value);
795
796 /** Get the current encoder state.
797  *
798  * \param  encoder  An encoder instance to query.
799  * \assert
800  *    \code encoder != NULL \endcode
801  * \retval FLAC__StreamEncoderState
802  *    The current encoder state.
803  */
804 FLAC_API FLAC__StreamEncoderState FLAC__stream_encoder_get_state(const FLAC__StreamEncoder *encoder);
805
806 /** Get the state of the verify stream decoder.
807  *  Useful when the stream encoder state is
808  *  \c FLAC__STREAM_ENCODER_VERIFY_DECODER_ERROR.
809  *
810  * \param  encoder  An encoder instance to query.
811  * \assert
812  *    \code encoder != NULL \endcode
813  * \retval FLAC__StreamDecoderState
814  *    The verify stream decoder state.
815  */
816 FLAC_API FLAC__StreamDecoderState FLAC__stream_encoder_get_verify_decoder_state(const FLAC__StreamEncoder *encoder);
817
818 /** Get the current encoder state as a C string.
819  *  This version automatically resolves
820  *  \c FLAC__STREAM_ENCODER_VERIFY_DECODER_ERROR by getting the
821  *  verify decoder's state.
822  *
823  * \param  encoder  A encoder instance to query.
824  * \assert
825  *    \code encoder != NULL \endcode
826  * \retval const char *
827  *    The encoder state as a C string.  Do not modify the contents.
828  */
829 FLAC_API const char *FLAC__stream_encoder_get_resolved_state_string(const FLAC__StreamEncoder *encoder);
830
831 /** Get relevant values about the nature of a verify decoder error.
832  *  Useful when the stream encoder state is
833  *  \c FLAC__STREAM_ENCODER_VERIFY_DECODER_ERROR.  The arguments should
834  *  be addresses in which the stats will be returned, or NULL if value
835  *  is not desired.
836  *
837  * \param  encoder  An encoder instance to query.
838  * \param  absolute_sample  The absolute sample number of the mismatch.
839  * \param  frame_number  The number of the frame in which the mismatch occurred.
840  * \param  channel       The channel in which the mismatch occurred.
841  * \param  sample        The number of the sample (relative to the frame) in
842  *                       which the mismatch occurred.
843  * \param  expected      The expected value for the sample in question.
844  * \param  got           The actual value returned by the decoder.
845  * \assert
846  *    \code encoder != NULL \endcode
847  */
848 FLAC_API void FLAC__stream_encoder_get_verify_decoder_error_stats(const FLAC__StreamEncoder *encoder, FLAC__uint64 *absolute_sample, unsigned *frame_number, unsigned *channel, unsigned *sample, FLAC__int32 *expected, FLAC__int32 *got);
849
850 /** Get the "verify" flag.
851  *
852  * \param  encoder  An encoder instance to query.
853  * \assert
854  *    \code encoder != NULL \endcode
855  * \retval FLAC__bool
856  *    See FLAC__stream_encoder_set_verify().
857  */
858 FLAC_API FLAC__bool FLAC__stream_encoder_get_verify(const FLAC__StreamEncoder *encoder);
859
860 /** Get the "streamable subset" flag.
861  *
862  * \param  encoder  An encoder instance to query.
863  * \assert
864  *    \code encoder != NULL \endcode
865  * \retval FLAC__bool
866  *    See FLAC__stream_encoder_set_streamable_subset().
867  */
868 FLAC_API FLAC__bool FLAC__stream_encoder_get_streamable_subset(const FLAC__StreamEncoder *encoder);
869
870 /** Get the "mid/side stereo coding" flag.
871  *
872  * \param  encoder  An encoder instance to query.
873  * \assert
874  *    \code encoder != NULL \endcode
875  * \retval FLAC__bool
876  *    See FLAC__stream_encoder_get_do_mid_side_stereo().
877  */
878 FLAC_API FLAC__bool FLAC__stream_encoder_get_do_mid_side_stereo(const FLAC__StreamEncoder *encoder);
879
880 /** Get the "adaptive mid/side switching" flag.
881  *
882  * \param  encoder  An encoder instance to query.
883  * \assert
884  *    \code encoder != NULL \endcode
885  * \retval FLAC__bool
886  *    See FLAC__stream_encoder_set_loose_mid_side_stereo().
887  */
888 FLAC_API FLAC__bool FLAC__stream_encoder_get_loose_mid_side_stereo(const FLAC__StreamEncoder *encoder);
889
890 /** Get the number of input channels being processed.
891  *
892  * \param  encoder  An encoder instance to query.
893  * \assert
894  *    \code encoder != NULL \endcode
895  * \retval unsigned
896  *    See FLAC__stream_encoder_set_channels().
897  */
898 FLAC_API unsigned FLAC__stream_encoder_get_channels(const FLAC__StreamEncoder *encoder);
899
900 /** Get the input sample resolution setting.
901  *
902  * \param  encoder  An encoder instance to query.
903  * \assert
904  *    \code encoder != NULL \endcode
905  * \retval unsigned
906  *    See FLAC__stream_encoder_set_bits_per_sample().
907  */
908 FLAC_API unsigned FLAC__stream_encoder_get_bits_per_sample(const FLAC__StreamEncoder *encoder);
909
910 /** Get the input sample rate setting.
911  *
912  * \param  encoder  An encoder instance to query.
913  * \assert
914  *    \code encoder != NULL \endcode
915  * \retval unsigned
916  *    See FLAC__stream_encoder_set_sample_rate().
917  */
918 FLAC_API unsigned FLAC__stream_encoder_get_sample_rate(const FLAC__StreamEncoder *encoder);
919
920 /** Get the blocksize setting.
921  *
922  * \param  encoder  An encoder instance to query.
923  * \assert
924  *    \code encoder != NULL \endcode
925  * \retval unsigned
926  *    See FLAC__stream_encoder_set_blocksize().
927  */
928 FLAC_API unsigned FLAC__stream_encoder_get_blocksize(const FLAC__StreamEncoder *encoder);
929
930 /** Get the maximum LPC order setting.
931  *
932  * \param  encoder  An encoder instance to query.
933  * \assert
934  *    \code encoder != NULL \endcode
935  * \retval unsigned
936  *    See FLAC__stream_encoder_set_max_lpc_order().
937  */
938 FLAC_API unsigned FLAC__stream_encoder_get_max_lpc_order(const FLAC__StreamEncoder *encoder);
939
940 /** Get the quantized linear predictor coefficient precision setting.
941  *
942  * \param  encoder  An encoder instance to query.
943  * \assert
944  *    \code encoder != NULL \endcode
945  * \retval unsigned
946  *    See FLAC__stream_encoder_set_qlp_coeff_precision().
947  */
948 FLAC_API unsigned FLAC__stream_encoder_get_qlp_coeff_precision(const FLAC__StreamEncoder *encoder);
949
950 /** Get the qlp coefficient precision search flag.
951  *
952  * \param  encoder  An encoder instance to query.
953  * \assert
954  *    \code encoder != NULL \endcode
955  * \retval FLAC__bool
956  *    See FLAC__stream_encoder_set_do_qlp_coeff_prec_search().
957  */
958 FLAC_API FLAC__bool FLAC__stream_encoder_get_do_qlp_coeff_prec_search(const FLAC__StreamEncoder *encoder);
959
960 /** Get the "escape coding" flag.
961  *
962  * \param  encoder  An encoder instance to query.
963  * \assert
964  *    \code encoder != NULL \endcode
965  * \retval FLAC__bool
966  *    See FLAC__stream_encoder_set_do_escape_coding().
967  */
968 FLAC_API FLAC__bool FLAC__stream_encoder_get_do_escape_coding(const FLAC__StreamEncoder *encoder);
969
970 /** Get the exhaustive model search flag.
971  *
972  * \param  encoder  An encoder instance to query.
973  * \assert
974  *    \code encoder != NULL \endcode
975  * \retval FLAC__bool
976  *    See FLAC__stream_encoder_set_do_exhaustive_model_search().
977  */
978 FLAC_API FLAC__bool FLAC__stream_encoder_get_do_exhaustive_model_search(const FLAC__StreamEncoder *encoder);
979
980 /** Get the minimum residual partition order setting.
981  *
982  * \param  encoder  An encoder instance to query.
983  * \assert
984  *    \code encoder != NULL \endcode
985  * \retval unsigned
986  *    See FLAC__stream_encoder_set_min_residual_partition_order().
987  */
988 FLAC_API unsigned FLAC__stream_encoder_get_min_residual_partition_order(const FLAC__StreamEncoder *encoder);
989
990 /** Get maximum residual partition order setting.
991  *
992  * \param  encoder  An encoder instance to query.
993  * \assert
994  *    \code encoder != NULL \endcode
995  * \retval unsigned
996  *    See FLAC__stream_encoder_set_max_residual_partition_order().
997  */
998 FLAC_API unsigned FLAC__stream_encoder_get_max_residual_partition_order(const FLAC__StreamEncoder *encoder);
999
1000 /** Get the Rice parameter search distance setting.
1001  *
1002  * \param  encoder  An encoder instance to query.
1003  * \assert
1004  *    \code encoder != NULL \endcode
1005  * \retval unsigned
1006  *    See FLAC__stream_encoder_set_rice_parameter_search_dist().
1007  */
1008 FLAC_API unsigned FLAC__stream_encoder_get_rice_parameter_search_dist(const FLAC__StreamEncoder *encoder);
1009
1010 /** Get the previously set estimate of the total samples to be encoded.
1011  *  The encoder merely mimics back the value given to
1012  *  FLAC__stream_encoder_set_total_samples_estimate() since it has no
1013  *  other way of knowing how many samples the user will encode.
1014  *
1015  * \param  encoder  An encoder instance to set.
1016  * \assert
1017  *    \code encoder != NULL \endcode
1018  * \retval FLAC__uint64
1019  *    See FLAC__stream_encoder_get_total_samples_estimate().
1020  */
1021 FLAC_API FLAC__uint64 FLAC__stream_encoder_get_total_samples_estimate(const FLAC__StreamEncoder *encoder);
1022
1023 /** Initialize the encoder instance.
1024  *  Should be called after FLAC__stream_encoder_new() and
1025  *  FLAC__stream_encoder_set_*() but before FLAC__stream_encoder_process()
1026  *  or FLAC__stream_encoder_process_interleaved().  Will set and return
1027  *  the encoder state, which will be FLAC__STREAM_ENCODER_OK if
1028  *  initialization succeeded.
1029  *
1030  *  The call to FLAC__stream_encoder_init() currently will also immediately
1031  *  call the write callback several times, once with the \c fLaC signature,
1032  *  and once for each encoded metadata block.
1033  *
1034  * \param  encoder  An uninitialized encoder instance.
1035  * \assert
1036  *    \code encoder != NULL \endcode
1037  * \retval FLAC__StreamEncoderState
1038  *    \c FLAC__STREAM_ENCODER_OK if initialization was successful; see
1039  *    FLAC__StreamEncoderState for the meanings of other return values.
1040  */
1041 FLAC_API FLAC__StreamEncoderState FLAC__stream_encoder_init(FLAC__StreamEncoder *encoder);
1042
1043 /** Finish the encoding process.
1044  *  Flushes the encoding buffer, releases resources, resets the encoder
1045  *  settings to their defaults, and returns the encoder state to
1046  *  FLAC__STREAM_ENCODER_UNINITIALIZED.  Note that this can generate
1047  *  one or more write callbacks before returning, and will generate
1048  *  a metadata callback.
1049  *
1050  *  In the event of a prematurely-terminated encode, it is not strictly
1051  *  necessary to call this immediately before FLAC__stream_encoder_delete()
1052  *  but it is good practice to match every FLAC__stream_encoder_init()
1053  *  with a FLAC__stream_encoder_finish().
1054  *
1055  * \param  encoder  An uninitialized encoder instance.
1056  * \assert
1057  *    \code encoder != NULL \endcode
1058  */
1059 FLAC_API void FLAC__stream_encoder_finish(FLAC__StreamEncoder *encoder);
1060
1061 /** Submit data for encoding.
1062  *  This version allows you to supply the input data via an array of
1063  *  pointers, each pointer pointing to an array of \a samples samples
1064  *  representing one channel.  The samples need not be block-aligned,
1065  *  but each channel should have the same number of samples.
1066  *
1067  * \param  encoder  An initialized encoder instance in the OK state.
1068  * \param  buffer   An array of pointers to each channel's signal.
1069  * \param  samples  The number of samples in one channel.
1070  * \assert
1071  *    \code encoder != NULL \endcode
1072  *    \code FLAC__stream_encoder_get_state(encoder) == FLAC__STREAM_ENCODER_OK \endcode
1073  * \retval FLAC__bool
1074  *    \c true if successful, else \c false; in this case, check the
1075  *    encoder state with FLAC__stream_encoder_get_state() to see what
1076  *    went wrong.
1077  */
1078 FLAC_API FLAC__bool FLAC__stream_encoder_process(FLAC__StreamEncoder *encoder, const FLAC__int32 * const buffer[], unsigned samples);
1079
1080 /** Submit data for encoding.
1081  *  This version allows you to supply the input data where the channels
1082  *  are interleaved into a single array (i.e. channel0_sample0,
1083  *  channel1_sample0, ... , channelN_sample0, channel0_sample1, ...).
1084  *  The samples need not be block-aligned but they must be
1085  *  sample-aligned, i.e. the first value should be channel0_sample0
1086  *  and the last value channelN_sampleM.
1087  *
1088  * \param  encoder  An initialized encoder instance in the OK state.
1089  * \param  buffer   An array of channel-interleaved data (see above).
1090  * \param  samples  The number of samples in one channel, the same as for
1091  *                  FLAC__stream_encoder_process().  For example, if
1092  *                  encoding two channels, \c 1000 \a samples corresponds
1093  *                  to a \a buffer of 2000 values.
1094  * \assert
1095  *    \code encoder != NULL \endcode
1096  *    \code FLAC__stream_encoder_get_state(encoder) == FLAC__STREAM_ENCODER_OK \endcode
1097  * \retval FLAC__bool
1098  *    \c true if successful, else \c false; in this case, check the
1099  *    encoder state with FLAC__stream_encoder_get_state() to see what
1100  *    went wrong.
1101  */
1102 FLAC_API FLAC__bool FLAC__stream_encoder_process_interleaved(FLAC__StreamEncoder *encoder, const FLAC__int32 buffer[], unsigned samples);
1103
1104 /* \} */
1105
1106 #ifdef __cplusplus
1107 }
1108 #endif
1109
1110 #endif