shithub: libopusenc

Download patch

ref: b69ccee4dc1407f54bce614a7512999c352cc0e0
parent: d96417dffe3a4638c0273f87107f4f5f5b62538f
author: Jean-Marc Valin <[email protected]>
date: Thu May 18 20:30:19 EDT 2017

Implement OPE_GET_* ctl() calls

--- a/include/opusenc.h
+++ b/include/opusenc.h
@@ -112,7 +112,7 @@
 #define OPE_SET_SERIALNO_REQUEST            14006
 #define OPE_GET_SERIALNO_REQUEST            14007
 #define OPE_SET_PACKET_CALLBACK_REQUEST     14008
-#define OPE_GET_PACKET_CALLBACK_REQUEST     14009
+/*#define OPE_GET_PACKET_CALLBACK_REQUEST     14009*/
 #define OPE_SET_HEADER_GAIN_REQUEST         14010
 #define OPE_GET_HEADER_GAIN_REQUEST         14011
 
@@ -134,7 +134,7 @@
 #define OPE_GET_SERIALNO(x) OPE_GET_SERIALNO_REQUEST, __opus_check_int_ptr(x)
 /* FIXME: Add type-checking macros to these. */
 #define OPE_SET_PACKET_CALLBACK(x,u) OPE_SET_PACKET_CALLBACK_REQUEST, (x), (u)
-#define OPE_GET_PACKET_CALLBACK(x,u) OPE_GET_PACKET_CALLBACK_REQUEST, (x), (u)
+/*#define OPE_GET_PACKET_CALLBACK(x,u) OPE_GET_PACKET_CALLBACK_REQUEST, (x), (u)*/
 #define OPE_SET_HEADER_GAIN(x,u) OPE_SET_HEADER_GAIN_REQUEST, __opus_check_int(x)
 #define OPE_GET_HEADER_GAIN(x,u) OPE_GET_HEADER_GAIN_REQUEST, __opus_check_int_ptr(x)
 /*@}*/
--- a/src/opusenc.c
+++ b/src/opusenc.c
@@ -663,6 +663,7 @@
   va_list ap;
   if (enc->unrecoverable) return OPE_UNRECOVERABLE;
   va_start(ap, request);
+  ret = OPE_OK;
   switch (request) {
     case OPUS_SET_APPLICATION_REQUEST:
     case OPUS_SET_BITRATE_REQUEST:
@@ -753,9 +754,14 @@
         break;
       }
       enc->decision_delay = value;
-      ret = OPE_OK;
     }
     break;
+    case OPE_GET_DECISION_DELAY_REQUEST:
+    {
+      opus_int32 *value = va_arg(ap, opus_int32*);
+      *value = enc->decision_delay;
+    }
+    break;
     case OPE_SET_MUXING_DELAY_REQUEST:
     {
       opus_int32 value = va_arg(ap, opus_int32);
@@ -765,9 +771,14 @@
       }
       enc->max_ogg_delay = value;
       oggp_set_muxing_delay(enc->oggp, enc->max_ogg_delay);
-      ret = OPE_OK;
     }
     break;
+    case OPE_GET_MUXING_DELAY_REQUEST:
+    {
+      opus_int32 *value = va_arg(ap, opus_int32*);
+      *value = enc->max_ogg_delay;
+    }
+    break;
     case OPE_SET_COMMENT_PADDING_REQUEST:
     {
       opus_int32 value = va_arg(ap, opus_int32);
@@ -779,6 +790,12 @@
       ret = OPE_OK;
     }
     break;
+    case OPE_GET_COMMENT_PADDING_REQUEST:
+    {
+      opus_int32 *value = va_arg(ap, opus_int32*);
+      *value = enc->comment_padding;
+    }
+    break;
     case OPE_SET_SERIALNO_REQUEST:
     {
       opus_int32 value = va_arg(ap, opus_int32);
@@ -791,6 +808,12 @@
       ret = OPE_OK;
     }
     break;
+    case OPE_GET_SERIALNO_REQUEST:
+    {
+      opus_int32 *value = va_arg(ap, opus_int32*);
+      *value = enc->last_stream->serialno;
+    }
+    break;
     case OPE_SET_PACKET_CALLBACK_REQUEST:
     {
       ope_packet_func value = va_arg(ap, ope_packet_func);
@@ -809,6 +832,12 @@
       }
       enc->header.gain = value;
       ret = OPE_OK;
+    }
+    break;
+    case OPE_GET_HEADER_GAIN_REQUEST:
+    {
+      opus_int32 *value = va_arg(ap, opus_int32*);
+      *value = enc->header.gain;
     }
     break;
     default: