• Main Page
  • Modules
  • Data Structures
  • Files
  • File List
  • Globals

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-2009                *
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 
00121 /*  @{ */
00122 
00147 typedef struct {
00148     int   y_width;      
00149     int   y_height;     
00150     int   y_stride;     
00152     int   uv_width;     
00153     int   uv_height;    
00154     int   uv_stride;    
00155     unsigned char *y;   
00156     unsigned char *u;   
00157     unsigned char *v;   
00159 } yuv_buffer;
00160 
00164 typedef enum {
00165   OC_CS_UNSPECIFIED,    
00166   OC_CS_ITU_REC_470M,   
00167   OC_CS_ITU_REC_470BG,  
00168   OC_CS_NSPACES         
00169 } theora_colorspace;
00170 
00178 typedef enum {
00179   OC_PF_420,    
00180   OC_PF_RSVD,   
00181   OC_PF_422,    
00182   OC_PF_444     
00183 } theora_pixelformat;
00184 
00206 typedef struct {
00207   ogg_uint32_t  width;          
00208   ogg_uint32_t  height;         
00209   ogg_uint32_t  frame_width;    
00210   ogg_uint32_t  frame_height;   
00211   ogg_uint32_t  offset_x;       
00212   ogg_uint32_t  offset_y;       
00213   ogg_uint32_t  fps_numerator;      
00214   ogg_uint32_t  fps_denominator;    
00215   ogg_uint32_t  aspect_numerator;   
00216   ogg_uint32_t  aspect_denominator; 
00217   theora_colorspace colorspace;     
00218   int           target_bitrate;     
00219   int           quality;  
00220   int           quick_p;  
00222   /* decode only */
00223   unsigned char version_major;
00224   unsigned char version_minor;
00225   unsigned char version_subminor;
00226 
00227   void *codec_setup;
00228 
00229   /* encode only */
00230   int           dropframes_p;
00231   int           keyframe_auto_p;
00232   ogg_uint32_t  keyframe_frequency;
00233   ogg_uint32_t  keyframe_frequency_force;  /* also used for decode init to
00234                                               get granpos shift correct */
00235   ogg_uint32_t  keyframe_data_target_bitrate;
00236   ogg_int32_t   keyframe_auto_threshold;
00237   ogg_uint32_t  keyframe_mindistance;
00238   ogg_int32_t   noise_sensitivity;
00239   ogg_int32_t   sharpness;
00240 
00241   theora_pixelformat pixelformat;       
00243 } theora_info;
00244 
00247 typedef struct{
00248   theora_info *i;
00249   ogg_int64_t granulepos;
00250 
00251   void *internal_encode;
00252   void *internal_decode;
00253 
00254 } theora_state;
00255 
00275 typedef struct theora_comment{
00276   char **user_comments;         
00277   int   *comment_lengths;       
00278   int    comments;              
00279   char  *vendor;                
00281 } theora_comment;
00282 
00283 
00285 /* \anchor decctlcodes_old
00286  * These are the available request codes for theora_control()
00287  * when called with a decoder instance.
00288  * By convention decoder control codes are odd, to distinguish 
00289  * them from \ref encctlcodes_old "encoder control codes" which
00290  * are even.
00291  *
00292  * Note that since the 1.0 release, both the legacy and the final
00293  * implementation accept all the same control codes, but only the
00294  * final API declares the newer codes.
00295  *
00296  * Keep any experimental or vendor-specific values above \c 0x8000.*/
00297 
00306 #define TH_DECCTL_GET_PPLEVEL_MAX (1)
00307 
00313 #define TH_DECCTL_SET_PPLEVEL (3)
00314 
00327 #define TH_ENCCTL_SET_KEYFRAME_FREQUENCY_FORCE (4)
00328 
00336 #define TH_DECCTL_SET_GRANPOS (5)
00337 
00353 #define TH_ENCCTL_SET_QUANT_PARAMS (2)
00354 
00382 #define TH_ENCCTL_SET_VP3_COMPATIBLE (10)
00383 
00397 #define TH_ENCCTL_GET_SPLEVEL_MAX (12)
00398 
00412 #define TH_ENCCTL_SET_SPLEVEL (14)
00413 
00416 #define OC_FAULT       -1       
00417 #define OC_EINVAL      -10      
00418 #define OC_DISABLED    -11      
00419 #define OC_BADHEADER   -20      
00420 #define OC_NOTFORMAT   -21      
00421 #define OC_VERSION     -22      
00422 #define OC_IMPL        -23      
00423 #define OC_BADPACKET   -24      
00424 #define OC_NEWPACKET   -25      
00425 #define OC_DUPFRAME    1        
00431 extern const char *theora_version_string(void);
00432 
00442 extern ogg_uint32_t theora_version_number(void);
00443 
00450 extern int theora_encode_init(theora_state *th, theora_info *ti);
00451 
00462 extern int theora_encode_YUVin(theora_state *t, yuv_buffer *yuv);
00463 
00476 extern int theora_encode_packetout( theora_state *t, int last_p,
00477                                     ogg_packet *op);
00478 
00489 extern int theora_encode_header(theora_state *t, ogg_packet *op);
00490 
00502 extern int theora_encode_comment(theora_comment *tc, ogg_packet *op);
00503 
00514 extern int theora_encode_tables(theora_state *t, ogg_packet *op);
00515 
00557 extern int theora_decode_header(theora_info *ci, theora_comment *cc,
00558                                 ogg_packet *op);
00559 
00568 extern int theora_decode_init(theora_state *th, theora_info *c);
00569 
00577 extern int theora_decode_packetin(theora_state *th,ogg_packet *op);
00578 
00589 extern int theora_decode_YUVout(theora_state *th,yuv_buffer *yuv);
00590 
00603 extern int theora_packet_isheader(ogg_packet *op);
00604 
00615 extern int theora_packet_iskeyframe(ogg_packet *op);
00616 
00642 int theora_granule_shift(theora_info *ti);
00643 
00660 extern ogg_int64_t theora_granule_frame(theora_state *th,ogg_int64_t granulepos);
00661 
00677 extern double theora_granule_time(theora_state *th,ogg_int64_t granulepos);
00678 
00685 extern void theora_info_init(theora_info *c);
00686 
00692 extern void theora_info_clear(theora_info *c);
00693 
00698 extern void theora_clear(theora_state *t);
00699 
00704 extern void theora_comment_init(theora_comment *tc);
00705 
00718 extern void theora_comment_add(theora_comment *tc, char *comment);
00719 
00732 extern void theora_comment_add_tag(theora_comment *tc,
00733                                        char *tag, char *value);
00734 
00749 extern char *theora_comment_query(theora_comment *tc, char *tag, int count);
00750 
00760 extern int   theora_comment_query_count(theora_comment *tc, char *tag);
00761 
00766 extern void  theora_comment_clear(theora_comment *tc);
00767 
00776 extern int theora_control(theora_state *th,int req,void *buf,size_t buf_sz);
00777 
00778 /* @} */ /* end oldfuncs doxygen group */
00779 
00780 #ifdef __cplusplus
00781 }
00782 #endif /* __cplusplus */
00783 
00784 #endif /* _O_THEORA_H_ */

Generated on Thu Sep 23 2010 for libtheora by  doxygen 1.7.1