@@ -268,6 +268,42 @@ OPUS_EXPORT OPUS_WARN_UNUSED_RESULT opus_int32 opus_encode(
268
268
opus_int32 max_data_bytes
269
269
) OPUS_ARG_NONNULL (1 ) OPUS_ARG_NONNULL (2 ) OPUS_ARG_NONNULL (4 );
270
270
271
+ /** Encodes an Opus frame.
272
+ * @param [in] st <tt>OpusEncoder*</tt>: Encoder state
273
+ * @param [in] pcm <tt>opus_int32*</tt>: Input signal (interleaved if 2 channels) representing (or slightly exceeding) 24-bit values. length is frame_size*channels*sizeof(opus_int32)
274
+ * @param [in] frame_size <tt>int</tt>: Number of samples per channel in the
275
+ * input signal.
276
+ * This must be an Opus frame size for
277
+ * the encoder's sampling rate.
278
+ * For example, at 48 kHz the permitted
279
+ * values are 120, 240, 480, 960, 1920,
280
+ * and 2880.
281
+ * Passing in a duration of less than
282
+ * 10 ms (480 samples at 48 kHz) will
283
+ * prevent the encoder from using the LPC
284
+ * or hybrid modes.
285
+ * @param [out] data <tt>unsigned char*</tt>: Output payload.
286
+ * This must contain storage for at
287
+ * least \a max_data_bytes.
288
+ * @param [in] max_data_bytes <tt>opus_int32</tt>: Size of the allocated
289
+ * memory for the output
290
+ * payload. This may be
291
+ * used to impose an upper limit on
292
+ * the instant bitrate, but should
293
+ * not be used as the only bitrate
294
+ * control. Use #OPUS_SET_BITRATE to
295
+ * control the bitrate.
296
+ * @returns The length of the encoded packet (in bytes) on success or a
297
+ * negative error code (see @ref opus_errorcodes) on failure.
298
+ */
299
+ OPUS_EXPORT OPUS_WARN_UNUSED_RESULT opus_int32 opus_encode24 (
300
+ OpusEncoder * st ,
301
+ const opus_int32 * pcm ,
302
+ int frame_size ,
303
+ unsigned char * data ,
304
+ opus_int32 max_data_bytes
305
+ ) OPUS_ARG_NONNULL (1 ) OPUS_ARG_NONNULL (2 ) OPUS_ARG_NONNULL (4 );
306
+
271
307
/** Encodes an Opus frame from floating point input.
272
308
* @param [in] st <tt>OpusEncoder*</tt>: Encoder state
273
309
* @param [in] pcm <tt>float*</tt>: Input in float format (interleaved if 2 channels), with a normal range of +/-1.0.
@@ -483,6 +519,31 @@ OPUS_EXPORT OPUS_WARN_UNUSED_RESULT int opus_decode(
483
519
int decode_fec
484
520
) OPUS_ARG_NONNULL (1 ) OPUS_ARG_NONNULL (4 );
485
521
522
+ /** Decode an Opus packet.
523
+ * @param [in] st <tt>OpusDecoder*</tt>: Decoder state
524
+ * @param [in] data <tt>char*</tt>: Input payload. Use a NULL pointer to indicate packet loss
525
+ * @param [in] len <tt>opus_int32</tt>: Number of bytes in payload*
526
+ * @param [out] pcm <tt>opus_int32*</tt>: Output signal (interleaved if 2 channels) representing (or slightly exceeding) 24-bit values. length
527
+ * is frame_size*channels*sizeof(opus_int32)
528
+ * @param [in] frame_size Number of samples per channel of available space in \a pcm.
529
+ * If this is less than the maximum packet duration (120ms; 5760 for 48kHz), this function will
530
+ * not be capable of decoding some packets. In the case of PLC (data==NULL) or FEC (decode_fec=1),
531
+ * then frame_size needs to be exactly the duration of audio that is missing, otherwise the
532
+ * decoder will not be in the optimal state to decode the next incoming packet. For the PLC and
533
+ * FEC cases, frame_size <b>must</b> be a multiple of 2.5 ms.
534
+ * @param [in] decode_fec <tt>int</tt>: Flag (0 or 1) to request that any in-band forward error correction data be
535
+ * decoded. If no such data is available, the frame is decoded as if it were lost.
536
+ * @returns Number of decoded samples or @ref opus_errorcodes
537
+ */
538
+ OPUS_EXPORT OPUS_WARN_UNUSED_RESULT int opus_decode24 (
539
+ OpusDecoder * st ,
540
+ const unsigned char * data ,
541
+ opus_int32 len ,
542
+ opus_int32 * pcm ,
543
+ int frame_size ,
544
+ int decode_fec
545
+ ) OPUS_ARG_NONNULL (1 ) OPUS_ARG_NONNULL (4 );
546
+
486
547
/** Decode an Opus packet with floating point output.
487
548
* @param [in] st <tt>OpusDecoder*</tt>: Decoder state
488
549
* @param [in] data <tt>char*</tt>: Input payload. Use a NULL pointer to indicate packet loss
@@ -596,7 +657,7 @@ OPUS_EXPORT int opus_dred_parse(OpusDREDDecoder *dred_dec, OpusDRED *dred, const
596
657
*/
597
658
OPUS_EXPORT int opus_dred_process (OpusDREDDecoder * dred_dec , const OpusDRED * src , OpusDRED * dst );
598
659
599
- /** Decode audio from an Opus DRED packet with floating point output.
660
+ /** Decode audio from an Opus DRED packet with 16-bit output.
600
661
* @param [in] st <tt>OpusDecoder*</tt>: Decoder state
601
662
* @param [in] dred <tt>OpusDRED*</tt>: DRED state
602
663
* @param [in] dred_offset <tt>opus_int32</tt>: position of the redundancy to decode (in samples before the beginning of the real audio data in the packet).
@@ -608,6 +669,18 @@ OPUS_EXPORT int opus_dred_process(OpusDREDDecoder *dred_dec, const OpusDRED *src
608
669
*/
609
670
OPUS_EXPORT int opus_decoder_dred_decode (OpusDecoder * st , const OpusDRED * dred , opus_int32 dred_offset , opus_int16 * pcm , opus_int32 frame_size );
610
671
672
+ /** Decode audio from an Opus DRED packet with 24-bit output.
673
+ * @param [in] st <tt>OpusDecoder*</tt>: Decoder state
674
+ * @param [in] dred <tt>OpusDRED*</tt>: DRED state
675
+ * @param [in] dred_offset <tt>opus_int32</tt>: position of the redundancy to decode (in samples before the beginning of the real audio data in the packet).
676
+ * @param [out] pcm <tt>opus_int32*</tt>: Output signal (interleaved if 2 channels). length
677
+ * is frame_size*channels*sizeof(opus_int16)
678
+ * @param [in] frame_size Number of samples per channel to decode in \a pcm.
679
+ * frame_size <b>must</b> be a multiple of 2.5 ms.
680
+ * @returns Number of decoded samples or @ref opus_errorcodes
681
+ */
682
+ OPUS_EXPORT int opus_decoder_dred_decode24 (OpusDecoder * st , const OpusDRED * dred , opus_int32 dred_offset , opus_int32 * pcm , opus_int32 frame_size );
683
+
611
684
/** Decode audio from an Opus DRED packet with floating point output.
612
685
* @param [in] st <tt>OpusDecoder*</tt>: Decoder state
613
686
* @param [in] dred <tt>OpusDRED*</tt>: DRED state
0 commit comments