You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: OpusSharp.Core/Enums.cs
+30Lines changed: 30 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -374,6 +374,16 @@ public enum EncoderCTL
374
374
/// Provide external DNN weights from binary object (only when explicitly built without the weights).
375
375
/// </summary>
376
376
OPUS_SET_DNN_BLOB=4052,
377
+
378
+
/// <summary>
379
+
/// If set to 1, enables quality extension (QEXT), otherwise disables it (default). Warning: This will hurt audio quality unless operating at a very high bitrate.
380
+
/// </summary>
381
+
OPUS_SET_QEXT=4056,
382
+
383
+
/// <summary>
384
+
/// Gets the encoder's configured quality extension (QEXT).
385
+
/// </summary>
386
+
OPUS_GET_QEXT=4057
377
387
}
378
388
379
389
/// <summary>
@@ -400,6 +410,26 @@ public enum DecoderCTL
400
410
/// Gets the pitch of the last decoded frame, if available.
401
411
/// </summary>
402
412
OPUS_GET_PITCH=4033,
413
+
414
+
/// <summary>
415
+
/// Enables blind bandwidth extension for wideband signals if decoding sampling rate is 48 kHz.
416
+
/// </summary>
417
+
OPUS_SET_OSCE_BWE=4054,
418
+
419
+
/// <summary>
420
+
/// Gets blind bandwidth extension flag for wideband signals if decoding sampling rate is 48 kHz.
421
+
/// </summary>
422
+
OPUS_GET_OSCE_BWE=4055,
423
+
424
+
/// <summary>
425
+
/// If set to 1, the decoder will ignore all extensions found in the padding area (does not affect DRED, which is decoded separately).
426
+
/// </summary>
427
+
OPUS_SET_IGNORE_EXTENSIONS=4058,
428
+
429
+
/// <summary>
430
+
/// Gets whether the decoder is ignoring extensions.
/// <param name="pcm">Input signal (interleaved if 2 channels) representing (or slightly exceeding) 24-bit values. length is frame_size*channels*sizeof(int)</param>
64
+
/// <param name="frame_size">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.</param>
65
+
/// <param name="data">Output payload. This must contain storage for at least max_data_bytes.</param>
66
+
/// <param name="max_data_bytes">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 <see cref="EncoderCTL.OPUS_SET_BITRATE"/> to control the bitrate.</param>
67
+
/// <returns>The length of the encoded packet (in bytes) on success or a negative error code (see <see cref="OpusErrorCodes"/>) on failure.</returns>
/// <param name="data">Input payload. Use a NULL pointer to indicate packet loss.</param>
199
+
/// <param name="len">Number of bytes in payload.</param>
200
+
/// <param name="pcm">Output signal (interleaved if 2 channels). length is frame_size*channels*sizeof(int).</param>
201
+
/// <param name="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=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 must be a multiple of 2.5 ms.</param>
202
+
/// <param name="decode_fec">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.</param>
203
+
/// <returns>Number of decoded samples or <see cref="OpusErrorCodes"/>.</returns>
/// <param name="pcm">The input signal as interleaved samples. This must contain frame_size*channels samples.</param>
681
+
/// <param name="frame_size">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.</param>
682
+
/// <param name="data">Output payload. This must contain storage for at least max_data_bytes.</param>
683
+
/// <param name="max_data_bytes">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 <see cref="EncoderCTL.OPUS_SET_BITRATE"/> to control the bitrate.</param>
684
+
/// <returns>The length of the encoded packet (in bytes) on success or a negative error code (see <see cref="OpusErrorCodes"/>) on failure.</returns>
/// <param name="data">Input payload. Use a NULL pointer to indicate packet loss.</param>
823
+
/// <param name="len">Number of bytes in payload.</param>
824
+
/// <param name="pcm">Output signal, with interleaved samples. This must contain room for frame_size*channels samples.</param>
825
+
/// <param name="frame_size">The number of samples per channel of available space in pcm. 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 must be a multiple of 2.5 ms.</param>
826
+
/// <param name="decode_fec">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.</param>
827
+
/// <returns>Number of samples decoded on success or a negative error code (see <see cref="OpusErrorCodes"/>) on failure.</returns>
Copy file name to clipboardExpand all lines: OpusSharp.Core/OpusDecoder.cs
+42Lines changed: 42 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -99,6 +99,34 @@ public unsafe int Decode(Span<byte> input, int length, Span<short> output, int f
99
99
returnresult;
100
100
}
101
101
}
102
+
103
+
/// <summary>
104
+
/// Decodes an opus encoded frame.
105
+
/// </summary>
106
+
/// <param name="input">Input payload. Use null to indicate packet loss</param>
107
+
/// <param name="length">Number of bytes in payload.</param>
108
+
/// <param name="output">Output signal (interleaved if 2 channels). length is frame_size*channels.</param>
109
+
/// <param name="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.</param>
110
+
/// <param name="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.</param>
111
+
/// <returns>Number of decoded samples or <see cref="OpusErrorCodes"/>.</returns>
/// <param name="input">Input payload. Use null to indicate packet loss</param>
191
+
/// <param name="length">Number of bytes in payload.</param>
192
+
/// <param name="output">Output signal (interleaved if 2 channels). length is (frame_size*channels)/2. Note: I don't know if this is correct.</param>
193
+
/// <param name="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.</param>
194
+
/// <param name="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.</param>
195
+
/// <returns>Number of decoded samples or <see cref="OpusErrorCodes"/>.</returns>
0 commit comments