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,621 @@
1
+ /* Copyright (c) 2017 Google Inc.
2
+ Written by Andrew Allen */
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_projection.h
30
+ * @brief Opus projection reference API
31
+ */
32
+
33
+ #ifndef OPUS_PROJECTION_H
34
+ #define OPUS_PROJECTION_H
35
+
36
+ #include "opus_multistream.h"
37
+
38
+ #ifdef __cplusplus
39
+ extern "C" {
40
+ #endif
41
+
42
+ /** @cond OPUS_INTERNAL_DOC */
43
+
44
+ /** These are the actual encoder and decoder CTL ID numbers.
45
+ * They should not be used directly by applications.c
46
+ * In general, SETs should be even and GETs should be odd.*/
47
+ /**@{*/
48
+ #define OPUS_PROJECTION_GET_DEMIXING_MATRIX_GAIN_REQUEST 6001
49
+ #define OPUS_PROJECTION_GET_DEMIXING_MATRIX_SIZE_REQUEST 6003
50
+ #define OPUS_PROJECTION_GET_DEMIXING_MATRIX_REQUEST 6005
51
+ /**@}*/
52
+
53
+ /** @endcond */
54
+
55
+ /** @defgroup opus_projection_ctls Projection specific encoder and decoder CTLs
56
+ *
57
+ * These are convenience macros that are specific to the
58
+ * opus_projection_encoder_ctl() and opus_projection_decoder_ctl()
59
+ * interface.
60
+ * The CTLs from @ref opus_genericctls, @ref opus_encoderctls,
61
+ * @ref opus_decoderctls, and @ref opus_multistream_ctls may be applied to a
62
+ * projection encoder or decoder as well.
63
+ */
64
+ /**@{*/
65
+
66
+ /** Gets the gain (in dB. S7.8-format) of the demixing matrix from the encoder.
67
+ * @param[out] x <tt>opus_int32 *</tt>: Returns the gain (in dB. S7.8-format)
68
+ * of the demixing matrix.
69
+ * @hideinitializer
70
+ */
71
+ #define OPUS_PROJECTION_GET_DEMIXING_MATRIX_GAIN(x) \
72
+ OPUS_PROJECTION_GET_DEMIXING_MATRIX_GAIN_REQUEST, __opus_check_int_ptr(x)
73
+
74
+ /** Gets the size in bytes of the demixing matrix from the encoder.
75
+ * @param[out] x <tt>opus_int32 *</tt>: Returns the size in bytes of the
76
+ * demixing matrix.
77
+ * @hideinitializer
78
+ */
79
+ #define OPUS_PROJECTION_GET_DEMIXING_MATRIX_SIZE(x) \
80
+ OPUS_PROJECTION_GET_DEMIXING_MATRIX_SIZE_REQUEST, __opus_check_int_ptr(x)
81
+
82
+ /** Copies the demixing matrix to the supplied pointer location.
83
+ * @param[out] x <tt>unsigned char *</tt>: Returns the demixing matrix to the
84
+ * supplied pointer location.
85
+ * @param y <tt>opus_int32</tt>: The size in bytes of the reserved memory at the
86
+ * pointer location.
87
+ * @hideinitializer
88
+ */
89
+ #define OPUS_PROJECTION_GET_DEMIXING_MATRIX(x, y) \
90
+ OPUS_PROJECTION_GET_DEMIXING_MATRIX_REQUEST, x, __opus_check_int(y)
91
+
92
+ /**@}*/
93
+
94
+ /** Opus projection encoder state.
95
+ * This contains the complete state of a projection Opus encoder.
96
+ * It is position independent and can be freely copied.
97
+ * @see opus_projection_ambisonics_encoder_create
98
+ */
99
+ typedef struct OpusProjectionEncoder OpusProjectionEncoder;
100
+
101
+ /** Opus projection decoder state.
102
+ * This contains the complete state of a projection Opus decoder.
103
+ * It is position independent and can be freely copied.
104
+ * @see opus_projection_decoder_create
105
+ * @see opus_projection_decoder_init
106
+ */
107
+ typedef struct OpusProjectionDecoder OpusProjectionDecoder;
108
+
109
+ /**\name Projection encoder functions */
110
+ /**@{*/
111
+
112
+ /** Gets the size of an OpusProjectionEncoder structure.
113
+ * @param channels <tt>int</tt>: The total number of input channels to encode.
114
+ * This must be no more than 255.
115
+ * @param mapping_family <tt>int</tt>: The mapping family to use for selecting
116
+ * the appropriate projection.
117
+ * @returns The size in bytes on success, or a negative error code
118
+ * (see @ref opus_errorcodes) on error.
119
+ */
120
+ OPUS_EXPORT OPUS_WARN_UNUSED_RESULT opus_int32
121
+ opus_projection_ambisonics_encoder_get_size(int channels, int mapping_family);
122
+
123
+ /** Allocates and initializes a projection encoder state.
124
+ * Call opus_projection_encoder_destroy() to release
125
+ * this object when finished.
126
+ * @param Fs <tt>opus_int32</tt>: Sampling rate of the input signal (in Hz).
127
+ * This must be one of 8000, 12000, 16000,
128
+ * 24000, or 48000.
129
+ * @param channels <tt>int</tt>: Number of channels in the input signal.
130
+ * This must be at most 255.
131
+ * It may be greater than the number of
132
+ * coded channels (<code>streams +
133
+ * coupled_streams</code>).
134
+ * @param mapping_family <tt>int</tt>: The mapping family to use for selecting
135
+ * the appropriate projection.
136
+ * @param[out] streams <tt>int *</tt>: The total number of streams that will
137
+ * be encoded from the input.
138
+ * @param[out] coupled_streams <tt>int *</tt>: Number of coupled (2 channel)
139
+ * streams that will be encoded from the input.
140
+ * @param application <tt>int</tt>: The target encoder application.
141
+ * This must be one of the following:
142
+ * <dl>
143
+ * <dt>#OPUS_APPLICATION_VOIP</dt>
144
+ * <dd>Process signal for improved speech intelligibility.</dd>
145
+ * <dt>#OPUS_APPLICATION_AUDIO</dt>
146
+ * <dd>Favor faithfulness to the original input.</dd>
147
+ * <dt>#OPUS_APPLICATION_RESTRICTED_LOWDELAY</dt>
148
+ * <dd>Configure the minimum possible coding delay by disabling certain modes
149
+ * of operation.</dd>
150
+ * </dl>
151
+ * @param[out] error <tt>int *</tt>: Returns #OPUS_OK on success, or an error
152
+ * code (see @ref opus_errorcodes) on
153
+ * failure.
154
+ */
155
+ OPUS_EXPORT OPUS_WARN_UNUSED_RESULT OpusProjectionEncoder *
156
+ opus_projection_ambisonics_encoder_create(
157
+ opus_int32 Fs,
158
+ int channels,
159
+ int mapping_family,
160
+ int *streams,
161
+ int *coupled_streams,
162
+ int application,
163
+ int *error) OPUS_ARG_NONNULL(4) OPUS_ARG_NONNULL(5);
164
+
165
+ /** Initialize a previously allocated projection encoder state.
166
+ * The memory pointed to by \a st must be at least the size returned by
167
+ * opus_projection_ambisonics_encoder_get_size().
168
+ * This is intended for applications which use their own allocator instead of
169
+ * malloc.
170
+ * To reset a previously initialized state, use the #OPUS_RESET_STATE CTL.
171
+ * @see opus_projection_ambisonics_encoder_create
172
+ * @see opus_projection_ambisonics_encoder_get_size
173
+ * @param st <tt>OpusProjectionEncoder*</tt>: Projection encoder state to
174
+ * initialize.
175
+ * @param Fs <tt>opus_int32</tt>: Sampling rate of the input signal (in Hz).
176
+ * This must be one of 8000, 12000, 16000,
177
+ * 24000, or 48000.
178
+ * @param channels <tt>int</tt>: Number of channels in the input signal.
179
+ * This must be at most 255.
180
+ * It may be greater than the number of
181
+ * coded channels (<code>streams +
182
+ * coupled_streams</code>).
183
+ * @param streams <tt>int</tt>: The total number of streams to encode from the
184
+ * input.
185
+ * This must be no more than the number of
186
+ * channels.
187
+ * @param coupled_streams <tt>int</tt>: Number of coupled (2 channel) streams
188
+ * to encode.
189
+ * This must be no larger than the total
190
+ * number of streams.
191
+ * Additionally, The total number of
192
+ * encoded channels (<code>streams +
193
+ * coupled_streams</code>) must be no
194
+ * more than the number of input channels.
195
+ * @param application <tt>int</tt>: The target encoder application.
196
+ * This must be one of the following:
197
+ * <dl>
198
+ * <dt>#OPUS_APPLICATION_VOIP</dt>
199
+ * <dd>Process signal for improved speech intelligibility.</dd>
200
+ * <dt>#OPUS_APPLICATION_AUDIO</dt>
201
+ * <dd>Favor faithfulness to the original input.</dd>
202
+ * <dt>#OPUS_APPLICATION_RESTRICTED_LOWDELAY</dt>
203
+ * <dd>Configure the minimum possible coding delay by disabling certain modes
204
+ * of operation.</dd>
205
+ * </dl>
206
+ * @returns #OPUS_OK on success, or an error code (see @ref opus_errorcodes)
207
+ * on failure.
208
+ */
209
+ OPUS_EXPORT int opus_projection_ambisonics_encoder_init(
210
+ OpusProjectionEncoder *st,
211
+ opus_int32 Fs,
212
+ int channels,
213
+ int mapping_family,
214
+ int *streams,
215
+ int *coupled_streams,
216
+ int application) OPUS_ARG_NONNULL(1) OPUS_ARG_NONNULL(5)
217
+ OPUS_ARG_NONNULL(6);
218
+
219
+ /** Encodes a projection Opus frame.
220
+ * @param st <tt>OpusProjectionEncoder*</tt>: Projection encoder state.
221
+ * @param[in] pcm <tt>const opus_int16*</tt>: The input signal as interleaved
222
+ * samples.
223
+ * This must contain
224
+ * <code>frame_size*channels</code>
225
+ * samples.
226
+ * @param frame_size <tt>int</tt>: Number of samples per channel in the input
227
+ * signal.
228
+ * This must be an Opus frame size for the
229
+ * encoder's sampling rate.
230
+ * For example, at 48 kHz the permitted values
231
+ * are 120, 240, 480, 960, 1920, and 2880.
232
+ * Passing in a duration of less than 10 ms
233
+ * (480 samples at 48 kHz) will prevent the
234
+ * encoder from using the LPC or hybrid modes.
235
+ * @param[out] data <tt>unsigned char*</tt>: Output payload.
236
+ * This must contain storage for at
237
+ * least \a max_data_bytes.
238
+ * @param [in] max_data_bytes <tt>opus_int32</tt>: Size of the allocated
239
+ * memory for the output
240
+ * payload. This may be
241
+ * used to impose an upper limit
242
+ * on the instant bitrate, but should not be used as the only bitrate control.
243
+ * Use #OPUS_SET_BITRATE to control the bitrate.
244
+ * @returns The length of the encoded packet (in bytes) on success or a
245
+ * negative error code (see @ref opus_errorcodes) on failure.
246
+ */
247
+ OPUS_EXPORT OPUS_WARN_UNUSED_RESULT int opus_projection_encode(
248
+ OpusProjectionEncoder *st,
249
+ const opus_int16 *pcm,
250
+ int frame_size,
251
+ unsigned char *data,
252
+ opus_int32 max_data_bytes) OPUS_ARG_NONNULL(1) OPUS_ARG_NONNULL(2)
253
+ OPUS_ARG_NONNULL(4);
254
+
255
+ /** Encodes a projection Opus frame.
256
+ * @param st <tt>OpusProjectionEncoder*</tt>: Projection encoder state.
257
+ * @param[in] pcm <tt>const opus_int32*</tt>: The input signal as interleaved
258
+ * samples representing (or slightly
259
+ * exceeding) 24-bit values. This must contain <code>frame_size*channels</code>
260
+ * samples.
261
+ * @param frame_size <tt>int</tt>: Number of samples per channel in the input
262
+ * signal.
263
+ * This must be an Opus frame size for the
264
+ * encoder's sampling rate.
265
+ * For example, at 48 kHz the permitted values
266
+ * are 120, 240, 480, 960, 1920, and 2880.
267
+ * Passing in a duration of less than 10 ms
268
+ * (480 samples at 48 kHz) will prevent the
269
+ * encoder from using the LPC or hybrid modes.
270
+ * @param[out] data <tt>unsigned char*</tt>: Output payload.
271
+ * This must contain storage for at
272
+ * least \a max_data_bytes.
273
+ * @param [in] max_data_bytes <tt>opus_int32</tt>: Size of the allocated
274
+ * memory for the output
275
+ * payload. This may be
276
+ * used to impose an upper limit
277
+ * on the instant bitrate, but should not be used as the only bitrate control.
278
+ * Use #OPUS_SET_BITRATE to control the bitrate.
279
+ * @returns The length of the encoded packet (in bytes) on success or a
280
+ * negative error code (see @ref opus_errorcodes) on failure.
281
+ */
282
+ OPUS_EXPORT OPUS_WARN_UNUSED_RESULT int opus_projection_encode24(
283
+ OpusProjectionEncoder *st,
284
+ const opus_int32 *pcm,
285
+ int frame_size,
286
+ unsigned char *data,
287
+ opus_int32 max_data_bytes) OPUS_ARG_NONNULL(1) OPUS_ARG_NONNULL(2)
288
+ OPUS_ARG_NONNULL(4);
289
+
290
+ /** Encodes a projection Opus frame from floating point input.
291
+ * @param st <tt>OpusProjectionEncoder*</tt>: Projection encoder state.
292
+ * @param[in] pcm <tt>const float*</tt>: The input signal as interleaved
293
+ * samples with a normal range of
294
+ * +/-1.0.
295
+ * Samples with a range beyond +/-1.0
296
+ * are supported but will be clipped by
297
+ * decoders using the integer API and
298
+ * should only be used if it is known
299
+ * that the far end supports extended
300
+ * dynamic range.
301
+ * This must contain
302
+ * <code>frame_size*channels</code>
303
+ * samples.
304
+ * @param frame_size <tt>int</tt>: Number of samples per channel in the input
305
+ * signal.
306
+ * This must be an Opus frame size for the
307
+ * encoder's sampling rate.
308
+ * For example, at 48 kHz the permitted values
309
+ * are 120, 240, 480, 960, 1920, and 2880.
310
+ * Passing in a duration of less than 10 ms
311
+ * (480 samples at 48 kHz) will prevent the
312
+ * encoder from using the LPC or hybrid modes.
313
+ * @param[out] data <tt>unsigned char*</tt>: Output payload.
314
+ * This must contain storage for at
315
+ * least \a max_data_bytes.
316
+ * @param [in] max_data_bytes <tt>opus_int32</tt>: Size of the allocated
317
+ * memory for the output
318
+ * payload. This may be
319
+ * used to impose an upper limit
320
+ * on the instant bitrate, but should not be used as the only bitrate control.
321
+ * Use #OPUS_SET_BITRATE to control the bitrate.
322
+ * @returns The length of the encoded packet (in bytes) on success or a
323
+ * negative error code (see @ref opus_errorcodes) on failure.
324
+ */
325
+ OPUS_EXPORT OPUS_WARN_UNUSED_RESULT int opus_projection_encode_float(
326
+ OpusProjectionEncoder *st,
327
+ const float *pcm,
328
+ int frame_size,
329
+ unsigned char *data,
330
+ opus_int32 max_data_bytes) OPUS_ARG_NONNULL(1) OPUS_ARG_NONNULL(2)
331
+ OPUS_ARG_NONNULL(4);
332
+
333
+ /** Frees an <code>OpusProjectionEncoder</code> allocated by
334
+ * opus_projection_ambisonics_encoder_create().
335
+ * @param st <tt>OpusProjectionEncoder*</tt>: Projection encoder state to be
336
+ * freed.
337
+ */
338
+ OPUS_EXPORT void opus_projection_encoder_destroy(OpusProjectionEncoder *st);
339
+
340
+ /** Perform a CTL function on a projection Opus encoder.
341
+ *
342
+ * Generally the request and subsequent arguments are generated by a
343
+ * convenience macro.
344
+ * @param st <tt>OpusProjectionEncoder*</tt>: Projection encoder state.
345
+ * @param request This and all remaining parameters should be replaced by one
346
+ * of the convenience macros in @ref opus_genericctls,
347
+ * @ref opus_encoderctls, @ref opus_multistream_ctls, or
348
+ * @ref opus_projection_ctls
349
+ * @see opus_genericctls
350
+ * @see opus_encoderctls
351
+ * @see opus_multistream_ctls
352
+ * @see opus_projection_ctls
353
+ */
354
+ OPUS_EXPORT int opus_projection_encoder_ctl(
355
+ OpusProjectionEncoder *st,
356
+ int request,
357
+ ...) OPUS_ARG_NONNULL(1);
358
+
359
+ /**@}*/
360
+
361
+ /**\name Projection decoder functions */
362
+ /**@{*/
363
+
364
+ /** Gets the size of an <code>OpusProjectionDecoder</code> structure.
365
+ * @param channels <tt>int</tt>: The total number of output channels.
366
+ * This must be no more than 255.
367
+ * @param streams <tt>int</tt>: The total number of streams coded in the
368
+ * input.
369
+ * This must be no more than 255.
370
+ * @param coupled_streams <tt>int</tt>: Number streams to decode as coupled
371
+ * (2 channel) streams.
372
+ * This must be no larger than the total
373
+ * number of streams.
374
+ * Additionally, The total number of
375
+ * coded channels (<code>streams +
376
+ * coupled_streams</code>) must be no
377
+ * more than 255.
378
+ * @returns The size in bytes on success, or a negative error code
379
+ * (see @ref opus_errorcodes) on error.
380
+ */
381
+ OPUS_EXPORT OPUS_WARN_UNUSED_RESULT opus_int32 opus_projection_decoder_get_size(
382
+ int channels,
383
+ int streams,
384
+ int coupled_streams);
385
+
386
+ /** Allocates and initializes a projection decoder state.
387
+ * Call opus_projection_decoder_destroy() to release
388
+ * this object when finished.
389
+ * @param Fs <tt>opus_int32</tt>: Sampling rate to decode at (in Hz).
390
+ * This must be one of 8000, 12000, 16000,
391
+ * 24000, or 48000.
392
+ * @param channels <tt>int</tt>: Number of channels to output.
393
+ * This must be at most 255.
394
+ * It may be different from the number of coded
395
+ * channels (<code>streams +
396
+ * coupled_streams</code>).
397
+ * @param streams <tt>int</tt>: The total number of streams coded in the
398
+ * input.
399
+ * This must be no more than 255.
400
+ * @param coupled_streams <tt>int</tt>: Number of streams to decode as coupled
401
+ * (2 channel) streams.
402
+ * This must be no larger than the total
403
+ * number of streams.
404
+ * Additionally, The total number of
405
+ * coded channels (<code>streams +
406
+ * coupled_streams</code>) must be no
407
+ * more than 255.
408
+ * @param[in] demixing_matrix <tt>const unsigned
409
+ * char[demixing_matrix_size]</tt>: Demixing matrix that mapping from coded
410
+ * channels to output channels, as described in @ref opus_projection and
411
+ * @ref opus_projection_ctls.
412
+ * @param demixing_matrix_size <tt>opus_int32</tt>: The size in bytes of the
413
+ * demixing matrix, as
414
+ * described in @ref
415
+ * opus_projection_ctls.
416
+ * @param[out] error <tt>int *</tt>: Returns #OPUS_OK on success, or an error
417
+ * code (see @ref opus_errorcodes) on
418
+ * failure.
419
+ */
420
+ OPUS_EXPORT OPUS_WARN_UNUSED_RESULT OpusProjectionDecoder *
421
+ opus_projection_decoder_create(
422
+ opus_int32 Fs,
423
+ int channels,
424
+ int streams,
425
+ int coupled_streams,
426
+ unsigned char *demixing_matrix,
427
+ opus_int32 demixing_matrix_size,
428
+ int *error) OPUS_ARG_NONNULL(5);
429
+
430
+ /** Initialize a previously allocated projection decoder state object.
431
+ * The memory pointed to by \a st must be at least the size returned by
432
+ * opus_projection_decoder_get_size().
433
+ * This is intended for applications which use their own allocator instead of
434
+ * malloc.
435
+ * To reset a previously initialized state, use the #OPUS_RESET_STATE CTL.
436
+ * @see opus_projection_decoder_create
437
+ * @see opus_projection_deocder_get_size
438
+ * @param st <tt>OpusProjectionDecoder*</tt>: Projection encoder state to
439
+ * initialize.
440
+ * @param Fs <tt>opus_int32</tt>: Sampling rate to decode at (in Hz).
441
+ * This must be one of 8000, 12000, 16000,
442
+ * 24000, or 48000.
443
+ * @param channels <tt>int</tt>: Number of channels to output.
444
+ * This must be at most 255.
445
+ * It may be different from the number of coded
446
+ * channels (<code>streams +
447
+ * coupled_streams</code>).
448
+ * @param streams <tt>int</tt>: The total number of streams coded in the
449
+ * input.
450
+ * This must be no more than 255.
451
+ * @param coupled_streams <tt>int</tt>: Number of streams to decode as coupled
452
+ * (2 channel) streams.
453
+ * This must be no larger than the total
454
+ * number of streams.
455
+ * Additionally, The total number of
456
+ * coded channels (<code>streams +
457
+ * coupled_streams</code>) must be no
458
+ * more than 255.
459
+ * @param[in] demixing_matrix <tt>const unsigned
460
+ * char[demixing_matrix_size]</tt>: Demixing matrix that mapping from coded
461
+ * channels to output channels, as described in @ref opus_projection and
462
+ * @ref opus_projection_ctls.
463
+ * @param demixing_matrix_size <tt>opus_int32</tt>: The size in bytes of the
464
+ * demixing matrix, as
465
+ * described in @ref
466
+ * opus_projection_ctls.
467
+ * @returns #OPUS_OK on success, or an error code (see @ref opus_errorcodes)
468
+ * on failure.
469
+ */
470
+ OPUS_EXPORT int opus_projection_decoder_init(
471
+ OpusProjectionDecoder *st,
472
+ opus_int32 Fs,
473
+ int channels,
474
+ int streams,
475
+ int coupled_streams,
476
+ unsigned char *demixing_matrix,
477
+ opus_int32 demixing_matrix_size) OPUS_ARG_NONNULL(1) OPUS_ARG_NONNULL(6);
478
+
479
+ /** Decode a projection Opus packet.
480
+ * @param st <tt>OpusProjectionDecoder*</tt>: Projection decoder state.
481
+ * @param[in] data <tt>const unsigned char*</tt>: Input payload.
482
+ * Use a <code>NULL</code>
483
+ * pointer to indicate packet
484
+ * loss.
485
+ * @param len <tt>opus_int32</tt>: Number of bytes in payload.
486
+ * @param[out] pcm <tt>opus_int16*</tt>: Output signal, with interleaved
487
+ * samples.
488
+ * This must contain room for
489
+ * <code>frame_size*channels</code>
490
+ * samples.
491
+ * @param frame_size <tt>int</tt>: The number of samples per channel of
492
+ * available space in \a pcm.
493
+ * If this is less than the maximum packet
494
+ * duration (120 ms; 5760 for 48kHz), this function will not be capable of
495
+ * decoding some packets. In the case of PLC (data==NULL) or FEC (decode_fec=1),
496
+ * then frame_size needs to be exactly the duration of audio that is missing,
497
+ * otherwise the decoder will not be in the optimal state to decode the next
498
+ * incoming packet. For the PLC and FEC cases, frame_size <b>must</b> be a
499
+ * multiple of 2.5 ms.
500
+ * @param decode_fec <tt>int</tt>: Flag (0 or 1) to request that any in-band
501
+ * forward error correction data be decoded.
502
+ * If no such data is available, the frame is
503
+ * decoded as if it were lost.
504
+ * @returns Number of samples decoded on success or a negative error code
505
+ * (see @ref opus_errorcodes) on failure.
506
+ */
507
+ OPUS_EXPORT OPUS_WARN_UNUSED_RESULT int opus_projection_decode(
508
+ OpusProjectionDecoder *st,
509
+ const unsigned char *data,
510
+ opus_int32 len,
511
+ opus_int16 *pcm,
512
+ int frame_size,
513
+ int decode_fec) OPUS_ARG_NONNULL(1) OPUS_ARG_NONNULL(4);
514
+
515
+ /** Decode a projection Opus packet.
516
+ * @param st <tt>OpusProjectionDecoder*</tt>: Projection decoder state.
517
+ * @param[in] data <tt>const unsigned char*</tt>: Input payload.
518
+ * Use a <code>NULL</code>
519
+ * pointer to indicate packet
520
+ * loss.
521
+ * @param len <tt>opus_int32</tt>: Number of bytes in payload.
522
+ * @param[out] pcm <tt>opus_int32*</tt>: Output signal, with interleaved
523
+ * samples representing (or slightly
524
+ * exceeding) 24-bit values. This must contain room for
525
+ * <code>frame_size*channels</code>
526
+ * samples.
527
+ * @param frame_size <tt>int</tt>: The number of samples per channel of
528
+ * available space in \a pcm.
529
+ * If this is less than the maximum packet
530
+ * duration (120 ms; 5760 for 48kHz), this function will not be capable of
531
+ * decoding some packets. In the case of PLC (data==NULL) or FEC (decode_fec=1),
532
+ * then frame_size needs to be exactly the duration of audio that is missing,
533
+ * otherwise the decoder will not be in the optimal state to decode the next
534
+ * incoming packet. For the PLC and FEC cases, frame_size <b>must</b> be a
535
+ * multiple of 2.5 ms.
536
+ * @param decode_fec <tt>int</tt>: Flag (0 or 1) to request that any in-band
537
+ * forward error correction data be decoded.
538
+ * If no such data is available, the frame is
539
+ * decoded as if it were lost.
540
+ * @returns Number of samples decoded on success or a negative error code
541
+ * (see @ref opus_errorcodes) on failure.
542
+ */
543
+ OPUS_EXPORT OPUS_WARN_UNUSED_RESULT int opus_projection_decode24(
544
+ OpusProjectionDecoder *st,
545
+ const unsigned char *data,
546
+ opus_int32 len,
547
+ opus_int32 *pcm,
548
+ int frame_size,
549
+ int decode_fec) OPUS_ARG_NONNULL(1) OPUS_ARG_NONNULL(4);
550
+
551
+ /** Decode a projection Opus packet with floating point output.
552
+ * @param st <tt>OpusProjectionDecoder*</tt>: Projection decoder state.
553
+ * @param[in] data <tt>const unsigned char*</tt>: Input payload.
554
+ * Use a <code>NULL</code>
555
+ * pointer to indicate packet
556
+ * loss.
557
+ * @param len <tt>opus_int32</tt>: Number of bytes in payload.
558
+ * @param[out] pcm <tt>opus_int16*</tt>: Output signal, with interleaved
559
+ * samples.
560
+ * This must contain room for
561
+ * <code>frame_size*channels</code>
562
+ * samples.
563
+ * @param frame_size <tt>int</tt>: The number of samples per channel of
564
+ * available space in \a pcm.
565
+ * If this is less than the maximum packet
566
+ * duration (120 ms; 5760 for 48kHz), this function will not be capable of
567
+ * decoding some packets. In the case of PLC (data==NULL) or FEC (decode_fec=1),
568
+ * then frame_size needs to be exactly the duration of audio that is missing,
569
+ * otherwise the decoder will not be in the optimal state to decode the next
570
+ * incoming packet. For the PLC and FEC cases, frame_size <b>must</b> be a
571
+ * multiple of 2.5 ms.
572
+ * @param decode_fec <tt>int</tt>: Flag (0 or 1) to request that any in-band
573
+ * forward error correction data be decoded.
574
+ * If no such data is available, the frame is
575
+ * decoded as if it were lost.
576
+ * @returns Number of samples decoded on success or a negative error code
577
+ * (see @ref opus_errorcodes) on failure.
578
+ */
579
+ OPUS_EXPORT OPUS_WARN_UNUSED_RESULT int opus_projection_decode_float(
580
+ OpusProjectionDecoder *st,
581
+ const unsigned char *data,
582
+ opus_int32 len,
583
+ float *pcm,
584
+ int frame_size,
585
+ int decode_fec) OPUS_ARG_NONNULL(1) OPUS_ARG_NONNULL(4);
586
+
587
+ /** Perform a CTL function on a projection Opus decoder.
588
+ *
589
+ * Generally the request and subsequent arguments are generated by a
590
+ * convenience macro.
591
+ * @param st <tt>OpusProjectionDecoder*</tt>: Projection decoder state.
592
+ * @param request This and all remaining parameters should be replaced by one
593
+ * of the convenience macros in @ref opus_genericctls,
594
+ * @ref opus_decoderctls, @ref opus_multistream_ctls, or
595
+ * @ref opus_projection_ctls.
596
+ * @see opus_genericctls
597
+ * @see opus_decoderctls
598
+ * @see opus_multistream_ctls
599
+ * @see opus_projection_ctls
600
+ */
601
+ OPUS_EXPORT int opus_projection_decoder_ctl(
602
+ OpusProjectionDecoder *st,
603
+ int request,
604
+ ...) OPUS_ARG_NONNULL(1);
605
+
606
+ /** Frees an <code>OpusProjectionDecoder</code> allocated by
607
+ * opus_projection_decoder_create().
608
+ * @param st <tt>OpusProjectionDecoder</tt>: Projection decoder state to be
609
+ * freed.
610
+ */
611
+ OPUS_EXPORT void opus_projection_decoder_destroy(OpusProjectionDecoder *st);
612
+
613
+ /**@}*/
614
+
615
+ /**@}*/
616
+
617
+ #ifdef __cplusplus
618
+ }
619
+ #endif
620
+
621
+ #endif /* OPUS_PROJECTION_H */