diff options
Diffstat (limited to 'include/opus.h')
-rw-r--r-- | include/opus.h | 34 |
1 files changed, 32 insertions, 2 deletions
diff --git a/include/opus.h b/include/opus.h index cde0f20c..01668a8b 100644 --- a/include/opus.h +++ b/include/opus.h @@ -398,6 +398,13 @@ OPUS_EXPORT int opus_encoder_ctl(OpusEncoder *st, int request, ...) OPUS_ARG_NON */ typedef struct OpusDecoder OpusDecoder; +/** Opus DRED decoder. + * This contains the complete state of an Opus DRED decoder. + * It is position independent and can be freely copied. + * @see opus_dred_decoder_create,opus_dred_decoder_init + */ +typedef struct OpusDREDDecoder OpusDREDDecoder; + /** Opus DRED state. * This contains the complete state of an Opus DRED packet. @@ -519,6 +526,28 @@ OPUS_EXPORT int opus_decoder_ctl(OpusDecoder *st, int request, ...) OPUS_ARG_NON */ OPUS_EXPORT void opus_decoder_destroy(OpusDecoder *st); +/** Gets the size of an <code>OpusDREDDecoder</code> structure. + * @returns The size in bytes. + */ +OPUS_EXPORT int opus_dred_decoder_get_size(void); + +/** Allocates and initializes an OpusDREDDecoder state. + * @param [out] error <tt>int*</tt>: #OPUS_OK Success or @ref opus_errorcodes + */ +OPUS_EXPORT OpusDREDDecoder *opus_dred_decoder_create(int *error); + +/** Initializes an <code>OpusDREDDecoder</code> state. + * @param[in] st <tt>OpusDREDDecoder*</tt>: State to be initialized. + * @param [out] error <tt>int*</tt>: #OPUS_OK Success or @ref opus_errorcodes + */ +OPUS_EXPORT int opus_dred_decoder_init(OpusDREDDecoder *dec); + +/** Frees an <code>OpusDREDDecoder</code> allocated by opus_dred_decoder_create(). + * @param[in] st <tt>OpusDREDDecoder*</tt>: State to be freed. + */ +OPUS_EXPORT void opus_dred_decoder_destroy(OpusDREDDecoder *dec); + + /** Gets the size of an <code>OpusDRED</code> structure. * @returns The size in bytes. @@ -544,13 +573,14 @@ OPUS_EXPORT void opus_dred_destroy(OpusDRED *dec); * @param [in] defer_processing <tt>int</tt>: Flag (0 or 1). If set to one, the CPU-intensive part of the DRED decoding is deferred until opus_dred_process() is called. * @returns Number of decoded DRED samples or @ref opus_errorcodes */ -OPUS_EXPORT int opus_dred_parse(OpusDRED *dred, const unsigned char *data, opus_int32 len, opus_int32 max_dred_samples, opus_int32 sampling_rate, int defer_processing) OPUS_ARG_NONNULL(1); +OPUS_EXPORT int opus_dred_parse(OpusDREDDecoder *dred_dec, OpusDRED *dred, const unsigned char *data, opus_int32 len, opus_int32 max_dred_samples, opus_int32 sampling_rate, int defer_processing) OPUS_ARG_NONNULL(1); /** Finish decoding an Opus DRED packet. The function only needs to be called if opus_dred_parse() was called with defer_processing=1. + * The source and destination will often be the same DRED state. * @param [in] dred <tt>OpusDRED*</tt>: DRED state * @returns @ref opus_errorcodes */ -OPUS_EXPORT int opus_dred_process(OpusDRED *dred); +OPUS_EXPORT int opus_dred_process(OpusDREDDecoder *dred_dec, const OpusDRED *src, OpusDRED *dst); /** Decode audio from an Opus DRED packet with floating point output. * @param [in] st <tt>OpusDecoder*</tt>: Decoder state |