shithub: libopusenc

Download patch

ref: a0beec3438c86b0cd418ead2a1198cdf74e13808
parent: 53072d5bdde0738725480f8107a886165a1f96d4
author: Jean-Marc Valin <jmvalin@jmvalin.ca>
date: Fri Mar 2 18:30:16 EST 2018

Adds OPE_GET_NB_STREAMS() and OPE_GET_NB_COUPLED_STREAMS(x)

--- a/include/opusenc.h
+++ b/include/opusenc.h
@@ -117,6 +117,8 @@
 /*#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 @@
 /*#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)
 /*@}*/
 /*@}*/
 
--- a/src/opusenc.c
+++ b/src/opusenc.c
@@ -1018,6 +1018,18 @@
       *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;
   }