examples/SFExamples/oggvorbiscodec94/src/libogg/include/ogg/ogg.h

00001 /********************************************************************
00002  *                                                                  *
00003  * THIS FILE IS PART OF THE OggVorbis 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 OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2002             *
00009  * by the Xiph.Org Foundation http://www.xiph.org/                  *
00010  *                                                                  *
00011  ********************************************************************
00012 
00013  function: toplevel libogg include
00014  last mod: $Id: ogg.h,v 1.19 2002/09/15 23:48:02 xiphmont Exp $
00015 
00016  ********************************************************************/
00017 #ifndef _OGG_H
00018 #define _OGG_H
00019 
00020 #ifndef __SYMBIAN32__
00021 # define IMPORT_C extern
00022 # define EXPORT_C
00023 #else
00024 # ifndef __cplusplus
00025 #  undef IMPORT_C
00026 #  define IMPORT_C __declspec(dllexport)
00027 #  define EXPORT_C __declspec(dllexport)
00028 # endif
00029 #endif
00030 
00031 #ifdef __cplusplus
00032 extern "C" {
00033 #endif
00034 
00035 #include "ogg/os_types.h"
00036 
00037 typedef struct {
00038   long endbyte;
00039   int  endbit;
00040 
00041   unsigned char *buffer;
00042   unsigned char *ptr;
00043   long storage;
00044 } oggpack_buffer;
00045 
00046 /* ogg_page is used to encapsulate the data in one Ogg bitstream page *****/
00047 
00048 typedef struct {
00049   unsigned char *header;
00050   long header_len;
00051   unsigned char *body;
00052   long body_len;
00053 } ogg_page;
00054 
00055 /* ogg_stream_state contains the current encode/decode state of a logical
00056    Ogg bitstream **********************************************************/
00057 
00058 typedef struct {
00059   unsigned char   *body_data;    /* bytes from packet bodies */
00060   long    body_storage;          /* storage elements allocated */
00061   long    body_fill;             /* elements stored; fill mark */
00062   long    body_returned;         /* elements of fill returned */
00063 
00064 
00065   int     *lacing_vals;      /* The values that will go to the segment table */
00066   ogg_int64_t *granule_vals; /* granulepos values for headers. Not compact
00067                                 this way, but it is simple coupled to the
00068                                 lacing fifo */
00069   long    lacing_storage;
00070   long    lacing_fill;
00071   long    lacing_packet;
00072   long    lacing_returned;
00073 
00074   unsigned char    header[282];      /* working space for header encode */
00075   int              header_fill;
00076 
00077   int     e_o_s;          /* set when we have buffered the last packet in the
00078                              logical bitstream */
00079   int     b_o_s;          /* set after we've written the initial page
00080                              of a logical bitstream */
00081   long    serialno;
00082   long    pageno;
00083   ogg_int64_t  packetno;      /* sequence number for decode; the framing
00084                              knows where there's a hole in the data,
00085                              but we need coupling so that the codec
00086                              (which is in a seperate abstraction
00087                              layer) also knows about the gap */
00088   ogg_int64_t   granulepos;
00089 
00090 } ogg_stream_state;
00091 
00092 /* ogg_packet is used to encapsulate the data and metadata belonging
00093    to a single raw Ogg/Vorbis packet *************************************/
00094 
00095 typedef struct {
00096   unsigned char *packet;
00097   long  bytes;
00098   long  b_o_s;
00099   long  e_o_s;
00100 
00101   ogg_int64_t  granulepos;
00102   
00103   ogg_int64_t  packetno;     /* sequence number for decode; the framing
00104                                 knows where there's a hole in the data,
00105                                 but we need coupling so that the codec
00106                                 (which is in a seperate abstraction
00107                                 layer) also knows about the gap */
00108 } ogg_packet;
00109 
00110 typedef struct {
00111   unsigned char *data;
00112   int storage;
00113   int fill;
00114   int returned;
00115 
00116   int unsynced;
00117   int headerbytes;
00118   int bodybytes;
00119 } ogg_sync_state;
00120 
00121 /* Ogg BITSTREAM PRIMITIVES: bitstream ************************/
00122 
00123 IMPORT_C void  oggpack_writeinit(oggpack_buffer *b);
00124 IMPORT_C void  oggpack_writetrunc(oggpack_buffer *b,long bits);
00125 IMPORT_C void  oggpack_writealign(oggpack_buffer *b);
00126 IMPORT_C void  oggpack_writecopy(oggpack_buffer *b,void *source,long bits);
00127 IMPORT_C void  oggpack_reset(oggpack_buffer *b);
00128 IMPORT_C void  oggpack_writeclear(oggpack_buffer *b);
00129 IMPORT_C void  oggpack_readinit(oggpack_buffer *b,unsigned char *buf,int bytes);
00130 IMPORT_C void  oggpack_write(oggpack_buffer *b,unsigned long value,int bits);
00131 IMPORT_C long  oggpack_look(oggpack_buffer *b,int bits);
00132 IMPORT_C long  oggpack_look1(oggpack_buffer *b);
00133 IMPORT_C void  oggpack_adv(oggpack_buffer *b,int bits);
00134 IMPORT_C void  oggpack_adv1(oggpack_buffer *b);
00135 IMPORT_C long  oggpack_read(oggpack_buffer *b,int bits);
00136 IMPORT_C long  oggpack_read1(oggpack_buffer *b);
00137 IMPORT_C long  oggpack_bytes(oggpack_buffer *b);
00138 IMPORT_C long  oggpack_bits(oggpack_buffer *b);
00139 IMPORT_C unsigned char *oggpack_get_buffer(oggpack_buffer *b);
00140 
00141 IMPORT_C void  oggpackB_writeinit(oggpack_buffer *b);
00142 IMPORT_C void  oggpackB_writetrunc(oggpack_buffer *b,long bits);
00143 IMPORT_C void  oggpackB_writealign(oggpack_buffer *b);
00144 IMPORT_C void  oggpackB_writecopy(oggpack_buffer *b,void *source,long bits);
00145 IMPORT_C void  oggpackB_reset(oggpack_buffer *b);
00146 IMPORT_C void  oggpackB_writeclear(oggpack_buffer *b);
00147 IMPORT_C void  oggpackB_readinit(oggpack_buffer *b,unsigned char *buf,int bytes);
00148 IMPORT_C void  oggpackB_write(oggpack_buffer *b,unsigned long value,int bits);
00149 IMPORT_C long  oggpackB_look(oggpack_buffer *b,int bits);
00150 IMPORT_C long  oggpackB_look1(oggpack_buffer *b);
00151 IMPORT_C void  oggpackB_adv(oggpack_buffer *b,int bits);
00152 IMPORT_C void  oggpackB_adv1(oggpack_buffer *b);
00153 IMPORT_C long  oggpackB_read(oggpack_buffer *b,int bits);
00154 IMPORT_C long  oggpackB_read1(oggpack_buffer *b);
00155 IMPORT_C long  oggpackB_bytes(oggpack_buffer *b);
00156 IMPORT_C long  oggpackB_bits(oggpack_buffer *b);
00157 IMPORT_C unsigned char *oggpackB_get_buffer(oggpack_buffer *b);
00158 
00159 /* Ogg BITSTREAM PRIMITIVES: encoding **************************/
00160 
00161 IMPORT_C int      ogg_stream_packetin(ogg_stream_state *os, ogg_packet *op);
00162 IMPORT_C int      ogg_stream_pageout(ogg_stream_state *os, ogg_page *og);
00163 IMPORT_C int      ogg_stream_flush(ogg_stream_state *os, ogg_page *og);
00164 
00165 /* Ogg BITSTREAM PRIMITIVES: decoding **************************/
00166 
00167 IMPORT_C int      ogg_sync_init(ogg_sync_state *oy);
00168 IMPORT_C int      ogg_sync_clear(ogg_sync_state *oy);
00169 IMPORT_C int      ogg_sync_reset(ogg_sync_state *oy);
00170 IMPORT_C int    ogg_sync_destroy(ogg_sync_state *oy);
00171 
00172 IMPORT_C char    *ogg_sync_buffer(ogg_sync_state *oy, long size);
00173 IMPORT_C int      ogg_sync_wrote(ogg_sync_state *oy, long bytes);
00174 IMPORT_C long     ogg_sync_pageseek(ogg_sync_state *oy,ogg_page *og);
00175 IMPORT_C int      ogg_sync_pageout(ogg_sync_state *oy, ogg_page *og);
00176 IMPORT_C int      ogg_stream_pagein(ogg_stream_state *os, ogg_page *og);
00177 IMPORT_C int      ogg_stream_packetout(ogg_stream_state *os,ogg_packet *op);
00178 IMPORT_C int      ogg_stream_packetpeek(ogg_stream_state *os,ogg_packet *op);
00179 
00180 /* Ogg BITSTREAM PRIMITIVES: general ***************************/
00181 
00182 IMPORT_C int      ogg_stream_init(ogg_stream_state *os,int serialno);
00183 IMPORT_C int      ogg_stream_clear(ogg_stream_state *os);
00184 IMPORT_C int      ogg_stream_reset(ogg_stream_state *os);
00185 IMPORT_C int      ogg_stream_reset_serialno(ogg_stream_state *os,int serialno);
00186 IMPORT_C int      ogg_stream_destroy(ogg_stream_state *os);
00187 IMPORT_C int      ogg_stream_eos(ogg_stream_state *os);
00188 
00189 IMPORT_C void     ogg_page_checksum_set(ogg_page *og);
00190 
00191 IMPORT_C int      ogg_page_version(ogg_page *og);
00192 IMPORT_C int      ogg_page_continued(ogg_page *og);
00193 IMPORT_C int      ogg_page_bos(ogg_page *og);
00194 IMPORT_C int      ogg_page_eos(ogg_page *og);
00195 IMPORT_C ogg_int64_t  ogg_page_granulepos(ogg_page *og);
00196 IMPORT_C int      ogg_page_serialno(ogg_page *og);
00197 IMPORT_C long     ogg_page_pageno(ogg_page *og);
00198 IMPORT_C int      ogg_page_packets(ogg_page *og);
00199 
00200 IMPORT_C void     ogg_packet_clear(ogg_packet *op);
00201 
00202 
00203 #ifdef __cplusplus
00204 }
00205 #endif
00206 
00207 #endif  /* _OGG_H */
00208 
00209 
00210 
00211 
00212 
00213 

Generated by  doxygen 1.6.2