⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 stream_encoder.h

📁 在x86平台上运行不可信任代码的sandbox。
💻 H
📖 第 1 页 / 共 3 页
字号:
/*********************************************************************** * * Class constructor/destructor * ***********************************************************************//** Create a new stream encoder instance.  The instance is created with *  default settings; see the individual FLAC__stream_encoder_set_*() *  functions for each setting's default. * * \retval FLAC__StreamEncoder* *    \c NULL if there was an error allocating memory, else the new instance. */FLAC_API FLAC__StreamEncoder *FLAC__stream_encoder_new();/** Free an encoder instance.  Deletes the object pointed to by \a encoder. * * \param encoder  A pointer to an existing encoder. * \assert *    \code encoder != NULL \endcode */FLAC_API void FLAC__stream_encoder_delete(FLAC__StreamEncoder *encoder);/*********************************************************************** * * Public class method prototypes * ***********************************************************************//** Set the "verify" flag.  If \c true, the encoder will verify it's own *  encoded output by feeding it through an internal decoder and comparing *  the original signal against the decoded signal.  If a mismatch occurs, *  the process call will return \c false.  Note that this will slow the *  encoding process by the extra time required for decoding and comparison. * * \default \c false * \param  encoder  An encoder instance to set. * \param  value    Flag value (see above). * \assert *    \code encoder != NULL \endcode * \retval FLAC__bool *    \c false if the encoder is already initialized, else \c true. */FLAC_API FLAC__bool FLAC__stream_encoder_set_verify(FLAC__StreamEncoder *encoder, FLAC__bool value);/** Set the "streamable subset" flag.  If \c true, the encoder will comply *  with the subset (see the format specification) and will check the *  settings during FLAC__stream_encoder_init() to see if all settings *  comply.  If \c false, the settings may take advantage of the full *  range that the format allows. * *  Make sure you know what it entails before setting this to \c false. * * \default \c true * \param  encoder  An encoder instance to set. * \param  value    Flag value (see above). * \assert *    \code encoder != NULL \endcode * \retval FLAC__bool *    \c false if the encoder is already initialized, else \c true. */FLAC_API FLAC__bool FLAC__stream_encoder_set_streamable_subset(FLAC__StreamEncoder *encoder, FLAC__bool value);/** Set to \c true to enable mid-side encoding on stereo input.  The *  number of channels must be 2.  Set to \c false to use only *  independent channel coding. * * \default \c false * \param  encoder  An encoder instance to set. * \param  value    Flag value (see above). * \assert *    \code encoder != NULL \endcode * \retval FLAC__bool *    \c false if the encoder is already initialized, else \c true. */FLAC_API FLAC__bool FLAC__stream_encoder_set_do_mid_side_stereo(FLAC__StreamEncoder *encoder, FLAC__bool value);/** Set to \c true to enable adaptive switching between mid-side and *  left-right encoding on stereo input.  The number of channels must *  be 2.  Set to \c false to use exhaustive searching.  In either *  case, the mid/side stereo setting must be \c true. * * \default \c false * \param  encoder  An encoder instance to set. * \param  value    Flag value (see above). * \assert *    \code encoder != NULL \endcode * \retval FLAC__bool *    \c false if the encoder is already initialized, else \c true. */FLAC_API FLAC__bool FLAC__stream_encoder_set_loose_mid_side_stereo(FLAC__StreamEncoder *encoder, FLAC__bool value);/** Set the number of channels to be encoded. * * \default \c 2 * \param  encoder  An encoder instance to set. * \param  value    See above. * \assert *    \code encoder != NULL \endcode * \retval FLAC__bool *    \c false if the encoder is already initialized, else \c true. */FLAC_API FLAC__bool FLAC__stream_encoder_set_channels(FLAC__StreamEncoder *encoder, unsigned value);/** Set the sample resolution of the input to be encoded. * * \warning * Do not feed the encoder data that is wider than the value you * set here or you will generate an invalid stream. * * \default \c 16 * \param  encoder  An encoder instance to set. * \param  value    See above. * \assert *    \code encoder != NULL \endcode * \retval FLAC__bool *    \c false if the encoder is already initialized, else \c true. */FLAC_API FLAC__bool FLAC__stream_encoder_set_bits_per_sample(FLAC__StreamEncoder *encoder, unsigned value);/** Set the sample rate (in Hz) of the input to be encoded. * * \default \c 44100 * \param  encoder  An encoder instance to set. * \param  value    See above. * \assert *    \code encoder != NULL \endcode * \retval FLAC__bool *    \c false if the encoder is already initialized, else \c true. */FLAC_API FLAC__bool FLAC__stream_encoder_set_sample_rate(FLAC__StreamEncoder *encoder, unsigned value);/** Set the blocksize to use while encoding. * * \default \c 1152 * \param  encoder  An encoder instance to set. * \param  value    See above. * \assert *    \code encoder != NULL \endcode * \retval FLAC__bool *    \c false if the encoder is already initialized, else \c true. */FLAC_API FLAC__bool FLAC__stream_encoder_set_blocksize(FLAC__StreamEncoder *encoder, unsigned value);/** Set the maximum LPC order, or \c 0 to use only the fixed predictors. * * \default \c 0 * \param  encoder  An encoder instance to set. * \param  value    See above. * \assert *    \code encoder != NULL \endcode * \retval FLAC__bool *    \c false if the encoder is already initialized, else \c true. */FLAC_API FLAC__bool FLAC__stream_encoder_set_max_lpc_order(FLAC__StreamEncoder *encoder, unsigned value);/** Set the precision, in bits, of the quantized linear predictor *  coefficients, or \c 0 to let the encoder select it based on the *  blocksize. * * \note * In the current implementation, qlp_coeff_precision + bits_per_sample must * be less than 32. * * \default \c 0 * \param  encoder  An encoder instance to set. * \param  value    See above. * \assert *    \code encoder != NULL \endcode * \retval FLAC__bool *    \c false if the encoder is already initialized, else \c true. */FLAC_API FLAC__bool FLAC__stream_encoder_set_qlp_coeff_precision(FLAC__StreamEncoder *encoder, unsigned value);/** Set to \c false to use only the specified quantized linear predictor *  coefficient precision, or \c true to search neighboring precision *  values and use the best one. * * \default \c false * \param  encoder  An encoder instance to set. * \param  value    See above. * \assert *    \code encoder != NULL \endcode * \retval FLAC__bool *    \c false if the encoder is already initialized, else \c true. */FLAC_API FLAC__bool FLAC__stream_encoder_set_do_qlp_coeff_prec_search(FLAC__StreamEncoder *encoder, FLAC__bool value);/** Deprecated.  Setting this value has no effect. * * \default \c false * \param  encoder  An encoder instance to set. * \param  value    See above. * \assert *    \code encoder != NULL \endcode * \retval FLAC__bool *    \c false if the encoder is already initialized, else \c true. */FLAC_API FLAC__bool FLAC__stream_encoder_set_do_escape_coding(FLAC__StreamEncoder *encoder, FLAC__bool value);/** Set to \c false to let the encoder estimate the best model order *  based on the residual signal energy, or \c true to force the *  encoder to evaluate all order models and select the best. * * \default \c false * \param  encoder  An encoder instance to set. * \param  value    See above. * \assert *    \code encoder != NULL \endcode * \retval FLAC__bool *    \c false if the encoder is already initialized, else \c true. */FLAC_API FLAC__bool FLAC__stream_encoder_set_do_exhaustive_model_search(FLAC__StreamEncoder *encoder, FLAC__bool value);/** Set the minimum partition order to search when coding the residual. *  This is used in tandem with *  FLAC__stream_encoder_set_max_residual_partition_order(). * *  The partition order determines the context size in the residual. *  The context size will be approximately <tt>blocksize / (2 ^ order)</tt>. * *  Set both min and max values to \c 0 to force a single context, *  whose Rice parameter is based on the residual signal variance. *  Otherwise, set a min and max order, and the encoder will search *  all orders, using the mean of each context for its Rice parameter, *  and use the best. * * \default \c 0 * \param  encoder  An encoder instance to set. * \param  value    See above. * \assert *    \code encoder != NULL \endcode * \retval FLAC__bool *    \c false if the encoder is already initialized, else \c true. */FLAC_API FLAC__bool FLAC__stream_encoder_set_min_residual_partition_order(FLAC__StreamEncoder *encoder, unsigned value);/** Set the maximum partition order to search when coding the residual. *  This is used in tandem with *  FLAC__stream_encoder_set_min_residual_partition_order(). * *  The partition order determines the context size in the residual. *  The context size will be approximately <tt>blocksize / (2 ^ order)</tt>. * *  Set both min and max values to \c 0 to force a single context, *  whose Rice parameter is based on the residual signal variance. *  Otherwise, set a min and max order, and the encoder will search *  all orders, using the mean of each context for its Rice parameter, *  and use the best. * * \default \c 0 * \param  encoder  An encoder instance to set. * \param  value    See above. * \assert *    \code encoder != NULL \endcode * \retval FLAC__bool *    \c false if the encoder is already initialized, else \c true. */FLAC_API FLAC__bool FLAC__stream_encoder_set_max_residual_partition_order(FLAC__StreamEncoder *encoder, unsigned value);/** Deprecated.  Setting this value has no effect. * * \default \c 0 * \param  encoder  An encoder instance to set. * \param  value    See above. * \assert *    \code encoder != NULL \endcode * \retval FLAC__bool *    \c false if the encoder is already initialized, else \c true. */FLAC_API FLAC__bool FLAC__stream_encoder_set_rice_parameter_search_dist(FLAC__StreamEncoder *encoder, unsigned value);/** Set an estimate of the total samples that will be encoded. *  This is merely an estimate and may be set to \c 0 if unknown. *  This value will be written to the STREAMINFO block before encoding, *  and can remove the need for the caller to rewrite the value later *  if the value is known before encoding. * * \default \c 0 * \param  encoder  An encoder instance to set. * \param  value    See above. * \assert *    \code encoder != NULL \endcode * \retval FLAC__bool *    \c false if the encoder is already initialized, else \c true. */FLAC_API FLAC__bool FLAC__stream_encoder_set_total_samples_estimate(FLAC__StreamEncoder *encoder, FLAC__uint64 value);/** Set the metadata blocks to be emitted to the stream before encoding. *  A value of \c NULL, \c 0 implies no metadata; otherwise, supply an *  array of pointers to metadata blocks.  The array is non-const since *  the encoder may need to change the \a is_last flag inside them. *  Otherwise, the encoder will not modify or free the blocks.  It is up *  to the caller to free the metadata blocks after encoding. * * \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. * * \note * The STREAMINFO block is always written and no STREAMINFO block may * occur in the supplied array. * * \note * By default the encoder does not create a SEEKTABLE.  If one is supplied * in the \a metadata array it will be written verbatim.  However by itself * this is not very useful as the user will not know the stream offsets for * the seekpoints ahead of time.  You must use the seekable stream encoder * to generate a legal seektable * (see FLAC__seekable_stream_encoder_set_metadata()) * * \note * A VORBIS_COMMENT block may be supplied.  The vendor string in it * will be ignored.  libFLAC will use it's own vendor string. libFLAC * will not modify the passed-in VORBIS_COMMENT's vendor string, it * will simply write it's own into the stream.  If no VORBIS_COMMENT * block is present in the \a metadata array, libFLAC will write an * empty one, containing only the vendor string. * * \default \c NULL, 0 * \param  encoder     An encoder instance to set. * \param  metadata    See above. * \param  num_blocks  See above. * \assert *    \code encoder != NULL \endcode * \retval FLAC__bool *    \c false if the encoder is already initialized, else \c true. */FLAC_API FLAC__bool FLAC__stream_encoder_set_metadata(FLAC__StreamEncoder *encoder, FLAC__StreamMetadata **metadata, unsigned num_blocks);/** Set the write callback. *  The supplied function will be called by the encoder anytime there is raw *  encoded data ready to write.  It may include metadata mixed with encoded *  audio frames and the data is not guaranteed to be aligned on frame or *  metadata block boundaries. * *  The only duty of the callback is to write out the \a bytes worth of data *  in \a buffer to the current position in the output stream.  The arguments *  \a samples and \a current_frame are purely informational.  If \a samples *  is greater than \c 0, then \a current_frame will hold the current frame *  number that is being written; otherwise, the write callback is being called *  to write metadata. * * \note * The callback is mandatory and must be set before initialization. * * \default \c NULL * \param  encoder  An encoder instance to set. * \param  value    See above. * \assert *    \code encoder != NULL \endcode *    \code value != NULL \endcode * \retval FLAC__bool

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -