opusfile: OpusHead Struct Reference

| opusfile 0.12 Stand-alone decoder library for .opus files.

Data Fields
OpusHead Struct Reference

Ogg Opus bitstream information. More...

`#include <opusfile.h>`

## Data Fields
int | version
| The Ogg Opus format version, in the range 0...255. More...
int | channel_count
| The number of channels, in the range 1...255.
unsigned | pre_skip
| The number of samples that should be discarded from the beginning of the stream.
opus_uint32 | input_sample_rate
| The sampling rate of the original input. More...
int | output_gain
| The gain to apply to the decoded output, in dB, as a Q8 value in the range -32768...32767. More...
int | mapping_family
| The channel mapping family, in the range 0...255. More...
int | stream_count
| The number of Opus streams in each Ogg packet, in the range 1...255.
int | coupled_count
| The number of coupled Opus streams in each Ogg packet, in the range 0...127. More...
unsigned char | mapping [OPUS_CHANNEL_COUNT_MAX]
| The mapping from coded stream channels to output channels. More...

## Detailed Description

Ogg Opus bitstream information.

This contains the basic playback parameters for a stream, and corresponds to the initial ID header packet of an Ogg Opus stream.

## Field Documentation

## ◆ version

int OpusHead::version

The Ogg Opus format version, in the range 0...255.

The top 4 bits represent a "major" version, and the bottom four bits represent backwards-compatible "minor" revisions. The current specification describes version 1. This library will recognize versions up through 15 as backwards compatible with the current specification. An earlier draft of the specification described a version 0, but the only difference between version 1 and version 0 is that version 0 did not specify the semantics for handling the version field.

## ◆ input_sample_rate

opus_uint32 OpusHead::input_sample_rate

The sampling rate of the original input.

All Opus audio is coded at 48 kHz, and should also be decoded at 48 kHz for playback (unless the target hardware does not support this sampling rate). However, this field may be used to resample the audio back to the original sampling rate, for example, when saving the output to a file.

## ◆ output_gain

int OpusHead::output_gain

The gain to apply to the decoded output, in dB, as a Q8 value in the range -32768...32767.

The `libopusfile` API will automatically apply this gain to the decoded output before returning it, scaling it by `pow(10,output_gain/(20.0*256))`. You can adjust this behavior with op_set_gain_offset().

## ◆ mapping_family

int OpusHead::mapping_family

The channel mapping family, in the range 0...255.

Channel mapping family 0 covers mono or stereo in a single stream. Channel mapping family 1 covers 1 to 8 channels in one or more streams, using the Vorbis speaker assignments. Channel mapping family 255 covers 1 to 255 channels in one or more streams, but without any defined speaker assignment.

## ◆ coupled_count

int OpusHead::coupled_count

The number of coupled Opus streams in each Ogg packet, in the range 0...127.

This must satisfy `0 <= coupled_count <= stream_count` and `coupled_count + stream_count <= 255`. The coupled streams appear first, before all uncoupled streams, in an Ogg Opus packet.

## ◆ mapping

unsigned char OpusHead::mapping[OPUS_CHANNEL_COUNT_MAX]

The mapping from coded stream channels to output channels.

Let `index=mapping[k]` be the value for channel `k`. If `index<2*coupled_count`, then it refers to the left channel from stream `(index/2)` if even, and the right channel from stream `(index/2)` if odd. Otherwise, it refers to the output of the uncoupled stream `(index-coupled_count)`.

The documentation for this struct was generated from the following file:

- opusfile.h