From 9d8b51969987fa5e4c5fa58f3e7d3bfb76bf6b1c Mon Sep 17 00:00:00 2001
From: Jean-Marc Valin <jean-marc.valin@usherbrooke.ca>
Date: Wed, 3 Aug 2011 12:44:37 -0400
Subject: [PATCH] Adds OPUS_GET_LOOKAHEAD

---
 src/opus.h         | 3 +++
 src/opus_encoder.c | 6 ++++++
 2 files changed, 9 insertions(+)

diff --git a/src/opus.h b/src/opus.h
index 2d2fdffb3..2f51fb740 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 9f8314825..b348d5ebb 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;
-- 
GitLab