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{
00116 TH_PF_420,
00118 TH_PF_RSVD,
00120 TH_PF_422,
00122 TH_PF_444,
00124 TH_PF_NFORMATS
00125 }th_pixel_fmt;
00126
00127
00128
00137 typedef struct{
00139 int width;
00141 int height;
00143 int stride;
00145 unsigned char *data;
00146 }th_img_plane;
00147
00163 typedef th_img_plane th_ycbcr_buffer[3];
00164
00199 typedef struct{
00203 unsigned char version_major;
00204 unsigned char version_minor;
00205 unsigned char version_subminor;
00209 ogg_uint32_t frame_width;
00212 ogg_uint32_t frame_height;
00215 ogg_uint32_t pic_width;
00218 ogg_uint32_t pic_height;
00222 ogg_uint32_t pic_x;
00230 ogg_uint32_t pic_y;
00235 ogg_uint32_t fps_numerator;
00236 ogg_uint32_t fps_denominator;
00247 ogg_uint32_t aspect_numerator;
00248 ogg_uint32_t aspect_denominator;
00251 th_colorspace colorspace;
00253 th_pixel_fmt pixel_fmt;
00257
00258
00259
00260 int target_bitrate;
00266
00267
00268
00269
00270
00271
00272
00273
00274
00275
00276
00277
00278
00279
00280 int quality;
00294 int keyframe_granule_shift;
00295 }th_info;
00296
00321 typedef struct th_comment{
00323 char **user_comments;
00325 int *comment_lengths;
00327 int comments;
00330 char *vendor;
00331 }th_comment;
00332
00333
00334
00336 typedef unsigned char th_quant_base[64];
00337
00339 typedef struct{
00341 int nranges;
00344 const int *sizes;
00347 const th_quant_base *base_matrices;
00348 }th_quant_ranges;
00349
00407 typedef struct{
00409 ogg_uint16_t dc_scale[64];
00411 ogg_uint16_t ac_scale[64];
00413 unsigned char loop_filter_limits[64];
00415 th_quant_ranges qi_ranges[2][3];
00416 }th_quant_info;
00417
00418
00419
00421 #define TH_NHUFFMAN_TABLES (80)
00422
00423 #define TH_NDCT_TOKENS (32)
00424
00436 typedef struct{
00439 ogg_uint32_t pattern;
00442 int nbits;
00443 }th_huff_code;
00444
00445
00446
00454 extern const char *th_version_string(void);
00464 extern ogg_uint32_t th_version_number(void);
00474 extern ogg_int64_t th_granule_frame(void *_encdec,ogg_int64_t _granpos);
00486 extern double th_granule_time(void *_encdec,ogg_int64_t _granpos);
00496 extern int th_packet_isheader(ogg_packet *_op);
00507 extern int th_packet_iskeyframe(ogg_packet *_op);
00517 extern void th_info_init(th_info *_info);
00522 extern void th_info_clear(th_info *_info);
00523
00528 extern void th_comment_init(th_comment *_tc);
00538 extern void th_comment_add(th_comment *_tc, char *_comment);
00549 extern void th_comment_add_tag(th_comment *_tc,char *_tag,char *_val);
00565 extern char *th_comment_query(th_comment *_tc,char *_tag,int _count);
00573 extern int th_comment_query_count(th_comment *_tc,char *_tag);
00579 extern void th_comment_clear(th_comment *_tc);
00582
00583
00584
00585 #if defined(__cplusplus)
00586 }
00587 #endif
00588
00589 #endif