opus_multistream(3) Opus opus_multistream(3) NNAAMMEE opus_multistream - The multistream API allows individual Opus streams to be combined into a single packet, enabling support for up to 255 channels. SSYYNNOOPPSSIISS TTyyppeeddeeffss typedef struct OOppuussMMSSEEnnccooddeerr OOppuussMMSSEEnnccooddeerr Opus multistream encoder state. typedef struct OOppuussMMSSDDeeccooddeerr OOppuussMMSSDDeeccooddeerr Opus multistream decoder state. MMuullttiissttrreeaamm eennccooddeerr ffuunnccttiioonnss ooppuuss__iinntt3322 ooppuuss__mmuullttiissttrreeaamm__eennccooddeerr__ggeett__ssiizzee (int streams, int coupled_streams) Gets the size of an OpusMSEncoder structure. ooppuuss__iinntt3322 ooppuuss__mmuullttiissttrreeaamm__ssuurrrroouunndd__eennccooddeerr__ggeett__ssiizzee (int channels, int mapping_family) OOppuussMMSSEEnnccooddeerr * ooppuuss__mmuullttiissttrreeaamm__eennccooddeerr__ccrreeaattee (ooppuuss__iinntt3322 Fs, int channels, int streams, int coupled_streams, const unsigned char *mapping, int application, int *error) Allocates and initializes a multistream encoder state. OOppuussMMSSEEnnccooddeerr * ooppuuss__mmuullttiissttrreeaamm__ssuurrrroouunndd__eennccooddeerr__ccrreeaattee (ooppuuss__iinntt3322 Fs, int channels, int mapping_family, int *streams, int *coupled_streams, unsigned char *mapping, int application, int *error) int ooppuuss__mmuullttiissttrreeaamm__eennccooddeerr__iinniitt (OOppuussMMSSEEnnccooddeerr *st, ooppuuss__iinntt3322 Fs, int channels, int streams, int coupled_streams, const unsigned char *mapping, int application) Initialize a previously allocated multistream encoder state. int ooppuuss__mmuullttiissttrreeaamm__ssuurrrroouunndd__eennccooddeerr__iinniitt (OOppuussMMSSEEnnccooddeerr *st, ooppuuss__iinntt3322 Fs, int channels, int mapping_family, int *streams, int *coupled_streams, unsigned char *mapping, int application) int ooppuuss__mmuullttiissttrreeaamm__eennccooddee (OOppuussMMSSEEnnccooddeerr *st, const ooppuuss__iinntt1166 *pcm, int frame_size, unsigned char *data, ooppuuss__iinntt3322 max_data_bytes) Encodes a multistream Opus frame. int ooppuuss__mmuullttiissttrreeaamm__eennccooddee__ffllooaatt (OOppuussMMSSEEnnccooddeerr *st, const float *pcm, int frame_size, unsigned char *data, ooppuuss__iinntt3322 max_data_bytes) Encodes a multistream Opus frame from floating point input. void ooppuuss__mmuullttiissttrreeaamm__eennccooddeerr__ddeessttrrooyy (OOppuussMMSSEEnnccooddeerr *st) Frees an OpusMSEncoder allocated by ooppuuss__mmuullttiissttrreeaamm__eennccooddeerr__ccrreeaattee(()). int ooppuuss__mmuullttiissttrreeaamm__eennccooddeerr__ccttll (OOppuussMMSSEEnnccooddeerr *st, int request,...) Perform a CTL function on a multistream Opus encoder. MMuullttiissttrreeaamm ddeeccooddeerr ffuunnccttiioonnss ooppuuss__iinntt3322 ooppuuss__mmuullttiissttrreeaamm__ddeeccooddeerr__ggeett__ssiizzee (int streams, int coupled_streams) Gets the size of an OpusMSDecoder structure. OOppuussMMSSDDeeccooddeerr * ooppuuss__mmuullttiissttrreeaamm__ddeeccooddeerr__ccrreeaattee (ooppuuss__iinntt3322 Fs, int channels, int streams, int coupled_streams, const unsigned char *mapping, int *error) Allocates and initializes a multistream decoder state. int ooppuuss__mmuullttiissttrreeaamm__ddeeccooddeerr__iinniitt (OOppuussMMSSDDeeccooddeerr *st, ooppuuss__iinntt3322 Fs, int channels, int streams, int coupled_streams, const unsigned char *mapping) Intialize a previously allocated decoder state object. int ooppuuss__mmuullttiissttrreeaamm__ddeeccooddee (OOppuussMMSSDDeeccooddeerr *st, const unsigned char *data, ooppuuss__iinntt3322 len, ooppuuss__iinntt1166 *pcm, int frame_size, int decode_fec) Decode a multistream Opus packet. int ooppuuss__mmuullttiissttrreeaamm__ddeeccooddee__ffllooaatt (OOppuussMMSSDDeeccooddeerr *st, const unsigned char *data, ooppuuss__iinntt3322 len, float *pcm, int frame_size, int decode_fec) Decode a multistream Opus packet with floating point output. int ooppuuss__mmuullttiissttrreeaamm__ddeeccooddeerr__ccttll (OOppuussMMSSDDeeccooddeerr *st, int request,...) Perform a CTL function on a multistream Opus decoder. void ooppuuss__mmuullttiissttrreeaamm__ddeeccooddeerr__ddeessttrrooyy (OOppuussMMSSDDeeccooddeerr *st) Frees an OpusMSDecoder allocated by ooppuuss__mmuullttiissttrreeaamm__ddeeccooddeerr__ccrreeaattee(()). DDeettaaiilleedd DDeessccrriippttiioonn The multistream API allows individual Opus streams to be combined into a single packet, enabling support for up to 255 channels. Unlike an elementary Opus stream, the encoder and decoder must negotiate the channel configuration before the decoder can successfully interpret the data in the packets produced by the encoder. Some basic information, such as packet duration, can be computed without any special negotiation. The format for multistream Opus packets is defined in RFC 7845 and is based on the self-delimited Opus framing described in Appendix B of RFC 6716. Normal Opus packets are just a degenerate case of multistream Opus packets, and can be encoded or decoded with the multistream API by setting streams to 1 when initializing the encoder or decoder. Multistream Opus streams can contain up to 255 elementary Opus streams. These may be either 'uncoupled' or 'coupled', indicating that the decoder is configured to decode them to either 1 or 2 channels, respectively. The streams are ordered so that all coupled streams appear at the beginning. A mapping table defines which decoded channel i should be used for each input/output (I/O) channel j. This table is typically provided as an unsigned char array. Let i = mapping[j] be the index for I/O channel j. If i < 2*coupled_streams, then I/O channel j is encoded as the left channel of stream (i/2) if i is even, or as the right channel of stream (i/2) if i is odd. Otherwise, I/O channel j is encoded as mono in stream (i - coupled_streams), unless it has the special value 255, in which case it is omitted from the encoding entirely (the decoder will reproduce it as silence). Each value i must either be the special value 255 or be less than streams + coupled_streams. The output channels specified by the encoder should use the Vorbis channel ordering. A decoder may wish to apply an additional permutation to the mapping the encoder used to achieve a different output channel order (e.g. for outputing in WAV order). Each multistream packet contains an Opus packet for each stream, and all of the Opus packets in a single multistream packet must have the same duration. Therefore the duration of a multistream packet can be extracted from the TOC sequence of the first stream, which is located at the beginning of the packet, just like an elementary Opus stream: int nb_samples; int nb_frames; nb_frames = opus_packet_get_nb_frames(data, len); if (nb_frames < 1) return nb_frames; nb_samples = opus_packet_get_samples_per_frame(data, 48000) * nb_frames; The general encoding and decoding process proceeds exactly the same as in the normal OOppuuss EEnnccooddeerr and OOppuuss DDeeccooddeerr APIs. See their documentation for an overview of how to use the corresponding multistream functions. TTyyppeeddeeff DDooccuummeennttaattiioonn ttyyppeeddeeff ssttrruucctt OOppuussMMSSDDeeccooddeerr OOppuussMMSSDDeeccooddeerr Opus multistream decoder state. This contains the complete state of a multistream Opus decoder. It is position independent and can be freely copied. SSeeee aallssoo:: ooppuuss__mmuullttiissttrreeaamm__ddeeccooddeerr__ccrreeaattee ooppuuss__mmuullttiissttrreeaamm__ddeeccooddeerr__iinniitt ttyyppeeddeeff ssttrruucctt OOppuussMMSSEEnnccooddeerr OOppuussMMSSEEnnccooddeerr Opus multistream encoder state. This contains the complete state of a multistream Opus encoder. It is position independent and can be freely copied. SSeeee aallssoo:: ooppuuss__mmuullttiissttrreeaamm__eennccooddeerr__ccrreeaattee ooppuuss__mmuullttiissttrreeaamm__eennccooddeerr__iinniitt FFuunnccttiioonn DDooccuummeennttaattiioonn iinntt ooppuuss__mmuullttiissttrreeaamm__ddeeccooddee ((OOppuussMMSSDDeeccooddeerr ** sstt,, ccoonnsstt uunnssiiggnneedd cchhaarr ** ddaattaa,, ooppuuss__iinntt3322 lleenn,, ooppuuss__iinntt1166 ** ppccmm,, iinntt ffrraammee__ssiizzee,, iinntt ddeeccooddee__ffeecc)) Decode a multistream Opus packet. PPaarraammeetteerrss:: _s_t OpusMSDecoder*: Multistream decoder state. _d_a_t_a const unsigned char*: Input payload. Use a NULL pointer to indicate packet loss. _l_e_n opus_int32: Number of bytes in payload. _p_c_m opus_int16*: Output signal, with interleaved samples. This must contain room for frame_size*channels samples. _f_r_a_m_e___s_i_z_e int: The number of samples per channel of available space in _p_c_m. If this is less than the maximum packet duration (120 ms; 5760 for 48kHz), this function will not be capable of decoding some packets. In the case of PLC (data==NULL) or FEC (decode_fec=1), then frame_size needs to be exactly the duration of audio that is missing, otherwise the decoder will not be in the optimal state to decode the next incoming packet. For the PLC and FEC cases, frame_size mmuusstt be a multiple of 2.5 ms. _d_e_c_o_d_e___f_e_c int: Flag (0 or 1) to request that any in-band forward error correction data be decoded. If no such data is available, the frame is decoded as if it were lost. RReettuurrnnss:: Number of samples decoded on success or a negative error code (see EErrrroorr ccooddeess) on failure. iinntt ooppuuss__mmuullttiissttrreeaamm__ddeeccooddee__ffllooaatt ((OOppuussMMSSDDeeccooddeerr ** sstt,, ccoonnsstt uunnssiiggnneedd cchhaarr ** ddaattaa,, ooppuuss__iinntt3322 lleenn,, ffllooaatt ** ppccmm,, iinntt ffrraammee__ssiizzee,, iinntt ddeeccooddee__ffeecc)) Decode a multistream Opus packet with floating point output. PPaarraammeetteerrss:: _s_t OpusMSDecoder*: Multistream decoder state. _d_a_t_a const unsigned char*: Input payload. Use a NULL pointer to indicate packet loss. _l_e_n opus_int32: Number of bytes in payload. _p_c_m opus_int16*: Output signal, with interleaved samples. This must contain room for frame_size*channels samples. _f_r_a_m_e___s_i_z_e int: The number of samples per channel of available space in _p_c_m. If this is less than the maximum packet duration (120 ms; 5760 for 48kHz), this function will not be capable of decoding some packets. In the case of PLC (data==NULL) or FEC (decode_fec=1), then frame_size needs to be exactly the duration of audio that is missing, otherwise the decoder will not be in the optimal state to decode the next incoming packet. For the PLC and FEC cases, frame_size mmuusstt be a multiple of 2.5 ms. _d_e_c_o_d_e___f_e_c int: Flag (0 or 1) to request that any in-band forward error correction data be decoded. If no such data is available, the frame is decoded as if it were lost. RReettuurrnnss:: Number of samples decoded on success or a negative error code (see EErrrroorr ccooddeess) on failure. OOppuussMMSSDDeeccooddeerr** ooppuuss__mmuullttiissttrreeaamm__ddeeccooddeerr__ccrreeaattee ((ooppuuss__iinntt3322 FFss,, iinntt cchhaannnneellss,, iinntt ssttrreeaammss,, iinntt ccoouupplleedd__ssttrreeaammss,, ccoonnsstt uunnssiiggnneedd cchhaarr ** mmaappppiinngg,, iinntt ** eerrrroorr)) Allocates and initializes a multistream decoder state. Call ooppuuss__mmuullttiissttrreeaamm__ddeeccooddeerr__ddeessttrrooyy(()) to release this object when finished. PPaarraammeetteerrss:: _F_s opus_int32: Sampling rate to decode at (in Hz). This must be one of 8000, 12000, 16000, 24000, or 48000. _c_h_a_n_n_e_l_s int: Number of channels to output. This must be at most 255. It may be different from the number of coded channels (streams + coupled_streams). _s_t_r_e_a_m_s int: The total number of streams coded in the input. This must be no more than 255. _c_o_u_p_l_e_d___s_t_r_e_a_m_s int: Number of streams to decode as coupled (2 channel) streams. This must be no larger than the total number of streams. Additionally, The total number of coded channels (streams + coupled_streams) must be no more than 255. _m_a_p_p_i_n_g const unsigned char[channels]: Mapping from coded channels to output channels, as described in OOppuuss MMuullttiissttrreeaamm AAPPII. _e_r_r_o_r int *: Returns OOPPUUSS__OOKK on success, or an error code (see EErrrroorr ccooddeess) on failure. iinntt ooppuuss__mmuullttiissttrreeaamm__ddeeccooddeerr__ccttll ((OOppuussMMSSDDeeccooddeerr ** sstt,, iinntt rreeqquueesstt,, ......)) Perform a CTL function on a multistream Opus decoder. Generally the request and subsequent arguments are generated by a convenience macro. PPaarraammeetteerrss:: _s_t OpusMSDecoder*: Multistream decoder state. _r_e_q_u_e_s_t This and all remaining parameters should be replaced by one of the convenience macros in GGeenneerriicc CCTTLLss, DDeeccooddeerr rreellaatteedd CCTTLLss, or MMuullttiissttrreeaamm ssppeecciiffiicc eennccooddeerr aanndd ddeeccooddeerr CCTTLLss. SSeeee aallssoo:: GGeenneerriicc CCTTLLss DDeeccooddeerr rreellaatteedd CCTTLLss MMuullttiissttrreeaamm ssppeecciiffiicc eennccooddeerr aanndd ddeeccooddeerr CCTTLLss vvooiidd ooppuuss__mmuullttiissttrreeaamm__ddeeccooddeerr__ddeessttrrooyy ((OOppuussMMSSDDeeccooddeerr ** sstt)) Frees an OpusMSDecoder allocated by ooppuuss__mmuullttiissttrreeaamm__ddeeccooddeerr__ccrreeaattee(()). PPaarraammeetteerrss:: _s_t OpusMSDecoder: Multistream decoder state to be freed. ooppuuss__iinntt3322 ooppuuss__mmuullttiissttrreeaamm__ddeeccooddeerr__ggeett__ssiizzee ((iinntt ssttrreeaammss,, iinntt ccoouupplleedd__ssttrreeaammss)) Gets the size of an OpusMSDecoder structure. PPaarraammeetteerrss:: _s_t_r_e_a_m_s int: The total number of streams coded in the input. This must be no more than 255. _c_o_u_p_l_e_d___s_t_r_e_a_m_s int: Number streams to decode as coupled (2 channel) streams. This must be no larger than the total number of streams. Additionally, The total number of coded channels (streams + coupled_streams) must be no more than 255. RReettuurrnnss:: The size in bytes on success, or a negative error code (see EErrrroorr ccooddeess) on error. iinntt ooppuuss__mmuullttiissttrreeaamm__ddeeccooddeerr__iinniitt ((OOppuussMMSSDDeeccooddeerr ** sstt,, ooppuuss__iinntt3322 FFss,, iinntt cchhaannnneellss,, iinntt ssttrreeaammss,, iinntt ccoouupplleedd__ssttrreeaammss,, ccoonnsstt uunnssiiggnneedd cchhaarr ** mmaappppiinngg)) Intialize a previously allocated decoder state object. The memory pointed to by _s_t must be at least the size returned by ooppuuss__mmuullttiissttrreeaamm__eennccooddeerr__ggeett__ssiizzee(()). This is intended for applications which use their own allocator instead of malloc. To reset a previously initialized state, use the OOPPUUSS__RREESSEETT__SSTTAATTEE CTL. SSeeee aallssoo:: ooppuuss__mmuullttiissttrreeaamm__ddeeccooddeerr__ccrreeaattee opus_multistream_deocder_get_size PPaarraammeetteerrss:: _s_t OpusMSEncoder*: Multistream encoder state to initialize. _F_s opus_int32: Sampling rate to decode at (in Hz). This must be one of 8000, 12000, 16000, 24000, or 48000. _c_h_a_n_n_e_l_s int: Number of channels to output. This must be at most 255. It may be different from the number of coded channels (streams + coupled_streams). _s_t_r_e_a_m_s int: The total number of streams coded in the input. This must be no more than 255. _c_o_u_p_l_e_d___s_t_r_e_a_m_s int: Number of streams to decode as coupled (2 channel) streams. This must be no larger than the total number of streams. Additionally, The total number of coded channels (streams + coupled_streams) must be no more than 255. _m_a_p_p_i_n_g const unsigned char[channels]: Mapping from coded channels to output channels, as described in OOppuuss MMuullttiissttrreeaamm AAPPII. RReettuurrnnss:: OOPPUUSS__OOKK on success, or an error code (see EErrrroorr ccooddeess) on failure. iinntt ooppuuss__mmuullttiissttrreeaamm__eennccooddee ((OOppuussMMSSEEnnccooddeerr ** sstt,, ccoonnsstt ooppuuss__iinntt1166 ** ppccmm,, iinntt ffrraammee__ssiizzee,, uunnssiiggnneedd cchhaarr ** ddaattaa,, ooppuuss__iinntt3322 mmaaxx__ddaattaa__bbyytteess)) Encodes a multistream Opus frame. PPaarraammeetteerrss:: _s_t OpusMSEncoder*: Multistream encoder state. _p_c_m const opus_int16*: The input signal as interleaved samples. This must contain frame_size*channels samples. _f_r_a_m_e___s_i_z_e int: Number of samples per channel in the input signal. This must be an Opus frame size for the encoder's sampling rate. For example, at 48 kHz the permitted values are 120, 240, 480, 960, 1920, and 2880. Passing in a duration of less than 10 ms (480 samples at 48 kHz) will prevent the encoder from using the LPC or hybrid modes. _d_a_t_a unsigned char*: Output payload. This must contain storage for at least _m_a_x___d_a_t_a___b_y_t_e_s. _m_a_x___d_a_t_a___b_y_t_e_s opus_int32: Size of the allocated memory for the output payload. This may be used to impose an upper limit on the instant bitrate, but should not be used as the only bitrate control. Use OOPPUUSS__SSEETT__BBIITTRRAATTEE to control the bitrate. RReettuurrnnss:: The length of the encoded packet (in bytes) on success or a negative error code (see EErrrroorr ccooddeess) on failure. iinntt ooppuuss__mmuullttiissttrreeaamm__eennccooddee__ffllooaatt ((OOppuussMMSSEEnnccooddeerr ** sstt,, ccoonnsstt ffllooaatt ** ppccmm,, iinntt ffrraammee__ssiizzee,, uunnssiiggnneedd cchhaarr ** ddaattaa,, ooppuuss__iinntt3322 mmaaxx__ddaattaa__bbyytteess)) Encodes a multistream Opus frame from floating point input. PPaarraammeetteerrss:: _s_t OpusMSEncoder*: Multistream encoder state. _p_c_m const float*: The input signal as interleaved samples with a normal range of +/-1.0. Samples with a range beyond +/-1.0 are supported but will be clipped by decoders using the integer API and should only be used if it is known that the far end supports extended dynamic range. This must contain frame_size*channels samples. _f_r_a_m_e___s_i_z_e int: Number of samples per channel in the input signal. This must be an Opus frame size for the encoder's sampling rate. For example, at 48 kHz the permitted values are 120, 240, 480, 960, 1920, and 2880. Passing in a duration of less than 10 ms (480 samples at 48 kHz) will prevent the encoder from using the LPC or hybrid modes. _d_a_t_a unsigned char*: Output payload. This must contain storage for at least _m_a_x___d_a_t_a___b_y_t_e_s. _m_a_x___d_a_t_a___b_y_t_e_s opus_int32: Size of the allocated memory for the output payload. This may be used to impose an upper limit on the instant bitrate, but should not be used as the only bitrate control. Use OOPPUUSS__SSEETT__BBIITTRRAATTEE to control the bitrate. RReettuurrnnss:: The length of the encoded packet (in bytes) on success or a negative error code (see EErrrroorr ccooddeess) on failure. OOppuussMMSSEEnnccooddeerr** ooppuuss__mmuullttiissttrreeaamm__eennccooddeerr__ccrreeaattee ((ooppuuss__iinntt3322 FFss,, iinntt cchhaannnneellss,, iinntt ssttrreeaammss,, iinntt ccoouupplleedd__ssttrreeaammss,, ccoonnsstt uunnssiiggnneedd cchhaarr ** mmaappppiinngg,, iinntt aapppplliiccaattiioonn,, iinntt ** eerrrroorr)) Allocates and initializes a multistream encoder state. Call ooppuuss__mmuullttiissttrreeaamm__eennccooddeerr__ddeessttrrooyy(()) to release this object when finished. PPaarraammeetteerrss:: _F_s opus_int32: Sampling rate of the input signal (in Hz). This must be one of 8000, 12000, 16000, 24000, or 48000. _c_h_a_n_n_e_l_s int: Number of channels in the input signal. This must be at most 255. It may be greater than the number of coded channels (streams + coupled_streams). _s_t_r_e_a_m_s int: The total number of streams to encode from the input. This must be no more than the number of channels. _c_o_u_p_l_e_d___s_t_r_e_a_m_s int: Number of coupled (2 channel) streams to encode. This must be no larger than the total number of streams. Additionally, The total number of encoded channels (streams + coupled_streams) must be no more than the number of input channels. _m_a_p_p_i_n_g const unsigned char[channels]: Mapping from encoded channels to input channels, as described in OOppuuss MMuullttiissttrreeaamm AAPPII. As an extra constraint, the multistream encoder does not allow encoding coupled streams for which one channel is unused since this is never a good idea. _a_p_p_l_i_c_a_t_i_o_n int: The target encoder application. This must be one of the following: OOPPUUSS__AAPPPPLLIICCAATTIIOONN__VVOOIIPP Process signal for improved speech intelligibility. OOPPUUSS__AAPPPPLLIICCAATTIIOONN__AAUUDDIIOO Favor faithfulness to the original input. OOPPUUSS__AAPPPPLLIICCAATTIIOONN__RREESSTTRRIICCTTEEDD__LLOOWWDDEELLAAYY Configure the minimum possible coding delay by disabling certain modes of operation. _e_r_r_o_r int *: Returns OOPPUUSS__OOKK on success, or an error code (see EErrrroorr ccooddeess) on failure. iinntt ooppuuss__mmuullttiissttrreeaamm__eennccooddeerr__ccttll ((OOppuussMMSSEEnnccooddeerr ** sstt,, iinntt rreeqquueesstt,, ......)) Perform a CTL function on a multistream Opus encoder. Generally the request and subsequent arguments are generated by a convenience macro. PPaarraammeetteerrss:: _s_t OpusMSEncoder*: Multistream encoder state. _r_e_q_u_e_s_t This and all remaining parameters should be replaced by one of the convenience macros in GGeenneerriicc CCTTLLss, EEnnccooddeerr rreellaatteedd CCTTLLss, or MMuullttiissttrreeaamm ssppeecciiffiicc eennccooddeerr aanndd ddeeccooddeerr CCTTLLss. SSeeee aallssoo:: GGeenneerriicc CCTTLLss EEnnccooddeerr rreellaatteedd CCTTLLss MMuullttiissttrreeaamm ssppeecciiffiicc eennccooddeerr aanndd ddeeccooddeerr CCTTLLss vvooiidd ooppuuss__mmuullttiissttrreeaamm__eennccooddeerr__ddeessttrrooyy ((OOppuussMMSSEEnnccooddeerr ** sstt)) Frees an OpusMSEncoder allocated by ooppuuss__mmuullttiissttrreeaamm__eennccooddeerr__ccrreeaattee(()). PPaarraammeetteerrss:: _s_t OpusMSEncoder*: Multistream encoder state to be freed. ooppuuss__iinntt3322 ooppuuss__mmuullttiissttrreeaamm__eennccooddeerr__ggeett__ssiizzee ((iinntt ssttrreeaammss,, iinntt ccoouupplleedd__ssttrreeaammss)) Gets the size of an OpusMSEncoder structure. PPaarraammeetteerrss:: _s_t_r_e_a_m_s int: The total number of streams to encode from the input. This must be no more than 255. _c_o_u_p_l_e_d___s_t_r_e_a_m_s int: Number of coupled (2 channel) streams to encode. This must be no larger than the total number of streams. Additionally, The total number of encoded channels (streams + coupled_streams) must be no more than 255. RReettuurrnnss:: The size in bytes on success, or a negative error code (see EErrrroorr ccooddeess) on error. iinntt ooppuuss__mmuullttiissttrreeaamm__eennccooddeerr__iinniitt ((OOppuussMMSSEEnnccooddeerr ** sstt,, ooppuuss__iinntt3322 FFss,, iinntt cchhaannnneellss,, iinntt ssttrreeaammss,, iinntt ccoouupplleedd__ssttrreeaammss,, ccoonnsstt uunnssiiggnneedd cchhaarr ** mmaappppiinngg,, iinntt aapppplliiccaattiioonn)) Initialize a previously allocated multistream encoder state. The memory pointed to by _s_t must be at least the size returned by ooppuuss__mmuullttiissttrreeaamm__eennccooddeerr__ggeett__ssiizzee(()). This is intended for applications which use their own allocator instead of malloc. To reset a previously initialized state, use the OOPPUUSS__RREESSEETT__SSTTAATTEE CTL. SSeeee aallssoo:: ooppuuss__mmuullttiissttrreeaamm__eennccooddeerr__ccrreeaattee ooppuuss__mmuullttiissttrreeaamm__eennccooddeerr__ggeett__ssiizzee PPaarraammeetteerrss:: _s_t OpusMSEncoder*: Multistream encoder state to initialize. _F_s opus_int32: Sampling rate of the input signal (in Hz). This must be one of 8000, 12000, 16000, 24000, or 48000. _c_h_a_n_n_e_l_s int: Number of channels in the input signal. This must be at most 255. It may be greater than the number of coded channels (streams + coupled_streams). _s_t_r_e_a_m_s int: The total number of streams to encode from the input. This must be no more than the number of channels. _c_o_u_p_l_e_d___s_t_r_e_a_m_s int: Number of coupled (2 channel) streams to encode. This must be no larger than the total number of streams. Additionally, The total number of encoded channels (streams + coupled_streams) must be no more than the number of input channels. _m_a_p_p_i_n_g const unsigned char[channels]: Mapping from encoded channels to input channels, as described in OOppuuss MMuullttiissttrreeaamm AAPPII. As an extra constraint, the multistream encoder does not allow encoding coupled streams for which one channel is unused since this is never a good idea. _a_p_p_l_i_c_a_t_i_o_n int: The target encoder application. This must be one of the following: OOPPUUSS__AAPPPPLLIICCAATTIIOONN__VVOOIIPP Process signal for improved speech intelligibility. OOPPUUSS__AAPPPPLLIICCAATTIIOONN__AAUUDDIIOO Favor faithfulness to the original input. OOPPUUSS__AAPPPPLLIICCAATTIIOONN__RREESSTTRRIICCTTEEDD__LLOOWWDDEELLAAYY Configure the minimum possible coding delay by disabling certain modes of operation. RReettuurrnnss:: OOPPUUSS__OOKK on success, or an error code (see EErrrroorr ccooddeess) on failure. OOppuussMMSSEEnnccooddeerr** ooppuuss__mmuullttiissttrreeaamm__ssuurrrroouunndd__eennccooddeerr__ccrreeaattee ((ooppuuss__iinntt3322 FFss,, iinntt cchhaannnneellss,, iinntt mmaappppiinngg__ffaammiillyy,, iinntt ** ssttrreeaammss,, iinntt ** ccoouupplleedd__ssttrreeaammss,, uunnssiiggnneedd cchhaarr ** mmaappppiinngg,, iinntt aapppplliiccaattiioonn,, iinntt ** eerrrroorr)) ooppuuss__iinntt3322 ooppuuss__mmuullttiissttrreeaamm__ssuurrrroouunndd__eennccooddeerr__ggeett__ssiizzee ((iinntt cchhaannnneellss,, iinntt mmaappppiinngg__ffaammiillyy)) iinntt ooppuuss__mmuullttiissttrreeaamm__ssuurrrroouunndd__eennccooddeerr__iinniitt ((OOppuussMMSSEEnnccooddeerr ** sstt,, ooppuuss__iinntt3322 FFss,, iinntt cchhaannnneellss,, iinntt mmaappppiinngg__ffaammiillyy,, iinntt ** ssttrreeaammss,, iinntt ** ccoouupplleedd__ssttrreeaammss,, uunnssiiggnneedd cchhaarr ** mmaappppiinngg,, iinntt aapppplliiccaattiioonn)) AAuutthhoorr Generated automatically by Doxygen for Opus from the source code. Version 1.3.1 Wed Aug 24 2022 opus_multistream(3)