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
00052 typedef struct {
00053
int y_width;
00054
int y_height;
00055
int y_stride;
00056
00057
int uv_width;
00058
int uv_height;
00059
int uv_stride;
00060
unsigned char *y;
00061
unsigned char *u;
00062
unsigned char *v;
00063
00064 }
yuv_buffer;
00065
00069 typedef enum {
00070 OC_CS_UNSPECIFIED,
00071 OC_CS_ITU_REC_470M,
00072 OC_CS_ITU_REC_470BG,
00073 }
theora_colorspace;
00074
00075
typedef struct {
00076 ogg_uint32_t width;
00077 ogg_uint32_t height;
00078 ogg_uint32_t frame_width;
00079 ogg_uint32_t frame_height;
00080 ogg_uint32_t offset_x;
00081 ogg_uint32_t offset_y;
00082 ogg_uint32_t fps_numerator;
00083 ogg_uint32_t fps_denominator;
00084 ogg_uint32_t aspect_numerator;
00085 ogg_uint32_t aspect_denominator;
00086
theora_colorspace colorspace;
00087
int target_bitrate;
00088
int quality;
00089
int quick_p;
00091
00092
unsigned char version_major;
00093
unsigned char version_minor;
00094
unsigned char version_subminor;
00095
00096
void *codec_setup;
00097
00098
00099
int dropframes_p;
00100
int keyframe_auto_p;
00101 ogg_uint32_t keyframe_frequency;
00102 ogg_uint32_t keyframe_frequency_force;
00103
00104 ogg_uint32_t keyframe_data_target_bitrate;
00105 ogg_int32_t keyframe_auto_threshold;
00106 ogg_uint32_t keyframe_mindistance;
00107 ogg_int32_t noise_sensitivity;
00108 ogg_int32_t sharpness;
00109
00110 } theora_info;
00111
00112
typedef struct{
00113 theora_info *i;
00114 ogg_int64_t granulepos;
00115
00116
void *internal_encode;
00117
void *internal_decode;
00118
00119 } theora_state;
00120
00121
typedef struct theora_comment{
00122
char **user_comments;
00123
int *comment_lengths;
00124
int comments;
00125
char *vendor;
00126
00127 } theora_comment;
00128
00129
#define OC_FAULT -1
00130
#define OC_EINVAL -10
00131
#define OC_DISABLED -11
00132
#define OC_BADHEADER -20
00133
#define OC_NOTFORMAT -21
00134
#define OC_VERSION -22
00135
#define OC_IMPL -23
00136
#define OC_BADPACKET -24
00137
#define OC_NEWPACKET -25
00138
00143
extern const char *
theora_version_string(
void);
00144
00154
extern ogg_uint32_t
theora_version_number(
void);
00155
00162
extern int theora_encode_init(theora_state *th, theora_info *c);
00163
00172
extern int theora_encode_YUVin(theora_state *t,
yuv_buffer *yuv);
00173
00186
extern int theora_encode_packetout( theora_state *t,
int last_p,
00187 ogg_packet *op);
00188
00199
extern int theora_encode_header(theora_state *t, ogg_packet *op);
00200
00212
extern int theora_encode_comment(theora_comment *tc, ogg_packet *op);
00213
00224
extern int theora_encode_tables(theora_state *t, ogg_packet *op);
00225
00267
extern int theora_decode_header(theora_info *ci, theora_comment *cc,
00268 ogg_packet *op);
00269
00278
extern int theora_decode_init(theora_state *th, theora_info *c);
00279
00286
extern int theora_decode_packetin(theora_state *th,ogg_packet *op);
00287
00294
extern int theora_decode_YUVout(theora_state *th,
yuv_buffer *yuv);
00295
00304
extern double theora_granule_time(theora_state *th,ogg_int64_t granulepos);
00305
00314
extern ogg_int64_t
theora_granule_frame(theora_state *th,ogg_int64_t granulepos);
00315
00322
extern void theora_info_init(theora_info *c);
00323
00329
extern void theora_info_clear(theora_info *c);
00330
00335
extern void theora_clear(theora_state *t);
00336
00337
extern void theora_comment_init(theora_comment *tc);
00338
extern void theora_comment_add(theora_comment *tc,
char *comment);
00339
extern void theora_comment_add_tag(theora_comment *tc,
00340
char *tag,
char *value);
00341
extern char *theora_comment_query(theora_comment *tc,
char *tag,
int count);
00342
extern int theora_comment_query_count(theora_comment *tc,
char *tag);
00343
extern void theora_comment_clear(theora_comment *tc);
00344
00345
#ifdef __cplusplus
00346
}
00347
#endif
00348
00349
#endif