Renaming "mode" option to "application"
This commit is contained in:
parent
468b921096
commit
69549ac05b
4 changed files with 13 additions and 23 deletions
12
src/opus.h
12
src/opus.h
|
@ -94,17 +94,19 @@ extern "C" {
|
||||||
#define OPUS_BANDWIDTH_FULLBAND 1105
|
#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
|
/* Coding bit-rate in bit/second */
|
||||||
#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)
|
|
||||||
|
|
||||||
#define OPUS_SET_BITRATE_REQUEST 2
|
#define OPUS_SET_BITRATE_REQUEST 2
|
||||||
#define OPUS_SET_BITRATE(x) OPUS_SET_BITRATE_REQUEST, __check_int(x)
|
#define OPUS_SET_BITRATE(x) OPUS_SET_BITRATE_REQUEST, __check_int(x)
|
||||||
#define OPUS_GET_BITRATE_REQUEST 3
|
#define OPUS_GET_BITRATE_REQUEST 3
|
||||||
#define OPUS_GET_BITRATE(x) OPUS_GET_BITRATE_REQUEST, __check_int_ptr(x)
|
#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_REQUEST 6
|
||||||
#define OPUS_SET_VBR(x) OPUS_SET_VBR_REQUEST, __check_int(x)
|
#define OPUS_SET_VBR(x) OPUS_SET_VBR_REQUEST, __check_int(x)
|
||||||
#define OPUS_GET_VBR_REQUEST 7
|
#define OPUS_GET_VBR_REQUEST 7
|
||||||
|
|
|
@ -658,18 +658,6 @@ int opus_decoder_ctl(OpusDecoder *st, int request, ...)
|
||||||
|
|
||||||
switch (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:
|
case OPUS_GET_BANDWIDTH_REQUEST:
|
||||||
{
|
{
|
||||||
int *value = va_arg(ap, int*);
|
int *value = va_arg(ap, int*);
|
||||||
|
|
|
@ -145,7 +145,7 @@ OpusEncoder *opus_encoder_init(OpusEncoder* st, int Fs, int channels, int applic
|
||||||
st->use_vbr = 0;
|
st->use_vbr = 0;
|
||||||
st->user_bitrate_bps = OPUS_BITRATE_AUTO;
|
st->user_bitrate_bps = OPUS_BITRATE_AUTO;
|
||||||
st->bitrate_bps = 3000+Fs*channels;
|
st->bitrate_bps = 3000+Fs*channels;
|
||||||
st->user_mode = application;
|
st->application = application;
|
||||||
st->signal_type = OPUS_SIGNAL_AUTO;
|
st->signal_type = OPUS_SIGNAL_AUTO;
|
||||||
st->user_bandwidth = OPUS_BANDWIDTH_AUTO;
|
st->user_bandwidth = OPUS_BANDWIDTH_AUTO;
|
||||||
st->voice_ratio = 90;
|
st->voice_ratio = 90;
|
||||||
|
@ -287,7 +287,7 @@ int opus_encode_float(OpusEncoder *st, const opus_val16 *pcm, int frame_size,
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
/* Mode selection depending on application and signal type */
|
/* 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;
|
opus_int32 threshold = 20000;
|
||||||
/* Hysteresis */
|
/* Hysteresis */
|
||||||
|
@ -756,13 +756,13 @@ int opus_encoder_ctl(OpusEncoder *st, int request, ...)
|
||||||
|
|
||||||
switch (request)
|
switch (request)
|
||||||
{
|
{
|
||||||
case OPUS_SET_MODE_REQUEST:
|
case OPUS_SET_APPLICATION_REQUEST:
|
||||||
{
|
{
|
||||||
int value = va_arg(ap, int);
|
int value = va_arg(ap, int);
|
||||||
st->user_mode = value;
|
st->application = value;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case OPUS_GET_MODE_REQUEST:
|
case OPUS_GET_APPLICATION_REQUEST:
|
||||||
{
|
{
|
||||||
int *value = va_arg(ap, int*);
|
int *value = va_arg(ap, int*);
|
||||||
*value = st->mode;
|
*value = st->mode;
|
||||||
|
|
|
@ -45,7 +45,7 @@ struct OpusEncoder {
|
||||||
int force_mono;
|
int force_mono;
|
||||||
|
|
||||||
int mode;
|
int mode;
|
||||||
int user_mode;
|
int application;
|
||||||
int prev_mode;
|
int prev_mode;
|
||||||
int signal_type;
|
int signal_type;
|
||||||
int bandwidth;
|
int bandwidth;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue