1#![no_std]
5#![allow(non_upper_case_globals)]
6#![allow(non_camel_case_types)]
7#![allow(non_snake_case)]
8
9
10pub const OPUS_OK: libc::c_int = 0;
11pub const OPUS_BAD_ARG: libc::c_int = -1;
12pub const OPUS_BUFFER_TOO_SMALL: libc::c_int = -2;
13pub const OPUS_INTERNAL_ERROR: libc::c_int = -3;
14pub const OPUS_INVALID_PACKET: libc::c_int = -4;
15pub const OPUS_UNIMPLEMENTED: libc::c_int = -5;
16pub const OPUS_INVALID_STATE: libc::c_int = -6;
17pub const OPUS_ALLOC_FAIL: libc::c_int = -7;
18pub const OPUS_SET_APPLICATION_REQUEST: libc::c_int = 4000;
19pub const OPUS_GET_APPLICATION_REQUEST: libc::c_int = 4001;
20pub const OPUS_SET_BITRATE_REQUEST: libc::c_int = 4002;
21pub const OPUS_GET_BITRATE_REQUEST: libc::c_int = 4003;
22pub const OPUS_SET_MAX_BANDWIDTH_REQUEST: libc::c_int = 4004;
23pub const OPUS_GET_MAX_BANDWIDTH_REQUEST: libc::c_int = 4005;
24pub const OPUS_SET_VBR_REQUEST: libc::c_int = 4006;
25pub const OPUS_GET_VBR_REQUEST: libc::c_int = 4007;
26pub const OPUS_SET_BANDWIDTH_REQUEST: libc::c_int = 4008;
27pub const OPUS_GET_BANDWIDTH_REQUEST: libc::c_int = 4009;
28pub const OPUS_SET_COMPLEXITY_REQUEST: libc::c_int = 4010;
29pub const OPUS_GET_COMPLEXITY_REQUEST: libc::c_int = 4011;
30pub const OPUS_SET_INBAND_FEC_REQUEST: libc::c_int = 4012;
31pub const OPUS_GET_INBAND_FEC_REQUEST: libc::c_int = 4013;
32pub const OPUS_SET_PACKET_LOSS_PERC_REQUEST: libc::c_int = 4014;
33pub const OPUS_GET_PACKET_LOSS_PERC_REQUEST: libc::c_int = 4015;
34pub const OPUS_SET_DTX_REQUEST: libc::c_int = 4016;
35pub const OPUS_GET_DTX_REQUEST: libc::c_int = 4017;
36pub const OPUS_SET_VBR_CONSTRAINT_REQUEST: libc::c_int = 4020;
37pub const OPUS_GET_VBR_CONSTRAINT_REQUEST: libc::c_int = 4021;
38pub const OPUS_SET_FORCE_CHANNELS_REQUEST: libc::c_int = 4022;
39pub const OPUS_GET_FORCE_CHANNELS_REQUEST: libc::c_int = 4023;
40pub const OPUS_SET_SIGNAL_REQUEST: libc::c_int = 4024;
41pub const OPUS_GET_SIGNAL_REQUEST: libc::c_int = 4025;
42pub const OPUS_GET_LOOKAHEAD_REQUEST: libc::c_int = 4027;
43pub const OPUS_GET_SAMPLE_RATE_REQUEST: libc::c_int = 4029;
44pub const OPUS_GET_FINAL_RANGE_REQUEST: libc::c_int = 4031;
45pub const OPUS_GET_PITCH_REQUEST: libc::c_int = 4033;
46pub const OPUS_SET_GAIN_REQUEST: libc::c_int = 4034;
47pub const OPUS_GET_GAIN_REQUEST: libc::c_int = 4045;
48pub const OPUS_SET_LSB_DEPTH_REQUEST: libc::c_int = 4036;
49pub const OPUS_GET_LSB_DEPTH_REQUEST: libc::c_int = 4037;
50pub const OPUS_GET_LAST_PACKET_DURATION_REQUEST: libc::c_int = 4039;
51pub const OPUS_SET_EXPERT_FRAME_DURATION_REQUEST: libc::c_int = 4040;
52pub const OPUS_GET_EXPERT_FRAME_DURATION_REQUEST: libc::c_int = 4041;
53pub const OPUS_SET_PREDICTION_DISABLED_REQUEST: libc::c_int = 4042;
54pub const OPUS_GET_PREDICTION_DISABLED_REQUEST: libc::c_int = 4043;
55pub const OPUS_SET_PHASE_INVERSION_DISABLED_REQUEST: libc::c_int = 4046;
56pub const OPUS_GET_PHASE_INVERSION_DISABLED_REQUEST: libc::c_int = 4047;
57pub const OPUS_GET_IN_DTX_REQUEST: libc::c_int = 4049;
58pub const OPUS_SET_DRED_DURATION_REQUEST: libc::c_int = 4050;
59pub const OPUS_GET_DRED_DURATION_REQUEST: libc::c_int = 4051;
60pub const OPUS_SET_DNN_BLOB_REQUEST: libc::c_int = 4052;
61pub const OPUS_AUTO: libc::c_int = -1000;
62pub const OPUS_BITRATE_MAX: libc::c_int = -1;
63pub const OPUS_APPLICATION_VOIP: libc::c_int = 2048;
64pub const OPUS_APPLICATION_AUDIO: libc::c_int = 2049;
65pub const OPUS_APPLICATION_RESTRICTED_LOWDELAY: libc::c_int = 2051;
66pub const OPUS_SIGNAL_VOICE: libc::c_int = 3001;
67pub const OPUS_SIGNAL_MUSIC: libc::c_int = 3002;
68pub const OPUS_BANDWIDTH_NARROWBAND: libc::c_int = 1101;
69pub const OPUS_BANDWIDTH_MEDIUMBAND: libc::c_int = 1102;
70pub const OPUS_BANDWIDTH_WIDEBAND: libc::c_int = 1103;
71pub const OPUS_BANDWIDTH_SUPERWIDEBAND: libc::c_int = 1104;
72pub const OPUS_BANDWIDTH_FULLBAND: libc::c_int = 1105;
73pub const OPUS_FRAMESIZE_ARG: libc::c_int = 5000;
74pub const OPUS_FRAMESIZE_2_5_MS: libc::c_int = 5001;
75pub const OPUS_FRAMESIZE_5_MS: libc::c_int = 5002;
76pub const OPUS_FRAMESIZE_10_MS: libc::c_int = 5003;
77pub const OPUS_FRAMESIZE_20_MS: libc::c_int = 5004;
78pub const OPUS_FRAMESIZE_40_MS: libc::c_int = 5005;
79pub const OPUS_FRAMESIZE_60_MS: libc::c_int = 5006;
80pub const OPUS_FRAMESIZE_80_MS: libc::c_int = 5007;
81pub const OPUS_FRAMESIZE_100_MS: libc::c_int = 5008;
82pub const OPUS_FRAMESIZE_120_MS: libc::c_int = 5009;
83pub const OPUS_RESET_STATE: libc::c_int = 4028;
84pub const OPUS_MULTISTREAM_GET_ENCODER_STATE_REQUEST: libc::c_int = 5120;
85pub const OPUS_MULTISTREAM_GET_DECODER_STATE_REQUEST: libc::c_int = 5122;
86pub type opus_int32 = libc::c_int;
87pub type opus_uint32 = libc::c_uint;
88pub type opus_int16 = libc::c_short;
89pub type opus_uint16 = libc::c_ushort;
90unsafe extern "C" {
91 pub fn opus_strerror(error: libc::c_int) -> *const libc::c_char;
92}
93unsafe extern "C" {
94 pub fn opus_get_version_string() -> *const libc::c_char;
95}
96#[repr(C)]
97#[derive(Debug, Copy, Clone)]
98pub struct OpusEncoder {
99 _unused: [u8; 0],
100}
101unsafe extern "C" {
102 pub fn opus_encoder_get_size(channels: libc::c_int) -> libc::c_int;
103}
104unsafe extern "C" {
105 pub fn opus_encoder_create(
106 Fs: opus_int32,
107 channels: libc::c_int,
108 application: libc::c_int,
109 error: *mut libc::c_int,
110 ) -> *mut OpusEncoder;
111}
112unsafe extern "C" {
113 pub fn opus_encoder_init(
114 st: *mut OpusEncoder,
115 Fs: opus_int32,
116 channels: libc::c_int,
117 application: libc::c_int,
118 ) -> libc::c_int;
119}
120unsafe extern "C" {
121 pub fn opus_encode(
122 st: *mut OpusEncoder,
123 pcm: *const opus_int16,
124 frame_size: libc::c_int,
125 data: *mut libc::c_uchar,
126 max_data_bytes: opus_int32,
127 ) -> opus_int32;
128}
129unsafe extern "C" {
130 pub fn opus_encode_float(
131 st: *mut OpusEncoder,
132 pcm: *const f32,
133 frame_size: libc::c_int,
134 data: *mut libc::c_uchar,
135 max_data_bytes: opus_int32,
136 ) -> opus_int32;
137}
138unsafe extern "C" {
139 pub fn opus_encoder_destroy(st: *mut OpusEncoder);
140}
141unsafe extern "C" {
142 pub fn opus_encoder_ctl(st: *mut OpusEncoder, request: libc::c_int, ...) -> libc::c_int;
143}
144#[repr(C)]
145#[derive(Debug, Copy, Clone)]
146pub struct OpusDecoder {
147 _unused: [u8; 0],
148}
149#[repr(C)]
150#[derive(Debug, Copy, Clone)]
151pub struct OpusDREDDecoder {
152 _unused: [u8; 0],
153}
154#[repr(C)]
155#[derive(Debug, Copy, Clone)]
156pub struct OpusDRED {
157 _unused: [u8; 0],
158}
159unsafe extern "C" {
160 pub fn opus_decoder_get_size(channels: libc::c_int) -> libc::c_int;
161}
162unsafe extern "C" {
163 pub fn opus_decoder_create(
164 Fs: opus_int32,
165 channels: libc::c_int,
166 error: *mut libc::c_int,
167 ) -> *mut OpusDecoder;
168}
169unsafe extern "C" {
170 pub fn opus_decoder_init(
171 st: *mut OpusDecoder,
172 Fs: opus_int32,
173 channels: libc::c_int,
174 ) -> libc::c_int;
175}
176unsafe extern "C" {
177 pub fn opus_decode(
178 st: *mut OpusDecoder,
179 data: *const libc::c_uchar,
180 len: opus_int32,
181 pcm: *mut opus_int16,
182 frame_size: libc::c_int,
183 decode_fec: libc::c_int,
184 ) -> libc::c_int;
185}
186unsafe extern "C" {
187 pub fn opus_decode_float(
188 st: *mut OpusDecoder,
189 data: *const libc::c_uchar,
190 len: opus_int32,
191 pcm: *mut f32,
192 frame_size: libc::c_int,
193 decode_fec: libc::c_int,
194 ) -> libc::c_int;
195}
196unsafe extern "C" {
197 pub fn opus_decoder_ctl(st: *mut OpusDecoder, request: libc::c_int, ...) -> libc::c_int;
198}
199unsafe extern "C" {
200 pub fn opus_decoder_destroy(st: *mut OpusDecoder);
201}
202unsafe extern "C" {
203 pub fn opus_dred_decoder_get_size() -> libc::c_int;
204}
205unsafe extern "C" {
206 pub fn opus_dred_decoder_create(error: *mut libc::c_int) -> *mut OpusDREDDecoder;
207}
208unsafe extern "C" {
209 pub fn opus_dred_decoder_init(dec: *mut OpusDREDDecoder) -> libc::c_int;
210}
211unsafe extern "C" {
212 pub fn opus_dred_decoder_destroy(dec: *mut OpusDREDDecoder);
213}
214unsafe extern "C" {
215 pub fn opus_dred_decoder_ctl(
216 dred_dec: *mut OpusDREDDecoder,
217 request: libc::c_int,
218 ...
219 ) -> libc::c_int;
220}
221unsafe extern "C" {
222 pub fn opus_dred_get_size() -> libc::c_int;
223}
224unsafe extern "C" {
225 pub fn opus_dred_alloc(error: *mut libc::c_int) -> *mut OpusDRED;
226}
227unsafe extern "C" {
228 pub fn opus_dred_free(dec: *mut OpusDRED);
229}
230unsafe extern "C" {
231 pub fn opus_dred_parse(
232 dred_dec: *mut OpusDREDDecoder,
233 dred: *mut OpusDRED,
234 data: *const libc::c_uchar,
235 len: opus_int32,
236 max_dred_samples: opus_int32,
237 sampling_rate: opus_int32,
238 dred_end: *mut libc::c_int,
239 defer_processing: libc::c_int,
240 ) -> libc::c_int;
241}
242unsafe extern "C" {
243 pub fn opus_dred_process(
244 dred_dec: *mut OpusDREDDecoder,
245 src: *const OpusDRED,
246 dst: *mut OpusDRED,
247 ) -> libc::c_int;
248}
249unsafe extern "C" {
250 pub fn opus_decoder_dred_decode(
251 st: *mut OpusDecoder,
252 dred: *const OpusDRED,
253 dred_offset: opus_int32,
254 pcm: *mut opus_int16,
255 frame_size: opus_int32,
256 ) -> libc::c_int;
257}
258unsafe extern "C" {
259 pub fn opus_decoder_dred_decode_float(
260 st: *mut OpusDecoder,
261 dred: *const OpusDRED,
262 dred_offset: opus_int32,
263 pcm: *mut f32,
264 frame_size: opus_int32,
265 ) -> libc::c_int;
266}
267unsafe extern "C" {
268 pub fn opus_packet_parse(
269 data: *const libc::c_uchar,
270 len: opus_int32,
271 out_toc: *mut libc::c_uchar,
272 frames: *mut *const libc::c_uchar,
273 size: *mut opus_int16,
274 payload_offset: *mut libc::c_int,
275 ) -> libc::c_int;
276}
277unsafe extern "C" {
278 pub fn opus_packet_get_bandwidth(data: *const libc::c_uchar) -> libc::c_int;
279}
280unsafe extern "C" {
281 pub fn opus_packet_get_samples_per_frame(
282 data: *const libc::c_uchar,
283 Fs: opus_int32,
284 ) -> libc::c_int;
285}
286unsafe extern "C" {
287 pub fn opus_packet_get_nb_channels(data: *const libc::c_uchar) -> libc::c_int;
288}
289unsafe extern "C" {
290 pub fn opus_packet_get_nb_frames(packet: *const libc::c_uchar, len: opus_int32) -> libc::c_int;
291}
292unsafe extern "C" {
293 pub fn opus_packet_get_nb_samples(
294 packet: *const libc::c_uchar,
295 len: opus_int32,
296 Fs: opus_int32,
297 ) -> libc::c_int;
298}
299unsafe extern "C" {
300 pub fn opus_packet_has_lbrr(packet: *const libc::c_uchar, len: opus_int32) -> libc::c_int;
301}
302unsafe extern "C" {
303 pub fn opus_decoder_get_nb_samples(
304 dec: *const OpusDecoder,
305 packet: *const libc::c_uchar,
306 len: opus_int32,
307 ) -> libc::c_int;
308}
309unsafe extern "C" {
310 pub fn opus_pcm_soft_clip(
311 pcm: *mut f32,
312 frame_size: libc::c_int,
313 channels: libc::c_int,
314 softclip_mem: *mut f32,
315 );
316}
317#[repr(C)]
318#[derive(Debug, Copy, Clone)]
319pub struct OpusRepacketizer {
320 _unused: [u8; 0],
321}
322unsafe extern "C" {
323 pub fn opus_repacketizer_get_size() -> libc::c_int;
324}
325unsafe extern "C" {
326 pub fn opus_repacketizer_init(rp: *mut OpusRepacketizer) -> *mut OpusRepacketizer;
327}
328unsafe extern "C" {
329 pub fn opus_repacketizer_create() -> *mut OpusRepacketizer;
330}
331unsafe extern "C" {
332 pub fn opus_repacketizer_destroy(rp: *mut OpusRepacketizer);
333}
334unsafe extern "C" {
335 pub fn opus_repacketizer_cat(
336 rp: *mut OpusRepacketizer,
337 data: *const libc::c_uchar,
338 len: opus_int32,
339 ) -> libc::c_int;
340}
341unsafe extern "C" {
342 pub fn opus_repacketizer_out_range(
343 rp: *mut OpusRepacketizer,
344 begin: libc::c_int,
345 end: libc::c_int,
346 data: *mut libc::c_uchar,
347 maxlen: opus_int32,
348 ) -> opus_int32;
349}
350unsafe extern "C" {
351 pub fn opus_repacketizer_get_nb_frames(rp: *mut OpusRepacketizer) -> libc::c_int;
352}
353unsafe extern "C" {
354 pub fn opus_repacketizer_out(
355 rp: *mut OpusRepacketizer,
356 data: *mut libc::c_uchar,
357 maxlen: opus_int32,
358 ) -> opus_int32;
359}
360unsafe extern "C" {
361 pub fn opus_packet_pad(
362 data: *mut libc::c_uchar,
363 len: opus_int32,
364 new_len: opus_int32,
365 ) -> libc::c_int;
366}
367unsafe extern "C" {
368 pub fn opus_packet_unpad(data: *mut libc::c_uchar, len: opus_int32) -> opus_int32;
369}
370unsafe extern "C" {
371 pub fn opus_multistream_packet_pad(
372 data: *mut libc::c_uchar,
373 len: opus_int32,
374 new_len: opus_int32,
375 nb_streams: libc::c_int,
376 ) -> libc::c_int;
377}
378unsafe extern "C" {
379 pub fn opus_multistream_packet_unpad(
380 data: *mut libc::c_uchar,
381 len: opus_int32,
382 nb_streams: libc::c_int,
383 ) -> opus_int32;
384}
385#[repr(C)]
386#[derive(Debug, Copy, Clone)]
387pub struct OpusMSEncoder {
388 _unused: [u8; 0],
389}
390#[repr(C)]
391#[derive(Debug, Copy, Clone)]
392pub struct OpusMSDecoder {
393 _unused: [u8; 0],
394}
395unsafe extern "C" {
396 pub fn opus_multistream_encoder_get_size(
397 streams: libc::c_int,
398 coupled_streams: libc::c_int,
399 ) -> opus_int32;
400}
401unsafe extern "C" {
402 pub fn opus_multistream_surround_encoder_get_size(
403 channels: libc::c_int,
404 mapping_family: libc::c_int,
405 ) -> opus_int32;
406}
407unsafe extern "C" {
408 pub fn opus_multistream_encoder_create(
409 Fs: opus_int32,
410 channels: libc::c_int,
411 streams: libc::c_int,
412 coupled_streams: libc::c_int,
413 mapping: *const libc::c_uchar,
414 application: libc::c_int,
415 error: *mut libc::c_int,
416 ) -> *mut OpusMSEncoder;
417}
418unsafe extern "C" {
419 pub fn opus_multistream_surround_encoder_create(
420 Fs: opus_int32,
421 channels: libc::c_int,
422 mapping_family: libc::c_int,
423 streams: *mut libc::c_int,
424 coupled_streams: *mut libc::c_int,
425 mapping: *mut libc::c_uchar,
426 application: libc::c_int,
427 error: *mut libc::c_int,
428 ) -> *mut OpusMSEncoder;
429}
430unsafe extern "C" {
431 pub fn opus_multistream_encoder_init(
432 st: *mut OpusMSEncoder,
433 Fs: opus_int32,
434 channels: libc::c_int,
435 streams: libc::c_int,
436 coupled_streams: libc::c_int,
437 mapping: *const libc::c_uchar,
438 application: libc::c_int,
439 ) -> libc::c_int;
440}
441unsafe extern "C" {
442 pub fn opus_multistream_surround_encoder_init(
443 st: *mut OpusMSEncoder,
444 Fs: opus_int32,
445 channels: libc::c_int,
446 mapping_family: libc::c_int,
447 streams: *mut libc::c_int,
448 coupled_streams: *mut libc::c_int,
449 mapping: *mut libc::c_uchar,
450 application: libc::c_int,
451 ) -> libc::c_int;
452}
453unsafe extern "C" {
454 pub fn opus_multistream_encode(
455 st: *mut OpusMSEncoder,
456 pcm: *const opus_int16,
457 frame_size: libc::c_int,
458 data: *mut libc::c_uchar,
459 max_data_bytes: opus_int32,
460 ) -> libc::c_int;
461}
462unsafe extern "C" {
463 pub fn opus_multistream_encode_float(
464 st: *mut OpusMSEncoder,
465 pcm: *const f32,
466 frame_size: libc::c_int,
467 data: *mut libc::c_uchar,
468 max_data_bytes: opus_int32,
469 ) -> libc::c_int;
470}
471unsafe extern "C" {
472 pub fn opus_multistream_encoder_destroy(st: *mut OpusMSEncoder);
473}
474unsafe extern "C" {
475 pub fn opus_multistream_encoder_ctl(
476 st: *mut OpusMSEncoder,
477 request: libc::c_int,
478 ...
479 ) -> libc::c_int;
480}
481unsafe extern "C" {
482 pub fn opus_multistream_decoder_get_size(
483 streams: libc::c_int,
484 coupled_streams: libc::c_int,
485 ) -> opus_int32;
486}
487unsafe extern "C" {
488 pub fn opus_multistream_decoder_create(
489 Fs: opus_int32,
490 channels: libc::c_int,
491 streams: libc::c_int,
492 coupled_streams: libc::c_int,
493 mapping: *const libc::c_uchar,
494 error: *mut libc::c_int,
495 ) -> *mut OpusMSDecoder;
496}
497unsafe extern "C" {
498 pub fn opus_multistream_decoder_init(
499 st: *mut OpusMSDecoder,
500 Fs: opus_int32,
501 channels: libc::c_int,
502 streams: libc::c_int,
503 coupled_streams: libc::c_int,
504 mapping: *const libc::c_uchar,
505 ) -> libc::c_int;
506}
507unsafe extern "C" {
508 pub fn opus_multistream_decode(
509 st: *mut OpusMSDecoder,
510 data: *const libc::c_uchar,
511 len: opus_int32,
512 pcm: *mut opus_int16,
513 frame_size: libc::c_int,
514 decode_fec: libc::c_int,
515 ) -> libc::c_int;
516}
517unsafe extern "C" {
518 pub fn opus_multistream_decode_float(
519 st: *mut OpusMSDecoder,
520 data: *const libc::c_uchar,
521 len: opus_int32,
522 pcm: *mut f32,
523 frame_size: libc::c_int,
524 decode_fec: libc::c_int,
525 ) -> libc::c_int;
526}
527unsafe extern "C" {
528 pub fn opus_multistream_decoder_ctl(
529 st: *mut OpusMSDecoder,
530 request: libc::c_int,
531 ...
532 ) -> libc::c_int;
533}
534unsafe extern "C" {
535 pub fn opus_multistream_decoder_destroy(st: *mut OpusMSDecoder);
536}