dbf-halloween2015
diff libs/ogg/ogg.h @ 1:c3f5c32cb210
barfed all the libraries in the source tree to make porting easier
author | John Tsiombikas <nuclear@member.fsf.org> |
---|---|
date | Sun, 01 Nov 2015 00:36:56 +0200 |
parents | |
children |
line diff
1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/libs/ogg/ogg.h Sun Nov 01 00:36:56 2015 +0200 1.3 @@ -0,0 +1,210 @@ 1.4 +/******************************************************************** 1.5 + * * 1.6 + * THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE. * 1.7 + * USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS * 1.8 + * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE * 1.9 + * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. * 1.10 + * * 1.11 + * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2007 * 1.12 + * by the Xiph.Org Foundation http://www.xiph.org/ * 1.13 + * * 1.14 + ******************************************************************** 1.15 + 1.16 + function: toplevel libogg include 1.17 + last mod: $Id: ogg.h 18044 2011-08-01 17:55:20Z gmaxwell $ 1.18 + 1.19 + ********************************************************************/ 1.20 +#ifndef _OGG_H 1.21 +#define _OGG_H 1.22 + 1.23 +#ifdef __cplusplus 1.24 +extern "C" { 1.25 +#endif 1.26 + 1.27 +#include <stddef.h> 1.28 +#include <ogg/os_types.h> 1.29 + 1.30 +typedef struct { 1.31 + void *iov_base; 1.32 + size_t iov_len; 1.33 +} ogg_iovec_t; 1.34 + 1.35 +typedef struct { 1.36 + long endbyte; 1.37 + int endbit; 1.38 + 1.39 + unsigned char *buffer; 1.40 + unsigned char *ptr; 1.41 + long storage; 1.42 +} oggpack_buffer; 1.43 + 1.44 +/* ogg_page is used to encapsulate the data in one Ogg bitstream page *****/ 1.45 + 1.46 +typedef struct { 1.47 + unsigned char *header; 1.48 + long header_len; 1.49 + unsigned char *body; 1.50 + long body_len; 1.51 +} ogg_page; 1.52 + 1.53 +/* ogg_stream_state contains the current encode/decode state of a logical 1.54 + Ogg bitstream **********************************************************/ 1.55 + 1.56 +typedef struct { 1.57 + unsigned char *body_data; /* bytes from packet bodies */ 1.58 + long body_storage; /* storage elements allocated */ 1.59 + long body_fill; /* elements stored; fill mark */ 1.60 + long body_returned; /* elements of fill returned */ 1.61 + 1.62 + 1.63 + int *lacing_vals; /* The values that will go to the segment table */ 1.64 + ogg_int64_t *granule_vals; /* granulepos values for headers. Not compact 1.65 + this way, but it is simple coupled to the 1.66 + lacing fifo */ 1.67 + long lacing_storage; 1.68 + long lacing_fill; 1.69 + long lacing_packet; 1.70 + long lacing_returned; 1.71 + 1.72 + unsigned char header[282]; /* working space for header encode */ 1.73 + int header_fill; 1.74 + 1.75 + int e_o_s; /* set when we have buffered the last packet in the 1.76 + logical bitstream */ 1.77 + int b_o_s; /* set after we've written the initial page 1.78 + of a logical bitstream */ 1.79 + long serialno; 1.80 + long pageno; 1.81 + ogg_int64_t packetno; /* sequence number for decode; the framing 1.82 + knows where there's a hole in the data, 1.83 + but we need coupling so that the codec 1.84 + (which is in a separate abstraction 1.85 + layer) also knows about the gap */ 1.86 + ogg_int64_t granulepos; 1.87 + 1.88 +} ogg_stream_state; 1.89 + 1.90 +/* ogg_packet is used to encapsulate the data and metadata belonging 1.91 + to a single raw Ogg/Vorbis packet *************************************/ 1.92 + 1.93 +typedef struct { 1.94 + unsigned char *packet; 1.95 + long bytes; 1.96 + long b_o_s; 1.97 + long e_o_s; 1.98 + 1.99 + ogg_int64_t granulepos; 1.100 + 1.101 + ogg_int64_t packetno; /* sequence number for decode; the framing 1.102 + knows where there's a hole in the data, 1.103 + but we need coupling so that the codec 1.104 + (which is in a separate abstraction 1.105 + layer) also knows about the gap */ 1.106 +} ogg_packet; 1.107 + 1.108 +typedef struct { 1.109 + unsigned char *data; 1.110 + int storage; 1.111 + int fill; 1.112 + int returned; 1.113 + 1.114 + int unsynced; 1.115 + int headerbytes; 1.116 + int bodybytes; 1.117 +} ogg_sync_state; 1.118 + 1.119 +/* Ogg BITSTREAM PRIMITIVES: bitstream ************************/ 1.120 + 1.121 +extern void oggpack_writeinit(oggpack_buffer *b); 1.122 +extern int oggpack_writecheck(oggpack_buffer *b); 1.123 +extern void oggpack_writetrunc(oggpack_buffer *b,long bits); 1.124 +extern void oggpack_writealign(oggpack_buffer *b); 1.125 +extern void oggpack_writecopy(oggpack_buffer *b,void *source,long bits); 1.126 +extern void oggpack_reset(oggpack_buffer *b); 1.127 +extern void oggpack_writeclear(oggpack_buffer *b); 1.128 +extern void oggpack_readinit(oggpack_buffer *b,unsigned char *buf,int bytes); 1.129 +extern void oggpack_write(oggpack_buffer *b,unsigned long value,int bits); 1.130 +extern long oggpack_look(oggpack_buffer *b,int bits); 1.131 +extern long oggpack_look1(oggpack_buffer *b); 1.132 +extern void oggpack_adv(oggpack_buffer *b,int bits); 1.133 +extern void oggpack_adv1(oggpack_buffer *b); 1.134 +extern long oggpack_read(oggpack_buffer *b,int bits); 1.135 +extern long oggpack_read1(oggpack_buffer *b); 1.136 +extern long oggpack_bytes(oggpack_buffer *b); 1.137 +extern long oggpack_bits(oggpack_buffer *b); 1.138 +extern unsigned char *oggpack_get_buffer(oggpack_buffer *b); 1.139 + 1.140 +extern void oggpackB_writeinit(oggpack_buffer *b); 1.141 +extern int oggpackB_writecheck(oggpack_buffer *b); 1.142 +extern void oggpackB_writetrunc(oggpack_buffer *b,long bits); 1.143 +extern void oggpackB_writealign(oggpack_buffer *b); 1.144 +extern void oggpackB_writecopy(oggpack_buffer *b,void *source,long bits); 1.145 +extern void oggpackB_reset(oggpack_buffer *b); 1.146 +extern void oggpackB_writeclear(oggpack_buffer *b); 1.147 +extern void oggpackB_readinit(oggpack_buffer *b,unsigned char *buf,int bytes); 1.148 +extern void oggpackB_write(oggpack_buffer *b,unsigned long value,int bits); 1.149 +extern long oggpackB_look(oggpack_buffer *b,int bits); 1.150 +extern long oggpackB_look1(oggpack_buffer *b); 1.151 +extern void oggpackB_adv(oggpack_buffer *b,int bits); 1.152 +extern void oggpackB_adv1(oggpack_buffer *b); 1.153 +extern long oggpackB_read(oggpack_buffer *b,int bits); 1.154 +extern long oggpackB_read1(oggpack_buffer *b); 1.155 +extern long oggpackB_bytes(oggpack_buffer *b); 1.156 +extern long oggpackB_bits(oggpack_buffer *b); 1.157 +extern unsigned char *oggpackB_get_buffer(oggpack_buffer *b); 1.158 + 1.159 +/* Ogg BITSTREAM PRIMITIVES: encoding **************************/ 1.160 + 1.161 +extern int ogg_stream_packetin(ogg_stream_state *os, ogg_packet *op); 1.162 +extern int ogg_stream_iovecin(ogg_stream_state *os, ogg_iovec_t *iov, 1.163 + int count, long e_o_s, ogg_int64_t granulepos); 1.164 +extern int ogg_stream_pageout(ogg_stream_state *os, ogg_page *og); 1.165 +extern int ogg_stream_pageout_fill(ogg_stream_state *os, ogg_page *og, int nfill); 1.166 +extern int ogg_stream_flush(ogg_stream_state *os, ogg_page *og); 1.167 +extern int ogg_stream_flush_fill(ogg_stream_state *os, ogg_page *og, int nfill); 1.168 + 1.169 +/* Ogg BITSTREAM PRIMITIVES: decoding **************************/ 1.170 + 1.171 +extern int ogg_sync_init(ogg_sync_state *oy); 1.172 +extern int ogg_sync_clear(ogg_sync_state *oy); 1.173 +extern int ogg_sync_reset(ogg_sync_state *oy); 1.174 +extern int ogg_sync_destroy(ogg_sync_state *oy); 1.175 +extern int ogg_sync_check(ogg_sync_state *oy); 1.176 + 1.177 +extern char *ogg_sync_buffer(ogg_sync_state *oy, long size); 1.178 +extern int ogg_sync_wrote(ogg_sync_state *oy, long bytes); 1.179 +extern long ogg_sync_pageseek(ogg_sync_state *oy,ogg_page *og); 1.180 +extern int ogg_sync_pageout(ogg_sync_state *oy, ogg_page *og); 1.181 +extern int ogg_stream_pagein(ogg_stream_state *os, ogg_page *og); 1.182 +extern int ogg_stream_packetout(ogg_stream_state *os,ogg_packet *op); 1.183 +extern int ogg_stream_packetpeek(ogg_stream_state *os,ogg_packet *op); 1.184 + 1.185 +/* Ogg BITSTREAM PRIMITIVES: general ***************************/ 1.186 + 1.187 +extern int ogg_stream_init(ogg_stream_state *os,int serialno); 1.188 +extern int ogg_stream_clear(ogg_stream_state *os); 1.189 +extern int ogg_stream_reset(ogg_stream_state *os); 1.190 +extern int ogg_stream_reset_serialno(ogg_stream_state *os,int serialno); 1.191 +extern int ogg_stream_destroy(ogg_stream_state *os); 1.192 +extern int ogg_stream_check(ogg_stream_state *os); 1.193 +extern int ogg_stream_eos(ogg_stream_state *os); 1.194 + 1.195 +extern void ogg_page_checksum_set(ogg_page *og); 1.196 + 1.197 +extern int ogg_page_version(const ogg_page *og); 1.198 +extern int ogg_page_continued(const ogg_page *og); 1.199 +extern int ogg_page_bos(const ogg_page *og); 1.200 +extern int ogg_page_eos(const ogg_page *og); 1.201 +extern ogg_int64_t ogg_page_granulepos(const ogg_page *og); 1.202 +extern int ogg_page_serialno(const ogg_page *og); 1.203 +extern long ogg_page_pageno(const ogg_page *og); 1.204 +extern int ogg_page_packets(const ogg_page *og); 1.205 + 1.206 +extern void ogg_packet_clear(ogg_packet *op); 1.207 + 1.208 + 1.209 +#ifdef __cplusplus 1.210 +} 1.211 +#endif 1.212 + 1.213 +#endif /* _OGG_H */