shithub: opus

Download patch

ref: 69549ac05b071e450032fc149cd2a694166d337c
parent: 468b921096b326771fbc0974de44feb0d9d10513
author: Jean-Marc Valin <[email protected]>
date: Thu Aug 18 13:28:28 EDT 2011

Renaming "mode" option to "application"

--- a/src/opus.h
+++ b/src/opus.h
@@ -94,17 +94,19 @@
 #define OPUS_BANDWIDTH_FULLBAND      1105
 
 
+/* OPUS_APPLICATION_VOIP or OPUS_APPLICATION_AUDIO */
+#define OPUS_SET_APPLICATION_REQUEST 0
+#define OPUS_SET_APPLICATION(x) OPUS_SET_APPLICATION_REQUEST, __check_int(x)
+#define OPUS_GET_APPLICATION_REQUEST 1
+#define OPUS_GET_APPLICATION(x) OPUS_GET_APPLICATION_REQUEST, __check_int_ptr(x)
 
-#define OPUS_SET_MODE_REQUEST 0
-#define OPUS_SET_MODE(x) OPUS_SET_MODE_REQUEST, __check_int(x)
-#define OPUS_GET_MODE_REQUEST 1
-#define OPUS_GET_MODE(x) OPUS_GET_MODE_REQUEST, __check_int_ptr(x)
-
+/* Coding bit-rate in bit/second */
 #define OPUS_SET_BITRATE_REQUEST 2
 #define OPUS_SET_BITRATE(x) OPUS_SET_BITRATE_REQUEST, __check_int(x)
 #define OPUS_GET_BITRATE_REQUEST 3
 #define OPUS_GET_BITRATE(x) OPUS_GET_BITRATE_REQUEST, __check_int_ptr(x)
 
+/* 0 for CBR, 1 for VBR */
 #define OPUS_SET_VBR_REQUEST 6
 #define OPUS_SET_VBR(x) OPUS_SET_VBR_REQUEST, __check_int(x)
 #define OPUS_GET_VBR_REQUEST 7
--- a/src/opus_decoder.c
+++ b/src/opus_decoder.c
@@ -658,18 +658,6 @@
 
     switch (request)
     {
-        case OPUS_GET_MODE_REQUEST:
-        {
-            int *value = va_arg(ap, int*);
-            *value = st->prev_mode;
-        }
-        break;
-        case OPUS_SET_BANDWIDTH_REQUEST:
-        {
-            int value = va_arg(ap, int);
-            st->bandwidth = value;
-        }
-        break;
         case OPUS_GET_BANDWIDTH_REQUEST:
         {
             int *value = va_arg(ap, int*);
--- a/src/opus_encoder.c
+++ b/src/opus_encoder.c
@@ -145,7 +145,7 @@
     st->use_vbr = 0;
     st->user_bitrate_bps = OPUS_BITRATE_AUTO;
     st->bitrate_bps = 3000+Fs*channels;
-    st->user_mode = application;
+    st->application = application;
     st->signal_type = OPUS_SIGNAL_AUTO;
     st->user_bandwidth = OPUS_BANDWIDTH_AUTO;
     st->voice_ratio = 90;
@@ -287,7 +287,7 @@
     }
 #else
     /* Mode selection depending on application and signal type */
-    if (st->user_mode==OPUS_APPLICATION_VOIP)
+    if (st->application==OPUS_APPLICATION_VOIP)
     {
         opus_int32 threshold = 20000;
         /* Hysteresis */
@@ -756,13 +756,13 @@
 
     switch (request)
     {
-        case OPUS_SET_MODE_REQUEST:
+        case OPUS_SET_APPLICATION_REQUEST:
         {
             int value = va_arg(ap, int);
-            st->user_mode = value;
+            st->application = value;
         }
         break;
-        case OPUS_GET_MODE_REQUEST:
+        case OPUS_GET_APPLICATION_REQUEST:
         {
             int *value = va_arg(ap, int*);
             *value = st->mode;
--- a/src/opus_encoder.h
+++ b/src/opus_encoder.h
@@ -45,7 +45,7 @@
     int          force_mono;
 
     int          mode;
-    int          user_mode;
+    int          application;
     int          prev_mode;
     int          signal_type;
     int          bandwidth;