diff --git a/src/opus.h b/src/opus.h index 2d2fdffb3c88057b4f16afe60a0bd7fbbcf8615f..2f51fb740f133be8293b74de84964b36c143b86b 100644 --- a/src/opus.h +++ b/src/opus.h @@ -145,6 +145,9 @@ extern "C" { #define OPUS_GET_SIGNAL_REQUEST 25 #define OPUS_GET_SIGNAL(x) OPUS_GET_SIGNAL_REQUEST, __check_int_ptr(x) +#define OPUS_GET_LOOKAHEAD_REQUEST 27 +#define OPUS_GET_LOOKAHEAD(x) OPUS_GET_LOOKAHEAD_REQUEST, __check_int_ptr(x) + typedef struct OpusEncoder OpusEncoder; typedef struct OpusDecoder OpusDecoder; diff --git a/src/opus_encoder.c b/src/opus_encoder.c index 9f831482548b58f39dc9683406d0dc624c6d8603..b348d5ebb7d7ad503be85abedc2d6b53a51c779e 100644 --- a/src/opus_encoder.c +++ b/src/opus_encoder.c @@ -810,6 +810,12 @@ int opus_encoder_ctl(OpusEncoder *st, int request, ...) *value = st->signal_type; } break; + case OPUS_GET_LOOKAHEAD_REQUEST: + { + int *value = va_arg(ap, int*); + *value = st->delay_compensation+st->Fs/400; + } + break; default: fprintf(stderr, "unknown opus_encoder_ctl() request: %d", request); break;