1 #![allow(non_snake_case)] 2 3 extern crate libc; 4 extern crate ogg_sys as ogg; 5 extern crate vorbis_sys; 6 7 #[repr(C)] 8 pub struct ov_callbacks { 9 pub read_func: extern fn(*mut libc::c_void, libc::size_t, libc::size_t, *mut libc::c_void) 10 -> libc::size_t, 11 pub seek_func: extern fn(*mut libc::c_void, ogg::ogg_int64_t, libc::c_int) -> libc::c_int, 12 pub close_func: extern fn(*mut libc::c_void) -> libc::c_int, 13 pub tell_func: extern fn(*mut libc::c_void) -> libc::c_long, 14 } 15 16 // TODO: add static callbacks 17 18 pub const NOTOPEN: libc::c_int = 0; 19 pub const PARTOPEN: libc::c_int = 1; 20 pub const OPENED: libc::c_int = 2; 21 pub const STREAMSET: libc::c_int = 3; 22 pub const INITSET: libc::c_int = 4; 23 24 #[repr(C)] 25 pub struct OggVorbis_File { 26 pub datasource: *mut libc::c_void, 27 pub seekable: libc::c_int, 28 pub offset: ogg::ogg_int64_t, 29 pub end: ogg::ogg_int64_t, 30 pub oy: ogg::ogg_sync_state, 31 32 pub links: libc::c_int, 33 pub offsets: *mut ogg::ogg_int64_t, 34 pub dataoffsets: *mut ogg::ogg_int64_t, 35 pub serialnos: *mut libc::c_long, 36 pub pcmlengths: *mut ogg::ogg_int64_t, 37 pub vi: *mut vorbis_sys::vorbis_info, 38 pub vc: *mut vorbis_sys::vorbis_comment, 39 40 pub pcm_offset: ogg::ogg_int64_t, 41 pub ready_state: libc::c_int, 42 pub current_serialno: libc::c_long, 43 pub current_link: libc::c_int, 44 45 pub bittrack: libc::c_double, 46 pub samptrack: libc::c_double, 47 48 pub os: ogg::ogg_stream_state, 49 pub vd: vorbis_sys::vorbis_dsp_state, 50 pub vb: vorbis_sys::vorbis_block, 51 52 pub callbacks: ov_callbacks, 53 } 54 55 extern { 56 pub fn ov_clear(vf: *mut OggVorbis_File) -> libc::c_int; 57 pub fn ov_fopen(path: *const libc::c_char, vf: *mut OggVorbis_File) -> libc::c_int; 58 pub fn ov_open(f: *mut libc::FILE, vf: *mut OggVorbis_File, initial: *const libc::c_char, 59 ibytes: libc::c_long) -> libc::c_int; 60 pub fn ov_open_callbacks(datasource: *mut libc::c_void, vf: *mut OggVorbis_File, 61 initial: *const libc::c_char, ibytes: libc::c_long, callbacks: ov_callbacks) 62 -> libc::c_int; 63 64 pub fn ov_test(f: *mut libc::FILE, vf: *mut OggVorbis_File, initial: *const libc::c_char, 65 ibytes: libc::c_long) -> libc::c_int; 66 pub fn ov_test_callbacks(datasource: *mut libc::c_void, vf: *mut OggVorbis_File, 67 initial: *const libc::c_char, ibytes: libc::c_long, callbacks: ov_callbacks) 68 -> libc::c_int; 69 pub fn ov_test_open(vf: *mut OggVorbis_File) -> libc::c_int; 70 71 pub fn ov_bitrate(vf: *mut OggVorbis_File, i: libc::c_int) -> libc::c_long; 72 pub fn ov_bitrate_instant(vf: *mut OggVorbis_File) -> libc::c_long; 73 pub fn ov_streams(vf: *mut OggVorbis_File) -> libc::c_long; 74 pub fn ov_seekable(vf: *mut OggVorbis_File) -> libc::c_long; 75 pub fn ov_serialnumber(vf: *mut OggVorbis_File, i: libc::c_int) -> libc::c_long; 76 77 pub fn ov_raw_total(vf: *mut OggVorbis_File, i: libc::c_int) -> ogg::ogg_int64_t; 78 pub fn ov_pcm_total(vf: *mut OggVorbis_File, i: libc::c_int) -> ogg::ogg_int64_t; 79 pub fn ov_time_total(vf: *mut OggVorbis_File, i: libc::c_int) -> libc::c_double; 80 81 pub fn ov_raw_seek(vf: *mut OggVorbis_File, pos: ogg::ogg_int64_t) -> libc::c_int; 82 pub fn ov_pcm_seek(vf: *mut OggVorbis_File, pos: ogg::ogg_int64_t) -> libc::c_int; 83 pub fn ov_pcm_seek_page(vf: *mut OggVorbis_File, pos: ogg::ogg_int64_t) -> libc::c_int; 84 pub fn ov_time_seek(vf: *mut OggVorbis_File, pos: libc::c_double) -> libc::c_int; 85 pub fn ov_time_seek_page(vf: *mut OggVorbis_File, pos: libc::c_double) -> libc::c_int; 86 87 pub fn ov_raw_seek_lap(vf: *mut OggVorbis_File, pos: ogg::ogg_int64_t) -> libc::c_int; 88 pub fn ov_pcm_seek_lap(vf: *mut OggVorbis_File, pos: ogg::ogg_int64_t) -> libc::c_int; 89 pub fn ov_pcm_seek_page_lap(vf: *mut OggVorbis_File, pos: ogg::ogg_int64_t) -> libc::c_int; 90 pub fn ov_time_seek_lap(vf: *mut OggVorbis_File, pos: libc::c_double) -> libc::c_int; 91 pub fn ov_time_seek_page_lap(vf: *mut OggVorbis_File, pos: libc::c_double) -> libc::c_int; 92 93 pub fn ov_raw_tell(vf: *mut OggVorbis_File) -> ogg::ogg_int64_t; 94 pub fn ov_pcm_tell(vf: *mut OggVorbis_File) -> ogg::ogg_int64_t; 95 pub fn ov_time_tell(vf: *mut OggVorbis_File) -> libc::c_double; 96 97 pub fn ov_info(vf: *mut OggVorbis_File, link: libc::c_int) -> *mut vorbis_sys::vorbis_info; 98 pub fn ov_comment(vf: *mut OggVorbis_File, link: libc::c_int) -> *mut vorbis_sys::vorbis_comment; 99 100 pub fn ov_read_float(vf: *mut OggVorbis_File, pcm_channels: *mut *mut *mut libc::c_float, 101 samples: libc::c_int, bitstream: *mut libc::c_int) -> libc::c_long; 102 pub fn ov_read_filter(vf: *mut OggVorbis_File, buffer: *mut libc::c_char, length: libc::c_int, 103 bigendianp: libc::c_int, word: libc::c_int, sgned: libc::c_int, 104 bitstream: *mut libc::c_int, 105 filter: extern fn(*mut *mut libc::c_float, libc::c_long, libc::c_long, *mut libc::c_void), 106 filter_param: *mut libc::c_void) -> libc::c_long; 107 pub fn ov_read(vf: *mut OggVorbis_File, buffer: *mut libc::c_char, length: libc::c_int, 108 bigendianp: libc::c_int, word: libc::c_int, sgned: libc::c_int, 109 bitstream: *mut libc::c_int) -> libc::c_long; 110 pub fn ov_crosslap(vf1: *mut OggVorbis_File, vf2: *mut OggVorbis_File) -> libc::c_int; 111 112 pub fn ov_halfrate(vf: *mut OggVorbis_File, flag: libc::c_int) -> libc::c_int; 113 pub fn ov_halfrate_p(vf: *mut OggVorbis_File) -> libc::c_int; 114 } 115