nuclear@0: /******************************************************************** nuclear@0: * * nuclear@0: * THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE. * nuclear@0: * USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS * nuclear@0: * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE * nuclear@0: * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. * nuclear@0: * * nuclear@0: * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2007 * nuclear@0: * by the Xiph.Org Foundation http://www.xiph.org/ * nuclear@0: * * nuclear@0: ******************************************************************** nuclear@0: nuclear@0: function: toplevel libogg include nuclear@0: last mod: $Id: ogg.h 18044 2011-08-01 17:55:20Z gmaxwell $ nuclear@0: nuclear@0: ********************************************************************/ nuclear@0: #ifndef _OGG_H nuclear@0: #define _OGG_H nuclear@0: nuclear@0: #ifdef __cplusplus nuclear@0: extern "C" { nuclear@0: #endif nuclear@0: nuclear@0: #include nuclear@0: #include nuclear@0: nuclear@0: typedef struct { nuclear@0: void *iov_base; nuclear@0: size_t iov_len; nuclear@0: } ogg_iovec_t; nuclear@0: nuclear@0: typedef struct { nuclear@0: long endbyte; nuclear@0: int endbit; nuclear@0: nuclear@0: unsigned char *buffer; nuclear@0: unsigned char *ptr; nuclear@0: long storage; nuclear@0: } oggpack_buffer; nuclear@0: nuclear@0: /* ogg_page is used to encapsulate the data in one Ogg bitstream page *****/ nuclear@0: nuclear@0: typedef struct { nuclear@0: unsigned char *header; nuclear@0: long header_len; nuclear@0: unsigned char *body; nuclear@0: long body_len; nuclear@0: } ogg_page; nuclear@0: nuclear@0: /* ogg_stream_state contains the current encode/decode state of a logical nuclear@0: Ogg bitstream **********************************************************/ nuclear@0: nuclear@0: typedef struct { nuclear@0: unsigned char *body_data; /* bytes from packet bodies */ nuclear@0: long body_storage; /* storage elements allocated */ nuclear@0: long body_fill; /* elements stored; fill mark */ nuclear@0: long body_returned; /* elements of fill returned */ nuclear@0: nuclear@0: nuclear@0: int *lacing_vals; /* The values that will go to the segment table */ nuclear@0: ogg_int64_t *granule_vals; /* granulepos values for headers. Not compact nuclear@0: this way, but it is simple coupled to the nuclear@0: lacing fifo */ nuclear@0: long lacing_storage; nuclear@0: long lacing_fill; nuclear@0: long lacing_packet; nuclear@0: long lacing_returned; nuclear@0: nuclear@0: unsigned char header[282]; /* working space for header encode */ nuclear@0: int header_fill; nuclear@0: nuclear@0: int e_o_s; /* set when we have buffered the last packet in the nuclear@0: logical bitstream */ nuclear@0: int b_o_s; /* set after we've written the initial page nuclear@0: of a logical bitstream */ nuclear@0: long serialno; nuclear@0: long pageno; nuclear@0: ogg_int64_t packetno; /* sequence number for decode; the framing nuclear@0: knows where there's a hole in the data, nuclear@0: but we need coupling so that the codec nuclear@0: (which is in a separate abstraction nuclear@0: layer) also knows about the gap */ nuclear@0: ogg_int64_t granulepos; nuclear@0: nuclear@0: } ogg_stream_state; nuclear@0: nuclear@0: /* ogg_packet is used to encapsulate the data and metadata belonging nuclear@0: to a single raw Ogg/Vorbis packet *************************************/ nuclear@0: nuclear@0: typedef struct { nuclear@0: unsigned char *packet; nuclear@0: long bytes; nuclear@0: long b_o_s; nuclear@0: long e_o_s; nuclear@0: nuclear@0: ogg_int64_t granulepos; nuclear@0: nuclear@0: ogg_int64_t packetno; /* sequence number for decode; the framing nuclear@0: knows where there's a hole in the data, nuclear@0: but we need coupling so that the codec nuclear@0: (which is in a separate abstraction nuclear@0: layer) also knows about the gap */ nuclear@0: } ogg_packet; nuclear@0: nuclear@0: typedef struct { nuclear@0: unsigned char *data; nuclear@0: int storage; nuclear@0: int fill; nuclear@0: int returned; nuclear@0: nuclear@0: int unsynced; nuclear@0: int headerbytes; nuclear@0: int bodybytes; nuclear@0: } ogg_sync_state; nuclear@0: nuclear@0: /* Ogg BITSTREAM PRIMITIVES: bitstream ************************/ nuclear@0: nuclear@0: extern void oggpack_writeinit(oggpack_buffer *b); nuclear@0: extern int oggpack_writecheck(oggpack_buffer *b); nuclear@0: extern void oggpack_writetrunc(oggpack_buffer *b,long bits); nuclear@0: extern void oggpack_writealign(oggpack_buffer *b); nuclear@0: extern void oggpack_writecopy(oggpack_buffer *b,void *source,long bits); nuclear@0: extern void oggpack_reset(oggpack_buffer *b); nuclear@0: extern void oggpack_writeclear(oggpack_buffer *b); nuclear@0: extern void oggpack_readinit(oggpack_buffer *b,unsigned char *buf,int bytes); nuclear@0: extern void oggpack_write(oggpack_buffer *b,unsigned long value,int bits); nuclear@0: extern long oggpack_look(oggpack_buffer *b,int bits); nuclear@0: extern long oggpack_look1(oggpack_buffer *b); nuclear@0: extern void oggpack_adv(oggpack_buffer *b,int bits); nuclear@0: extern void oggpack_adv1(oggpack_buffer *b); nuclear@0: extern long oggpack_read(oggpack_buffer *b,int bits); nuclear@0: extern long oggpack_read1(oggpack_buffer *b); nuclear@0: extern long oggpack_bytes(oggpack_buffer *b); nuclear@0: extern long oggpack_bits(oggpack_buffer *b); nuclear@0: extern unsigned char *oggpack_get_buffer(oggpack_buffer *b); nuclear@0: nuclear@0: extern void oggpackB_writeinit(oggpack_buffer *b); nuclear@0: extern int oggpackB_writecheck(oggpack_buffer *b); nuclear@0: extern void oggpackB_writetrunc(oggpack_buffer *b,long bits); nuclear@0: extern void oggpackB_writealign(oggpack_buffer *b); nuclear@0: extern void oggpackB_writecopy(oggpack_buffer *b,void *source,long bits); nuclear@0: extern void oggpackB_reset(oggpack_buffer *b); nuclear@0: extern void oggpackB_writeclear(oggpack_buffer *b); nuclear@0: extern void oggpackB_readinit(oggpack_buffer *b,unsigned char *buf,int bytes); nuclear@0: extern void oggpackB_write(oggpack_buffer *b,unsigned long value,int bits); nuclear@0: extern long oggpackB_look(oggpack_buffer *b,int bits); nuclear@0: extern long oggpackB_look1(oggpack_buffer *b); nuclear@0: extern void oggpackB_adv(oggpack_buffer *b,int bits); nuclear@0: extern void oggpackB_adv1(oggpack_buffer *b); nuclear@0: extern long oggpackB_read(oggpack_buffer *b,int bits); nuclear@0: extern long oggpackB_read1(oggpack_buffer *b); nuclear@0: extern long oggpackB_bytes(oggpack_buffer *b); nuclear@0: extern long oggpackB_bits(oggpack_buffer *b); nuclear@0: extern unsigned char *oggpackB_get_buffer(oggpack_buffer *b); nuclear@0: nuclear@0: /* Ogg BITSTREAM PRIMITIVES: encoding **************************/ nuclear@0: nuclear@0: extern int ogg_stream_packetin(ogg_stream_state *os, ogg_packet *op); nuclear@0: extern int ogg_stream_iovecin(ogg_stream_state *os, ogg_iovec_t *iov, nuclear@0: int count, long e_o_s, ogg_int64_t granulepos); nuclear@0: extern int ogg_stream_pageout(ogg_stream_state *os, ogg_page *og); nuclear@0: extern int ogg_stream_pageout_fill(ogg_stream_state *os, ogg_page *og, int nfill); nuclear@0: extern int ogg_stream_flush(ogg_stream_state *os, ogg_page *og); nuclear@0: extern int ogg_stream_flush_fill(ogg_stream_state *os, ogg_page *og, int nfill); nuclear@0: nuclear@0: /* Ogg BITSTREAM PRIMITIVES: decoding **************************/ nuclear@0: nuclear@0: extern int ogg_sync_init(ogg_sync_state *oy); nuclear@0: extern int ogg_sync_clear(ogg_sync_state *oy); nuclear@0: extern int ogg_sync_reset(ogg_sync_state *oy); nuclear@0: extern int ogg_sync_destroy(ogg_sync_state *oy); nuclear@0: extern int ogg_sync_check(ogg_sync_state *oy); nuclear@0: nuclear@0: extern char *ogg_sync_buffer(ogg_sync_state *oy, long size); nuclear@0: extern int ogg_sync_wrote(ogg_sync_state *oy, long bytes); nuclear@0: extern long ogg_sync_pageseek(ogg_sync_state *oy,ogg_page *og); nuclear@0: extern int ogg_sync_pageout(ogg_sync_state *oy, ogg_page *og); nuclear@0: extern int ogg_stream_pagein(ogg_stream_state *os, ogg_page *og); nuclear@0: extern int ogg_stream_packetout(ogg_stream_state *os,ogg_packet *op); nuclear@0: extern int ogg_stream_packetpeek(ogg_stream_state *os,ogg_packet *op); nuclear@0: nuclear@0: /* Ogg BITSTREAM PRIMITIVES: general ***************************/ nuclear@0: nuclear@0: extern int ogg_stream_init(ogg_stream_state *os,int serialno); nuclear@0: extern int ogg_stream_clear(ogg_stream_state *os); nuclear@0: extern int ogg_stream_reset(ogg_stream_state *os); nuclear@0: extern int ogg_stream_reset_serialno(ogg_stream_state *os,int serialno); nuclear@0: extern int ogg_stream_destroy(ogg_stream_state *os); nuclear@0: extern int ogg_stream_check(ogg_stream_state *os); nuclear@0: extern int ogg_stream_eos(ogg_stream_state *os); nuclear@0: nuclear@0: extern void ogg_page_checksum_set(ogg_page *og); nuclear@0: nuclear@0: extern int ogg_page_version(const ogg_page *og); nuclear@0: extern int ogg_page_continued(const ogg_page *og); nuclear@0: extern int ogg_page_bos(const ogg_page *og); nuclear@0: extern int ogg_page_eos(const ogg_page *og); nuclear@0: extern ogg_int64_t ogg_page_granulepos(const ogg_page *og); nuclear@0: extern int ogg_page_serialno(const ogg_page *og); nuclear@0: extern long ogg_page_pageno(const ogg_page *og); nuclear@0: extern int ogg_page_packets(const ogg_page *og); nuclear@0: nuclear@0: extern void ogg_packet_clear(ogg_packet *op); nuclear@0: nuclear@0: nuclear@0: #ifdef __cplusplus nuclear@0: } nuclear@0: #endif nuclear@0: nuclear@0: #endif /* _OGG_H */