unsafe_libopus/
lib.rs

1extern crate core;
2
3pub mod externs;
4pub mod varargs;
5
6#[allow(non_camel_case_types)]
7#[allow(non_snake_case)]
8#[allow(non_upper_case_globals)]
9#[allow(unused_assignments)]
10mod celt {
11    pub mod bands;
12    pub mod celt;
13    pub mod celt_decoder;
14    pub mod celt_encoder;
15    pub mod celt_lpc;
16    pub mod cwrs;
17    pub mod entcode;
18    pub mod entdec;
19    pub mod entenc;
20    pub mod kiss_fft;
21    pub mod laplace;
22    pub mod mathops;
23    pub mod mdct;
24    pub mod modes;
25    pub mod pitch;
26    pub mod quant_bands;
27    pub mod rate;
28    // pub mod tests {
29    //     pub mod test_unit_cwrs32;
30    //     pub mod test_unit_dft;
31    //     pub mod test_unit_entropy;
32    //     pub mod test_unit_laplace;
33    //     pub mod test_unit_mathops;
34    //     pub mod test_unit_mdct;
35    //     pub mod test_unit_rotation;
36    //     pub mod test_unit_types;
37    // } // mod tests
38    pub mod vq;
39    // stuff for structs that do not have a clear home, named after the header files
40    pub mod float_cast;
41} // mod celt
42
43#[allow(non_camel_case_types)]
44#[allow(non_snake_case)]
45#[allow(non_upper_case_globals)]
46#[allow(unused_assignments)]
47mod silk {
48    pub mod A2NLSF;
49    pub mod CNG;
50    pub mod HP_variable_cutoff;
51    pub mod LPC_analysis_filter;
52    pub mod LPC_fit;
53    pub mod LPC_inv_pred_gain;
54    pub mod LP_variable_cutoff;
55    pub mod NLSF2A;
56    pub mod NLSF_VQ;
57    pub mod NLSF_VQ_weights_laroia;
58    pub mod NLSF_decode;
59    pub mod NLSF_del_dec_quant;
60    pub mod NLSF_encode;
61    pub mod NLSF_stabilize;
62    pub mod NLSF_unpack;
63    pub mod NSQ;
64    pub mod NSQ_del_dec;
65    pub mod PLC;
66    pub mod VAD;
67    pub mod VQ_WMat_EC;
68    pub mod ana_filt_bank_1;
69    pub mod biquad_alt;
70    pub mod bwexpander;
71    pub mod bwexpander_32;
72    pub mod check_control_input;
73    pub mod code_signs;
74    pub mod control_SNR;
75    pub mod control_audio_bandwidth;
76    pub mod control_codec;
77    pub mod debug;
78    pub mod dec_API;
79    pub mod decode_core;
80    pub mod decode_frame;
81    pub mod decode_indices;
82    pub mod decode_parameters;
83    pub mod decode_pitch;
84    pub mod decode_pulses;
85    pub mod decoder_set_fs;
86    pub mod enc_API;
87    pub mod encode_indices;
88    pub mod encode_pulses;
89    pub mod float {
90        pub mod LPC_analysis_filter_FLP;
91        pub mod LTP_analysis_filter_FLP;
92        pub mod LTP_scale_ctrl_FLP;
93        pub mod apply_sine_window_FLP;
94        pub mod autocorrelation_FLP;
95        pub mod burg_modified_FLP;
96        pub mod bwexpander_FLP;
97        pub mod corrMatrix_FLP;
98        pub mod encode_frame_FLP;
99        pub mod energy_FLP;
100        pub mod find_LPC_FLP;
101        pub mod find_LTP_FLP;
102        pub mod find_pitch_lags_FLP;
103        pub mod find_pred_coefs_FLP;
104        pub mod inner_product_FLP;
105        pub mod k2a_FLP;
106        pub mod noise_shape_analysis_FLP;
107        pub mod pitch_analysis_core_FLP;
108        pub mod process_gains_FLP;
109        pub mod residual_energy_FLP;
110        pub mod scale_copy_vector_FLP;
111        pub mod scale_vector_FLP;
112        pub mod schur_FLP;
113        pub mod sort_FLP;
114        pub mod structs_FLP;
115        pub mod warped_autocorrelation_FLP;
116        pub mod wrappers_FLP;
117    } // mod float
118    pub mod gain_quant;
119    pub mod init_decoder;
120    pub mod init_encoder;
121    pub mod inner_prod_aligned;
122    pub mod interpolate;
123    pub mod lin2log;
124    pub mod log2lin;
125    pub mod pitch_est_tables;
126    pub mod process_NLSFs;
127    pub mod quant_LTP_gains;
128    pub mod resampler;
129    pub mod shell_coder;
130    pub mod sigm_Q15;
131    pub mod sort;
132    pub mod stereo_LR_to_MS;
133    pub mod stereo_MS_to_LR;
134    pub mod stereo_decode_pred;
135    pub mod stereo_encode_pred;
136    pub mod stereo_find_predictor;
137    pub mod stereo_quant_pred;
138    pub mod sum_sqr_shift;
139    pub mod table_LSF_cos;
140    pub mod tables_LTP;
141    pub mod tables_NLSF_CB_NB_MB;
142    pub mod tables_NLSF_CB_WB;
143    pub mod tables_gain;
144    pub mod tables_other;
145    pub mod tables_pitch_lag;
146    pub mod tables_pulses_per_block;
147    // stuff for structs that do not have a clear home, named after the header files
148    pub mod Inlines;
149    pub mod SigProc_FIX;
150    pub mod define;
151    pub mod macros;
152    pub mod structs;
153
154    pub mod mathops;
155} // mod silk
156
157#[allow(non_camel_case_types)]
158#[allow(non_snake_case)]
159#[allow(non_upper_case_globals)]
160#[allow(unused_assignments)]
161mod src {
162    pub mod analysis;
163    pub mod mapping_matrix;
164    pub mod mlp;
165    pub mod mlp_data;
166    pub mod opus;
167    pub mod opus_decoder;
168    pub mod opus_encoder;
169    pub mod opus_multistream;
170    pub mod opus_multistream_decoder;
171    pub mod opus_multistream_encoder;
172    pub mod opus_projection_decoder;
173    pub mod opus_projection_encoder;
174    pub mod repacketizer;
175    // stuff for structs that do not have a clear home, named after the header files
176    pub mod opus_defines;
177    pub mod opus_private;
178} // mod src
179
180// TODO: copy over the docs
181// =====
182// opus.h
183// =====
184
185// opus_encoder
186pub use crate::src::opus_encoder::{
187    opus_encode, opus_encode_float, opus_encoder_create, opus_encoder_ctl_impl,
188    opus_encoder_destroy, opus_encoder_get_size, opus_encoder_init, OpusEncoder,
189};
190// opus_decoder
191pub use crate::src::opus_decoder::{
192    opus_decode, opus_decode_float, opus_decoder_create, opus_decoder_ctl_impl,
193    opus_decoder_destroy, opus_decoder_get_nb_samples, opus_decoder_get_size, opus_decoder_init,
194    opus_packet_get_bandwidth, opus_packet_get_nb_channels, opus_packet_get_nb_frames,
195    opus_packet_get_nb_samples, OpusDecoder,
196};
197
198pub use crate::src::opus::{
199    opus_packet_get_samples_per_frame, opus_packet_parse, opus_pcm_soft_clip,
200};
201// opus_repacketizer
202pub use crate::src::repacketizer::{
203    opus_multistream_packet_pad, opus_multistream_packet_unpad, opus_packet_pad, opus_packet_unpad,
204    opus_repacketizer_cat, opus_repacketizer_create, opus_repacketizer_destroy,
205    opus_repacketizer_get_nb_frames, opus_repacketizer_get_size, opus_repacketizer_init,
206    opus_repacketizer_out, opus_repacketizer_out_range, opus_repacketizer_out_range_impl,
207    OpusRepacketizer,
208};
209
210// =====
211// opus_defines.h
212// =====
213// opus_errorcodes
214pub use crate::src::opus_defines::{
215    OPUS_ALLOC_FAIL, OPUS_BAD_ARG, OPUS_BUFFER_TOO_SMALL, OPUS_INTERNAL_ERROR, OPUS_INVALID_PACKET,
216    OPUS_INVALID_STATE, OPUS_OK, OPUS_UNIMPLEMENTED,
217};
218pub use crate::src::opus_defines::{
219    OPUS_GET_APPLICATION_REQUEST, OPUS_GET_BANDWIDTH_REQUEST, OPUS_GET_BITRATE_REQUEST,
220    OPUS_GET_COMPLEXITY_REQUEST, OPUS_GET_DTX_REQUEST, OPUS_GET_EXPERT_FRAME_DURATION_REQUEST,
221    OPUS_GET_FINAL_RANGE_REQUEST, OPUS_GET_FORCE_CHANNELS_REQUEST, OPUS_GET_GAIN_REQUEST,
222    OPUS_GET_INBAND_FEC_REQUEST, OPUS_GET_IN_DTX_REQUEST, OPUS_GET_LAST_PACKET_DURATION_REQUEST,
223    OPUS_GET_LOOKAHEAD_REQUEST, OPUS_GET_LSB_DEPTH_REQUEST, OPUS_GET_MAX_BANDWIDTH_REQUEST,
224    OPUS_GET_PACKET_LOSS_PERC_REQUEST, OPUS_GET_PHASE_INVERSION_DISABLED_REQUEST,
225    OPUS_GET_PITCH_REQUEST, OPUS_GET_PREDICTION_DISABLED_REQUEST, OPUS_GET_SAMPLE_RATE_REQUEST,
226    OPUS_GET_SIGNAL_REQUEST, OPUS_GET_VBR_CONSTRAINT_REQUEST, OPUS_GET_VBR_REQUEST,
227    OPUS_RESET_STATE, OPUS_SET_APPLICATION_REQUEST, OPUS_SET_BANDWIDTH_REQUEST,
228    OPUS_SET_BITRATE_REQUEST, OPUS_SET_COMPLEXITY_REQUEST, OPUS_SET_DTX_REQUEST,
229    OPUS_SET_EXPERT_FRAME_DURATION_REQUEST, OPUS_SET_FORCE_CHANNELS_REQUEST, OPUS_SET_GAIN_REQUEST,
230    OPUS_SET_INBAND_FEC_REQUEST, OPUS_SET_LSB_DEPTH_REQUEST, OPUS_SET_MAX_BANDWIDTH_REQUEST,
231    OPUS_SET_PACKET_LOSS_PERC_REQUEST, OPUS_SET_PHASE_INVERSION_DISABLED_REQUEST,
232    OPUS_SET_PREDICTION_DISABLED_REQUEST, OPUS_SET_SIGNAL_REQUEST, OPUS_SET_VBR_CONSTRAINT_REQUEST,
233    OPUS_SET_VBR_REQUEST,
234};
235// opus_ctlvalues
236pub use crate::src::opus_defines::{
237    OPUS_APPLICATION_AUDIO, OPUS_APPLICATION_RESTRICTED_LOWDELAY, OPUS_APPLICATION_VOIP, OPUS_AUTO,
238    OPUS_BANDWIDTH_FULLBAND, OPUS_BANDWIDTH_MEDIUMBAND, OPUS_BANDWIDTH_NARROWBAND,
239    OPUS_BANDWIDTH_SUPERWIDEBAND, OPUS_BANDWIDTH_WIDEBAND, OPUS_BITRATE_MAX, OPUS_FRAMESIZE_100_MS,
240    OPUS_FRAMESIZE_10_MS, OPUS_FRAMESIZE_120_MS, OPUS_FRAMESIZE_20_MS, OPUS_FRAMESIZE_2_5_MS,
241    OPUS_FRAMESIZE_40_MS, OPUS_FRAMESIZE_5_MS, OPUS_FRAMESIZE_60_MS, OPUS_FRAMESIZE_80_MS,
242    OPUS_FRAMESIZE_ARG, OPUS_SIGNAL_MUSIC, OPUS_SIGNAL_VOICE,
243};
244// opus_libinfo
245pub use crate::celt::celt::{opus_get_version_string, opus_strerror};
246
247// =====
248// opus_multistream.h
249// =====
250pub use crate::src::opus_multistream_decoder::{
251    opus_multistream_decode, opus_multistream_decode_float, opus_multistream_decoder_create,
252    opus_multistream_decoder_ctl_impl, opus_multistream_decoder_destroy,
253    opus_multistream_decoder_get_size, opus_multistream_decoder_init, OpusMSDecoder,
254};
255pub use crate::src::opus_multistream_encoder::{
256    opus_multistream_encode, opus_multistream_encode_float, opus_multistream_encoder_create,
257    opus_multistream_encoder_ctl_impl, opus_multistream_encoder_destroy,
258    opus_multistream_encoder_get_size, opus_multistream_encoder_init,
259    opus_multistream_surround_encoder_create, opus_multistream_surround_encoder_get_size,
260    opus_multistream_surround_encoder_init, OpusMSEncoder,
261};
262
263// =====
264// opus_projection.h
265// =====
266pub use crate::src::opus_projection_decoder::{
267    opus_projection_decode, opus_projection_decode_float, opus_projection_decoder_create,
268    opus_projection_decoder_ctl_impl, opus_projection_decoder_destroy,
269    opus_projection_decoder_get_size, opus_projection_decoder_init, OpusProjectionDecoder,
270};
271pub use crate::src::opus_projection_encoder::{
272    opus_projection_ambisonics_encoder_create, opus_projection_ambisonics_encoder_get_size,
273    opus_projection_ambisonics_encoder_init, opus_projection_encode, opus_projection_encode_float,
274    opus_projection_encoder_ctl_impl, opus_projection_encoder_destroy, OpusProjectionEncoder,
275};
276
277// =====
278// opus_custom.h
279// =====
280pub use crate::celt::celt_decoder::{opus_custom_decoder_ctl_impl, OpusCustomDecoder};
281pub use crate::celt::celt_encoder::{opus_custom_encoder_ctl_impl, OpusCustomEncoder};
282// NOTE: we don't support opus custom modes, so no opus_custom_destroy here
283pub use crate::celt::modes::{opus_custom_mode_create, OpusCustomMode};
284
285// expose opus_private
286pub use crate::src::opus_private;