react-native-audio-api 0.7.1-nightly-5a218c6-20250809 → 0.7.1-nightly-4d86c14-20250811

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