~ubuntu-branches/ubuntu/utopic/castle-game-engine/utopic

« back to all changes in this revision

Viewing changes to src/audio/castlevorbiscodec.pas

  • Committer: Package Import Robot
  • Author(s): Abou Al Montacir
  • Date: 2013-04-27 18:06:40 UTC
  • Revision ID: package-import@ubuntu.com-20130427180640-eink4nmwzuivez1c
Tags: upstream-4.0.1
ImportĀ upstreamĀ versionĀ 4.0.1

Show diffs side-by-side

added added

removed removed

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