Sets up an Opus encoder on a channel.
HENCODE BASS_Encode_OPUS_Start( DWORD handle, char *options, DWORD flags, ENCODEPROC *proc, void *user );
handle | The channel handle... a HSTREAM, HMUSIC, or HRECORD. |
options | Encoder options... NULL = use defaults. The following OPUSENC style options are supported: --bitrate, --vbr, --cvbr, --hard-cbr, --comp / --complexity, --framesize, --expect-loss, --max-delay, --comment, --artist, --title, --album, --tracknumber, --date, --genre, --picture, --padding, --serial, --set-ctl-int. See the OPUSENC documentation for details on the aforementioned options and defaults. Also available is a "--no-ogg" option to produce raw Opus packets without an Ogg container, a "--no-reorder" option to disable reordering channels to the Opus specification's order, and a "--mapping-255" option that does the same but also sets channel mapping family 255 to prevent reordering by decoders (in theory). Anything else that is included will be ignored. |
flags | The flags supported by BASS_Encode_StartUser may be used here, but the floating-point conversion flags are ignored. |
proc | Optional callback function to receive the encoded data... NULL = no callback. |
user | User instance data to pass to the callback function. |
BASS_ERROR_HANDLE | handle is not valid. |
BASS_ERROR_FORMAT | The channel's sample format is not supported by the encoder. |
BASS_ERROR_ILLPARAM | options contains an invalid setting. |
BASS_ERROR_FILEOPEN | A "--picture" option file could not be opened. |
BASS_ERROR_FILEFORM | A "--picture" option file has an invalid format. It needs to be JPEG, PNG, or GIF. |
BASS_ERROR_MEM | There is insufficient memory. |
BASS_ERROR_UNKNOWN | Some other mystery problem! |
Tags/comments should be in UTF-8 form. This function will take care of that when the BASS_UNICODE flag is used, but otherwise you will need to make sure that any tags included in options are UTF-8 (not ISO-8859-1/etc).
When the "--mapping-255" option is used, all of the source's channels will be encoded uncoupled (mono) by default, but a channel map may be provided to use instead of that, like this: "--mapping-255=map", where map is a comma-separated list of channel numbers (0 = first), with "+" indicating a coupling (stereo). For example: "--mapping-255=0+1,2+3,4,5" would mean that channels 0 and 1 are coupled, as are channels 2 and 3, while channels 4 and 5 are uncoupled. Note that coupled channels must be listed first.
When the "--no-ogg" option is used, the first callback of the ENCODEPROC function will receive an Ogg Opus Identification Header containing information for decoder initialization (see https://datatracker.ietf.org/doc/html/rfc7845.html#section-5.1 for details), and each subsequent callback will receive one packet of Opus data. The data can be decoded with the BASSOPUS add-on's BASS_OPUS_StreamCreate function, or the libOpus library functions directly. There is no metadata without the Ogg container, so these options will be ignored: --comment, --artist, --title, --album, --tracknumber, --date, --genre, --picture, --padding, --serial, --max-delay (the last 2 are not metadata but do only apply to Ogg). "--set-ctl-int 4012=1" may be used together with "--expect-loss" to enable FEC (Forward Error Correction) for improved sound quality when there are lost packets (if supported by the decoder).
BASS_Encode_CastInit, BASS_Encode_IsActive, BASS_Encode_ServerInit, BASS_Encode_SetNotify, BASS_Encode_SetPaused, BASS_Encode_Stop, BASS_Encode_Write, ENCODEPROC callback, BASS_CONFIG_ENCODE_PRIORITY