Interface IOpusDecoder
An opus decoder interface.
Inherited Members
Namespace: OpusSharp.Core.Interfaces
Assembly: OpusSharp.Core.dll
Syntax
public interface IOpusDecoder : IDisposable
Methods
| Edit this page View SourceCtl(DecoderCTL)
Performs a ctl request.
Declaration
int Ctl(DecoderCTL request)
Parameters
| Type | Name | Description |
|---|---|---|
| DecoderCTL | request | The request you want to specify. |
Returns
| Type | Description |
|---|---|
| int | The result code of the request. See OpusErrorCodes. |
Exceptions
| Type | Condition |
|---|---|
| OpusException | |
| ObjectDisposedException |
Ctl(DecoderCTL, int)
Performs a ctl set request.
Declaration
int Ctl(DecoderCTL request, int value)
Parameters
| Type | Name | Description |
|---|---|---|
| DecoderCTL | request | The request you want to specify. |
| int | value | The input value. |
Returns
| Type | Description |
|---|---|
| int | The result code of the request. See OpusErrorCodes. |
Exceptions
| Type | Condition |
|---|---|
| OpusException | |
| ObjectDisposedException |
Ctl(GenericCTL)
Performs a ctl request.
Declaration
int Ctl(GenericCTL request)
Parameters
| Type | Name | Description |
|---|---|---|
| GenericCTL | request | The request you want to specify. |
Returns
| Type | Description |
|---|---|
| int | The result code of the request. See OpusErrorCodes. |
Exceptions
| Type | Condition |
|---|---|
| OpusException | |
| ObjectDisposedException |
Ctl(GenericCTL, int)
Performs a ctl set request.
Declaration
int Ctl(GenericCTL request, int value)
Parameters
| Type | Name | Description |
|---|---|---|
| GenericCTL | request | The request you want to specify. |
| int | value | The input value. |
Returns
| Type | Description |
|---|---|
| int | The result code of the request. See OpusErrorCodes. |
Exceptions
| Type | Condition |
|---|---|
| OpusException | |
| ObjectDisposedException |
Ctl<T>(DecoderCTL, ref T)
Performs a ctl get/set request.
Declaration
int Ctl<T>(DecoderCTL request, ref T value) where T : unmanaged
Parameters
| Type | Name | Description |
|---|---|---|
| DecoderCTL | request | The request you want to specify. |
| T | value | The input/output value. |
Returns
| Type | Description |
|---|---|
| int | The result code of the request. See OpusErrorCodes. |
Type Parameters
| Name | Description |
|---|---|
| T | The type you want to input/output. |
Exceptions
| Type | Condition |
|---|---|
| OpusException | |
| ObjectDisposedException |
Ctl<T>(GenericCTL, ref T)
Performs a ctl request.
Declaration
int Ctl<T>(GenericCTL request, ref T value) where T : unmanaged
Parameters
| Type | Name | Description |
|---|---|---|
| GenericCTL | request | The request you want to specify. |
| T | value | The input/output value. |
Returns
| Type | Description |
|---|---|
| int | The result code of the request. See OpusErrorCodes. |
Type Parameters
| Name | Description |
|---|---|
| T | The type you want to input/output. |
Exceptions
| Type | Condition |
|---|---|
| OpusException | |
| ObjectDisposedException |
Decode(byte[]?, int, byte[], int, bool)
Decodes an opus encoded frame.
Declaration
int Decode(byte[]? input, int length, byte[] output, int frame_size, bool decode_fec)
Parameters
| Type | Name | Description |
|---|---|---|
| byte[] | input | Input payload. Use null to indicate packet loss |
| int | length | Number of bytes in payload. |
| byte[] | output | Output signal (interleaved if 2 channels). length is frame_sizechannelssizeof(short). |
| int | frame_size | Number of samples per channel of available space in pcm. If this is less than the maximum packet duration (120ms; 5760 for 48kHz), this function will not be capable of decoding some packets. In the case of PLC (data==NULL) or FEC (decode_fec=true), 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 must be a multiple of 2.5 ms. |
| bool | decode_fec | 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. |
Returns
| Type | Description |
|---|---|
| int | Number of decoded samples or OpusErrorCodes. |
Exceptions
| Type | Condition |
|---|---|
| OpusException | |
| ObjectDisposedException |
Decode(byte[]?, int, short[], int, bool)
Decodes an opus encoded frame.
Declaration
int Decode(byte[]? input, int length, short[] output, int frame_size, bool decode_fec)
Parameters
| Type | Name | Description |
|---|---|---|
| byte[] | input | Input payload. Use null to indicate packet loss |
| int | length | Number of bytes in payload. |
| short[] | output | Output signal (interleaved if 2 channels). length is frame_size*channels. |
| int | frame_size | Number of samples per channel of available space in pcm. If this is less than the maximum packet duration (120ms; 5760 for 48kHz), this function will not be capable of decoding some packets. In the case of PLC (data==NULL) or FEC (decode_fec=true), 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 must be a multiple of 2.5 ms. |
| bool | decode_fec | 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. |
Returns
| Type | Description |
|---|---|
| int | Number of decoded samples or OpusErrorCodes. |
Exceptions
| Type | Condition |
|---|---|
| OpusException | |
| ObjectDisposedException |
Decode(byte[]?, int, int[], int, bool)
Decodes an opus encoded frame.
Declaration
int Decode(byte[]? input, int length, int[] output, int frame_size, bool decode_fec)
Parameters
| Type | Name | Description |
|---|---|---|
| byte[] | input | Input payload. Use null to indicate packet loss |
| int | length | Number of bytes in payload. |
| int[] | output | Output signal (interleaved if 2 channels). length is frame_size*channels. |
| int | frame_size | Number of samples per channel of available space in pcm. If this is less than the maximum packet duration (120ms; 5760 for 48kHz), this function will not be capable of decoding some packets. In the case of PLC (data==NULL) or FEC (decode_fec=true), 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 must be a multiple of 2.5 ms. |
| bool | decode_fec | 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. |
Returns
| Type | Description |
|---|---|
| int | Number of decoded samples or OpusErrorCodes. |
Exceptions
| Type | Condition |
|---|---|
| OpusException | |
| ObjectDisposedException |
Decode(byte[]?, int, float[], int, bool)
Decodes an opus encoded frame.
Declaration
int Decode(byte[]? input, int length, float[] output, int frame_size, bool decode_fec)
Parameters
| Type | Name | Description |
|---|---|---|
| byte[] | input | Input payload. Use null to indicate packet loss |
| int | length | Number of bytes in payload. |
| float[] | output | Output signal (interleaved if 2 channels). length is (frame_size*channels)/2. Note: I don't know if this is correct. |
| int | frame_size | Number of samples per channel of available space in pcm. If this is less than the maximum packet duration (120ms; 5760 for 48kHz), this function will not be capable of decoding some packets. In the case of PLC (data==NULL) or FEC (decode_fec=true), 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 must be a multiple of 2.5 ms. |
| bool | decode_fec | 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. |
Returns
| Type | Description |
|---|---|
| int | Number of decoded samples or OpusErrorCodes. |
Exceptions
| Type | Condition |
|---|---|
| OpusException | |
| ObjectDisposedException |