00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00044 #if !defined(_O_THEORA_CODEC_H_)
00045 # define _O_THEORA_CODEC_H_ (1)
00046 # include <ogg/ogg.h>
00047
00048 #if defined(__cplusplus)
00049 extern "C" {
00050 #endif
00051
00052
00053
00057 #define TH_EFAULT (-1)
00058
00059 #define TH_EINVAL (-10)
00060
00061 #define TH_EBADHEADER (-20)
00062
00063 #define TH_ENOTFORMAT (-21)
00064
00065 #define TH_EVERSION (-22)
00066
00067 #define TH_EIMPL (-23)
00068
00069 #define TH_EBADPACKET (-24)
00070
00073 #define TH_DUPFRAME (1)
00074
00080 typedef enum{
00083 TH_CS_UNSPECIFIED,
00085 TH_CS_ITU_REC_470M,
00087 TH_CS_ITU_REC_470BG,
00089 TH_CS_NSPACES
00090 }th_colorspace;
00091
00096 typedef enum{
00098 TH_PF_420,
00100 TH_PF_RSVD,
00102 TH_PF_422,
00104 TH_PF_444,
00106 TH_PF_NFORMATS
00107 }th_pixel_fmt;
00108
00109
00110
00119 typedef struct{
00121 int width;
00123 int height;
00125 int ystride;
00127 unsigned char *data;
00128 }th_img_plane;
00129
00145 typedef th_img_plane th_ycbcr_buffer[3];
00146
00181 typedef struct{
00185 unsigned char version_major;
00186 unsigned char version_minor;
00187 unsigned char version_subminor;
00191 ogg_uint32_t frame_width;
00194 ogg_uint32_t frame_height;
00197 ogg_uint32_t pic_width;
00200 ogg_uint32_t pic_height;
00204 ogg_uint32_t pic_x;
00212 ogg_uint32_t pic_y;
00217 ogg_uint32_t fps_numerator;
00218 ogg_uint32_t fps_denominator;
00229 ogg_uint32_t aspect_numerator;
00230 ogg_uint32_t aspect_denominator;
00233 th_colorspace colorspace;
00235 th_pixel_fmt pixel_fmt;
00239
00240
00241
00242 int target_bitrate;
00248
00249
00250
00251
00252
00253
00254
00255
00256
00257
00258
00259
00260
00261
00262 int quality;
00276 int keyframe_granule_shift;
00277 }th_info;
00278
00303 typedef struct th_comment{
00305 char **user_comments;
00307 int *comment_lengths;
00309 int comments;
00312 char *vendor;
00313 }th_comment;
00314
00315
00316
00318 typedef unsigned char th_quant_base[64];
00319
00321 typedef struct{
00323 int nranges;
00326 const int *sizes;
00329 const th_quant_base *base_matrices;
00330 }th_quant_ranges;
00331
00389 typedef struct{
00391 ogg_uint16_t dc_scale[64];
00393 ogg_uint16_t ac_scale[64];
00395 unsigned char loop_filter_limits[64];
00397 th_quant_ranges qi_ranges[2][3];
00398 }th_quant_info;
00399
00400
00401
00403 #define TH_NHUFFMAN_TABLES (80)
00404
00405 #define TH_NDCT_TOKENS (32)
00406
00418 typedef struct{
00421 ogg_uint32_t pattern;
00424 int nbits;
00425 }th_huff_code;
00426
00427
00428
00436 extern const char *th_version_string(void);
00446 extern ogg_uint32_t th_version_number(void);
00455 extern ogg_int64_t th_granule_frame(void *_encdec,ogg_int64_t _granpos);
00464 extern double th_granule_time(void *_encdec,ogg_int64_t _granpos);
00474 extern int th_packet_isheader(ogg_packet *_op);
00485 extern int th_packet_iskeyframe(ogg_packet *_op);
00495 extern void th_info_init(th_info *_info);
00500 extern void th_info_clear(th_info *_info);
00501
00506 extern void th_comment_init(th_comment *_tc);
00516 extern void th_comment_add(th_comment *_tc, char *_comment);
00527 extern void th_comment_add_tag(th_comment *_tc,char *_tag,char *_val);
00543 extern char *th_comment_query(th_comment *_tc,char *_tag,int _count);
00551 extern int th_comment_query_count(th_comment *_tc,char *_tag);
00557 extern void th_comment_clear(th_comment *_tc);
00560
00561
00562
00563 #if defined(__cplusplus)
00564 }
00565 #endif
00566
00567 #endif