BASS_OPUS_StreamCreate

Creates a sample stream from raw Opus packets.

HSTREAM BASS_OPUS_StreamCreate(
    BASS_OPUS_HEAD *head,
    DWORD flags,
    STREAMPROC *proc,
    void *user
);

Parameters

headDecoder initialization parameters.
flagsA combination of these flags.
BASS_SAMPLE_FLOATUse 32-bit floating-point sample data. See Floating-point channels for info. If this flag is not specified, then the stream is 16-bit.
BASS_SAMPLE_3DEnable 3D functionality. The stream must be mono (chans=1). The SPEAKER flags cannot be used together with this flag.
BASS_STREAM_AUTOFREEAutomatically free the stream when playback ends.
BASS_STREAM_DECODEDecode the sample data, without playing it. Use BASS_ChannelGetData to retrieve decoded sample data. The BASS_SAMPLE_3D, BASS_STREAM_AUTOFREE and SPEAKER flags cannot be used together with this flag.
BASS_SPEAKER_xxxSpeaker assignment flags. These flags have no effect when the stream is more than stereo.
procThe user defined stream writing function, or one of the following.
STREAMPROC_PUSHCreate a "push" stream. Instead of BASSOPUS pulling data from a STREAMPROC function, data is pushed to BASSOPUS via BASS_OPUS_StreamPutData.
userUser instance data to pass to the callback function. Unused when creating a dummy or push stream.

Return value

If successful, the new stream's handle is returned, else 0 is returned. Use BASS_ErrorGetCode to get the error code.

Error codes

BASS_ERROR_INITBASS_Init has not been successfully called.
BASS_ERROR_ILLPARAMhead and/or proc is invalid.
BASS_ERROR_NOTAVAILThe BASS_STREAM_AUTOFREE flag cannot be combined with the BASS_STREAM_DECODE flag.
BASS_ERROR_FORMATThe sample format is not supported.
BASS_ERROR_SPEAKERThe specified SPEAKER flags are invalid.
BASS_ERROR_MEMThere is insufficent memory.
BASS_ERROR_NO3DCould not initialize 3D support.
BASS_ERROR_UNKNOWNSome other mystery problem!

Remarks

This function allows streaming of Opus packets without an Ogg container. When a STREAMPROC callback function is used, it should return one whole packet of data with each call, or 0 if there are none currently available. When STREAMPROC_PUSH is used, the packets should be provided via BASS_OPUS_StreamPutData. In both cases, the BASS_STREAMPROC_OPUS_LOSS value can be used to indicate a missing packet, which will activate packet loss concealment to fill the gap. FEC (Forward Error Correction) will be used when it has been enabled by the encoder.

To stream a standard Opus file, use BASS_OPUS_StreamCreateFile.

See also

BASS_OPUS_StreamCreateFile, BASS_OPUS_StreamCreateFileUser, BASS_OPUS_StreamCreateURL

BASS_ChannelGetInfo, BASS_ChannelGetLength, BASS_ChannelGetTags, BASS_ChannelPlay, BASS_ChannelSetAttribute, BASS_ChannelSetDSP, BASS_ChannelSetFX, BASS_StreamFree, BASS_StreamGetFilePosition