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,241 @@
1
+ /********************************************************************
2
+ * *
3
+ * THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE. *
4
+ * USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS *
5
+ * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
6
+ * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. *
7
+ * *
8
+ * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2001 *
9
+ * by the Xiph.Org Foundation https://xiph.org/ *
10
+
11
+ ********************************************************************
12
+
13
+ function: libvorbis codec headers
14
+
15
+ ********************************************************************/
16
+
17
+ #ifndef _vorbis_codec_h_
18
+ #define _vorbis_codec_h_
19
+
20
+ #ifdef __cplusplus
21
+ extern "C" {
22
+ #endif /* __cplusplus */
23
+
24
+ #include <ogg/ogg.h>
25
+
26
+ typedef struct vorbis_info {
27
+ int version;
28
+ int channels;
29
+ long rate;
30
+
31
+ /* The below bitrate declarations are *hints*.
32
+ Combinations of the three values carry the following implications:
33
+
34
+ all three set to the same value:
35
+ implies a fixed rate bitstream
36
+ only nominal set:
37
+ implies a VBR stream that averages the nominal bitrate. No hard
38
+ upper/lower limit
39
+ upper and or lower set:
40
+ implies a VBR bitstream that obeys the bitrate limits. nominal
41
+ may also be set to give a nominal rate.
42
+ none set:
43
+ the coder does not care to speculate.
44
+ */
45
+
46
+ long bitrate_upper;
47
+ long bitrate_nominal;
48
+ long bitrate_lower;
49
+ long bitrate_window;
50
+
51
+ void *codec_setup;
52
+ } vorbis_info;
53
+
54
+ /* vorbis_dsp_state buffers the current vorbis audio
55
+ analysis/synthesis state. The DSP state belongs to a specific
56
+ logical bitstream ****************************************************/
57
+ typedef struct vorbis_dsp_state {
58
+ int analysisp;
59
+ vorbis_info *vi;
60
+
61
+ float **pcm;
62
+ float **pcmret;
63
+ int pcm_storage;
64
+ int pcm_current;
65
+ int pcm_returned;
66
+
67
+ int preextrapolate;
68
+ int eofflag;
69
+
70
+ long lW;
71
+ long W;
72
+ long nW;
73
+ long centerW;
74
+
75
+ ogg_int64_t granulepos;
76
+ ogg_int64_t sequence;
77
+
78
+ ogg_int64_t glue_bits;
79
+ ogg_int64_t time_bits;
80
+ ogg_int64_t floor_bits;
81
+ ogg_int64_t res_bits;
82
+
83
+ void *backend_state;
84
+ } vorbis_dsp_state;
85
+
86
+ typedef struct vorbis_block {
87
+ /* necessary stream state for linking to the framing abstraction */
88
+ float **pcm; /* this is a pointer into local storage */
89
+ oggpack_buffer opb;
90
+
91
+ long lW;
92
+ long W;
93
+ long nW;
94
+ int pcmend;
95
+ int mode;
96
+
97
+ int eofflag;
98
+ ogg_int64_t granulepos;
99
+ ogg_int64_t sequence;
100
+ vorbis_dsp_state *vd; /* For read-only access of configuration */
101
+
102
+ /* local storage to avoid remallocing; it's up to the mapping to
103
+ structure it */
104
+ void *localstore;
105
+ long localtop;
106
+ long localalloc;
107
+ long totaluse;
108
+ struct alloc_chain *reap;
109
+
110
+ /* bitmetrics for the frame */
111
+ long glue_bits;
112
+ long time_bits;
113
+ long floor_bits;
114
+ long res_bits;
115
+
116
+ void *internal;
117
+
118
+ } vorbis_block;
119
+
120
+ /* vorbis_block is a single block of data to be processed as part of
121
+ the analysis/synthesis stream; it belongs to a specific logical
122
+ bitstream, but is independent from other vorbis_blocks belonging to
123
+ that logical bitstream. *************************************************/
124
+
125
+ struct alloc_chain {
126
+ void *ptr;
127
+ struct alloc_chain *next;
128
+ };
129
+
130
+ /* vorbis_info contains all the setup information specific to the
131
+ specific compression/decompression mode in progress (eg,
132
+ psychoacoustic settings, channel setup, options, codebook
133
+ etc). vorbis_info and substructures are in backends.h.
134
+ *********************************************************************/
135
+
136
+ /* the comments are not part of vorbis_info so that vorbis_info can be
137
+ static storage */
138
+ typedef struct vorbis_comment {
139
+ /* unlimited user comment fields. libvorbis writes 'libvorbis'
140
+ whatever vendor is set to in encode */
141
+ char **user_comments;
142
+ int *comment_lengths;
143
+ int comments;
144
+ char *vendor;
145
+
146
+ } vorbis_comment;
147
+
148
+ /* libvorbis encodes in two abstraction layers; first we perform DSP
149
+ and produce a packet (see docs/analysis.txt). The packet is then
150
+ coded into a framed OggSquish bitstream by the second layer (see
151
+ docs/framing.txt). Decode is the reverse process; we sync/frame
152
+ the bitstream and extract individual packets, then decode the
153
+ packet back into PCM audio.
154
+
155
+ The extra framing/packetizing is used in streaming formats, such as
156
+ files. Over the net (such as with UDP), the framing and
157
+ packetization aren't necessary as they're provided by the transport
158
+ and the streaming layer is not used */
159
+
160
+ /* Vorbis PRIMITIVES: general ***************************************/
161
+
162
+ extern void vorbis_info_init(vorbis_info *vi);
163
+ extern void vorbis_info_clear(vorbis_info *vi);
164
+ extern int vorbis_info_blocksize(vorbis_info *vi, int zo);
165
+ extern void vorbis_comment_init(vorbis_comment *vc);
166
+ extern void vorbis_comment_add(vorbis_comment *vc, const char *comment);
167
+ extern void vorbis_comment_add_tag(
168
+ vorbis_comment *vc,
169
+ const char *tag,
170
+ const char *contents);
171
+ extern char *
172
+ vorbis_comment_query(vorbis_comment *vc, const char *tag, int count);
173
+ extern int vorbis_comment_query_count(vorbis_comment *vc, const char *tag);
174
+ extern void vorbis_comment_clear(vorbis_comment *vc);
175
+
176
+ extern int vorbis_block_init(vorbis_dsp_state *v, vorbis_block *vb);
177
+ extern int vorbis_block_clear(vorbis_block *vb);
178
+ extern void vorbis_dsp_clear(vorbis_dsp_state *v);
179
+ extern double vorbis_granule_time(vorbis_dsp_state *v, ogg_int64_t granulepos);
180
+
181
+ extern const char *vorbis_version_string(void);
182
+
183
+ /* Vorbis PRIMITIVES: analysis/DSP layer ****************************/
184
+
185
+ extern int vorbis_analysis_init(vorbis_dsp_state *v, vorbis_info *vi);
186
+ extern int vorbis_commentheader_out(vorbis_comment *vc, ogg_packet *op);
187
+ extern int vorbis_analysis_headerout(
188
+ vorbis_dsp_state *v,
189
+ vorbis_comment *vc,
190
+ ogg_packet *op,
191
+ ogg_packet *op_comm,
192
+ ogg_packet *op_code);
193
+ extern float **vorbis_analysis_buffer(vorbis_dsp_state *v, int vals);
194
+ extern int vorbis_analysis_wrote(vorbis_dsp_state *v, int vals);
195
+ extern int vorbis_analysis_blockout(vorbis_dsp_state *v, vorbis_block *vb);
196
+ extern int vorbis_analysis(vorbis_block *vb, ogg_packet *op);
197
+
198
+ extern int vorbis_bitrate_addblock(vorbis_block *vb);
199
+ extern int vorbis_bitrate_flushpacket(vorbis_dsp_state *vd, ogg_packet *op);
200
+
201
+ /* Vorbis PRIMITIVES: synthesis layer *******************************/
202
+ extern int vorbis_synthesis_idheader(ogg_packet *op);
203
+ extern int
204
+ vorbis_synthesis_headerin(vorbis_info *vi, vorbis_comment *vc, ogg_packet *op);
205
+
206
+ extern int vorbis_synthesis_init(vorbis_dsp_state *v, vorbis_info *vi);
207
+ extern int vorbis_synthesis_restart(vorbis_dsp_state *v);
208
+ extern int vorbis_synthesis(vorbis_block *vb, ogg_packet *op);
209
+ extern int vorbis_synthesis_trackonly(vorbis_block *vb, ogg_packet *op);
210
+ extern int vorbis_synthesis_blockin(vorbis_dsp_state *v, vorbis_block *vb);
211
+ extern int vorbis_synthesis_pcmout(vorbis_dsp_state *v, float ***pcm);
212
+ extern int vorbis_synthesis_lapout(vorbis_dsp_state *v, float ***pcm);
213
+ extern int vorbis_synthesis_read(vorbis_dsp_state *v, int samples);
214
+ extern long vorbis_packet_blocksize(vorbis_info *vi, ogg_packet *op);
215
+
216
+ extern int vorbis_synthesis_halfrate(vorbis_info *v, int flag);
217
+ extern int vorbis_synthesis_halfrate_p(vorbis_info *v);
218
+
219
+ /* Vorbis ERRORS and return codes ***********************************/
220
+
221
+ #define OV_FALSE -1
222
+ #define OV_EOF -2
223
+ #define OV_HOLE -3
224
+
225
+ #define OV_EREAD -128
226
+ #define OV_EFAULT -129
227
+ #define OV_EIMPL -130
228
+ #define OV_EINVAL -131
229
+ #define OV_ENOTVORBIS -132
230
+ #define OV_EBADHEADER -133
231
+ #define OV_EVERSION -134
232
+ #define OV_ENOTAUDIO -135
233
+ #define OV_EBADPACKET -136
234
+ #define OV_EBADLINK -137
235
+ #define OV_ENOSEEK -138
236
+
237
+ #ifdef __cplusplus
238
+ }
239
+ #endif /* __cplusplus */
240
+
241
+ #endif
@@ -0,0 +1,446 @@
1
+ /********************************************************************
2
+ * *
3
+ * THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE. *
4
+ * USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS *
5
+ * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
6
+ * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. *
7
+ * *
8
+ * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2001 *
9
+ * by the Xiph.Org Foundation https://xiph.org/ *
10
+ * *
11
+ ********************************************************************
12
+
13
+ function: vorbis encode-engine setup
14
+
15
+ ********************************************************************/
16
+
17
+ /** \file
18
+ * Libvorbisenc is a convenient API for setting up an encoding
19
+ * environment using libvorbis. Libvorbisenc encapsulates the
20
+ * actions needed to set up the encoder properly.
21
+ */
22
+
23
+ #ifndef _OV_ENC_H_
24
+ #define _OV_ENC_H_
25
+
26
+ #ifdef __cplusplus
27
+ extern "C" {
28
+ #endif /* __cplusplus */
29
+
30
+ #include "codec.h"
31
+
32
+ /**
33
+ * This is the primary function within libvorbisenc for setting up managed
34
+ * bitrate modes.
35
+ *
36
+ * Before this function is called, the \ref vorbis_info
37
+ * struct should be initialized by using vorbis_info_init() from the libvorbis
38
+ * API. After encoding, vorbis_info_clear() should be called.
39
+ *
40
+ * The max_bitrate, nominal_bitrate, and min_bitrate settings are used to set
41
+ * constraints for the encoded file. This function uses these settings to
42
+ * select the appropriate encoding mode and set it up.
43
+ *
44
+ * \param vi Pointer to an initialized \ref vorbis_info struct.
45
+ * \param channels The number of channels to be encoded.
46
+ * \param rate The sampling rate of the source audio.
47
+ * \param max_bitrate Desired maximum bitrate (limit). -1 indicates unset.
48
+ * \param nominal_bitrate Desired average, or central, bitrate. -1 indicates
49
+ * unset.
50
+ * \param min_bitrate Desired minimum bitrate. -1 indicates unset.
51
+ *
52
+ * \return Zero for success, and negative values for failure.
53
+ *
54
+ * \retval 0 Success.
55
+ * \retval OV_EFAULT Internal logic fault; indicates a bug or heap/stack
56
+ * corruption.
57
+ * \retval OV_EINVAL Invalid setup request, eg, out of range argument.
58
+ * \retval OV_EIMPL Unimplemented mode; unable to comply with bitrate request.
59
+ */
60
+ extern int vorbis_encode_init(
61
+ vorbis_info *vi,
62
+ long channels,
63
+ long rate,
64
+
65
+ long max_bitrate,
66
+ long nominal_bitrate,
67
+ long min_bitrate);
68
+
69
+ /**
70
+ * This function performs step-one of a three-step bitrate-managed encode
71
+ * setup. It functions similarly to the one-step setup performed by \ref
72
+ * vorbis_encode_init but allows an application to make further encode setup
73
+ * tweaks using \ref vorbis_encode_ctl before finally calling \ref
74
+ * vorbis_encode_setup_init to complete the setup process.
75
+ *
76
+ * Before this function is called, the \ref vorbis_info struct should be
77
+ * initialized by using vorbis_info_init() from the libvorbis API. After
78
+ * encoding, vorbis_info_clear() should be called.
79
+ *
80
+ * The max_bitrate, nominal_bitrate, and min_bitrate settings are used to set
81
+ * constraints for the encoded file. This function uses these settings to
82
+ * select the appropriate encoding mode and set it up.
83
+ *
84
+ * \param vi Pointer to an initialized vorbis_info struct.
85
+ * \param channels The number of channels to be encoded.
86
+ * \param rate The sampling rate of the source audio.
87
+ * \param max_bitrate Desired maximum bitrate (limit). -1 indicates unset.
88
+ * \param nominal_bitrate Desired average, or central, bitrate. -1 indicates
89
+ * unset.
90
+ * \param min_bitrate Desired minimum bitrate. -1 indicates unset.
91
+ *
92
+ * \return Zero for success, and negative for failure.
93
+ *
94
+ * \retval 0 Success
95
+ * \retval OV_EFAULT Internal logic fault; indicates a bug or heap/stack
96
+ * corruption.
97
+ * \retval OV_EINVAL Invalid setup request, eg, out of range argument.
98
+ * \retval OV_EIMPL Unimplemented mode; unable to comply with bitrate
99
+ * request.
100
+ */
101
+ extern int vorbis_encode_setup_managed(
102
+ vorbis_info *vi,
103
+ long channels,
104
+ long rate,
105
+
106
+ long max_bitrate,
107
+ long nominal_bitrate,
108
+ long min_bitrate);
109
+
110
+ /**
111
+ * This function performs step-one of a three-step variable bitrate
112
+ * (quality-based) encode setup. It functions similarly to the one-step setup
113
+ * performed by \ref vorbis_encode_init_vbr() but allows an application to
114
+ * make further encode setup tweaks using \ref vorbis_encode_ctl() before
115
+ * finally calling \ref vorbis_encode_setup_init to complete the setup
116
+ * process.
117
+ *
118
+ * Before this function is called, the \ref vorbis_info struct should be
119
+ * initialized by using \ref vorbis_info_init() from the libvorbis API. After
120
+ * encoding, vorbis_info_clear() should be called.
121
+ *
122
+ * \param vi Pointer to an initialized vorbis_info struct.
123
+ * \param channels The number of channels to be encoded.
124
+ * \param rate The sampling rate of the source audio.
125
+ * \param quality Desired quality level, currently from -0.1 to 1.0 (lo to
126
+ * hi).
127
+ *
128
+ * \return Zero for success, and negative values for failure.
129
+ *
130
+ * \retval 0 Success
131
+ * \retval OV_EFAULT Internal logic fault; indicates a bug or heap/stack
132
+ * corruption.
133
+ * \retval OV_EINVAL Invalid setup request, eg, out of range argument.
134
+ * \retval OV_EIMPL Unimplemented mode; unable to comply with quality level
135
+ * request.
136
+ */
137
+ extern int vorbis_encode_setup_vbr(
138
+ vorbis_info *vi,
139
+ long channels,
140
+ long rate,
141
+
142
+ float quality);
143
+
144
+ /**
145
+ * This is the primary function within libvorbisenc for setting up variable
146
+ * bitrate ("quality" based) modes.
147
+ *
148
+ *
149
+ * Before this function is called, the vorbis_info struct should be
150
+ * initialized by using vorbis_info_init() from the libvorbis API. After
151
+ * encoding, vorbis_info_clear() should be called.
152
+ *
153
+ * \param vi Pointer to an initialized vorbis_info struct.
154
+ * \param channels The number of channels to be encoded.
155
+ * \param rate The sampling rate of the source audio.
156
+ * \param base_quality Desired quality level, currently from -0.1 to 1.0 (lo to
157
+ * hi).
158
+ *
159
+ *
160
+ * \return Zero for success, or a negative number for failure.
161
+ *
162
+ * \retval 0 Success
163
+ * \retval OV_EFAULT Internal logic fault; indicates a bug or heap/stack
164
+ * corruption.
165
+ * \retval OV_EINVAL Invalid setup request, eg, out of range argument.
166
+ * \retval OV_EIMPL Unimplemented mode; unable to comply with quality level
167
+ * request.
168
+ */
169
+ extern int vorbis_encode_init_vbr(
170
+ vorbis_info *vi,
171
+ long channels,
172
+ long rate,
173
+
174
+ float base_quality);
175
+
176
+ /**
177
+ * This function performs the last stage of three-step encoding setup, as
178
+ * described in the API overview under managed bitrate modes.
179
+ *
180
+ * Before this function is called, the \ref vorbis_info struct should be
181
+ * initialized by using vorbis_info_init() from the libvorbis API, one of
182
+ * \ref vorbis_encode_setup_managed() or \ref vorbis_encode_setup_vbr() called
183
+ * to initialize the high-level encoding setup, and \ref vorbis_encode_ctl()
184
+ * called if necessary to make encoding setup changes.
185
+ * vorbis_encode_setup_init() finalizes the highlevel encoding structure into
186
+ * a complete encoding setup after which the application may make no further
187
+ * setup changes.
188
+ *
189
+ * After encoding, vorbis_info_clear() should be called.
190
+ *
191
+ * \param vi Pointer to an initialized \ref vorbis_info struct.
192
+ *
193
+ * \return Zero for success, and negative values for failure.
194
+ *
195
+ * \retval 0 Success.
196
+ * \retval OV_EFAULT Internal logic fault; indicates a bug or heap/stack
197
+ * corruption.
198
+ *
199
+ * \retval OV_EINVAL Attempt to use vorbis_encode_setup_init() without first
200
+ * calling one of vorbis_encode_setup_managed() or vorbis_encode_setup_vbr() to
201
+ * initialize the high-level encoding setup
202
+ *
203
+ */
204
+ extern int vorbis_encode_setup_init(vorbis_info *vi);
205
+
206
+ /**
207
+ * This function implements a generic interface to miscellaneous encoder
208
+ * settings similar to the classic UNIX 'ioctl()' system call. Applications
209
+ * may use vorbis_encode_ctl() to query or set bitrate management or quality
210
+ * mode details by using one of several \e request arguments detailed below.
211
+ * vorbis_encode_ctl() must be called after one of
212
+ * vorbis_encode_setup_managed() or vorbis_encode_setup_vbr(). When used
213
+ * to modify settings, \ref vorbis_encode_ctl() must be called before \ref
214
+ * vorbis_encode_setup_init().
215
+ *
216
+ * \param vi Pointer to an initialized vorbis_info struct.
217
+ *
218
+ * \param number Specifies the desired action; See \ref encctlcodes "the list
219
+ * of available requests".
220
+ *
221
+ * \param arg void * pointing to a data structure matching the request
222
+ * argument.
223
+ *
224
+ * \retval 0 Success. Any further return information (such as the
225
+ * result of a query) is placed into the storage pointed to by *arg.
226
+ *
227
+ * \retval OV_EINVAL Invalid argument, or an attempt to modify a setting after
228
+ * calling vorbis_encode_setup_init().
229
+ *
230
+ * \retval OV_EIMPL Unimplemented or unknown request
231
+ */
232
+ extern int vorbis_encode_ctl(vorbis_info *vi, int number, void *arg);
233
+
234
+ /**
235
+ * \deprecated This is a deprecated interface. Please use vorbis_encode_ctl()
236
+ * with the \ref ovectl_ratemanage2_arg struct and \ref
237
+ * OV_ECTL_RATEMANAGE2_GET and \ref OV_ECTL_RATEMANAGE2_SET calls in new code.
238
+ *
239
+ * The \ref ovectl_ratemanage_arg structure is used with vorbis_encode_ctl()
240
+ * and the \ref OV_ECTL_RATEMANAGE_GET, \ref OV_ECTL_RATEMANAGE_SET, \ref
241
+ * OV_ECTL_RATEMANAGE_AVG, \ref OV_ECTL_RATEMANAGE_HARD calls in order to
242
+ * query and modify specifics of the encoder's bitrate management
243
+ * configuration.
244
+ */
245
+ struct ovectl_ratemanage_arg {
246
+ int management_active; /**< nonzero if bitrate management is active*/
247
+ /** hard lower limit (in kilobits per second) below which the stream bitrate
248
+ will never be allowed for any given bitrate_hard_window seconds of time.*/
249
+ long bitrate_hard_min;
250
+ /** hard upper limit (in kilobits per second) above which the stream bitrate
251
+ will never be allowed for any given bitrate_hard_window seconds of time.*/
252
+ long bitrate_hard_max;
253
+ /** the window period (in seconds) used to regulate the hard bitrate minimum
254
+ and maximum*/
255
+ double bitrate_hard_window;
256
+ /** soft lower limit (in kilobits per second) below which the average bitrate
257
+ tracker will start nudging the bitrate higher.*/
258
+ long bitrate_av_lo;
259
+ /** soft upper limit (in kilobits per second) above which the average bitrate
260
+ tracker will start nudging the bitrate lower.*/
261
+ long bitrate_av_hi;
262
+ /** the window period (in seconds) used to regulate the average bitrate
263
+ minimum and maximum.*/
264
+ double bitrate_av_window;
265
+ /** Regulates the relative centering of the average and hard windows; in
266
+ libvorbis 1.0 and 1.0.1, the hard window regulation overlapped but
267
+ followed the average window regulation. In libvorbis 1.1 a bit-reservoir
268
+ interface replaces the old windowing interface; the older windowing
269
+ interface is simulated and this field has no effect.*/
270
+ double bitrate_av_window_center;
271
+ };
272
+
273
+ /**
274
+ * \name struct ovectl_ratemanage2_arg
275
+ *
276
+ * The ovectl_ratemanage2_arg structure is used with vorbis_encode_ctl() and
277
+ * the OV_ECTL_RATEMANAGE2_GET and OV_ECTL_RATEMANAGE2_SET calls in order to
278
+ * query and modify specifics of the encoder's bitrate management
279
+ * configuration.
280
+ *
281
+ */
282
+ struct ovectl_ratemanage2_arg {
283
+ int management_active; /**< nonzero if bitrate management is active */
284
+ /** Lower allowed bitrate limit in kilobits per second */
285
+ long bitrate_limit_min_kbps;
286
+ /** Upper allowed bitrate limit in kilobits per second */
287
+ long bitrate_limit_max_kbps;
288
+ long
289
+ bitrate_limit_reservoir_bits; /**<Size of the bitrate reservoir in bits */
290
+ /** Regulates the bitrate reservoir's preferred fill level in a range from 0.0
291
+ * to 1.0; 0.0 tries to bank bits to buffer against future bitrate spikes, 1.0
292
+ * buffers against future sudden drops in instantaneous bitrate. Default is
293
+ * 0.1
294
+ */
295
+ double bitrate_limit_reservoir_bias;
296
+ /** Average bitrate setting in kilobits per second */
297
+ long bitrate_average_kbps;
298
+ /** Slew rate limit setting for average bitrate adjustment; sets the minimum
299
+ * time in seconds the bitrate tracker may swing from one extreme to the
300
+ * other when boosting or damping average bitrate.
301
+ */
302
+ double bitrate_average_damping;
303
+ };
304
+
305
+ /**
306
+ * \name vorbis_encode_ctl() codes
307
+ *
308
+ * \anchor encctlcodes
309
+ *
310
+ * These values are passed as the \c number parameter of vorbis_encode_ctl().
311
+ * The type of the referent of that function's \c arg pointer depends on these
312
+ * codes.
313
+ */
314
+ /*@{*/
315
+
316
+ /**
317
+ * Query the current encoder bitrate management setting.
318
+ *
319
+ *Argument: <tt>struct ovectl_ratemanage2_arg *</tt>
320
+ *
321
+ * Used to query the current encoder bitrate management setting. Also used to
322
+ * initialize fields of an ovectl_ratemanage2_arg structure for use with
323
+ * \ref OV_ECTL_RATEMANAGE2_SET.
324
+ */
325
+ #define OV_ECTL_RATEMANAGE2_GET 0x14
326
+
327
+ /**
328
+ * Set the current encoder bitrate management settings.
329
+ *
330
+ * Argument: <tt>struct ovectl_ratemanage2_arg *</tt>
331
+ *
332
+ * Used to set the current encoder bitrate management settings to the values
333
+ * listed in the ovectl_ratemanage2_arg. Passing a NULL pointer will disable
334
+ * bitrate management.
335
+ */
336
+ #define OV_ECTL_RATEMANAGE2_SET 0x15
337
+
338
+ /**
339
+ * Returns the current encoder hard-lowpass setting (kHz) in the double
340
+ * pointed to by arg.
341
+ *
342
+ * Argument: <tt>double *</tt>
343
+ */
344
+ #define OV_ECTL_LOWPASS_GET 0x20
345
+
346
+ /**
347
+ * Sets the encoder hard-lowpass to the value (kHz) pointed to by arg. Valid
348
+ * lowpass settings range from 2 to 99.
349
+ *
350
+ * Argument: <tt>double *</tt>
351
+ */
352
+ #define OV_ECTL_LOWPASS_SET 0x21
353
+
354
+ /**
355
+ * Returns the current encoder impulse block setting in the double pointed
356
+ * to by arg.
357
+ *
358
+ * Argument: <tt>double *</tt>
359
+ */
360
+ #define OV_ECTL_IBLOCK_GET 0x30
361
+
362
+ /**
363
+ * Sets the impulse block bias to the the value pointed to by arg.
364
+ *
365
+ * Argument: <tt>double *</tt>
366
+ *
367
+ * Valid range is -15.0 to 0.0 [default]. A negative impulse block bias will
368
+ * direct to encoder to use more bits when incoding short blocks that contain
369
+ * strong impulses, thus improving the accuracy of impulse encoding.
370
+ */
371
+ #define OV_ECTL_IBLOCK_SET 0x31
372
+
373
+ /**
374
+ * Returns the current encoder coupling setting in the int pointed
375
+ * to by arg.
376
+ *
377
+ * Argument: <tt>int *</tt>
378
+ */
379
+ #define OV_ECTL_COUPLING_GET 0x40
380
+
381
+ /**
382
+ * Enables/disables channel coupling in multichannel encoding according to arg.
383
+ *
384
+ * Argument: <tt>int *</tt>
385
+ *
386
+ * Zero disables channel coupling for multichannel inputs, nonzer enables
387
+ * channel coupling. Setting has no effect on monophonic encoding or
388
+ * multichannel counts that do not offer coupling. At present, coupling is
389
+ * available for stereo and 5.1 encoding.
390
+ */
391
+ #define OV_ECTL_COUPLING_SET 0x41
392
+
393
+ /* deprecated rate management supported only for compatibility */
394
+
395
+ /**
396
+ * Old interface to querying bitrate management settings.
397
+ *
398
+ * Deprecated after move to bit-reservoir style management in 1.1 rendered
399
+ * this interface partially obsolete.
400
+
401
+ * \deprecated Please use \ref OV_ECTL_RATEMANAGE2_GET instead.
402
+ *
403
+ * Argument: <tt>struct ovectl_ratemanage_arg *</tt>
404
+ */
405
+ #define OV_ECTL_RATEMANAGE_GET 0x10
406
+ /**
407
+ * Old interface to modifying bitrate management settings.
408
+ *
409
+ * deprecated after move to bit-reservoir style management in 1.1 rendered
410
+ * this interface partially obsolete.
411
+ *
412
+ * \deprecated Please use \ref OV_ECTL_RATEMANAGE2_SET instead.
413
+ *
414
+ * Argument: <tt>struct ovectl_ratemanage_arg *</tt>
415
+ */
416
+ #define OV_ECTL_RATEMANAGE_SET 0x11
417
+ /**
418
+ * Old interface to setting average-bitrate encoding mode.
419
+ *
420
+ * Deprecated after move to bit-reservoir style management in 1.1 rendered
421
+ * this interface partially obsolete.
422
+ *
423
+ * \deprecated Please use \ref OV_ECTL_RATEMANAGE2_SET instead.
424
+ *
425
+ * Argument: <tt>struct ovectl_ratemanage_arg *</tt>
426
+ */
427
+ #define OV_ECTL_RATEMANAGE_AVG 0x12
428
+ /**
429
+ * Old interface to setting bounded-bitrate encoding modes.
430
+ *
431
+ * deprecated after move to bit-reservoir style management in 1.1 rendered
432
+ * this interface partially obsolete.
433
+ *
434
+ * \deprecated Please use \ref OV_ECTL_RATEMANAGE2_SET instead.
435
+ *
436
+ * Argument: <tt>struct ovectl_ratemanage_arg *</tt>
437
+ */
438
+ #define OV_ECTL_RATEMANAGE_HARD 0x13
439
+
440
+ /*@}*/
441
+
442
+ #ifdef __cplusplus
443
+ }
444
+ #endif /* __cplusplus */
445
+
446
+ #endif