LMMS
Loading...
Searching...
No Matches
ogg.h
Go to the documentation of this file.
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#ifdef __cplusplus
20extern "C" {
21#endif
22
23#include <stddef.h>
24#include "os_types.h"
25
26typedef struct {
27 void *iov_base;
28 size_t iov_len;
30
31typedef struct {
32 long endbyte;
33 int endbit;
34
35 unsigned char *buffer;
36 unsigned char *ptr;
37 long storage;
39
40/* ogg_page is used to encapsulate the data in one Ogg bitstream page *****/
41
42typedef struct {
43 unsigned char *header;
45 unsigned char *body;
47} ogg_page;
48
49/* ogg_stream_state contains the current encode/decode state of a logical
50 Ogg bitstream **********************************************************/
51
52typedef struct {
53 unsigned char *body_data; /* bytes from packet bodies */
54 long body_storage; /* storage elements allocated */
55 long body_fill; /* elements stored; fill mark */
56 long body_returned; /* elements of fill returned */
57
58
59 int *lacing_vals; /* The values that will go to the segment table */
60 ogg_int64_t *granule_vals; /* granulepos values for headers. Not compact
61 this way, but it is simple coupled to the
62 lacing fifo */
67
68 unsigned char header[282]; /* working space for header encode */
70
71 int e_o_s; /* set when we have buffered the last packet in the
72 logical bitstream */
73 int b_o_s; /* set after we've written the initial page
74 of a logical bitstream */
76 long pageno;
77 ogg_int64_t packetno; /* sequence number for decode; the framing
78 knows where there's a hole in the data,
79 but we need coupling so that the codec
80 (which is in a separate abstraction
81 layer) also knows about the gap */
83
85
86/* ogg_packet is used to encapsulate the data and metadata belonging
87 to a single raw Ogg/Vorbis packet *************************************/
88
89typedef struct {
90 unsigned char *packet;
91 long bytes;
92 long b_o_s;
93 long e_o_s;
94
96
97 ogg_int64_t packetno; /* sequence number for decode; the framing
98 knows where there's a hole in the data,
99 but we need coupling so that the codec
100 (which is in a separate abstraction
101 layer) also knows about the gap */
102} ogg_packet;
103
104typedef struct {
105 unsigned char *data;
107 int fill;
109
114
115/* Ogg BITSTREAM PRIMITIVES: bitstream ************************/
116
119extern void oggpack_writetrunc(oggpack_buffer *b,long bits);
121extern void oggpack_writecopy(oggpack_buffer *b,void *source,long bits);
122extern void oggpack_reset(oggpack_buffer *b);
124extern void oggpack_readinit(oggpack_buffer *b,unsigned char *buf,int bytes);
125extern void oggpack_write(oggpack_buffer *b,unsigned long value,int bits);
126extern long oggpack_look(oggpack_buffer *b,int bits);
127extern long oggpack_look1(oggpack_buffer *b);
128extern void oggpack_adv(oggpack_buffer *b,int bits);
129extern void oggpack_adv1(oggpack_buffer *b);
130extern long oggpack_read(oggpack_buffer *b,int bits);
131extern long oggpack_read1(oggpack_buffer *b);
132extern long oggpack_bytes(oggpack_buffer *b);
133extern long oggpack_bits(oggpack_buffer *b);
134extern unsigned char *oggpack_get_buffer(oggpack_buffer *b);
135
138extern void oggpackB_writetrunc(oggpack_buffer *b,long bits);
140extern void oggpackB_writecopy(oggpack_buffer *b,void *source,long bits);
141extern void oggpackB_reset(oggpack_buffer *b);
143extern void oggpackB_readinit(oggpack_buffer *b,unsigned char *buf,int bytes);
144extern void oggpackB_write(oggpack_buffer *b,unsigned long value,int bits);
145extern long oggpackB_look(oggpack_buffer *b,int bits);
146extern long oggpackB_look1(oggpack_buffer *b);
147extern void oggpackB_adv(oggpack_buffer *b,int bits);
148extern void oggpackB_adv1(oggpack_buffer *b);
149extern long oggpackB_read(oggpack_buffer *b,int bits);
150extern long oggpackB_read1(oggpack_buffer *b);
151extern long oggpackB_bytes(oggpack_buffer *b);
152extern long oggpackB_bits(oggpack_buffer *b);
153extern unsigned char *oggpackB_get_buffer(oggpack_buffer *b);
154
155/* Ogg BITSTREAM PRIMITIVES: encoding **************************/
156
159 int count, long e_o_s, ogg_int64_t granulepos);
161extern int ogg_stream_pageout_fill(ogg_stream_state *os, ogg_page *og, int nfill);
163extern int ogg_stream_flush_fill(ogg_stream_state *os, ogg_page *og, int nfill);
164
165/* Ogg BITSTREAM PRIMITIVES: decoding **************************/
166
167extern int ogg_sync_init(ogg_sync_state *oy);
168extern int ogg_sync_clear(ogg_sync_state *oy);
169extern int ogg_sync_reset(ogg_sync_state *oy);
170extern int ogg_sync_destroy(ogg_sync_state *oy);
171extern int ogg_sync_check(ogg_sync_state *oy);
172
173extern char *ogg_sync_buffer(ogg_sync_state *oy, long size);
174extern int ogg_sync_wrote(ogg_sync_state *oy, long bytes);
175extern long ogg_sync_pageseek(ogg_sync_state *oy,ogg_page *og);
176extern int ogg_sync_pageout(ogg_sync_state *oy, ogg_page *og);
180
181/* Ogg BITSTREAM PRIMITIVES: general ***************************/
182
183extern int ogg_stream_init(ogg_stream_state *os,int serialno);
186extern int ogg_stream_reset_serialno(ogg_stream_state *os,int serialno);
190
191extern void ogg_page_checksum_set(ogg_page *og);
192
193extern int ogg_page_version(const ogg_page *og);
194extern int ogg_page_continued(const ogg_page *og);
195extern int ogg_page_bos(const ogg_page *og);
196extern int ogg_page_eos(const ogg_page *og);
198extern int ogg_page_serialno(const ogg_page *og);
199extern long ogg_page_pageno(const ogg_page *og);
200extern int ogg_page_packets(const ogg_page *og);
201
202extern void ogg_packet_clear(ogg_packet *op);
203
204
205#ifdef __cplusplus
206}
207#endif
208
209#endif /* _OGG_H */
int64_t ogg_int64_t
Definition config_types.h:8
static PuglViewHint int value
Definition pugl.h:1708
long oggpackB_look1(oggpack_buffer *b)
Definition bitwise.c:340
int ogg_page_continued(const ogg_page *og)
Definition framing.c:37
int ogg_stream_destroy(ogg_stream_state *os)
Definition framing.c:173
void oggpackB_writeclear(oggpack_buffer *b)
Definition bitwise.c:258
void oggpack_reset(oggpack_buffer *b)
Definition bitwise.c:242
unsigned char * oggpackB_get_buffer(oggpack_buffer *b)
Definition bitwise.c:526
int ogg_page_packets(const ogg_page *og)
Definition framing.c:95
int ogg_stream_check(ogg_stream_state *os)
Definition framing.c:156
void oggpack_writeclear(oggpack_buffer *b)
Definition bitwise.c:253
int ogg_sync_init(ogg_sync_state *oy)
Definition framing.c:557
int ogg_stream_clear(ogg_stream_state *os)
Definition framing.c:162
long oggpackB_bits(oggpack_buffer *b)
Definition bitwise.c:518
int ogg_stream_packetout(ogg_stream_state *os, ogg_packet *op)
Definition framing.c:989
long oggpackB_read1(oggpack_buffer *b)
Definition bitwise.c:485
void oggpackB_reset(oggpack_buffer *b)
Definition bitwise.c:249
long oggpack_look1(oggpack_buffer *b)
Definition bitwise.c:335
int ogg_sync_clear(ogg_sync_state *oy)
Definition framing.c:566
int ogg_page_version(const ogg_page *og)
Definition framing.c:33
long ogg_sync_pageseek(ogg_sync_state *oy, ogg_page *og)
Definition framing.c:636
ogg_int64_t ogg_page_granulepos(const ogg_page *og)
Definition framing.c:49
int ogg_stream_packetpeek(ogg_stream_state *os, ogg_packet *op)
Definition framing.c:994
void oggpack_readinit(oggpack_buffer *b, unsigned char *buf, int bytes)
Definition bitwise.c:262
int ogg_stream_packetin(ogg_stream_state *os, ogg_packet *op)
Definition framing.c:339
long ogg_page_pageno(const ogg_page *og)
Definition framing.c:69
int ogg_stream_pagein(ogg_stream_state *os, ogg_page *og)
Definition framing.c:766
int ogg_page_serialno(const ogg_page *og)
Definition framing.c:62
long oggpack_bytes(oggpack_buffer *b)
Definition bitwise.c:506
void oggpackB_writeinit(oggpack_buffer *b)
Definition bitwise.c:50
int ogg_stream_reset(ogg_stream_state *os)
Definition framing.c:907
void oggpackB_writealign(oggpack_buffer *b)
Definition bitwise.c:177
void oggpackB_writetrunc(oggpack_buffer *b, long bits)
Definition bitwise.c:74
long oggpackB_read(oggpack_buffer *b, int bits)
Definition bitwise.c:422
int ogg_sync_destroy(ogg_sync_state *oy)
Definition framing.c:574
int ogg_stream_pageout(ogg_stream_state *os, ogg_page *og)
Definition framing.c:510
int ogg_stream_eos(ogg_stream_state *os)
Definition framing.c:536
void oggpackB_adv1(oggpack_buffer *b)
Definition bitwise.c:373
long oggpack_read(oggpack_buffer *b, int bits)
Definition bitwise.c:378
void oggpack_writetrunc(oggpack_buffer *b, long bits)
Definition bitwise.c:63
void oggpackB_write(oggpack_buffer *b, unsigned long value, int bits)
Definition bitwise.c:129
void oggpackB_readinit(oggpack_buffer *b, unsigned char *buf, int bytes)
Definition bitwise.c:268
void oggpack_writealign(oggpack_buffer *b)
Definition bitwise.c:171
int ogg_page_bos(const ogg_page *og)
Definition framing.c:41
int ogg_stream_iovecin(ogg_stream_state *os, ogg_iovec_t *iov, int count, long e_o_s, ogg_int64_t granulepos)
Definition framing.c:276
void ogg_page_checksum_set(ogg_page *og)
Definition framing.c:255
unsigned char * oggpack_get_buffer(oggpack_buffer *b)
Definition bitwise.c:522
int ogg_sync_reset(ogg_sync_state *oy)
Definition framing.c:896
int ogg_stream_flush(ogg_stream_state *os, ogg_page *og)
Definition framing.c:494
void oggpack_adv(oggpack_buffer *b, int bits)
Definition bitwise.c:345
int ogg_stream_pageout_fill(ogg_stream_state *os, ogg_page *og, int nfill)
Definition framing.c:525
int ogg_stream_init(ogg_stream_state *os, int serialno)
Definition framing.c:133
int ogg_sync_pageout(ogg_sync_state *oy, ogg_page *og)
Definition framing.c:733
int ogg_sync_wrote(ogg_sync_state *oy, long bytes)
Definition framing.c:619
int oggpack_writecheck(oggpack_buffer *b)
Definition bitwise.c:54
long oggpack_bits(oggpack_buffer *b)
Definition bitwise.c:510
int ogg_sync_check(ogg_sync_state *oy)
Definition framing.c:582
long oggpackB_bytes(oggpack_buffer *b)
Definition bitwise.c:514
long oggpack_look(oggpack_buffer *b, int bits)
Definition bitwise.c:273
void oggpack_writeinit(oggpack_buffer *b)
Definition bitwise.c:43
int ogg_page_eos(const ogg_page *og)
Definition framing.c:45
void oggpack_writecopy(oggpack_buffer *b, void *source, long bits)
Definition bitwise.c:234
void oggpackB_writecopy(oggpack_buffer *b, void *source, long bits)
Definition bitwise.c:238
void ogg_packet_clear(ogg_packet *op)
Definition framing.c:999
char * ogg_sync_buffer(ogg_sync_state *oy, long size)
Definition framing.c:587
int oggpackB_writecheck(oggpack_buffer *b)
Definition bitwise.c:59
void oggpack_adv1(oggpack_buffer *b)
Definition bitwise.c:365
void oggpack_write(oggpack_buffer *b, unsigned long value, int bits)
Definition bitwise.c:86
int ogg_stream_flush_fill(ogg_stream_state *os, ogg_page *og, int nfill)
Definition framing.c:502
int ogg_stream_reset_serialno(ogg_stream_state *os, int serialno)
Definition framing.c:928
long oggpack_read1(oggpack_buffer *b)
Definition bitwise.c:464
void oggpackB_adv(oggpack_buffer *b, int bits)
Definition bitwise.c:361
long oggpackB_look(oggpack_buffer *b, int bits)
Definition bitwise.c:305
Definition ogg.h:26
void * iov_base
Definition ogg.h:27
size_t iov_len
Definition ogg.h:28
Definition ogg.h:89
long bytes
Definition ogg.h:91
unsigned char * packet
Definition ogg.h:90
ogg_int64_t packetno
Definition ogg.h:97
ogg_int64_t granulepos
Definition ogg.h:95
long e_o_s
Definition ogg.h:93
long b_o_s
Definition ogg.h:92
Definition ogg.h:42
unsigned char * header
Definition ogg.h:43
long body_len
Definition ogg.h:46
long header_len
Definition ogg.h:44
unsigned char * body
Definition ogg.h:45
Definition ogg.h:52
long pageno
Definition ogg.h:76
long body_fill
Definition ogg.h:55
ogg_int64_t packetno
Definition ogg.h:77
long lacing_storage
Definition ogg.h:63
int e_o_s
Definition ogg.h:71
long lacing_returned
Definition ogg.h:66
int * lacing_vals
Definition ogg.h:59
ogg_int64_t * granule_vals
Definition ogg.h:60
ogg_int64_t granulepos
Definition ogg.h:82
long body_returned
Definition ogg.h:56
long lacing_fill
Definition ogg.h:64
unsigned char * body_data
Definition ogg.h:53
int b_o_s
Definition ogg.h:73
long serialno
Definition ogg.h:75
long body_storage
Definition ogg.h:54
long lacing_packet
Definition ogg.h:65
unsigned char header[282]
Definition ogg.h:68
int header_fill
Definition ogg.h:69
Definition ogg.h:104
int storage
Definition ogg.h:106
int fill
Definition ogg.h:107
int unsynced
Definition ogg.h:110
int bodybytes
Definition ogg.h:112
int headerbytes
Definition ogg.h:111
int returned
Definition ogg.h:108
unsigned char * data
Definition ogg.h:105
Definition ogg.h:31
long storage
Definition ogg.h:37
unsigned char * buffer
Definition ogg.h:35
long endbyte
Definition ogg.h:32
unsigned char * ptr
Definition ogg.h:36
int endbit
Definition ogg.h:33
b
Definition crypt.c:628
ulg size
Definition extract.c:2350
static ZCONST char Far * os[NUM_HOSTS]
Definition zipinfo.c:1001
_WDL_CSTRING_PREFIX void INT_PTR count
Definition wdlcstring.h:263