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

Generated by  doxygen 1.6.2