From 69549ac05b071e450032fc149cd2a694166d337c Mon Sep 17 00:00:00 2001 From: Jean-Marc Valin <jean-marc.valin@usherbrooke.ca> Date: Thu, 18 Aug 2011 17:28:28 -0400 Subject: [PATCH] Renaming "mode" option to "application" --- src/opus.h | 12 +++++++----- src/opus_decoder.c | 12 ------------ src/opus_encoder.c | 10 +++++----- src/opus_encoder.h | 2 +- 4 files changed, 13 insertions(+), 23 deletions(-) diff --git a/src/opus.h b/src/opus.h index aa18dd060..420f96b85 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 7138854d8..b8e20a93a 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 5e7c9698c..6cd9d2623 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 7b1aaccee..6769dc656 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; -- GitLab