StreamOpusEncoder<T extends num> class
Used to encode a stream of pcm data to opus frames of constant time. Each StreamOpusEncoder MUST ONLY be used once!
The different constructors determine, how the input stream is interpreted, and of what type they have to be (Float32List, Int16List or Uint8List). If a TypeError occurs the stream you bound this transformer to is most likly not a Stream<Float32List>, Stream<Float32List> or Stream<Float32List>.
When using a Float32List set the instances type parameter T to double, otherwise (for Int16List or Uint8List) to int.
- Inheritance
-
- Object
- StreamTransformerBase<
List< T> , Uint8List> - StreamOpusEncoder
Constructors
- StreamOpusEncoder.bytes({required FrameTime frameTime, required bool floatInput, required int sampleRate, required int channels, required Application application, bool fillUpLastFrame = true, bool copyOutput = true})
-
Creates a new StreamOpusEncoder with
sampleRate
,channels
andapplication
type that expects its input Lists to be bytes in form of Uint8List. - StreamOpusEncoder.float({required FrameTime frameTime, required int sampleRate, required int channels, required Application application, bool fillUpLastFrame = true, bool copyOutput = true})
-
Creates a new StreamOpusEncoder with
sampleRate
,channels
andapplication
type that expects its input Lists to be Float32List. - StreamOpusEncoder.s16le({required FrameTime frameTime, required int sampleRate, required int channels, required Application application, bool fillUpLastFrame = true, bool copyOutput = true})
-
Creates a new StreamOpusEncoder with
sampleRate
,channels
andapplication
type that expects its input Lists to be Int16List.
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.
no setter
- channels → int
-
Number of channels, must be 1 for mono or 2 for stereo.
no setter
- copyOutput → bool
-
If
true
, the encoded output is copied into dart memory befor passig it to any consumers.final - fillUpLastFrame → bool
-
If the underlying stream is closed and this is
true
, the missing samples are filled up with zero to produce a final frame. If its set tofalse
, an UnfinishedFrameException is thrown instead.final - floats → bool
-
Indicates if the input data is interpreted as floats (
true
) or as s16le (false
).final - frameTime → FrameTime
-
The frames time determines, how much data need to be buffered before producing an encoded opus packet.
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 encoder.
Opus supports sample rates from 8kHz to 48kHz so this value must be between 8000 and 48000.
no setter
Methods
-
bind(
Stream< List< stream) → Stream<T> >Uint8List> -
Binds this stream to transfrom an other stream.
The runtime type of the input
stream
must be castable to either Stream<Float32List>, Stream<Int16List> or Stream<Uint8List> depending on what constructor was used or a TypeError will be thrown.override -
cast<
RS, RT> () → StreamTransformer< RS, RT> -
Provides a
StreamTransformer<RS, RT>
view of this stream transformer.inherited -
destroy(
) → void - Manually destroys this encoder. If it was bound, this should have happend automatically; then calling destory is a no-op.
-
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