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
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
//! Bindings to [mpg123][1].
//!
//! [1]: https://www.mpg123.de/

#![allow(non_camel_case_types)]

#[macro_use]
extern crate bitflags;
extern crate libc;

use libc::{c_char, c_double, c_int, c_long, c_uchar, c_ulong, c_void, off_t, size_t, ssize_t};

#[derive(Clone, Copy)]
#[repr(C)]
pub enum mpg123_channelcount {
    MPG123_MONO = 1,
    MPG123_STEREO = 2,
}
pub use mpg123_channelcount::*;

bitflags! {
    #[repr(C)]
    pub struct mpg123_channels: c_int {
        const MPG123_LEFT  = 0x1;
        const MPG123_RIGHT = 0x2;
        const MPG123_LR    = 0x3;
    }
}

bitflags! {
    #[repr(C)]
    pub struct mpg123_enc_enum: c_int {
        const MPG123_ENC_8           = 0x000f;
        const MPG123_ENC_16          = 0x0040;
        const MPG123_ENC_24          = 0x4000;
        const MPG123_ENC_32          = 0x0100;
        const MPG123_ENC_SIGNED      = 0x0080;
        const MPG123_ENC_FLOAT       = 0x0e00;
        const MPG123_ENC_SIGNED_16   = Self::MPG123_ENC_16.bits
                                     | Self::MPG123_ENC_SIGNED.bits
                                     | 0x0010;
        const MPG123_ENC_UNSIGNED_16 = Self::MPG123_ENC_16.bits
                                     | 0x0020;
        const MPG123_ENC_UNSIGNED_8  = 0x0001;
        const MPG123_ENC_SIGNED_8    = Self::MPG123_ENC_SIGNED.bits
                                     | 0x0002;
        const MPG123_ENC_ULAW_8      = 0x0004;
        const MPG123_ENC_ALAW_8      = 0x0008;
        const MPG123_ENC_SIGNED_32   = Self::MPG123_ENC_32.bits
                                     | Self::MPG123_ENC_SIGNED.bits
                                     | 0x1000;
        const MPG123_ENC_UNSIGNED_32 = Self::MPG123_ENC_32.bits
                                     | 0x2000;
        const MPG123_ENC_SIGNED_24   = Self::MPG123_ENC_24.bits
                                     | Self::MPG123_ENC_SIGNED.bits
                                     | 0x1000;
        const MPG123_ENC_UNSIGNED_24 = Self::MPG123_ENC_24.bits
                                     | 0x2000;
        const MPG123_ENC_FLOAT_32    = 0x0200;
        const MPG123_ENC_FLOAT_64    = 0x0400;
        const MPG123_ENC_ANY         = Self::MPG123_ENC_SIGNED_8.bits
                                     | Self::MPG123_ENC_SIGNED_16.bits
                                     | Self::MPG123_ENC_SIGNED_24.bits
                                     | Self::MPG123_ENC_SIGNED_32.bits
                                     | Self::MPG123_ENC_UNSIGNED_8.bits
                                     | Self::MPG123_ENC_UNSIGNED_16.bits
                                     | Self::MPG123_ENC_UNSIGNED_24.bits
                                     | Self::MPG123_ENC_UNSIGNED_32.bits
                                     | Self::MPG123_ENC_ALAW_8.bits
                                     | Self::MPG123_ENC_ULAW_8.bits
                                     | Self::MPG123_ENC_FLOAT_32.bits
                                     | Self::MPG123_ENC_FLOAT_64.bits;
    }
}

#[derive(Clone, Copy)]
#[repr(C)]
pub enum mpg123_errors {
    MPG123_DONE = -12,
    MPG123_NEW_FORMAT = -11,
    MPG123_NEED_MORE = -10,
    MPG123_ERR = -1,
    MPG123_OK = 0,
    MPG123_BAD_OUTFORMAT,
    MPG123_BAD_CHANNEL,
    MPG123_BAD_RATE,
    MPG123_ERR_16TO8TABLE,
    MPG123_BAD_PARAM,
    MPG123_BAD_BUFFER,
    MPG123_OUT_OF_MEM,
    MPG123_NOT_INITIALIZED,
    MPG123_BAD_DECODER,
    MPG123_BAD_HANDLE,
    MPG123_NO_BUFFERS,
    MPG123_BAD_RVA,
    MPG123_NO_GAPLESS,
    MPG123_NO_SPACE,
    MPG123_BAD_TYPES,
    MPG123_BAD_BAND,
    MPG123_ERR_NULL,
    MPG123_ERR_READER,
    MPG123_NO_SEEK_FROM_END,
    MPG123_BAD_WHENCE,
    MPG123_NO_TIMEOUT,
    MPG123_BAD_FILE,
    MPG123_NO_SEEK,
    MPG123_NO_READER,
    MPG123_BAD_PARS,
    MPG123_BAD_INDEX_PAR,
    MPG123_OUT_OF_SYNC,
    MPG123_RESYNC_FAIL,
    MPG123_NO_8BIT,
    MPG123_BAD_ALIGN,
    MPG123_NULL_BUFFER,
    MPG123_NO_RELSEEK,
    MPG123_NULL_POINTER,
    MPG123_BAD_KEY,
    MPG123_NO_INDEX,
    MPG123_INDEX_FAIL,
    MPG123_BAD_DECODER_SETUP,
    MPG123_MISSING_FEATURE,
    MPG123_BAD_VALUE,
    MPG123_LSEEK_FAILED,
    MPG123_BAD_CUSTOM_IO,
    MPG123_LFS_OVERFLOW,
    MPG123_INT_OVERFLOW,
}
pub use mpg123_errors::*;

#[derive(Clone, Copy)]
#[repr(C)]
pub enum mpg123_feature_set {
    MPG123_FEATURE_ABI_UTF8OPEN = 0,
    MPG123_FEATURE_OUTPUT_8BIT,
    MPG123_FEATURE_OUTPUT_16BIT,
    MPG123_FEATURE_OUTPUT_32BIT,
    MPG123_FEATURE_INDEX,
    MPG123_FEATURE_PARSE_ID3V2,
    MPG123_FEATURE_DECODE_LAYER1,
    MPG123_FEATURE_DECODE_LAYER2,
    MPG123_FEATURE_DECODE_LAYER3,
    MPG123_FEATURE_DECODE_ACCURATE,
    MPG123_FEATURE_DECODE_DOWNSAMPLE,
    MPG123_FEATURE_DECODE_NTOM,
    MPG123_FEATURE_PARSE_ICY,
    MPG123_FEATURE_TIMEOUT_READ,
    MPG123_FEATURE_EQUALIZER,
}
pub use mpg123_feature_set::*;

bitflags! {
    #[repr(C)]
    pub struct mpg123_flags: c_int {
        const MPG123_CRC       = 0x1;
        const MPG123_COPYRIGHT = 0x2;
        const MPG123_PRIVATE   = 0x4;
        const MPG123_ORIGINAL  = 0x8;
    }
}

#[derive(Clone, Copy)]
#[repr(C)]
pub struct mpg123_fmt {
    pub rate: c_long,
    pub channels: c_int,
    pub encoding: c_int,
}

#[derive(Clone, Copy)]
#[repr(C)]
pub struct mpg123_frameinfo {
    pub version: mpg123_version,
    pub layer: c_int,
    pub rate: c_long,
    pub mode: mpg123_mode,
    pub mode_ext: c_int,
    pub framesize: c_int,
    pub flags: mpg123_flags,
    pub emphasis: c_int,
    pub bitrate: c_int,
    pub abr_rate: c_int,
    pub vbr: mpg123_vbr,
}

pub enum mpg123_handle {}

#[derive(Clone, Copy)]
#[repr(C)]
pub enum mpg123_id3_enc {
    mpg123_id3_latin1 = 0,
    mpg123_id3_utf16bom = 1,
    mpg123_id3_utf16be = 2,
    mpg123_id3_utf8 = 3,
}
pub use mpg123_id3_enc::*;

#[derive(Clone, Copy)]
#[repr(C)]
pub enum mpg123_id3_pic_type {
    mpg123_id3_pic_other = 0,
    mpg123_id3_pic_icon = 1,
    mpg123_id3_pic_other_icon = 2,
    mpg123_id3_pic_front_cover = 3,
    mpg123_id3_pic_back_cover = 4,
    mpg123_id3_pic_leaflet = 5,
    mpg123_id3_pic_media = 6,
    mpg123_id3_pic_lead = 7,
    mpg123_id3_pic_artist = 8,
    mpg123_id3_pic_conductor = 9,
    mpg123_id3_pic_orchestra = 10,
    mpg123_id3_pic_composer = 11,
    mpg123_id3_pic_lyricist = 12,
    mpg123_id3_pic_location = 13,
    mpg123_id3_pic_recording = 14,
    mpg123_id3_pic_performance = 15,
    mpg123_id3_pic_video = 16,
    mpg123_id3_pic_fish = 17,
    mpg123_id3_pic_illustration = 18,
    mpg123_id3_pic_artist_logo = 19,
    mpg123_id3_pic_publisher_logo = 20,
}
pub use mpg123_id3_pic_type::*;

#[derive(Clone, Copy)]
#[repr(C)]
pub struct mpg123_id3v1 {
    pub tag: [c_char; 3],
    pub title: [c_char; 30],
    pub artist: [c_char; 30],
    pub album: [c_char; 30],
    pub year: [c_char; 4],
    pub comment: [c_char; 30],
    pub genre: c_uchar,
}

#[derive(Clone, Copy)]
#[repr(C)]
pub struct mpg123_id3v2 {
    pub version: c_uchar,
    pub title: *mut mpg123_string,
    pub artist: *mut mpg123_string,
    pub album: *mut mpg123_string,
    pub year: *mut mpg123_string,
    pub genre: *mut mpg123_string,
    pub comment: *mut mpg123_string,
    pub comment_list: *mut mpg123_text,
    pub comments: size_t,
    pub text: *mut mpg123_text,
    pub texts: size_t,
    pub extra: *mut mpg123_text,
    pub extras: size_t,
    pub picture: *mut mpg123_picture,
    pub pictures: size_t,
}

#[derive(Clone, Copy)]
#[repr(C)]
pub enum mpg123_mode {
    MPG123_M_STEREO = 0,
    MPG123_M_JOINT,
    MPG123_M_DUAL,
    MPG123_M_MONO,
}
pub use mpg123_mode::*;

pub enum mpg123_pars {}

#[derive(Clone, Copy)]
#[repr(C)]
pub enum mpg123_parms {
    MPG123_VERBOSE = 0,
    MPG123_FLAGS,
    MPG123_ADD_FLAGS,
    MPG123_FORCE_RATE,
    MPG123_DOWN_SAMPLE,
    MPG123_RVA,
    MPG123_DOWNSPEED,
    MPG123_UPSPEED,
    MPG123_START_FRAME,
    MPG123_DECODE_FRAMES,
    MPG123_ICY_INTERVAL,
    MPG123_OUTSCALE,
    MPG123_TIMEOUT,
    MPG123_REMOVE_FLAGS,
    MPG123_RESYNC_LIMIT,
    MPG123_INDEX_SIZE,
    MPG123_PREFRAMES,
    MPG123_FEEDPOOL,
    MPG123_FEEDBUFFER,
}
pub use mpg123_parms::*;

bitflags! {
    #[repr(C)]
    pub struct mpg123_param_flags: c_int {
        const MPG123_FORCE_MONO          = 0x00007;
        const MPG123_MONO_LEFT           = 0x00001;
        const MPG123_MONO_RIGHT          = 0x00002;
        const MPG123_MONO_MIX            = 0x00004;
        const MPG123_FORCE_STEREO        = 0x00008;
        const MPG123_FORCE_8BIT          = 0x00010;
        const MPG123_QUIET               = 0x00020;
        const MPG123_GAPLESS             = 0x00040;
        const MPG123_NO_RESYNC           = 0x00080;
        const MPG123_SEEKBUFFER          = 0x00100;
        const MPG123_FUZZY               = 0x00200;
        const MPG123_FORCE_FLOAT         = 0x00400;
        const MPG123_PLAIN_ID3TEXT       = 0x00800;
        const MPG123_IGNORE_STREAMLENGTH = 0x01000;
        const MPG123_SKIP_ID3V2          = 0x02000;
        const MPG123_IGNORE_INFOFRAME    = 0x04000;
        const MPG123_AUTO_RESAMPLE       = 0x08000;
        const MPG123_PICTURE             = 0x10000;
    }
}

#[derive(Clone, Copy)]
#[repr(C)]
pub enum mpg123_param_rva {
    MPG123_RVA_OFF = 0,
    MPG123_RVA_MIX = 1,
    MPG123_RVA_ALBUM = 2,
}
pub use mpg123_param_rva::*;

#[derive(Clone, Copy)]
#[repr(C)]
pub struct mpg123_picture {
    pub _type: c_char,
    pub description: mpg123_string,
    pub mime_type: mpg123_string,
    pub size: size_t,
    pub data: *mut c_uchar,
}

#[derive(Clone, Copy)]
#[repr(C)]
pub enum mpg123_state {
    MPG123_ACCURATE = 1,
    MPG123_BUFFERFILL,
    MPG123_FRANKENSTEIN,
    MPG123_FRESH_DECODER,
}
pub use mpg123_state::*;

#[derive(Clone, Copy)]
#[repr(C)]
pub struct mpg123_string {
    pub p: *mut c_char,
    pub size: size_t,
    pub fill: size_t,
}

#[derive(Clone, Copy)]
#[repr(C)]
pub struct mpg123_text {
    pub lang: [c_char; 3],
    pub id: [c_char; 4],
    pub description: mpg123_string,
    pub text: mpg123_string,
}

#[derive(Clone, Copy)]
#[repr(C)]
pub enum mpg123_text_encoding {
    mpg123_text_unknown = 0,
    mpg123_text_utf8 = 1,
    mpg123_text_latin1 = 2,
    mpg123_text_icy = 3,
    mpg123_text_cp1252 = 4,
    mpg123_text_utf16 = 5,
    mpg123_text_utf16bom = 6,
    mpg123_text_utf16be = 7,
}
pub use mpg123_text_encoding::*;

#[derive(Clone, Copy)]
#[repr(C)]
pub enum mpg123_vbr {
    MPG123_CBR = 0,
    MPG123_VBR,
    MPG123_ABR,
}
pub use mpg123_vbr::*;

#[derive(Clone, Copy)]
#[repr(C)]
pub enum mpg123_version {
    MPG123_1_0 = 0,
    MPG123_2_0,
    MPG123_2_5,
}
pub use mpg123_version::*;

extern "C" {
    pub fn mpg123_init() -> c_int;
    pub fn mpg123_exit();
    pub fn mpg123_new(decoder: *const c_char, error: *mut c_int) -> *mut mpg123_handle;
    pub fn mpg123_delete(mh: *mut mpg123_handle);
    pub fn mpg123_param(
        mh: *mut mpg123_handle,
        _type: mpg123_parms,
        value: c_long,
        fvalue: c_double,
    ) -> c_int;
    pub fn mpg123_getparam(
        mh: *mut mpg123_handle,
        _type: mpg123_parms,
        value: *mut c_long,
        fvalue: *mut c_double,
    ) -> c_int;
    pub fn mpg123_feature(key: mpg123_feature_set) -> c_int;
    pub fn mpg123_plain_strerror(errcode: c_int) -> *const c_char;
    pub fn mpg123_strerror(mh: *mut mpg123_handle) -> *const c_char;
    pub fn mpg123_errcode(mh: *mut mpg123_handle) -> c_int;
    pub fn mpg123_decoders() -> *mut *const c_char;
    pub fn mpg123_supported_decoders() -> *mut *const c_char;
    pub fn mpg123_decoder(mh: *mut mpg123_handle, decoder_name: *const c_char) -> c_int;
    pub fn mpg123_current_decoder(mh: *mut mpg123_handle) -> *const c_char;
    pub fn mpg123_rates(list: *mut *const c_long, number: *mut size_t);
    pub fn mpg123_encodings(list: *mut *const c_int, number: *mut size_t);
    pub fn mpg123_encsize(encoding: c_int) -> c_int;
    pub fn mpg123_format_none(mh: *mut mpg123_handle) -> c_int;
    pub fn mpg123_format_all(mh: *mut mpg123_handle) -> c_int;
    pub fn mpg123_format(
        mh: *mut mpg123_handle,
        rate: c_long,
        channels: c_int,
        encodings: c_int,
    ) -> c_int;
    pub fn mpg123_format_support(mh: *mut mpg123_handle, rate: c_long, encoding: c_int) -> c_int;
    pub fn mpg123_getformat(
        mh: *mut mpg123_handle,
        rate: *mut c_long,
        channels: *mut c_int,
        encoding: *mut c_int,
    ) -> c_int;
    pub fn mpg123_open(mh: *mut mpg123_handle, path: *const c_char) -> c_int;
    pub fn mpg123_open_fd(mh: *mut mpg123_handle, fd: c_int) -> c_int;
    pub fn mpg123_open_handle(mh: *mut mpg123_handle, iohandle: *mut c_void) -> c_int;
    pub fn mpg123_open_feed(mh: *mut mpg123_handle) -> c_int;
    pub fn mpg123_close(mh: *mut mpg123_handle) -> c_int;
    pub fn mpg123_read(
        mh: *mut mpg123_handle,
        outmemory: *mut c_uchar,
        outmemsize: size_t,
        done: *mut size_t,
    ) -> c_int;
    pub fn mpg123_feed(mh: *mut mpg123_handle, _in: *const c_uchar, size: size_t) -> c_int;
    pub fn mpg123_decode(
        mh: *mut mpg123_handle,
        inmemory: *const c_uchar,
        inmemsize: size_t,
        outmemory: *mut c_uchar,
        outmemsize: size_t,
        done: *mut size_t,
    ) -> c_int;
    pub fn mpg123_decode_frame(
        mh: *mut mpg123_handle,
        num: *mut off_t,
        audio: *mut *mut c_uchar,
        bytes: *mut size_t,
    ) -> c_int;
    pub fn mpg123_framebyframe_decode(
        mh: *mut mpg123_handle,
        num: *mut off_t,
        audio: *mut *mut c_uchar,
        bytes: *mut size_t,
    ) -> c_int;
    pub fn mpg123_framebyframe_next(mh: *mut mpg123_handle) -> c_int;
    pub fn mpg123_framedata(
        mh: *mut mpg123_handle,
        header: *mut c_ulong,
        bodydata: *mut *mut c_uchar,
        bodybytes: *mut size_t,
    ) -> c_int;
    pub fn mpg123_framepos(mh: *mut mpg123_handle) -> off_t;
    pub fn mpg123_tell(mh: *mut mpg123_handle) -> off_t;
    pub fn mpg123_tellframe(mh: *mut mpg123_handle) -> off_t;
    pub fn mpg123_tell_stream(mh: *mut mpg123_handle) -> off_t;
    pub fn mpg123_seek(mh: *mut mpg123_handle, sampleoff: off_t, whence: c_int) -> off_t;
    pub fn mpg123_feedseek(
        mh: *mut mpg123_handle,
        sampleoff: off_t,
        whence: c_int,
        input_offset: *mut off_t,
    ) -> off_t;
    pub fn mpg123_seek_frame(mh: *mut mpg123_handle, frameoff: off_t, whence: c_int) -> off_t;
    pub fn mpg123_timeframe(mh: *mut mpg123_handle, sec: c_double) -> off_t;
    pub fn mpg123_index(
        mh: *mut mpg123_handle,
        offsets: *mut *mut off_t,
        step: *mut off_t,
        fill: *mut size_t,
    ) -> c_int;
    pub fn mpg123_set_index(
        mh: *mut mpg123_handle,
        offsets: *mut off_t,
        step: off_t,
        fill: size_t,
    ) -> c_int;
    pub fn mpg123_position(
        mh: *mut mpg123_handle,
        frame_offset: off_t,
        buffered_bytes: off_t,
        current_frame: *mut off_t,
        frames_left: *mut off_t,
        current_seconds: *mut c_double,
        seconds_left: *mut c_double,
    ) -> c_int;
    pub fn mpg123_eq(
        mh: *mut mpg123_handle,
        channel: mpg123_channels,
        band: c_int,
        val: c_double,
    ) -> c_int;
    pub fn mpg123_geteq(mh: *mut mpg123_handle, channel: mpg123_channels, band: c_int) -> c_double;
    pub fn mpg123_reset_eq(mh: *mut mpg123_handle) -> c_int;
    pub fn mpg123_volume(mh: *mut mpg123_handle, vol: c_double) -> c_int;
    pub fn mpg123_volume_change(mh: *mut mpg123_handle, change: c_double) -> c_int;
    pub fn mpg123_getvolume(
        mh: *mut mpg123_handle,
        base: *mut c_double,
        really: *mut c_double,
        rva_db: *mut c_double,
    ) -> c_int;
    pub fn mpg123_info(mh: *mut mpg123_handle, mi: *mut mpg123_frameinfo) -> c_int;
    pub fn mpg123_safe_buffer() -> size_t;
    pub fn mpg123_scan(mh: *mut mpg123_handle) -> c_int;
    pub fn mpg123_framelength(mh: *mut mpg123_handle) -> off_t;
    pub fn mpg123_length(mh: *mut mpg123_handle) -> off_t;
    pub fn mpg123_set_filesize(mh: *mut mpg123_handle, size: off_t) -> c_int;
    pub fn mpg123_tpf(mh: *mut mpg123_handle) -> c_double;
    pub fn mpg123_spf(mh: *mut mpg123_handle) -> c_int;
    pub fn mpg123_clip(mh: *mut mpg123_handle) -> c_long;
    pub fn mpg123_getstate(
        mh: *mut mpg123_handle,
        key: mpg123_state,
        val: *mut c_long,
        fval: *mut c_double,
    ) -> c_int;
    pub fn mpg123_init_string(sb: *mut mpg123_string);
    pub fn mpg123_free_string(sb: *mut mpg123_string);
    pub fn mpg123_resize_string(sb: *mut mpg123_string, news: size_t) -> c_int;
    pub fn mpg123_grow_string(sb: *mut mpg123_string, news: size_t) -> c_int;
    pub fn mpg123_copy_string(from: *mut mpg123_string, to: *mut mpg123_string) -> c_int;
    pub fn mpg123_add_string(sb: *mut mpg123_string, stuff: *const c_char) -> c_int;
    pub fn mpg123_add_substring(
        sb: *mut mpg123_string,
        stuff: *const c_char,
        from: size_t,
        count: size_t,
    ) -> c_int;
    pub fn mpg123_set_string(sb: *mut mpg123_string, stuff: *const c_char) -> c_int;
    pub fn mpg123_set_substring(
        sb: *mut mpg123_string,
        stuff: *const c_char,
        from: size_t,
        count: size_t,
    ) -> c_int;
    pub fn mpg123_strlen(sb: *mut mpg123_string, utf8: c_int) -> size_t;
    pub fn mpg123_chomp_string(sb: *mut mpg123_string) -> c_int;
    pub fn mpg123_enc_from_id3(id3_enc_byte: c_uchar) -> mpg123_text_encoding;
    pub fn mpg123_store_utf8(
        sb: *mut mpg123_string,
        enc: mpg123_text_encoding,
        source: *const c_uchar,
        source_size: size_t,
    ) -> c_int;
    pub fn mpg123_meta_check(mh: *mut mpg123_handle) -> c_int;
    pub fn mpg123_meta_free(mh: *mut mpg123_handle);
    pub fn mpg123_id3(
        mh: *mut mpg123_handle,
        v1: *mut *mut mpg123_id3v1,
        v2: *mut *mut mpg123_id3v2,
    ) -> c_int;
    pub fn mpg123_icy(mh: *mut mpg123_handle, icy_meta: *mut *mut c_char) -> c_int;
    pub fn mpg123_icy2utf8(icy_text: *const c_char) -> *mut c_char;
    pub fn mpg123_parnew(
        mp: *mut mpg123_pars,
        decoder: *const c_char,
        error: *mut c_int,
    ) -> *mut mpg123_handle;
    pub fn mpg123_new_pars(error: *mut c_int) -> *mut mpg123_pars;
    pub fn mpg123_delete_pars(mp: *mut mpg123_pars);
    pub fn mpg123_fmt_none(mp: *mut mpg123_pars) -> c_int;
    pub fn mpg123_fmt_all(mp: *mut mpg123_pars) -> c_int;
    pub fn mpg123_fmt(
        mp: *mut mpg123_pars,
        rate: c_long,
        channels: c_int,
        encodings: c_int,
    ) -> c_int;
    pub fn mpg123_fmt_support(mp: *mut mpg123_pars, rate: c_long, encoding: c_int) -> c_int;
    pub fn mpg123_par(
        mp: *mut mpg123_pars,
        _type: mpg123_parms,
        value: c_long,
        fvalue: c_double,
    ) -> c_int;
    pub fn mpg123_getpar(
        mp: *mut mpg123_pars,
        _type: mpg123_parms,
        value: *mut c_long,
        fvalue: *mut c_double,
    ) -> c_int;
    pub fn mpg123_replace_buffer(mh: *mut mpg123_handle, data: *mut c_uchar, size: size_t)
        -> c_int;
    pub fn mpg123_outblock(mh: *mut mpg123_handle) -> size_t;
    pub fn mpg123_replace_reader(
        mh: *mut mpg123_handle,
        r_read: unsafe extern "C" fn(c_int, *mut c_void, size_t) -> ssize_t,
        r_lseek: unsafe extern "C" fn(c_int, off_t, c_int) -> off_t,
    ) -> c_int;
    pub fn mpg123_replace_reader_handle(
        mh: *mut mpg123_handle,
        r_read: unsafe extern "C" fn(*mut c_void, *mut c_void, size_t) -> ssize_t,
        r_lseek: unsafe extern "C" fn(*mut c_void, off_t, c_int) -> off_t,
        cleanup: unsafe extern "C" fn(*mut c_void),
    ) -> c_int;
}