StreamOpusDecoder class
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.
If packet loss is reported forwardErrorCorrection might try to recover lost packages.
The different constructors determine, if the output stream is actually a stream of Float32List, Int16List or Uint8List, so it's safe to cast the resulting stream to the corresponding format.
- Inheritance
-
- Object
- StreamTransformerBase<
Uint8List?, List< num> > - StreamOpusDecoder
Constructors
- StreamOpusDecoder.bytes({required bool floatOutput, required int sampleRate, required int channels, bool forwardErrorCorrection = false, bool copyOutput = true, bool autoSoftClip = false})
-
Creates a new StreamOpusDecoder with
sampleRate
andchannels
that outputs plain bytes (in form of Uint8List), so it's safe to cast the output stream. - StreamOpusDecoder.float({required int sampleRate, required int channels, bool forwardErrorCorrection = false, bool copyOutput = true, bool autoSoftClip = false})
-
Creates a new StreamOpusDecoder with
sampleRate
andchannels
that outputs Float32List, so it's safe to cast the output stream. - StreamOpusDecoder.s16le({required int sampleRate, required int channels, bool forwardErrorCorrection = false, bool copyOutput = true})
-
Creates a new StreamOpusDecoder with
sampleRate
andchannels
that outputs Int16List, so it's safe to cast the output stream.
Properties
- autoSoftClip → bool
-
If the packet is decoded to floats, autoSoftClip can be set to
true
to perform sofclipping right after decoding without additional memory copying.final - channels → int
-
Number of channels, must be 1 for mono or 2 for stereo.
no setter
- copyOutput → bool
-
If
true
, the decoded output is copied into dart memory befor passig it to any consumers.final - floats → bool
-
Indicates if the input data is decoded to floats (
true
) or to s16le (false
).final - forwardErrorCorrection → bool
-
If forward error correction (fec) should be enabled.
final
- 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 decoder.
Opus supports sample rates from 8kHz to 48kHz so this value must be between 8000 and 48000.
no setter
Methods
-
bind(
Stream< Uint8List?> stream) → Stream<List< num> > -
Binds this stream to transfrom an other stream.
A
null
element in the input stream is interpreted as packet loss.override -
cast<
RS, RT> () → StreamTransformer< RS, RT> -
Provides a
StreamTransformer<RS, RT>
view of this stream transformer.inherited -
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