BASS_OPUS_StreamPutData

Adds a packet to a "push" raw Opus stream.

DWORD BASS_OPUS_StreamPutData(
    HSTREAM handle,
    void *buffer,
    DWORD length
);

Parameters

handleThe stream handle.
bufferPointer to the packet data.
lengthThe amount of data in bytes, optionally using the BASS_STREAMPROC_END flag to signify the end of the stream. BASS_STREAMPROC_OPUS_LOSS can be used to signify a missing packet. 0 can be used to just check how many packets are queued.

Return value

If successful, the number of packets currently queued is returned, else -1 is returned. Use BASS_ErrorGetCode to get the error code.

Error codes

BASS_ERROR_HANDLEhandle is not valid.
BASS_ERROR_NOTAVAILThe stream is not using the push system.
BASS_ERROR_ILLPARAMlength is not valid.
BASS_ERROR_ENDEDThe stream has ended.
BASS_ERROR_MEMThere is insufficient memory.

Remarks

One whole packet of Opus data should be provided in each call. The packets will remain queued until needed by the decoder. By default, there is no limit to the number of packets that can be queued (besides available memory), but that can be changed via the BASS_ATTRIB_PUSH_LIMIT attribute (note the limit is in packets, not bytes). The queue is cleared when the stream is reset, eg. via BASS_ChannelPlay (restart = TRUE) or BASS_ChannelSetPosition (pos = 0).

When the BASS_STREAMPROC_OPUS_LOSS value is used to indicate a missing packet, packet loss concealment will be activated to fill the gap.

See also

BASS_OPUS_StreamCreate