opus_dart library
A dart friendly api for encoding and decoding opus packets. Must be initalized using the initOpus function.
Classes
- BufferedOpusDecoder
- An implementation of OpusDecoder that uses preallocated buffers. Don't forget to call destroy once you are done with it.
- BufferedOpusEncoder
- An implementation of OpusEncoder that uses preallocated buffers. Don't forget to call destroy once you are done with it.
- OpusDecoder
- Abstract base class for opus decoders.
- OpusEncoder
- Abstract base class for opus encoders.
- OpusPacketUtils
- Bundles utility functions to examin opus packets.
- SimpleOpusDecoder
- An easy to use implementation of OpusDecoder. Don't forget to call destroy once you are done with it.
- SimpleOpusEncoder
- An easy to use implementation of OpusEncoder. Don't forget to call destroy once you are done with it.
- StreamOpusDecoder
-
Used to decode a stream of opus packets to pcm data.
Each element in the input stream MUST contain a whole opus packet.
Each StreamOpusEncoder MUST ONLY be used once!
A
null
element in the input stream is interpreted as packet loss. -
StreamOpusEncoder<
T extends num> - Used to encode a stream of pcm data to opus frames of constant time. Each StreamOpusEncoder MUST ONLY be used once!
Enums
- Application
- Represents the different apllication types an OpusEncoder supports. Setting the right apllication type when creating an encoder can improve quality.
- FrameTime
- Represents different frame times supported by opus.
Constants
- maxDataBytes → const int
- Max bitstream size of a single opus packet.
Functions
-
getOpusVersion(
) → String - Returns the version of the native libopus library.
-
initOpus(
DynamicLibrary opusLib) → void - Must be called to initalize this library.
-
maxSamplesPerPacket(
int sampleRate, int channels) → int -
Calculates, how much sampels a single opus package at
sampleRate
withchannels
may contain. -
pcmSoftClip(
{required Float32List input, required int channels}) → Float32List -
Soft clips the
input
to a range from -1 to 1 and returns the result.
Exceptions / Errors
- OpusDestroyedError
- Thrown when attempting to call an method on an already destroyed encoder or decoder.
- OpusException
- Thrown when a native exception occurs.
- UnfinishedFrameException
- Thrown if an StreamOpusEncoder finished with insufficient samples left to produce a final frame.