| 1 |
{ Minimal translation of C /usr/include/vorbis/codec.h header. |
| 2 |
@exclude (This is only a C header translation (no nice PasDoc docs), |
| 3 |
and also this is internal.) } |
| 4 |
unit CastleInternalVorbisCodec; |
| 5 |
|
| 6 |
{$I castleconf.inc} |
| 7 |
{$ifdef FPC} |
| 8 |
{$packrecords C} |
| 9 |
{$else} |
| 10 |
{$ALIGN 4} |
| 11 |
{$endif} |
| 12 |
|
| 13 |
|
| 14 |
interface |
| 15 |
|
| 16 |
uses CTypes, CastleInternalOgg; |
| 17 |
|
| 18 |
type |
| 19 |
Tvorbis_info = record |
| 20 |
version: CInt; |
| 21 |
channels: CInt; |
| 22 |
rate: CLong; |
| 23 |
|
| 24 |
{* The below bitrate declarations are *hints*. |
| 25 |
Combinations of the three values carry the following implications: |
| 26 |
|
| 27 |
all three set to the same value: |
| 28 |
implies a fixed rate bitstream |
| 29 |
only nominal set: |
| 30 |
implies a VBR stream that averages the nominal bitrate. No hard |
| 31 |
upper/lower limit |
| 32 |
upper and or lower set: |
| 33 |
implies a VBR bitstream that obeys the bitrate limits. nominal |
| 34 |
may also be set to give a nominal rate. |
| 35 |
none set: |
| 36 |
the coder does not care to speculate. |
| 37 |
*} |
| 38 |
|
| 39 |
bitrate_upper: CLong; |
| 40 |
bitrate_nominal: CLong; |
| 41 |
bitrate_lower: CLong; |
| 42 |
bitrate_window: CLong; |
| 43 |
|
| 44 |
codec_setup: Pointer; |
| 45 |
end; |
| 46 |
Pvorbis_info = ^Tvorbis_info; |
| 47 |
|
| 48 |
{* vorbis_dsp_state buffers the current vorbis audio |
| 49 |
analysis/synthesis state. The DSP state belongs to a specific |
| 50 |
logical bitstream ****************************************************} |
| 51 |
Tvorbis_dsp_state = record |
| 52 |
analysisp: Cint; |
| 53 |
vi: Pvorbis_info; |
| 54 |
|
| 55 |
pcm: Pointer; |
| 56 |
pcmret: Pointer; |
| 57 |
pcm_storage: CInt; |
| 58 |
pcm_current: Cint; |
| 59 |
pcm_returned: Cint; |
| 60 |
|
| 61 |
preextrapolate: Cint; |
| 62 |
eofflag: Cint; |
| 63 |
|
| 64 |
lW: Clong; |
| 65 |
W: Clong; |
| 66 |
nW: Clong; |
| 67 |
centerW: Clong; |
| 68 |
|
| 69 |
granulepos: Int64; |
| 70 |
sequence: Int64; |
| 71 |
|
| 72 |
glue_bits: Int64; |
| 73 |
time_bits: Int64; |
| 74 |
floor_bits: Int64; |
| 75 |
res_bits: Int64; |
| 76 |
|
| 77 |
backend_state: Pointer; |
| 78 |
end; |
| 79 |
Pvorbis_dsp_state = ^Tvorbis_dsp_state; |
| 80 |
|
| 81 |
Tvorbis_block = record |
| 82 |
{* necessary stream state for linking to the framing abstraction *} |
| 83 |
pcm: Pointer; {* this is a pointer into local storage *} |
| 84 |
opb: Toggpack_buffer; |
| 85 |
|
| 86 |
lW: Clong; |
| 87 |
W: Clong; |
| 88 |
nW: Clong; |
| 89 |
pcmend: Cint; |
| 90 |
mode: Cint; |
| 91 |
|
| 92 |
eofflag: Cint; |
| 93 |
granulepos: Int64; |
| 94 |
sequence: Int64; |
| 95 |
vd: Pvorbis_dsp_state; {* For read-only access of configuration *} |
| 96 |
|
| 97 |
{* local storage to avoid remallocing; it's up to the mapping to |
| 98 |
structure it *} |
| 99 |
localstore: Pointer; |
| 100 |
localtop: Clong; |
| 101 |
localalloc: Clong; |
| 102 |
totaluse: Clong; |
| 103 |
reap: Pointer; |
| 104 |
|
| 105 |
{* bitmetrics for the frame *} |
| 106 |
glue_bits: Clong; |
| 107 |
time_bits: Clong; |
| 108 |
floor_bits: Clong; |
| 109 |
res_bits: Clong; |
| 110 |
|
| 111 |
internal: Pointer; |
| 112 |
end; |
| 113 |
|
| 114 |
{* vorbis_info contains all the setup information specific to the |
| 115 |
specific compression/decompression mode in progress (eg, |
| 116 |
psychoacoustic settings, channel setup, options, codebook |
| 117 |
etc). vorbis_info and substructures are in backends.h. |
| 118 |
*********************************************************************/ |
| 119 |
|
| 120 |
/* the comments are not part of vorbis_info so that vorbis_info can be |
| 121 |
static storage *} |
| 122 |
Tvorbis_comment = record |
| 123 |
{* unlimited user comment fields. libvorbis writes 'libvorbis' |
| 124 |
whatever vendor is set to in encode *} |
| 125 |
user_comments: Pointer; |
| 126 |
comment_lengths: PCInt; |
| 127 |
comments: CInt; |
| 128 |
vendor: PChar; |
| 129 |
end; |
| 130 |
Pvorbis_comment = ^Tvorbis_comment; |
| 131 |
|
| 132 |
const |
| 133 |
{* Vorbis ERRORS and return codes ***********************************} |
| 134 |
OV_FALSE = -1; |
| 135 |
OV_EOF = -2; |
| 136 |
OV_HOLE = -3; |
| 137 |
|
| 138 |
OV_EREAD = -128; |
| 139 |
OV_EFAULT = -129; |
| 140 |
OV_EIMPL = -130; |
| 141 |
OV_EINVAL = -131; |
| 142 |
OV_ENOTVORBIS = -132; |
| 143 |
OV_EBADHEADER = -133; |
| 144 |
OV_EVERSION = -134; |
| 145 |
OV_ENOTAUDIO = -135; |
| 146 |
OV_EBADPACKET = -136; |
| 147 |
OV_EBADLINK = -137; |
| 148 |
OV_ENOSEEK = -138; |
| 149 |
|
| 150 |
implementation |
| 151 |
|
| 152 |
end. |