/* libFLAC - Free Lossless Audio Codec library
- * Copyright (C) 2000,2001,2002,2003,2004,2005,2006 Josh Coalson
+ * Copyright (C) 2000,2001,2002,2003,2004,2005,2006,2007,2008,2009 Josh Coalson
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* \link flac_stream_encoder stream encoder \endlink module.
*/
-/** \defgroup flac_encoder FLAC/ *_encoder.h: encoder interfaces
+/** \defgroup flac_encoder FLAC/ \*_encoder.h: encoder interfaces
* \ingroup flac
*
* \brief
* The call to FLAC__stream_encoder_init_*() currently will also immediately
* call the write callback several times, once with the \c fLaC signature,
* and once for each encoded metadata block. Note that for Ogg FLAC
- * encoding you will usually get twice the number of callbacks than with
- * native FLAC, one for the Ogg page header and one for the page body.
+ * encoding you will usually get at least twice the number of callbacks than
+ * with native FLAC, one for the Ogg page header and one for the page body.
*
* After initializing the instance, the client may feed audio data to the
* encoder in one of two ways:
* - Channel separate, through FLAC__stream_encoder_process() - The client
* will pass an array of pointers to buffers, one for each channel, to
* the encoder, each of the same length. The samples need not be
- * block-aligned.
+ * block-aligned, but each channel should have the same number of samples.
* - Channel interleaved, through
* FLAC__stream_encoder_process_interleaved() - The client will pass a single
* pointer to data that is channel-interleaved (i.e. channel0_sample0,
* sample-aligned, i.e. the first value should be channel0_sample0 and
* the last value channelN_sampleM.
*
+ * Note that for either process call, each sample in the buffers should be a
+ * signed integer, right-justified to the resolution set by
+ * FLAC__stream_encoder_set_bits_per_sample(). For example, if the resolution
+ * is 16 bits per sample, the samples should all be in the range [-32768,32767].
+ *
* When the client is finished encoding data, it calls
* FLAC__stream_encoder_finish(), which causes the encoder to encode any
* data still in its input pipe, and call the metadata callback with the
* \retval FLAC__StreamEncoder*
* \c NULL if there was an error allocating memory, else the new instance.
*/
-FLAC_API FLAC__StreamEncoder *FLAC__stream_encoder_new();
+FLAC_API FLAC__StreamEncoder *FLAC__stream_encoder_new(void);
/** Free an encoder instance. Deletes the object pointed to by \a encoder.
*
* <td>max residual partition order<td>
* <td>rice parameter search dist<td>
* </tr>
- * <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>2<td> <td>2<td> <td>0<td> </tr>
- * <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>2<td> <td>2<td> <td>0<td> </tr>
+ * <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>
+ * <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>
* <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>
- * <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>3<td> <td>3<td> <td>0<td> </tr>
- * <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>3<td> <td>3<td> <td>0<td> </tr>
- * <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>3<td> <td>3<td> <td>0<td> </tr>
- * <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>4<td> <td>0<td> </tr>
+ * <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>
+ * <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>
+ * <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>
+ * <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>
* <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>
* <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>
* </table>
*/
FLAC_API FLAC__bool FLAC__stream_encoder_set_loose_mid_side_stereo(FLAC__StreamEncoder *encoder, FLAC__bool value);
-/* @@@@add to unit tests*/
/** Sets the apodization function(s) the encoder will use when windowing
* audio data for LPC analysis.
*
* the encoder may need to change the \a is_last flag inside them, and
* in some cases update seek point offsets. Otherwise, the encoder will
* not modify or free the blocks. It is up to the caller to free the
- * metadata blocks after encoding.
+ * metadata blocks after encoding finishes.
*
* \note
- * The encoder stores only the \a metadata pointer; the passed-in array
- * must survive at least until after FLAC__stream_encoder_init_*() returns.
- * Do not modify the array or free the blocks until then.
+ * The encoder stores only copies of the pointers in the \a metadata array;
+ * the metadata blocks themselves must survive at least until after
+ * FLAC__stream_encoder_finish() returns. Do not free the blocks until then.
*
* \note
* The STREAMINFO block is always written and no STREAMINFO block may
* This version allows you to supply the input data via an array of
* pointers, each pointer pointing to an array of \a samples samples
* representing one channel. The samples need not be block-aligned,
- * but each channel should have the same number of samples.
+ * but each channel should have the same number of samples. Each sample
+ * should be a signed integer, right-justified to the resolution set by
+ * FLAC__stream_encoder_set_bits_per_sample(). For example, if the
+ * resolution is 16 bits per sample, the samples should all be in the
+ * range [-32768,32767].
*
* For applications where channel order is important, channels must
* follow the order as described in the
* channel1_sample0, ... , channelN_sample0, channel0_sample1, ...).
* The samples need not be block-aligned but they must be
* sample-aligned, i.e. the first value should be channel0_sample0
- * and the last value channelN_sampleM.
+ * and the last value channelN_sampleM. Each sample should be a signed
+ * integer, right-justified to the resolution set by
+ * FLAC__stream_encoder_set_bits_per_sample(). For example, if the
+ * resolution is 16 bits per sample, the samples should all be in the
+ * range [-32768,32767].
*
* For applications where channel order is important, channels must
* follow the order as described in the