diff --git a/src/opus.h b/src/opus.h index aa18dd0609c7312089669f5bdafd7c12805299bf..420f96b8561832ebe6721e48e2451f6ed77a1e82 100644 --- a/src/opus.h +++ b/src/opus.h @@ -94,17 +94,19 @@ extern "C" { #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 diff --git a/src/opus_decoder.c b/src/opus_decoder.c index 7138854d8fb82a2b8f2ca0be64bec65989cbda14..b8e20a93a47ee9e28594678763ce48bd9a41403a 100644 --- a/src/opus_decoder.c +++ b/src/opus_decoder.c @@ -658,18 +658,6 @@ int opus_decoder_ctl(OpusDecoder *st, int request, ...) 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*); diff --git a/src/opus_encoder.c b/src/opus_encoder.c index 5e7c9698c52fc5766d5d14939728786ca2621786..6cd9d26233edcece2488c68e16deca8d7faae657 100644 --- a/src/opus_encoder.c +++ b/src/opus_encoder.c @@ -145,7 +145,7 @@ OpusEncoder *opus_encoder_init(OpusEncoder* st, int Fs, int channels, int applic 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 @@ int opus_encode_float(OpusEncoder *st, const opus_val16 *pcm, int frame_size, } #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 @@ int opus_encoder_ctl(OpusEncoder *st, int request, ...) 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; diff --git a/src/opus_encoder.h b/src/opus_encoder.h index 7b1aaccee7ca975fff9797221a2340edf35abdbd..6769dc656f3388551a0b76c57d4a8a9d0a92f6f2 100644 --- a/src/opus_encoder.h +++ b/src/opus_encoder.h @@ -45,7 +45,7 @@ struct OpusEncoder { int force_mono; int mode; - int user_mode; + int application; int prev_mode; int signal_type; int bandwidth;