[][src]Function fdk_aac_sys::aacEncEncode

pub unsafe extern "C" fn aacEncEncode(
    hAacEncoder: HANDLE_AACENCODER,
    inBufDesc: *const AACENC_BufDesc,
    outBufDesc: *const AACENC_BufDesc,
    inargs: *const AACENC_InArgs,
    outargs: *mut AACENC_OutArgs
) -> AACENC_ERROR

\brief Encode audio data.

This function is mainly for encoding audio data. In addition the function can be used for an encoder (re)configuration process.

  • PCM input data will be retrieved from external input buffer until the fill level allows encoding a single frame. This functionality allows an external buffer with reduced size in comparison to the AAC or HE-AAC audio frame length.
  • If the value of the input samples argument is zero, just internal reinitialization will be applied if it is requested.
  • At the end of a file the flushing process can be triggerd via setting the value of the input samples argument to -1. The encoder delay lines are fully flushed when the encoder returns no valid bitstream data AACENC_OutArgs::numOutBytes. Furthermore the end of file is signaled by the return value AACENC_ENCODE_EOF.
  • If an error occured in the previous frame or any of the encoder parameters changed, an internal reinitialization process will be applied before encoding the incoming audio samples.
  • The function can also be used for an independent reconfiguration process without encoding. The first parameter has to be a valid encoder handle and all other parameters can be set to NULL.
  • If the size of the external bitbuffer in outBufDesc is not sufficient for writing the whole bitstream, an internal error will be the return value and a reconfiguration will be triggered.

\param hAacEncoder A valid AAC encoder handle. \param inBufDesc Input buffer descriptor, see AACENC_BufDesc: - At least one input buffer with audio data is expected. - Optionally a second input buffer with ancillary data can be fed. \param outBufDesc Output buffer descriptor, see AACENC_BufDesc: - Provide one output buffer for the encoded bitstream. \param inargs Input arguments, see AACENC_InArgs. \param outargs Output arguments, AACENC_OutArgs.

\return - AACENC_OK, on success. - AACENC_INVALID_HANDLE, AACENC_ENCODE_ERROR, on failure in encoding process. - AACENC_INVALID_CONFIG, AACENC_INIT_ERROR, AACENC_INIT_AAC_ERROR, AACENC_INIT_SBR_ERROR, AACENC_INIT_TP_ERROR, AACENC_INIT_META_ERROR, AACENC_INIT_MPS_ERROR, on failure in encoder initialization. - AACENC_UNSUPPORTED_PARAMETER, on incorrect input or output buffer descriptor initialization. - AACENC_ENCODE_EOF, when flushing fully concluded.