SimpleOpusEncoder class

An easy to use implementation of OpusEncoder. Don't forget to call destroy once you are done with it.

All method calls in this calls allocate their own memory everytime they are called. See the BufferedOpusEncoder for an implementation with less allocation calls.

Inheritance

Constructors

SimpleOpusEncoder({required int sampleRate, required int channels, required Application application})
Creates an new SimpleOpusEncoder based on the sampleRate, channels and application type. See the matching fields for more information about these parameters.
factory

Properties

application Application
The kind of application for which this encoders output is used. Setting the right application type can increase quality of the encoded frames.
final
channels int
Number of channels, must be 1 for mono or 2 for stereo.
final
destroyed bool
Wheter this encoder was already destroyed by calling destroy. If so, calling any method will result in an OpusDestroyedError.
no setteroverride
hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
sampleRate int
The sample rate in Hz for this encoder. Opus supports sample rates from 8kHz to 48kHz so this value must be between 8000 and 48000.
final

Methods

destroy() → void
Destroys this encoder by releasing all native resources. After this, it is no longer possible to encode using this encoder, so any further method call will throw an OpusDestroyedError.
override
encode({required Int16List input, int maxOutputSizeBytes = maxDataBytes}) Uint8List
Encodes a frame of pcm data, stored as Int16List.
encodeFloat({required Float32List input, int maxOutputSizeBytes = maxDataBytes}) Uint8List
Encodes a frame of pcm data, stored as Float32List.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited