]> gitweb.factorcode.org Git - factor.git/blob - extra/ogg/vorbis/vorbis.factor
Fix Windows bootstrap
[factor.git] / extra / ogg / vorbis / vorbis.factor
1 ! Copyright (C) 2007 Chris Double.
2 ! See http://factorcode.org/license.txt for BSD license.
3 !
4 USING: kernel system combinators alien alien.syntax ogg ;
5 IN: ogg.vorbis
6
7 <<
8 "vorbis" {
9     { [ os winnt? ]  [ "vorbis.dll" ] }
10     { [ os macosx? ] [ "libvorbis.0.dylib" ] }
11     { [ os unix? ]   [ "libvorbis.so" ] }
12 } cond "cdecl" add-library 
13 >>
14
15 LIBRARY: vorbis
16
17 C-STRUCT: vorbis_info 
18     { "int" "version" }
19     { "int" "channels" }
20     { "long" "rate" }
21     { "long" "bitrate_upper" }
22     { "long" "bitrate_nominal" }
23     { "long" "bitrate_lower" }
24     { "long" "bitrate_window" }
25     { "void*" "codec_setup"} 
26     ;
27
28 C-STRUCT: vorbis_dsp_state
29     { "int" "analysisp" }
30     { "vorbis_info*" "vi" }
31     { "float**" "pcm" }
32     { "float**" "pcmret" }
33     { "int" "pcm_storage" }
34     { "int" "pcm_current" }
35     { "int" "pcm_returned" }
36     { "int" "preextrapolate" }
37     { "int" "eofflag" }
38     { "long" "lW" }
39     { "long" "W" }
40     { "long" "nW" }
41     { "long" "centerW" }
42     { "longlong" "granulepos" }
43     { "longlong" "sequence" }
44     { "longlong" "glue_bits" }
45     { "longlong" "time_bits" }
46     { "longlong" "floor_bits" }
47     { "longlong" "res_bits" }
48     { "void*" "backend_state" }
49     ;
50
51 C-STRUCT: alloc_chain
52     { "void*" "ptr" }
53     { "void*" "next" }
54     ;
55
56 C-STRUCT: vorbis_block
57     { "float**" "pcm" }
58     { "oggpack_buffer" "opb" }
59     { "long" "lW" }
60     { "long" "W" }
61     { "long" "nW" }
62     { "int" "pcmend" }
63     { "int" "mode" }
64     { "int" "eofflag" }
65     { "longlong" "granulepos" }
66     { "longlong" "sequence" }
67     { "vorbis_dsp_state*" "vd" }
68     { "void*" "localstore" }
69     { "long" "localtop" }
70     { "long" "localalloc" }
71     { "long" "totaluse" }
72     { "alloc_chain*" "reap" }
73     { "long" "glue_bits" }
74     { "long" "time_bits" }
75     { "long" "floor_bits" }
76     { "long" "res_bits" }
77     { "void*" "internal" }
78     ;
79
80 C-STRUCT: vorbis_comment
81     { "char**" "usercomments" }
82     { "int*" "comment_lengths" }
83     { "int" "comments" }
84     { "char*" "vendor" }
85     ;
86
87 FUNCTION: void     vorbis_info_init ( vorbis_info* vi ) ;
88 FUNCTION: void     vorbis_info_clear ( vorbis_info* vi ) ;
89 FUNCTION: int      vorbis_info_blocksize ( vorbis_info* vi, int zo ) ;
90 FUNCTION: void     vorbis_comment_init ( vorbis_comment* vc ) ;
91 FUNCTION: void     vorbis_comment_add ( vorbis_comment* vc, char* comment ) ;
92 FUNCTION: void     vorbis_comment_add_tag ( vorbis_comment* vc, char* tag, char* contents ) ;
93 FUNCTION: char*    vorbis_comment_query ( vorbis_comment* vc, char* tag, int count ) ;
94 FUNCTION: int      vorbis_comment_query_count ( vorbis_comment* vc, char* tag ) ;
95 FUNCTION: void     vorbis_comment_clear ( vorbis_comment* vc ) ;
96 FUNCTION: int      vorbis_block_init ( vorbis_dsp_state* v, vorbis_block* vb ) ;
97 FUNCTION: int      vorbis_block_clear ( vorbis_block* vb ) ;
98 FUNCTION: void     vorbis_dsp_clear ( vorbis_dsp_state* v ) ;
99 FUNCTION: double   vorbis_granule_time ( vorbis_dsp_state* v, longlong granulepos ) ;
100 FUNCTION: int      vorbis_analysis_init ( vorbis_dsp_state* v, vorbis_info* vi ) ;
101 FUNCTION: int      vorbis_commentheader_out ( vorbis_comment* vc, ogg_packet* op ) ;
102 FUNCTION: int      vorbis_analysis_headerout ( vorbis_dsp_state* v,
103                                           vorbis_comment* vc,
104                                           ogg_packet* op,
105                                           ogg_packet* op_comm,
106                                           ogg_packet* op_code ) ;
107 FUNCTION: float**  vorbis_analysis_buffer ( vorbis_dsp_state* v, int vals ) ;
108 FUNCTION: int      vorbis_analysis_wrote ( vorbis_dsp_state* v, int vals ) ;
109 FUNCTION: int      vorbis_analysis_blockout ( vorbis_dsp_state* v, vorbis_block* vb ) ;
110 FUNCTION: int      vorbis_analysis ( vorbis_block* vb, ogg_packet* op ) ;
111 FUNCTION: int      vorbis_bitrate_addblock ( vorbis_block* vb ) ;
112 FUNCTION: int      vorbis_bitrate_flushpacket ( vorbis_dsp_state* vd,
113                                            ogg_packet* op ) ;
114 FUNCTION: int      vorbis_synthesis_headerin ( vorbis_info* vi, vorbis_comment* vc,
115                                           ogg_packet* op ) ;
116 FUNCTION: int      vorbis_synthesis_init ( vorbis_dsp_state* v, vorbis_info* vi ) ;
117 FUNCTION: int      vorbis_synthesis_restart ( vorbis_dsp_state* v ) ;
118 FUNCTION: int      vorbis_synthesis ( vorbis_block* vb, ogg_packet* op ) ;
119 FUNCTION: int      vorbis_synthesis_trackonly ( vorbis_block* vb, ogg_packet* op ) ;
120 FUNCTION: int      vorbis_synthesis_blockin ( vorbis_dsp_state* v, vorbis_block* vb ) ;
121 FUNCTION: int      vorbis_synthesis_pcmout ( vorbis_dsp_state* v, float*** pcm ) ;
122 FUNCTION: int      vorbis_synthesis_lapout ( vorbis_dsp_state* v, float*** pcm ) ;
123 FUNCTION: int      vorbis_synthesis_read ( vorbis_dsp_state* v, int samples ) ;
124 FUNCTION: long     vorbis_packet_blocksize ( vorbis_info* vi, ogg_packet* op ) ;
125 FUNCTION: int      vorbis_synthesis_halfrate ( vorbis_info* v, int flag ) ;
126 FUNCTION: int      vorbis_synthesis_halfrate_p ( vorbis_info* v ) ;
127
128 : OV_FALSE ( -- number ) -1 ; inline
129 : OV_EOF ( -- number ) -2 ; inline
130 : OV_HOLE ( -- number ) -3 ; inline
131 : OV_EREAD ( -- number ) -128 ; inline
132 : OV_EFAULT ( -- number ) -129 ; inline
133 : OV_EIMPL ( -- number ) -130 ; inline
134 : OV_EINVAL ( -- number ) -131 ; inline
135 : OV_ENOTVORBIS ( -- number ) -132 ; inline
136 : OV_EBADHEADER ( -- number ) -133 ; inline
137 : OV_EVERSION ( -- number ) -134 ; inline
138 : OV_ENOTAUDIO ( -- number ) -135 ; inline
139 : OV_EBADPACKET ( -- number ) -136 ; inline
140 : OV_EBADLINK ( -- number ) -137 ; inline
141 : OV_ENOSEEK ( -- number ) -138 ; inline