From 057a242bfeb7844032286fdbea8a1dd21c837545 Mon Sep 17 00:00:00 2001 From: pangbo5 Date: Tue, 13 Jan 2026 18:45:51 +0800 Subject: [PATCH] opusenc: Forward OPUS_SET/GET_DRED_DURATION_REQUEST to encoder Add support for controlling DRED (Deep REDundancy) duration through the ope_encoder_ctl() API. This allows applications using libopusenc to enable and configure the new DRED feature introduced in Opus 1.5 for improved packet loss resilience. The new cases forward the OPUS_SET_DRED_DURATION_REQUEST and OPUS_GET_DRED_DURATION_REQUEST control requests to the underlying multistream encoder, enabling DRED functionality when encoding to Ogg Opus files. Signed-off-by: Hei Stansen --- src/opusenc.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/src/opusenc.c b/src/opusenc.c index 6ad3d91..efca1d8 100644 --- a/src/opusenc.c +++ b/src/opusenc.c @@ -951,6 +951,14 @@ int ope_encoder_ctl(OggOpusEnc *enc, int request, ...) { ret = opeint_encoder_ctl2(&enc->st, request, value); } break; +#ifdef OPUS_SET_DRED_DURATION_REQUEST + case OPUS_SET_DRED_DURATION_REQUEST: + { + opus_int32 value = va_arg(ap, opus_int32); + ret = opeint_encoder_ctl2(&enc->st, OPUS_SET_DRED_DURATION_REQUEST, value); + } + break; +#endif case OPUS_GET_LOOKAHEAD_REQUEST: { opus_int32 *value = va_arg(ap, opus_int32*); @@ -997,6 +1005,14 @@ int ope_encoder_ctl(OggOpusEnc *enc, int request, ...) { ret = opeint_encoder_ctl2(&enc->st, request, value); } break; +#ifdef OPUS_GET_DRED_DURATION_REQUEST + case OPUS_GET_DRED_DURATION_REQUEST: + { + opus_int32 *value = va_arg(ap, opus_int32*); + ret = opeint_encoder_ctl2(&enc->st, OPUS_GET_DRED_DURATION_REQUEST, value); + } + break; +#endif case OPUS_MULTISTREAM_GET_ENCODER_STATE_REQUEST: { opus_int32 stream_id;