Debian Codegraph @

external/vorbis/ogg.h

raw symbols SCIP
1 /********************************************************************
2 * *
3 * THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE. *
4 * USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS *
5 * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
6 * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. *
7 * *
8 * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2007 *
9 * by the Xiph.Org Foundation http://www.xiph.org/ *
10 * *
11 ********************************************************************
12
13 function: toplevel libogg include
14
15 ********************************************************************/
16 #ifndef _ogg_h_
17 #define _ogg_h_
18
19 #include "melder.h"
20
21 #include "config_types.h"
22
23 typedef struct {
24 void *iov_base;
25 size_t iov_len;
26 } ogg_iovec_t;
27
28 typedef struct {
29 long endbyte;
30 int endbit;
31
32 unsigned char *buffer;
33 unsigned char *ptr;
34 long storage;
35 } oggpack_buffer;
36
37 /* ogg_page is used to encapsulate the data in one Ogg bitstream page *****/
38
39 typedef struct {
40 unsigned char *header;
41 long header_len;
42 unsigned char *body;
43 long body_len;
44 } ogg_page;
45
46 /* ogg_stream_state contains the current encode/decode state of a logical
47 Ogg bitstream **********************************************************/
48
49 typedef struct {
50 unsigned char *body_data; /* bytes from packet bodies */
51 long body_storage; /* storage elements allocated */
52 long body_fill; /* elements stored; fill mark */
53 long body_returned; /* elements of fill returned */
54
55
56 int *lacing_vals; /* The values that will go to the segment table */
57 ogg_int64_t *granule_vals; /* granulepos values for headers. Not compact
58 this way, but it is simple coupled to the
59 lacing fifo */
60 long lacing_storage;
61 long lacing_fill;
62 long lacing_packet;
63 long lacing_returned;
64
65 unsigned char header[282]; /* working space for header encode */
66 int header_fill;
67
68 int e_o_s; /* set when we have buffered the last packet in the
69 logical bitstream */
70 int b_o_s; /* set after we've written the initial page
71 of a logical bitstream */
72 long serialno;
73 long pageno;
74 ogg_int64_t packetno; /* sequence number for decode; the framing
75 knows where there's a hole in the data,
76 but we need coupling so that the codec
77 (which is in a separate abstraction
78 layer) also knows about the gap */
79 ogg_int64_t granulepos;
80
81 } ogg_stream_state;
82
83 /* ogg_packet is used to encapsulate the data and metadata belonging
84 to a single raw Ogg/Vorbis packet *************************************/
85
86 typedef struct {
87 unsigned char *packet;
88 long bytes;
89 long b_o_s;
90 long e_o_s;
91
92 ogg_int64_t granulepos;
93
94 ogg_int64_t packetno; /* sequence number for decode; the framing
95 knows where there's a hole in the data,
96 but we need coupling so that the codec
97 (which is in a separate abstraction
98 layer) also knows about the gap */
99 } ogg_packet;
100
101 typedef struct {
102 unsigned char *data;
103 int storage;
104 int fill;
105 int returned;
106
107 int unsynced;
108 int headerbytes;
109 int bodybytes;
110 } ogg_sync_state;
111
112 /* Ogg BITSTREAM PRIMITIVES: bitstream ************************/
113
114 extern void oggpack_writeinit(oggpack_buffer *b);
115 extern int oggpack_writecheck(oggpack_buffer *b);
116 extern void oggpack_writetrunc(oggpack_buffer *b,long bits);
117 extern void oggpack_writealign(oggpack_buffer *b);
118 extern void oggpack_writecopy(oggpack_buffer *b,void *source,long bits);
119 extern void oggpack_reset(oggpack_buffer *b);
120 extern void oggpack_writeclear(oggpack_buffer *b);
121 extern void oggpack_readinit(oggpack_buffer *b,unsigned char *buf,int bytes);
122 extern void oggpack_write(oggpack_buffer *b,unsigned long value,int bits);
123 extern long oggpack_look(oggpack_buffer *b,int bits);
124 extern long oggpack_look1(oggpack_buffer *b);
125 extern void oggpack_adv(oggpack_buffer *b,int bits);
126 extern void oggpack_adv1(oggpack_buffer *b);
127 extern long oggpack_read(oggpack_buffer *b,int bits);
128 extern long oggpack_read1(oggpack_buffer *b);
129 extern long oggpack_bytes(oggpack_buffer *b);
130 extern long oggpack_bits(oggpack_buffer *b);
131 extern unsigned char *oggpack_get_buffer(oggpack_buffer *b);
132
133 extern void oggpackB_writeinit(oggpack_buffer *b);
134 extern int oggpackB_writecheck(oggpack_buffer *b);
135 extern void oggpackB_writetrunc(oggpack_buffer *b,long bits);
136 extern void oggpackB_writealign(oggpack_buffer *b);
137 extern void oggpackB_writecopy(oggpack_buffer *b,void *source,long bits);
138 extern void oggpackB_reset(oggpack_buffer *b);
139 extern void oggpackB_writeclear(oggpack_buffer *b);
140 extern void oggpackB_readinit(oggpack_buffer *b,unsigned char *buf,int bytes);
141 extern void oggpackB_write(oggpack_buffer *b,unsigned long value,int bits);
142 extern long oggpackB_look(oggpack_buffer *b,int bits);
143 extern long oggpackB_look1(oggpack_buffer *b);
144 extern void oggpackB_adv(oggpack_buffer *b,int bits);
145 extern void oggpackB_adv1(oggpack_buffer *b);
146 extern long oggpackB_read(oggpack_buffer *b,int bits);
147 extern long oggpackB_read1(oggpack_buffer *b);
148 extern long oggpackB_bytes(oggpack_buffer *b);
149 extern long oggpackB_bits(oggpack_buffer *b);
150 extern unsigned char *oggpackB_get_buffer(oggpack_buffer *b);
151
152 /* Ogg BITSTREAM PRIMITIVES: encoding **************************/
153
154 extern int ogg_stream_packetin(ogg_stream_state *os, ogg_packet *op);
155 extern int ogg_stream_iovecin(ogg_stream_state *os, ogg_iovec_t *iov,
156 int count, long e_o_s, ogg_int64_t granulepos);
157 extern int ogg_stream_pageout(ogg_stream_state *os, ogg_page *og);
158 extern int ogg_stream_pageout_fill(ogg_stream_state *os, ogg_page *og, int nfill);
159 extern int ogg_stream_flush(ogg_stream_state *os, ogg_page *og);
160 extern int ogg_stream_flush_fill(ogg_stream_state *os, ogg_page *og, int nfill);
161
162 /* Ogg BITSTREAM PRIMITIVES: decoding **************************/
163
164 extern int ogg_sync_init(ogg_sync_state *oy);
165 extern int ogg_sync_clear(ogg_sync_state *oy);
166 extern int ogg_sync_reset(ogg_sync_state *oy);
167 extern int ogg_sync_destroy(ogg_sync_state *oy);
168 extern int ogg_sync_check(ogg_sync_state *oy);
169
170 extern char *ogg_sync_buffer(ogg_sync_state *oy, long size);
171 extern int ogg_sync_wrote(ogg_sync_state *oy, long bytes);
172 extern long ogg_sync_pageseek(ogg_sync_state *oy,ogg_page *og);
173 extern int ogg_sync_pageout(ogg_sync_state *oy, ogg_page *og);
174 extern int ogg_stream_pagein(ogg_stream_state *os, ogg_page *og);
175 extern int ogg_stream_packetout(ogg_stream_state *os,ogg_packet *op);
176 extern int ogg_stream_packetpeek(ogg_stream_state *os,ogg_packet *op);
177
178 /* Ogg BITSTREAM PRIMITIVES: general ***************************/
179
180 extern int ogg_stream_init(ogg_stream_state *os,int serialno);
181 extern int ogg_stream_clear(ogg_stream_state *os);
182 extern int ogg_stream_reset(ogg_stream_state *os);
183 extern int ogg_stream_reset_serialno(ogg_stream_state *os,int serialno);
184 extern int ogg_stream_destroy(ogg_stream_state *os);
185 extern int ogg_stream_check(ogg_stream_state *os);
186 extern int ogg_stream_eos(ogg_stream_state *os);
187
188 extern void ogg_page_checksum_set(ogg_page *og);
189
190 extern int ogg_page_version(const ogg_page *og);
191 extern int ogg_page_continued(const ogg_page *og);
192 extern int ogg_page_bos(const ogg_page *og);
193 extern int ogg_page_eos(const ogg_page *og);
194 extern ogg_int64_t ogg_page_granulepos(const ogg_page *og);
195 extern int ogg_page_serialno(const ogg_page *og);
196 extern long ogg_page_pageno(const ogg_page *og);
197 extern int ogg_page_packets(const ogg_page *og);
198
199 extern void ogg_packet_clear(ogg_packet *op);
200
201
202 #endif /* _ogg_h_ */