libvorbis documentation | libvorbis version 1.3.2 - 20101101

# vorbis_analysis

declared in "vorbis/codec.h";

Once the uncompressed audio data has been divided into blocks, this function is called on each block. It looks up the encoding mode and dispatches the block to the forward transform provided by that mode.

When using a basic encoding mode, with no bitrate management, an ogg_packet pointer can be given, and the coded block is returned directly through that structure and can be placed in the output stream.

Otherwise, NULL should be passed for the ogg_packet pointer. In that case, after the transform has been applied, the block must passed to vorbis_bitrate_addblock() for further coding. This method works with both basic and managed encoding modes, so it's recommended for new code.

    extern int      vorbis_analysis(vorbis_block *vb,ogg_packet *op);

### Parameters

vb
  Pointer to the vorbis_block to be encoded.
op
  Optional pointer to an ogg_packet. This is normally NULL, and the final output is obtained by passing vb though the vorbis_bitrate_*() interface to perform further refinement. However, when not using a bitrate managed encoding mode, it is possible to skip that step by providing an ogg_packet pointer here, obtaining the compressed data directly.

### Return Values

- 0 for success
- negative values for failure:
  - OV_EINVAL - Invalid request; a non-NULL value was passed for op when the encoder is using a bitrate managed mode.
  - OV_EFAULT - Internal fault; indicates a bug or memory corruption.
  - OV_EIMPL - Unimplemented; not supported by this version of the library.

copyright © 2010 Xiph.Org | Ogg Vorbis
libvorbis documentation | libvorbis version 1.3.2 - 20101101