1 ! Copyright (C) 2007 Chris Double.
2 ! See http://factorcode.org/license.txt for BSD license.
4 USING: kernel system combinators alien alien.syntax ;
7 : load-vorbis-library ( -- )
9 { [ win32? ] [ "vorbis.dll" ] }
10 { [ macosx? ] [ "libvorbis.0.dylib" ] }
11 { [ unix? ] [ "libvorbis.so" ] }
12 } cond "cdecl" add-library ; parsing
22 { "long" "bitrate_upper" }
23 { "long" "bitrate_nominal" }
24 { "long" "bitrate_lower" }
25 { "long" "bitrate_window" }
26 { "void*" "codec_setup"}
29 C-STRUCT: vorbis_dsp_state
31 { "vorbis_info*" "vi" }
33 { "float**" "pcmret" }
34 { "int" "pcm_storage" }
35 { "int" "pcm_current" }
36 { "int" "pcm_returned" }
37 { "int" "preextrapolate" }
43 { "longlong" "granulepos" }
44 { "longlong" "sequence" }
45 { "longlong" "glue_bits" }
46 { "longlong" "time_bits" }
47 { "longlong" "floor_bits" }
48 { "longlong" "res_bits" }
49 { "void*" "backend_state" }
57 C-STRUCT: vorbis_block
59 { "oggpack_buffer" "opb" }
66 { "longlong" "granulepos" }
67 { "longlong" "sequence" }
68 { "vorbis_dsp_state*" "vd" }
69 { "void*" "localstore" }
71 { "long" "localalloc" }
73 { "alloc_chain*" "reap" }
74 { "long" "glue_bits" }
75 { "long" "time_bits" }
76 { "long" "floor_bits" }
78 { "void*" "internal" }
81 C-STRUCT: vorbis_comment
82 { "char**" "usercomments" }
83 { "int*" "comment_lengths" }
88 FUNCTION: void vorbis_info_init ( vorbis_info* vi ) ;
89 FUNCTION: void vorbis_info_clear ( vorbis_info* vi ) ;
90 FUNCTION: int vorbis_info_blocksize ( vorbis_info* vi, int zo ) ;
91 FUNCTION: void vorbis_comment_init ( vorbis_comment* vc ) ;
92 FUNCTION: void vorbis_comment_add ( vorbis_comment* vc, char* comment ) ;
93 FUNCTION: void vorbis_comment_add_tag ( vorbis_comment* vc, char* tag, char* contents ) ;
94 FUNCTION: char* vorbis_comment_query ( vorbis_comment* vc, char* tag, int count ) ;
95 FUNCTION: int vorbis_comment_query_count ( vorbis_comment* vc, char* tag ) ;
96 FUNCTION: void vorbis_comment_clear ( vorbis_comment* vc ) ;
97 FUNCTION: int vorbis_block_init ( vorbis_dsp_state* v, vorbis_block* vb ) ;
98 FUNCTION: int vorbis_block_clear ( vorbis_block* vb ) ;
99 FUNCTION: void vorbis_dsp_clear ( vorbis_dsp_state* v ) ;
100 FUNCTION: double vorbis_granule_time ( vorbis_dsp_state* v, longlong granulepos ) ;
101 FUNCTION: int vorbis_analysis_init ( vorbis_dsp_state* v, vorbis_info* vi ) ;
102 FUNCTION: int vorbis_commentheader_out ( vorbis_comment* vc, ogg_packet* op ) ;
103 FUNCTION: int vorbis_analysis_headerout ( vorbis_dsp_state* v,
107 ogg_packet* op_code ) ;
108 FUNCTION: float** vorbis_analysis_buffer ( vorbis_dsp_state* v, int vals ) ;
109 FUNCTION: int vorbis_analysis_wrote ( vorbis_dsp_state* v, int vals ) ;
110 FUNCTION: int vorbis_analysis_blockout ( vorbis_dsp_state* v, vorbis_block* vb ) ;
111 FUNCTION: int vorbis_analysis ( vorbis_block* vb, ogg_packet* op ) ;
112 FUNCTION: int vorbis_bitrate_addblock ( vorbis_block* vb ) ;
113 FUNCTION: int vorbis_bitrate_flushpacket ( vorbis_dsp_state* vd,
115 FUNCTION: int vorbis_synthesis_headerin ( vorbis_info* vi, vorbis_comment* vc,
117 FUNCTION: int vorbis_synthesis_init ( vorbis_dsp_state* v, vorbis_info* vi ) ;
118 FUNCTION: int vorbis_synthesis_restart ( vorbis_dsp_state* v ) ;
119 FUNCTION: int vorbis_synthesis ( vorbis_block* vb, ogg_packet* op ) ;
120 FUNCTION: int vorbis_synthesis_trackonly ( vorbis_block* vb, ogg_packet* op ) ;
121 FUNCTION: int vorbis_synthesis_blockin ( vorbis_dsp_state* v, vorbis_block* vb ) ;
122 FUNCTION: int vorbis_synthesis_pcmout ( vorbis_dsp_state* v, float*** pcm ) ;
123 FUNCTION: int vorbis_synthesis_lapout ( vorbis_dsp_state* v, float*** pcm ) ;
124 FUNCTION: int vorbis_synthesis_read ( vorbis_dsp_state* v, int samples ) ;
125 FUNCTION: long vorbis_packet_blocksize ( vorbis_info* vi, ogg_packet* op ) ;
126 FUNCTION: int vorbis_synthesis_halfrate ( vorbis_info* v, int flag ) ;
127 FUNCTION: int vorbis_synthesis_halfrate_p ( vorbis_info* v ) ;
129 : OV_FALSE ( -- number ) -1 ; inline
130 : OV_EOF ( -- number ) -2 ; inline
131 : OV_HOLE ( -- number ) -3 ; inline
132 : OV_EREAD ( -- number ) -128 ; inline
133 : OV_EFAULT ( -- number ) -129 ; inline
134 : OV_EIMPL ( -- number ) -130 ; inline
135 : OV_EINVAL ( -- number ) -131 ; inline
136 : OV_ENOTVORBIS ( -- number ) -132 ; inline
137 : OV_EBADHEADER ( -- number ) -133 ; inline
138 : OV_EVERSION ( -- number ) -134 ; inline
139 : OV_ENOTAUDIO ( -- number ) -135 ; inline
140 : OV_EBADPACKET ( -- number ) -136 ; inline
141 : OV_EBADLINK ( -- number ) -137 ; inline
142 : OV_ENOSEEK ( -- number ) -138 ; inline