libvorbisenc documentation | libvorbisenc release 1.1 - 20040709

# vorbis_encode_init

declared in "vorbis/libvorbisenc.h";

This is the primary function within libvorbisenc for setting up managed bitrate modes.

Before this function is called, the vorbis_info struct should be initialized by using vorbis_info_init() from the libvorbis API. After encoding, vorbis_info_clear should be called.

The max_bitrate, nominal_bitrate, and min_bitrate settings are used to set constraints for the encoded file. This function uses these settings to select the appropriate encoding mode and set it up.

    extern int vorbis_encode_init(vorbis_info *vi,
    			      long channels,
    			      long rate,

    			      long max_bitrate,
    			      long nominal_bitrate,
    			      long min_bitrate);

### Parameters

vi
  File pointer to an initialized vorbis_info struct.
channels
  The number of channels to be encoded.
rate
  The sampling rate of the source audio.
max_bitrate
  Desired maximum bitrate (limit). -1 indicates unset.
nominal_bitrate
  Desired average, or central, bitrate. -1 indicates unset.
min_bitrate
  Desired minimum bitrate. -1 indicates unset.

### Return Values

> - 0 for success
> - less than zero for failure:
> - OV_EFAULT - Internal logic fault; indicates a bug or heap/stack corruption.
> - OV_EINVAL - Invalid setup request, eg, out of range argument.
> - OV_EIMPL - Unimplemented mode; unable to comply with bitrate request.

copyright © 2004 xiph.org | Ogg Vorbis team@vorbis.org
libvorbisenc documentation | libvorbisenc release 1.1 - 20040709