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
00060 typedef struct {
00061 int y_width;
00062 int y_height;
00063 int y_stride;
00065 int uv_width;
00066 int uv_height;
00067 int uv_stride;
00068 unsigned char *y;
00069 unsigned char *u;
00070 unsigned char *v;
00072 } yuv_buffer;
00073
00077 typedef enum {
00078 OC_CS_UNSPECIFIED,
00079 OC_CS_ITU_REC_470M,
00080 OC_CS_ITU_REC_470BG,
00081 } theora_colorspace;
00082
00103 typedef struct {
00104 ogg_uint32_t width;
00105 ogg_uint32_t height;
00106 ogg_uint32_t frame_width;
00107 ogg_uint32_t frame_height;
00108 ogg_uint32_t offset_x;
00109 ogg_uint32_t offset_y;
00110 ogg_uint32_t fps_numerator;
00111 ogg_uint32_t fps_denominator;
00112 ogg_uint32_t aspect_numerator;
00113 ogg_uint32_t aspect_denominator;
00114 theora_colorspace colorspace;
00115 int target_bitrate;
00116 int quality;
00117 int quick_p;
00119
00120 unsigned char version_major;
00121 unsigned char version_minor;
00122 unsigned char version_subminor;
00123
00124 void *codec_setup;
00125
00126
00127 int dropframes_p;
00128 int keyframe_auto_p;
00129 ogg_uint32_t keyframe_frequency;
00130 ogg_uint32_t keyframe_frequency_force;
00131
00132 ogg_uint32_t keyframe_data_target_bitrate;
00133 ogg_int32_t keyframe_auto_threshold;
00134 ogg_uint32_t keyframe_mindistance;
00135 ogg_int32_t noise_sensitivity;
00136 ogg_int32_t sharpness;
00137
00138 } theora_info;
00139
00142 typedef struct{
00143 theora_info *i;
00144 ogg_int64_t granulepos;
00145
00146 void *internal_encode;
00147 void *internal_decode;
00148
00149 } theora_state;
00150
00170 typedef struct theora_comment{
00171 char **user_comments;
00172 int *comment_lengths;
00173 int comments;
00174 char *vendor;
00176 } theora_comment;
00177
00178 #define OC_FAULT -1
00179 #define OC_EINVAL -10
00180 #define OC_DISABLED -11
00181 #define OC_BADHEADER -20
00182 #define OC_NOTFORMAT -21
00183 #define OC_VERSION -22
00184 #define OC_IMPL -23
00185 #define OC_BADPACKET -24
00186 #define OC_NEWPACKET -25
00192 extern const char *theora_version_string(void);
00193
00203 extern ogg_uint32_t theora_version_number(void);
00204
00211 extern int theora_encode_init(theora_state *th, theora_info *c);
00212
00221 extern int theora_encode_YUVin(theora_state *t, yuv_buffer *yuv);
00222
00235 extern int theora_encode_packetout( theora_state *t, int last_p,
00236 ogg_packet *op);
00237
00248 extern int theora_encode_header(theora_state *t, ogg_packet *op);
00249
00261 extern int theora_encode_comment(theora_comment *tc, ogg_packet *op);
00262
00273 extern int theora_encode_tables(theora_state *t, ogg_packet *op);
00274
00316 extern int theora_decode_header(theora_info *ci, theora_comment *cc,
00317 ogg_packet *op);
00318
00327 extern int theora_decode_init(theora_state *th, theora_info *c);
00328
00335 extern int theora_decode_packetin(theora_state *th,ogg_packet *op);
00336
00343 extern int theora_decode_YUVout(theora_state *th,yuv_buffer *yuv);
00344
00357 extern int theora_packet_isheader(ogg_packet *op);
00358
00369 extern int theora_packet_iskeyframe(ogg_packet *op);
00370
00382 extern ogg_int64_t theora_granule_frame(theora_state *th,ogg_int64_t granulepos);
00383
00392 extern double theora_granule_time(theora_state *th,ogg_int64_t granulepos);
00393
00400 extern void theora_info_init(theora_info *c);
00401
00407 extern void theora_info_clear(theora_info *c);
00408
00413 extern void theora_clear(theora_state *t);
00414
00416 extern void theora_comment_init(theora_comment *tc);
00420 extern void theora_comment_add(theora_comment *tc, char *comment);
00429 extern void theora_comment_add_tag(theora_comment *tc,
00430 char *tag, char *value);
00441 extern char *theora_comment_query(theora_comment *tc, char *tag, int count);
00449 extern int theora_comment_query_count(theora_comment *tc, char *tag);
00451 extern void theora_comment_clear(theora_comment *tc);
00452
00453 #ifdef __cplusplus
00454 }
00455 #endif
00456
00457 #endif