Vixen
02b45cc4
csharp
public sealed class OpusAudioPacketDecoder

Opus, as a container's audio track rather than as a voice packet.

No guide page documents this yet — the page shows what the code says about itself.

Remarks

The adapter is the whole of it. Vixen.Audio.Codecs.OpusPacketDecoder already takes a packet and produces frames, which is exactly the shape a Matroska audio track needs — the codec and the container come from different places, which is the reason IAudioPacketDecoder exists at all. What this adds is the pre-skip, and the registration that makes MatroskaAudioStreamDecoder.TryOpen find it.

Why it is a separate assembly. The same argument Vixen.Audio.Codecs makes: a game whose only video is an uncompressed sting should not carry Concentus, so the module that reads containers registers nothing and the module that references a codec is the one you opt into. Vixen.Video would otherwise drag a general-purpose audio codec into every project that plays a logo.

Opus always decodes at 48 kHz, whatever the track's SamplingFrequency says. That element describes what was fed to the encoder and has no bearing on what comes out — a reader that resampled to honour it would be undoing nothing and costing a pass.

Fields and properties (4)

  • public const int MaximumFrames

    The largest frame count Concentus's decoder is asked to have room for.

  • public AudioFormat Format

    The rate and channel count it produces.

  • public int MaxFramesPerPacket

    The most frames one packet can turn into.

  • public int PreSkip

    How many frames of priming this stream declared.

Methods (5)

  • public OpusAudioPacketDecoder(in AudioTrackInfo track)

    Creates a decoder for a track.

  • public int Decode(ReadOnlySpan<byte> packet, Span<float> destination)
  • public void Reset()
  • public void Dispose()

    Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.

  • public static int PreSkipOf(in AudioTrackInfo track)

    How many frames of priming to discard, from whichever source stated it.

Used by (2)

  • OpusAudioPacketDecoderFactoryVixen.Video.Codecs
  • OpusAudioTrackTestsVixen.Video.Codecs.Tests