1 #![allow(non_snake_case)]
2 
3 extern crate libc;
4 extern crate ogg_sys as ogg;
5 
6 #[repr(C)]
7 pub struct vorbis_info {
8     pub version: libc::c_int,
9     pub channels: libc::c_int,
10     pub rate: libc::c_long,
11     pub bitrate_upper: libc::c_long,
12     pub bitrate_nominal: libc::c_long,
13     pub bitrate_lower: libc::c_long,
14     pub bitrate_window: libc::c_long,
15     pub codec_setup: *mut libc::c_void,
16 }
17 
18 #[repr(C)]
19 pub struct vorbis_dsp_state {
20     pub analysisp: libc::c_int,
21     pub vi: *mut vorbis_info,
22 
23     pub pcm: *mut *mut libc::c_float,
24     pub pcmret: *mut *mut libc::c_float,
25     pub pcm_storage: libc::c_int,
26     pub pcm_current: libc::c_int,
27     pub pcm_returned: libc::c_int,
28 
29     pub preextrapolate: libc::c_int,
30     pub eofflag: libc::c_int,
31 
32     pub lW: libc::c_long,
33     pub W: libc::c_long,
34     pub nW: libc::c_long,
35     pub centerW: libc::c_long,
36 
37     pub granulepos: ogg::ogg_int64_t,
38     pub sequence: ogg::ogg_int64_t,
39 
40     pub glue_bits: ogg::ogg_int64_t,
41     pub time_bits: ogg::ogg_int64_t,
42     pub floor_bits: ogg::ogg_int64_t,
43     pub res_bits: ogg::ogg_int64_t,
44 
45     pub backend_state: *mut libc::c_void,
46 }
47 
48 #[repr(C)]
49 pub struct vorbis_block {
50     pub pcm: *mut *mut libc::c_float,
51     pub opb: ogg::oggpack_buffer,
52 
53     pub lW: libc::c_long,
54     pub W: libc::c_long,
55     pub nW: libc::c_long,
56     pub pcmend: libc::c_int,
57     pub mode: libc::c_int,
58 
59     pub eofflag: libc::c_int,
60     pub granulepos: ogg::ogg_int64_t,
61     pub sequence: ogg::ogg_int64_t,
62     pub vd: *mut vorbis_dsp_state,
63 
64     pub localstore: *mut libc::c_void,
65     pub localtop: libc::c_long,
66     pub localalloc: libc::c_long,
67     pub totaluse: libc::c_long,
68     pub reap: *mut alloc_chain,
69 
70     pub glue_bits: libc::c_long,
71     pub time_bits: libc::c_long,
72     pub floor_bits: libc::c_long,
73     pub res_bits: libc::c_long,
74 
75     pub internal: *mut libc::c_void,
76 }
77 
78 #[repr(C)]
79 pub struct alloc_chain {
80     pub ptr: *mut libc::c_char,
81     pub next: *mut alloc_chain,
82 }
83 
84 #[repr(C)]
85 pub struct vorbis_comment {
86     pub user_comments: *mut *mut libc::c_char,
87     pub comment_lengths: *mut libc::c_int,
88     pub comments: libc::c_int,
89     pub vendor: *mut libc::c_char,
90 }
91 
92 pub const OV_FALSE: libc::c_int = -1;
93 pub const OV_EOF: libc::c_int = -2;
94 pub const OV_HOLE: libc::c_int = -3;
95 
96 pub const OV_EREAD: libc::c_int = -128;
97 pub const OV_EFAULT: libc::c_int = -129;
98 pub const OV_EIMPL: libc::c_int = -130;
99 pub const OV_EINVAL: libc::c_int = -131;
100 pub const OV_ENOTVORBIS: libc::c_int = -132;
101 pub const OV_EBADHEADER: libc::c_int = -133;
102 pub const OV_EVERSION: libc::c_int = -134;
103 pub const OV_ENOTAUDIO: libc::c_int = -135;
104 pub const OV_EBADPACKET: libc::c_int = -136;
105 pub const OV_EBADLINK: libc::c_int = -137;
106 pub const OV_ENOSEEK: libc::c_int = -138;
107 
108 extern {
109     pub fn vorbis_info_init(vi: *mut vorbis_info);
110     pub fn vorbis_info_clear(vi: *mut vorbis_info);
111     pub fn vorbis_info_blocksize(vi: *mut vorbis_info, zo: libc::c_int) -> libc::c_int;
112     pub fn vorbis_comment_init(vc: *mut vorbis_comment);
113     pub fn vorbis_comment_add(vc: *mut vorbis_comment, comment: *const libc::c_char);
114     pub fn vorbis_comment_add_tag(vc: *mut vorbis_comment, tag: *const libc::c_char,
115         contents: *const libc::c_char);
116     pub fn vorbis_comment_query(vc: *mut vorbis_comment, tag: *const libc::c_char,
117         count: libc::c_int) -> *mut libc::c_char;
118     pub fn vorbis_comment_query_count(vc: *mut vorbis_comment, tag: *const libc::c_char)
119         -> libc::c_int;
120     pub fn vorbis_comment_clear(vc: *mut vorbis_comment);
121 
122     pub fn vorbis_block_init(v: *mut vorbis_dsp_state, vb: *mut vorbis_block) -> libc::c_int;
123     pub fn vorbis_block_clear(vb: *mut vorbis_block) -> libc::c_int;
124     pub fn vorbis_dsp_clear(v: *mut vorbis_dsp_state);
125     pub fn vorbis_granule_time(v: *mut vorbis_dsp_state, granulepos: ogg::ogg_int64_t)
126         -> libc::c_double;
127 
128     pub fn vorbis_version_string() -> *const libc::c_char;
129 
130     pub fn vorbis_analysis_init(v: *mut vorbis_dsp_state,vi: *mut vorbis_info) -> libc::c_int;
131     pub fn vorbis_commentheader_out(vc: *mut vorbis_comment, op: *mut ogg::ogg_packet)
132         -> libc::c_int;
133     pub fn vorbis_analysis_headerout(v: *mut vorbis_dsp_state, vc: *mut vorbis_comment,
134         op: *mut ogg::ogg_packet, op_comm: *mut ogg::ogg_packet,
135         op_code: *mut ogg::ogg_packet) -> libc::c_int;
136     pub fn vorbis_analysis_buffer(v: *mut vorbis_dsp_state, vals: libc::c_int)
137         -> *mut *mut libc::c_float;
138     pub fn vorbis_analysis_wrote(v: *mut vorbis_dsp_state, vals: libc::c_int) -> libc::c_int;
139     pub fn vorbis_analysis_blockout(v: *mut vorbis_dsp_state, vb: *mut vorbis_block) -> libc::c_int;
140     pub fn vorbis_analysis(vb: *mut vorbis_block, op: *mut ogg::ogg_packet) -> libc::c_int;
141 
142     pub fn vorbis_bitrate_addblock(vb: *mut vorbis_block) -> libc::c_int;
143     pub fn vorbis_bitrate_flushpacket(v: *mut vorbis_dsp_state, op: *mut ogg::ogg_packet)
144         -> libc::c_int;
145 
146     pub fn vorbis_synthesis_idheader(op: *mut ogg::ogg_packet) -> libc::c_int;
147     pub fn vorbis_synthesis_headerin(vi: *mut vorbis_info, vc: *mut vorbis_comment,
148         op: *mut ogg::ogg_packet) -> libc::c_int;
149 
150     pub fn vorbis_synthesis_init(v: *mut vorbis_dsp_state, vi: *mut vorbis_info) -> libc::c_int;
151     pub fn vorbis_synthesis_restart(v: *mut vorbis_dsp_state) -> libc::c_int;
152     pub fn vorbis_synthesis(vb: *mut vorbis_block,op: *mut ogg::ogg_packet) -> libc::c_int;
153     pub fn vorbis_synthesis_trackonly(vb: *mut vorbis_block,
154         op: *mut ogg::ogg_packet) -> libc::c_int;
155     pub fn vorbis_synthesis_blockin(v: *mut vorbis_dsp_state,vb: *mut vorbis_block) -> libc::c_int;
156     pub fn vorbis_synthesis_pcmout(v: *mut vorbis_dsp_state, pcm: *mut *mut *mut libc::c_float)
157         -> libc::c_int;
158     pub fn vorbis_synthesis_lapout(v: *mut vorbis_dsp_state, pcm: *mut *mut *mut libc::c_float)
159         -> libc::c_int;
160     pub fn vorbis_synthesis_read(v: *mut vorbis_dsp_state, samples: libc::c_int) -> libc::c_int;
161     pub fn vorbis_packet_blocksize(vi: *mut vorbis_info, op: *mut ogg::ogg_packet) -> libc::c_long;
162 
163     pub fn vorbis_synthesis_halfrate(v: *mut vorbis_info, flag: libc::c_int) -> libc::c_int;
164     pub fn vorbis_synthesis_halfrate_p(v: *mut vorbis_info) -> libc::c_int;
165 }
166