#[non_exhaustive]pub enum Application {
Voip = 2_048,
Audio = 2_049,
RestrictedLowDelay = 2_051,
RestrictedSilk = 2_052,
RestrictedCelt = 2_053,
}Expand description
What an encoder is tuned for: libopus OPUS_APPLICATION_*, the
application argument of OpusEncoder::new.
Voip and Audio only steer the
encoder’s choices. The three restricted applications also limit them:
to CELT-only packets, or to SILK-only packets.
That limit holds for every packet that carries audio. A packet without
audio can name another mode in its TOC byte, as in libopus. The encoder
writes such a packet when there is no room to code the frame: the
output buffer has fewer than 3 bytes, or the bitrate gives fewer than 3
bytes per frame, or, for a frame of 40 ms or more, the bitrate is below
2400 b/s or the output buffer holds fewer than 300 bytes per second.
The packet is the TOC byte, with a frame count byte for some frames of
60 ms or more, padded when the bitrate is constant (libopus’s “PLC”
packet). libopus takes its mode from the last frame the encoder coded,
except that a frame shorter than 10 ms is marked CELT-only and a frame
of 60 ms or more in a 1-byte buffer SILK-only. Before the first coded
frame, and after reset_state, the last
mode is libopus’s initial one, Hybrid at fullband. So a restricted
encoder whose bitrate is too low to code any frame can write a TOC byte
that names Hybrid in every packet. A decoder conceals a packet without
audio like a lost one.
The number of each value is the libopus constant of the same name
(to_raw). More values may be added in a later release,
so a match on it needs a _ arm.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Voip = 2_048
libopus OPUS_APPLICATION_VOIP (2048): speech, for example in a
call. The encoder leans towards SILK and keeps speech intelligible.
Audio = 2_049
libopus OPUS_APPLICATION_AUDIO (2049): music and other audio that
should sound as close to the input as possible.
RestrictedLowDelay = 2_051
libopus OPUS_APPLICATION_RESTRICTED_LOWDELAY (2051): the lowest
delay. Every packet that carries audio is CELT-only (see above for
packets without audio), and the encoder has no 4 ms look-ahead.
RestrictedSilk = 2_052
libopus OPUS_APPLICATION_RESTRICTED_SILK (2052, new in libopus
1.6): every packet that carries audio is SILK-only, for a decoder
that only has SILK (see above for packets without audio).
- The bandwidth is at most wideband (8 kHz of audio), whatever is set.
- Frames are 10 ms or longer. An encode call with 2.5 or 5 ms is
refused with
BadArg. - The speech and music analysis does not run.
- The look-ahead (
OpusEncoder::lookahead) is 6.5 ms, as withVoipandAudio.
It can only be chosen when the encoder is created:
OpusEncoder::set_application refuses to change to it or from it.
RestrictedCelt = 2_053
libopus OPUS_APPLICATION_RESTRICTED_CELT (2053, new in libopus
1.6): every packet that carries audio is CELT-only, for a decoder
that only has CELT (see above for packets without audio).
The encoder codes as with RestrictedLowDelay:
the same packets, and no 4 ms look-ahead.
It can only be chosen when the encoder is created:
OpusEncoder::set_application refuses to change to it or from it.