sndfile_sys/
lib.rs

1#![allow(non_snake_case, non_camel_case_types)]
2
3extern crate libc;
4
5#[cfg(windows)]
6use libc::wchar_t;
7use libc::{c_char, c_double, c_float, c_int, c_short, c_uint, c_void, size_t};
8use std::i64;
9
10#[link(name = "sndfile")]
11extern "C" {}
12
13#[cfg(test)]
14mod test;
15
16pub const SF_FORMAT_WAV: c_int = 0x010000;
17pub const SF_FORMAT_AIFF: c_int = 0x020000;
18pub const SF_FORMAT_AU: c_int = 0x030000;
19pub const SF_FORMAT_RAW: c_int = 0x040000;
20pub const SF_FORMAT_PAF: c_int = 0x050000;
21pub const SF_FORMAT_SVX: c_int = 0x060000;
22pub const SF_FORMAT_NIST: c_int = 0x070000;
23pub const SF_FORMAT_VOC: c_int = 0x080000;
24pub const SF_FORMAT_IRCAM: c_int = 0x0A0000;
25pub const SF_FORMAT_W64: c_int = 0x0B0000;
26pub const SF_FORMAT_MAT4: c_int = 0x0C0000;
27pub const SF_FORMAT_MAT5: c_int = 0x0D0000;
28pub const SF_FORMAT_PVF: c_int = 0x0E0000;
29pub const SF_FORMAT_XI: c_int = 0x0F0000;
30pub const SF_FORMAT_HTK: c_int = 0x100000;
31pub const SF_FORMAT_SDS: c_int = 0x110000;
32pub const SF_FORMAT_AVR: c_int = 0x120000;
33pub const SF_FORMAT_WAVEX: c_int = 0x130000;
34pub const SF_FORMAT_SD2: c_int = 0x160000;
35pub const SF_FORMAT_FLAC: c_int = 0x170000;
36pub const SF_FORMAT_CAF: c_int = 0x180000;
37pub const SF_FORMAT_WVE: c_int = 0x190000;
38pub const SF_FORMAT_OGG: c_int = 0x200000;
39pub const SF_FORMAT_MPC2K: c_int = 0x210000;
40pub const SF_FORMAT_RF64: c_int = 0x220000;
41pub const SF_FORMAT_MPEG: c_int = 0x230000;
42pub const SF_FORMAT_PCM_S8: c_int = 0x0001;
43pub const SF_FORMAT_PCM_16: c_int = 0x0002;
44pub const SF_FORMAT_PCM_24: c_int = 0x0003;
45pub const SF_FORMAT_PCM_32: c_int = 0x0004;
46pub const SF_FORMAT_PCM_U8: c_int = 0x0005;
47pub const SF_FORMAT_FLOAT: c_int = 0x0006;
48pub const SF_FORMAT_DOUBLE: c_int = 0x0007;
49pub const SF_FORMAT_ULAW: c_int = 0x0010;
50pub const SF_FORMAT_ALAW: c_int = 0x0011;
51pub const SF_FORMAT_IMA_ADPCM: c_int = 0x0012;
52pub const SF_FORMAT_MS_ADPCM: c_int = 0x0013;
53pub const SF_FORMAT_GSM610: c_int = 0x0020;
54pub const SF_FORMAT_VOX_ADPCM: c_int = 0x0021;
55pub const SF_FORMAT_NMS_ADPCM_16: c_int = 0x0022;
56pub const SF_FORMAT_NMS_ADPCM_24: c_int = 0x0023;
57pub const SF_FORMAT_NMS_ADPCM_32: c_int = 0x0024;
58pub const SF_FORMAT_G721_32: c_int = 0x0030;
59pub const SF_FORMAT_G723_24: c_int = 0x0031;
60pub const SF_FORMAT_G723_40: c_int = 0x0032;
61pub const SF_FORMAT_DWVW_12: c_int = 0x0040;
62pub const SF_FORMAT_DWVW_16: c_int = 0x0041;
63pub const SF_FORMAT_DWVW_24: c_int = 0x0042;
64pub const SF_FORMAT_DWVW_N: c_int = 0x0043;
65pub const SF_FORMAT_DPCM_8: c_int = 0x0050;
66pub const SF_FORMAT_DPCM_16: c_int = 0x0051;
67pub const SF_FORMAT_VORBIS: c_int = 0x0060;
68pub const SF_FORMAT_OPUS: c_int = 0x0064;
69pub const SF_FORMAT_ALAC_16: c_int = 0x0070;
70pub const SF_FORMAT_ALAC_20: c_int = 0x0071;
71pub const SF_FORMAT_ALAC_24: c_int = 0x0072;
72pub const SF_FORMAT_ALAC_32: c_int = 0x0073;
73pub const SF_FORMAT_MPEG_LAYER_I: c_int = 0x0080;
74pub const SF_FORMAT_MPEG_LAYER_II: c_int = 0x0081;
75pub const SF_FORMAT_MPEG_LAYER_III: c_int = 0x0082;
76pub const SF_ENDIAN_FILE: c_int = 0x00000000;
77pub const SF_ENDIAN_LITTLE: c_int = 0x10000000;
78pub const SF_ENDIAN_BIG: c_int = 0x20000000;
79pub const SF_ENDIAN_CPU: c_int = 0x30000000;
80pub const SF_FORMAT_SUBMASK: c_int = 0x0000FFFF;
81pub const SF_FORMAT_TYPEMASK: c_int = 0x0FFF0000;
82pub const SF_FORMAT_ENDMASK: c_int = 0x30000000;
83
84pub const SFC_GET_LIB_VERSION: c_int = 0x1000;
85pub const SFC_GET_LOG_INFO: c_int = 0x1001;
86pub const SFC_GET_CURRENT_SF_INFO: c_int = 0x1002;
87pub const SFC_GET_NORM_DOUBLE: c_int = 0x1010;
88pub const SFC_GET_NORM_FLOAT: c_int = 0x1011;
89pub const SFC_SET_NORM_DOUBLE: c_int = 0x1012;
90pub const SFC_SET_NORM_FLOAT: c_int = 0x1013;
91pub const SFC_SET_SCALE_FLOAT_INT_READ: c_int = 0x1014;
92pub const SFC_SET_SCALE_INT_FLOAT_WRITE: c_int = 0x1015;
93pub const SFC_GET_SIMPLE_FORMAT_COUNT: c_int = 0x1020;
94pub const SFC_GET_SIMPLE_FORMAT: c_int = 0x1021;
95pub const SFC_GET_FORMAT_INFO: c_int = 0x1028;
96pub const SFC_GET_FORMAT_MAJOR_COUNT: c_int = 0x1030;
97pub const SFC_GET_FORMAT_MAJOR: c_int = 0x1031;
98pub const SFC_GET_FORMAT_SUBTYPE_COUNT: c_int = 0x1032;
99pub const SFC_GET_FORMAT_SUBTYPE: c_int = 0x1033;
100pub const SFC_CALC_SIGNAL_MAX: c_int = 0x1040;
101pub const SFC_CALC_NORM_SIGNAL_MAX: c_int = 0x1041;
102pub const SFC_CALC_MAX_ALL_CHANNELS: c_int = 0x1042;
103pub const SFC_CALC_NORM_MAX_ALL_CHANNELS: c_int = 0x1043;
104pub const SFC_GET_SIGNAL_MAX: c_int = 0x1044;
105pub const SFC_GET_MAX_ALL_CHANNELS: c_int = 0x1045;
106pub const SFC_SET_ADD_PEAK_CHUNK: c_int = 0x1050;
107pub const SFC_UPDATE_HEADER_NOW: c_int = 0x1060;
108pub const SFC_SET_UPDATE_HEADER_AUTO: c_int = 0x1061;
109pub const SFC_FILE_TRUNCATE: c_int = 0x1080;
110pub const SFC_SET_RAW_START_OFFSET: c_int = 0x1090;
111pub const SFC_SET_DITHER_ON_WRITE: c_int = 0x10A0;
112pub const SFC_SET_DITHER_ON_READ: c_int = 0x10A1;
113pub const SFC_GET_DITHER_INFO_COUNT: c_int = 0x10A2;
114pub const SFC_GET_DITHER_INFO: c_int = 0x10A3;
115pub const SFC_GET_EMBED_FILE_INFO: c_int = 0x10B0;
116pub const SFC_SET_CLIPPING: c_int = 0x10C0;
117pub const SFC_GET_CLIPPING: c_int = 0x10C1;
118pub const SFC_GET_CUE_COUNT: c_int = 0x10CD;
119pub const SFC_GET_CUE: c_int = 0x10CE;
120pub const SFC_SET_CUE: c_int = 0x10CF;
121pub const SFC_GET_INSTRUMENT: c_int = 0x10D0;
122pub const SFC_SET_INSTRUMENT: c_int = 0x10D1;
123pub const SFC_GET_LOOP_INFO: c_int = 0x10E0;
124pub const SFC_GET_BROADCAST_INFO: c_int = 0x10F0;
125pub const SFC_SET_BROADCAST_INFO: c_int = 0x10F1;
126pub const SFC_GET_CHANNEL_MAP_INFO: c_int = 0x1100;
127pub const SFC_SET_CHANNEL_MAP_INFO: c_int = 0x1101;
128pub const SFC_RAW_DATA_NEEDS_ENDSWAP: c_int = 0x1110;
129pub const SFC_WAVEX_SET_AMBISONIC: c_int = 0x1200;
130pub const SFC_WAVEX_GET_AMBISONIC: c_int = 0x1201;
131pub const SFC_RF64_AUTO_DOWNGRADE: c_int = 0x1210;
132pub const SFC_SET_VBR_ENCODING_QUALITY: c_int = 0x1300;
133pub const SFC_SET_COMPRESSION_LEVEL: c_int = 0x1301;
134pub const SFC_SET_OGG_PAGE_LATENCY_MS: c_int = 0x1302;
135pub const SFC_SET_OGG_PAGE_LATENCY: c_int = 0x1303;
136pub const SFC_GET_BITRATE_MODE: c_int = 0x1304;
137pub const SFC_SET_BITRATE_MODE: c_int = 0x1305;
138pub const SFC_SET_CART_INFO: c_int = 0x1400;
139pub const SFC_GET_CART_INFO: c_int = 0x1401;
140pub const SFC_SET_ORIGINAL_SAMPLERATE: c_int = 0x1500;
141pub const SFC_GET_ORIGINAL_SAMPLERATE: c_int = 0x1501;
142pub const SFC_TEST_IEEE_FLOAT_REPLACE: c_int = 0x6001;
143pub const SFC_SET_ADD_HEADER_PAD_CHUNK: c_int = 0x1051;
144pub const SFC_SET_ADD_DITHER_ON_WRITE: c_int = 0x1070;
145pub const SFC_SET_ADD_DITHER_ON_READ: c_int = 0x1071;
146
147pub const SF_STR_TITLE: c_int = 0x01;
148pub const SF_STR_COPYRIGHT: c_int = 0x02;
149pub const SF_STR_SOFTWARE: c_int = 0x03;
150pub const SF_STR_ARTIST: c_int = 0x04;
151pub const SF_STR_COMMENT: c_int = 0x05;
152pub const SF_STR_DATE: c_int = 0x06;
153pub const SF_STR_ALBUM: c_int = 0x07;
154pub const SF_STR_LICENSE: c_int = 0x08;
155pub const SF_STR_TRACKNUMBER: c_int = 0x09;
156pub const SF_STR_GENRE: c_int = 0x10;
157pub const SF_STR_FIRST: c_int = SF_STR_TITLE;
158pub const SF_STR_LAST: c_int = SF_STR_GENRE;
159
160pub const SF_FALSE: c_int = 0;
161pub const SF_TRUE: c_int = 1;
162
163pub const SFM_READ: c_int = 0x10;
164pub const SFM_WRITE: c_int = 0x20;
165pub const SFM_RDWR: c_int = 0x30;
166
167pub const SF_AMBISONIC_NONE: c_int = 0x40;
168pub const SF_AMBISONIC_B_FORMAT: c_int = 0x41;
169
170pub const SF_ERR_NO_ERROR: c_int = 0;
171pub const SF_ERR_UNRECOGNISED_FORMAT: c_int = 1;
172pub const SF_ERR_SYSTEM: c_int = 2;
173pub const SF_ERR_MALFORMED_FILE: c_int = 3;
174pub const SF_ERR_UNSUPPORTED_ENCODING: c_int = 4;
175
176pub const SF_CHANNEL_MAP_INVALID: c_int = 0;
177pub const SF_CHANNEL_MAP_MONO: c_int = 1;
178pub const SF_CHANNEL_MAP_LEFT: c_int = 2;
179pub const SF_CHANNEL_MAP_RIGHT: c_int = 3;
180pub const SF_CHANNEL_MAP_CENTER: c_int = 4;
181pub const SF_CHANNEL_MAP_FRONT_LEFT: c_int = 5;
182pub const SF_CHANNEL_MAP_FRONT_RIGHT: c_int = 6;
183pub const SF_CHANNEL_MAP_FRONT_CENTER: c_int = 7;
184pub const SF_CHANNEL_MAP_REAR_CENTER: c_int = 8;
185pub const SF_CHANNEL_MAP_REAR_LEFT: c_int = 9;
186pub const SF_CHANNEL_MAP_REAR_RIGHT: c_int = 10;
187pub const SF_CHANNEL_MAP_LFE: c_int = 11;
188pub const SF_CHANNEL_MAP_FRONT_LEFT_OF_CENTER: c_int = 12;
189pub const SF_CHANNEL_MAP_FRONT_RIGHT_OF_CENTER: c_int = 13;
190pub const SF_CHANNEL_MAP_SIDE_LEFT: c_int = 14;
191pub const SF_CHANNEL_MAP_SIDE_RIGHT: c_int = 15;
192pub const SF_CHANNEL_MAP_TOP_CENTER: c_int = 16;
193pub const SF_CHANNEL_MAP_TOP_FRONT_LEFT: c_int = 17;
194pub const SF_CHANNEL_MAP_TOP_FRONT_RIGHT: c_int = 18;
195pub const SF_CHANNEL_MAP_TOP_FRONT_CENTER: c_int = 19;
196pub const SF_CHANNEL_MAP_TOP_REAR_LEFT: c_int = 20;
197pub const SF_CHANNEL_MAP_TOP_REAR_RIGHT: c_int = 21;
198pub const SF_CHANNEL_MAP_TOP_REAR_CENTER: c_int = 22;
199pub const SF_CHANNEL_MAP_AMBISONIC_B_W: c_int = 23;
200pub const SF_CHANNEL_MAP_AMBISONIC_B_X: c_int = 24;
201pub const SF_CHANNEL_MAP_AMBISONIC_B_Y: c_int = 25;
202pub const SF_CHANNEL_MAP_AMBISONIC_B_Z: c_int = 26;
203pub const SF_CHANNEL_MAP_MAX: c_int = 27;
204
205pub type SNDFILE = c_void;
206
207pub type sf_count_t = i64;
208
209pub const SF_COUNT_MAX: i64 = i64::MAX;
210
211#[repr(C)]
212#[derive(Debug)]
213pub struct SF_INFO {
214    pub frames: sf_count_t,
215    pub samplerate: c_int,
216    pub channels: c_int,
217    pub format: c_int,
218    pub sections: c_int,
219    pub seekable: c_int,
220}
221
222#[repr(C)]
223#[derive(Debug)]
224pub struct SF_FORMAT_INFO {
225    pub format: c_int,
226    pub name: *const c_char,
227    pub extension: *const c_char,
228}
229
230pub const SFD_DEFAULT_LEVEL: c_int = 0;
231pub const SFD_CUSTOM_LEVEL: c_int = 0x40000000;
232pub const SFD_NO_DITHER: c_int = 500;
233pub const SFD_WHITE: c_int = 501;
234pub const SFD_TRIANGULAR_PDF: c_int = 502;
235
236#[repr(C)]
237#[derive(Debug)]
238pub struct SF_DITHER_INFO {
239    pub type_: c_int,
240    pub level: c_double,
241    pub name: *const c_char,
242}
243
244#[repr(C)]
245#[derive(Debug)]
246pub struct SF_EMBED_FILE_INFO {
247    pub offset: sf_count_t,
248    pub length: sf_count_t,
249}
250
251#[repr(C)]
252pub struct SF_CUE_POINT {
253    pub indx: i32,
254    pub position: u32,
255    pub fcc_chunk: i32,
256    pub chunk_start: i32,
257    pub block_start: i32,
258    pub sample_offset: u32,
259    pub name: [c_char; 256],
260}
261
262#[repr(C)]
263pub struct SF_CUES {
264    pub cue_count: u32,
265    pub cue_points: [SF_CUE_POINT; 100],
266}
267
268pub const SF_LOOP_NONE: c_int = 800;
269pub const SF_LOOP_FORWARD: c_int = 801;
270pub const SF_LOOP_BACKWARD: c_int = 802;
271pub const SF_LOOP_ALTERNATING: c_int = 803;
272
273#[repr(C)]
274#[derive(Debug)]
275pub struct SF_INSTRUMENT_LOOP {
276    pub mode: c_int,
277    pub start: u32,
278    pub end: u32,
279    pub count: u32,
280}
281
282#[repr(C)]
283pub struct SF_INSTRUMENT {
284    pub gain: c_int,
285    pub basenote: c_char,
286    pub detune: c_char,
287    pub velocity_lo: c_char,
288    pub velocity_hi: c_char,
289    pub key_lo: c_char,
290    pub key_hi: c_char,
291    pub loop_count: c_int,
292    pub loops: [SF_INSTRUMENT_LOOP; 16],
293}
294
295#[repr(C)]
296pub struct SF_LOOP_INFO {
297    pub time_sig_num: c_short,
298    pub time_sig_den: c_short,
299    pub loop_mode: c_int,
300    pub num_beats: c_int,
301    pub bpm: c_float,
302    pub root_key: c_int,
303    pub future: [c_int; 6],
304}
305
306#[repr(C)]
307pub struct SF_BROADCAST_INFO {
308    pub description: [c_char; 256],
309    pub originator: [c_char; 32],
310    pub originator_reference: [c_char; 32],
311    pub origination_date: [c_char; 10],
312    pub origination_time: [c_char; 8],
313    pub time_reference_low: u32,
314    pub time_reference_high: u32,
315    pub version: c_short,
316    pub umid: [c_char; 64],
317    pub reserved: [c_char; 190],
318    pub coding_history_size: u32,
319    pub coding_history: [c_char; 256],
320}
321
322#[repr(C)]
323pub struct SF_CART_TIMER {
324    pub usage: [c_char; 4],
325    pub value: i32,
326}
327
328#[repr(C)]
329pub struct SF_CART_INFO {
330    pub version: [c_char; 4],
331    pub title: [c_char; 64],
332    pub artist: [c_char; 64],
333    pub cut_id: [c_char; 64],
334    pub client_id: [c_char; 64],
335    pub category: [c_char; 64],
336    pub classification: [c_char; 64],
337    pub out_cue: [c_char; 64],
338    pub start_date: [c_char; 10],
339    pub start_time: [c_char; 8],
340    pub end_date: [c_char; 10],
341    pub end_time: [c_char; 8],
342    pub producer_app_id: [c_char; 64],
343    pub producer_app_version: [c_char; 64],
344    pub user_def: [c_char; 64],
345    pub level_reference: i32,
346    pub post_timers: [SF_CART_TIMER; 8],
347    pub reserved: [c_char; 276],
348    pub url: [c_char; 1024],
349    pub tag_text_size: i32,
350    pub tag_text: [c_char; 256],
351}
352
353pub type sf_vio_get_filelen = extern "C" fn(user_data: *mut c_void) -> sf_count_t;
354pub type sf_vio_seek =
355    extern "C" fn(offset: sf_count_t, whence: c_int, user_data: *mut c_void) -> sf_count_t;
356pub type sf_vio_read =
357    extern "C" fn(ptr: *mut c_void, count: sf_count_t, user_data: *mut c_void) -> sf_count_t;
358pub type sf_vio_write =
359    extern "C" fn(ptr: *const c_void, count: sf_count_t, user_data: *mut c_void) -> sf_count_t;
360pub type sf_vio_tell = extern "C" fn(user_data: *mut c_void) -> sf_count_t;
361
362#[repr(C)]
363#[derive(Debug)]
364pub struct SF_VIRTUAL_IO {
365    pub get_filelen: sf_vio_get_filelen,
366    pub seek: sf_vio_seek,
367    pub read: sf_vio_read,
368    pub write: sf_vio_write,
369    pub tell: sf_vio_tell,
370}
371
372pub const SF_SEEK_SET: c_int = 0;
373pub const SF_SEEK_CUR: c_int = 1;
374pub const SF_SEEK_END: c_int = 2;
375
376#[repr(C)]
377pub struct SF_CHUNK_INFO {
378    id: [c_char; 64],
379    id_size: c_uint,
380    datalen: c_uint,
381    data: *mut c_void,
382}
383
384pub type SF_CHUNK_ITERATOR = c_void;
385
386extern "C" {
387    pub fn sf_open(path: *const c_char, mode: c_int, sfinfo: *mut SF_INFO) -> *mut SNDFILE;
388    pub fn sf_open_fd(
389        fd: c_int,
390        mode: c_int,
391        sfinfo: *mut SF_INFO,
392        close_desc: c_int,
393    ) -> *mut SNDFILE;
394    pub fn sf_open_virtual(
395        sfvirtual: *mut SF_VIRTUAL_IO,
396        mode: c_int,
397        sfinfo: *mut SF_INFO,
398        user_data: *mut c_void,
399    ) -> *mut SNDFILE;
400    #[cfg(windows)]
401    pub fn sf_wchar_open(wpath: *const wchar_t, mode: c_int, sfinfo: *mut SF_INFO) -> *mut SNDFILE;
402    pub fn sf_error(sndfile: *mut SNDFILE) -> c_int;
403    pub fn sf_strerror(sndfile: *mut SNDFILE) -> *const c_char;
404    pub fn sf_error_number(errnum: c_int) -> *const c_char;
405    pub fn sf_perror(sndfile: *mut SNDFILE) -> c_int;
406    pub fn sf_error_str(sndfile: *mut SNDFILE, str_: *mut c_char, len: size_t) -> c_int;
407    pub fn sf_command(
408        sndfile: *mut SNDFILE,
409        command: c_int,
410        data: *mut c_void,
411        datasize: c_int,
412    ) -> c_int;
413    pub fn sf_format_check(info: *const SF_INFO) -> c_int;
414    pub fn sf_seek(sndfile: *mut SNDFILE, frames: sf_count_t, whence: c_int) -> sf_count_t;
415    pub fn sf_set_string(sndfile: *mut SNDFILE, str_type: c_int, str_: *const c_char) -> c_int;
416    pub fn sf_get_string(sndfile: *mut SNDFILE, str_type: c_int) -> *const c_char;
417    pub fn sf_version_string() -> *const c_char;
418    pub fn sf_current_byterate(sndfile: *mut SNDFILE) -> c_int;
419    pub fn sf_read_raw(sndfile: *mut SNDFILE, ptr: *mut c_void, bytes: sf_count_t) -> sf_count_t;
420    pub fn sf_write_raw(sndfile: *mut SNDFILE, ptr: *const c_void, bytes: sf_count_t)
421        -> sf_count_t;
422    pub fn sf_readf_short(
423        sndfile: *mut SNDFILE,
424        ptr: *mut c_short,
425        frames: sf_count_t,
426    ) -> sf_count_t;
427    pub fn sf_writef_short(
428        sndfile: *mut SNDFILE,
429        ptr: *const c_short,
430        frames: sf_count_t,
431    ) -> sf_count_t;
432    pub fn sf_readf_int(sndfile: *mut SNDFILE, ptr: *mut c_int, frames: sf_count_t) -> sf_count_t;
433    pub fn sf_writef_int(
434        sndfile: *mut SNDFILE,
435        ptr: *const c_int,
436        frames: sf_count_t,
437    ) -> sf_count_t;
438    pub fn sf_readf_float(
439        sndfile: *mut SNDFILE,
440        ptr: *mut c_float,
441        frames: sf_count_t,
442    ) -> sf_count_t;
443    pub fn sf_writef_float(
444        sndfile: *mut SNDFILE,
445        ptr: *const c_float,
446        frames: sf_count_t,
447    ) -> sf_count_t;
448    pub fn sf_readf_double(
449        sndfile: *mut SNDFILE,
450        ptr: *mut c_double,
451        frames: sf_count_t,
452    ) -> sf_count_t;
453    pub fn sf_writef_double(
454        sndfile: *mut SNDFILE,
455        ptr: *const c_double,
456        frames: sf_count_t,
457    ) -> sf_count_t;
458    pub fn sf_read_short(sndfile: *mut SNDFILE, ptr: *mut c_short, items: sf_count_t)
459        -> sf_count_t;
460    pub fn sf_write_short(
461        sndfile: *mut SNDFILE,
462        ptr: *const c_short,
463        items: sf_count_t,
464    ) -> sf_count_t;
465    pub fn sf_read_int(sndfile: *mut SNDFILE, ptr: *mut c_int, items: sf_count_t) -> sf_count_t;
466    pub fn sf_write_int(sndfile: *mut SNDFILE, ptr: *const c_int, items: sf_count_t) -> sf_count_t;
467    pub fn sf_read_float(sndfile: *mut SNDFILE, ptr: *mut c_float, items: sf_count_t)
468        -> sf_count_t;
469    pub fn sf_write_float(
470        sndfile: *mut SNDFILE,
471        ptr: *const c_float,
472        items: sf_count_t,
473    ) -> sf_count_t;
474    pub fn sf_read_double(
475        sndfile: *mut SNDFILE,
476        ptr: *mut c_double,
477        items: sf_count_t,
478    ) -> sf_count_t;
479    pub fn sf_write_double(
480        sndfile: *mut SNDFILE,
481        ptr: *const c_double,
482        items: sf_count_t,
483    ) -> sf_count_t;
484    pub fn sf_close(sndfile: *mut SNDFILE) -> c_int;
485    pub fn sf_write_sync(sndfile: *mut SNDFILE);
486    pub fn sf_set_chunk(sndfile: *mut SNDFILE, chunk_info: *const SF_CHUNK_INFO) -> c_int;
487    pub fn sf_get_chunk_iterator(
488        sndfile: *mut SNDFILE,
489        chunk_info: *const SF_CHUNK_INFO,
490    ) -> *mut SF_CHUNK_ITERATOR;
491    pub fn sf_next_chunk_iterator(iterator: *mut SF_CHUNK_ITERATOR) -> *mut SF_CHUNK_ITERATOR;
492    pub fn sf_get_chunk_size(it: *const SF_CHUNK_ITERATOR, chunk_info: *mut SF_CHUNK_INFO)
493        -> c_int;
494    pub fn sf_get_chunk_data(it: *const SF_CHUNK_ITERATOR, chunk_info: *mut SF_CHUNK_INFO)
495        -> c_int;
496}