00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00062 #if !defined(_O_THEORA_CODEC_H_)
00063 # define _O_THEORA_CODEC_H_ (1)
00064 # include <ogg/ogg.h>
00065
00066 #if defined(__cplusplus)
00067 extern "C" {
00068 #endif
00069
00070
00071
00075 #define TH_EFAULT (-1)
00076
00077 #define TH_EINVAL (-10)
00078
00079 #define TH_EBADHEADER (-20)
00080
00081 #define TH_ENOTFORMAT (-21)
00082
00083 #define TH_EVERSION (-22)
00084
00085 #define TH_EIMPL (-23)
00086
00087 #define TH_EBADPACKET (-24)
00088
00091 #define TH_DUPFRAME (1)
00092
00098 typedef enum{
00101 TH_CS_UNSPECIFIED,
00103 TH_CS_ITU_REC_470M,
00105 TH_CS_ITU_REC_470BG,
00107 TH_CS_NSPACES
00108 }th_colorspace;
00109
00114 typedef enum{
00118 TH_PF_420,
00120 TH_PF_RSVD,
00124 TH_PF_422,
00127 TH_PF_444,
00129 TH_PF_NFORMATS
00130 }th_pixel_fmt;
00131
00132
00133
00142 typedef struct{
00144 int width;
00146 int height;
00148 int stride;
00150 unsigned char *data;
00151 }th_img_plane;
00152
00168 typedef th_img_plane th_ycbcr_buffer[3];
00169
00204 typedef struct{
00208 unsigned char version_major;
00209 unsigned char version_minor;
00210 unsigned char version_subminor;
00214 ogg_uint32_t frame_width;
00217 ogg_uint32_t frame_height;
00220 ogg_uint32_t pic_width;
00223 ogg_uint32_t pic_height;
00227 ogg_uint32_t pic_x;
00235 ogg_uint32_t pic_y;
00240 ogg_uint32_t fps_numerator;
00241 ogg_uint32_t fps_denominator;
00252 ogg_uint32_t aspect_numerator;
00253 ogg_uint32_t aspect_denominator;
00256 th_colorspace colorspace;
00258 th_pixel_fmt pixel_fmt;
00262
00263
00264
00265 int target_bitrate;
00271
00272
00273
00274
00275
00276
00277
00278
00279
00280
00281
00282
00283
00284
00285 int quality;
00299 int keyframe_granule_shift;
00300 }th_info;
00301
00326 typedef struct th_comment{
00328 char **user_comments;
00330 int *comment_lengths;
00332 int comments;
00335 char *vendor;
00336 }th_comment;
00337
00338
00339
00341 typedef unsigned char th_quant_base[64];
00342
00344 typedef struct{
00346 int nranges;
00349 const int *sizes;
00352 const th_quant_base *base_matrices;
00353 }th_quant_ranges;
00354
00412 typedef struct{
00414 ogg_uint16_t dc_scale[64];
00416 ogg_uint16_t ac_scale[64];
00418 unsigned char loop_filter_limits[64];
00420 th_quant_ranges qi_ranges[2][3];
00421 }th_quant_info;
00422
00423
00424
00426 #define TH_NHUFFMAN_TABLES (80)
00427
00428 #define TH_NDCT_TOKENS (32)
00429
00441 typedef struct{
00444 ogg_uint32_t pattern;
00447 int nbits;
00448 }th_huff_code;
00449
00450
00451
00459 extern const char *th_version_string(void);
00469 extern ogg_uint32_t th_version_number(void);
00479 extern ogg_int64_t th_granule_frame(void *_encdec,ogg_int64_t _granpos);
00491 extern double th_granule_time(void *_encdec,ogg_int64_t _granpos);
00501 extern int th_packet_isheader(ogg_packet *_op);
00512 extern int th_packet_iskeyframe(ogg_packet *_op);
00522 extern void th_info_init(th_info *_info);
00527 extern void th_info_clear(th_info *_info);
00528
00533 extern void th_comment_init(th_comment *_tc);
00543 extern void th_comment_add(th_comment *_tc, char *_comment);
00554 extern void th_comment_add_tag(th_comment *_tc,char *_tag,char *_val);
00570 extern char *th_comment_query(th_comment *_tc,char *_tag,int _count);
00578 extern int th_comment_query_count(th_comment *_tc,char *_tag);
00584 extern void th_comment_clear(th_comment *_tc);
00587
00588
00589
00590 #if defined(__cplusplus)
00591 }
00592 #endif
00593
00594 #endif