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 #include <stddef.h>
00027
00028 #include <ogg/ogg.h>
00029
00031
00032
00157 typedef struct {
00158 int y_width;
00159 int y_height;
00160 int y_stride;
00162 int uv_width;
00163 int uv_height;
00164 int uv_stride;
00165 unsigned char *y;
00166 unsigned char *u;
00167 unsigned char *v;
00169 } yuv_buffer;
00170
00174 typedef enum {
00175 OC_CS_UNSPECIFIED,
00176 OC_CS_ITU_REC_470M,
00177 OC_CS_ITU_REC_470BG,
00178 OC_CS_NSPACES
00179 } theora_colorspace;
00180
00188 typedef enum {
00189 OC_PF_420,
00190 OC_PF_RSVD,
00191 OC_PF_422,
00192 OC_PF_444,
00193 } theora_pixelformat;
00194
00216 typedef struct {
00217 ogg_uint32_t width;
00218 ogg_uint32_t height;
00219 ogg_uint32_t frame_width;
00220 ogg_uint32_t frame_height;
00221 ogg_uint32_t offset_x;
00222 ogg_uint32_t offset_y;
00223 ogg_uint32_t fps_numerator;
00224 ogg_uint32_t fps_denominator;
00225 ogg_uint32_t aspect_numerator;
00226 ogg_uint32_t aspect_denominator;
00227 theora_colorspace colorspace;
00228 int target_bitrate;
00229 int quality;
00230 int quick_p;
00232
00233 unsigned char version_major;
00234 unsigned char version_minor;
00235 unsigned char version_subminor;
00236
00237 void *codec_setup;
00238
00239
00240 int dropframes_p;
00241 int keyframe_auto_p;
00242 ogg_uint32_t keyframe_frequency;
00243 ogg_uint32_t keyframe_frequency_force;
00244
00245 ogg_uint32_t keyframe_data_target_bitrate;
00246 ogg_int32_t keyframe_auto_threshold;
00247 ogg_uint32_t keyframe_mindistance;
00248 ogg_int32_t noise_sensitivity;
00249 ogg_int32_t sharpness;
00250
00251 theora_pixelformat pixelformat;
00253 } theora_info;
00254
00257 typedef struct{
00258 theora_info *i;
00259 ogg_int64_t granulepos;
00260
00261 void *internal_encode;
00262 void *internal_decode;
00263
00264 } theora_state;
00265
00285 typedef struct theora_comment{
00286 char **user_comments;
00287 int *comment_lengths;
00288 int comments;
00289 char *vendor;
00291 } theora_comment;
00292
00293
00309 #define TH_DECCTL_GET_PPLEVEL_MAX (1)
00310
00316 #define TH_DECCTL_SET_PPLEVEL (3)
00317
00330 #define TH_ENCCTL_SET_KEYFRAME_FREQUENCY_FORCE (4)
00331
00339 #define TH_DECCTL_SET_GRANPOS (5)
00340
00341 #define TH_DECCTL_SET_TELEMETRY_MBMODE (9)
00342 #define TH_DECCTL_SET_TELEMETRY_MV (11)
00343 #define TH_DECCTL_SET_TELEMETRY_QI (13)
00344 #define TH_DECCTL_SET_TELEMETRY_BITS (15)
00345
00371 #define TH_ENCCTL_SET_QUANT_PARAMS (2)
00372
00399 #define TH_ENCCTL_SET_VP3_COMPATIBLE (10)
00400
00413 #define TH_ENCCTL_GET_SPLEVEL_MAX (12)
00414
00427 #define TH_ENCCTL_SET_SPLEVEL (14)
00428
00453 #define TH_ENCCTL_SET_DUP_COUNT (18)
00454
00456 #define OC_FAULT -1
00457 #define OC_EINVAL -10
00458 #define OC_DISABLED -11
00459 #define OC_BADHEADER -20
00460 #define OC_NOTFORMAT -21
00461 #define OC_VERSION -22
00462 #define OC_IMPL -23
00463 #define OC_BADPACKET -24
00464 #define OC_NEWPACKET -25
00465 #define OC_DUPFRAME 1
00471 extern const char *theora_version_string(void);
00472
00482 extern ogg_uint32_t theora_version_number(void);
00483
00490 extern int theora_encode_init(theora_state *th, theora_info *ti);
00491
00502 extern int theora_encode_YUVin(theora_state *t, yuv_buffer *yuv);
00503
00516 extern int theora_encode_packetout( theora_state *t, int last_p,
00517 ogg_packet *op);
00518
00529 extern int theora_encode_header(theora_state *t, ogg_packet *op);
00530
00542 extern int theora_encode_comment(theora_comment *tc, ogg_packet *op);
00543
00554 extern int theora_encode_tables(theora_state *t, ogg_packet *op);
00555
00597 extern int theora_decode_header(theora_info *ci, theora_comment *cc,
00598 ogg_packet *op);
00599
00608 extern int theora_decode_init(theora_state *th, theora_info *c);
00609
00617 extern int theora_decode_packetin(theora_state *th,ogg_packet *op);
00618
00629 extern int theora_decode_YUVout(theora_state *th,yuv_buffer *yuv);
00630
00643 extern int theora_packet_isheader(ogg_packet *op);
00644
00655 extern int theora_packet_iskeyframe(ogg_packet *op);
00656
00682 int theora_granule_shift(theora_info *ti);
00683
00700 extern ogg_int64_t theora_granule_frame(theora_state *th,ogg_int64_t granulepos);
00701
00717 extern double theora_granule_time(theora_state *th,ogg_int64_t granulepos);
00718
00725 extern void theora_info_init(theora_info *c);
00726
00732 extern void theora_info_clear(theora_info *c);
00733
00738 extern void theora_clear(theora_state *t);
00739
00744 extern void theora_comment_init(theora_comment *tc);
00745
00758 extern void theora_comment_add(theora_comment *tc, char *comment);
00759
00772 extern void theora_comment_add_tag(theora_comment *tc,
00773 char *tag, char *value);
00774
00789 extern char *theora_comment_query(theora_comment *tc, char *tag, int count);
00790
00800 extern int theora_comment_query_count(theora_comment *tc, char *tag);
00801
00806 extern void theora_comment_clear(theora_comment *tc);
00807
00816 extern int theora_control(theora_state *th,int req,void *buf,size_t buf_sz);
00817
00818
00819
00820 #ifdef __cplusplus
00821 }
00822 #endif
00823
00824 #endif