00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018 #ifndef _O_THEORA_H_
00019 #define _O_THEORA_H_
00020
00021 #ifdef __cplusplus
00022 extern "C"
00023 {
00024 #endif
00025
00026 #ifndef LIBOGG2
00027 #include <ogg/ogg.h>
00028 #else
00029 #include <ogg2/ogg.h>
00030
00031 ogg_buffer_state *ogg_buffer_create(void);
00032 #endif
00033
00034 typedef struct {
00035 int y_width;
00036 int y_height;
00037 int y_stride;
00038
00039 int uv_width;
00040 int uv_height;
00041 int uv_stride;
00042 char *y;
00043 char *u;
00044 char *v;
00045
00046 } yuv_buffer;
00047
00048 typedef enum {
00049 OC_CS_UNSPECIFIED,
00050 OC_CS_ITU_REC_470M,
00051 OC_CS_ITU_REC_470BG,
00052 } theora_colorspace;
00053
00054 typedef struct {
00055 ogg_uint32_t width;
00056 ogg_uint32_t height;
00057 ogg_uint32_t frame_width;
00058 ogg_uint32_t frame_height;
00059 ogg_uint32_t offset_x;
00060 ogg_uint32_t offset_y;
00061 ogg_uint32_t fps_numerator;
00062 ogg_uint32_t fps_denominator;
00063 ogg_uint32_t aspect_numerator;
00064 ogg_uint32_t aspect_denominator;
00065 theora_colorspace colorspace;
00066 int target_bitrate;
00067 int quality;
00068 int quick_p;
00069
00070
00071 unsigned char version_major;
00072 unsigned char version_minor;
00073 unsigned char version_subminor;
00074
00075 void *codec_setup;
00076
00077
00078 int dropframes_p;
00079 int keyframe_auto_p;
00080 ogg_uint32_t keyframe_frequency;
00081 ogg_uint32_t keyframe_frequency_force;
00082
00083 ogg_uint32_t keyframe_data_target_bitrate;
00084 ogg_int32_t keyframe_auto_threshold;
00085 ogg_uint32_t keyframe_mindistance;
00086 ogg_int32_t noise_sensitivity;
00087 ogg_int32_t sharpness;
00088
00089 } theora_info;
00090
00091 typedef struct{
00092 theora_info *i;
00093 ogg_int64_t granulepos;
00094
00095 void *internal_encode;
00096 void *internal_decode;
00097
00098 } theora_state;
00099
00100 typedef struct theora_comment{
00101 char **user_comments;
00102 int *comment_lengths;
00103 int comments;
00104 char *vendor;
00105
00106 } theora_comment;
00107
00108 #define OC_FAULT -1
00109 #define OC_EINVAL -10
00110 #define OC_BADHEADER -20
00111 #define OC_NOTFORMAT -21
00112 #define OC_VERSION -22
00113 #define OC_IMPL -23
00114 #define OC_BADPACKET -24
00115 #define OC_NEWPACKET -25
00116
00117 extern const char* __cdecl theora_version_string(void);
00118 extern ogg_uint32_t __cdecl theora_version_number(void);
00119 extern int __cdecl theora_encode_init(theora_state *th, theora_info *c);
00120 extern int __cdecl theora_encode_YUVin(theora_state *t, yuv_buffer *yuv);
00121 extern int __cdecl theora_encode_packetout( theora_state *t, int last_p,
00122 ogg_packet *op);
00123 extern int __cdecl theora_encode_header(theora_state *t, ogg_packet *op);
00124 extern int __cdecl theora_encode_comment(theora_comment *tc, ogg_packet *op);
00125 extern int __cdecl theora_encode_tables(theora_state *t, ogg_packet *op);
00126 extern int __cdecl theora_decode_header(theora_info *ci, theora_comment *cc,
00127 ogg_packet *op);
00128 extern int __cdecl theora_decode_init(theora_state *th, theora_info *c);
00129 extern int __cdecl theora_decode_packetin(theora_state *th,ogg_packet *op);
00130 extern int __cdecl theora_decode_YUVout(theora_state *th,yuv_buffer *yuv);
00131 extern double __cdecl theora_granule_time(theora_state *th,ogg_int64_t granulepos);
00132 extern void __cdecl theora_info_init(theora_info *c);
00133 extern void __cdecl theora_info_clear(theora_info *c);
00134 extern void __cdecl theora_clear(theora_state *t);
00135
00136 extern void __cdecl theora_comment_init(theora_comment *tc);
00137 extern void __cdecl theora_comment_add(theora_comment *tc, char *comment);
00138 extern void __cdecl theora_comment_add_tag(theora_comment *tc,
00139 char *tag, char *value);
00140 extern char *__cdecl theora_comment_query(theora_comment *tc, char *tag, int count);
00141 extern int __cdecl theora_comment_query_count(theora_comment *tc, char *tag);
00142 extern void __cdecl theora_comment_clear(theora_comment *tc);
00143
00144 #ifdef __cplusplus
00145 }
00146 #endif
00147
00148 #endif