theora.h

Go to the documentation of this file.
00001 /********************************************************************
00002  *                                                                  *
00003  * THIS FILE IS PART OF THE OggTheora SOFTWARE CODEC SOURCE CODE.   *
00004  * USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS     *
00005  * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
00006  * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING.       *
00007  *                                                                  *
00008  * THE Theora SOURCE CODE IS COPYRIGHT (C) 2002-2007                *
00009  * by the Xiph.Org Foundation http://www.xiph.org/                  *
00010  *                                                                  *
00011  ********************************************************************
00012 
00013   function:
00014   last mod: $Id: theora.h,v 1.17 2003/12/06 18:06:19 arc Exp $
00015 
00016  ********************************************************************/
00017 
00018 #ifndef _O_THEORA_H_
00019 #define _O_THEORA_H_
00020 
00021 #ifdef __cplusplus
00022 extern "C"
00023 {
00024 #endif /* __cplusplus */
00025 
00026 #include <stddef.h>     /* for size_t */
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   /* decode only */
00233   unsigned char version_major;
00234   unsigned char version_minor;
00235   unsigned char version_subminor;
00236 
00237   void *codec_setup;
00238 
00239   /* encode only */
00240   int           dropframes_p;
00241   int           keyframe_auto_p;
00242   ogg_uint32_t  keyframe_frequency;
00243   ogg_uint32_t  keyframe_frequency_force;  /* also used for decode init to
00244                                               get granpos shift correct */
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 
00325 #define TH_DECCTL_SET_GRANPOS (5)
00326 
00327 
00348 #define TH_ENCCTL_SET_HUFFMAN_CODES (0)
00349 
00367 #define TH_ENCCTL_SET_QUANT_PARAMS (2)
00368 
00380 #define TH_ENCCTL_SET_KEYFRAME_FREQUENCY_FORCE (4)
00381 
00408 #define TH_ENCCTL_SET_VP3_COMPATIBLE (10)
00409 
00422 #define TH_ENCCTL_GET_SPLEVEL_MAX (12)
00423 
00436 #define TH_ENCCTL_SET_SPLEVEL (14)
00437 
00456 #define TH_ENCCTL_SETUP_VBR (16)
00457 
00471 #define TH_ENCCTL_SETUP_CQI (18)
00472 
00474 #define OC_FAULT       -1       
00475 #define OC_EINVAL      -10      
00476 #define OC_DISABLED    -11      
00477 #define OC_BADHEADER   -20      
00478 #define OC_NOTFORMAT   -21      
00479 #define OC_VERSION     -22      
00480 #define OC_IMPL        -23      
00481 #define OC_BADPACKET   -24      
00482 #define OC_NEWPACKET   -25      
00483 #define OC_DUPFRAME    1        
00489 extern const char *theora_version_string(void);
00490 
00500 extern ogg_uint32_t theora_version_number(void);
00501 
00508 extern int theora_encode_init(theora_state *th, theora_info *ti);
00509 
00520 extern int theora_encode_YUVin(theora_state *t, yuv_buffer *yuv);
00521 
00534 extern int theora_encode_packetout( theora_state *t, int last_p,
00535                                     ogg_packet *op);
00536 
00547 extern int theora_encode_header(theora_state *t, ogg_packet *op);
00548 
00560 extern int theora_encode_comment(theora_comment *tc, ogg_packet *op);
00561 
00572 extern int theora_encode_tables(theora_state *t, ogg_packet *op);
00573 
00615 extern int theora_decode_header(theora_info *ci, theora_comment *cc,
00616                                 ogg_packet *op);
00617 
00626 extern int theora_decode_init(theora_state *th, theora_info *c);
00627 
00635 extern int theora_decode_packetin(theora_state *th,ogg_packet *op);
00636 
00647 extern int theora_decode_YUVout(theora_state *th,yuv_buffer *yuv);
00648 
00661 extern int theora_packet_isheader(ogg_packet *op);
00662 
00673 extern int theora_packet_iskeyframe(ogg_packet *op);
00674 
00700 int theora_granule_shift(theora_info *ti);
00701 
00718 extern ogg_int64_t theora_granule_frame(theora_state *th,ogg_int64_t granulepos);
00719 
00735 extern double theora_granule_time(theora_state *th,ogg_int64_t granulepos);
00736 
00743 extern void theora_info_init(theora_info *c);
00744 
00750 extern void theora_info_clear(theora_info *c);
00751 
00756 extern void theora_clear(theora_state *t);
00757 
00762 extern void theora_comment_init(theora_comment *tc);
00763 
00776 extern void theora_comment_add(theora_comment *tc, char *comment);
00777 
00790 extern void theora_comment_add_tag(theora_comment *tc,
00791                                        char *tag, char *value);
00792 
00807 extern char *theora_comment_query(theora_comment *tc, char *tag, int count);
00808 
00818 extern int   theora_comment_query_count(theora_comment *tc, char *tag);
00819 
00824 extern void  theora_comment_clear(theora_comment *tc);
00825 
00834 extern int theora_control(theora_state *th,int req,void *buf,size_t buf_sz);
00835 
00836 /* @} */ /* end oldfuncs doxygen group */
00837 
00838 #ifdef __cplusplus
00839 }
00840 #endif /* __cplusplus */
00841 
00842 #endif /* _O_THEORA_H_ */

Generated on Wed Apr 16 13:30:39 2008 for libtheora by  doxygen 1.5.3