Adds OPE_GET_NB_STREAMS() and OPE_GET_NB_COUPLED_STREAMS(x)
authorJean-Marc Valin <jmvalin@jmvalin.ca>
Sat, 3 Mar 2018 04:30:16 +0000 (23:30 -0500)
committerJean-Marc Valin <jmvalin@jmvalin.ca>
Sat, 3 Mar 2018 04:30:16 +0000 (23:30 -0500)
include/opusenc.h
src/opusenc.c

index fb714fd..10adc88 100644 (file)
@@ -117,6 +117,8 @@ extern "C" {
 /*#define OPE_GET_PACKET_CALLBACK_REQUEST     14009*/
 #define OPE_SET_HEADER_GAIN_REQUEST         14010
 #define OPE_GET_HEADER_GAIN_REQUEST         14011
+#define OPE_GET_NB_STREAMS_REQUEST          14013
+#define OPE_GET_NB_COUPLED_STREAMS_REQUEST  14015
 
 /**\defgroup encoder_ctl Encoding Options*/
 /*@{*/
@@ -139,6 +141,8 @@ extern "C" {
 /*#define OPE_GET_PACKET_CALLBACK(x,u) OPE_GET_PACKET_CALLBACK_REQUEST, (x), (u)*/
 #define OPE_SET_HEADER_GAIN(x) OPE_SET_HEADER_GAIN_REQUEST, __opus_check_int(x)
 #define OPE_GET_HEADER_GAIN(x) OPE_GET_HEADER_GAIN_REQUEST, __opus_check_int_ptr(x)
+#define OPE_GET_NB_STREAMS(x) OPE_GET_NB_STREAMS_REQUEST, __opus_check_int_ptr(x)
+#define OPE_GET_NB_COUPLED_STREAMS(x) OPE_GET_NB_COUPLED_STREAMS_REQUEST, __opus_check_int_ptr(x)
 /*@}*/
 /*@}*/
 
index 05c49bf..c5ce978 100644 (file)
@@ -1018,6 +1018,18 @@ int ope_encoder_ctl(OggOpusEnc *enc, int request, ...) {
       *value = enc->header.gain;
     }
     break;
+    case OPE_GET_NB_STREAMS_REQUEST:
+    {
+      opus_int32 *value = va_arg(ap, opus_int32*);
+      *value = enc->header.nb_streams;
+    }
+    break;
+    case OPE_GET_NB_COUPLED_STREAMS_REQUEST:
+    {
+      opus_int32 *value = va_arg(ap, opus_int32*);
+      *value = enc->header.nb_coupled;
+    }
+    break;
     default:
       ret = OPUS_UNIMPLEMENTED;
   }