opus_defines.h (38558B)
1 /* Copyright (c) 2010-2011 Xiph.Org Foundation, Skype Limited 2 Written by Jean-Marc Valin and Koen Vos */ 3 /* 4 Redistribution and use in source and binary forms, with or without 5 modification, are permitted provided that the following conditions 6 are met: 7 8 - Redistributions of source code must retain the above copyright 9 notice, this list of conditions and the following disclaimer. 10 11 - Redistributions in binary form must reproduce the above copyright 12 notice, this list of conditions and the following disclaimer in the 13 documentation and/or other materials provided with the distribution. 14 15 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 16 ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 17 LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 18 A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER 19 OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 20 EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 21 PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 22 PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 23 LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 24 NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 25 SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 */ 27 28 /** 29 * @file opus_defines.h 30 * @brief Opus reference implementation constants 31 */ 32 33 #ifndef OPUS_DEFINES_H 34 #define OPUS_DEFINES_H 35 36 #include "opus_types.h" 37 38 #ifdef __cplusplus 39 extern "C" { 40 #endif 41 42 /** @defgroup opus_errorcodes Error codes 43 * @{ 44 */ 45 /** No error @hideinitializer*/ 46 #define OPUS_OK 0 47 /** One or more invalid/out of range arguments @hideinitializer*/ 48 #define OPUS_BAD_ARG -1 49 /** Not enough bytes allocated in the buffer @hideinitializer*/ 50 #define OPUS_BUFFER_TOO_SMALL -2 51 /** An internal error was detected @hideinitializer*/ 52 #define OPUS_INTERNAL_ERROR -3 53 /** The compressed data passed is corrupted @hideinitializer*/ 54 #define OPUS_INVALID_PACKET -4 55 /** Invalid/unsupported request number @hideinitializer*/ 56 #define OPUS_UNIMPLEMENTED -5 57 /** An encoder or decoder structure is invalid or already freed @hideinitializer*/ 58 #define OPUS_INVALID_STATE -6 59 /** Memory allocation has failed @hideinitializer*/ 60 #define OPUS_ALLOC_FAIL -7 61 /**@}*/ 62 63 /** @cond OPUS_INTERNAL_DOC */ 64 /**Export control for opus functions */ 65 66 #ifndef OPUS_EXPORT 67 # if defined(_WIN32) 68 # if defined(OPUS_BUILD) && defined(DLL_EXPORT) 69 # define OPUS_EXPORT __declspec(dllexport) 70 # else 71 # define OPUS_EXPORT 72 # endif 73 # elif defined(__GNUC__) && defined(OPUS_BUILD) 74 # define OPUS_EXPORT __attribute__ ((visibility ("default"))) 75 # else 76 # define OPUS_EXPORT 77 # endif 78 #endif 79 80 # if !defined(OPUS_GNUC_PREREQ) 81 # if defined(__GNUC__)&&defined(__GNUC_MINOR__) 82 # define OPUS_GNUC_PREREQ(_maj,_min) \ 83 ((__GNUC__<<16)+__GNUC_MINOR__>=((_maj)<<16)+(_min)) 84 # else 85 # define OPUS_GNUC_PREREQ(_maj,_min) 0 86 # endif 87 # endif 88 89 #if (!defined(__STDC_VERSION__) || (__STDC_VERSION__ < 199901L) ) 90 # if OPUS_GNUC_PREREQ(3,0) 91 # define OPUS_RESTRICT __restrict__ 92 # elif (defined(_MSC_VER) && _MSC_VER >= 1400) 93 # define OPUS_RESTRICT __restrict 94 # else 95 # define OPUS_RESTRICT 96 # endif 97 #else 98 # define OPUS_RESTRICT restrict 99 #endif 100 101 #if (!defined(__STDC_VERSION__) || (__STDC_VERSION__ < 199901L) ) 102 # if OPUS_GNUC_PREREQ(2,7) 103 # define OPUS_INLINE __inline__ 104 # elif (defined(_MSC_VER)) 105 # define OPUS_INLINE __inline 106 # else 107 # define OPUS_INLINE 108 # endif 109 #else 110 # define OPUS_INLINE inline 111 #endif 112 113 /**Warning attributes for opus functions 114 * NONNULL is not used in OPUS_BUILD to avoid the compiler optimizing out 115 * some paranoid null checks. */ 116 #if defined(__GNUC__) && OPUS_GNUC_PREREQ(3, 4) 117 # define OPUS_WARN_UNUSED_RESULT __attribute__ ((__warn_unused_result__)) 118 #else 119 # define OPUS_WARN_UNUSED_RESULT 120 #endif 121 #if !defined(OPUS_BUILD) && defined(__GNUC__) && OPUS_GNUC_PREREQ(3, 4) 122 # define OPUS_ARG_NONNULL(_x) __attribute__ ((__nonnull__(_x))) 123 #else 124 # define OPUS_ARG_NONNULL(_x) 125 #endif 126 127 /** These are the actual Encoder CTL ID numbers. 128 * They should not be used directly by applications. 129 * In general, SETs should be even and GETs should be odd.*/ 130 #define OPUS_SET_APPLICATION_REQUEST 4000 131 #define OPUS_GET_APPLICATION_REQUEST 4001 132 #define OPUS_SET_BITRATE_REQUEST 4002 133 #define OPUS_GET_BITRATE_REQUEST 4003 134 #define OPUS_SET_MAX_BANDWIDTH_REQUEST 4004 135 #define OPUS_GET_MAX_BANDWIDTH_REQUEST 4005 136 #define OPUS_SET_VBR_REQUEST 4006 137 #define OPUS_GET_VBR_REQUEST 4007 138 #define OPUS_SET_BANDWIDTH_REQUEST 4008 139 #define OPUS_GET_BANDWIDTH_REQUEST 4009 140 #define OPUS_SET_COMPLEXITY_REQUEST 4010 141 #define OPUS_GET_COMPLEXITY_REQUEST 4011 142 #define OPUS_SET_INBAND_FEC_REQUEST 4012 143 #define OPUS_GET_INBAND_FEC_REQUEST 4013 144 #define OPUS_SET_PACKET_LOSS_PERC_REQUEST 4014 145 #define OPUS_GET_PACKET_LOSS_PERC_REQUEST 4015 146 #define OPUS_SET_DTX_REQUEST 4016 147 #define OPUS_GET_DTX_REQUEST 4017 148 #define OPUS_SET_VBR_CONSTRAINT_REQUEST 4020 149 #define OPUS_GET_VBR_CONSTRAINT_REQUEST 4021 150 #define OPUS_SET_FORCE_CHANNELS_REQUEST 4022 151 #define OPUS_GET_FORCE_CHANNELS_REQUEST 4023 152 #define OPUS_SET_SIGNAL_REQUEST 4024 153 #define OPUS_GET_SIGNAL_REQUEST 4025 154 #define OPUS_GET_LOOKAHEAD_REQUEST 4027 155 /* #define OPUS_RESET_STATE 4028 */ 156 #define OPUS_GET_SAMPLE_RATE_REQUEST 4029 157 #define OPUS_GET_FINAL_RANGE_REQUEST 4031 158 #define OPUS_GET_PITCH_REQUEST 4033 159 #define OPUS_SET_GAIN_REQUEST 4034 160 #define OPUS_GET_GAIN_REQUEST 4045 /* Should have been 4035 */ 161 #define OPUS_SET_LSB_DEPTH_REQUEST 4036 162 #define OPUS_GET_LSB_DEPTH_REQUEST 4037 163 #define OPUS_GET_LAST_PACKET_DURATION_REQUEST 4039 164 #define OPUS_SET_EXPERT_FRAME_DURATION_REQUEST 4040 165 #define OPUS_GET_EXPERT_FRAME_DURATION_REQUEST 4041 166 #define OPUS_SET_PREDICTION_DISABLED_REQUEST 4042 167 #define OPUS_GET_PREDICTION_DISABLED_REQUEST 4043 168 /* Don't use 4045, it's already taken by OPUS_GET_GAIN_REQUEST */ 169 #define OPUS_SET_PHASE_INVERSION_DISABLED_REQUEST 4046 170 #define OPUS_GET_PHASE_INVERSION_DISABLED_REQUEST 4047 171 #define OPUS_GET_IN_DTX_REQUEST 4049 172 #define OPUS_SET_DRED_DURATION_REQUEST 4050 173 #define OPUS_GET_DRED_DURATION_REQUEST 4051 174 #define OPUS_SET_DNN_BLOB_REQUEST 4052 175 /*#define OPUS_GET_DNN_BLOB_REQUEST 4053 */ 176 #define OPUS_SET_OSCE_BWE_REQUEST 4054 177 #define OPUS_GET_OSCE_BWE_REQUEST 4055 178 #define OPUS_SET_QEXT_REQUEST 4056 179 #define OPUS_GET_QEXT_REQUEST 4057 180 #define OPUS_SET_IGNORE_EXTENSIONS_REQUEST 4058 181 #define OPUS_GET_IGNORE_EXTENSIONS_REQUEST 4059 182 183 /** Defines for the presence of extended APIs. */ 184 #define OPUS_HAVE_OPUS_PROJECTION_H 185 186 /* Macros to trigger compilation errors when the wrong types are provided to a CTL */ 187 #define opus_check_int(x) (((void)((x) == (opus_int32)0)), (opus_int32)(x)) 188 189 #ifdef DISABLE_PTR_CHECK 190 /* Disable checks to prevent ubsan from complaining about NULL checks 191 in test_opus_api. */ 192 #define opus_check_int_ptr(ptr) (ptr) 193 #define opus_check_uint_ptr(ptr) (ptr) 194 #define opus_check_uint8_ptr(ptr) (ptr) 195 #define opus_check_val16_ptr(ptr) (ptr) 196 #define opus_check_void_ptr(ptr) (ptr) 197 #else 198 #define opus_check_int_ptr(ptr) ((ptr) + ((ptr) - (opus_int32*)(ptr))) 199 #define opus_check_uint_ptr(ptr) ((ptr) + ((ptr) - (opus_uint32*)(ptr))) 200 #define opus_check_uint8_ptr(ptr) ((ptr) + ((ptr) - (opus_uint8*)(ptr))) 201 #define opus_check_val16_ptr(ptr) ((ptr) + ((ptr) - (opus_val16*)(ptr))) 202 #define opus_check_void_ptr(x) ((void)((void *)0 == (x)), (x)) 203 #endif 204 /** @endcond */ 205 206 /** @defgroup opus_ctlvalues Pre-defined values for CTL interface 207 * @see opus_genericctls, opus_encoderctls 208 * @{ 209 */ 210 /* Values for the various encoder CTLs */ 211 #define OPUS_AUTO -1000 /**<Auto/default setting @hideinitializer*/ 212 #define OPUS_BITRATE_MAX -1 /**<Maximum bitrate @hideinitializer*/ 213 214 /** Best for most VoIP/videoconference applications where listening quality and intelligibility matter most 215 * @hideinitializer */ 216 #define OPUS_APPLICATION_VOIP 2048 217 /** Best for broadcast/high-fidelity application where the decoded audio should be as close as possible to the input 218 * @hideinitializer */ 219 #define OPUS_APPLICATION_AUDIO 2049 220 /** Only use when lowest-achievable latency is what matters most. Voice-optimized modes cannot be used. 221 * @hideinitializer */ 222 #define OPUS_APPLICATION_RESTRICTED_LOWDELAY 2051 223 /** Experts only: forces SILK encoding; don't allocate CELT state at all. Disables OPUS_SET_APPLICATION. */ 224 #define OPUS_APPLICATION_RESTRICTED_SILK 2052 225 /** Experts only: forces CELT encoding; don't allocate SILK state at all. Disables OPUS_SET_APPLICATION. */ 226 #define OPUS_APPLICATION_RESTRICTED_CELT 2053 227 228 #define OPUS_SIGNAL_VOICE 3001 /**< Signal being encoded is voice */ 229 #define OPUS_SIGNAL_MUSIC 3002 /**< Signal being encoded is music */ 230 #define OPUS_BANDWIDTH_NARROWBAND 1101 /**< 4 kHz bandpass @hideinitializer*/ 231 #define OPUS_BANDWIDTH_MEDIUMBAND 1102 /**< 6 kHz bandpass @hideinitializer*/ 232 #define OPUS_BANDWIDTH_WIDEBAND 1103 /**< 8 kHz bandpass @hideinitializer*/ 233 #define OPUS_BANDWIDTH_SUPERWIDEBAND 1104 /**<12 kHz bandpass @hideinitializer*/ 234 #define OPUS_BANDWIDTH_FULLBAND 1105 /**<20 kHz bandpass @hideinitializer*/ 235 236 #define OPUS_FRAMESIZE_ARG 5000 /**< Select frame size from the argument (default) */ 237 #define OPUS_FRAMESIZE_2_5_MS 5001 /**< Use 2.5 ms frames */ 238 #define OPUS_FRAMESIZE_5_MS 5002 /**< Use 5 ms frames */ 239 #define OPUS_FRAMESIZE_10_MS 5003 /**< Use 10 ms frames */ 240 #define OPUS_FRAMESIZE_20_MS 5004 /**< Use 20 ms frames */ 241 #define OPUS_FRAMESIZE_40_MS 5005 /**< Use 40 ms frames */ 242 #define OPUS_FRAMESIZE_60_MS 5006 /**< Use 60 ms frames */ 243 #define OPUS_FRAMESIZE_80_MS 5007 /**< Use 80 ms frames */ 244 #define OPUS_FRAMESIZE_100_MS 5008 /**< Use 100 ms frames */ 245 #define OPUS_FRAMESIZE_120_MS 5009 /**< Use 120 ms frames */ 246 247 /**@}*/ 248 249 250 /** @defgroup opus_encoderctls Encoder related CTLs 251 * 252 * These are convenience macros for use with the \c opus_encode_ctl 253 * interface. They are used to generate the appropriate series of 254 * arguments for that call, passing the correct type, size and so 255 * on as expected for each particular request. 256 * 257 * Some usage examples: 258 * 259 * @code 260 * int ret; 261 * ret = opus_encoder_ctl(enc_ctx, OPUS_SET_BANDWIDTH(OPUS_AUTO)); 262 * if (ret != OPUS_OK) return ret; 263 * 264 * opus_int32 rate; 265 * opus_encoder_ctl(enc_ctx, OPUS_GET_BANDWIDTH(&rate)); 266 * 267 * opus_encoder_ctl(enc_ctx, OPUS_RESET_STATE); 268 * @endcode 269 * 270 * @see opus_genericctls, opus_encoder 271 * @{ 272 */ 273 274 /** Configures the encoder's computational complexity. 275 * The supported range is 0-10 inclusive with 10 representing the highest complexity. 276 * @see OPUS_GET_COMPLEXITY 277 * @param[in] x <tt>opus_int32</tt>: Allowed values: 0-10, inclusive. 278 * 279 * @hideinitializer */ 280 #define OPUS_SET_COMPLEXITY(x) OPUS_SET_COMPLEXITY_REQUEST, opus_check_int(x) 281 /** Gets the encoder's complexity configuration. 282 * @see OPUS_SET_COMPLEXITY 283 * @param[out] x <tt>opus_int32 *</tt>: Returns a value in the range 0-10, 284 * inclusive. 285 * @hideinitializer */ 286 #define OPUS_GET_COMPLEXITY(x) OPUS_GET_COMPLEXITY_REQUEST, opus_check_int_ptr(x) 287 288 /** Configures the bitrate in the encoder. 289 * Rates from 500 to 512000 bits per second are meaningful, as well as the 290 * special values #OPUS_AUTO and #OPUS_BITRATE_MAX. 291 * The value #OPUS_BITRATE_MAX can be used to cause the codec to use as much 292 * rate as it can, which is useful for controlling the rate by adjusting the 293 * output buffer size. 294 * @see OPUS_GET_BITRATE 295 * @param[in] x <tt>opus_int32</tt>: Bitrate in bits per second. The default 296 * is determined based on the number of 297 * channels and the input sampling rate. 298 * @hideinitializer */ 299 #define OPUS_SET_BITRATE(x) OPUS_SET_BITRATE_REQUEST, opus_check_int(x) 300 /** Gets the encoder's bitrate configuration. 301 * @see OPUS_SET_BITRATE 302 * @param[out] x <tt>opus_int32 *</tt>: Returns the bitrate in bits per second. 303 * The default is determined based on the 304 * number of channels and the input 305 * sampling rate. 306 * @hideinitializer */ 307 #define OPUS_GET_BITRATE(x) OPUS_GET_BITRATE_REQUEST, opus_check_int_ptr(x) 308 309 /** Enables or disables variable bitrate (VBR) in the encoder. 310 * The configured bitrate may not be met exactly because frames must 311 * be an integer number of bytes in length. 312 * @see OPUS_GET_VBR 313 * @see OPUS_SET_VBR_CONSTRAINT 314 * @param[in] x <tt>opus_int32</tt>: Allowed values: 315 * <dl> 316 * <dt>0</dt><dd>Hard CBR. For LPC/hybrid modes at very low bit-rate, this can 317 * cause noticeable quality degradation.</dd> 318 * <dt>1</dt><dd>VBR (default). The exact type of VBR is controlled by 319 * #OPUS_SET_VBR_CONSTRAINT.</dd> 320 * </dl> 321 * @hideinitializer */ 322 #define OPUS_SET_VBR(x) OPUS_SET_VBR_REQUEST, opus_check_int(x) 323 /** Determine if variable bitrate (VBR) is enabled in the encoder. 324 * @see OPUS_SET_VBR 325 * @see OPUS_GET_VBR_CONSTRAINT 326 * @param[out] x <tt>opus_int32 *</tt>: Returns one of the following values: 327 * <dl> 328 * <dt>0</dt><dd>Hard CBR.</dd> 329 * <dt>1</dt><dd>VBR (default). The exact type of VBR may be retrieved via 330 * #OPUS_GET_VBR_CONSTRAINT.</dd> 331 * </dl> 332 * @hideinitializer */ 333 #define OPUS_GET_VBR(x) OPUS_GET_VBR_REQUEST, opus_check_int_ptr(x) 334 335 /** Enables or disables constrained VBR in the encoder. 336 * This setting is ignored when the encoder is in CBR mode. 337 * @warning Only the MDCT mode of Opus currently heeds the constraint. 338 * Speech mode ignores it completely, hybrid mode may fail to obey it 339 * if the LPC layer uses more bitrate than the constraint would have 340 * permitted. 341 * @see OPUS_GET_VBR_CONSTRAINT 342 * @see OPUS_SET_VBR 343 * @param[in] x <tt>opus_int32</tt>: Allowed values: 344 * <dl> 345 * <dt>0</dt><dd>Unconstrained VBR.</dd> 346 * <dt>1</dt><dd>Constrained VBR (default). This creates a maximum of one 347 * frame of buffering delay assuming a transport with a 348 * serialization speed of the nominal bitrate.</dd> 349 * </dl> 350 * @hideinitializer */ 351 #define OPUS_SET_VBR_CONSTRAINT(x) OPUS_SET_VBR_CONSTRAINT_REQUEST, opus_check_int(x) 352 /** Determine if constrained VBR is enabled in the encoder. 353 * @see OPUS_SET_VBR_CONSTRAINT 354 * @see OPUS_GET_VBR 355 * @param[out] x <tt>opus_int32 *</tt>: Returns one of the following values: 356 * <dl> 357 * <dt>0</dt><dd>Unconstrained VBR.</dd> 358 * <dt>1</dt><dd>Constrained VBR (default).</dd> 359 * </dl> 360 * @hideinitializer */ 361 #define OPUS_GET_VBR_CONSTRAINT(x) OPUS_GET_VBR_CONSTRAINT_REQUEST, opus_check_int_ptr(x) 362 363 /** Configures mono/stereo forcing in the encoder. 364 * This can force the encoder to produce packets encoded as either mono or 365 * stereo, regardless of the format of the input audio. This is useful when 366 * the caller knows that the input signal is currently a mono source embedded 367 * in a stereo stream. 368 * @see OPUS_GET_FORCE_CHANNELS 369 * @param[in] x <tt>opus_int32</tt>: Allowed values: 370 * <dl> 371 * <dt>#OPUS_AUTO</dt><dd>Not forced (default)</dd> 372 * <dt>1</dt> <dd>Forced mono</dd> 373 * <dt>2</dt> <dd>Forced stereo</dd> 374 * </dl> 375 * @hideinitializer */ 376 #define OPUS_SET_FORCE_CHANNELS(x) OPUS_SET_FORCE_CHANNELS_REQUEST, opus_check_int(x) 377 /** Gets the encoder's forced channel configuration. 378 * @see OPUS_SET_FORCE_CHANNELS 379 * @param[out] x <tt>opus_int32 *</tt>: 380 * <dl> 381 * <dt>#OPUS_AUTO</dt><dd>Not forced (default)</dd> 382 * <dt>1</dt> <dd>Forced mono</dd> 383 * <dt>2</dt> <dd>Forced stereo</dd> 384 * </dl> 385 * @hideinitializer */ 386 #define OPUS_GET_FORCE_CHANNELS(x) OPUS_GET_FORCE_CHANNELS_REQUEST, opus_check_int_ptr(x) 387 388 /** Configures the maximum bandpass that the encoder will select automatically. 389 * Applications should normally use this instead of #OPUS_SET_BANDWIDTH 390 * (leaving that set to the default, #OPUS_AUTO). This allows the 391 * application to set an upper bound based on the type of input it is 392 * providing, but still gives the encoder the freedom to reduce the bandpass 393 * when the bitrate becomes too low, for better overall quality. 394 * @see OPUS_GET_MAX_BANDWIDTH 395 * @param[in] x <tt>opus_int32</tt>: Allowed values: 396 * <dl> 397 * <dt>OPUS_BANDWIDTH_NARROWBAND</dt> <dd>4 kHz passband</dd> 398 * <dt>OPUS_BANDWIDTH_MEDIUMBAND</dt> <dd>6 kHz passband</dd> 399 * <dt>OPUS_BANDWIDTH_WIDEBAND</dt> <dd>8 kHz passband</dd> 400 * <dt>OPUS_BANDWIDTH_SUPERWIDEBAND</dt><dd>12 kHz passband</dd> 401 * <dt>OPUS_BANDWIDTH_FULLBAND</dt> <dd>20 kHz passband (default)</dd> 402 * </dl> 403 * @hideinitializer */ 404 #define OPUS_SET_MAX_BANDWIDTH(x) OPUS_SET_MAX_BANDWIDTH_REQUEST, opus_check_int(x) 405 406 /** Gets the encoder's configured maximum allowed bandpass. 407 * @see OPUS_SET_MAX_BANDWIDTH 408 * @param[out] x <tt>opus_int32 *</tt>: Allowed values: 409 * <dl> 410 * <dt>#OPUS_BANDWIDTH_NARROWBAND</dt> <dd>4 kHz passband</dd> 411 * <dt>#OPUS_BANDWIDTH_MEDIUMBAND</dt> <dd>6 kHz passband</dd> 412 * <dt>#OPUS_BANDWIDTH_WIDEBAND</dt> <dd>8 kHz passband</dd> 413 * <dt>#OPUS_BANDWIDTH_SUPERWIDEBAND</dt><dd>12 kHz passband</dd> 414 * <dt>#OPUS_BANDWIDTH_FULLBAND</dt> <dd>20 kHz passband (default)</dd> 415 * </dl> 416 * @hideinitializer */ 417 #define OPUS_GET_MAX_BANDWIDTH(x) OPUS_GET_MAX_BANDWIDTH_REQUEST, opus_check_int_ptr(x) 418 419 /** Sets the encoder's bandpass to a specific value. 420 * This prevents the encoder from automatically selecting the bandpass based 421 * on the available bitrate. If an application knows the bandpass of the input 422 * audio it is providing, it should normally use #OPUS_SET_MAX_BANDWIDTH 423 * instead, which still gives the encoder the freedom to reduce the bandpass 424 * when the bitrate becomes too low, for better overall quality. 425 * @see OPUS_GET_BANDWIDTH 426 * @param[in] x <tt>opus_int32</tt>: Allowed values: 427 * <dl> 428 * <dt>#OPUS_AUTO</dt> <dd>(default)</dd> 429 * <dt>#OPUS_BANDWIDTH_NARROWBAND</dt> <dd>4 kHz passband</dd> 430 * <dt>#OPUS_BANDWIDTH_MEDIUMBAND</dt> <dd>6 kHz passband</dd> 431 * <dt>#OPUS_BANDWIDTH_WIDEBAND</dt> <dd>8 kHz passband</dd> 432 * <dt>#OPUS_BANDWIDTH_SUPERWIDEBAND</dt><dd>12 kHz passband</dd> 433 * <dt>#OPUS_BANDWIDTH_FULLBAND</dt> <dd>20 kHz passband</dd> 434 * </dl> 435 * @hideinitializer */ 436 #define OPUS_SET_BANDWIDTH(x) OPUS_SET_BANDWIDTH_REQUEST, opus_check_int(x) 437 438 /** Configures the type of signal being encoded. 439 * This is a hint which helps the encoder's mode selection. 440 * @see OPUS_GET_SIGNAL 441 * @param[in] x <tt>opus_int32</tt>: Allowed values: 442 * <dl> 443 * <dt>#OPUS_AUTO</dt> <dd>(default)</dd> 444 * <dt>#OPUS_SIGNAL_VOICE</dt><dd>Bias thresholds towards choosing LPC or Hybrid modes.</dd> 445 * <dt>#OPUS_SIGNAL_MUSIC</dt><dd>Bias thresholds towards choosing MDCT modes.</dd> 446 * </dl> 447 * @hideinitializer */ 448 #define OPUS_SET_SIGNAL(x) OPUS_SET_SIGNAL_REQUEST, opus_check_int(x) 449 /** Gets the encoder's configured signal type. 450 * @see OPUS_SET_SIGNAL 451 * @param[out] x <tt>opus_int32 *</tt>: Returns one of the following values: 452 * <dl> 453 * <dt>#OPUS_AUTO</dt> <dd>(default)</dd> 454 * <dt>#OPUS_SIGNAL_VOICE</dt><dd>Bias thresholds towards choosing LPC or Hybrid modes.</dd> 455 * <dt>#OPUS_SIGNAL_MUSIC</dt><dd>Bias thresholds towards choosing MDCT modes.</dd> 456 * </dl> 457 * @hideinitializer */ 458 #define OPUS_GET_SIGNAL(x) OPUS_GET_SIGNAL_REQUEST, opus_check_int_ptr(x) 459 460 461 /** Configures the encoder's intended application. 462 * The initial value is a mandatory argument to the encoder_create function. 463 * @see OPUS_GET_APPLICATION 464 * @param[in] x <tt>opus_int32</tt>: Returns one of the following values: 465 * <dl> 466 * <dt>#OPUS_APPLICATION_VOIP</dt> 467 * <dd>Process signal for improved speech intelligibility.</dd> 468 * <dt>#OPUS_APPLICATION_AUDIO</dt> 469 * <dd>Favor faithfulness to the original input.</dd> 470 * <dt>#OPUS_APPLICATION_RESTRICTED_LOWDELAY</dt> 471 * <dd>Configure the minimum possible coding delay by disabling certain modes 472 * of operation.</dd> 473 * </dl> 474 * @hideinitializer */ 475 #define OPUS_SET_APPLICATION(x) OPUS_SET_APPLICATION_REQUEST, opus_check_int(x) 476 /** Gets the encoder's configured application. 477 * @see OPUS_SET_APPLICATION 478 * @param[out] x <tt>opus_int32 *</tt>: Returns one of the following values: 479 * <dl> 480 * <dt>#OPUS_APPLICATION_VOIP</dt> 481 * <dd>Process signal for improved speech intelligibility.</dd> 482 * <dt>#OPUS_APPLICATION_AUDIO</dt> 483 * <dd>Favor faithfulness to the original input.</dd> 484 * <dt>#OPUS_APPLICATION_RESTRICTED_LOWDELAY</dt> 485 * <dd>Configure the minimum possible coding delay by disabling certain modes 486 * of operation.</dd> 487 * </dl> 488 * @hideinitializer */ 489 #define OPUS_GET_APPLICATION(x) OPUS_GET_APPLICATION_REQUEST, opus_check_int_ptr(x) 490 491 /** Gets the total samples of delay added by the entire codec. 492 * This can be queried by the encoder and then the provided number of samples can be 493 * skipped on from the start of the decoder's output to provide time aligned input 494 * and output. From the perspective of a decoding application the real data begins this many 495 * samples late. 496 * 497 * The decoder contribution to this delay is identical for all decoders, but the 498 * encoder portion of the delay may vary from implementation to implementation, 499 * version to version, or even depend on the encoder's initial configuration. 500 * Applications needing delay compensation should call this CTL rather than 501 * hard-coding a value. 502 * @param[out] x <tt>opus_int32 *</tt>: Number of lookahead samples 503 * @hideinitializer */ 504 #define OPUS_GET_LOOKAHEAD(x) OPUS_GET_LOOKAHEAD_REQUEST, opus_check_int_ptr(x) 505 506 /** Configures the encoder's use of inband forward error correction (FEC). 507 * @note This is only applicable to the LPC layer 508 * @see OPUS_GET_INBAND_FEC 509 * @param[in] x <tt>opus_int32</tt>: Allowed values: 510 * <dl> 511 * <dt>0</dt><dd>Disable inband FEC (default).</dd> 512 * <dt>1</dt><dd>Inband FEC enabled. If the packet loss rate is sufficiently high, Opus will automatically switch to SILK even at high rates to enable use of that FEC.</dd> 513 * <dt>2</dt><dd>Inband FEC enabled, but does not necessarily switch to SILK if we have music.</dd> 514 * </dl> 515 * @hideinitializer */ 516 #define OPUS_SET_INBAND_FEC(x) OPUS_SET_INBAND_FEC_REQUEST, opus_check_int(x) 517 /** Gets encoder's configured use of inband forward error correction. 518 * @see OPUS_SET_INBAND_FEC 519 * @param[out] x <tt>opus_int32 *</tt>: Returns one of the following values: 520 * <dl> 521 * <dt>0</dt><dd>Inband FEC disabled (default).</dd> 522 * <dt>1</dt><dd>Inband FEC enabled. If the packet loss rate is sufficiently high, Opus will automatically switch to SILK even at high rates to enable use of that FEC.</dd> 523 * <dt>2</dt><dd>Inband FEC enabled, but does not necessarily switch to SILK if we have music.</dd> 524 * </dl> 525 * @hideinitializer */ 526 #define OPUS_GET_INBAND_FEC(x) OPUS_GET_INBAND_FEC_REQUEST, opus_check_int_ptr(x) 527 528 /** Configures the encoder's expected packet loss percentage. 529 * Higher values trigger progressively more loss resistant behavior in the encoder 530 * at the expense of quality at a given bitrate in the absence of packet loss, but 531 * greater quality under loss. 532 * @see OPUS_GET_PACKET_LOSS_PERC 533 * @param[in] x <tt>opus_int32</tt>: Loss percentage in the range 0-100, inclusive (default: 0). 534 * @hideinitializer */ 535 #define OPUS_SET_PACKET_LOSS_PERC(x) OPUS_SET_PACKET_LOSS_PERC_REQUEST, opus_check_int(x) 536 /** Gets the encoder's configured packet loss percentage. 537 * @see OPUS_SET_PACKET_LOSS_PERC 538 * @param[out] x <tt>opus_int32 *</tt>: Returns the configured loss percentage 539 * in the range 0-100, inclusive (default: 0). 540 * @hideinitializer */ 541 #define OPUS_GET_PACKET_LOSS_PERC(x) OPUS_GET_PACKET_LOSS_PERC_REQUEST, opus_check_int_ptr(x) 542 543 /** Configures the encoder's use of discontinuous transmission (DTX). 544 * @note This is only applicable to the LPC layer 545 * @see OPUS_GET_DTX 546 * @param[in] x <tt>opus_int32</tt>: Allowed values: 547 * <dl> 548 * <dt>0</dt><dd>Disable DTX (default).</dd> 549 * <dt>1</dt><dd>Enabled DTX.</dd> 550 * </dl> 551 * @hideinitializer */ 552 #define OPUS_SET_DTX(x) OPUS_SET_DTX_REQUEST, opus_check_int(x) 553 /** Gets encoder's configured use of discontinuous transmission. 554 * @see OPUS_SET_DTX 555 * @param[out] x <tt>opus_int32 *</tt>: Returns one of the following values: 556 * <dl> 557 * <dt>0</dt><dd>DTX disabled (default).</dd> 558 * <dt>1</dt><dd>DTX enabled.</dd> 559 * </dl> 560 * @hideinitializer */ 561 #define OPUS_GET_DTX(x) OPUS_GET_DTX_REQUEST, opus_check_int_ptr(x) 562 /** Configures the depth of signal being encoded. 563 * 564 * This is a hint which helps the encoder identify silence and near-silence. 565 * It represents the number of significant bits of linear intensity below 566 * which the signal contains ignorable quantization or other noise. 567 * 568 * For example, OPUS_SET_LSB_DEPTH(14) would be an appropriate setting 569 * for G.711 u-law input. OPUS_SET_LSB_DEPTH(16) would be appropriate 570 * for 16-bit linear pcm input with opus_encode_float(). 571 * 572 * When using opus_encode() instead of opus_encode_float(), or when libopus 573 * is compiled for fixed-point, the encoder uses the minimum of the value 574 * set here and the value 16. 575 * 576 * @see OPUS_GET_LSB_DEPTH 577 * @param[in] x <tt>opus_int32</tt>: Input precision in bits, between 8 and 24 578 * (default: 24). 579 * @hideinitializer */ 580 #define OPUS_SET_LSB_DEPTH(x) OPUS_SET_LSB_DEPTH_REQUEST, opus_check_int(x) 581 /** Gets the encoder's configured signal depth. 582 * @see OPUS_SET_LSB_DEPTH 583 * @param[out] x <tt>opus_int32 *</tt>: Input precision in bits, between 8 and 584 * 24 (default: 24). 585 * @hideinitializer */ 586 #define OPUS_GET_LSB_DEPTH(x) OPUS_GET_LSB_DEPTH_REQUEST, opus_check_int_ptr(x) 587 588 /** Configures the encoder's use of variable duration frames. 589 * When variable duration is enabled, the encoder is free to use a shorter frame 590 * size than the one requested in the opus_encode*() call. 591 * It is then the user's responsibility 592 * to verify how much audio was encoded by checking the ToC byte of the encoded 593 * packet. The part of the audio that was not encoded needs to be resent to the 594 * encoder for the next call. Do not use this option unless you <b>really</b> 595 * know what you are doing. 596 * @see OPUS_GET_EXPERT_FRAME_DURATION 597 * @param[in] x <tt>opus_int32</tt>: Allowed values: 598 * <dl> 599 * <dt>OPUS_FRAMESIZE_ARG</dt><dd>Select frame size from the argument (default).</dd> 600 * <dt>OPUS_FRAMESIZE_2_5_MS</dt><dd>Use 2.5 ms frames.</dd> 601 * <dt>OPUS_FRAMESIZE_5_MS</dt><dd>Use 5 ms frames.</dd> 602 * <dt>OPUS_FRAMESIZE_10_MS</dt><dd>Use 10 ms frames.</dd> 603 * <dt>OPUS_FRAMESIZE_20_MS</dt><dd>Use 20 ms frames.</dd> 604 * <dt>OPUS_FRAMESIZE_40_MS</dt><dd>Use 40 ms frames.</dd> 605 * <dt>OPUS_FRAMESIZE_60_MS</dt><dd>Use 60 ms frames.</dd> 606 * <dt>OPUS_FRAMESIZE_80_MS</dt><dd>Use 80 ms frames.</dd> 607 * <dt>OPUS_FRAMESIZE_100_MS</dt><dd>Use 100 ms frames.</dd> 608 * <dt>OPUS_FRAMESIZE_120_MS</dt><dd>Use 120 ms frames.</dd> 609 * </dl> 610 * @hideinitializer */ 611 #define OPUS_SET_EXPERT_FRAME_DURATION(x) OPUS_SET_EXPERT_FRAME_DURATION_REQUEST, opus_check_int(x) 612 /** Gets the encoder's configured use of variable duration frames. 613 * @see OPUS_SET_EXPERT_FRAME_DURATION 614 * @param[out] x <tt>opus_int32 *</tt>: Returns one of the following values: 615 * <dl> 616 * <dt>OPUS_FRAMESIZE_ARG</dt><dd>Select frame size from the argument (default).</dd> 617 * <dt>OPUS_FRAMESIZE_2_5_MS</dt><dd>Use 2.5 ms frames.</dd> 618 * <dt>OPUS_FRAMESIZE_5_MS</dt><dd>Use 5 ms frames.</dd> 619 * <dt>OPUS_FRAMESIZE_10_MS</dt><dd>Use 10 ms frames.</dd> 620 * <dt>OPUS_FRAMESIZE_20_MS</dt><dd>Use 20 ms frames.</dd> 621 * <dt>OPUS_FRAMESIZE_40_MS</dt><dd>Use 40 ms frames.</dd> 622 * <dt>OPUS_FRAMESIZE_60_MS</dt><dd>Use 60 ms frames.</dd> 623 * <dt>OPUS_FRAMESIZE_80_MS</dt><dd>Use 80 ms frames.</dd> 624 * <dt>OPUS_FRAMESIZE_100_MS</dt><dd>Use 100 ms frames.</dd> 625 * <dt>OPUS_FRAMESIZE_120_MS</dt><dd>Use 120 ms frames.</dd> 626 * </dl> 627 * @hideinitializer */ 628 #define OPUS_GET_EXPERT_FRAME_DURATION(x) OPUS_GET_EXPERT_FRAME_DURATION_REQUEST, opus_check_int_ptr(x) 629 630 /** If set to 1, disables almost all use of prediction, making frames almost 631 * completely independent. This reduces quality. 632 * @see OPUS_GET_PREDICTION_DISABLED 633 * @param[in] x <tt>opus_int32</tt>: Allowed values: 634 * <dl> 635 * <dt>0</dt><dd>Enable prediction (default).</dd> 636 * <dt>1</dt><dd>Disable prediction.</dd> 637 * </dl> 638 * @hideinitializer */ 639 #define OPUS_SET_PREDICTION_DISABLED(x) OPUS_SET_PREDICTION_DISABLED_REQUEST, opus_check_int(x) 640 /** Gets the encoder's configured prediction status. 641 * @see OPUS_SET_PREDICTION_DISABLED 642 * @param[out] x <tt>opus_int32 *</tt>: Returns one of the following values: 643 * <dl> 644 * <dt>0</dt><dd>Prediction enabled (default).</dd> 645 * <dt>1</dt><dd>Prediction disabled.</dd> 646 * </dl> 647 * @hideinitializer */ 648 #define OPUS_GET_PREDICTION_DISABLED(x) OPUS_GET_PREDICTION_DISABLED_REQUEST, opus_check_int_ptr(x) 649 650 /** If non-zero, enables Deep Redundancy (DRED) and use the specified maximum number of 10-ms redundant frames 651 * @hideinitializer */ 652 #define OPUS_SET_DRED_DURATION(x) OPUS_SET_DRED_DURATION_REQUEST, opus_check_int(x) 653 /** Gets the encoder's configured Deep Redundancy (DRED) maximum number of frames. 654 * @hideinitializer */ 655 #define OPUS_GET_DRED_DURATION(x) OPUS_GET_DRED_DURATION_REQUEST, opus_check_int_ptr(x) 656 657 /** Provide external DNN weights from binary object (only when explicitly built without the weights) 658 * @hideinitializer */ 659 #define OPUS_SET_DNN_BLOB(data, len) OPUS_SET_DNN_BLOB_REQUEST, opus_check_void_ptr(data), opus_check_int(len) 660 661 /** If set to 1, enables quality extension (QEXT), otherwise disables it (default). Warning: This will *hurt* audio quality unless operating at 662 a very high bitrate. 663 * @hideinitializer */ 664 #define OPUS_SET_QEXT(x) OPUS_SET_QEXT_REQUEST, opus_check_int(x) 665 /** Gets the encoder's configured quality extension (QEXT). 666 * @hideinitializer */ 667 #define OPUS_GET_QEXT(x) OPUS_GET_QEXT_REQUEST, opus_check_int_ptr(x) 668 669 /**@}*/ 670 671 /** @defgroup opus_genericctls Generic CTLs 672 * 673 * These macros are used with the \c opus_decoder_ctl and 674 * \c opus_encoder_ctl calls to generate a particular 675 * request. 676 * 677 * When called on an \c OpusDecoder they apply to that 678 * particular decoder instance. When called on an 679 * \c OpusEncoder they apply to the corresponding setting 680 * on that encoder instance, if present. 681 * 682 * Some usage examples: 683 * 684 * @code 685 * int ret; 686 * opus_int32 pitch; 687 * ret = opus_decoder_ctl(dec_ctx, OPUS_GET_PITCH(&pitch)); 688 * if (ret == OPUS_OK) return ret; 689 * 690 * opus_encoder_ctl(enc_ctx, OPUS_RESET_STATE); 691 * opus_decoder_ctl(dec_ctx, OPUS_RESET_STATE); 692 * 693 * opus_int32 enc_bw, dec_bw; 694 * opus_encoder_ctl(enc_ctx, OPUS_GET_BANDWIDTH(&enc_bw)); 695 * opus_decoder_ctl(dec_ctx, OPUS_GET_BANDWIDTH(&dec_bw)); 696 * if (enc_bw != dec_bw) { 697 * printf("packet bandwidth mismatch!\n"); 698 * } 699 * @endcode 700 * 701 * @see opus_encoder, opus_decoder_ctl, opus_encoder_ctl, opus_decoderctls, opus_encoderctls 702 * @{ 703 */ 704 705 /** Resets the codec state to be equivalent to a freshly initialized state. 706 * This should be called when switching streams in order to prevent 707 * the back to back decoding from giving different results from 708 * one at a time decoding. 709 * @hideinitializer */ 710 #define OPUS_RESET_STATE 4028 711 712 /** Gets the final state of the codec's entropy coder. 713 * This is used for testing purposes, 714 * The encoder and decoder state should be identical after coding a payload 715 * (assuming no data corruption or software bugs) 716 * 717 * @param[out] x <tt>opus_uint32 *</tt>: Entropy coder state 718 * 719 * @hideinitializer */ 720 #define OPUS_GET_FINAL_RANGE(x) OPUS_GET_FINAL_RANGE_REQUEST, opus_check_uint_ptr(x) 721 722 /** Gets the encoder's configured bandpass or the decoder's last bandpass. 723 * @see OPUS_SET_BANDWIDTH 724 * @param[out] x <tt>opus_int32 *</tt>: Returns one of the following values: 725 * <dl> 726 * <dt>#OPUS_AUTO</dt> <dd>(default)</dd> 727 * <dt>#OPUS_BANDWIDTH_NARROWBAND</dt> <dd>4 kHz passband</dd> 728 * <dt>#OPUS_BANDWIDTH_MEDIUMBAND</dt> <dd>6 kHz passband</dd> 729 * <dt>#OPUS_BANDWIDTH_WIDEBAND</dt> <dd>8 kHz passband</dd> 730 * <dt>#OPUS_BANDWIDTH_SUPERWIDEBAND</dt><dd>12 kHz passband</dd> 731 * <dt>#OPUS_BANDWIDTH_FULLBAND</dt> <dd>20 kHz passband</dd> 732 * </dl> 733 * @hideinitializer */ 734 #define OPUS_GET_BANDWIDTH(x) OPUS_GET_BANDWIDTH_REQUEST, opus_check_int_ptr(x) 735 736 /** Gets the sampling rate the encoder or decoder was initialized with. 737 * This simply returns the <code>Fs</code> value passed to opus_encoder_init() 738 * or opus_decoder_init(). 739 * @param[out] x <tt>opus_int32 *</tt>: Sampling rate of encoder or decoder. 740 * @hideinitializer 741 */ 742 #define OPUS_GET_SAMPLE_RATE(x) OPUS_GET_SAMPLE_RATE_REQUEST, opus_check_int_ptr(x) 743 744 /** If set to 1, disables the use of phase inversion for intensity stereo, 745 * improving the quality of mono downmixes, but slightly reducing normal 746 * stereo quality. Disabling phase inversion in the decoder does not comply 747 * with RFC 6716, although it does not cause any interoperability issue and 748 * is expected to become part of the Opus standard once RFC 6716 is updated 749 * by draft-ietf-codec-opus-update. 750 * @see OPUS_GET_PHASE_INVERSION_DISABLED 751 * @param[in] x <tt>opus_int32</tt>: Allowed values: 752 * <dl> 753 * <dt>0</dt><dd>Enable phase inversion (default).</dd> 754 * <dt>1</dt><dd>Disable phase inversion.</dd> 755 * </dl> 756 * @hideinitializer */ 757 #define OPUS_SET_PHASE_INVERSION_DISABLED(x) OPUS_SET_PHASE_INVERSION_DISABLED_REQUEST, opus_check_int(x) 758 /** Gets the encoder's configured phase inversion status. 759 * @see OPUS_SET_PHASE_INVERSION_DISABLED 760 * @param[out] x <tt>opus_int32 *</tt>: Returns one of the following values: 761 * <dl> 762 * <dt>0</dt><dd>Stereo phase inversion enabled (default).</dd> 763 * <dt>1</dt><dd>Stereo phase inversion disabled.</dd> 764 * </dl> 765 * @hideinitializer */ 766 #define OPUS_GET_PHASE_INVERSION_DISABLED(x) OPUS_GET_PHASE_INVERSION_DISABLED_REQUEST, opus_check_int_ptr(x) 767 /** Gets the DTX state of the encoder. 768 * Returns whether the last encoded frame was either a comfort noise update 769 * during DTX or not encoded because of DTX. 770 * @param[out] x <tt>opus_int32 *</tt>: Returns one of the following values: 771 * <dl> 772 * <dt>0</dt><dd>The encoder is not in DTX.</dd> 773 * <dt>1</dt><dd>The encoder is in DTX.</dd> 774 * </dl> 775 * @hideinitializer */ 776 #define OPUS_GET_IN_DTX(x) OPUS_GET_IN_DTX_REQUEST, opus_check_int_ptr(x) 777 778 /**@}*/ 779 780 /** @defgroup opus_decoderctls Decoder related CTLs 781 * @see opus_genericctls, opus_encoderctls, opus_decoder 782 * @{ 783 */ 784 785 /** Configures decoder gain adjustment. 786 * Scales the decoded output by a factor specified in Q8 dB units. 787 * This has a maximum range of -32768 to 32767 inclusive, and returns 788 * OPUS_BAD_ARG otherwise. The default is zero indicating no adjustment. 789 * This setting survives decoder reset. 790 * 791 * gain = pow(10, x/(20.0*256)) 792 * 793 * @param[in] x <tt>opus_int32</tt>: Amount to scale PCM signal by in Q8 dB units. 794 * @hideinitializer */ 795 #define OPUS_SET_GAIN(x) OPUS_SET_GAIN_REQUEST, opus_check_int(x) 796 /** Gets the decoder's configured gain adjustment. @see OPUS_SET_GAIN 797 * 798 * @param[out] x <tt>opus_int32 *</tt>: Amount to scale PCM signal by in Q8 dB units. 799 * @hideinitializer */ 800 #define OPUS_GET_GAIN(x) OPUS_GET_GAIN_REQUEST, opus_check_int_ptr(x) 801 802 /** Gets the duration (in samples) of the last packet successfully decoded or concealed. 803 * @param[out] x <tt>opus_int32 *</tt>: Number of samples (at current sampling rate). 804 * @hideinitializer */ 805 #define OPUS_GET_LAST_PACKET_DURATION(x) OPUS_GET_LAST_PACKET_DURATION_REQUEST, opus_check_int_ptr(x) 806 807 /** Gets the pitch of the last decoded frame, if available. 808 * This can be used for any post-processing algorithm requiring the use of pitch, 809 * e.g. time stretching/shortening. If the last frame was not voiced, or if the 810 * pitch was not coded in the frame, then zero is returned. 811 * 812 * This CTL is only implemented for decoder instances. 813 * 814 * @param[out] x <tt>opus_int32 *</tt>: pitch period at 48 kHz (or 0 if not available) 815 * 816 * @hideinitializer */ 817 #define OPUS_GET_PITCH(x) OPUS_GET_PITCH_REQUEST, opus_check_int_ptr(x) 818 819 /** Enables blind bandwidth extension for wideband signals if decoding sampling rate is 48 kHz. 820 * @param[in] x <tt>opus_int32 </tt>: 1 enables bandwidth extension, 0 disables it. 821 * The default is 0. 822 * 823 * @hideinitializer */ 824 #define OPUS_SET_OSCE_BWE(x) OPUS_SET_OSCE_BWE_REQUEST, opus_check_int(x) 825 /** Gets blind bandwidth extension flag for wideband signals if decoding sampling rate is 48 kHz. 826 * @param[out] x <tt>opus_int32 *</tt>: 1 if bwe enabled, 0 if disabled. 827 * 828 * @hideinitializer */ 829 #define OPUS_GET_OSCE_BWE(x) OPUS_GET_OSCE_BWE_REQUEST, opus_check_int_ptr(x) 830 831 /** If set to 1, the decoder will ignore all extensions found in the padding area 832 * (does not affect DRED, which is decoded separately). 833 * @hideinitializer */ 834 #define OPUS_SET_IGNORE_EXTENSIONS(x) OPUS_SET_IGNORE_EXTENSIONS_REQUEST, opus_check_int(x) 835 /** Gets whether the decoder is ignoring extensions. 836 * @hideinitializer */ 837 #define OPUS_GET_IGNORE_EXTENSIONS(x) OPUS_GET_IGNORE_EXTENSIONS_REQUEST, opus_check_int_ptr(x) 838 839 /**@}*/ 840 841 /** @defgroup opus_libinfo Opus library information functions 842 * @{ 843 */ 844 845 /** Converts an opus error code into a human readable string. 846 * 847 * @param[in] error <tt>int</tt>: Error number 848 * @returns Error string 849 */ 850 OPUS_EXPORT const char *opus_strerror(int error); 851 852 /** Gets the libopus version string. 853 * 854 * Applications may look for the substring "-fixed" in the version string to 855 * determine whether they have a fixed-point or floating-point build at 856 * runtime. 857 * 858 * @returns Version string 859 */ 860 OPUS_EXPORT const char *opus_get_version_string(void); 861 /**@}*/ 862 863 #ifdef __cplusplus 864 } 865 #endif 866 867 #endif /* OPUS_DEFINES_H */