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
/* automatically generated by rust-bindgen 0.54.1 */

pub const MINIMP3_MAX_SAMPLES_PER_FRAME: usize = 2304;
pub const MP3D_SEEK_TO_BYTE: libc::c_int = 0;
pub const MP3D_SEEK_TO_SAMPLE: libc::c_int = 1;
pub const MP3D_DO_NOT_SCAN: libc::c_int = 2;
pub const MINIMP3_IO_SIZE: usize = 131072;
pub const MINIMP3_BUF_SIZE: usize = 16384;
pub const MP3D_E_PARAM: libc::c_int = -1;
pub const MP3D_E_MEMORY: libc::c_int = -2;
pub const MP3D_E_IOERROR: libc::c_int = -3;
pub const MP3D_E_USER: libc::c_int = -4;
pub const MP3D_E_DECODE: libc::c_int = -5;
pub type wchar_t = libc::c_int;
#[repr(C)]
#[derive(Debug)]
pub struct mp3dec_frame_info_t {
    pub frame_bytes: libc::c_int,
    pub frame_offset: libc::c_int,
    pub channels: libc::c_int,
    pub hz: libc::c_int,
    pub layer: libc::c_int,
    pub bitrate_kbps: libc::c_int,
}
#[repr(C)]
pub struct mp3dec_t {
    pub mdct_overlap: [[f32; 288usize]; 2usize],
    pub qmf_state: [f32; 960usize],
    pub reserv: libc::c_int,
    pub free_format_bytes: libc::c_int,
    pub header: [libc::c_uchar; 4usize],
    pub reserv_buf: [libc::c_uchar; 511usize],
}
extern "C" {
    pub fn mp3dec_init(dec: *mut mp3dec_t);
}
extern "C" {
    pub fn mp3dec_f32_to_s16(in_: *const f32, out: *mut i16, num_samples: libc::c_int);
}
extern "C" {
    pub fn mp3dec_decode_frame(
        dec: *mut mp3dec_t,
        mp3: *const u8,
        mp3_bytes: libc::c_int,
        pcm: *mut mp3d_sample_t,
        info: *mut mp3dec_frame_info_t,
    ) -> libc::c_int;
}
#[repr(C)]
#[derive(Debug)]
pub struct mp3dec_file_info_t {
    pub buffer: *mut mp3d_sample_t,
    pub samples: usize,
    pub channels: libc::c_int,
    pub hz: libc::c_int,
    pub layer: libc::c_int,
    pub avg_bitrate_kbps: libc::c_int,
}
#[repr(C)]
#[derive(Debug)]
pub struct mp3dec_map_info_t {
    pub buffer: *const u8,
    pub size: usize,
}
#[repr(C)]
pub struct mp3dec_frame_t {
    pub sample: u64,
    pub offset: u64,
}
#[repr(C)]
#[derive(Debug)]
pub struct mp3dec_index_t {
    pub frames: *mut mp3dec_frame_t,
    pub num_frames: usize,
    pub capacity: usize,
}
pub type MP3D_READ_CB = ::core::option::Option<
    unsafe extern "C" fn(
        buf: *mut libc::c_void,
        size: usize,
        user_data: *mut libc::c_void,
    ) -> usize,
>;
pub type MP3D_SEEK_CB = ::core::option::Option<
    unsafe extern "C" fn(position: u64, user_data: *mut libc::c_void) -> libc::c_int,
>;
#[repr(C)]
#[derive(Debug)]
pub struct mp3dec_io_t {
    pub read: MP3D_READ_CB,
    pub read_data: *mut libc::c_void,
    pub seek: MP3D_SEEK_CB,
    pub seek_data: *mut libc::c_void,
}
#[repr(C)]
pub struct mp3dec_ex_t {
    pub mp3d: mp3dec_t,
    pub file: mp3dec_map_info_t,
    pub io: *mut mp3dec_io_t,
    pub index: mp3dec_index_t,
    pub offset: u64,
    pub samples: u64,
    pub detected_samples: u64,
    pub cur_sample: u64,
    pub start_offset: u64,
    pub end_offset: u64,
    pub info: mp3dec_frame_info_t,
    pub buffer: [mp3d_sample_t; 2304usize],
    pub input_consumed: usize,
    pub input_filled: usize,
    pub is_file: libc::c_int,
    pub flags: libc::c_int,
    pub vbr_tag_found: libc::c_int,
    pub indexes_built: libc::c_int,
    pub free_format_bytes: libc::c_int,
    pub buffer_samples: libc::c_int,
    pub buffer_consumed: libc::c_int,
    pub to_skip: libc::c_int,
    pub start_delay: libc::c_int,
    pub last_error: libc::c_int,
}
pub type MP3D_ITERATE_CB = ::core::option::Option<
    unsafe extern "C" fn(
        user_data: *mut libc::c_void,
        frame: *const u8,
        frame_size: libc::c_int,
        free_format_bytes: libc::c_int,
        buf_size: usize,
        offset: u64,
        info: *mut mp3dec_frame_info_t,
    ) -> libc::c_int,
>;
pub type MP3D_PROGRESS_CB = ::core::option::Option<
    unsafe extern "C" fn(
        user_data: *mut libc::c_void,
        file_size: usize,
        offset: u64,
        info: *mut mp3dec_frame_info_t,
    ) -> libc::c_int,
>;
extern "C" {
    pub fn mp3dec_detect_buf(buf: *const u8, buf_size: usize) -> libc::c_int;
}
extern "C" {
    pub fn mp3dec_detect_cb(io: *mut mp3dec_io_t, buf: *mut u8, buf_size: usize) -> libc::c_int;
}
extern "C" {
    pub fn mp3dec_load_buf(
        dec: *mut mp3dec_t,
        buf: *const u8,
        buf_size: usize,
        info: *mut mp3dec_file_info_t,
        progress_cb: MP3D_PROGRESS_CB,
        user_data: *mut libc::c_void,
    ) -> libc::c_int;
}
extern "C" {
    pub fn mp3dec_load_cb(
        dec: *mut mp3dec_t,
        io: *mut mp3dec_io_t,
        buf: *mut u8,
        buf_size: usize,
        info: *mut mp3dec_file_info_t,
        progress_cb: MP3D_PROGRESS_CB,
        user_data: *mut libc::c_void,
    ) -> libc::c_int;
}
extern "C" {
    pub fn mp3dec_iterate_buf(
        buf: *const u8,
        buf_size: usize,
        callback: MP3D_ITERATE_CB,
        user_data: *mut libc::c_void,
    ) -> libc::c_int;
}
extern "C" {
    pub fn mp3dec_iterate_cb(
        io: *mut mp3dec_io_t,
        buf: *mut u8,
        buf_size: usize,
        callback: MP3D_ITERATE_CB,
        user_data: *mut libc::c_void,
    ) -> libc::c_int;
}
extern "C" {
    pub fn mp3dec_ex_open_buf(
        dec: *mut mp3dec_ex_t,
        buf: *const u8,
        buf_size: usize,
        flags: libc::c_int,
    ) -> libc::c_int;
}
extern "C" {
    pub fn mp3dec_ex_open_cb(
        dec: *mut mp3dec_ex_t,
        io: *mut mp3dec_io_t,
        flags: libc::c_int,
    ) -> libc::c_int;
}
extern "C" {
    pub fn mp3dec_ex_close(dec: *mut mp3dec_ex_t);
}
extern "C" {
    pub fn mp3dec_ex_seek(dec: *mut mp3dec_ex_t, position: u64) -> libc::c_int;
}
extern "C" {
    pub fn mp3dec_ex_read_frame(
        dec: *mut mp3dec_ex_t,
        buf: *mut *mut mp3d_sample_t,
        max_samples: usize,
    ) -> usize;
}
extern "C" {
    pub fn mp3dec_ex_read(dec: *mut mp3dec_ex_t, buf: *mut mp3d_sample_t, samples: usize) -> usize;
}
extern "C" {
    pub fn mp3dec_detect(file_name: *const libc::c_char) -> libc::c_int;
}
extern "C" {
    pub fn mp3dec_load(
        dec: *mut mp3dec_t,
        file_name: *const libc::c_char,
        info: *mut mp3dec_file_info_t,
        progress_cb: MP3D_PROGRESS_CB,
        user_data: *mut libc::c_void,
    ) -> libc::c_int;
}
extern "C" {
    pub fn mp3dec_iterate(
        file_name: *const libc::c_char,
        callback: MP3D_ITERATE_CB,
        user_data: *mut libc::c_void,
    ) -> libc::c_int;
}
extern "C" {
    pub fn mp3dec_ex_open(
        dec: *mut mp3dec_ex_t,
        file_name: *const libc::c_char,
        flags: libc::c_int,
    ) -> libc::c_int;
}
extern "C" {
    pub fn mp3dec_detect_w(file_name: *const wchar_t) -> libc::c_int;
}
extern "C" {
    pub fn mp3dec_load_w(
        dec: *mut mp3dec_t,
        file_name: *const wchar_t,
        info: *mut mp3dec_file_info_t,
        progress_cb: MP3D_PROGRESS_CB,
        user_data: *mut libc::c_void,
    ) -> libc::c_int;
}
extern "C" {
    pub fn mp3dec_iterate_w(
        file_name: *const wchar_t,
        callback: MP3D_ITERATE_CB,
        user_data: *mut libc::c_void,
    ) -> libc::c_int;
}
extern "C" {
    pub fn mp3dec_ex_open_w(
        dec: *mut mp3dec_ex_t,
        file_name: *const wchar_t,
        flags: libc::c_int,
    ) -> libc::c_int;
}