1 ! Copyright (C) 2007 Chris Double.
2 ! See http://factorcode.org/license.txt for BSD license.
4 USING: kernel system combinators alien alien.syntax ;
9 { [ os winnt? ] [ "theora.dll" ] }
10 { [ os macosx? ] [ "libtheora.0.dylib" ] }
11 { [ os unix? ] [ "libtheora.so" ] }
12 } cond "cdecl" add-library
28 : OC_CS_UNSPECIFIED ( -- number ) 0 ; inline
29 : OC_CS_ITU_REC_470M ( -- number ) 1 ; inline
30 : OC_CS_ITU_REC_470BG ( -- number ) 2 ; inline
31 : OC_CS_NSPACES ( -- number ) 3 ; inline
33 TYPEDEF: int theora_colorspace
35 : OC_PF_420 ( -- number ) 0 ; inline
36 : OC_PF_RSVD ( -- number ) 1 ; inline
37 : OC_PF_422 ( -- number ) 2 ; inline
38 : OC_PF_444 ( -- number ) 3 ; inline
40 TYPEDEF: int theora_pixelformat
45 { "uint" "frame_width" }
46 { "uint" "frame_height" }
49 { "uint" "fps_numerator" }
50 { "uint" "fps_denominator" }
51 { "uint" "aspect_numerator" }
52 { "uint" "aspect_denominator" }
53 { "theora_colorspace" "colorspace" }
54 { "int" "target_bitrate" }
57 { "uchar" "version_major" }
58 { "uchar" "version_minor" }
59 { "uchar" "version_subminor" }
60 { "void*" "codec_setup" }
61 { "int" "dropframes_p" }
62 { "int" "keyframe_auto_p" }
63 { "uint" "keyframe_frequency" }
64 { "uint" "keyframe_frequency_force" }
65 { "uint" "keyframe_data_target_bitrate" }
66 { "int" "keyframe_auto_threshold" }
67 { "uint" "keyframe_mindistance" }
68 { "int" "noise_sensitivity" }
70 { "theora_pixelformat" "pixelformat" } ;
72 C-STRUCT: theora_state
73 { "theora_info*" "i" }
74 { "longlong" "granulepos" }
75 { "void*" "internal_encode" }
76 { "void*" "internal_decode" } ;
78 C-STRUCT: theora_comment
79 { "char**" "user_comments" }
80 { "int*" "comment_lengths" }
82 { "char*" "vendor" } ;
84 : OC_FAULT ( -- number ) -1 ; inline
85 : OC_EINVAL ( -- number ) -10 ; inline
86 : OC_DISABLED ( -- number ) -11 ; inline
87 : OC_BADHEADER ( -- number ) -20 ; inline
88 : OC_NOTFORMAT ( -- number ) -21 ; inline
89 : OC_VERSION ( -- number ) -22 ; inline
90 : OC_IMPL ( -- number ) -23 ; inline
91 : OC_BADPACKET ( -- number ) -24 ; inline
92 : OC_NEWPACKET ( -- number ) -25 ; inline
93 : OC_DUPFRAME ( -- number ) 1 ; inline
95 FUNCTION: char* theora_version_string ( ) ;
96 FUNCTION: uint theora_version_number ( ) ;
97 FUNCTION: int theora_encode_init ( theora_state* th, theora_info* ti ) ;
98 FUNCTION: int theora_encode_YUVin ( theora_state* t, yuv_buffer* yuv ) ;
99 FUNCTION: int theora_encode_packetout ( theora_state* t, int last_p, ogg_packet* op ) ;
100 FUNCTION: int theora_encode_header ( theora_state* t, ogg_packet* op ) ;
101 FUNCTION: int theora_encode_comment ( theora_comment* tc, ogg_packet* op ) ;
102 FUNCTION: int theora_encode_tables ( theora_state* t, ogg_packet* op ) ;
103 FUNCTION: int theora_decode_header ( theora_info* ci, theora_comment* cc, ogg_packet* op ) ;
104 FUNCTION: int theora_decode_init ( theora_state* th, theora_info* c ) ;
105 FUNCTION: int theora_decode_packetin ( theora_state* th, ogg_packet* op ) ;
106 FUNCTION: int theora_decode_YUVout ( theora_state* th, yuv_buffer* yuv ) ;
107 FUNCTION: int theora_packet_isheader ( ogg_packet* op ) ;
108 FUNCTION: int theora_packet_iskeyframe ( ogg_packet* op ) ;
109 FUNCTION: int theora_granule_shift ( theora_info* ti ) ;
110 FUNCTION: longlong theora_granule_frame ( theora_state* th, longlong granulepos ) ;
111 FUNCTION: double theora_granule_time ( theora_state* th, longlong granulepos ) ;
112 FUNCTION: void theora_info_init ( theora_info* c ) ;
113 FUNCTION: void theora_info_clear ( theora_info* c ) ;
114 FUNCTION: void theora_clear ( theora_state* t ) ;
115 FUNCTION: void theora_comment_init ( theora_comment* tc ) ;
116 FUNCTION: void theora_comment_add ( theora_comment* tc, char* comment ) ;
117 FUNCTION: void theora_comment_add_tag ( theora_comment* tc, char* tag, char* value ) ;
118 FUNCTION: char* theora_comment_query ( theora_comment* tc, char* tag, int count ) ;
119 FUNCTION: int theora_comment_query_count ( theora_comment* tc, char* tag ) ;
120 FUNCTION: void theora_comment_clear ( theora_comment* tc ) ;