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