opusic_sys/
lib.rs

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
/* automatically generated by rust-bindgen 0.69.4 */


#![no_std]
#![allow(non_upper_case_globals)]
#![allow(non_camel_case_types)]
#![allow(non_snake_case)]


pub const OPUS_OK: libc::c_int = 0;
pub const OPUS_BAD_ARG: libc::c_int = -1;
pub const OPUS_BUFFER_TOO_SMALL: libc::c_int = -2;
pub const OPUS_INTERNAL_ERROR: libc::c_int = -3;
pub const OPUS_INVALID_PACKET: libc::c_int = -4;
pub const OPUS_UNIMPLEMENTED: libc::c_int = -5;
pub const OPUS_INVALID_STATE: libc::c_int = -6;
pub const OPUS_ALLOC_FAIL: libc::c_int = -7;
pub const OPUS_SET_APPLICATION_REQUEST: libc::c_int = 4000;
pub const OPUS_GET_APPLICATION_REQUEST: libc::c_int = 4001;
pub const OPUS_SET_BITRATE_REQUEST: libc::c_int = 4002;
pub const OPUS_GET_BITRATE_REQUEST: libc::c_int = 4003;
pub const OPUS_SET_MAX_BANDWIDTH_REQUEST: libc::c_int = 4004;
pub const OPUS_GET_MAX_BANDWIDTH_REQUEST: libc::c_int = 4005;
pub const OPUS_SET_VBR_REQUEST: libc::c_int = 4006;
pub const OPUS_GET_VBR_REQUEST: libc::c_int = 4007;
pub const OPUS_SET_BANDWIDTH_REQUEST: libc::c_int = 4008;
pub const OPUS_GET_BANDWIDTH_REQUEST: libc::c_int = 4009;
pub const OPUS_SET_COMPLEXITY_REQUEST: libc::c_int = 4010;
pub const OPUS_GET_COMPLEXITY_REQUEST: libc::c_int = 4011;
pub const OPUS_SET_INBAND_FEC_REQUEST: libc::c_int = 4012;
pub const OPUS_GET_INBAND_FEC_REQUEST: libc::c_int = 4013;
pub const OPUS_SET_PACKET_LOSS_PERC_REQUEST: libc::c_int = 4014;
pub const OPUS_GET_PACKET_LOSS_PERC_REQUEST: libc::c_int = 4015;
pub const OPUS_SET_DTX_REQUEST: libc::c_int = 4016;
pub const OPUS_GET_DTX_REQUEST: libc::c_int = 4017;
pub const OPUS_SET_VBR_CONSTRAINT_REQUEST: libc::c_int = 4020;
pub const OPUS_GET_VBR_CONSTRAINT_REQUEST: libc::c_int = 4021;
pub const OPUS_SET_FORCE_CHANNELS_REQUEST: libc::c_int = 4022;
pub const OPUS_GET_FORCE_CHANNELS_REQUEST: libc::c_int = 4023;
pub const OPUS_SET_SIGNAL_REQUEST: libc::c_int = 4024;
pub const OPUS_GET_SIGNAL_REQUEST: libc::c_int = 4025;
pub const OPUS_GET_LOOKAHEAD_REQUEST: libc::c_int = 4027;
pub const OPUS_GET_SAMPLE_RATE_REQUEST: libc::c_int = 4029;
pub const OPUS_GET_FINAL_RANGE_REQUEST: libc::c_int = 4031;
pub const OPUS_GET_PITCH_REQUEST: libc::c_int = 4033;
pub const OPUS_SET_GAIN_REQUEST: libc::c_int = 4034;
pub const OPUS_GET_GAIN_REQUEST: libc::c_int = 4045;
pub const OPUS_SET_LSB_DEPTH_REQUEST: libc::c_int = 4036;
pub const OPUS_GET_LSB_DEPTH_REQUEST: libc::c_int = 4037;
pub const OPUS_GET_LAST_PACKET_DURATION_REQUEST: libc::c_int = 4039;
pub const OPUS_SET_EXPERT_FRAME_DURATION_REQUEST: libc::c_int = 4040;
pub const OPUS_GET_EXPERT_FRAME_DURATION_REQUEST: libc::c_int = 4041;
pub const OPUS_SET_PREDICTION_DISABLED_REQUEST: libc::c_int = 4042;
pub const OPUS_GET_PREDICTION_DISABLED_REQUEST: libc::c_int = 4043;
pub const OPUS_SET_PHASE_INVERSION_DISABLED_REQUEST: libc::c_int = 4046;
pub const OPUS_GET_PHASE_INVERSION_DISABLED_REQUEST: libc::c_int = 4047;
pub const OPUS_GET_IN_DTX_REQUEST: libc::c_int = 4049;
pub const OPUS_SET_DRED_DURATION_REQUEST: libc::c_int = 4050;
pub const OPUS_GET_DRED_DURATION_REQUEST: libc::c_int = 4051;
pub const OPUS_SET_DNN_BLOB_REQUEST: libc::c_int = 4052;
pub const OPUS_AUTO: libc::c_int = -1000;
pub const OPUS_BITRATE_MAX: libc::c_int = -1;
pub const OPUS_APPLICATION_VOIP: libc::c_int = 2048;
pub const OPUS_APPLICATION_AUDIO: libc::c_int = 2049;
pub const OPUS_APPLICATION_RESTRICTED_LOWDELAY: libc::c_int = 2051;
pub const OPUS_SIGNAL_VOICE: libc::c_int = 3001;
pub const OPUS_SIGNAL_MUSIC: libc::c_int = 3002;
pub const OPUS_BANDWIDTH_NARROWBAND: libc::c_int = 1101;
pub const OPUS_BANDWIDTH_MEDIUMBAND: libc::c_int = 1102;
pub const OPUS_BANDWIDTH_WIDEBAND: libc::c_int = 1103;
pub const OPUS_BANDWIDTH_SUPERWIDEBAND: libc::c_int = 1104;
pub const OPUS_BANDWIDTH_FULLBAND: libc::c_int = 1105;
pub const OPUS_FRAMESIZE_ARG: libc::c_int = 5000;
pub const OPUS_FRAMESIZE_2_5_MS: libc::c_int = 5001;
pub const OPUS_FRAMESIZE_5_MS: libc::c_int = 5002;
pub const OPUS_FRAMESIZE_10_MS: libc::c_int = 5003;
pub const OPUS_FRAMESIZE_20_MS: libc::c_int = 5004;
pub const OPUS_FRAMESIZE_40_MS: libc::c_int = 5005;
pub const OPUS_FRAMESIZE_60_MS: libc::c_int = 5006;
pub const OPUS_FRAMESIZE_80_MS: libc::c_int = 5007;
pub const OPUS_FRAMESIZE_100_MS: libc::c_int = 5008;
pub const OPUS_FRAMESIZE_120_MS: libc::c_int = 5009;
pub const OPUS_RESET_STATE: libc::c_int = 4028;
pub const OPUS_MULTISTREAM_GET_ENCODER_STATE_REQUEST: libc::c_int = 5120;
pub const OPUS_MULTISTREAM_GET_DECODER_STATE_REQUEST: libc::c_int = 5122;
pub type opus_int32 = libc::c_int;
pub type opus_uint32 = libc::c_uint;
pub type opus_int16 = libc::c_short;
pub type opus_uint16 = libc::c_ushort;
extern "C" {
    pub fn opus_strerror(error: libc::c_int) -> *const libc::c_char;
}
extern "C" {
    pub fn opus_get_version_string() -> *const libc::c_char;
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct OpusEncoder {
    _unused: [u8; 0],
}
extern "C" {
    pub fn opus_encoder_get_size(channels: libc::c_int) -> libc::c_int;
}
extern "C" {
    pub fn opus_encoder_create(
        Fs: opus_int32,
        channels: libc::c_int,
        application: libc::c_int,
        error: *mut libc::c_int,
    ) -> *mut OpusEncoder;
}
extern "C" {
    pub fn opus_encoder_init(
        st: *mut OpusEncoder,
        Fs: opus_int32,
        channels: libc::c_int,
        application: libc::c_int,
    ) -> libc::c_int;
}
extern "C" {
    pub fn opus_encode(
        st: *mut OpusEncoder,
        pcm: *const opus_int16,
        frame_size: libc::c_int,
        data: *mut libc::c_uchar,
        max_data_bytes: opus_int32,
    ) -> opus_int32;
}
extern "C" {
    pub fn opus_encode_float(
        st: *mut OpusEncoder,
        pcm: *const f32,
        frame_size: libc::c_int,
        data: *mut libc::c_uchar,
        max_data_bytes: opus_int32,
    ) -> opus_int32;
}
extern "C" {
    pub fn opus_encoder_destroy(st: *mut OpusEncoder);
}
extern "C" {
    pub fn opus_encoder_ctl(st: *mut OpusEncoder, request: libc::c_int, ...) -> libc::c_int;
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct OpusDecoder {
    _unused: [u8; 0],
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct OpusDREDDecoder {
    _unused: [u8; 0],
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct OpusDRED {
    _unused: [u8; 0],
}
extern "C" {
    pub fn opus_decoder_get_size(channels: libc::c_int) -> libc::c_int;
}
extern "C" {
    pub fn opus_decoder_create(
        Fs: opus_int32,
        channels: libc::c_int,
        error: *mut libc::c_int,
    ) -> *mut OpusDecoder;
}
extern "C" {
    pub fn opus_decoder_init(
        st: *mut OpusDecoder,
        Fs: opus_int32,
        channels: libc::c_int,
    ) -> libc::c_int;
}
extern "C" {
    pub fn opus_decode(
        st: *mut OpusDecoder,
        data: *const libc::c_uchar,
        len: opus_int32,
        pcm: *mut opus_int16,
        frame_size: libc::c_int,
        decode_fec: libc::c_int,
    ) -> libc::c_int;
}
extern "C" {
    pub fn opus_decode_float(
        st: *mut OpusDecoder,
        data: *const libc::c_uchar,
        len: opus_int32,
        pcm: *mut f32,
        frame_size: libc::c_int,
        decode_fec: libc::c_int,
    ) -> libc::c_int;
}
extern "C" {
    pub fn opus_decoder_ctl(st: *mut OpusDecoder, request: libc::c_int, ...) -> libc::c_int;
}
extern "C" {
    pub fn opus_decoder_destroy(st: *mut OpusDecoder);
}
extern "C" {
    pub fn opus_dred_decoder_get_size() -> libc::c_int;
}
extern "C" {
    pub fn opus_dred_decoder_create(error: *mut libc::c_int) -> *mut OpusDREDDecoder;
}
extern "C" {
    pub fn opus_dred_decoder_init(dec: *mut OpusDREDDecoder) -> libc::c_int;
}
extern "C" {
    pub fn opus_dred_decoder_destroy(dec: *mut OpusDREDDecoder);
}
extern "C" {
    pub fn opus_dred_decoder_ctl(
        dred_dec: *mut OpusDREDDecoder,
        request: libc::c_int,
        ...
    ) -> libc::c_int;
}
extern "C" {
    pub fn opus_dred_get_size() -> libc::c_int;
}
extern "C" {
    pub fn opus_dred_alloc(error: *mut libc::c_int) -> *mut OpusDRED;
}
extern "C" {
    pub fn opus_dred_free(dec: *mut OpusDRED);
}
extern "C" {
    pub fn opus_dred_parse(
        dred_dec: *mut OpusDREDDecoder,
        dred: *mut OpusDRED,
        data: *const libc::c_uchar,
        len: opus_int32,
        max_dred_samples: opus_int32,
        sampling_rate: opus_int32,
        dred_end: *mut libc::c_int,
        defer_processing: libc::c_int,
    ) -> libc::c_int;
}
extern "C" {
    pub fn opus_dred_process(
        dred_dec: *mut OpusDREDDecoder,
        src: *const OpusDRED,
        dst: *mut OpusDRED,
    ) -> libc::c_int;
}
extern "C" {
    pub fn opus_decoder_dred_decode(
        st: *mut OpusDecoder,
        dred: *const OpusDRED,
        dred_offset: opus_int32,
        pcm: *mut opus_int16,
        frame_size: opus_int32,
    ) -> libc::c_int;
}
extern "C" {
    pub fn opus_decoder_dred_decode_float(
        st: *mut OpusDecoder,
        dred: *const OpusDRED,
        dred_offset: opus_int32,
        pcm: *mut f32,
        frame_size: opus_int32,
    ) -> libc::c_int;
}
extern "C" {
    pub fn opus_packet_parse(
        data: *const libc::c_uchar,
        len: opus_int32,
        out_toc: *mut libc::c_uchar,
        frames: *mut *const libc::c_uchar,
        size: *mut opus_int16,
        payload_offset: *mut libc::c_int,
    ) -> libc::c_int;
}
extern "C" {
    pub fn opus_packet_get_bandwidth(data: *const libc::c_uchar) -> libc::c_int;
}
extern "C" {
    pub fn opus_packet_get_samples_per_frame(
        data: *const libc::c_uchar,
        Fs: opus_int32,
    ) -> libc::c_int;
}
extern "C" {
    pub fn opus_packet_get_nb_channels(data: *const libc::c_uchar) -> libc::c_int;
}
extern "C" {
    pub fn opus_packet_get_nb_frames(packet: *const libc::c_uchar, len: opus_int32) -> libc::c_int;
}
extern "C" {
    pub fn opus_packet_get_nb_samples(
        packet: *const libc::c_uchar,
        len: opus_int32,
        Fs: opus_int32,
    ) -> libc::c_int;
}
extern "C" {
    pub fn opus_packet_has_lbrr(packet: *const libc::c_uchar, len: opus_int32) -> libc::c_int;
}
extern "C" {
    pub fn opus_decoder_get_nb_samples(
        dec: *const OpusDecoder,
        packet: *const libc::c_uchar,
        len: opus_int32,
    ) -> libc::c_int;
}
extern "C" {
    pub fn opus_pcm_soft_clip(
        pcm: *mut f32,
        frame_size: libc::c_int,
        channels: libc::c_int,
        softclip_mem: *mut f32,
    );
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct OpusRepacketizer {
    _unused: [u8; 0],
}
extern "C" {
    pub fn opus_repacketizer_get_size() -> libc::c_int;
}
extern "C" {
    pub fn opus_repacketizer_init(rp: *mut OpusRepacketizer) -> *mut OpusRepacketizer;
}
extern "C" {
    pub fn opus_repacketizer_create() -> *mut OpusRepacketizer;
}
extern "C" {
    pub fn opus_repacketizer_destroy(rp: *mut OpusRepacketizer);
}
extern "C" {
    pub fn opus_repacketizer_cat(
        rp: *mut OpusRepacketizer,
        data: *const libc::c_uchar,
        len: opus_int32,
    ) -> libc::c_int;
}
extern "C" {
    pub fn opus_repacketizer_out_range(
        rp: *mut OpusRepacketizer,
        begin: libc::c_int,
        end: libc::c_int,
        data: *mut libc::c_uchar,
        maxlen: opus_int32,
    ) -> opus_int32;
}
extern "C" {
    pub fn opus_repacketizer_get_nb_frames(rp: *mut OpusRepacketizer) -> libc::c_int;
}
extern "C" {
    pub fn opus_repacketizer_out(
        rp: *mut OpusRepacketizer,
        data: *mut libc::c_uchar,
        maxlen: opus_int32,
    ) -> opus_int32;
}
extern "C" {
    pub fn opus_packet_pad(
        data: *mut libc::c_uchar,
        len: opus_int32,
        new_len: opus_int32,
    ) -> libc::c_int;
}
extern "C" {
    pub fn opus_packet_unpad(data: *mut libc::c_uchar, len: opus_int32) -> opus_int32;
}
extern "C" {
    pub fn opus_multistream_packet_pad(
        data: *mut libc::c_uchar,
        len: opus_int32,
        new_len: opus_int32,
        nb_streams: libc::c_int,
    ) -> libc::c_int;
}
extern "C" {
    pub fn opus_multistream_packet_unpad(
        data: *mut libc::c_uchar,
        len: opus_int32,
        nb_streams: libc::c_int,
    ) -> opus_int32;
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct OpusMSEncoder {
    _unused: [u8; 0],
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct OpusMSDecoder {
    _unused: [u8; 0],
}
extern "C" {
    pub fn opus_multistream_encoder_get_size(
        streams: libc::c_int,
        coupled_streams: libc::c_int,
    ) -> opus_int32;
}
extern "C" {
    pub fn opus_multistream_surround_encoder_get_size(
        channels: libc::c_int,
        mapping_family: libc::c_int,
    ) -> opus_int32;
}
extern "C" {
    pub fn opus_multistream_encoder_create(
        Fs: opus_int32,
        channels: libc::c_int,
        streams: libc::c_int,
        coupled_streams: libc::c_int,
        mapping: *const libc::c_uchar,
        application: libc::c_int,
        error: *mut libc::c_int,
    ) -> *mut OpusMSEncoder;
}
extern "C" {
    pub fn opus_multistream_surround_encoder_create(
        Fs: opus_int32,
        channels: libc::c_int,
        mapping_family: libc::c_int,
        streams: *mut libc::c_int,
        coupled_streams: *mut libc::c_int,
        mapping: *mut libc::c_uchar,
        application: libc::c_int,
        error: *mut libc::c_int,
    ) -> *mut OpusMSEncoder;
}
extern "C" {
    pub fn opus_multistream_encoder_init(
        st: *mut OpusMSEncoder,
        Fs: opus_int32,
        channels: libc::c_int,
        streams: libc::c_int,
        coupled_streams: libc::c_int,
        mapping: *const libc::c_uchar,
        application: libc::c_int,
    ) -> libc::c_int;
}
extern "C" {
    pub fn opus_multistream_surround_encoder_init(
        st: *mut OpusMSEncoder,
        Fs: opus_int32,
        channels: libc::c_int,
        mapping_family: libc::c_int,
        streams: *mut libc::c_int,
        coupled_streams: *mut libc::c_int,
        mapping: *mut libc::c_uchar,
        application: libc::c_int,
    ) -> libc::c_int;
}
extern "C" {
    pub fn opus_multistream_encode(
        st: *mut OpusMSEncoder,
        pcm: *const opus_int16,
        frame_size: libc::c_int,
        data: *mut libc::c_uchar,
        max_data_bytes: opus_int32,
    ) -> libc::c_int;
}
extern "C" {
    pub fn opus_multistream_encode_float(
        st: *mut OpusMSEncoder,
        pcm: *const f32,
        frame_size: libc::c_int,
        data: *mut libc::c_uchar,
        max_data_bytes: opus_int32,
    ) -> libc::c_int;
}
extern "C" {
    pub fn opus_multistream_encoder_destroy(st: *mut OpusMSEncoder);
}
extern "C" {
    pub fn opus_multistream_encoder_ctl(
        st: *mut OpusMSEncoder,
        request: libc::c_int,
        ...
    ) -> libc::c_int;
}
extern "C" {
    pub fn opus_multistream_decoder_get_size(
        streams: libc::c_int,
        coupled_streams: libc::c_int,
    ) -> opus_int32;
}
extern "C" {
    pub fn opus_multistream_decoder_create(
        Fs: opus_int32,
        channels: libc::c_int,
        streams: libc::c_int,
        coupled_streams: libc::c_int,
        mapping: *const libc::c_uchar,
        error: *mut libc::c_int,
    ) -> *mut OpusMSDecoder;
}
extern "C" {
    pub fn opus_multistream_decoder_init(
        st: *mut OpusMSDecoder,
        Fs: opus_int32,
        channels: libc::c_int,
        streams: libc::c_int,
        coupled_streams: libc::c_int,
        mapping: *const libc::c_uchar,
    ) -> libc::c_int;
}
extern "C" {
    pub fn opus_multistream_decode(
        st: *mut OpusMSDecoder,
        data: *const libc::c_uchar,
        len: opus_int32,
        pcm: *mut opus_int16,
        frame_size: libc::c_int,
        decode_fec: libc::c_int,
    ) -> libc::c_int;
}
extern "C" {
    pub fn opus_multistream_decode_float(
        st: *mut OpusMSDecoder,
        data: *const libc::c_uchar,
        len: opus_int32,
        pcm: *mut f32,
        frame_size: libc::c_int,
        decode_fec: libc::c_int,
    ) -> libc::c_int;
}
extern "C" {
    pub fn opus_multistream_decoder_ctl(
        st: *mut OpusMSDecoder,
        request: libc::c_int,
        ...
    ) -> libc::c_int;
}
extern "C" {
    pub fn opus_multistream_decoder_destroy(st: *mut OpusMSDecoder);
}