1c74663799493f2b1e6123c18def94295d0afab7Kenny Root/* libFLAC - Free Lossless Audio Codec library
2c74663799493f2b1e6123c18def94295d0afab7Kenny Root * Copyright (C) 2000,2001,2002,2003,2004,2005,2006,2007  Josh Coalson
3c74663799493f2b1e6123c18def94295d0afab7Kenny Root *
4c74663799493f2b1e6123c18def94295d0afab7Kenny Root * Redistribution and use in source and binary forms, with or without
5c74663799493f2b1e6123c18def94295d0afab7Kenny Root * modification, are permitted provided that the following conditions
6c74663799493f2b1e6123c18def94295d0afab7Kenny Root * are met:
7c74663799493f2b1e6123c18def94295d0afab7Kenny Root *
8c74663799493f2b1e6123c18def94295d0afab7Kenny Root * - Redistributions of source code must retain the above copyright
9c74663799493f2b1e6123c18def94295d0afab7Kenny Root * notice, this list of conditions and the following disclaimer.
10c74663799493f2b1e6123c18def94295d0afab7Kenny Root *
11c74663799493f2b1e6123c18def94295d0afab7Kenny Root * - Redistributions in binary form must reproduce the above copyright
12c74663799493f2b1e6123c18def94295d0afab7Kenny Root * notice, this list of conditions and the following disclaimer in the
13c74663799493f2b1e6123c18def94295d0afab7Kenny Root * documentation and/or other materials provided with the distribution.
14c74663799493f2b1e6123c18def94295d0afab7Kenny Root *
15c74663799493f2b1e6123c18def94295d0afab7Kenny Root * - Neither the name of the Xiph.org Foundation nor the names of its
16c74663799493f2b1e6123c18def94295d0afab7Kenny Root * contributors may be used to endorse or promote products derived from
17c74663799493f2b1e6123c18def94295d0afab7Kenny Root * this software without specific prior written permission.
18c74663799493f2b1e6123c18def94295d0afab7Kenny Root *
19c74663799493f2b1e6123c18def94295d0afab7Kenny Root * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
20c74663799493f2b1e6123c18def94295d0afab7Kenny Root * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
21c74663799493f2b1e6123c18def94295d0afab7Kenny Root * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
22c74663799493f2b1e6123c18def94295d0afab7Kenny Root * A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR
23c74663799493f2b1e6123c18def94295d0afab7Kenny Root * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
24c74663799493f2b1e6123c18def94295d0afab7Kenny Root * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
25c74663799493f2b1e6123c18def94295d0afab7Kenny Root * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
26c74663799493f2b1e6123c18def94295d0afab7Kenny Root * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
27c74663799493f2b1e6123c18def94295d0afab7Kenny Root * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
28c74663799493f2b1e6123c18def94295d0afab7Kenny Root * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
29c74663799493f2b1e6123c18def94295d0afab7Kenny Root * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30c74663799493f2b1e6123c18def94295d0afab7Kenny Root */
31c74663799493f2b1e6123c18def94295d0afab7Kenny Root
32c74663799493f2b1e6123c18def94295d0afab7Kenny Root#ifndef FLAC__STREAM_ENCODER_H
33c74663799493f2b1e6123c18def94295d0afab7Kenny Root#define FLAC__STREAM_ENCODER_H
34c74663799493f2b1e6123c18def94295d0afab7Kenny Root
35c74663799493f2b1e6123c18def94295d0afab7Kenny Root#include <stdio.h> /* for FILE */
36c74663799493f2b1e6123c18def94295d0afab7Kenny Root#include "export.h"
37c74663799493f2b1e6123c18def94295d0afab7Kenny Root#include "format.h"
38c74663799493f2b1e6123c18def94295d0afab7Kenny Root#include "stream_decoder.h"
39c74663799493f2b1e6123c18def94295d0afab7Kenny Root
40c74663799493f2b1e6123c18def94295d0afab7Kenny Root#ifdef __cplusplus
41c74663799493f2b1e6123c18def94295d0afab7Kenny Rootextern "C" {
42c74663799493f2b1e6123c18def94295d0afab7Kenny Root#endif
43c74663799493f2b1e6123c18def94295d0afab7Kenny Root
44c74663799493f2b1e6123c18def94295d0afab7Kenny Root
45c74663799493f2b1e6123c18def94295d0afab7Kenny Root/** \file include/FLAC/stream_encoder.h
46c74663799493f2b1e6123c18def94295d0afab7Kenny Root *
47c74663799493f2b1e6123c18def94295d0afab7Kenny Root *  \brief
48c74663799493f2b1e6123c18def94295d0afab7Kenny Root *  This module contains the functions which implement the stream
49c74663799493f2b1e6123c18def94295d0afab7Kenny Root *  encoder.
50c74663799493f2b1e6123c18def94295d0afab7Kenny Root *
51c74663799493f2b1e6123c18def94295d0afab7Kenny Root *  See the detailed documentation in the
52c74663799493f2b1e6123c18def94295d0afab7Kenny Root *  \link flac_stream_encoder stream encoder \endlink module.
53c74663799493f2b1e6123c18def94295d0afab7Kenny Root */
54c74663799493f2b1e6123c18def94295d0afab7Kenny Root
55c74663799493f2b1e6123c18def94295d0afab7Kenny Root/** \defgroup flac_encoder FLAC/ \*_encoder.h: encoder interfaces
56c74663799493f2b1e6123c18def94295d0afab7Kenny Root *  \ingroup flac
57c74663799493f2b1e6123c18def94295d0afab7Kenny Root *
58c74663799493f2b1e6123c18def94295d0afab7Kenny Root *  \brief
59c74663799493f2b1e6123c18def94295d0afab7Kenny Root *  This module describes the encoder layers provided by libFLAC.
60c74663799493f2b1e6123c18def94295d0afab7Kenny Root *
61c74663799493f2b1e6123c18def94295d0afab7Kenny Root * The stream encoder can be used to encode complete streams either to the
62c74663799493f2b1e6123c18def94295d0afab7Kenny Root * client via callbacks, or directly to a file, depending on how it is
63c74663799493f2b1e6123c18def94295d0afab7Kenny Root * initialized.  When encoding via callbacks, the client provides a write
64c74663799493f2b1e6123c18def94295d0afab7Kenny Root * callback which will be called whenever FLAC data is ready to be written.
65c74663799493f2b1e6123c18def94295d0afab7Kenny Root * If the client also supplies a seek callback, the encoder will also
66c74663799493f2b1e6123c18def94295d0afab7Kenny Root * automatically handle the writing back of metadata discovered while
67c74663799493f2b1e6123c18def94295d0afab7Kenny Root * encoding, like stream info, seek points offsets, etc.  When encoding to
68c74663799493f2b1e6123c18def94295d0afab7Kenny Root * a file, the client needs only supply a filename or open \c FILE* and an
69c74663799493f2b1e6123c18def94295d0afab7Kenny Root * optional progress callback for periodic notification of progress; the
70c74663799493f2b1e6123c18def94295d0afab7Kenny Root * write and seek callbacks are supplied internally.  For more info see the
71c74663799493f2b1e6123c18def94295d0afab7Kenny Root * \link flac_stream_encoder stream encoder \endlink module.
72c74663799493f2b1e6123c18def94295d0afab7Kenny Root */
73c74663799493f2b1e6123c18def94295d0afab7Kenny Root
74c74663799493f2b1e6123c18def94295d0afab7Kenny Root/** \defgroup flac_stream_encoder FLAC/stream_encoder.h: stream encoder interface
75c74663799493f2b1e6123c18def94295d0afab7Kenny Root *  \ingroup flac_encoder
76c74663799493f2b1e6123c18def94295d0afab7Kenny Root *
77c74663799493f2b1e6123c18def94295d0afab7Kenny Root *  \brief
78c74663799493f2b1e6123c18def94295d0afab7Kenny Root *  This module contains the functions which implement the stream
79c74663799493f2b1e6123c18def94295d0afab7Kenny Root *  encoder.
80c74663799493f2b1e6123c18def94295d0afab7Kenny Root *
81c74663799493f2b1e6123c18def94295d0afab7Kenny Root * The stream encoder can encode to native FLAC, and optionally Ogg FLAC
82c74663799493f2b1e6123c18def94295d0afab7Kenny Root * (check FLAC_API_SUPPORTS_OGG_FLAC) streams and files.
83c74663799493f2b1e6123c18def94295d0afab7Kenny Root *
84c74663799493f2b1e6123c18def94295d0afab7Kenny Root * The basic usage of this encoder is as follows:
85c74663799493f2b1e6123c18def94295d0afab7Kenny Root * - The program creates an instance of an encoder using
86c74663799493f2b1e6123c18def94295d0afab7Kenny Root *   FLAC__stream_encoder_new().
87c74663799493f2b1e6123c18def94295d0afab7Kenny Root * - The program overrides the default settings using
88c74663799493f2b1e6123c18def94295d0afab7Kenny Root *   FLAC__stream_encoder_set_*() functions.  At a minimum, the following
89c74663799493f2b1e6123c18def94295d0afab7Kenny Root *   functions should be called:
90c74663799493f2b1e6123c18def94295d0afab7Kenny Root *   - FLAC__stream_encoder_set_channels()
91c74663799493f2b1e6123c18def94295d0afab7Kenny Root *   - FLAC__stream_encoder_set_bits_per_sample()
92c74663799493f2b1e6123c18def94295d0afab7Kenny Root *   - FLAC__stream_encoder_set_sample_rate()
93c74663799493f2b1e6123c18def94295d0afab7Kenny Root *   - FLAC__stream_encoder_set_ogg_serial_number() (if encoding to Ogg FLAC)
94c74663799493f2b1e6123c18def94295d0afab7Kenny Root *   - FLAC__stream_encoder_set_total_samples_estimate() (if known)
95c74663799493f2b1e6123c18def94295d0afab7Kenny Root * - If the application wants to control the compression level or set its own
96c74663799493f2b1e6123c18def94295d0afab7Kenny Root *   metadata, then the following should also be called:
97c74663799493f2b1e6123c18def94295d0afab7Kenny Root *   - FLAC__stream_encoder_set_compression_level()
98c74663799493f2b1e6123c18def94295d0afab7Kenny Root *   - FLAC__stream_encoder_set_verify()
99c74663799493f2b1e6123c18def94295d0afab7Kenny Root *   - FLAC__stream_encoder_set_metadata()
100c74663799493f2b1e6123c18def94295d0afab7Kenny Root * - The rest of the set functions should only be called if the client needs
101c74663799493f2b1e6123c18def94295d0afab7Kenny Root *   exact control over how the audio is compressed; thorough understanding
102c74663799493f2b1e6123c18def94295d0afab7Kenny Root *   of the FLAC format is necessary to achieve good results.
103c74663799493f2b1e6123c18def94295d0afab7Kenny Root * - The program initializes the instance to validate the settings and
104c74663799493f2b1e6123c18def94295d0afab7Kenny Root *   prepare for encoding using
105c74663799493f2b1e6123c18def94295d0afab7Kenny Root *   - FLAC__stream_encoder_init_stream() or FLAC__stream_encoder_init_FILE()
106c74663799493f2b1e6123c18def94295d0afab7Kenny Root *     or FLAC__stream_encoder_init_file() for native FLAC
107c74663799493f2b1e6123c18def94295d0afab7Kenny Root *   - FLAC__stream_encoder_init_ogg_stream() or FLAC__stream_encoder_init_ogg_FILE()
108c74663799493f2b1e6123c18def94295d0afab7Kenny Root *     or FLAC__stream_encoder_init_ogg_file() for Ogg FLAC
109c74663799493f2b1e6123c18def94295d0afab7Kenny Root * - The program calls FLAC__stream_encoder_process() or
110c74663799493f2b1e6123c18def94295d0afab7Kenny Root *   FLAC__stream_encoder_process_interleaved() to encode data, which
111c74663799493f2b1e6123c18def94295d0afab7Kenny Root *   subsequently calls the callbacks when there is encoder data ready
112c74663799493f2b1e6123c18def94295d0afab7Kenny Root *   to be written.
113c74663799493f2b1e6123c18def94295d0afab7Kenny Root * - The program finishes the encoding with FLAC__stream_encoder_finish(),
114c74663799493f2b1e6123c18def94295d0afab7Kenny Root *   which causes the encoder to encode any data still in its input pipe,
115c74663799493f2b1e6123c18def94295d0afab7Kenny Root *   update the metadata with the final encoding statistics if output
116c74663799493f2b1e6123c18def94295d0afab7Kenny Root *   seeking is possible, and finally reset the encoder to the
117c74663799493f2b1e6123c18def94295d0afab7Kenny Root *   uninitialized state.
118c74663799493f2b1e6123c18def94295d0afab7Kenny Root * - The instance may be used again or deleted with
119c74663799493f2b1e6123c18def94295d0afab7Kenny Root *   FLAC__stream_encoder_delete().
120c74663799493f2b1e6123c18def94295d0afab7Kenny Root *
121c74663799493f2b1e6123c18def94295d0afab7Kenny Root * In more detail, the stream encoder functions similarly to the
122c74663799493f2b1e6123c18def94295d0afab7Kenny Root * \link flac_stream_decoder stream decoder \endlink, but has fewer
123c74663799493f2b1e6123c18def94295d0afab7Kenny Root * callbacks and more options.  Typically the client will create a new
124c74663799493f2b1e6123c18def94295d0afab7Kenny Root * instance by calling FLAC__stream_encoder_new(), then set the necessary
125c74663799493f2b1e6123c18def94295d0afab7Kenny Root * parameters with FLAC__stream_encoder_set_*(), and initialize it by
126c74663799493f2b1e6123c18def94295d0afab7Kenny Root * calling one of the FLAC__stream_encoder_init_*() functions.
127c74663799493f2b1e6123c18def94295d0afab7Kenny Root *
128c74663799493f2b1e6123c18def94295d0afab7Kenny Root * Unlike the decoders, the stream encoder has many options that can
129c74663799493f2b1e6123c18def94295d0afab7Kenny Root * affect the speed and compression ratio.  When setting these parameters
130c74663799493f2b1e6123c18def94295d0afab7Kenny Root * you should have some basic knowledge of the format (see the
131c74663799493f2b1e6123c18def94295d0afab7Kenny Root * <A HREF="../documentation.html#format">user-level documentation</A>
132c74663799493f2b1e6123c18def94295d0afab7Kenny Root * or the <A HREF="../format.html">formal description</A>).  The
133c74663799493f2b1e6123c18def94295d0afab7Kenny Root * FLAC__stream_encoder_set_*() functions themselves do not validate the
134c74663799493f2b1e6123c18def94295d0afab7Kenny Root * values as many are interdependent.  The FLAC__stream_encoder_init_*()
135c74663799493f2b1e6123c18def94295d0afab7Kenny Root * functions will do this, so make sure to pay attention to the state
136c74663799493f2b1e6123c18def94295d0afab7Kenny Root * returned by FLAC__stream_encoder_init_*() to make sure that it is
137c74663799493f2b1e6123c18def94295d0afab7Kenny Root * FLAC__STREAM_ENCODER_INIT_STATUS_OK.  Any parameters that are not set
138c74663799493f2b1e6123c18def94295d0afab7Kenny Root * before FLAC__stream_encoder_init_*() will take on the defaults from
139c74663799493f2b1e6123c18def94295d0afab7Kenny Root * the constructor.
140c74663799493f2b1e6123c18def94295d0afab7Kenny Root *
141c74663799493f2b1e6123c18def94295d0afab7Kenny Root * There are three initialization functions for native FLAC, one for
142c74663799493f2b1e6123c18def94295d0afab7Kenny Root * setting up the encoder to encode FLAC data to the client via
143c74663799493f2b1e6123c18def94295d0afab7Kenny Root * callbacks, and two for encoding directly to a file.
144c74663799493f2b1e6123c18def94295d0afab7Kenny Root *
145c74663799493f2b1e6123c18def94295d0afab7Kenny Root * For encoding via callbacks, use FLAC__stream_encoder_init_stream().
146c74663799493f2b1e6123c18def94295d0afab7Kenny Root * You must also supply a write callback which will be called anytime
147c74663799493f2b1e6123c18def94295d0afab7Kenny Root * there is raw encoded data to write.  If the client can seek the output
148c74663799493f2b1e6123c18def94295d0afab7Kenny Root * it is best to also supply seek and tell callbacks, as this allows the
149c74663799493f2b1e6123c18def94295d0afab7Kenny Root * encoder to go back after encoding is finished to write back
150c74663799493f2b1e6123c18def94295d0afab7Kenny Root * information that was collected while encoding, like seek point offsets,
151c74663799493f2b1e6123c18def94295d0afab7Kenny Root * frame sizes, etc.
152c74663799493f2b1e6123c18def94295d0afab7Kenny Root *
153c74663799493f2b1e6123c18def94295d0afab7Kenny Root * For encoding directly to a file, use FLAC__stream_encoder_init_FILE()
154c74663799493f2b1e6123c18def94295d0afab7Kenny Root * or FLAC__stream_encoder_init_file().  Then you must only supply a
155c74663799493f2b1e6123c18def94295d0afab7Kenny Root * filename or open \c FILE*; the encoder will handle all the callbacks
156c74663799493f2b1e6123c18def94295d0afab7Kenny Root * internally.  You may also supply a progress callback for periodic
157c74663799493f2b1e6123c18def94295d0afab7Kenny Root * notification of the encoding progress.
158c74663799493f2b1e6123c18def94295d0afab7Kenny Root *
159c74663799493f2b1e6123c18def94295d0afab7Kenny Root * There are three similarly-named init functions for encoding to Ogg
160c74663799493f2b1e6123c18def94295d0afab7Kenny Root * FLAC streams.  Check \c FLAC_API_SUPPORTS_OGG_FLAC to find out if the
161c74663799493f2b1e6123c18def94295d0afab7Kenny Root * library has been built with Ogg support.
162c74663799493f2b1e6123c18def94295d0afab7Kenny Root *
163c74663799493f2b1e6123c18def94295d0afab7Kenny Root * The call to FLAC__stream_encoder_init_*() currently will also immediately
164c74663799493f2b1e6123c18def94295d0afab7Kenny Root * call the write callback several times, once with the \c fLaC signature,
165c74663799493f2b1e6123c18def94295d0afab7Kenny Root * and once for each encoded metadata block.  Note that for Ogg FLAC
166c74663799493f2b1e6123c18def94295d0afab7Kenny Root * encoding you will usually get at least twice the number of callbacks than
167c74663799493f2b1e6123c18def94295d0afab7Kenny Root * with native FLAC, one for the Ogg page header and one for the page body.
168c74663799493f2b1e6123c18def94295d0afab7Kenny Root *
169c74663799493f2b1e6123c18def94295d0afab7Kenny Root * After initializing the instance, the client may feed audio data to the
170c74663799493f2b1e6123c18def94295d0afab7Kenny Root * encoder in one of two ways:
171c74663799493f2b1e6123c18def94295d0afab7Kenny Root *
172c74663799493f2b1e6123c18def94295d0afab7Kenny Root * - Channel separate, through FLAC__stream_encoder_process() - The client
173c74663799493f2b1e6123c18def94295d0afab7Kenny Root *   will pass an array of pointers to buffers, one for each channel, to
174c74663799493f2b1e6123c18def94295d0afab7Kenny Root *   the encoder, each of the same length.  The samples need not be
175c74663799493f2b1e6123c18def94295d0afab7Kenny Root *   block-aligned, but each channel should have the same number of samples.
176c74663799493f2b1e6123c18def94295d0afab7Kenny Root * - Channel interleaved, through
177c74663799493f2b1e6123c18def94295d0afab7Kenny Root *   FLAC__stream_encoder_process_interleaved() - The client will pass a single
178c74663799493f2b1e6123c18def94295d0afab7Kenny Root *   pointer to data that is channel-interleaved (i.e. channel0_sample0,
179c74663799493f2b1e6123c18def94295d0afab7Kenny Root *   channel1_sample0, ... , channelN_sample0, channel0_sample1, ...).
180c74663799493f2b1e6123c18def94295d0afab7Kenny Root *   Again, the samples need not be block-aligned but they must be
181c74663799493f2b1e6123c18def94295d0afab7Kenny Root *   sample-aligned, i.e. the first value should be channel0_sample0 and
182c74663799493f2b1e6123c18def94295d0afab7Kenny Root *   the last value channelN_sampleM.
183c74663799493f2b1e6123c18def94295d0afab7Kenny Root *
184c74663799493f2b1e6123c18def94295d0afab7Kenny Root * Note that for either process call, each sample in the buffers should be a
185c74663799493f2b1e6123c18def94295d0afab7Kenny Root * signed integer, right-justified to the resolution set by
186c74663799493f2b1e6123c18def94295d0afab7Kenny Root * FLAC__stream_encoder_set_bits_per_sample().  For example, if the resolution
187c74663799493f2b1e6123c18def94295d0afab7Kenny Root * is 16 bits per sample, the samples should all be in the range [-32768,32767].
188c74663799493f2b1e6123c18def94295d0afab7Kenny Root *
189c74663799493f2b1e6123c18def94295d0afab7Kenny Root * When the client is finished encoding data, it calls
190c74663799493f2b1e6123c18def94295d0afab7Kenny Root * FLAC__stream_encoder_finish(), which causes the encoder to encode any
191c74663799493f2b1e6123c18def94295d0afab7Kenny Root * data still in its input pipe, and call the metadata callback with the
192c74663799493f2b1e6123c18def94295d0afab7Kenny Root * final encoding statistics.  Then the instance may be deleted with
193c74663799493f2b1e6123c18def94295d0afab7Kenny Root * FLAC__stream_encoder_delete() or initialized again to encode another
194c74663799493f2b1e6123c18def94295d0afab7Kenny Root * stream.
195c74663799493f2b1e6123c18def94295d0afab7Kenny Root *
196c74663799493f2b1e6123c18def94295d0afab7Kenny Root * For programs that write their own metadata, but that do not know the
197c74663799493f2b1e6123c18def94295d0afab7Kenny Root * actual metadata until after encoding, it is advantageous to instruct
198c74663799493f2b1e6123c18def94295d0afab7Kenny Root * the encoder to write a PADDING block of the correct size, so that
199c74663799493f2b1e6123c18def94295d0afab7Kenny Root * instead of rewriting the whole stream after encoding, the program can
200c74663799493f2b1e6123c18def94295d0afab7Kenny Root * just overwrite the PADDING block.  If only the maximum size of the
201c74663799493f2b1e6123c18def94295d0afab7Kenny Root * metadata is known, the program can write a slightly larger padding
202c74663799493f2b1e6123c18def94295d0afab7Kenny Root * block, then split it after encoding.
203c74663799493f2b1e6123c18def94295d0afab7Kenny Root *
204c74663799493f2b1e6123c18def94295d0afab7Kenny Root * Make sure you understand how lengths are calculated.  All FLAC metadata
205c74663799493f2b1e6123c18def94295d0afab7Kenny Root * blocks have a 4 byte header which contains the type and length.  This
206c74663799493f2b1e6123c18def94295d0afab7Kenny Root * length does not include the 4 bytes of the header.  See the format page
207c74663799493f2b1e6123c18def94295d0afab7Kenny Root * for the specification of metadata blocks and their lengths.
208c74663799493f2b1e6123c18def94295d0afab7Kenny Root *
209c74663799493f2b1e6123c18def94295d0afab7Kenny Root * \note
210c74663799493f2b1e6123c18def94295d0afab7Kenny Root * If you are writing the FLAC data to a file via callbacks, make sure it
211c74663799493f2b1e6123c18def94295d0afab7Kenny Root * is open for update (e.g. mode "w+" for stdio streams).  This is because
212c74663799493f2b1e6123c18def94295d0afab7Kenny Root * after the first encoding pass, the encoder will try to seek back to the
213c74663799493f2b1e6123c18def94295d0afab7Kenny Root * beginning of the stream, to the STREAMINFO block, to write some data
214c74663799493f2b1e6123c18def94295d0afab7Kenny Root * there.  (If using FLAC__stream_encoder_init*_file() or
215c74663799493f2b1e6123c18def94295d0afab7Kenny Root * FLAC__stream_encoder_init*_FILE(), the file is managed internally.)
216c74663799493f2b1e6123c18def94295d0afab7Kenny Root *
217c74663799493f2b1e6123c18def94295d0afab7Kenny Root * \note
218c74663799493f2b1e6123c18def94295d0afab7Kenny Root * The "set" functions may only be called when the encoder is in the
219c74663799493f2b1e6123c18def94295d0afab7Kenny Root * state FLAC__STREAM_ENCODER_UNINITIALIZED, i.e. after
220c74663799493f2b1e6123c18def94295d0afab7Kenny Root * FLAC__stream_encoder_new() or FLAC__stream_encoder_finish(), but
221c74663799493f2b1e6123c18def94295d0afab7Kenny Root * before FLAC__stream_encoder_init_*().  If this is the case they will
222c74663799493f2b1e6123c18def94295d0afab7Kenny Root * return \c true, otherwise \c false.
223c74663799493f2b1e6123c18def94295d0afab7Kenny Root *
224c74663799493f2b1e6123c18def94295d0afab7Kenny Root * \note
225c74663799493f2b1e6123c18def94295d0afab7Kenny Root * FLAC__stream_encoder_finish() resets all settings to the constructor
226c74663799493f2b1e6123c18def94295d0afab7Kenny Root * defaults.
227c74663799493f2b1e6123c18def94295d0afab7Kenny Root *
228c74663799493f2b1e6123c18def94295d0afab7Kenny Root * \{
229c74663799493f2b1e6123c18def94295d0afab7Kenny Root */
230c74663799493f2b1e6123c18def94295d0afab7Kenny Root
231c74663799493f2b1e6123c18def94295d0afab7Kenny Root
232c74663799493f2b1e6123c18def94295d0afab7Kenny Root/** State values for a FLAC__StreamEncoder.
233c74663799493f2b1e6123c18def94295d0afab7Kenny Root *
234c74663799493f2b1e6123c18def94295d0afab7Kenny Root * The encoder's state can be obtained by calling FLAC__stream_encoder_get_state().
235c74663799493f2b1e6123c18def94295d0afab7Kenny Root *
236c74663799493f2b1e6123c18def94295d0afab7Kenny Root * If the encoder gets into any other state besides \c FLAC__STREAM_ENCODER_OK
237c74663799493f2b1e6123c18def94295d0afab7Kenny Root * or \c FLAC__STREAM_ENCODER_UNINITIALIZED, it becomes invalid for encoding and
238c74663799493f2b1e6123c18def94295d0afab7Kenny Root * must be deleted with FLAC__stream_encoder_delete().
239c74663799493f2b1e6123c18def94295d0afab7Kenny Root */
240c74663799493f2b1e6123c18def94295d0afab7Kenny Roottypedef enum {
241c74663799493f2b1e6123c18def94295d0afab7Kenny Root
242c74663799493f2b1e6123c18def94295d0afab7Kenny Root	FLAC__STREAM_ENCODER_OK = 0,
243c74663799493f2b1e6123c18def94295d0afab7Kenny Root	/**< The encoder is in the normal OK state and samples can be processed. */
244c74663799493f2b1e6123c18def94295d0afab7Kenny Root
245c74663799493f2b1e6123c18def94295d0afab7Kenny Root	FLAC__STREAM_ENCODER_UNINITIALIZED,
246c74663799493f2b1e6123c18def94295d0afab7Kenny Root	/**< The encoder is in the uninitialized state; one of the
247c74663799493f2b1e6123c18def94295d0afab7Kenny Root	 * FLAC__stream_encoder_init_*() functions must be called before samples
248c74663799493f2b1e6123c18def94295d0afab7Kenny Root	 * can be processed.
249c74663799493f2b1e6123c18def94295d0afab7Kenny Root	 */
250c74663799493f2b1e6123c18def94295d0afab7Kenny Root
251c74663799493f2b1e6123c18def94295d0afab7Kenny Root	FLAC__STREAM_ENCODER_OGG_ERROR,
252c74663799493f2b1e6123c18def94295d0afab7Kenny Root	/**< An error occurred in the underlying Ogg layer.  */
253c74663799493f2b1e6123c18def94295d0afab7Kenny Root
254c74663799493f2b1e6123c18def94295d0afab7Kenny Root	FLAC__STREAM_ENCODER_VERIFY_DECODER_ERROR,
255c74663799493f2b1e6123c18def94295d0afab7Kenny Root	/**< An error occurred in the underlying verify stream decoder;
256c74663799493f2b1e6123c18def94295d0afab7Kenny Root	 * check FLAC__stream_encoder_get_verify_decoder_state().
257c74663799493f2b1e6123c18def94295d0afab7Kenny Root	 */
258c74663799493f2b1e6123c18def94295d0afab7Kenny Root
259c74663799493f2b1e6123c18def94295d0afab7Kenny Root	FLAC__STREAM_ENCODER_VERIFY_MISMATCH_IN_AUDIO_DATA,
260c74663799493f2b1e6123c18def94295d0afab7Kenny Root	/**< The verify decoder detected a mismatch between the original
261c74663799493f2b1e6123c18def94295d0afab7Kenny Root	 * audio signal and the decoded audio signal.
262c74663799493f2b1e6123c18def94295d0afab7Kenny Root	 */
263c74663799493f2b1e6123c18def94295d0afab7Kenny Root
264c74663799493f2b1e6123c18def94295d0afab7Kenny Root	FLAC__STREAM_ENCODER_CLIENT_ERROR,
265c74663799493f2b1e6123c18def94295d0afab7Kenny Root	/**< One of the callbacks returned a fatal error. */
266c74663799493f2b1e6123c18def94295d0afab7Kenny Root
267c74663799493f2b1e6123c18def94295d0afab7Kenny Root	FLAC__STREAM_ENCODER_IO_ERROR,
268c74663799493f2b1e6123c18def94295d0afab7Kenny Root	/**< An I/O error occurred while opening/reading/writing a file.
269c74663799493f2b1e6123c18def94295d0afab7Kenny Root	 * Check \c errno.
270c74663799493f2b1e6123c18def94295d0afab7Kenny Root	 */
271c74663799493f2b1e6123c18def94295d0afab7Kenny Root
272c74663799493f2b1e6123c18def94295d0afab7Kenny Root	FLAC__STREAM_ENCODER_FRAMING_ERROR,
273c74663799493f2b1e6123c18def94295d0afab7Kenny Root	/**< An error occurred while writing the stream; usually, the
274c74663799493f2b1e6123c18def94295d0afab7Kenny Root	 * write_callback returned an error.
275c74663799493f2b1e6123c18def94295d0afab7Kenny Root	 */
276c74663799493f2b1e6123c18def94295d0afab7Kenny Root
277c74663799493f2b1e6123c18def94295d0afab7Kenny Root	FLAC__STREAM_ENCODER_MEMORY_ALLOCATION_ERROR
278c74663799493f2b1e6123c18def94295d0afab7Kenny Root	/**< Memory allocation failed. */
279c74663799493f2b1e6123c18def94295d0afab7Kenny Root
280c74663799493f2b1e6123c18def94295d0afab7Kenny Root} FLAC__StreamEncoderState;
281c74663799493f2b1e6123c18def94295d0afab7Kenny Root
282c74663799493f2b1e6123c18def94295d0afab7Kenny Root/** Maps a FLAC__StreamEncoderState to a C string.
283c74663799493f2b1e6123c18def94295d0afab7Kenny Root *
284c74663799493f2b1e6123c18def94295d0afab7Kenny Root *  Using a FLAC__StreamEncoderState as the index to this array
285c74663799493f2b1e6123c18def94295d0afab7Kenny Root *  will give the string equivalent.  The contents should not be modified.
286c74663799493f2b1e6123c18def94295d0afab7Kenny Root */
287c74663799493f2b1e6123c18def94295d0afab7Kenny Rootextern FLAC_API const char * const FLAC__StreamEncoderStateString[];
288c74663799493f2b1e6123c18def94295d0afab7Kenny Root
289c74663799493f2b1e6123c18def94295d0afab7Kenny Root
290c74663799493f2b1e6123c18def94295d0afab7Kenny Root/** Possible return values for the FLAC__stream_encoder_init_*() functions.
291c74663799493f2b1e6123c18def94295d0afab7Kenny Root */
292c74663799493f2b1e6123c18def94295d0afab7Kenny Roottypedef enum {
293c74663799493f2b1e6123c18def94295d0afab7Kenny Root
294c74663799493f2b1e6123c18def94295d0afab7Kenny Root	FLAC__STREAM_ENCODER_INIT_STATUS_OK = 0,
295c74663799493f2b1e6123c18def94295d0afab7Kenny Root	/**< Initialization was successful. */
296c74663799493f2b1e6123c18def94295d0afab7Kenny Root
297c74663799493f2b1e6123c18def94295d0afab7Kenny Root	FLAC__STREAM_ENCODER_INIT_STATUS_ENCODER_ERROR,
298c74663799493f2b1e6123c18def94295d0afab7Kenny Root	/**< General failure to set up encoder; call FLAC__stream_encoder_get_state() for cause. */
299c74663799493f2b1e6123c18def94295d0afab7Kenny Root
300c74663799493f2b1e6123c18def94295d0afab7Kenny Root	FLAC__STREAM_ENCODER_INIT_STATUS_UNSUPPORTED_CONTAINER,
301c74663799493f2b1e6123c18def94295d0afab7Kenny Root	/**< The library was not compiled with support for the given container
302c74663799493f2b1e6123c18def94295d0afab7Kenny Root	 * format.
303c74663799493f2b1e6123c18def94295d0afab7Kenny Root	 */
304c74663799493f2b1e6123c18def94295d0afab7Kenny Root
305c74663799493f2b1e6123c18def94295d0afab7Kenny Root	FLAC__STREAM_ENCODER_INIT_STATUS_INVALID_CALLBACKS,
306c74663799493f2b1e6123c18def94295d0afab7Kenny Root	/**< A required callback was not supplied. */
307c74663799493f2b1e6123c18def94295d0afab7Kenny Root
308c74663799493f2b1e6123c18def94295d0afab7Kenny Root	FLAC__STREAM_ENCODER_INIT_STATUS_INVALID_NUMBER_OF_CHANNELS,
309c74663799493f2b1e6123c18def94295d0afab7Kenny Root	/**< The encoder has an invalid setting for number of channels. */
310c74663799493f2b1e6123c18def94295d0afab7Kenny Root
311c74663799493f2b1e6123c18def94295d0afab7Kenny Root	FLAC__STREAM_ENCODER_INIT_STATUS_INVALID_BITS_PER_SAMPLE,
312c74663799493f2b1e6123c18def94295d0afab7Kenny Root	/**< The encoder has an invalid setting for bits-per-sample.
313c74663799493f2b1e6123c18def94295d0afab7Kenny Root	 * FLAC supports 4-32 bps but the reference encoder currently supports
314c74663799493f2b1e6123c18def94295d0afab7Kenny Root	 * only up to 24 bps.
315c74663799493f2b1e6123c18def94295d0afab7Kenny Root	 */
316c74663799493f2b1e6123c18def94295d0afab7Kenny Root
317c74663799493f2b1e6123c18def94295d0afab7Kenny Root	FLAC__STREAM_ENCODER_INIT_STATUS_INVALID_SAMPLE_RATE,
318c74663799493f2b1e6123c18def94295d0afab7Kenny Root	/**< The encoder has an invalid setting for the input sample rate. */
319c74663799493f2b1e6123c18def94295d0afab7Kenny Root
320c74663799493f2b1e6123c18def94295d0afab7Kenny Root	FLAC__STREAM_ENCODER_INIT_STATUS_INVALID_BLOCK_SIZE,
321c74663799493f2b1e6123c18def94295d0afab7Kenny Root	/**< The encoder has an invalid setting for the block size. */
322c74663799493f2b1e6123c18def94295d0afab7Kenny Root
323c74663799493f2b1e6123c18def94295d0afab7Kenny Root	FLAC__STREAM_ENCODER_INIT_STATUS_INVALID_MAX_LPC_ORDER,
324c74663799493f2b1e6123c18def94295d0afab7Kenny Root	/**< The encoder has an invalid setting for the maximum LPC order. */
325c74663799493f2b1e6123c18def94295d0afab7Kenny Root
326c74663799493f2b1e6123c18def94295d0afab7Kenny Root	FLAC__STREAM_ENCODER_INIT_STATUS_INVALID_QLP_COEFF_PRECISION,
327c74663799493f2b1e6123c18def94295d0afab7Kenny Root	/**< The encoder has an invalid setting for the precision of the quantized linear predictor coefficients. */
328c74663799493f2b1e6123c18def94295d0afab7Kenny Root
329c74663799493f2b1e6123c18def94295d0afab7Kenny Root	FLAC__STREAM_ENCODER_INIT_STATUS_BLOCK_SIZE_TOO_SMALL_FOR_LPC_ORDER,
330c74663799493f2b1e6123c18def94295d0afab7Kenny Root	/**< The specified block size is less than the maximum LPC order. */
331c74663799493f2b1e6123c18def94295d0afab7Kenny Root
332c74663799493f2b1e6123c18def94295d0afab7Kenny Root	FLAC__STREAM_ENCODER_INIT_STATUS_NOT_STREAMABLE,
333c74663799493f2b1e6123c18def94295d0afab7Kenny Root	/**< The encoder is bound to the <A HREF="../format.html#subset">Subset</A> but other settings violate it. */
334c74663799493f2b1e6123c18def94295d0afab7Kenny Root
335c74663799493f2b1e6123c18def94295d0afab7Kenny Root	FLAC__STREAM_ENCODER_INIT_STATUS_INVALID_METADATA,
336c74663799493f2b1e6123c18def94295d0afab7Kenny Root	/**< The metadata input to the encoder is invalid, in one of the following ways:
337c74663799493f2b1e6123c18def94295d0afab7Kenny Root	 * - FLAC__stream_encoder_set_metadata() was called with a null pointer but a block count > 0
338c74663799493f2b1e6123c18def94295d0afab7Kenny Root	 * - One of the metadata blocks contains an undefined type
339c74663799493f2b1e6123c18def94295d0afab7Kenny Root	 * - It contains an illegal CUESHEET as checked by FLAC__format_cuesheet_is_legal()
340c74663799493f2b1e6123c18def94295d0afab7Kenny Root	 * - It contains an illegal SEEKTABLE as checked by FLAC__format_seektable_is_legal()
341c74663799493f2b1e6123c18def94295d0afab7Kenny Root	 * - It contains more than one SEEKTABLE block or more than one VORBIS_COMMENT block
342c74663799493f2b1e6123c18def94295d0afab7Kenny Root	 */
343c74663799493f2b1e6123c18def94295d0afab7Kenny Root
344c74663799493f2b1e6123c18def94295d0afab7Kenny Root	FLAC__STREAM_ENCODER_INIT_STATUS_ALREADY_INITIALIZED
345c74663799493f2b1e6123c18def94295d0afab7Kenny Root	/**< FLAC__stream_encoder_init_*() was called when the encoder was
346c74663799493f2b1e6123c18def94295d0afab7Kenny Root	 * already initialized, usually because
347c74663799493f2b1e6123c18def94295d0afab7Kenny Root	 * FLAC__stream_encoder_finish() was not called.
348c74663799493f2b1e6123c18def94295d0afab7Kenny Root	 */
349c74663799493f2b1e6123c18def94295d0afab7Kenny Root
350c74663799493f2b1e6123c18def94295d0afab7Kenny Root} FLAC__StreamEncoderInitStatus;
351c74663799493f2b1e6123c18def94295d0afab7Kenny Root
352c74663799493f2b1e6123c18def94295d0afab7Kenny Root/** Maps a FLAC__StreamEncoderInitStatus to a C string.
353c74663799493f2b1e6123c18def94295d0afab7Kenny Root *
354c74663799493f2b1e6123c18def94295d0afab7Kenny Root *  Using a FLAC__StreamEncoderInitStatus as the index to this array
355c74663799493f2b1e6123c18def94295d0afab7Kenny Root *  will give the string equivalent.  The contents should not be modified.
356c74663799493f2b1e6123c18def94295d0afab7Kenny Root */
357c74663799493f2b1e6123c18def94295d0afab7Kenny Rootextern FLAC_API const char * const FLAC__StreamEncoderInitStatusString[];
358c74663799493f2b1e6123c18def94295d0afab7Kenny Root
359c74663799493f2b1e6123c18def94295d0afab7Kenny Root
360c74663799493f2b1e6123c18def94295d0afab7Kenny Root/** Return values for the FLAC__StreamEncoder read callback.
361c74663799493f2b1e6123c18def94295d0afab7Kenny Root */
362c74663799493f2b1e6123c18def94295d0afab7Kenny Roottypedef enum {
363c74663799493f2b1e6123c18def94295d0afab7Kenny Root
364c74663799493f2b1e6123c18def94295d0afab7Kenny Root	FLAC__STREAM_ENCODER_READ_STATUS_CONTINUE,
365c74663799493f2b1e6123c18def94295d0afab7Kenny Root	/**< The read was OK and decoding can continue. */
366c74663799493f2b1e6123c18def94295d0afab7Kenny Root
367c74663799493f2b1e6123c18def94295d0afab7Kenny Root	FLAC__STREAM_ENCODER_READ_STATUS_END_OF_STREAM,
368c74663799493f2b1e6123c18def94295d0afab7Kenny Root	/**< The read was attempted at the end of the stream. */
369c74663799493f2b1e6123c18def94295d0afab7Kenny Root
370c74663799493f2b1e6123c18def94295d0afab7Kenny Root	FLAC__STREAM_ENCODER_READ_STATUS_ABORT,
371c74663799493f2b1e6123c18def94295d0afab7Kenny Root	/**< An unrecoverable error occurred. */
372c74663799493f2b1e6123c18def94295d0afab7Kenny Root
373c74663799493f2b1e6123c18def94295d0afab7Kenny Root	FLAC__STREAM_ENCODER_READ_STATUS_UNSUPPORTED
374c74663799493f2b1e6123c18def94295d0afab7Kenny Root	/**< Client does not support reading back from the output. */
375c74663799493f2b1e6123c18def94295d0afab7Kenny Root
376c74663799493f2b1e6123c18def94295d0afab7Kenny Root} FLAC__StreamEncoderReadStatus;
377c74663799493f2b1e6123c18def94295d0afab7Kenny Root
378c74663799493f2b1e6123c18def94295d0afab7Kenny Root/** Maps a FLAC__StreamEncoderReadStatus to a C string.
379c74663799493f2b1e6123c18def94295d0afab7Kenny Root *
380c74663799493f2b1e6123c18def94295d0afab7Kenny Root *  Using a FLAC__StreamEncoderReadStatus as the index to this array
381c74663799493f2b1e6123c18def94295d0afab7Kenny Root *  will give the string equivalent.  The contents should not be modified.
382c74663799493f2b1e6123c18def94295d0afab7Kenny Root */
383c74663799493f2b1e6123c18def94295d0afab7Kenny Rootextern FLAC_API const char * const FLAC__StreamEncoderReadStatusString[];
384c74663799493f2b1e6123c18def94295d0afab7Kenny Root
385c74663799493f2b1e6123c18def94295d0afab7Kenny Root
386c74663799493f2b1e6123c18def94295d0afab7Kenny Root/** Return values for the FLAC__StreamEncoder write callback.
387c74663799493f2b1e6123c18def94295d0afab7Kenny Root */
388c74663799493f2b1e6123c18def94295d0afab7Kenny Roottypedef enum {
389c74663799493f2b1e6123c18def94295d0afab7Kenny Root
390c74663799493f2b1e6123c18def94295d0afab7Kenny Root	FLAC__STREAM_ENCODER_WRITE_STATUS_OK = 0,
391c74663799493f2b1e6123c18def94295d0afab7Kenny Root	/**< The write was OK and encoding can continue. */
392c74663799493f2b1e6123c18def94295d0afab7Kenny Root
393c74663799493f2b1e6123c18def94295d0afab7Kenny Root	FLAC__STREAM_ENCODER_WRITE_STATUS_FATAL_ERROR
394c74663799493f2b1e6123c18def94295d0afab7Kenny Root	/**< An unrecoverable error occurred.  The encoder will return from the process call. */
395c74663799493f2b1e6123c18def94295d0afab7Kenny Root
396c74663799493f2b1e6123c18def94295d0afab7Kenny Root} FLAC__StreamEncoderWriteStatus;
397c74663799493f2b1e6123c18def94295d0afab7Kenny Root
398c74663799493f2b1e6123c18def94295d0afab7Kenny Root/** Maps a FLAC__StreamEncoderWriteStatus to a C string.
399c74663799493f2b1e6123c18def94295d0afab7Kenny Root *
400c74663799493f2b1e6123c18def94295d0afab7Kenny Root *  Using a FLAC__StreamEncoderWriteStatus as the index to this array
401c74663799493f2b1e6123c18def94295d0afab7Kenny Root *  will give the string equivalent.  The contents should not be modified.
402c74663799493f2b1e6123c18def94295d0afab7Kenny Root */
403c74663799493f2b1e6123c18def94295d0afab7Kenny Rootextern FLAC_API const char * const FLAC__StreamEncoderWriteStatusString[];
404c74663799493f2b1e6123c18def94295d0afab7Kenny Root
405c74663799493f2b1e6123c18def94295d0afab7Kenny Root
406c74663799493f2b1e6123c18def94295d0afab7Kenny Root/** Return values for the FLAC__StreamEncoder seek callback.
407c74663799493f2b1e6123c18def94295d0afab7Kenny Root */
408c74663799493f2b1e6123c18def94295d0afab7Kenny Roottypedef enum {
409c74663799493f2b1e6123c18def94295d0afab7Kenny Root
410c74663799493f2b1e6123c18def94295d0afab7Kenny Root	FLAC__STREAM_ENCODER_SEEK_STATUS_OK,
411c74663799493f2b1e6123c18def94295d0afab7Kenny Root	/**< The seek was OK and encoding can continue. */
412c74663799493f2b1e6123c18def94295d0afab7Kenny Root
413c74663799493f2b1e6123c18def94295d0afab7Kenny Root	FLAC__STREAM_ENCODER_SEEK_STATUS_ERROR,
414c74663799493f2b1e6123c18def94295d0afab7Kenny Root	/**< An unrecoverable error occurred. */
415c74663799493f2b1e6123c18def94295d0afab7Kenny Root
416c74663799493f2b1e6123c18def94295d0afab7Kenny Root	FLAC__STREAM_ENCODER_SEEK_STATUS_UNSUPPORTED
417c74663799493f2b1e6123c18def94295d0afab7Kenny Root	/**< Client does not support seeking. */
418c74663799493f2b1e6123c18def94295d0afab7Kenny Root
419c74663799493f2b1e6123c18def94295d0afab7Kenny Root} FLAC__StreamEncoderSeekStatus;
420c74663799493f2b1e6123c18def94295d0afab7Kenny Root
421c74663799493f2b1e6123c18def94295d0afab7Kenny Root/** Maps a FLAC__StreamEncoderSeekStatus to a C string.
422c74663799493f2b1e6123c18def94295d0afab7Kenny Root *
423c74663799493f2b1e6123c18def94295d0afab7Kenny Root *  Using a FLAC__StreamEncoderSeekStatus as the index to this array
424c74663799493f2b1e6123c18def94295d0afab7Kenny Root *  will give the string equivalent.  The contents should not be modified.
425c74663799493f2b1e6123c18def94295d0afab7Kenny Root */
426c74663799493f2b1e6123c18def94295d0afab7Kenny Rootextern FLAC_API const char * const FLAC__StreamEncoderSeekStatusString[];
427c74663799493f2b1e6123c18def94295d0afab7Kenny Root
428c74663799493f2b1e6123c18def94295d0afab7Kenny Root
429c74663799493f2b1e6123c18def94295d0afab7Kenny Root/** Return values for the FLAC__StreamEncoder tell callback.
430c74663799493f2b1e6123c18def94295d0afab7Kenny Root */
431c74663799493f2b1e6123c18def94295d0afab7Kenny Roottypedef enum {
432c74663799493f2b1e6123c18def94295d0afab7Kenny Root
433c74663799493f2b1e6123c18def94295d0afab7Kenny Root	FLAC__STREAM_ENCODER_TELL_STATUS_OK,
434c74663799493f2b1e6123c18def94295d0afab7Kenny Root	/**< The tell was OK and encoding can continue. */
435c74663799493f2b1e6123c18def94295d0afab7Kenny Root
436c74663799493f2b1e6123c18def94295d0afab7Kenny Root	FLAC__STREAM_ENCODER_TELL_STATUS_ERROR,
437c74663799493f2b1e6123c18def94295d0afab7Kenny Root	/**< An unrecoverable error occurred. */
438c74663799493f2b1e6123c18def94295d0afab7Kenny Root
439c74663799493f2b1e6123c18def94295d0afab7Kenny Root	FLAC__STREAM_ENCODER_TELL_STATUS_UNSUPPORTED
440c74663799493f2b1e6123c18def94295d0afab7Kenny Root	/**< Client does not support seeking. */
441c74663799493f2b1e6123c18def94295d0afab7Kenny Root
442c74663799493f2b1e6123c18def94295d0afab7Kenny Root} FLAC__StreamEncoderTellStatus;
443c74663799493f2b1e6123c18def94295d0afab7Kenny Root
444c74663799493f2b1e6123c18def94295d0afab7Kenny Root/** Maps a FLAC__StreamEncoderTellStatus to a C string.
445c74663799493f2b1e6123c18def94295d0afab7Kenny Root *
446c74663799493f2b1e6123c18def94295d0afab7Kenny Root *  Using a FLAC__StreamEncoderTellStatus as the index to this array
447c74663799493f2b1e6123c18def94295d0afab7Kenny Root *  will give the string equivalent.  The contents should not be modified.
448c74663799493f2b1e6123c18def94295d0afab7Kenny Root */
449c74663799493f2b1e6123c18def94295d0afab7Kenny Rootextern FLAC_API const char * const FLAC__StreamEncoderTellStatusString[];
450c74663799493f2b1e6123c18def94295d0afab7Kenny Root
451c74663799493f2b1e6123c18def94295d0afab7Kenny Root
452c74663799493f2b1e6123c18def94295d0afab7Kenny Root/***********************************************************************
453c74663799493f2b1e6123c18def94295d0afab7Kenny Root *
454c74663799493f2b1e6123c18def94295d0afab7Kenny Root * class FLAC__StreamEncoder
455c74663799493f2b1e6123c18def94295d0afab7Kenny Root *
456c74663799493f2b1e6123c18def94295d0afab7Kenny Root ***********************************************************************/
457c74663799493f2b1e6123c18def94295d0afab7Kenny Root
458c74663799493f2b1e6123c18def94295d0afab7Kenny Rootstruct FLAC__StreamEncoderProtected;
459c74663799493f2b1e6123c18def94295d0afab7Kenny Rootstruct FLAC__StreamEncoderPrivate;
460c74663799493f2b1e6123c18def94295d0afab7Kenny Root/** The opaque structure definition for the stream encoder type.
461c74663799493f2b1e6123c18def94295d0afab7Kenny Root *  See the \link flac_stream_encoder stream encoder module \endlink
462c74663799493f2b1e6123c18def94295d0afab7Kenny Root *  for a detailed description.
463c74663799493f2b1e6123c18def94295d0afab7Kenny Root */
464c74663799493f2b1e6123c18def94295d0afab7Kenny Roottypedef struct {
465c74663799493f2b1e6123c18def94295d0afab7Kenny Root	struct FLAC__StreamEncoderProtected *protected_; /* avoid the C++ keyword 'protected' */
466c74663799493f2b1e6123c18def94295d0afab7Kenny Root	struct FLAC__StreamEncoderPrivate *private_; /* avoid the C++ keyword 'private' */
467c74663799493f2b1e6123c18def94295d0afab7Kenny Root} FLAC__StreamEncoder;
468c74663799493f2b1e6123c18def94295d0afab7Kenny Root
469c74663799493f2b1e6123c18def94295d0afab7Kenny Root/** Signature for the read callback.
470c74663799493f2b1e6123c18def94295d0afab7Kenny Root *
471c74663799493f2b1e6123c18def94295d0afab7Kenny Root *  A function pointer matching this signature must be passed to
472c74663799493f2b1e6123c18def94295d0afab7Kenny Root *  FLAC__stream_encoder_init_ogg_stream() if seeking is supported.
473c74663799493f2b1e6123c18def94295d0afab7Kenny Root *  The supplied function will be called when the encoder needs to read back
474c74663799493f2b1e6123c18def94295d0afab7Kenny Root *  encoded data.  This happens during the metadata callback, when the encoder
475c74663799493f2b1e6123c18def94295d0afab7Kenny Root *  has to read, modify, and rewrite the metadata (e.g. seekpoints) gathered
476c74663799493f2b1e6123c18def94295d0afab7Kenny Root *  while encoding.  The address of the buffer to be filled is supplied, along
477c74663799493f2b1e6123c18def94295d0afab7Kenny Root *  with the number of bytes the buffer can hold.  The callback may choose to
478c74663799493f2b1e6123c18def94295d0afab7Kenny Root *  supply less data and modify the byte count but must be careful not to
479c74663799493f2b1e6123c18def94295d0afab7Kenny Root *  overflow the buffer.  The callback then returns a status code chosen from
480c74663799493f2b1e6123c18def94295d0afab7Kenny Root *  FLAC__StreamEncoderReadStatus.
481c74663799493f2b1e6123c18def94295d0afab7Kenny Root *
482c74663799493f2b1e6123c18def94295d0afab7Kenny Root * Here is an example of a read callback for stdio streams:
483c74663799493f2b1e6123c18def94295d0afab7Kenny Root * \code
484c74663799493f2b1e6123c18def94295d0afab7Kenny Root * FLAC__StreamEncoderReadStatus read_cb(const FLAC__StreamEncoder *encoder, FLAC__byte buffer[], size_t *bytes, void *client_data)
485c74663799493f2b1e6123c18def94295d0afab7Kenny Root * {
486c74663799493f2b1e6123c18def94295d0afab7Kenny Root *   FILE *file = ((MyClientData*)client_data)->file;
487c74663799493f2b1e6123c18def94295d0afab7Kenny Root *   if(*bytes > 0) {
488c74663799493f2b1e6123c18def94295d0afab7Kenny Root *     *bytes = fread(buffer, sizeof(FLAC__byte), *bytes, file);
489c74663799493f2b1e6123c18def94295d0afab7Kenny Root *     if(ferror(file))
490c74663799493f2b1e6123c18def94295d0afab7Kenny Root *       return FLAC__STREAM_ENCODER_READ_STATUS_ABORT;
491c74663799493f2b1e6123c18def94295d0afab7Kenny Root *     else if(*bytes == 0)
492c74663799493f2b1e6123c18def94295d0afab7Kenny Root *       return FLAC__STREAM_ENCODER_READ_STATUS_END_OF_STREAM;
493c74663799493f2b1e6123c18def94295d0afab7Kenny Root *     else
494c74663799493f2b1e6123c18def94295d0afab7Kenny Root *       return FLAC__STREAM_ENCODER_READ_STATUS_CONTINUE;
495c74663799493f2b1e6123c18def94295d0afab7Kenny Root *   }
496c74663799493f2b1e6123c18def94295d0afab7Kenny Root *   else
497c74663799493f2b1e6123c18def94295d0afab7Kenny Root *     return FLAC__STREAM_ENCODER_READ_STATUS_ABORT;
498c74663799493f2b1e6123c18def94295d0afab7Kenny Root * }
499c74663799493f2b1e6123c18def94295d0afab7Kenny Root * \endcode
500c74663799493f2b1e6123c18def94295d0afab7Kenny Root *
501c74663799493f2b1e6123c18def94295d0afab7Kenny Root * \note In general, FLAC__StreamEncoder functions which change the
502c74663799493f2b1e6123c18def94295d0afab7Kenny Root * state should not be called on the \a encoder while in the callback.
503c74663799493f2b1e6123c18def94295d0afab7Kenny Root *
504c74663799493f2b1e6123c18def94295d0afab7Kenny Root * \param  encoder  The encoder instance calling the callback.
505c74663799493f2b1e6123c18def94295d0afab7Kenny Root * \param  buffer   A pointer to a location for the callee to store
506c74663799493f2b1e6123c18def94295d0afab7Kenny Root *                  data to be encoded.
507c74663799493f2b1e6123c18def94295d0afab7Kenny Root * \param  bytes    A pointer to the size of the buffer.  On entry
508c74663799493f2b1e6123c18def94295d0afab7Kenny Root *                  to the callback, it contains the maximum number
509c74663799493f2b1e6123c18def94295d0afab7Kenny Root *                  of bytes that may be stored in \a buffer.  The
510c74663799493f2b1e6123c18def94295d0afab7Kenny Root *                  callee must set it to the actual number of bytes
511c74663799493f2b1e6123c18def94295d0afab7Kenny Root *                  stored (0 in case of error or end-of-stream) before
512c74663799493f2b1e6123c18def94295d0afab7Kenny Root *                  returning.
513c74663799493f2b1e6123c18def94295d0afab7Kenny Root * \param  client_data  The callee's client data set through
514c74663799493f2b1e6123c18def94295d0afab7Kenny Root *                      FLAC__stream_encoder_set_client_data().
515c74663799493f2b1e6123c18def94295d0afab7Kenny Root * \retval FLAC__StreamEncoderReadStatus
516c74663799493f2b1e6123c18def94295d0afab7Kenny Root *    The callee's return status.
517c74663799493f2b1e6123c18def94295d0afab7Kenny Root */
518c74663799493f2b1e6123c18def94295d0afab7Kenny Roottypedef FLAC__StreamEncoderReadStatus (*FLAC__StreamEncoderReadCallback)(const FLAC__StreamEncoder *encoder, FLAC__byte buffer[], size_t *bytes, void *client_data);
519c74663799493f2b1e6123c18def94295d0afab7Kenny Root
520c74663799493f2b1e6123c18def94295d0afab7Kenny Root/** Signature for the write callback.
521c74663799493f2b1e6123c18def94295d0afab7Kenny Root *
522c74663799493f2b1e6123c18def94295d0afab7Kenny Root *  A function pointer matching this signature must be passed to
523c74663799493f2b1e6123c18def94295d0afab7Kenny Root *  FLAC__stream_encoder_init*_stream().  The supplied function will be called
524c74663799493f2b1e6123c18def94295d0afab7Kenny Root *  by the encoder anytime there is raw encoded data ready to write.  It may
525c74663799493f2b1e6123c18def94295d0afab7Kenny Root *  include metadata mixed with encoded audio frames and the data is not
526c74663799493f2b1e6123c18def94295d0afab7Kenny Root *  guaranteed to be aligned on frame or metadata block boundaries.
527c74663799493f2b1e6123c18def94295d0afab7Kenny Root *
528c74663799493f2b1e6123c18def94295d0afab7Kenny Root *  The only duty of the callback is to write out the \a bytes worth of data
529c74663799493f2b1e6123c18def94295d0afab7Kenny Root *  in \a buffer to the current position in the output stream.  The arguments
530c74663799493f2b1e6123c18def94295d0afab7Kenny Root *  \a samples and \a current_frame are purely informational.  If \a samples
531c74663799493f2b1e6123c18def94295d0afab7Kenny Root *  is greater than \c 0, then \a current_frame will hold the current frame
532c74663799493f2b1e6123c18def94295d0afab7Kenny Root *  number that is being written; otherwise it indicates that the write
533c74663799493f2b1e6123c18def94295d0afab7Kenny Root *  callback is being called to write metadata.
534c74663799493f2b1e6123c18def94295d0afab7Kenny Root *
535c74663799493f2b1e6123c18def94295d0afab7Kenny Root * \note
536c74663799493f2b1e6123c18def94295d0afab7Kenny Root * Unlike when writing to native FLAC, when writing to Ogg FLAC the
537c74663799493f2b1e6123c18def94295d0afab7Kenny Root * write callback will be called twice when writing each audio
538c74663799493f2b1e6123c18def94295d0afab7Kenny Root * frame; once for the page header, and once for the page body.
539c74663799493f2b1e6123c18def94295d0afab7Kenny Root * When writing the page header, the \a samples argument to the
540c74663799493f2b1e6123c18def94295d0afab7Kenny Root * write callback will be \c 0.
541c74663799493f2b1e6123c18def94295d0afab7Kenny Root *
542c74663799493f2b1e6123c18def94295d0afab7Kenny Root * \note In general, FLAC__StreamEncoder functions which change the
543c74663799493f2b1e6123c18def94295d0afab7Kenny Root * state should not be called on the \a encoder while in the callback.
544c74663799493f2b1e6123c18def94295d0afab7Kenny Root *
545c74663799493f2b1e6123c18def94295d0afab7Kenny Root * \param  encoder  The encoder instance calling the callback.
546c74663799493f2b1e6123c18def94295d0afab7Kenny Root * \param  buffer   An array of encoded data of length \a bytes.
547c74663799493f2b1e6123c18def94295d0afab7Kenny Root * \param  bytes    The byte length of \a buffer.
548c74663799493f2b1e6123c18def94295d0afab7Kenny Root * \param  samples  The number of samples encoded by \a buffer.
549c74663799493f2b1e6123c18def94295d0afab7Kenny Root *                  \c 0 has a special meaning; see above.
550c74663799493f2b1e6123c18def94295d0afab7Kenny Root * \param  current_frame  The number of the current frame being encoded.
551c74663799493f2b1e6123c18def94295d0afab7Kenny Root * \param  client_data  The callee's client data set through
552c74663799493f2b1e6123c18def94295d0afab7Kenny Root *                      FLAC__stream_encoder_init_*().
553c74663799493f2b1e6123c18def94295d0afab7Kenny Root * \retval FLAC__StreamEncoderWriteStatus
554c74663799493f2b1e6123c18def94295d0afab7Kenny Root *    The callee's return status.
555c74663799493f2b1e6123c18def94295d0afab7Kenny Root */
556c74663799493f2b1e6123c18def94295d0afab7Kenny Roottypedef FLAC__StreamEncoderWriteStatus (*FLAC__StreamEncoderWriteCallback)(const FLAC__StreamEncoder *encoder, const FLAC__byte buffer[], size_t bytes, unsigned samples, unsigned current_frame, void *client_data);
557c74663799493f2b1e6123c18def94295d0afab7Kenny Root
558c74663799493f2b1e6123c18def94295d0afab7Kenny Root/** Signature for the seek callback.
559c74663799493f2b1e6123c18def94295d0afab7Kenny Root *
560c74663799493f2b1e6123c18def94295d0afab7Kenny Root *  A function pointer matching this signature may be passed to
561c74663799493f2b1e6123c18def94295d0afab7Kenny Root *  FLAC__stream_encoder_init*_stream().  The supplied function will be called
562c74663799493f2b1e6123c18def94295d0afab7Kenny Root *  when the encoder needs to seek the output stream.  The encoder will pass
563c74663799493f2b1e6123c18def94295d0afab7Kenny Root *  the absolute byte offset to seek to, 0 meaning the beginning of the stream.
564c74663799493f2b1e6123c18def94295d0afab7Kenny Root *
565c74663799493f2b1e6123c18def94295d0afab7Kenny Root * Here is an example of a seek callback for stdio streams:
566c74663799493f2b1e6123c18def94295d0afab7Kenny Root * \code
567c74663799493f2b1e6123c18def94295d0afab7Kenny Root * FLAC__StreamEncoderSeekStatus seek_cb(const FLAC__StreamEncoder *encoder, FLAC__uint64 absolute_byte_offset, void *client_data)
568c74663799493f2b1e6123c18def94295d0afab7Kenny Root * {
569c74663799493f2b1e6123c18def94295d0afab7Kenny Root *   FILE *file = ((MyClientData*)client_data)->file;
570c74663799493f2b1e6123c18def94295d0afab7Kenny Root *   if(file == stdin)
571c74663799493f2b1e6123c18def94295d0afab7Kenny Root *     return FLAC__STREAM_ENCODER_SEEK_STATUS_UNSUPPORTED;
572c74663799493f2b1e6123c18def94295d0afab7Kenny Root *   else if(fseeko(file, (off_t)absolute_byte_offset, SEEK_SET) < 0)
573c74663799493f2b1e6123c18def94295d0afab7Kenny Root *     return FLAC__STREAM_ENCODER_SEEK_STATUS_ERROR;
574c74663799493f2b1e6123c18def94295d0afab7Kenny Root *   else
575c74663799493f2b1e6123c18def94295d0afab7Kenny Root *     return FLAC__STREAM_ENCODER_SEEK_STATUS_OK;
576c74663799493f2b1e6123c18def94295d0afab7Kenny Root * }
577c74663799493f2b1e6123c18def94295d0afab7Kenny Root * \endcode
578c74663799493f2b1e6123c18def94295d0afab7Kenny Root *
579c74663799493f2b1e6123c18def94295d0afab7Kenny Root * \note In general, FLAC__StreamEncoder functions which change the
580c74663799493f2b1e6123c18def94295d0afab7Kenny Root * state should not be called on the \a encoder while in the callback.
581c74663799493f2b1e6123c18def94295d0afab7Kenny Root *
582c74663799493f2b1e6123c18def94295d0afab7Kenny Root * \param  encoder  The encoder instance calling the callback.
583c74663799493f2b1e6123c18def94295d0afab7Kenny Root * \param  absolute_byte_offset  The offset from the beginning of the stream
584c74663799493f2b1e6123c18def94295d0afab7Kenny Root *                               to seek to.
585c74663799493f2b1e6123c18def94295d0afab7Kenny Root * \param  client_data  The callee's client data set through
586c74663799493f2b1e6123c18def94295d0afab7Kenny Root *                      FLAC__stream_encoder_init_*().
587c74663799493f2b1e6123c18def94295d0afab7Kenny Root * \retval FLAC__StreamEncoderSeekStatus
588c74663799493f2b1e6123c18def94295d0afab7Kenny Root *    The callee's return status.
589c74663799493f2b1e6123c18def94295d0afab7Kenny Root */
590c74663799493f2b1e6123c18def94295d0afab7Kenny Roottypedef FLAC__StreamEncoderSeekStatus (*FLAC__StreamEncoderSeekCallback)(const FLAC__StreamEncoder *encoder, FLAC__uint64 absolute_byte_offset, void *client_data);
591c74663799493f2b1e6123c18def94295d0afab7Kenny Root
592c74663799493f2b1e6123c18def94295d0afab7Kenny Root/** Signature for the tell callback.
593c74663799493f2b1e6123c18def94295d0afab7Kenny Root *
594c74663799493f2b1e6123c18def94295d0afab7Kenny Root *  A function pointer matching this signature may be passed to
595c74663799493f2b1e6123c18def94295d0afab7Kenny Root *  FLAC__stream_encoder_init*_stream().  The supplied function will be called
596c74663799493f2b1e6123c18def94295d0afab7Kenny Root *  when the encoder needs to know the current position of the output stream.
597c74663799493f2b1e6123c18def94295d0afab7Kenny Root *
598c74663799493f2b1e6123c18def94295d0afab7Kenny Root * \warning
599c74663799493f2b1e6123c18def94295d0afab7Kenny Root * The callback must return the true current byte offset of the output to
600c74663799493f2b1e6123c18def94295d0afab7Kenny Root * which the encoder is writing.  If you are buffering the output, make
601c74663799493f2b1e6123c18def94295d0afab7Kenny Root * sure and take this into account.  If you are writing directly to a
602c74663799493f2b1e6123c18def94295d0afab7Kenny Root * FILE* from your write callback, ftell() is sufficient.  If you are
603c74663799493f2b1e6123c18def94295d0afab7Kenny Root * writing directly to a file descriptor from your write callback, you
604c74663799493f2b1e6123c18def94295d0afab7Kenny Root * can use lseek(fd, SEEK_CUR, 0).  The encoder may later seek back to
605c74663799493f2b1e6123c18def94295d0afab7Kenny Root * these points to rewrite metadata after encoding.
606c74663799493f2b1e6123c18def94295d0afab7Kenny Root *
607c74663799493f2b1e6123c18def94295d0afab7Kenny Root * Here is an example of a tell callback for stdio streams:
608c74663799493f2b1e6123c18def94295d0afab7Kenny Root * \code
609c74663799493f2b1e6123c18def94295d0afab7Kenny Root * FLAC__StreamEncoderTellStatus tell_cb(const FLAC__StreamEncoder *encoder, FLAC__uint64 *absolute_byte_offset, void *client_data)
610c74663799493f2b1e6123c18def94295d0afab7Kenny Root * {
611c74663799493f2b1e6123c18def94295d0afab7Kenny Root *   FILE *file = ((MyClientData*)client_data)->file;
612c74663799493f2b1e6123c18def94295d0afab7Kenny Root *   off_t pos;
613c74663799493f2b1e6123c18def94295d0afab7Kenny Root *   if(file == stdin)
614c74663799493f2b1e6123c18def94295d0afab7Kenny Root *     return FLAC__STREAM_ENCODER_TELL_STATUS_UNSUPPORTED;
615c74663799493f2b1e6123c18def94295d0afab7Kenny Root *   else if((pos = ftello(file)) < 0)
616c74663799493f2b1e6123c18def94295d0afab7Kenny Root *     return FLAC__STREAM_ENCODER_TELL_STATUS_ERROR;
617c74663799493f2b1e6123c18def94295d0afab7Kenny Root *   else {
618c74663799493f2b1e6123c18def94295d0afab7Kenny Root *     *absolute_byte_offset = (FLAC__uint64)pos;
619c74663799493f2b1e6123c18def94295d0afab7Kenny Root *     return FLAC__STREAM_ENCODER_TELL_STATUS_OK;
620c74663799493f2b1e6123c18def94295d0afab7Kenny Root *   }
621c74663799493f2b1e6123c18def94295d0afab7Kenny Root * }
622c74663799493f2b1e6123c18def94295d0afab7Kenny Root * \endcode
623c74663799493f2b1e6123c18def94295d0afab7Kenny Root *
624c74663799493f2b1e6123c18def94295d0afab7Kenny Root * \note In general, FLAC__StreamEncoder functions which change the
625c74663799493f2b1e6123c18def94295d0afab7Kenny Root * state should not be called on the \a encoder while in the callback.
626c74663799493f2b1e6123c18def94295d0afab7Kenny Root *
627c74663799493f2b1e6123c18def94295d0afab7Kenny Root * \param  encoder  The encoder instance calling the callback.
628c74663799493f2b1e6123c18def94295d0afab7Kenny Root * \param  absolute_byte_offset  The address at which to store the current
629c74663799493f2b1e6123c18def94295d0afab7Kenny Root *                               position of the output.
630c74663799493f2b1e6123c18def94295d0afab7Kenny Root * \param  client_data  The callee's client data set through
631c74663799493f2b1e6123c18def94295d0afab7Kenny Root *                      FLAC__stream_encoder_init_*().
632c74663799493f2b1e6123c18def94295d0afab7Kenny Root * \retval FLAC__StreamEncoderTellStatus
633c74663799493f2b1e6123c18def94295d0afab7Kenny Root *    The callee's return status.
634c74663799493f2b1e6123c18def94295d0afab7Kenny Root */
635c74663799493f2b1e6123c18def94295d0afab7Kenny Roottypedef FLAC__StreamEncoderTellStatus (*FLAC__StreamEncoderTellCallback)(const FLAC__StreamEncoder *encoder, FLAC__uint64 *absolute_byte_offset, void *client_data);
636c74663799493f2b1e6123c18def94295d0afab7Kenny Root
637c74663799493f2b1e6123c18def94295d0afab7Kenny Root/** Signature for the metadata callback.
638c74663799493f2b1e6123c18def94295d0afab7Kenny Root *
639c74663799493f2b1e6123c18def94295d0afab7Kenny Root *  A function pointer matching this signature may be passed to
640c74663799493f2b1e6123c18def94295d0afab7Kenny Root *  FLAC__stream_encoder_init*_stream().  The supplied function will be called
641c74663799493f2b1e6123c18def94295d0afab7Kenny Root *  once at the end of encoding with the populated STREAMINFO structure.  This
642c74663799493f2b1e6123c18def94295d0afab7Kenny Root *  is so the client can seek back to the beginning of the file and write the
643c74663799493f2b1e6123c18def94295d0afab7Kenny Root *  STREAMINFO block with the correct statistics after encoding (like
644c74663799493f2b1e6123c18def94295d0afab7Kenny Root *  minimum/maximum frame size and total samples).
645c74663799493f2b1e6123c18def94295d0afab7Kenny Root *
646c74663799493f2b1e6123c18def94295d0afab7Kenny Root * \note In general, FLAC__StreamEncoder functions which change the
647c74663799493f2b1e6123c18def94295d0afab7Kenny Root * state should not be called on the \a encoder while in the callback.
648c74663799493f2b1e6123c18def94295d0afab7Kenny Root *
649c74663799493f2b1e6123c18def94295d0afab7Kenny Root * \param  encoder      The encoder instance calling the callback.
650c74663799493f2b1e6123c18def94295d0afab7Kenny Root * \param  metadata     The final populated STREAMINFO block.
651c74663799493f2b1e6123c18def94295d0afab7Kenny Root * \param  client_data  The callee's client data set through
652c74663799493f2b1e6123c18def94295d0afab7Kenny Root *                      FLAC__stream_encoder_init_*().
653c74663799493f2b1e6123c18def94295d0afab7Kenny Root */
654c74663799493f2b1e6123c18def94295d0afab7Kenny Roottypedef void (*FLAC__StreamEncoderMetadataCallback)(const FLAC__StreamEncoder *encoder, const FLAC__StreamMetadata *metadata, void *client_data);
655c74663799493f2b1e6123c18def94295d0afab7Kenny Root
656c74663799493f2b1e6123c18def94295d0afab7Kenny Root/** Signature for the progress callback.
657c74663799493f2b1e6123c18def94295d0afab7Kenny Root *
658c74663799493f2b1e6123c18def94295d0afab7Kenny Root *  A function pointer matching this signature may be passed to
659c74663799493f2b1e6123c18def94295d0afab7Kenny Root *  FLAC__stream_encoder_init*_file() or FLAC__stream_encoder_init*_FILE().
660c74663799493f2b1e6123c18def94295d0afab7Kenny Root *  The supplied function will be called when the encoder has finished
661c74663799493f2b1e6123c18def94295d0afab7Kenny Root *  writing a frame.  The \c total_frames_estimate argument to the
662c74663799493f2b1e6123c18def94295d0afab7Kenny Root *  callback will be based on the value from
663c74663799493f2b1e6123c18def94295d0afab7Kenny Root *  FLAC__stream_encoder_set_total_samples_estimate().
664c74663799493f2b1e6123c18def94295d0afab7Kenny Root *
665c74663799493f2b1e6123c18def94295d0afab7Kenny Root * \note In general, FLAC__StreamEncoder functions which change the
666c74663799493f2b1e6123c18def94295d0afab7Kenny Root * state should not be called on the \a encoder while in the callback.
667c74663799493f2b1e6123c18def94295d0afab7Kenny Root *
668c74663799493f2b1e6123c18def94295d0afab7Kenny Root * \param  encoder          The encoder instance calling the callback.
669c74663799493f2b1e6123c18def94295d0afab7Kenny Root * \param  bytes_written    Bytes written so far.
670c74663799493f2b1e6123c18def94295d0afab7Kenny Root * \param  samples_written  Samples written so far.
671c74663799493f2b1e6123c18def94295d0afab7Kenny Root * \param  frames_written   Frames written so far.
672c74663799493f2b1e6123c18def94295d0afab7Kenny Root * \param  total_frames_estimate  The estimate of the total number of
673c74663799493f2b1e6123c18def94295d0afab7Kenny Root *                                frames to be written.
674c74663799493f2b1e6123c18def94295d0afab7Kenny Root * \param  client_data      The callee's client data set through
675c74663799493f2b1e6123c18def94295d0afab7Kenny Root *                          FLAC__stream_encoder_init_*().
676c74663799493f2b1e6123c18def94295d0afab7Kenny Root */
677c74663799493f2b1e6123c18def94295d0afab7Kenny Roottypedef void (*FLAC__StreamEncoderProgressCallback)(const FLAC__StreamEncoder *encoder, FLAC__uint64 bytes_written, FLAC__uint64 samples_written, unsigned frames_written, unsigned total_frames_estimate, void *client_data);
678c74663799493f2b1e6123c18def94295d0afab7Kenny Root
679c74663799493f2b1e6123c18def94295d0afab7Kenny Root
680c74663799493f2b1e6123c18def94295d0afab7Kenny Root/***********************************************************************
681c74663799493f2b1e6123c18def94295d0afab7Kenny Root *
682c74663799493f2b1e6123c18def94295d0afab7Kenny Root * Class constructor/destructor
683c74663799493f2b1e6123c18def94295d0afab7Kenny Root *
684c74663799493f2b1e6123c18def94295d0afab7Kenny Root ***********************************************************************/
685c74663799493f2b1e6123c18def94295d0afab7Kenny Root
686c74663799493f2b1e6123c18def94295d0afab7Kenny Root/** Create a new stream encoder instance.  The instance is created with
687c74663799493f2b1e6123c18def94295d0afab7Kenny Root *  default settings; see the individual FLAC__stream_encoder_set_*()
688c74663799493f2b1e6123c18def94295d0afab7Kenny Root *  functions for each setting's default.
689c74663799493f2b1e6123c18def94295d0afab7Kenny Root *
690c74663799493f2b1e6123c18def94295d0afab7Kenny Root * \retval FLAC__StreamEncoder*
691c74663799493f2b1e6123c18def94295d0afab7Kenny Root *    \c NULL if there was an error allocating memory, else the new instance.
692c74663799493f2b1e6123c18def94295d0afab7Kenny Root */
693c74663799493f2b1e6123c18def94295d0afab7Kenny RootFLAC_API FLAC__StreamEncoder *FLAC__stream_encoder_new(void);
694c74663799493f2b1e6123c18def94295d0afab7Kenny Root
695c74663799493f2b1e6123c18def94295d0afab7Kenny Root/** Free an encoder instance.  Deletes the object pointed to by \a encoder.
696c74663799493f2b1e6123c18def94295d0afab7Kenny Root *
697c74663799493f2b1e6123c18def94295d0afab7Kenny Root * \param encoder  A pointer to an existing encoder.
698c74663799493f2b1e6123c18def94295d0afab7Kenny Root * \assert
699c74663799493f2b1e6123c18def94295d0afab7Kenny Root *    \code encoder != NULL \endcode
700c74663799493f2b1e6123c18def94295d0afab7Kenny Root */
701c74663799493f2b1e6123c18def94295d0afab7Kenny RootFLAC_API void FLAC__stream_encoder_delete(FLAC__StreamEncoder *encoder);
702c74663799493f2b1e6123c18def94295d0afab7Kenny Root
703c74663799493f2b1e6123c18def94295d0afab7Kenny Root
704c74663799493f2b1e6123c18def94295d0afab7Kenny Root/***********************************************************************
705c74663799493f2b1e6123c18def94295d0afab7Kenny Root *
706c74663799493f2b1e6123c18def94295d0afab7Kenny Root * Public class method prototypes
707c74663799493f2b1e6123c18def94295d0afab7Kenny Root *
708c74663799493f2b1e6123c18def94295d0afab7Kenny Root ***********************************************************************/
709c74663799493f2b1e6123c18def94295d0afab7Kenny Root
710c74663799493f2b1e6123c18def94295d0afab7Kenny Root/** Set the serial number for the FLAC stream to use in the Ogg container.
711c74663799493f2b1e6123c18def94295d0afab7Kenny Root *
712c74663799493f2b1e6123c18def94295d0afab7Kenny Root * \note
713c74663799493f2b1e6123c18def94295d0afab7Kenny Root * This does not need to be set for native FLAC encoding.
714c74663799493f2b1e6123c18def94295d0afab7Kenny Root *
715c74663799493f2b1e6123c18def94295d0afab7Kenny Root * \note
716c74663799493f2b1e6123c18def94295d0afab7Kenny Root * It is recommended to set a serial number explicitly as the default of '0'
717c74663799493f2b1e6123c18def94295d0afab7Kenny Root * may collide with other streams.
718c74663799493f2b1e6123c18def94295d0afab7Kenny Root *
719c74663799493f2b1e6123c18def94295d0afab7Kenny Root * \default \c 0
720c74663799493f2b1e6123c18def94295d0afab7Kenny Root * \param  encoder        An encoder instance to set.
721c74663799493f2b1e6123c18def94295d0afab7Kenny Root * \param  serial_number  See above.
722c74663799493f2b1e6123c18def94295d0afab7Kenny Root * \assert
723c74663799493f2b1e6123c18def94295d0afab7Kenny Root *    \code encoder != NULL \endcode
724c74663799493f2b1e6123c18def94295d0afab7Kenny Root * \retval FLAC__bool
725c74663799493f2b1e6123c18def94295d0afab7Kenny Root *    \c false if the encoder is already initialized, else \c true.
726c74663799493f2b1e6123c18def94295d0afab7Kenny Root */
727c74663799493f2b1e6123c18def94295d0afab7Kenny RootFLAC_API FLAC__bool FLAC__stream_encoder_set_ogg_serial_number(FLAC__StreamEncoder *encoder, long serial_number);
728c74663799493f2b1e6123c18def94295d0afab7Kenny Root
729c74663799493f2b1e6123c18def94295d0afab7Kenny Root/** Set the "verify" flag.  If \c true, the encoder will verify it's own
730c74663799493f2b1e6123c18def94295d0afab7Kenny Root *  encoded output by feeding it through an internal decoder and comparing
731c74663799493f2b1e6123c18def94295d0afab7Kenny Root *  the original signal against the decoded signal.  If a mismatch occurs,
732c74663799493f2b1e6123c18def94295d0afab7Kenny Root *  the process call will return \c false.  Note that this will slow the
733c74663799493f2b1e6123c18def94295d0afab7Kenny Root *  encoding process by the extra time required for decoding and comparison.
734c74663799493f2b1e6123c18def94295d0afab7Kenny Root *
735c74663799493f2b1e6123c18def94295d0afab7Kenny Root * \default \c false
736c74663799493f2b1e6123c18def94295d0afab7Kenny Root * \param  encoder  An encoder instance to set.
737c74663799493f2b1e6123c18def94295d0afab7Kenny Root * \param  value    Flag value (see above).
738c74663799493f2b1e6123c18def94295d0afab7Kenny Root * \assert
739c74663799493f2b1e6123c18def94295d0afab7Kenny Root *    \code encoder != NULL \endcode
740c74663799493f2b1e6123c18def94295d0afab7Kenny Root * \retval FLAC__bool
741c74663799493f2b1e6123c18def94295d0afab7Kenny Root *    \c false if the encoder is already initialized, else \c true.
742c74663799493f2b1e6123c18def94295d0afab7Kenny Root */
743c74663799493f2b1e6123c18def94295d0afab7Kenny RootFLAC_API FLAC__bool FLAC__stream_encoder_set_verify(FLAC__StreamEncoder *encoder, FLAC__bool value);
744c74663799493f2b1e6123c18def94295d0afab7Kenny Root
745c74663799493f2b1e6123c18def94295d0afab7Kenny Root/** Set the <A HREF="../format.html#subset">Subset</A> flag.  If \c true,
746c74663799493f2b1e6123c18def94295d0afab7Kenny Root *  the encoder will comply with the Subset and will check the
747c74663799493f2b1e6123c18def94295d0afab7Kenny Root *  settings during FLAC__stream_encoder_init_*() to see if all settings
748c74663799493f2b1e6123c18def94295d0afab7Kenny Root *  comply.  If \c false, the settings may take advantage of the full
749c74663799493f2b1e6123c18def94295d0afab7Kenny Root *  range that the format allows.
750c74663799493f2b1e6123c18def94295d0afab7Kenny Root *
751c74663799493f2b1e6123c18def94295d0afab7Kenny Root *  Make sure you know what it entails before setting this to \c false.
752c74663799493f2b1e6123c18def94295d0afab7Kenny Root *
753c74663799493f2b1e6123c18def94295d0afab7Kenny Root * \default \c true
754c74663799493f2b1e6123c18def94295d0afab7Kenny Root * \param  encoder  An encoder instance to set.
755c74663799493f2b1e6123c18def94295d0afab7Kenny Root * \param  value    Flag value (see above).
756c74663799493f2b1e6123c18def94295d0afab7Kenny Root * \assert
757c74663799493f2b1e6123c18def94295d0afab7Kenny Root *    \code encoder != NULL \endcode
758c74663799493f2b1e6123c18def94295d0afab7Kenny Root * \retval FLAC__bool
759c74663799493f2b1e6123c18def94295d0afab7Kenny Root *    \c false if the encoder is already initialized, else \c true.
760c74663799493f2b1e6123c18def94295d0afab7Kenny Root */
761c74663799493f2b1e6123c18def94295d0afab7Kenny RootFLAC_API FLAC__bool FLAC__stream_encoder_set_streamable_subset(FLAC__StreamEncoder *encoder, FLAC__bool value);
762c74663799493f2b1e6123c18def94295d0afab7Kenny Root
763c74663799493f2b1e6123c18def94295d0afab7Kenny Root/** Set the number of channels to be encoded.
764c74663799493f2b1e6123c18def94295d0afab7Kenny Root *
765c74663799493f2b1e6123c18def94295d0afab7Kenny Root * \default \c 2
766c74663799493f2b1e6123c18def94295d0afab7Kenny Root * \param  encoder  An encoder instance to set.
767c74663799493f2b1e6123c18def94295d0afab7Kenny Root * \param  value    See above.
768c74663799493f2b1e6123c18def94295d0afab7Kenny Root * \assert
769c74663799493f2b1e6123c18def94295d0afab7Kenny Root *    \code encoder != NULL \endcode
770c74663799493f2b1e6123c18def94295d0afab7Kenny Root * \retval FLAC__bool
771c74663799493f2b1e6123c18def94295d0afab7Kenny Root *    \c false if the encoder is already initialized, else \c true.
772c74663799493f2b1e6123c18def94295d0afab7Kenny Root */
773c74663799493f2b1e6123c18def94295d0afab7Kenny RootFLAC_API FLAC__bool FLAC__stream_encoder_set_channels(FLAC__StreamEncoder *encoder, unsigned value);
774c74663799493f2b1e6123c18def94295d0afab7Kenny Root
775c74663799493f2b1e6123c18def94295d0afab7Kenny Root/** Set the sample resolution of the input to be encoded.
776c74663799493f2b1e6123c18def94295d0afab7Kenny Root *
777c74663799493f2b1e6123c18def94295d0afab7Kenny Root * \warning
778c74663799493f2b1e6123c18def94295d0afab7Kenny Root * Do not feed the encoder data that is wider than the value you
779c74663799493f2b1e6123c18def94295d0afab7Kenny Root * set here or you will generate an invalid stream.
780c74663799493f2b1e6123c18def94295d0afab7Kenny Root *
781c74663799493f2b1e6123c18def94295d0afab7Kenny Root * \default \c 16
782c74663799493f2b1e6123c18def94295d0afab7Kenny Root * \param  encoder  An encoder instance to set.
783c74663799493f2b1e6123c18def94295d0afab7Kenny Root * \param  value    See above.
784c74663799493f2b1e6123c18def94295d0afab7Kenny Root * \assert
785c74663799493f2b1e6123c18def94295d0afab7Kenny Root *    \code encoder != NULL \endcode
786c74663799493f2b1e6123c18def94295d0afab7Kenny Root * \retval FLAC__bool
787c74663799493f2b1e6123c18def94295d0afab7Kenny Root *    \c false if the encoder is already initialized, else \c true.
788c74663799493f2b1e6123c18def94295d0afab7Kenny Root */
789c74663799493f2b1e6123c18def94295d0afab7Kenny RootFLAC_API FLAC__bool FLAC__stream_encoder_set_bits_per_sample(FLAC__StreamEncoder *encoder, unsigned value);
790c74663799493f2b1e6123c18def94295d0afab7Kenny Root
791c74663799493f2b1e6123c18def94295d0afab7Kenny Root/** Set the sample rate (in Hz) of the input to be encoded.
792c74663799493f2b1e6123c18def94295d0afab7Kenny Root *
793c74663799493f2b1e6123c18def94295d0afab7Kenny Root * \default \c 44100
794c74663799493f2b1e6123c18def94295d0afab7Kenny Root * \param  encoder  An encoder instance to set.
795c74663799493f2b1e6123c18def94295d0afab7Kenny Root * \param  value    See above.
796c74663799493f2b1e6123c18def94295d0afab7Kenny Root * \assert
797c74663799493f2b1e6123c18def94295d0afab7Kenny Root *    \code encoder != NULL \endcode
798c74663799493f2b1e6123c18def94295d0afab7Kenny Root * \retval FLAC__bool
799c74663799493f2b1e6123c18def94295d0afab7Kenny Root *    \c false if the encoder is already initialized, else \c true.
800c74663799493f2b1e6123c18def94295d0afab7Kenny Root */
801c74663799493f2b1e6123c18def94295d0afab7Kenny RootFLAC_API FLAC__bool FLAC__stream_encoder_set_sample_rate(FLAC__StreamEncoder *encoder, unsigned value);
802c74663799493f2b1e6123c18def94295d0afab7Kenny Root
803c74663799493f2b1e6123c18def94295d0afab7Kenny Root/** Set the compression level
804c74663799493f2b1e6123c18def94295d0afab7Kenny Root *
805c74663799493f2b1e6123c18def94295d0afab7Kenny Root * The compression level is roughly proportional to the amount of effort
806c74663799493f2b1e6123c18def94295d0afab7Kenny Root * the encoder expends to compress the file.  A higher level usually
807c74663799493f2b1e6123c18def94295d0afab7Kenny Root * means more computation but higher compression.  The default level is
808c74663799493f2b1e6123c18def94295d0afab7Kenny Root * suitable for most applications.
809c74663799493f2b1e6123c18def94295d0afab7Kenny Root *
810c74663799493f2b1e6123c18def94295d0afab7Kenny Root * Currently the levels range from \c 0 (fastest, least compression) to
811c74663799493f2b1e6123c18def94295d0afab7Kenny Root * \c 8 (slowest, most compression).  A value larger than \c 8 will be
812c74663799493f2b1e6123c18def94295d0afab7Kenny Root * treated as \c 8.
813c74663799493f2b1e6123c18def94295d0afab7Kenny Root *
814c74663799493f2b1e6123c18def94295d0afab7Kenny Root * This function automatically calls the following other \c _set_
815c74663799493f2b1e6123c18def94295d0afab7Kenny Root * functions with appropriate values, so the client does not need to
816c74663799493f2b1e6123c18def94295d0afab7Kenny Root * unless it specifically wants to override them:
817c74663799493f2b1e6123c18def94295d0afab7Kenny Root * - FLAC__stream_encoder_set_do_mid_side_stereo()
818c74663799493f2b1e6123c18def94295d0afab7Kenny Root * - FLAC__stream_encoder_set_loose_mid_side_stereo()
819c74663799493f2b1e6123c18def94295d0afab7Kenny Root * - FLAC__stream_encoder_set_apodization()
820c74663799493f2b1e6123c18def94295d0afab7Kenny Root * - FLAC__stream_encoder_set_max_lpc_order()
821c74663799493f2b1e6123c18def94295d0afab7Kenny Root * - FLAC__stream_encoder_set_qlp_coeff_precision()
822c74663799493f2b1e6123c18def94295d0afab7Kenny Root * - FLAC__stream_encoder_set_do_qlp_coeff_prec_search()
823c74663799493f2b1e6123c18def94295d0afab7Kenny Root * - FLAC__stream_encoder_set_do_escape_coding()
824c74663799493f2b1e6123c18def94295d0afab7Kenny Root * - FLAC__stream_encoder_set_do_exhaustive_model_search()
825c74663799493f2b1e6123c18def94295d0afab7Kenny Root * - FLAC__stream_encoder_set_min_residual_partition_order()
826c74663799493f2b1e6123c18def94295d0afab7Kenny Root * - FLAC__stream_encoder_set_max_residual_partition_order()
827c74663799493f2b1e6123c18def94295d0afab7Kenny Root * - FLAC__stream_encoder_set_rice_parameter_search_dist()
828c74663799493f2b1e6123c18def94295d0afab7Kenny Root *
829c74663799493f2b1e6123c18def94295d0afab7Kenny Root * The actual values set for each level are:
830c74663799493f2b1e6123c18def94295d0afab7Kenny Root * <table>
831c74663799493f2b1e6123c18def94295d0afab7Kenny Root * <tr>
832c74663799493f2b1e6123c18def94295d0afab7Kenny Root *  <td><b>level</b><td>
833c74663799493f2b1e6123c18def94295d0afab7Kenny Root *  <td>do mid-side stereo<td>
834c74663799493f2b1e6123c18def94295d0afab7Kenny Root *  <td>loose mid-side stereo<td>
835c74663799493f2b1e6123c18def94295d0afab7Kenny Root *  <td>apodization<td>
836c74663799493f2b1e6123c18def94295d0afab7Kenny Root *  <td>max lpc order<td>
837c74663799493f2b1e6123c18def94295d0afab7Kenny Root *  <td>qlp coeff precision<td>
838c74663799493f2b1e6123c18def94295d0afab7Kenny Root *  <td>qlp coeff prec search<td>
839c74663799493f2b1e6123c18def94295d0afab7Kenny Root *  <td>escape coding<td>
840c74663799493f2b1e6123c18def94295d0afab7Kenny Root *  <td>exhaustive model search<td>
841c74663799493f2b1e6123c18def94295d0afab7Kenny Root *  <td>min residual partition order<td>
842c74663799493f2b1e6123c18def94295d0afab7Kenny Root *  <td>max residual partition order<td>
843c74663799493f2b1e6123c18def94295d0afab7Kenny Root *  <td>rice parameter search dist<td>
844c74663799493f2b1e6123c18def94295d0afab7Kenny Root * </tr>
845c74663799493f2b1e6123c18def94295d0afab7Kenny Root * <tr>  <td><b>0</b><td>  <td>false<td>  <td>false<td>  <td>tukey(0.5)<td>  <td>0<td>   <td>0<td>  <td>false<td>  <td>false<td>  <td>false<td>  <td>0<td>  <td>3<td>  <td>0<td>  </tr>
846c74663799493f2b1e6123c18def94295d0afab7Kenny Root * <tr>  <td><b>1</b><td>  <td>true<td>   <td>true<td>   <td>tukey(0.5)<td>  <td>0<td>   <td>0<td>  <td>false<td>  <td>false<td>  <td>false<td>  <td>0<td>  <td>3<td>  <td>0<td>  </tr>
847c74663799493f2b1e6123c18def94295d0afab7Kenny Root * <tr>  <td><b>2</b><td>  <td>true<td>   <td>false<td>  <td>tukey(0.5)<td>  <td>0<td>   <td>0<td>  <td>false<td>  <td>false<td>  <td>false<td>  <td>0<td>  <td>3<td>  <td>0<td>  </tr>
848c74663799493f2b1e6123c18def94295d0afab7Kenny Root * <tr>  <td><b>3</b><td>  <td>false<td>  <td>false<td>  <td>tukey(0.5)<td>  <td>6<td>   <td>0<td>  <td>false<td>  <td>false<td>  <td>false<td>  <td>0<td>  <td>4<td>  <td>0<td>  </tr>
849c74663799493f2b1e6123c18def94295d0afab7Kenny Root * <tr>  <td><b>4</b><td>  <td>true<td>   <td>true<td>   <td>tukey(0.5)<td>  <td>8<td>   <td>0<td>  <td>false<td>  <td>false<td>  <td>false<td>  <td>0<td>  <td>4<td>  <td>0<td>  </tr>
850c74663799493f2b1e6123c18def94295d0afab7Kenny Root * <tr>  <td><b>5</b><td>  <td>true<td>   <td>false<td>  <td>tukey(0.5)<td>  <td>8<td>   <td>0<td>  <td>false<td>  <td>false<td>  <td>false<td>  <td>0<td>  <td>5<td>  <td>0<td>  </tr>
851c74663799493f2b1e6123c18def94295d0afab7Kenny Root * <tr>  <td><b>6</b><td>  <td>true<td>   <td>false<td>  <td>tukey(0.5)<td>  <td>8<td>   <td>0<td>  <td>false<td>  <td>false<td>  <td>false<td>  <td>0<td>  <td>6<td>  <td>0<td>  </tr>
852c74663799493f2b1e6123c18def94295d0afab7Kenny Root * <tr>  <td><b>7</b><td>  <td>true<td>   <td>false<td>  <td>tukey(0.5)<td>  <td>8<td>   <td>0<td>  <td>false<td>  <td>false<td>  <td>true<td>   <td>0<td>  <td>6<td>  <td>0<td>  </tr>
853c74663799493f2b1e6123c18def94295d0afab7Kenny Root * <tr>  <td><b>8</b><td>  <td>true<td>   <td>false<td>  <td>tukey(0.5)<td>  <td>12<td>  <td>0<td>  <td>false<td>  <td>false<td>  <td>true<td>   <td>0<td>  <td>6<td>  <td>0<td>  </tr>
854c74663799493f2b1e6123c18def94295d0afab7Kenny Root * </table>
855c74663799493f2b1e6123c18def94295d0afab7Kenny Root *
856c74663799493f2b1e6123c18def94295d0afab7Kenny Root * \default \c 5
857c74663799493f2b1e6123c18def94295d0afab7Kenny Root * \param  encoder  An encoder instance to set.
858c74663799493f2b1e6123c18def94295d0afab7Kenny Root * \param  value    See above.
859c74663799493f2b1e6123c18def94295d0afab7Kenny Root * \assert
860c74663799493f2b1e6123c18def94295d0afab7Kenny Root *    \code encoder != NULL \endcode
861c74663799493f2b1e6123c18def94295d0afab7Kenny Root * \retval FLAC__bool
862c74663799493f2b1e6123c18def94295d0afab7Kenny Root *    \c false if the encoder is already initialized, else \c true.
863c74663799493f2b1e6123c18def94295d0afab7Kenny Root */
864c74663799493f2b1e6123c18def94295d0afab7Kenny RootFLAC_API FLAC__bool FLAC__stream_encoder_set_compression_level(FLAC__StreamEncoder *encoder, unsigned value);
865c74663799493f2b1e6123c18def94295d0afab7Kenny Root
866c74663799493f2b1e6123c18def94295d0afab7Kenny Root/** Set the blocksize to use while encoding.
867c74663799493f2b1e6123c18def94295d0afab7Kenny Root *
868c74663799493f2b1e6123c18def94295d0afab7Kenny Root * The number of samples to use per frame.  Use \c 0 to let the encoder
869c74663799493f2b1e6123c18def94295d0afab7Kenny Root * estimate a blocksize; this is usually best.
870c74663799493f2b1e6123c18def94295d0afab7Kenny Root *
871c74663799493f2b1e6123c18def94295d0afab7Kenny Root * \default \c 0
872c74663799493f2b1e6123c18def94295d0afab7Kenny Root * \param  encoder  An encoder instance to set.
873c74663799493f2b1e6123c18def94295d0afab7Kenny Root * \param  value    See above.
874c74663799493f2b1e6123c18def94295d0afab7Kenny Root * \assert
875c74663799493f2b1e6123c18def94295d0afab7Kenny Root *    \code encoder != NULL \endcode
876c74663799493f2b1e6123c18def94295d0afab7Kenny Root * \retval FLAC__bool
877c74663799493f2b1e6123c18def94295d0afab7Kenny Root *    \c false if the encoder is already initialized, else \c true.
878c74663799493f2b1e6123c18def94295d0afab7Kenny Root */
879c74663799493f2b1e6123c18def94295d0afab7Kenny RootFLAC_API FLAC__bool FLAC__stream_encoder_set_blocksize(FLAC__StreamEncoder *encoder, unsigned value);
880c74663799493f2b1e6123c18def94295d0afab7Kenny Root
881c74663799493f2b1e6123c18def94295d0afab7Kenny Root/** Set to \c true to enable mid-side encoding on stereo input.  The
882c74663799493f2b1e6123c18def94295d0afab7Kenny Root *  number of channels must be 2 for this to have any effect.  Set to
883c74663799493f2b1e6123c18def94295d0afab7Kenny Root *  \c false to use only independent channel coding.
884c74663799493f2b1e6123c18def94295d0afab7Kenny Root *
885c74663799493f2b1e6123c18def94295d0afab7Kenny Root * \default \c false
886c74663799493f2b1e6123c18def94295d0afab7Kenny Root * \param  encoder  An encoder instance to set.
887c74663799493f2b1e6123c18def94295d0afab7Kenny Root * \param  value    Flag value (see above).
888c74663799493f2b1e6123c18def94295d0afab7Kenny Root * \assert
889c74663799493f2b1e6123c18def94295d0afab7Kenny Root *    \code encoder != NULL \endcode
890c74663799493f2b1e6123c18def94295d0afab7Kenny Root * \retval FLAC__bool
891c74663799493f2b1e6123c18def94295d0afab7Kenny Root *    \c false if the encoder is already initialized, else \c true.
892c74663799493f2b1e6123c18def94295d0afab7Kenny Root */
893c74663799493f2b1e6123c18def94295d0afab7Kenny RootFLAC_API FLAC__bool FLAC__stream_encoder_set_do_mid_side_stereo(FLAC__StreamEncoder *encoder, FLAC__bool value);
894c74663799493f2b1e6123c18def94295d0afab7Kenny Root
895c74663799493f2b1e6123c18def94295d0afab7Kenny Root/** Set to \c true to enable adaptive switching between mid-side and
896c74663799493f2b1e6123c18def94295d0afab7Kenny Root *  left-right encoding on stereo input.  Set to \c false to use
897c74663799493f2b1e6123c18def94295d0afab7Kenny Root *  exhaustive searching.  Setting this to \c true requires
898c74663799493f2b1e6123c18def94295d0afab7Kenny Root *  FLAC__stream_encoder_set_do_mid_side_stereo() to also be set to
899c74663799493f2b1e6123c18def94295d0afab7Kenny Root *  \c true in order to have any effect.
900c74663799493f2b1e6123c18def94295d0afab7Kenny Root *
901c74663799493f2b1e6123c18def94295d0afab7Kenny Root * \default \c false
902c74663799493f2b1e6123c18def94295d0afab7Kenny Root * \param  encoder  An encoder instance to set.
903c74663799493f2b1e6123c18def94295d0afab7Kenny Root * \param  value    Flag value (see above).
904c74663799493f2b1e6123c18def94295d0afab7Kenny Root * \assert
905c74663799493f2b1e6123c18def94295d0afab7Kenny Root *    \code encoder != NULL \endcode
906c74663799493f2b1e6123c18def94295d0afab7Kenny Root * \retval FLAC__bool
907c74663799493f2b1e6123c18def94295d0afab7Kenny Root *    \c false if the encoder is already initialized, else \c true.
908c74663799493f2b1e6123c18def94295d0afab7Kenny Root */
909c74663799493f2b1e6123c18def94295d0afab7Kenny RootFLAC_API FLAC__bool FLAC__stream_encoder_set_loose_mid_side_stereo(FLAC__StreamEncoder *encoder, FLAC__bool value);
910c74663799493f2b1e6123c18def94295d0afab7Kenny Root
911c74663799493f2b1e6123c18def94295d0afab7Kenny Root/** Sets the apodization function(s) the encoder will use when windowing
912c74663799493f2b1e6123c18def94295d0afab7Kenny Root *  audio data for LPC analysis.
913c74663799493f2b1e6123c18def94295d0afab7Kenny Root *
914c74663799493f2b1e6123c18def94295d0afab7Kenny Root * The \a specification is a plain ASCII string which specifies exactly
915c74663799493f2b1e6123c18def94295d0afab7Kenny Root * which functions to use.  There may be more than one (up to 32),
916c74663799493f2b1e6123c18def94295d0afab7Kenny Root * separated by \c ';' characters.  Some functions take one or more
917c74663799493f2b1e6123c18def94295d0afab7Kenny Root * comma-separated arguments in parentheses.
918c74663799493f2b1e6123c18def94295d0afab7Kenny Root *
919c74663799493f2b1e6123c18def94295d0afab7Kenny Root * The available functions are \c bartlett, \c bartlett_hann,
920c74663799493f2b1e6123c18def94295d0afab7Kenny Root * \c blackman, \c blackman_harris_4term_92db, \c connes, \c flattop,
921c74663799493f2b1e6123c18def94295d0afab7Kenny Root * \c gauss(STDDEV), \c hamming, \c hann, \c kaiser_bessel, \c nuttall,
922c74663799493f2b1e6123c18def94295d0afab7Kenny Root * \c rectangle, \c triangle, \c tukey(P), \c welch.
923c74663799493f2b1e6123c18def94295d0afab7Kenny Root *
924c74663799493f2b1e6123c18def94295d0afab7Kenny Root * For \c gauss(STDDEV), STDDEV specifies the standard deviation
925c74663799493f2b1e6123c18def94295d0afab7Kenny Root * (0<STDDEV<=0.5).
926c74663799493f2b1e6123c18def94295d0afab7Kenny Root *
927c74663799493f2b1e6123c18def94295d0afab7Kenny Root * For \c tukey(P), P specifies the fraction of the window that is
928c74663799493f2b1e6123c18def94295d0afab7Kenny Root * tapered (0<=P<=1).  P=0 corresponds to \c rectangle and P=1
929c74663799493f2b1e6123c18def94295d0afab7Kenny Root * corresponds to \c hann.
930c74663799493f2b1e6123c18def94295d0afab7Kenny Root *
931c74663799493f2b1e6123c18def94295d0afab7Kenny Root * Example specifications are \c "blackman" or
932c74663799493f2b1e6123c18def94295d0afab7Kenny Root * \c "hann;triangle;tukey(0.5);tukey(0.25);tukey(0.125)"
933c74663799493f2b1e6123c18def94295d0afab7Kenny Root *
934c74663799493f2b1e6123c18def94295d0afab7Kenny Root * Any function that is specified erroneously is silently dropped.  Up
935c74663799493f2b1e6123c18def94295d0afab7Kenny Root * to 32 functions are kept, the rest are dropped.  If the specification
936c74663799493f2b1e6123c18def94295d0afab7Kenny Root * is empty the encoder defaults to \c "tukey(0.5)".
937c74663799493f2b1e6123c18def94295d0afab7Kenny Root *
938c74663799493f2b1e6123c18def94295d0afab7Kenny Root * When more than one function is specified, then for every subframe the
939c74663799493f2b1e6123c18def94295d0afab7Kenny Root * encoder will try each of them separately and choose the window that
940c74663799493f2b1e6123c18def94295d0afab7Kenny Root * results in the smallest compressed subframe.
941c74663799493f2b1e6123c18def94295d0afab7Kenny Root *
942c74663799493f2b1e6123c18def94295d0afab7Kenny Root * Note that each function specified causes the encoder to occupy a
943c74663799493f2b1e6123c18def94295d0afab7Kenny Root * floating point array in which to store the window.
944c74663799493f2b1e6123c18def94295d0afab7Kenny Root *
945c74663799493f2b1e6123c18def94295d0afab7Kenny Root * \default \c "tukey(0.5)"
946c74663799493f2b1e6123c18def94295d0afab7Kenny Root * \param  encoder        An encoder instance to set.
947c74663799493f2b1e6123c18def94295d0afab7Kenny Root * \param  specification  See above.
948c74663799493f2b1e6123c18def94295d0afab7Kenny Root * \assert
949c74663799493f2b1e6123c18def94295d0afab7Kenny Root *    \code encoder != NULL \endcode
950c74663799493f2b1e6123c18def94295d0afab7Kenny Root *    \code specification != NULL \endcode
951c74663799493f2b1e6123c18def94295d0afab7Kenny Root * \retval FLAC__bool
952c74663799493f2b1e6123c18def94295d0afab7Kenny Root *    \c false if the encoder is already initialized, else \c true.
953c74663799493f2b1e6123c18def94295d0afab7Kenny Root */
954c74663799493f2b1e6123c18def94295d0afab7Kenny RootFLAC_API FLAC__bool FLAC__stream_encoder_set_apodization(FLAC__StreamEncoder *encoder, const char *specification);
955c74663799493f2b1e6123c18def94295d0afab7Kenny Root
956c74663799493f2b1e6123c18def94295d0afab7Kenny Root/** Set the maximum LPC order, or \c 0 to use only the fixed predictors.
957c74663799493f2b1e6123c18def94295d0afab7Kenny Root *
958c74663799493f2b1e6123c18def94295d0afab7Kenny Root * \default \c 0
959c74663799493f2b1e6123c18def94295d0afab7Kenny Root * \param  encoder  An encoder instance to set.
960c74663799493f2b1e6123c18def94295d0afab7Kenny Root * \param  value    See above.
961c74663799493f2b1e6123c18def94295d0afab7Kenny Root * \assert
962c74663799493f2b1e6123c18def94295d0afab7Kenny Root *    \code encoder != NULL \endcode
963c74663799493f2b1e6123c18def94295d0afab7Kenny Root * \retval FLAC__bool
964c74663799493f2b1e6123c18def94295d0afab7Kenny Root *    \c false if the encoder is already initialized, else \c true.
965c74663799493f2b1e6123c18def94295d0afab7Kenny Root */
966c74663799493f2b1e6123c18def94295d0afab7Kenny RootFLAC_API FLAC__bool FLAC__stream_encoder_set_max_lpc_order(FLAC__StreamEncoder *encoder, unsigned value);
967c74663799493f2b1e6123c18def94295d0afab7Kenny Root
968c74663799493f2b1e6123c18def94295d0afab7Kenny Root/** Set the precision, in bits, of the quantized linear predictor
969c74663799493f2b1e6123c18def94295d0afab7Kenny Root *  coefficients, or \c 0 to let the encoder select it based on the
970c74663799493f2b1e6123c18def94295d0afab7Kenny Root *  blocksize.
971c74663799493f2b1e6123c18def94295d0afab7Kenny Root *
972c74663799493f2b1e6123c18def94295d0afab7Kenny Root * \note
973c74663799493f2b1e6123c18def94295d0afab7Kenny Root * In the current implementation, qlp_coeff_precision + bits_per_sample must
974c74663799493f2b1e6123c18def94295d0afab7Kenny Root * be less than 32.
975c74663799493f2b1e6123c18def94295d0afab7Kenny Root *
976c74663799493f2b1e6123c18def94295d0afab7Kenny Root * \default \c 0
977c74663799493f2b1e6123c18def94295d0afab7Kenny Root * \param  encoder  An encoder instance to set.
978c74663799493f2b1e6123c18def94295d0afab7Kenny Root * \param  value    See above.
979c74663799493f2b1e6123c18def94295d0afab7Kenny Root * \assert
980c74663799493f2b1e6123c18def94295d0afab7Kenny Root *    \code encoder != NULL \endcode
981c74663799493f2b1e6123c18def94295d0afab7Kenny Root * \retval FLAC__bool
982c74663799493f2b1e6123c18def94295d0afab7Kenny Root *    \c false if the encoder is already initialized, else \c true.
983c74663799493f2b1e6123c18def94295d0afab7Kenny Root */
984c74663799493f2b1e6123c18def94295d0afab7Kenny RootFLAC_API FLAC__bool FLAC__stream_encoder_set_qlp_coeff_precision(FLAC__StreamEncoder *encoder, unsigned value);
985c74663799493f2b1e6123c18def94295d0afab7Kenny Root
986c74663799493f2b1e6123c18def94295d0afab7Kenny Root/** Set to \c false to use only the specified quantized linear predictor
987c74663799493f2b1e6123c18def94295d0afab7Kenny Root *  coefficient precision, or \c true to search neighboring precision
988c74663799493f2b1e6123c18def94295d0afab7Kenny Root *  values and use the best one.
989c74663799493f2b1e6123c18def94295d0afab7Kenny Root *
990c74663799493f2b1e6123c18def94295d0afab7Kenny Root * \default \c false
991c74663799493f2b1e6123c18def94295d0afab7Kenny Root * \param  encoder  An encoder instance to set.
992c74663799493f2b1e6123c18def94295d0afab7Kenny Root * \param  value    See above.
993c74663799493f2b1e6123c18def94295d0afab7Kenny Root * \assert
994c74663799493f2b1e6123c18def94295d0afab7Kenny Root *    \code encoder != NULL \endcode
995c74663799493f2b1e6123c18def94295d0afab7Kenny Root * \retval FLAC__bool
996c74663799493f2b1e6123c18def94295d0afab7Kenny Root *    \c false if the encoder is already initialized, else \c true.
997c74663799493f2b1e6123c18def94295d0afab7Kenny Root */
998c74663799493f2b1e6123c18def94295d0afab7Kenny RootFLAC_API FLAC__bool FLAC__stream_encoder_set_do_qlp_coeff_prec_search(FLAC__StreamEncoder *encoder, FLAC__bool value);
999c74663799493f2b1e6123c18def94295d0afab7Kenny Root
1000c74663799493f2b1e6123c18def94295d0afab7Kenny Root/** Deprecated.  Setting this value has no effect.
1001c74663799493f2b1e6123c18def94295d0afab7Kenny Root *
1002c74663799493f2b1e6123c18def94295d0afab7Kenny Root * \default \c false
1003c74663799493f2b1e6123c18def94295d0afab7Kenny Root * \param  encoder  An encoder instance to set.
1004c74663799493f2b1e6123c18def94295d0afab7Kenny Root * \param  value    See above.
1005c74663799493f2b1e6123c18def94295d0afab7Kenny Root * \assert
1006c74663799493f2b1e6123c18def94295d0afab7Kenny Root *    \code encoder != NULL \endcode
1007c74663799493f2b1e6123c18def94295d0afab7Kenny Root * \retval FLAC__bool
1008c74663799493f2b1e6123c18def94295d0afab7Kenny Root *    \c false if the encoder is already initialized, else \c true.
1009c74663799493f2b1e6123c18def94295d0afab7Kenny Root */
1010c74663799493f2b1e6123c18def94295d0afab7Kenny RootFLAC_API FLAC__bool FLAC__stream_encoder_set_do_escape_coding(FLAC__StreamEncoder *encoder, FLAC__bool value);
1011c74663799493f2b1e6123c18def94295d0afab7Kenny Root
1012c74663799493f2b1e6123c18def94295d0afab7Kenny Root/** Set to \c false to let the encoder estimate the best model order
1013c74663799493f2b1e6123c18def94295d0afab7Kenny Root *  based on the residual signal energy, or \c true to force the
1014c74663799493f2b1e6123c18def94295d0afab7Kenny Root *  encoder to evaluate all order models and select the best.
1015c74663799493f2b1e6123c18def94295d0afab7Kenny Root *
1016c74663799493f2b1e6123c18def94295d0afab7Kenny Root * \default \c false
1017c74663799493f2b1e6123c18def94295d0afab7Kenny Root * \param  encoder  An encoder instance to set.
1018c74663799493f2b1e6123c18def94295d0afab7Kenny Root * \param  value    See above.
1019c74663799493f2b1e6123c18def94295d0afab7Kenny Root * \assert
1020c74663799493f2b1e6123c18def94295d0afab7Kenny Root *    \code encoder != NULL \endcode
1021c74663799493f2b1e6123c18def94295d0afab7Kenny Root * \retval FLAC__bool
1022c74663799493f2b1e6123c18def94295d0afab7Kenny Root *    \c false if the encoder is already initialized, else \c true.
1023c74663799493f2b1e6123c18def94295d0afab7Kenny Root */
1024c74663799493f2b1e6123c18def94295d0afab7Kenny RootFLAC_API FLAC__bool FLAC__stream_encoder_set_do_exhaustive_model_search(FLAC__StreamEncoder *encoder, FLAC__bool value);
1025c74663799493f2b1e6123c18def94295d0afab7Kenny Root
1026c74663799493f2b1e6123c18def94295d0afab7Kenny Root/** Set the minimum partition order to search when coding the residual.
1027c74663799493f2b1e6123c18def94295d0afab7Kenny Root *  This is used in tandem with
1028c74663799493f2b1e6123c18def94295d0afab7Kenny Root *  FLAC__stream_encoder_set_max_residual_partition_order().
1029c74663799493f2b1e6123c18def94295d0afab7Kenny Root *
1030c74663799493f2b1e6123c18def94295d0afab7Kenny Root *  The partition order determines the context size in the residual.
1031c74663799493f2b1e6123c18def94295d0afab7Kenny Root *  The context size will be approximately <tt>blocksize / (2 ^ order)</tt>.
1032c74663799493f2b1e6123c18def94295d0afab7Kenny Root *
1033c74663799493f2b1e6123c18def94295d0afab7Kenny Root *  Set both min and max values to \c 0 to force a single context,
1034c74663799493f2b1e6123c18def94295d0afab7Kenny Root *  whose Rice parameter is based on the residual signal variance.
1035c74663799493f2b1e6123c18def94295d0afab7Kenny Root *  Otherwise, set a min and max order, and the encoder will search
1036c74663799493f2b1e6123c18def94295d0afab7Kenny Root *  all orders, using the mean of each context for its Rice parameter,
1037c74663799493f2b1e6123c18def94295d0afab7Kenny Root *  and use the best.
1038c74663799493f2b1e6123c18def94295d0afab7Kenny Root *
1039c74663799493f2b1e6123c18def94295d0afab7Kenny Root * \default \c 0
1040c74663799493f2b1e6123c18def94295d0afab7Kenny Root * \param  encoder  An encoder instance to set.
1041c74663799493f2b1e6123c18def94295d0afab7Kenny Root * \param  value    See above.
1042c74663799493f2b1e6123c18def94295d0afab7Kenny Root * \assert
1043c74663799493f2b1e6123c18def94295d0afab7Kenny Root *    \code encoder != NULL \endcode
1044c74663799493f2b1e6123c18def94295d0afab7Kenny Root * \retval FLAC__bool
1045c74663799493f2b1e6123c18def94295d0afab7Kenny Root *    \c false if the encoder is already initialized, else \c true.
1046c74663799493f2b1e6123c18def94295d0afab7Kenny Root */
1047c74663799493f2b1e6123c18def94295d0afab7Kenny RootFLAC_API FLAC__bool FLAC__stream_encoder_set_min_residual_partition_order(FLAC__StreamEncoder *encoder, unsigned value);
1048c74663799493f2b1e6123c18def94295d0afab7Kenny Root
1049c74663799493f2b1e6123c18def94295d0afab7Kenny Root/** Set the maximum partition order to search when coding the residual.
1050c74663799493f2b1e6123c18def94295d0afab7Kenny Root *  This is used in tandem with
1051c74663799493f2b1e6123c18def94295d0afab7Kenny Root *  FLAC__stream_encoder_set_min_residual_partition_order().
1052c74663799493f2b1e6123c18def94295d0afab7Kenny Root *
1053c74663799493f2b1e6123c18def94295d0afab7Kenny Root *  The partition order determines the context size in the residual.
1054c74663799493f2b1e6123c18def94295d0afab7Kenny Root *  The context size will be approximately <tt>blocksize / (2 ^ order)</tt>.
1055c74663799493f2b1e6123c18def94295d0afab7Kenny Root *
1056c74663799493f2b1e6123c18def94295d0afab7Kenny Root *  Set both min and max values to \c 0 to force a single context,
1057c74663799493f2b1e6123c18def94295d0afab7Kenny Root *  whose Rice parameter is based on the residual signal variance.
1058c74663799493f2b1e6123c18def94295d0afab7Kenny Root *  Otherwise, set a min and max order, and the encoder will search
1059c74663799493f2b1e6123c18def94295d0afab7Kenny Root *  all orders, using the mean of each context for its Rice parameter,
1060c74663799493f2b1e6123c18def94295d0afab7Kenny Root *  and use the best.
1061c74663799493f2b1e6123c18def94295d0afab7Kenny Root *
1062c74663799493f2b1e6123c18def94295d0afab7Kenny Root * \default \c 0
1063c74663799493f2b1e6123c18def94295d0afab7Kenny Root * \param  encoder  An encoder instance to set.
1064c74663799493f2b1e6123c18def94295d0afab7Kenny Root * \param  value    See above.
1065c74663799493f2b1e6123c18def94295d0afab7Kenny Root * \assert
1066c74663799493f2b1e6123c18def94295d0afab7Kenny Root *    \code encoder != NULL \endcode
1067c74663799493f2b1e6123c18def94295d0afab7Kenny Root * \retval FLAC__bool
1068c74663799493f2b1e6123c18def94295d0afab7Kenny Root *    \c false if the encoder is already initialized, else \c true.
1069c74663799493f2b1e6123c18def94295d0afab7Kenny Root */
1070c74663799493f2b1e6123c18def94295d0afab7Kenny RootFLAC_API FLAC__bool FLAC__stream_encoder_set_max_residual_partition_order(FLAC__StreamEncoder *encoder, unsigned value);
1071c74663799493f2b1e6123c18def94295d0afab7Kenny Root
1072c74663799493f2b1e6123c18def94295d0afab7Kenny Root/** Deprecated.  Setting this value has no effect.
1073c74663799493f2b1e6123c18def94295d0afab7Kenny Root *
1074c74663799493f2b1e6123c18def94295d0afab7Kenny Root * \default \c 0
1075c74663799493f2b1e6123c18def94295d0afab7Kenny Root * \param  encoder  An encoder instance to set.
1076c74663799493f2b1e6123c18def94295d0afab7Kenny Root * \param  value    See above.
1077c74663799493f2b1e6123c18def94295d0afab7Kenny Root * \assert
1078c74663799493f2b1e6123c18def94295d0afab7Kenny Root *    \code encoder != NULL \endcode
1079c74663799493f2b1e6123c18def94295d0afab7Kenny Root * \retval FLAC__bool
1080c74663799493f2b1e6123c18def94295d0afab7Kenny Root *    \c false if the encoder is already initialized, else \c true.
1081c74663799493f2b1e6123c18def94295d0afab7Kenny Root */
1082c74663799493f2b1e6123c18def94295d0afab7Kenny RootFLAC_API FLAC__bool FLAC__stream_encoder_set_rice_parameter_search_dist(FLAC__StreamEncoder *encoder, unsigned value);
1083c74663799493f2b1e6123c18def94295d0afab7Kenny Root
1084c74663799493f2b1e6123c18def94295d0afab7Kenny Root/** Set an estimate of the total samples that will be encoded.
1085c74663799493f2b1e6123c18def94295d0afab7Kenny Root *  This is merely an estimate and may be set to \c 0 if unknown.
1086c74663799493f2b1e6123c18def94295d0afab7Kenny Root *  This value will be written to the STREAMINFO block before encoding,
1087c74663799493f2b1e6123c18def94295d0afab7Kenny Root *  and can remove the need for the caller to rewrite the value later
1088c74663799493f2b1e6123c18def94295d0afab7Kenny Root *  if the value is known before encoding.
1089c74663799493f2b1e6123c18def94295d0afab7Kenny Root *
1090c74663799493f2b1e6123c18def94295d0afab7Kenny Root * \default \c 0
1091c74663799493f2b1e6123c18def94295d0afab7Kenny Root * \param  encoder  An encoder instance to set.
1092c74663799493f2b1e6123c18def94295d0afab7Kenny Root * \param  value    See above.
1093c74663799493f2b1e6123c18def94295d0afab7Kenny Root * \assert
1094c74663799493f2b1e6123c18def94295d0afab7Kenny Root *    \code encoder != NULL \endcode
1095c74663799493f2b1e6123c18def94295d0afab7Kenny Root * \retval FLAC__bool
1096c74663799493f2b1e6123c18def94295d0afab7Kenny Root *    \c false if the encoder is already initialized, else \c true.
1097c74663799493f2b1e6123c18def94295d0afab7Kenny Root */
1098c74663799493f2b1e6123c18def94295d0afab7Kenny RootFLAC_API FLAC__bool FLAC__stream_encoder_set_total_samples_estimate(FLAC__StreamEncoder *encoder, FLAC__uint64 value);
1099c74663799493f2b1e6123c18def94295d0afab7Kenny Root
1100c74663799493f2b1e6123c18def94295d0afab7Kenny Root/** Set the metadata blocks to be emitted to the stream before encoding.
1101c74663799493f2b1e6123c18def94295d0afab7Kenny Root *  A value of \c NULL, \c 0 implies no metadata; otherwise, supply an
1102c74663799493f2b1e6123c18def94295d0afab7Kenny Root *  array of pointers to metadata blocks.  The array is non-const since
1103c74663799493f2b1e6123c18def94295d0afab7Kenny Root *  the encoder may need to change the \a is_last flag inside them, and
1104c74663799493f2b1e6123c18def94295d0afab7Kenny Root *  in some cases update seek point offsets.  Otherwise, the encoder will
1105c74663799493f2b1e6123c18def94295d0afab7Kenny Root *  not modify or free the blocks.  It is up to the caller to free the
1106c74663799493f2b1e6123c18def94295d0afab7Kenny Root *  metadata blocks after encoding finishes.
1107c74663799493f2b1e6123c18def94295d0afab7Kenny Root *
1108c74663799493f2b1e6123c18def94295d0afab7Kenny Root * \note
1109c74663799493f2b1e6123c18def94295d0afab7Kenny Root * The encoder stores only copies of the pointers in the \a metadata array;
1110c74663799493f2b1e6123c18def94295d0afab7Kenny Root * the metadata blocks themselves must survive at least until after
1111c74663799493f2b1e6123c18def94295d0afab7Kenny Root * FLAC__stream_encoder_finish() returns.  Do not free the blocks until then.
1112c74663799493f2b1e6123c18def94295d0afab7Kenny Root *
1113c74663799493f2b1e6123c18def94295d0afab7Kenny Root * \note
1114c74663799493f2b1e6123c18def94295d0afab7Kenny Root * The STREAMINFO block is always written and no STREAMINFO block may
1115c74663799493f2b1e6123c18def94295d0afab7Kenny Root * occur in the supplied array.
1116c74663799493f2b1e6123c18def94295d0afab7Kenny Root *
1117c74663799493f2b1e6123c18def94295d0afab7Kenny Root * \note
1118c74663799493f2b1e6123c18def94295d0afab7Kenny Root * By default the encoder does not create a SEEKTABLE.  If one is supplied
1119c74663799493f2b1e6123c18def94295d0afab7Kenny Root * in the \a metadata array, but the client has specified that it does not
1120c74663799493f2b1e6123c18def94295d0afab7Kenny Root * support seeking, then the SEEKTABLE will be written verbatim.  However
1121c74663799493f2b1e6123c18def94295d0afab7Kenny Root * by itself this is not very useful as the client will not know the stream
1122c74663799493f2b1e6123c18def94295d0afab7Kenny Root * offsets for the seekpoints ahead of time.  In order to get a proper
1123c74663799493f2b1e6123c18def94295d0afab7Kenny Root * seektable the client must support seeking.  See next note.
1124c74663799493f2b1e6123c18def94295d0afab7Kenny Root *
1125c74663799493f2b1e6123c18def94295d0afab7Kenny Root * \note
1126c74663799493f2b1e6123c18def94295d0afab7Kenny Root * SEEKTABLE blocks are handled specially.  Since you will not know
1127c74663799493f2b1e6123c18def94295d0afab7Kenny Root * the values for the seek point stream offsets, you should pass in
1128c74663799493f2b1e6123c18def94295d0afab7Kenny Root * a SEEKTABLE 'template', that is, a SEEKTABLE object with the
1129c74663799493f2b1e6123c18def94295d0afab7Kenny Root * required sample numbers (or placeholder points), with \c 0 for the
1130c74663799493f2b1e6123c18def94295d0afab7Kenny Root * \a frame_samples and \a stream_offset fields for each point.  If the
1131c74663799493f2b1e6123c18def94295d0afab7Kenny Root * client has specified that it supports seeking by providing a seek
1132c74663799493f2b1e6123c18def94295d0afab7Kenny Root * callback to FLAC__stream_encoder_init_stream() or both seek AND read
1133c74663799493f2b1e6123c18def94295d0afab7Kenny Root * callback to FLAC__stream_encoder_init_ogg_stream() (or by using
1134c74663799493f2b1e6123c18def94295d0afab7Kenny Root * FLAC__stream_encoder_init*_file() or FLAC__stream_encoder_init*_FILE()),
1135c74663799493f2b1e6123c18def94295d0afab7Kenny Root * then while it is encoding the encoder will fill the stream offsets in
1136c74663799493f2b1e6123c18def94295d0afab7Kenny Root * for you and when encoding is finished, it will seek back and write the
1137c74663799493f2b1e6123c18def94295d0afab7Kenny Root * real values into the SEEKTABLE block in the stream.  There are helper
1138c74663799493f2b1e6123c18def94295d0afab7Kenny Root * routines for manipulating seektable template blocks; see metadata.h:
1139c74663799493f2b1e6123c18def94295d0afab7Kenny Root * FLAC__metadata_object_seektable_template_*().  If the client does
1140c74663799493f2b1e6123c18def94295d0afab7Kenny Root * not support seeking, the SEEKTABLE will have inaccurate offsets which
1141c74663799493f2b1e6123c18def94295d0afab7Kenny Root * will slow down or remove the ability to seek in the FLAC stream.
1142c74663799493f2b1e6123c18def94295d0afab7Kenny Root *
1143c74663799493f2b1e6123c18def94295d0afab7Kenny Root * \note
1144c74663799493f2b1e6123c18def94295d0afab7Kenny Root * The encoder instance \b will modify the first \c SEEKTABLE block
1145c74663799493f2b1e6123c18def94295d0afab7Kenny Root * as it transforms the template to a valid seektable while encoding,
1146c74663799493f2b1e6123c18def94295d0afab7Kenny Root * but it is still up to the caller to free all metadata blocks after
1147c74663799493f2b1e6123c18def94295d0afab7Kenny Root * encoding.
1148c74663799493f2b1e6123c18def94295d0afab7Kenny Root *
1149c74663799493f2b1e6123c18def94295d0afab7Kenny Root * \note
1150c74663799493f2b1e6123c18def94295d0afab7Kenny Root * A VORBIS_COMMENT block may be supplied.  The vendor string in it
1151c74663799493f2b1e6123c18def94295d0afab7Kenny Root * will be ignored.  libFLAC will use it's own vendor string. libFLAC
1152c74663799493f2b1e6123c18def94295d0afab7Kenny Root * will not modify the passed-in VORBIS_COMMENT's vendor string, it
1153c74663799493f2b1e6123c18def94295d0afab7Kenny Root * will simply write it's own into the stream.  If no VORBIS_COMMENT
1154c74663799493f2b1e6123c18def94295d0afab7Kenny Root * block is present in the \a metadata array, libFLAC will write an
1155c74663799493f2b1e6123c18def94295d0afab7Kenny Root * empty one, containing only the vendor string.
1156c74663799493f2b1e6123c18def94295d0afab7Kenny Root *
1157c74663799493f2b1e6123c18def94295d0afab7Kenny Root * \note The Ogg FLAC mapping requires that the VORBIS_COMMENT block be
1158c74663799493f2b1e6123c18def94295d0afab7Kenny Root * the second metadata block of the stream.  The encoder already supplies
1159c74663799493f2b1e6123c18def94295d0afab7Kenny Root * the STREAMINFO block automatically.  If \a metadata does not contain a
1160c74663799493f2b1e6123c18def94295d0afab7Kenny Root * VORBIS_COMMENT block, the encoder will supply that too.  Otherwise, if
1161c74663799493f2b1e6123c18def94295d0afab7Kenny Root * \a metadata does contain a VORBIS_COMMENT block and it is not the
1162c74663799493f2b1e6123c18def94295d0afab7Kenny Root * first, the init function will reorder \a metadata by moving the
1163c74663799493f2b1e6123c18def94295d0afab7Kenny Root * VORBIS_COMMENT block to the front; the relative ordering of the other
1164c74663799493f2b1e6123c18def94295d0afab7Kenny Root * blocks will remain as they were.
1165c74663799493f2b1e6123c18def94295d0afab7Kenny Root *
1166c74663799493f2b1e6123c18def94295d0afab7Kenny Root * \note The Ogg FLAC mapping limits the number of metadata blocks per
1167c74663799493f2b1e6123c18def94295d0afab7Kenny Root * stream to \c 65535.  If \a num_blocks exceeds this the function will
1168c74663799493f2b1e6123c18def94295d0afab7Kenny Root * return \c false.
1169c74663799493f2b1e6123c18def94295d0afab7Kenny Root *
1170c74663799493f2b1e6123c18def94295d0afab7Kenny Root * \default \c NULL, 0
1171c74663799493f2b1e6123c18def94295d0afab7Kenny Root * \param  encoder     An encoder instance to set.
1172c74663799493f2b1e6123c18def94295d0afab7Kenny Root * \param  metadata    See above.
1173c74663799493f2b1e6123c18def94295d0afab7Kenny Root * \param  num_blocks  See above.
1174c74663799493f2b1e6123c18def94295d0afab7Kenny Root * \assert
1175c74663799493f2b1e6123c18def94295d0afab7Kenny Root *    \code encoder != NULL \endcode
1176c74663799493f2b1e6123c18def94295d0afab7Kenny Root * \retval FLAC__bool
1177c74663799493f2b1e6123c18def94295d0afab7Kenny Root *    \c false if the encoder is already initialized, else \c true.
1178c74663799493f2b1e6123c18def94295d0afab7Kenny Root *    \c false if the encoder is already initialized, or if
1179c74663799493f2b1e6123c18def94295d0afab7Kenny Root *    \a num_blocks > 65535 if encoding to Ogg FLAC, else \c true.
1180c74663799493f2b1e6123c18def94295d0afab7Kenny Root */
1181c74663799493f2b1e6123c18def94295d0afab7Kenny RootFLAC_API FLAC__bool FLAC__stream_encoder_set_metadata(FLAC__StreamEncoder *encoder, FLAC__StreamMetadata **metadata, unsigned num_blocks);
1182c74663799493f2b1e6123c18def94295d0afab7Kenny Root
1183c74663799493f2b1e6123c18def94295d0afab7Kenny Root/** Get the current encoder state.
1184c74663799493f2b1e6123c18def94295d0afab7Kenny Root *
1185c74663799493f2b1e6123c18def94295d0afab7Kenny Root * \param  encoder  An encoder instance to query.
1186c74663799493f2b1e6123c18def94295d0afab7Kenny Root * \assert
1187c74663799493f2b1e6123c18def94295d0afab7Kenny Root *    \code encoder != NULL \endcode
1188c74663799493f2b1e6123c18def94295d0afab7Kenny Root * \retval FLAC__StreamEncoderState
1189c74663799493f2b1e6123c18def94295d0afab7Kenny Root *    The current encoder state.
1190c74663799493f2b1e6123c18def94295d0afab7Kenny Root */
1191c74663799493f2b1e6123c18def94295d0afab7Kenny RootFLAC_API FLAC__StreamEncoderState FLAC__stream_encoder_get_state(const FLAC__StreamEncoder *encoder);
1192c74663799493f2b1e6123c18def94295d0afab7Kenny Root
1193c74663799493f2b1e6123c18def94295d0afab7Kenny Root/** Get the state of the verify stream decoder.
1194c74663799493f2b1e6123c18def94295d0afab7Kenny Root *  Useful when the stream encoder state is
1195c74663799493f2b1e6123c18def94295d0afab7Kenny Root *  \c FLAC__STREAM_ENCODER_VERIFY_DECODER_ERROR.
1196c74663799493f2b1e6123c18def94295d0afab7Kenny Root *
1197c74663799493f2b1e6123c18def94295d0afab7Kenny Root * \param  encoder  An encoder instance to query.
1198c74663799493f2b1e6123c18def94295d0afab7Kenny Root * \assert
1199c74663799493f2b1e6123c18def94295d0afab7Kenny Root *    \code encoder != NULL \endcode
1200c74663799493f2b1e6123c18def94295d0afab7Kenny Root * \retval FLAC__StreamDecoderState
1201c74663799493f2b1e6123c18def94295d0afab7Kenny Root *    The verify stream decoder state.
1202c74663799493f2b1e6123c18def94295d0afab7Kenny Root */
1203c74663799493f2b1e6123c18def94295d0afab7Kenny RootFLAC_API FLAC__StreamDecoderState FLAC__stream_encoder_get_verify_decoder_state(const FLAC__StreamEncoder *encoder);
1204c74663799493f2b1e6123c18def94295d0afab7Kenny Root
1205c74663799493f2b1e6123c18def94295d0afab7Kenny Root/** Get the current encoder state as a C string.
1206c74663799493f2b1e6123c18def94295d0afab7Kenny Root *  This version automatically resolves
1207c74663799493f2b1e6123c18def94295d0afab7Kenny Root *  \c FLAC__STREAM_ENCODER_VERIFY_DECODER_ERROR by getting the
1208c74663799493f2b1e6123c18def94295d0afab7Kenny Root *  verify decoder's state.
1209c74663799493f2b1e6123c18def94295d0afab7Kenny Root *
1210c74663799493f2b1e6123c18def94295d0afab7Kenny Root * \param  encoder  A encoder instance to query.
1211c74663799493f2b1e6123c18def94295d0afab7Kenny Root * \assert
1212c74663799493f2b1e6123c18def94295d0afab7Kenny Root *    \code encoder != NULL \endcode
1213c74663799493f2b1e6123c18def94295d0afab7Kenny Root * \retval const char *
1214c74663799493f2b1e6123c18def94295d0afab7Kenny Root *    The encoder state as a C string.  Do not modify the contents.
1215c74663799493f2b1e6123c18def94295d0afab7Kenny Root */
1216c74663799493f2b1e6123c18def94295d0afab7Kenny RootFLAC_API const char *FLAC__stream_encoder_get_resolved_state_string(const FLAC__StreamEncoder *encoder);
1217c74663799493f2b1e6123c18def94295d0afab7Kenny Root
1218c74663799493f2b1e6123c18def94295d0afab7Kenny Root/** Get relevant values about the nature of a verify decoder error.
1219c74663799493f2b1e6123c18def94295d0afab7Kenny Root *  Useful when the stream encoder state is
1220c74663799493f2b1e6123c18def94295d0afab7Kenny Root *  \c FLAC__STREAM_ENCODER_VERIFY_DECODER_ERROR.  The arguments should
1221c74663799493f2b1e6123c18def94295d0afab7Kenny Root *  be addresses in which the stats will be returned, or NULL if value
1222c74663799493f2b1e6123c18def94295d0afab7Kenny Root *  is not desired.
1223c74663799493f2b1e6123c18def94295d0afab7Kenny Root *
1224c74663799493f2b1e6123c18def94295d0afab7Kenny Root * \param  encoder  An encoder instance to query.
1225c74663799493f2b1e6123c18def94295d0afab7Kenny Root * \param  absolute_sample  The absolute sample number of the mismatch.
1226c74663799493f2b1e6123c18def94295d0afab7Kenny Root * \param  frame_number  The number of the frame in which the mismatch occurred.
1227c74663799493f2b1e6123c18def94295d0afab7Kenny Root * \param  channel       The channel in which the mismatch occurred.
1228c74663799493f2b1e6123c18def94295d0afab7Kenny Root * \param  sample        The number of the sample (relative to the frame) in
1229c74663799493f2b1e6123c18def94295d0afab7Kenny Root *                       which the mismatch occurred.
1230c74663799493f2b1e6123c18def94295d0afab7Kenny Root * \param  expected      The expected value for the sample in question.
1231c74663799493f2b1e6123c18def94295d0afab7Kenny Root * \param  got           The actual value returned by the decoder.
1232c74663799493f2b1e6123c18def94295d0afab7Kenny Root * \assert
1233c74663799493f2b1e6123c18def94295d0afab7Kenny Root *    \code encoder != NULL \endcode
1234c74663799493f2b1e6123c18def94295d0afab7Kenny Root */
1235c74663799493f2b1e6123c18def94295d0afab7Kenny RootFLAC_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);
1236c74663799493f2b1e6123c18def94295d0afab7Kenny Root
1237c74663799493f2b1e6123c18def94295d0afab7Kenny Root/** Get the "verify" flag.
1238c74663799493f2b1e6123c18def94295d0afab7Kenny Root *
1239c74663799493f2b1e6123c18def94295d0afab7Kenny Root * \param  encoder  An encoder instance to query.
1240c74663799493f2b1e6123c18def94295d0afab7Kenny Root * \assert
1241c74663799493f2b1e6123c18def94295d0afab7Kenny Root *    \code encoder != NULL \endcode
1242c74663799493f2b1e6123c18def94295d0afab7Kenny Root * \retval FLAC__bool
1243c74663799493f2b1e6123c18def94295d0afab7Kenny Root *    See FLAC__stream_encoder_set_verify().
1244c74663799493f2b1e6123c18def94295d0afab7Kenny Root */
1245c74663799493f2b1e6123c18def94295d0afab7Kenny RootFLAC_API FLAC__bool FLAC__stream_encoder_get_verify(const FLAC__StreamEncoder *encoder);
1246c74663799493f2b1e6123c18def94295d0afab7Kenny Root
1247c74663799493f2b1e6123c18def94295d0afab7Kenny Root/** Get the <A HREF="../format.html#subset>Subset</A> flag.
1248c74663799493f2b1e6123c18def94295d0afab7Kenny Root *
1249c74663799493f2b1e6123c18def94295d0afab7Kenny Root * \param  encoder  An encoder instance to query.
1250c74663799493f2b1e6123c18def94295d0afab7Kenny Root * \assert
1251c74663799493f2b1e6123c18def94295d0afab7Kenny Root *    \code encoder != NULL \endcode
1252c74663799493f2b1e6123c18def94295d0afab7Kenny Root * \retval FLAC__bool
1253c74663799493f2b1e6123c18def94295d0afab7Kenny Root *    See FLAC__stream_encoder_set_streamable_subset().
1254c74663799493f2b1e6123c18def94295d0afab7Kenny Root */
1255c74663799493f2b1e6123c18def94295d0afab7Kenny RootFLAC_API FLAC__bool FLAC__stream_encoder_get_streamable_subset(const FLAC__StreamEncoder *encoder);
1256c74663799493f2b1e6123c18def94295d0afab7Kenny Root
1257c74663799493f2b1e6123c18def94295d0afab7Kenny Root/** Get the number of input channels being processed.
1258c74663799493f2b1e6123c18def94295d0afab7Kenny Root *
1259c74663799493f2b1e6123c18def94295d0afab7Kenny Root * \param  encoder  An encoder instance to query.
1260c74663799493f2b1e6123c18def94295d0afab7Kenny Root * \assert
1261c74663799493f2b1e6123c18def94295d0afab7Kenny Root *    \code encoder != NULL \endcode
1262c74663799493f2b1e6123c18def94295d0afab7Kenny Root * \retval unsigned
1263c74663799493f2b1e6123c18def94295d0afab7Kenny Root *    See FLAC__stream_encoder_set_channels().
1264c74663799493f2b1e6123c18def94295d0afab7Kenny Root */
1265c74663799493f2b1e6123c18def94295d0afab7Kenny RootFLAC_API unsigned FLAC__stream_encoder_get_channels(const FLAC__StreamEncoder *encoder);
1266c74663799493f2b1e6123c18def94295d0afab7Kenny Root
1267c74663799493f2b1e6123c18def94295d0afab7Kenny Root/** Get the input sample resolution setting.
1268c74663799493f2b1e6123c18def94295d0afab7Kenny Root *
1269c74663799493f2b1e6123c18def94295d0afab7Kenny Root * \param  encoder  An encoder instance to query.
1270c74663799493f2b1e6123c18def94295d0afab7Kenny Root * \assert
1271c74663799493f2b1e6123c18def94295d0afab7Kenny Root *    \code encoder != NULL \endcode
1272c74663799493f2b1e6123c18def94295d0afab7Kenny Root * \retval unsigned
1273c74663799493f2b1e6123c18def94295d0afab7Kenny Root *    See FLAC__stream_encoder_set_bits_per_sample().
1274c74663799493f2b1e6123c18def94295d0afab7Kenny Root */
1275c74663799493f2b1e6123c18def94295d0afab7Kenny RootFLAC_API unsigned FLAC__stream_encoder_get_bits_per_sample(const FLAC__StreamEncoder *encoder);
1276c74663799493f2b1e6123c18def94295d0afab7Kenny Root
1277c74663799493f2b1e6123c18def94295d0afab7Kenny Root/** Get the input sample rate setting.
1278c74663799493f2b1e6123c18def94295d0afab7Kenny Root *
1279c74663799493f2b1e6123c18def94295d0afab7Kenny Root * \param  encoder  An encoder instance to query.
1280c74663799493f2b1e6123c18def94295d0afab7Kenny Root * \assert
1281c74663799493f2b1e6123c18def94295d0afab7Kenny Root *    \code encoder != NULL \endcode
1282c74663799493f2b1e6123c18def94295d0afab7Kenny Root * \retval unsigned
1283c74663799493f2b1e6123c18def94295d0afab7Kenny Root *    See FLAC__stream_encoder_set_sample_rate().
1284c74663799493f2b1e6123c18def94295d0afab7Kenny Root */
1285c74663799493f2b1e6123c18def94295d0afab7Kenny RootFLAC_API unsigned FLAC__stream_encoder_get_sample_rate(const FLAC__StreamEncoder *encoder);
1286c74663799493f2b1e6123c18def94295d0afab7Kenny Root
1287c74663799493f2b1e6123c18def94295d0afab7Kenny Root/** Get the blocksize setting.
1288c74663799493f2b1e6123c18def94295d0afab7Kenny Root *
1289c74663799493f2b1e6123c18def94295d0afab7Kenny Root * \param  encoder  An encoder instance to query.
1290c74663799493f2b1e6123c18def94295d0afab7Kenny Root * \assert
1291c74663799493f2b1e6123c18def94295d0afab7Kenny Root *    \code encoder != NULL \endcode
1292c74663799493f2b1e6123c18def94295d0afab7Kenny Root * \retval unsigned
1293c74663799493f2b1e6123c18def94295d0afab7Kenny Root *    See FLAC__stream_encoder_set_blocksize().
1294c74663799493f2b1e6123c18def94295d0afab7Kenny Root */
1295c74663799493f2b1e6123c18def94295d0afab7Kenny RootFLAC_API unsigned FLAC__stream_encoder_get_blocksize(const FLAC__StreamEncoder *encoder);
1296c74663799493f2b1e6123c18def94295d0afab7Kenny Root
1297c74663799493f2b1e6123c18def94295d0afab7Kenny Root/** Get the "mid/side stereo coding" flag.
1298c74663799493f2b1e6123c18def94295d0afab7Kenny Root *
1299c74663799493f2b1e6123c18def94295d0afab7Kenny Root * \param  encoder  An encoder instance to query.
1300c74663799493f2b1e6123c18def94295d0afab7Kenny Root * \assert
1301c74663799493f2b1e6123c18def94295d0afab7Kenny Root *    \code encoder != NULL \endcode
1302c74663799493f2b1e6123c18def94295d0afab7Kenny Root * \retval FLAC__bool
1303c74663799493f2b1e6123c18def94295d0afab7Kenny Root *    See FLAC__stream_encoder_get_do_mid_side_stereo().
1304c74663799493f2b1e6123c18def94295d0afab7Kenny Root */
1305c74663799493f2b1e6123c18def94295d0afab7Kenny RootFLAC_API FLAC__bool FLAC__stream_encoder_get_do_mid_side_stereo(const FLAC__StreamEncoder *encoder);
1306c74663799493f2b1e6123c18def94295d0afab7Kenny Root
1307c74663799493f2b1e6123c18def94295d0afab7Kenny Root/** Get the "adaptive mid/side switching" flag.
1308c74663799493f2b1e6123c18def94295d0afab7Kenny Root *
1309c74663799493f2b1e6123c18def94295d0afab7Kenny Root * \param  encoder  An encoder instance to query.
1310c74663799493f2b1e6123c18def94295d0afab7Kenny Root * \assert
1311c74663799493f2b1e6123c18def94295d0afab7Kenny Root *    \code encoder != NULL \endcode
1312c74663799493f2b1e6123c18def94295d0afab7Kenny Root * \retval FLAC__bool
1313c74663799493f2b1e6123c18def94295d0afab7Kenny Root *    See FLAC__stream_encoder_set_loose_mid_side_stereo().
1314c74663799493f2b1e6123c18def94295d0afab7Kenny Root */
1315c74663799493f2b1e6123c18def94295d0afab7Kenny RootFLAC_API FLAC__bool FLAC__stream_encoder_get_loose_mid_side_stereo(const FLAC__StreamEncoder *encoder);
1316c74663799493f2b1e6123c18def94295d0afab7Kenny Root
1317c74663799493f2b1e6123c18def94295d0afab7Kenny Root/** Get the maximum LPC order setting.
1318c74663799493f2b1e6123c18def94295d0afab7Kenny Root *
1319c74663799493f2b1e6123c18def94295d0afab7Kenny Root * \param  encoder  An encoder instance to query.
1320c74663799493f2b1e6123c18def94295d0afab7Kenny Root * \assert
1321c74663799493f2b1e6123c18def94295d0afab7Kenny Root *    \code encoder != NULL \endcode
1322c74663799493f2b1e6123c18def94295d0afab7Kenny Root * \retval unsigned
1323c74663799493f2b1e6123c18def94295d0afab7Kenny Root *    See FLAC__stream_encoder_set_max_lpc_order().
1324c74663799493f2b1e6123c18def94295d0afab7Kenny Root */
1325c74663799493f2b1e6123c18def94295d0afab7Kenny RootFLAC_API unsigned FLAC__stream_encoder_get_max_lpc_order(const FLAC__StreamEncoder *encoder);
1326c74663799493f2b1e6123c18def94295d0afab7Kenny Root
1327c74663799493f2b1e6123c18def94295d0afab7Kenny Root/** Get the quantized linear predictor coefficient precision setting.
1328c74663799493f2b1e6123c18def94295d0afab7Kenny Root *
1329c74663799493f2b1e6123c18def94295d0afab7Kenny Root * \param  encoder  An encoder instance to query.
1330c74663799493f2b1e6123c18def94295d0afab7Kenny Root * \assert
1331c74663799493f2b1e6123c18def94295d0afab7Kenny Root *    \code encoder != NULL \endcode
1332c74663799493f2b1e6123c18def94295d0afab7Kenny Root * \retval unsigned
1333c74663799493f2b1e6123c18def94295d0afab7Kenny Root *    See FLAC__stream_encoder_set_qlp_coeff_precision().
1334c74663799493f2b1e6123c18def94295d0afab7Kenny Root */
1335c74663799493f2b1e6123c18def94295d0afab7Kenny RootFLAC_API unsigned FLAC__stream_encoder_get_qlp_coeff_precision(const FLAC__StreamEncoder *encoder);
1336c74663799493f2b1e6123c18def94295d0afab7Kenny Root
1337c74663799493f2b1e6123c18def94295d0afab7Kenny Root/** Get the qlp coefficient precision search flag.
1338c74663799493f2b1e6123c18def94295d0afab7Kenny Root *
1339c74663799493f2b1e6123c18def94295d0afab7Kenny Root * \param  encoder  An encoder instance to query.
1340c74663799493f2b1e6123c18def94295d0afab7Kenny Root * \assert
1341c74663799493f2b1e6123c18def94295d0afab7Kenny Root *    \code encoder != NULL \endcode
1342c74663799493f2b1e6123c18def94295d0afab7Kenny Root * \retval FLAC__bool
1343c74663799493f2b1e6123c18def94295d0afab7Kenny Root *    See FLAC__stream_encoder_set_do_qlp_coeff_prec_search().
1344c74663799493f2b1e6123c18def94295d0afab7Kenny Root */
1345c74663799493f2b1e6123c18def94295d0afab7Kenny RootFLAC_API FLAC__bool FLAC__stream_encoder_get_do_qlp_coeff_prec_search(const FLAC__StreamEncoder *encoder);
1346c74663799493f2b1e6123c18def94295d0afab7Kenny Root
1347c74663799493f2b1e6123c18def94295d0afab7Kenny Root/** Get the "escape coding" flag.
1348c74663799493f2b1e6123c18def94295d0afab7Kenny Root *
1349c74663799493f2b1e6123c18def94295d0afab7Kenny Root * \param  encoder  An encoder instance to query.
1350c74663799493f2b1e6123c18def94295d0afab7Kenny Root * \assert
1351c74663799493f2b1e6123c18def94295d0afab7Kenny Root *    \code encoder != NULL \endcode
1352c74663799493f2b1e6123c18def94295d0afab7Kenny Root * \retval FLAC__bool
1353c74663799493f2b1e6123c18def94295d0afab7Kenny Root *    See FLAC__stream_encoder_set_do_escape_coding().
1354c74663799493f2b1e6123c18def94295d0afab7Kenny Root */
1355c74663799493f2b1e6123c18def94295d0afab7Kenny RootFLAC_API FLAC__bool FLAC__stream_encoder_get_do_escape_coding(const FLAC__StreamEncoder *encoder);
1356c74663799493f2b1e6123c18def94295d0afab7Kenny Root
1357c74663799493f2b1e6123c18def94295d0afab7Kenny Root/** Get the exhaustive model search flag.
1358c74663799493f2b1e6123c18def94295d0afab7Kenny Root *
1359c74663799493f2b1e6123c18def94295d0afab7Kenny Root * \param  encoder  An encoder instance to query.
1360c74663799493f2b1e6123c18def94295d0afab7Kenny Root * \assert
1361c74663799493f2b1e6123c18def94295d0afab7Kenny Root *    \code encoder != NULL \endcode
1362c74663799493f2b1e6123c18def94295d0afab7Kenny Root * \retval FLAC__bool
1363c74663799493f2b1e6123c18def94295d0afab7Kenny Root *    See FLAC__stream_encoder_set_do_exhaustive_model_search().
1364c74663799493f2b1e6123c18def94295d0afab7Kenny Root */
1365c74663799493f2b1e6123c18def94295d0afab7Kenny RootFLAC_API FLAC__bool FLAC__stream_encoder_get_do_exhaustive_model_search(const FLAC__StreamEncoder *encoder);
1366c74663799493f2b1e6123c18def94295d0afab7Kenny Root
1367c74663799493f2b1e6123c18def94295d0afab7Kenny Root/** Get the minimum residual partition order setting.
1368c74663799493f2b1e6123c18def94295d0afab7Kenny Root *
1369c74663799493f2b1e6123c18def94295d0afab7Kenny Root * \param  encoder  An encoder instance to query.
1370c74663799493f2b1e6123c18def94295d0afab7Kenny Root * \assert
1371c74663799493f2b1e6123c18def94295d0afab7Kenny Root *    \code encoder != NULL \endcode
1372c74663799493f2b1e6123c18def94295d0afab7Kenny Root * \retval unsigned
1373c74663799493f2b1e6123c18def94295d0afab7Kenny Root *    See FLAC__stream_encoder_set_min_residual_partition_order().
1374c74663799493f2b1e6123c18def94295d0afab7Kenny Root */
1375c74663799493f2b1e6123c18def94295d0afab7Kenny RootFLAC_API unsigned FLAC__stream_encoder_get_min_residual_partition_order(const FLAC__StreamEncoder *encoder);
1376c74663799493f2b1e6123c18def94295d0afab7Kenny Root
1377c74663799493f2b1e6123c18def94295d0afab7Kenny Root/** Get maximum residual partition order setting.
1378c74663799493f2b1e6123c18def94295d0afab7Kenny Root *
1379c74663799493f2b1e6123c18def94295d0afab7Kenny Root * \param  encoder  An encoder instance to query.
1380c74663799493f2b1e6123c18def94295d0afab7Kenny Root * \assert
1381c74663799493f2b1e6123c18def94295d0afab7Kenny Root *    \code encoder != NULL \endcode
1382c74663799493f2b1e6123c18def94295d0afab7Kenny Root * \retval unsigned
1383c74663799493f2b1e6123c18def94295d0afab7Kenny Root *    See FLAC__stream_encoder_set_max_residual_partition_order().
1384c74663799493f2b1e6123c18def94295d0afab7Kenny Root */
1385c74663799493f2b1e6123c18def94295d0afab7Kenny RootFLAC_API unsigned FLAC__stream_encoder_get_max_residual_partition_order(const FLAC__StreamEncoder *encoder);
1386c74663799493f2b1e6123c18def94295d0afab7Kenny Root
1387c74663799493f2b1e6123c18def94295d0afab7Kenny Root/** Get the Rice parameter search distance setting.
1388c74663799493f2b1e6123c18def94295d0afab7Kenny Root *
1389c74663799493f2b1e6123c18def94295d0afab7Kenny Root * \param  encoder  An encoder instance to query.
1390c74663799493f2b1e6123c18def94295d0afab7Kenny Root * \assert
1391c74663799493f2b1e6123c18def94295d0afab7Kenny Root *    \code encoder != NULL \endcode
1392c74663799493f2b1e6123c18def94295d0afab7Kenny Root * \retval unsigned
1393c74663799493f2b1e6123c18def94295d0afab7Kenny Root *    See FLAC__stream_encoder_set_rice_parameter_search_dist().
1394c74663799493f2b1e6123c18def94295d0afab7Kenny Root */
1395c74663799493f2b1e6123c18def94295d0afab7Kenny RootFLAC_API unsigned FLAC__stream_encoder_get_rice_parameter_search_dist(const FLAC__StreamEncoder *encoder);
1396c74663799493f2b1e6123c18def94295d0afab7Kenny Root
1397c74663799493f2b1e6123c18def94295d0afab7Kenny Root/** Get the previously set estimate of the total samples to be encoded.
1398c74663799493f2b1e6123c18def94295d0afab7Kenny Root *  The encoder merely mimics back the value given to
1399c74663799493f2b1e6123c18def94295d0afab7Kenny Root *  FLAC__stream_encoder_set_total_samples_estimate() since it has no
1400c74663799493f2b1e6123c18def94295d0afab7Kenny Root *  other way of knowing how many samples the client will encode.
1401c74663799493f2b1e6123c18def94295d0afab7Kenny Root *
1402c74663799493f2b1e6123c18def94295d0afab7Kenny Root * \param  encoder  An encoder instance to set.
1403c74663799493f2b1e6123c18def94295d0afab7Kenny Root * \assert
1404c74663799493f2b1e6123c18def94295d0afab7Kenny Root *    \code encoder != NULL \endcode
1405c74663799493f2b1e6123c18def94295d0afab7Kenny Root * \retval FLAC__uint64
1406c74663799493f2b1e6123c18def94295d0afab7Kenny Root *    See FLAC__stream_encoder_get_total_samples_estimate().
1407c74663799493f2b1e6123c18def94295d0afab7Kenny Root */
1408c74663799493f2b1e6123c18def94295d0afab7Kenny RootFLAC_API FLAC__uint64 FLAC__stream_encoder_get_total_samples_estimate(const FLAC__StreamEncoder *encoder);
1409c74663799493f2b1e6123c18def94295d0afab7Kenny Root
1410c74663799493f2b1e6123c18def94295d0afab7Kenny Root/** Initialize the encoder instance to encode native FLAC streams.
1411c74663799493f2b1e6123c18def94295d0afab7Kenny Root *
1412c74663799493f2b1e6123c18def94295d0afab7Kenny Root *  This flavor of initialization sets up the encoder to encode to a
1413c74663799493f2b1e6123c18def94295d0afab7Kenny Root *  native FLAC stream. I/O is performed via callbacks to the client.
1414c74663799493f2b1e6123c18def94295d0afab7Kenny Root *  For encoding to a plain file via filename or open \c FILE*,
1415c74663799493f2b1e6123c18def94295d0afab7Kenny Root *  FLAC__stream_encoder_init_file() and FLAC__stream_encoder_init_FILE()
1416c74663799493f2b1e6123c18def94295d0afab7Kenny Root *  provide a simpler interface.
1417c74663799493f2b1e6123c18def94295d0afab7Kenny Root *
1418c74663799493f2b1e6123c18def94295d0afab7Kenny Root *  This function should be called after FLAC__stream_encoder_new() and
1419c74663799493f2b1e6123c18def94295d0afab7Kenny Root *  FLAC__stream_encoder_set_*() but before FLAC__stream_encoder_process()
1420c74663799493f2b1e6123c18def94295d0afab7Kenny Root *  or FLAC__stream_encoder_process_interleaved().
1421c74663799493f2b1e6123c18def94295d0afab7Kenny Root *  initialization succeeded.
1422c74663799493f2b1e6123c18def94295d0afab7Kenny Root *
1423c74663799493f2b1e6123c18def94295d0afab7Kenny Root *  The call to FLAC__stream_encoder_init_stream() currently will also
1424c74663799493f2b1e6123c18def94295d0afab7Kenny Root *  immediately call the write callback several times, once with the \c fLaC
1425c74663799493f2b1e6123c18def94295d0afab7Kenny Root *  signature, and once for each encoded metadata block.
1426c74663799493f2b1e6123c18def94295d0afab7Kenny Root *
1427c74663799493f2b1e6123c18def94295d0afab7Kenny Root * \param  encoder            An uninitialized encoder instance.
1428c74663799493f2b1e6123c18def94295d0afab7Kenny Root * \param  write_callback     See FLAC__StreamEncoderWriteCallback.  This
1429c74663799493f2b1e6123c18def94295d0afab7Kenny Root *                            pointer must not be \c NULL.
1430c74663799493f2b1e6123c18def94295d0afab7Kenny Root * \param  seek_callback      See FLAC__StreamEncoderSeekCallback.  This
1431c74663799493f2b1e6123c18def94295d0afab7Kenny Root *                            pointer may be \c NULL if seeking is not
1432c74663799493f2b1e6123c18def94295d0afab7Kenny Root *                            supported.  The encoder uses seeking to go back
1433c74663799493f2b1e6123c18def94295d0afab7Kenny Root *                            and write some some stream statistics to the
1434c74663799493f2b1e6123c18def94295d0afab7Kenny Root *                            STREAMINFO block; this is recommended but not
1435c74663799493f2b1e6123c18def94295d0afab7Kenny Root *                            necessary to create a valid FLAC stream.  If
1436c74663799493f2b1e6123c18def94295d0afab7Kenny Root *                            \a seek_callback is not \c NULL then a
1437c74663799493f2b1e6123c18def94295d0afab7Kenny Root *                            \a tell_callback must also be supplied.
1438c74663799493f2b1e6123c18def94295d0afab7Kenny Root *                            Alternatively, a dummy seek callback that just
1439c74663799493f2b1e6123c18def94295d0afab7Kenny Root *                            returns \c FLAC__STREAM_ENCODER_SEEK_STATUS_UNSUPPORTED
1440c74663799493f2b1e6123c18def94295d0afab7Kenny Root *                            may also be supplied, all though this is slightly
1441c74663799493f2b1e6123c18def94295d0afab7Kenny Root *                            less efficient for the encoder.
1442c74663799493f2b1e6123c18def94295d0afab7Kenny Root * \param  tell_callback      See FLAC__StreamEncoderTellCallback.  This
1443c74663799493f2b1e6123c18def94295d0afab7Kenny Root *                            pointer may be \c NULL if seeking is not
1444c74663799493f2b1e6123c18def94295d0afab7Kenny Root *                            supported.  If \a seek_callback is \c NULL then
1445c74663799493f2b1e6123c18def94295d0afab7Kenny Root *                            this argument will be ignored.  If
1446c74663799493f2b1e6123c18def94295d0afab7Kenny Root *                            \a seek_callback is not \c NULL then a
1447c74663799493f2b1e6123c18def94295d0afab7Kenny Root *                            \a tell_callback must also be supplied.
1448c74663799493f2b1e6123c18def94295d0afab7Kenny Root *                            Alternatively, a dummy tell callback that just
1449c74663799493f2b1e6123c18def94295d0afab7Kenny Root *                            returns \c FLAC__STREAM_ENCODER_TELL_STATUS_UNSUPPORTED
1450c74663799493f2b1e6123c18def94295d0afab7Kenny Root *                            may also be supplied, all though this is slightly
1451c74663799493f2b1e6123c18def94295d0afab7Kenny Root *                            less efficient for the encoder.
1452c74663799493f2b1e6123c18def94295d0afab7Kenny Root * \param  metadata_callback  See FLAC__StreamEncoderMetadataCallback.  This
1453c74663799493f2b1e6123c18def94295d0afab7Kenny Root *                            pointer may be \c NULL if the callback is not
1454c74663799493f2b1e6123c18def94295d0afab7Kenny Root *                            desired.  If the client provides a seek callback,
1455c74663799493f2b1e6123c18def94295d0afab7Kenny Root *                            this function is not necessary as the encoder
1456c74663799493f2b1e6123c18def94295d0afab7Kenny Root *                            will automatically seek back and update the
1457c74663799493f2b1e6123c18def94295d0afab7Kenny Root *                            STREAMINFO block.  It may also be \c NULL if the
1458c74663799493f2b1e6123c18def94295d0afab7Kenny Root *                            client does not support seeking, since it will
1459c74663799493f2b1e6123c18def94295d0afab7Kenny Root *                            have no way of going back to update the
1460c74663799493f2b1e6123c18def94295d0afab7Kenny Root *                            STREAMINFO.  However the client can still supply
1461c74663799493f2b1e6123c18def94295d0afab7Kenny Root *                            a callback if it would like to know the details
1462c74663799493f2b1e6123c18def94295d0afab7Kenny Root *                            from the STREAMINFO.
1463c74663799493f2b1e6123c18def94295d0afab7Kenny Root * \param  client_data        This value will be supplied to callbacks in their
1464c74663799493f2b1e6123c18def94295d0afab7Kenny Root *                            \a client_data argument.
1465c74663799493f2b1e6123c18def94295d0afab7Kenny Root * \assert
1466c74663799493f2b1e6123c18def94295d0afab7Kenny Root *    \code encoder != NULL \endcode
1467c74663799493f2b1e6123c18def94295d0afab7Kenny Root * \retval FLAC__StreamEncoderInitStatus
1468c74663799493f2b1e6123c18def94295d0afab7Kenny Root *    \c FLAC__STREAM_ENCODER_INIT_STATUS_OK if initialization was successful;
1469c74663799493f2b1e6123c18def94295d0afab7Kenny Root *    see FLAC__StreamEncoderInitStatus for the meanings of other return values.
1470c74663799493f2b1e6123c18def94295d0afab7Kenny Root */
1471c74663799493f2b1e6123c18def94295d0afab7Kenny RootFLAC_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);
1472c74663799493f2b1e6123c18def94295d0afab7Kenny Root
1473c74663799493f2b1e6123c18def94295d0afab7Kenny Root/** Initialize the encoder instance to encode Ogg FLAC streams.
1474c74663799493f2b1e6123c18def94295d0afab7Kenny Root *
1475c74663799493f2b1e6123c18def94295d0afab7Kenny Root *  This flavor of initialization sets up the encoder to encode to a FLAC
1476c74663799493f2b1e6123c18def94295d0afab7Kenny Root *  stream in an Ogg container.  I/O is performed via callbacks to the
1477c74663799493f2b1e6123c18def94295d0afab7Kenny Root *  client.  For encoding to a plain file via filename or open \c FILE*,
1478c74663799493f2b1e6123c18def94295d0afab7Kenny Root *  FLAC__stream_encoder_init_ogg_file() and FLAC__stream_encoder_init_ogg_FILE()
1479c74663799493f2b1e6123c18def94295d0afab7Kenny Root *  provide a simpler interface.
1480c74663799493f2b1e6123c18def94295d0afab7Kenny Root *
1481c74663799493f2b1e6123c18def94295d0afab7Kenny Root *  This function should be called after FLAC__stream_encoder_new() and
1482c74663799493f2b1e6123c18def94295d0afab7Kenny Root *  FLAC__stream_encoder_set_*() but before FLAC__stream_encoder_process()
1483c74663799493f2b1e6123c18def94295d0afab7Kenny Root *  or FLAC__stream_encoder_process_interleaved().
1484c74663799493f2b1e6123c18def94295d0afab7Kenny Root *  initialization succeeded.
1485c74663799493f2b1e6123c18def94295d0afab7Kenny Root *
1486c74663799493f2b1e6123c18def94295d0afab7Kenny Root *  The call to FLAC__stream_encoder_init_ogg_stream() currently will also
1487c74663799493f2b1e6123c18def94295d0afab7Kenny Root *  immediately call the write callback several times to write the metadata
1488c74663799493f2b1e6123c18def94295d0afab7Kenny Root *  packets.
1489c74663799493f2b1e6123c18def94295d0afab7Kenny Root *
1490c74663799493f2b1e6123c18def94295d0afab7Kenny Root * \param  encoder            An uninitialized encoder instance.
1491c74663799493f2b1e6123c18def94295d0afab7Kenny Root * \param  read_callback      See FLAC__StreamEncoderReadCallback.  This
1492c74663799493f2b1e6123c18def94295d0afab7Kenny Root *                            pointer must not be \c NULL if \a seek_callback
1493c74663799493f2b1e6123c18def94295d0afab7Kenny Root *                            is non-NULL since they are both needed to be
1494c74663799493f2b1e6123c18def94295d0afab7Kenny Root *                            able to write data back to the Ogg FLAC stream
1495c74663799493f2b1e6123c18def94295d0afab7Kenny Root *                            in the post-encode phase.
1496c74663799493f2b1e6123c18def94295d0afab7Kenny Root * \param  write_callback     See FLAC__StreamEncoderWriteCallback.  This
1497c74663799493f2b1e6123c18def94295d0afab7Kenny Root *                            pointer must not be \c NULL.
1498c74663799493f2b1e6123c18def94295d0afab7Kenny Root * \param  seek_callback      See FLAC__StreamEncoderSeekCallback.  This
1499c74663799493f2b1e6123c18def94295d0afab7Kenny Root *                            pointer may be \c NULL if seeking is not
1500c74663799493f2b1e6123c18def94295d0afab7Kenny Root *                            supported.  The encoder uses seeking to go back
1501c74663799493f2b1e6123c18def94295d0afab7Kenny Root *                            and write some some stream statistics to the
1502c74663799493f2b1e6123c18def94295d0afab7Kenny Root *                            STREAMINFO block; this is recommended but not
1503c74663799493f2b1e6123c18def94295d0afab7Kenny Root *                            necessary to create a valid FLAC stream.  If
1504c74663799493f2b1e6123c18def94295d0afab7Kenny Root *                            \a seek_callback is not \c NULL then a
1505c74663799493f2b1e6123c18def94295d0afab7Kenny Root *                            \a tell_callback must also be supplied.
1506c74663799493f2b1e6123c18def94295d0afab7Kenny Root *                            Alternatively, a dummy seek callback that just
1507c74663799493f2b1e6123c18def94295d0afab7Kenny Root *                            returns \c FLAC__STREAM_ENCODER_SEEK_STATUS_UNSUPPORTED
1508c74663799493f2b1e6123c18def94295d0afab7Kenny Root *                            may also be supplied, all though this is slightly
1509c74663799493f2b1e6123c18def94295d0afab7Kenny Root *                            less efficient for the encoder.
1510c74663799493f2b1e6123c18def94295d0afab7Kenny Root * \param  tell_callback      See FLAC__StreamEncoderTellCallback.  This
1511c74663799493f2b1e6123c18def94295d0afab7Kenny Root *                            pointer may be \c NULL if seeking is not
1512c74663799493f2b1e6123c18def94295d0afab7Kenny Root *                            supported.  If \a seek_callback is \c NULL then
1513c74663799493f2b1e6123c18def94295d0afab7Kenny Root *                            this argument will be ignored.  If
1514c74663799493f2b1e6123c18def94295d0afab7Kenny Root *                            \a seek_callback is not \c NULL then a
1515c74663799493f2b1e6123c18def94295d0afab7Kenny Root *                            \a tell_callback must also be supplied.
1516c74663799493f2b1e6123c18def94295d0afab7Kenny Root *                            Alternatively, a dummy tell callback that just
1517c74663799493f2b1e6123c18def94295d0afab7Kenny Root *                            returns \c FLAC__STREAM_ENCODER_TELL_STATUS_UNSUPPORTED
1518c74663799493f2b1e6123c18def94295d0afab7Kenny Root *                            may also be supplied, all though this is slightly
1519c74663799493f2b1e6123c18def94295d0afab7Kenny Root *                            less efficient for the encoder.
1520c74663799493f2b1e6123c18def94295d0afab7Kenny Root * \param  metadata_callback  See FLAC__StreamEncoderMetadataCallback.  This
1521c74663799493f2b1e6123c18def94295d0afab7Kenny Root *                            pointer may be \c NULL if the callback is not
1522c74663799493f2b1e6123c18def94295d0afab7Kenny Root *                            desired.  If the client provides a seek callback,
1523c74663799493f2b1e6123c18def94295d0afab7Kenny Root *                            this function is not necessary as the encoder
1524c74663799493f2b1e6123c18def94295d0afab7Kenny Root *                            will automatically seek back and update the
1525c74663799493f2b1e6123c18def94295d0afab7Kenny Root *                            STREAMINFO block.  It may also be \c NULL if the
1526c74663799493f2b1e6123c18def94295d0afab7Kenny Root *                            client does not support seeking, since it will
1527c74663799493f2b1e6123c18def94295d0afab7Kenny Root *                            have no way of going back to update the
1528c74663799493f2b1e6123c18def94295d0afab7Kenny Root *                            STREAMINFO.  However the client can still supply
1529c74663799493f2b1e6123c18def94295d0afab7Kenny Root *                            a callback if it would like to know the details
1530c74663799493f2b1e6123c18def94295d0afab7Kenny Root *                            from the STREAMINFO.
1531c74663799493f2b1e6123c18def94295d0afab7Kenny Root * \param  client_data        This value will be supplied to callbacks in their
1532c74663799493f2b1e6123c18def94295d0afab7Kenny Root *                            \a client_data argument.
1533c74663799493f2b1e6123c18def94295d0afab7Kenny Root * \assert
1534c74663799493f2b1e6123c18def94295d0afab7Kenny Root *    \code encoder != NULL \endcode
1535c74663799493f2b1e6123c18def94295d0afab7Kenny Root * \retval FLAC__StreamEncoderInitStatus
1536c74663799493f2b1e6123c18def94295d0afab7Kenny Root *    \c FLAC__STREAM_ENCODER_INIT_STATUS_OK if initialization was successful;
1537c74663799493f2b1e6123c18def94295d0afab7Kenny Root *    see FLAC__StreamEncoderInitStatus for the meanings of other return values.
1538c74663799493f2b1e6123c18def94295d0afab7Kenny Root */
1539c74663799493f2b1e6123c18def94295d0afab7Kenny RootFLAC_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);
1540c74663799493f2b1e6123c18def94295d0afab7Kenny Root
1541c74663799493f2b1e6123c18def94295d0afab7Kenny Root/** Initialize the encoder instance to encode native FLAC files.
1542c74663799493f2b1e6123c18def94295d0afab7Kenny Root *
1543c74663799493f2b1e6123c18def94295d0afab7Kenny Root *  This flavor of initialization sets up the encoder to encode to a
1544c74663799493f2b1e6123c18def94295d0afab7Kenny Root *  plain native FLAC file.  For non-stdio streams, you must use
1545c74663799493f2b1e6123c18def94295d0afab7Kenny Root *  FLAC__stream_encoder_init_stream() and provide callbacks for the I/O.
1546c74663799493f2b1e6123c18def94295d0afab7Kenny Root *
1547c74663799493f2b1e6123c18def94295d0afab7Kenny Root *  This function should be called after FLAC__stream_encoder_new() and
1548c74663799493f2b1e6123c18def94295d0afab7Kenny Root *  FLAC__stream_encoder_set_*() but before FLAC__stream_encoder_process()
1549c74663799493f2b1e6123c18def94295d0afab7Kenny Root *  or FLAC__stream_encoder_process_interleaved().
1550c74663799493f2b1e6123c18def94295d0afab7Kenny Root *  initialization succeeded.
1551c74663799493f2b1e6123c18def94295d0afab7Kenny Root *
1552c74663799493f2b1e6123c18def94295d0afab7Kenny Root * \param  encoder            An uninitialized encoder instance.
1553c74663799493f2b1e6123c18def94295d0afab7Kenny Root * \param  file               An open file.  The file should have been opened
1554c74663799493f2b1e6123c18def94295d0afab7Kenny Root *                            with mode \c "w+b" and rewound.  The file
1555c74663799493f2b1e6123c18def94295d0afab7Kenny Root *                            becomes owned by the encoder and should not be
1556c74663799493f2b1e6123c18def94295d0afab7Kenny Root *                            manipulated by the client while encoding.
1557c74663799493f2b1e6123c18def94295d0afab7Kenny Root *                            Unless \a file is \c stdout, it will be closed
1558c74663799493f2b1e6123c18def94295d0afab7Kenny Root *                            when FLAC__stream_encoder_finish() is called.
1559c74663799493f2b1e6123c18def94295d0afab7Kenny Root *                            Note however that a proper SEEKTABLE cannot be
1560c74663799493f2b1e6123c18def94295d0afab7Kenny Root *                            created when encoding to \c stdout since it is
1561c74663799493f2b1e6123c18def94295d0afab7Kenny Root *                            not seekable.
1562c74663799493f2b1e6123c18def94295d0afab7Kenny Root * \param  progress_callback  See FLAC__StreamEncoderProgressCallback.  This
1563c74663799493f2b1e6123c18def94295d0afab7Kenny Root *                            pointer may be \c NULL if the callback is not
1564c74663799493f2b1e6123c18def94295d0afab7Kenny Root *                            desired.
1565c74663799493f2b1e6123c18def94295d0afab7Kenny Root * \param  client_data        This value will be supplied to callbacks in their
1566c74663799493f2b1e6123c18def94295d0afab7Kenny Root *                            \a client_data argument.
1567c74663799493f2b1e6123c18def94295d0afab7Kenny Root * \assert
1568c74663799493f2b1e6123c18def94295d0afab7Kenny Root *    \code encoder != NULL \endcode
1569c74663799493f2b1e6123c18def94295d0afab7Kenny Root *    \code file != NULL \endcode
1570c74663799493f2b1e6123c18def94295d0afab7Kenny Root * \retval FLAC__StreamEncoderInitStatus
1571c74663799493f2b1e6123c18def94295d0afab7Kenny Root *    \c FLAC__STREAM_ENCODER_INIT_STATUS_OK if initialization was successful;
1572c74663799493f2b1e6123c18def94295d0afab7Kenny Root *    see FLAC__StreamEncoderInitStatus for the meanings of other return values.
1573c74663799493f2b1e6123c18def94295d0afab7Kenny Root */
1574c74663799493f2b1e6123c18def94295d0afab7Kenny RootFLAC_API FLAC__StreamEncoderInitStatus FLAC__stream_encoder_init_FILE(FLAC__StreamEncoder *encoder, FILE *file, FLAC__StreamEncoderProgressCallback progress_callback, void *client_data);
1575c74663799493f2b1e6123c18def94295d0afab7Kenny Root
1576c74663799493f2b1e6123c18def94295d0afab7Kenny Root/** Initialize the encoder instance to encode Ogg FLAC files.
1577c74663799493f2b1e6123c18def94295d0afab7Kenny Root *
1578c74663799493f2b1e6123c18def94295d0afab7Kenny Root *  This flavor of initialization sets up the encoder to encode to a
1579c74663799493f2b1e6123c18def94295d0afab7Kenny Root *  plain Ogg FLAC file.  For non-stdio streams, you must use
1580c74663799493f2b1e6123c18def94295d0afab7Kenny Root *  FLAC__stream_encoder_init_ogg_stream() and provide callbacks for the I/O.
1581c74663799493f2b1e6123c18def94295d0afab7Kenny Root *
1582c74663799493f2b1e6123c18def94295d0afab7Kenny Root *  This function should be called after FLAC__stream_encoder_new() and
1583c74663799493f2b1e6123c18def94295d0afab7Kenny Root *  FLAC__stream_encoder_set_*() but before FLAC__stream_encoder_process()
1584c74663799493f2b1e6123c18def94295d0afab7Kenny Root *  or FLAC__stream_encoder_process_interleaved().
1585c74663799493f2b1e6123c18def94295d0afab7Kenny Root *  initialization succeeded.
1586c74663799493f2b1e6123c18def94295d0afab7Kenny Root *
1587c74663799493f2b1e6123c18def94295d0afab7Kenny Root * \param  encoder            An uninitialized encoder instance.
1588c74663799493f2b1e6123c18def94295d0afab7Kenny Root * \param  file               An open file.  The file should have been opened
1589c74663799493f2b1e6123c18def94295d0afab7Kenny Root *                            with mode \c "w+b" and rewound.  The file
1590c74663799493f2b1e6123c18def94295d0afab7Kenny Root *                            becomes owned by the encoder and should not be
1591c74663799493f2b1e6123c18def94295d0afab7Kenny Root *                            manipulated by the client while encoding.
1592c74663799493f2b1e6123c18def94295d0afab7Kenny Root *                            Unless \a file is \c stdout, it will be closed
1593c74663799493f2b1e6123c18def94295d0afab7Kenny Root *                            when FLAC__stream_encoder_finish() is called.
1594c74663799493f2b1e6123c18def94295d0afab7Kenny Root *                            Note however that a proper SEEKTABLE cannot be
1595c74663799493f2b1e6123c18def94295d0afab7Kenny Root *                            created when encoding to \c stdout since it is
1596c74663799493f2b1e6123c18def94295d0afab7Kenny Root *                            not seekable.
1597c74663799493f2b1e6123c18def94295d0afab7Kenny Root * \param  progress_callback  See FLAC__StreamEncoderProgressCallback.  This
1598c74663799493f2b1e6123c18def94295d0afab7Kenny Root *                            pointer may be \c NULL if the callback is not
1599c74663799493f2b1e6123c18def94295d0afab7Kenny Root *                            desired.
1600c74663799493f2b1e6123c18def94295d0afab7Kenny Root * \param  client_data        This value will be supplied to callbacks in their
1601c74663799493f2b1e6123c18def94295d0afab7Kenny Root *                            \a client_data argument.
1602c74663799493f2b1e6123c18def94295d0afab7Kenny Root * \assert
1603c74663799493f2b1e6123c18def94295d0afab7Kenny Root *    \code encoder != NULL \endcode
1604c74663799493f2b1e6123c18def94295d0afab7Kenny Root *    \code file != NULL \endcode
1605c74663799493f2b1e6123c18def94295d0afab7Kenny Root * \retval FLAC__StreamEncoderInitStatus
1606c74663799493f2b1e6123c18def94295d0afab7Kenny Root *    \c FLAC__STREAM_ENCODER_INIT_STATUS_OK if initialization was successful;
1607c74663799493f2b1e6123c18def94295d0afab7Kenny Root *    see FLAC__StreamEncoderInitStatus for the meanings of other return values.
1608c74663799493f2b1e6123c18def94295d0afab7Kenny Root */
1609c74663799493f2b1e6123c18def94295d0afab7Kenny RootFLAC_API FLAC__StreamEncoderInitStatus FLAC__stream_encoder_init_ogg_FILE(FLAC__StreamEncoder *encoder, FILE *file, FLAC__StreamEncoderProgressCallback progress_callback, void *client_data);
1610c74663799493f2b1e6123c18def94295d0afab7Kenny Root
1611c74663799493f2b1e6123c18def94295d0afab7Kenny Root/** Initialize the encoder instance to encode native FLAC files.
1612c74663799493f2b1e6123c18def94295d0afab7Kenny Root *
1613c74663799493f2b1e6123c18def94295d0afab7Kenny Root *  This flavor of initialization sets up the encoder to encode to a plain
1614c74663799493f2b1e6123c18def94295d0afab7Kenny Root *  FLAC file.  If POSIX fopen() semantics are not sufficient (for example,
1615c74663799493f2b1e6123c18def94295d0afab7Kenny Root *  with Unicode filenames on Windows), you must use
1616c74663799493f2b1e6123c18def94295d0afab7Kenny Root *  FLAC__stream_encoder_init_FILE(), or FLAC__stream_encoder_init_stream()
1617c74663799493f2b1e6123c18def94295d0afab7Kenny Root *  and provide callbacks for the I/O.
1618c74663799493f2b1e6123c18def94295d0afab7Kenny Root *
1619c74663799493f2b1e6123c18def94295d0afab7Kenny Root *  This function should be called after FLAC__stream_encoder_new() and
1620c74663799493f2b1e6123c18def94295d0afab7Kenny Root *  FLAC__stream_encoder_set_*() but before FLAC__stream_encoder_process()
1621c74663799493f2b1e6123c18def94295d0afab7Kenny Root *  or FLAC__stream_encoder_process_interleaved().
1622c74663799493f2b1e6123c18def94295d0afab7Kenny Root *  initialization succeeded.
1623c74663799493f2b1e6123c18def94295d0afab7Kenny Root *
1624c74663799493f2b1e6123c18def94295d0afab7Kenny Root * \param  encoder            An uninitialized encoder instance.
1625c74663799493f2b1e6123c18def94295d0afab7Kenny Root * \param  filename           The name of the file to encode to.  The file will
1626c74663799493f2b1e6123c18def94295d0afab7Kenny Root *                            be opened with fopen().  Use \c NULL to encode to
1627c74663799493f2b1e6123c18def94295d0afab7Kenny Root *                            \c stdout.  Note however that a proper SEEKTABLE
1628c74663799493f2b1e6123c18def94295d0afab7Kenny Root *                            cannot be created when encoding to \c stdout since
1629c74663799493f2b1e6123c18def94295d0afab7Kenny Root *                            it is not seekable.
1630c74663799493f2b1e6123c18def94295d0afab7Kenny Root * \param  progress_callback  See FLAC__StreamEncoderProgressCallback.  This
1631c74663799493f2b1e6123c18def94295d0afab7Kenny Root *                            pointer may be \c NULL if the callback is not
1632c74663799493f2b1e6123c18def94295d0afab7Kenny Root *                            desired.
1633c74663799493f2b1e6123c18def94295d0afab7Kenny Root * \param  client_data        This value will be supplied to callbacks in their
1634c74663799493f2b1e6123c18def94295d0afab7Kenny Root *                            \a client_data argument.
1635c74663799493f2b1e6123c18def94295d0afab7Kenny Root * \assert
1636c74663799493f2b1e6123c18def94295d0afab7Kenny Root *    \code encoder != NULL \endcode
1637c74663799493f2b1e6123c18def94295d0afab7Kenny Root * \retval FLAC__StreamEncoderInitStatus
1638c74663799493f2b1e6123c18def94295d0afab7Kenny Root *    \c FLAC__STREAM_ENCODER_INIT_STATUS_OK if initialization was successful;
1639c74663799493f2b1e6123c18def94295d0afab7Kenny Root *    see FLAC__StreamEncoderInitStatus for the meanings of other return values.
1640c74663799493f2b1e6123c18def94295d0afab7Kenny Root */
1641c74663799493f2b1e6123c18def94295d0afab7Kenny RootFLAC_API FLAC__StreamEncoderInitStatus FLAC__stream_encoder_init_file(FLAC__StreamEncoder *encoder, const char *filename, FLAC__StreamEncoderProgressCallback progress_callback, void *client_data);
1642c74663799493f2b1e6123c18def94295d0afab7Kenny Root
1643c74663799493f2b1e6123c18def94295d0afab7Kenny Root/** Initialize the encoder instance to encode Ogg FLAC files.
1644c74663799493f2b1e6123c18def94295d0afab7Kenny Root *
1645c74663799493f2b1e6123c18def94295d0afab7Kenny Root *  This flavor of initialization sets up the encoder to encode to a plain
1646c74663799493f2b1e6123c18def94295d0afab7Kenny Root *  Ogg FLAC file.  If POSIX fopen() semantics are not sufficient (for example,
1647c74663799493f2b1e6123c18def94295d0afab7Kenny Root *  with Unicode filenames on Windows), you must use
1648c74663799493f2b1e6123c18def94295d0afab7Kenny Root *  FLAC__stream_encoder_init_ogg_FILE(), or FLAC__stream_encoder_init_ogg_stream()
1649c74663799493f2b1e6123c18def94295d0afab7Kenny Root *  and provide callbacks for the I/O.
1650c74663799493f2b1e6123c18def94295d0afab7Kenny Root *
1651c74663799493f2b1e6123c18def94295d0afab7Kenny Root *  This function should be called after FLAC__stream_encoder_new() and
1652c74663799493f2b1e6123c18def94295d0afab7Kenny Root *  FLAC__stream_encoder_set_*() but before FLAC__stream_encoder_process()
1653c74663799493f2b1e6123c18def94295d0afab7Kenny Root *  or FLAC__stream_encoder_process_interleaved().
1654c74663799493f2b1e6123c18def94295d0afab7Kenny Root *  initialization succeeded.
1655c74663799493f2b1e6123c18def94295d0afab7Kenny Root *
1656c74663799493f2b1e6123c18def94295d0afab7Kenny Root * \param  encoder            An uninitialized encoder instance.
1657c74663799493f2b1e6123c18def94295d0afab7Kenny Root * \param  filename           The name of the file to encode to.  The file will
1658c74663799493f2b1e6123c18def94295d0afab7Kenny Root *                            be opened with fopen().  Use \c NULL to encode to
1659c74663799493f2b1e6123c18def94295d0afab7Kenny Root *                            \c stdout.  Note however that a proper SEEKTABLE
1660c74663799493f2b1e6123c18def94295d0afab7Kenny Root *                            cannot be created when encoding to \c stdout since
1661c74663799493f2b1e6123c18def94295d0afab7Kenny Root *                            it is not seekable.
1662c74663799493f2b1e6123c18def94295d0afab7Kenny Root * \param  progress_callback  See FLAC__StreamEncoderProgressCallback.  This
1663c74663799493f2b1e6123c18def94295d0afab7Kenny Root *                            pointer may be \c NULL if the callback is not
1664c74663799493f2b1e6123c18def94295d0afab7Kenny Root *                            desired.
1665c74663799493f2b1e6123c18def94295d0afab7Kenny Root * \param  client_data        This value will be supplied to callbacks in their
1666c74663799493f2b1e6123c18def94295d0afab7Kenny Root *                            \a client_data argument.
1667c74663799493f2b1e6123c18def94295d0afab7Kenny Root * \assert
1668c74663799493f2b1e6123c18def94295d0afab7Kenny Root *    \code encoder != NULL \endcode
1669c74663799493f2b1e6123c18def94295d0afab7Kenny Root * \retval FLAC__StreamEncoderInitStatus
1670c74663799493f2b1e6123c18def94295d0afab7Kenny Root *    \c FLAC__STREAM_ENCODER_INIT_STATUS_OK if initialization was successful;
1671c74663799493f2b1e6123c18def94295d0afab7Kenny Root *    see FLAC__StreamEncoderInitStatus for the meanings of other return values.
1672c74663799493f2b1e6123c18def94295d0afab7Kenny Root */
1673c74663799493f2b1e6123c18def94295d0afab7Kenny RootFLAC_API FLAC__StreamEncoderInitStatus FLAC__stream_encoder_init_ogg_file(FLAC__StreamEncoder *encoder, const char *filename, FLAC__StreamEncoderProgressCallback progress_callback, void *client_data);
1674c74663799493f2b1e6123c18def94295d0afab7Kenny Root
1675c74663799493f2b1e6123c18def94295d0afab7Kenny Root/** Finish the encoding process.
1676c74663799493f2b1e6123c18def94295d0afab7Kenny Root *  Flushes the encoding buffer, releases resources, resets the encoder
1677c74663799493f2b1e6123c18def94295d0afab7Kenny Root *  settings to their defaults, and returns the encoder state to
1678c74663799493f2b1e6123c18def94295d0afab7Kenny Root *  FLAC__STREAM_ENCODER_UNINITIALIZED.  Note that this can generate
1679c74663799493f2b1e6123c18def94295d0afab7Kenny Root *  one or more write callbacks before returning, and will generate
1680c74663799493f2b1e6123c18def94295d0afab7Kenny Root *  a metadata callback.
1681c74663799493f2b1e6123c18def94295d0afab7Kenny Root *
1682c74663799493f2b1e6123c18def94295d0afab7Kenny Root *  Note that in the course of processing the last frame, errors can
1683c74663799493f2b1e6123c18def94295d0afab7Kenny Root *  occur, so the caller should be sure to check the return value to
1684c74663799493f2b1e6123c18def94295d0afab7Kenny Root *  ensure the file was encoded properly.
1685c74663799493f2b1e6123c18def94295d0afab7Kenny Root *
1686c74663799493f2b1e6123c18def94295d0afab7Kenny Root *  In the event of a prematurely-terminated encode, it is not strictly
1687c74663799493f2b1e6123c18def94295d0afab7Kenny Root *  necessary to call this immediately before FLAC__stream_encoder_delete()
1688c74663799493f2b1e6123c18def94295d0afab7Kenny Root *  but it is good practice to match every FLAC__stream_encoder_init_*()
1689c74663799493f2b1e6123c18def94295d0afab7Kenny Root *  with a FLAC__stream_encoder_finish().
1690c74663799493f2b1e6123c18def94295d0afab7Kenny Root *
1691c74663799493f2b1e6123c18def94295d0afab7Kenny Root * \param  encoder  An uninitialized encoder instance.
1692c74663799493f2b1e6123c18def94295d0afab7Kenny Root * \assert
1693c74663799493f2b1e6123c18def94295d0afab7Kenny Root *    \code encoder != NULL \endcode
1694c74663799493f2b1e6123c18def94295d0afab7Kenny Root * \retval FLAC__bool
1695c74663799493f2b1e6123c18def94295d0afab7Kenny Root *    \c false if an error occurred processing the last frame; or if verify
1696c74663799493f2b1e6123c18def94295d0afab7Kenny Root *    mode is set (see FLAC__stream_encoder_set_verify()), there was a
1697c74663799493f2b1e6123c18def94295d0afab7Kenny Root *    verify mismatch; else \c true.  If \c false, caller should check the
1698c74663799493f2b1e6123c18def94295d0afab7Kenny Root *    state with FLAC__stream_encoder_get_state() for more information
1699c74663799493f2b1e6123c18def94295d0afab7Kenny Root *    about the error.
1700c74663799493f2b1e6123c18def94295d0afab7Kenny Root */
1701c74663799493f2b1e6123c18def94295d0afab7Kenny RootFLAC_API FLAC__bool FLAC__stream_encoder_finish(FLAC__StreamEncoder *encoder);
1702c74663799493f2b1e6123c18def94295d0afab7Kenny Root
1703c74663799493f2b1e6123c18def94295d0afab7Kenny Root/** Submit data for encoding.
1704c74663799493f2b1e6123c18def94295d0afab7Kenny Root *  This version allows you to supply the input data via an array of
1705c74663799493f2b1e6123c18def94295d0afab7Kenny Root *  pointers, each pointer pointing to an array of \a samples samples
1706c74663799493f2b1e6123c18def94295d0afab7Kenny Root *  representing one channel.  The samples need not be block-aligned,
1707c74663799493f2b1e6123c18def94295d0afab7Kenny Root *  but each channel should have the same number of samples.  Each sample
1708c74663799493f2b1e6123c18def94295d0afab7Kenny Root *  should be a signed integer, right-justified to the resolution set by
1709c74663799493f2b1e6123c18def94295d0afab7Kenny Root *  FLAC__stream_encoder_set_bits_per_sample().  For example, if the
1710c74663799493f2b1e6123c18def94295d0afab7Kenny Root *  resolution is 16 bits per sample, the samples should all be in the
1711c74663799493f2b1e6123c18def94295d0afab7Kenny Root *  range [-32768,32767].
1712c74663799493f2b1e6123c18def94295d0afab7Kenny Root *
1713c74663799493f2b1e6123c18def94295d0afab7Kenny Root *  For applications where channel order is important, channels must
1714c74663799493f2b1e6123c18def94295d0afab7Kenny Root *  follow the order as described in the
1715c74663799493f2b1e6123c18def94295d0afab7Kenny Root *  <A HREF="../format.html#frame_header">frame header</A>.
1716c74663799493f2b1e6123c18def94295d0afab7Kenny Root *
1717c74663799493f2b1e6123c18def94295d0afab7Kenny Root * \param  encoder  An initialized encoder instance in the OK state.
1718c74663799493f2b1e6123c18def94295d0afab7Kenny Root * \param  buffer   An array of pointers to each channel's signal.
1719c74663799493f2b1e6123c18def94295d0afab7Kenny Root * \param  samples  The number of samples in one channel.
1720c74663799493f2b1e6123c18def94295d0afab7Kenny Root * \assert
1721c74663799493f2b1e6123c18def94295d0afab7Kenny Root *    \code encoder != NULL \endcode
1722c74663799493f2b1e6123c18def94295d0afab7Kenny Root *    \code FLAC__stream_encoder_get_state(encoder) == FLAC__STREAM_ENCODER_OK \endcode
1723c74663799493f2b1e6123c18def94295d0afab7Kenny Root * \retval FLAC__bool
1724c74663799493f2b1e6123c18def94295d0afab7Kenny Root *    \c true if successful, else \c false; in this case, check the
1725c74663799493f2b1e6123c18def94295d0afab7Kenny Root *    encoder state with FLAC__stream_encoder_get_state() to see what
1726c74663799493f2b1e6123c18def94295d0afab7Kenny Root *    went wrong.
1727c74663799493f2b1e6123c18def94295d0afab7Kenny Root */
1728c74663799493f2b1e6123c18def94295d0afab7Kenny RootFLAC_API FLAC__bool FLAC__stream_encoder_process(FLAC__StreamEncoder *encoder, const FLAC__int32 * const buffer[], unsigned samples);
1729c74663799493f2b1e6123c18def94295d0afab7Kenny Root
1730c74663799493f2b1e6123c18def94295d0afab7Kenny Root/** Submit data for encoding.
1731c74663799493f2b1e6123c18def94295d0afab7Kenny Root *  This version allows you to supply the input data where the channels
1732c74663799493f2b1e6123c18def94295d0afab7Kenny Root *  are interleaved into a single array (i.e. channel0_sample0,
1733c74663799493f2b1e6123c18def94295d0afab7Kenny Root *  channel1_sample0, ... , channelN_sample0, channel0_sample1, ...).
1734c74663799493f2b1e6123c18def94295d0afab7Kenny Root *  The samples need not be block-aligned but they must be
1735c74663799493f2b1e6123c18def94295d0afab7Kenny Root *  sample-aligned, i.e. the first value should be channel0_sample0
1736c74663799493f2b1e6123c18def94295d0afab7Kenny Root *  and the last value channelN_sampleM.  Each sample should be a signed
1737c74663799493f2b1e6123c18def94295d0afab7Kenny Root *  integer, right-justified to the resolution set by
1738c74663799493f2b1e6123c18def94295d0afab7Kenny Root *  FLAC__stream_encoder_set_bits_per_sample().  For example, if the
1739c74663799493f2b1e6123c18def94295d0afab7Kenny Root *  resolution is 16 bits per sample, the samples should all be in the
1740c74663799493f2b1e6123c18def94295d0afab7Kenny Root *  range [-32768,32767].
1741c74663799493f2b1e6123c18def94295d0afab7Kenny Root *
1742c74663799493f2b1e6123c18def94295d0afab7Kenny Root *  For applications where channel order is important, channels must
1743c74663799493f2b1e6123c18def94295d0afab7Kenny Root *  follow the order as described in the
1744c74663799493f2b1e6123c18def94295d0afab7Kenny Root *  <A HREF="../format.html#frame_header">frame header</A>.
1745c74663799493f2b1e6123c18def94295d0afab7Kenny Root *
1746c74663799493f2b1e6123c18def94295d0afab7Kenny Root * \param  encoder  An initialized encoder instance in the OK state.
1747c74663799493f2b1e6123c18def94295d0afab7Kenny Root * \param  buffer   An array of channel-interleaved data (see above).
1748c74663799493f2b1e6123c18def94295d0afab7Kenny Root * \param  samples  The number of samples in one channel, the same as for
1749c74663799493f2b1e6123c18def94295d0afab7Kenny Root *                  FLAC__stream_encoder_process().  For example, if
1750c74663799493f2b1e6123c18def94295d0afab7Kenny Root *                  encoding two channels, \c 1000 \a samples corresponds
1751c74663799493f2b1e6123c18def94295d0afab7Kenny Root *                  to a \a buffer of 2000 values.
1752c74663799493f2b1e6123c18def94295d0afab7Kenny Root * \assert
1753c74663799493f2b1e6123c18def94295d0afab7Kenny Root *    \code encoder != NULL \endcode
1754c74663799493f2b1e6123c18def94295d0afab7Kenny Root *    \code FLAC__stream_encoder_get_state(encoder) == FLAC__STREAM_ENCODER_OK \endcode
1755c74663799493f2b1e6123c18def94295d0afab7Kenny Root * \retval FLAC__bool
1756c74663799493f2b1e6123c18def94295d0afab7Kenny Root *    \c true if successful, else \c false; in this case, check the
1757c74663799493f2b1e6123c18def94295d0afab7Kenny Root *    encoder state with FLAC__stream_encoder_get_state() to see what
1758c74663799493f2b1e6123c18def94295d0afab7Kenny Root *    went wrong.
1759c74663799493f2b1e6123c18def94295d0afab7Kenny Root */
1760c74663799493f2b1e6123c18def94295d0afab7Kenny RootFLAC_API FLAC__bool FLAC__stream_encoder_process_interleaved(FLAC__StreamEncoder *encoder, const FLAC__int32 buffer[], unsigned samples);
1761c74663799493f2b1e6123c18def94295d0afab7Kenny Root
1762c74663799493f2b1e6123c18def94295d0afab7Kenny Root/* \} */
1763c74663799493f2b1e6123c18def94295d0afab7Kenny Root
1764c74663799493f2b1e6123c18def94295d0afab7Kenny Root#ifdef __cplusplus
1765c74663799493f2b1e6123c18def94295d0afab7Kenny Root}
1766c74663799493f2b1e6123c18def94295d0afab7Kenny Root#endif
1767c74663799493f2b1e6123c18def94295d0afab7Kenny Root
1768c74663799493f2b1e6123c18def94295d0afab7Kenny Root#endif
1769