]> gitweb.factorcode.org Git - factor.git/blob - extra/ogg/theora/theora.factor
change back other char/uchar* parameters that don't look like actual string types
[factor.git] / extra / ogg / theora / theora.factor
1 ! Copyright (C) 2007 Chris Double.
2 ! See http://factorcode.org/license.txt for BSD license.
3 !
4 USING: 
5     alien
6     alien.c-types 
7     alien.libraries
8     alien.syntax 
9     classes.struct
10     combinators 
11     kernel 
12     ogg
13     system
14 ;
15 IN: ogg.theora
16
17 <<
18 "theoradec" {
19     { [ os winnt? ]  [ "theoradec.dll" ] }
20     { [ os macosx? ] [ "libtheoradec.0.dylib" ] }
21     { [ os unix? ]   [ "libtheoradec.so" ] }
22 } cond "cdecl" add-library
23
24 "theoraenc" {
25     { [ os winnt? ]  [ "theoraenc.dll" ] }
26     { [ os macosx? ] [ "libtheoraenc.0.dylib" ] }
27     { [ os unix? ]   [ "libtheoraenc.so" ] }
28 } cond "cdecl" add-library
29 >>
30
31 CONSTANT: TH-EFAULT      -1
32 CONSTANT: TH-EINVAL     -10
33 CONSTANT: TH-EBADHEADER -20
34 CONSTANT: TH-ENOTFORMAT -21
35 CONSTANT: TH-EVERSION   -22
36 CONSTANT: TH-EIMPL      -23
37 CONSTANT: TH-EBADPACKET -24
38 CONSTANT: TH-DUPFRAME     1
39
40 TYPEDEF: int th-colorspace 
41 CONSTANT: TH-CS-UNSPECIFIED   0
42 CONSTANT: TH-CS-ITU-REC-470M  1
43 CONSTANT: TH-CS-ITU-REC-470BG 2
44 CONSTANT: TH-CS-NSPACES       3
45
46 TYPEDEF: int th-pixelformat
47 CONSTANT: TH-PF-RSVD     0
48 CONSTANT: TH-PF-422      1
49 CONSTANT: TH-PF-444      2
50 CONSTANT: TH-PF-NFORMATS 3
51
52 STRUCT: th-img-plane
53     { width int }
54     { height int }
55     { stride int }
56     { data uchar* }
57 ;
58
59 TYPEDEF: th-img-plane[3] th-ycbcr-buffer
60
61 STRUCT: th-info
62     { version-major uchar }
63     { version-minor uchar }
64     { version-subminor uchar }
65     { frame-width uint }
66     { frame-height uint }
67     { pic-width uint }
68     { pic-height uint }
69     { pic-x uint }
70     { pic-y uint }
71     { fps-numerator uint }
72     { fps-denominator uint }
73     { aspect-numerator uint }
74     { aspect-denominator uint }
75     { colorspace th-colorspace }
76     { pixel-fmt th-pixelformat }
77     { target-bitrate int }
78     { quality int }
79     { keyframe-granule-shift int }
80 ;
81
82 STRUCT: th-comment
83     { user-comments c-string* }
84     { comment-lengths int* }
85     { comments int }
86     { vendor c-string }
87 ;
88
89 TYPEDEF: uchar[64] th-quant-base
90
91 STRUCT: th-quant-ranges
92     { nranges int }
93     { sizes int* }
94     { base-matrices th-quant-base* }
95 ;
96
97 STRUCT: th-quant-info
98     { dc-scale { short 64 } }
99     { ac-scale { short 64 } }
100     { loop-filter-limits { uchar 64 } }
101     { qi-ranges { th-quant-ranges 2 3 } }
102 ;
103
104 CONSTANT: TH-NHUFFMANE-TABLES 80
105 CONSTANT: TH-NDCT-TOKENS 32
106
107 STRUCT: th-huff-code
108     { pattern int }
109     { nbits int }
110 ;
111
112 LIBRARY: theoradec
113 FUNCTION: c-string th_version_string ( ) ;
114 FUNCTION: uint th_version_number ( ) ;
115 FUNCTION: longlong th_granule_frame ( void* encdec, longlong granpos) ;
116 FUNCTION: int th_packet_isheader ( ogg-packet* op ) ;
117 FUNCTION: int th_packet_iskeyframe ( ogg-packet* op ) ;
118 FUNCTION: void th_info_init ( th-info* info ) ;
119 FUNCTION: void th_info_clear ( th-info* info ) ;
120 FUNCTION: void th_comment_init ( th-comment* tc ) ;
121 FUNCTION: void th_comment_add ( th-comment* tc, c-string comment ) ;
122 FUNCTION: void th_comment_add_tag ( th-comment* tc, c-string tag, c-string value ) ;
123 FUNCTION: c-string th_comment_query ( th-comment* tc, c-string tag, int count ) ;
124 FUNCTION: int   th_comment_query_count ( th-comment* tc, c-string tag ) ;
125 FUNCTION: void  th_comment_clear ( th-comment* tc ) ;
126
127 CONSTANT: TH-ENCCTL-SET-HUFFMAN-CODES 0
128 CONSTANT: TH-ENCCTL-SET-QUANT-PARAMS 2
129 CONSTANT: TH-ENCCTL-SET-KEYFRAME-FREQUENCY-FORCE 4
130 CONSTANT: TH-ENCCTL-SET-VP3-COMPATIBLE 10
131 CONSTANT: TH-ENCCTL-GET-SPLEVEL-MAX 12
132 CONSTANT: TH-ENCCTL-SET-SPLEVEL 14
133 CONSTANT: TH-ENCCTL-SET-DUP-COUNT 18
134 CONSTANT: TH-ENCCTL-SET-RATE-FLAGS 20
135 CONSTANT: TH-ENCCTL-SET-RATE-BUFFER 22
136 CONSTANT: TH-ENCCTL-2PASS-OUT 24
137 CONSTANT: TH-ENCCTL-2PASS-IN 26
138 CONSTANT: TH-ENCCTL-SET-QUALITY 28
139 CONSTANT: TH-ENCCTL-SET-BITRATE 30
140
141 CONSTANT: TH-RATECTL-DROP-FRAMES 1
142 CONSTANT: TH-RATECTL-CAP-OVERFLOW 2
143 CONSTANT: TH-RATECTL-CAP-UNDERFOW 4
144
145 TYPEDEF: void* th-enc-ctx
146
147 LIBRARY: theoraenc
148 FUNCTION: th-enc-ctx* th_encode_alloc ( th-info* info ) ;
149 FUNCTION: int th_encode_ctl ( th-enc-ctx* enc, int req, void* buf, int buf_sz ) ;
150 FUNCTION: int th_encode_flushheader ( th-enc-ctx* enc, th-comment* comments, ogg-packet* op ) ;
151 FUNCTION: int th_encode_ycbcr_in ( th-enc-ctx* enc, th-ycbcr-buffer ycbcr ) ;
152 FUNCTION: int th_encode_packetout ( th-enc-ctx* enc, int last, ogg-packet* op ) ;
153 FUNCTION: void th_encode_free ( th-enc-ctx* enc ) ;
154
155 CONSTANT: TH-DECCTL-GET-PPLEVEL-MAX 1
156 CONSTANT: TH-DECCTL-SET-PPLEVEL 3
157 CONSTANT: TH-DECCTL-SET-GRANPOS 5
158 CONSTANT: TH-DECCTL-SET-STRIPE-CB 7
159 CONSTANT: TH-DECCTL-SET-TELEMETRY-MBMODE 9
160 CONSTANT: TH-DECCTL-SET-TELEMETRY-MV 11
161 CONSTANT: TH-DECCTL-SET-TELEMETRY-QI 13
162 CONSTANT: TH-DECCTL-SET-TELEMETRY-BITS 15
163
164 TYPEDEF: void* th-stripe-decoded-func
165
166 STRUCT: th-stripe-callback
167     { ctx void* }
168     { stripe-decoded th-stripe-decoded-func }
169 ;
170
171 TYPEDEF: void* th-dec-ctx
172 TYPEDEF: void* th-setup-info
173
174 LIBRARY: theoradec
175 FUNCTION: int th_decode_headerin ( th-info* info, th-comment* tc, th-setup-info** setup, ogg-packet* op ) ;
176 FUNCTION: th-dec-ctx* th_decode_alloc ( th-info* info, th-setup-info* setup ) ;
177 FUNCTION: void th_setup_free ( th-setup-info* setup ) ;
178 FUNCTION: int th_decode_ctl ( th-dec-ctx* dec, int req, void* buf, int buf_sz ) ;
179 FUNCTION: int th_decode_packetin ( th-dec-ctx* dec, ogg-packet* op, longlong granpos ) ;
180 FUNCTION: int th_decode_ycbcr_out ( th-dec-ctx* dec, th-ycbcr-buffer ycbcr ) ;
181 FUNCTION: void th_decode_free ( th-dec-ctx* dec ) ;