1 | {This unit is part of United Openlibraries of Sound (uos)}
|
---|
2 |
|
---|
3 | {This is the Pascal Wrapper + Dynamic loading of Opus library.
|
---|
4 | Load library with op_load() and release with op_unload().
|
---|
5 | License : modified LGPL.
|
---|
6 | Fred van Stappen / fiens@hotmail.com}
|
---|
7 |
|
---|
8 | unit uos_opus;
|
---|
9 |
|
---|
10 | {$mode objfpc}{$H+}
|
---|
11 | {$PACKRECORDS C}
|
---|
12 |
|
---|
13 | interface
|
---|
14 |
|
---|
15 | uses
|
---|
16 | dynlibs, CTypes, SysUtils;
|
---|
17 |
|
---|
18 | const
|
---|
19 | OPUS_OK = 0;
|
---|
20 | OPUS_BAD_ARG = -1;
|
---|
21 | OPUS_BUFFER_TOO_SMALL = -2;
|
---|
22 | OPUS_INTERNAL_ERROR = -3;
|
---|
23 | OPUS_INVALID_PACKET = -4;
|
---|
24 | OPUS_UNIMPLEMENTED = -5;
|
---|
25 | OPUS_INVALID_STATE = -6;
|
---|
26 | OPUS_ALLOC_FAIL = -7;
|
---|
27 |
|
---|
28 | OPUS_APPLICATION_VOIP = 2048;
|
---|
29 | OPUS_APPLICATION_AUDIO = 2049;
|
---|
30 | OPUS_APPLICATION_RESTRICTED_LOWDELAY = 2051;
|
---|
31 |
|
---|
32 | OPUS_SIGNAL_VOICE = 3001; // Signal being encoded is voice
|
---|
33 | OPUS_SIGNAL_MUSIC = 3002; // Signal being encoded is music
|
---|
34 |
|
---|
35 | OPUS_BANDWIDTH_NARROWBAND = 1101; // 4 kHz bandpass @hideinitializer
|
---|
36 | OPUS_BANDWIDTH_MEDIUMBAND = 1102; // 6 kHz bandpass @hideinitializer
|
---|
37 | OPUS_BANDWIDTH_WIDEBAND = 1103; // 8 kHz bandpass @hideinitializer
|
---|
38 | OPUS_BANDWIDTH_SUPERWIDEBAND = 1104; // 12 kHz bandpass @hideinitializer
|
---|
39 | OPUS_BANDWIDTH_FULLBAND = 1105; // 20 kHz bandpass @hideinitializer
|
---|
40 |
|
---|
41 | OPUS_FRAMESIZE_ARG = 5000; // Select frame size from the argument (default)
|
---|
42 | OPUS_FRAMESIZE_2_5_MS = 5001; // Use 2.5 ms frames
|
---|
43 | OPUS_FRAMESIZE_5_MS = 5002; // Use 5 ms frames
|
---|
44 | OPUS_FRAMESIZE_10_MS = 5003; // Use 10 ms frames
|
---|
45 | OPUS_FRAMESIZE_20_MS = 5004; // Use 20 ms frames
|
---|
46 | OPUS_FRAMESIZE_40_MS = 5005; // Use 40 ms frames
|
---|
47 | OPUS_FRAMESIZE_60_MS = 5006; // Use 60 ms frames
|
---|
48 |
|
---|
49 | const
|
---|
50 | OPUS_SET_APPLICATION_REQUEST = 4000;
|
---|
51 | OPUS_GET_APPLICATION_REQUEST = 4001;
|
---|
52 | OPUS_SET_BITRATE_REQUEST = 4002;
|
---|
53 | OPUS_GET_BITRATE_REQUEST = 4003;
|
---|
54 | OPUS_SET_MAX_BANDWIDTH_REQUEST = 4004;
|
---|
55 | OPUS_GET_MAX_BANDWIDTH_REQUEST = 4005;
|
---|
56 | OPUS_SET_VBR_REQUEST = 4006;
|
---|
57 | OPUS_GET_VBR_REQUEST = 4007;
|
---|
58 | OPUS_SET_BANDWIDTH_REQUEST = 4008;
|
---|
59 | OPUS_GET_BANDWIDTH_REQUEST = 4009;
|
---|
60 | OPUS_SET_COMPLEXITY_REQUEST = 4010;
|
---|
61 | OPUS_GET_COMPLEXITY_REQUEST = 4011;
|
---|
62 | OPUS_SET_INBAND_FEC_REQUEST = 4012;
|
---|
63 | OPUS_GET_INBAND_FEC_REQUEST = 4013;
|
---|
64 | OPUS_SET_PACKET_LOSS_PERC_REQUEST = 4014;
|
---|
65 | OPUS_GET_PACKET_LOSS_PERC_REQUEST = 4015;
|
---|
66 | OPUS_SET_DTX_REQUEST = 4016;
|
---|
67 | OPUS_GET_DTX_REQUEST = 4017;
|
---|
68 | OPUS_SET_VBR_CONSTRAINT_REQUEST = 4020;
|
---|
69 | OPUS_GET_VBR_CONSTRAINT_REQUEST = 4021;
|
---|
70 | OPUS_SET_FORCE_CHANNELS_REQUEST = 4022;
|
---|
71 | OPUS_GET_FORCE_CHANNELS_REQUEST = 4023;
|
---|
72 | OPUS_SET_SIGNAL_REQUEST = 4024;
|
---|
73 | OPUS_GET_SIGNAL_REQUEST = 4025;
|
---|
74 | OPUS_GET_LOOKAHEAD_REQUEST = 4027;
|
---|
75 | OPUS_RESET_STATE_REQUEST = 4028;
|
---|
76 | OPUS_GET_SAMPLE_RATE_REQUEST = 4029;
|
---|
77 | OPUS_GET_FINAL_RANGE_REQUEST = 4031;
|
---|
78 | OPUS_GET_PITCH_REQUEST = 4033;
|
---|
79 | OPUS_SET_GAIN_REQUEST = 4034;
|
---|
80 | OPUS_GET_GAIN_REQUEST = 4045;
|
---|
81 | OPUS_SET_LSB_DEPTH_REQUEST = 4036;
|
---|
82 | OPUS_GET_LSB_DEPTH_REQUEST = 4037;
|
---|
83 | OPUS_GET_LAST_PACKET_DURATION_REQUEST = 4039;
|
---|
84 | OPUS_SET_EXPERT_FRAME_DURATION_REQUEST = 4040;
|
---|
85 | OPUS_GET_EXPERT_FRAME_DURATION_REQUEST = 4041;
|
---|
86 | OPUS_SET_PREDICTION_DISABLED_REQUEST = 4042;
|
---|
87 | OPUS_GET_PREDICTION_DISABLED_REQUEST = 4043;
|
---|
88 | OPUS_MULTISTREAM_GET_ENCODER_STATE_REQUEST = 5120;
|
---|
89 | OPUS_MULTISTREAM_GET_DECODER_STATE_REQUEST = 5122;
|
---|
90 |
|
---|
91 | type
|
---|
92 | TOpusEncoder = Pointer;
|
---|
93 | TOpusDecoder = Pointer;
|
---|
94 | TOpusRepacketizer = Pointer;
|
---|
95 | TOpusMSDecoder = pointer;
|
---|
96 | TOpusMSEncoder = pointer;
|
---|
97 |
|
---|
98 | TOpusFrames = array [0..47] of Pointer;
|
---|
99 | TOpusFrameSizes = array [0..47] of cint;
|
---|
100 |
|
---|
101 | type
|
---|
102 | TRequestValueType = (orPointer, orInteger, orXY, orNoValue);
|
---|
103 | TOpusCTLRequestRecord = record
|
---|
104 | Request: Word;
|
---|
105 | case ReqType: TRequestValueType of
|
---|
106 | orPointer: (PtrValue: Pointer);
|
---|
107 | orInteger: (IntValue: cint);
|
---|
108 | orXY: (XValue: cint; YValue: pointer);
|
---|
109 | end;
|
---|
110 |
|
---|
111 | var
|
---|
112 | opus_get_version_string: function(): PAnsiChar; cdecl; opus_strerror: function(error: cint): PAnsiChar; cdecl;
|
---|
113 | opus_encode: function(st: TOpusEncoder; pcm : pcfloat; frame_size: cint;
|
---|
114 | var data; max_data_bytes: cint): cint; cdecl;
|
---|
115 | opus_encode_float: function(st: TOpusEncoder; pcm : pcfloat; frame_size: cint; var data; max_data_bytes: cint): cint; cdecl;
|
---|
116 | opus_encoder_create: function(Fs: cint; channels, application: cint; out error: cint): TOpusEncoder; cdecl;
|
---|
117 |
|
---|
118 | opus_encoder_ctli: function(st: TOpusEncoder; const reqrequest: word ; reqval : cint ): cint; cdecl;
|
---|
119 | opus_encoder_ctlp: function(st: TOpusEncoder; const reqrequest: word ; reqval : pointer ): cint; cdecl;
|
---|
120 | opus_encoder_ctlxy: function(st: TOpusEncoder; const reqrequest: word ; reqx : cint ; reqy : pointer ): cint; cdecl;
|
---|
121 | opus_encoder_ctln: function(st: TOpusEncoder; const reqrequest: word): cint; cdecl;
|
---|
122 |
|
---|
123 | opus_encoder_destroy: procedure(st: TOpusEncoder); cdecl;
|
---|
124 | opus_encoder_get_size: function(channels: cint): cint; cdecl;
|
---|
125 | opus_encoder_init: function(st: TOpusEncoder; Fs: cint; channels, application: cint): cint; cdecl;
|
---|
126 |
|
---|
127 | opus_decode: function(st: TOpusDecoder; const data; len: cint; pcm : pcfloat; frame_size, decode_fec: cint): cint; cdecl;
|
---|
128 | opus_decode_float: function(st: TOpusDecoder; const data; len: cint; pcm : pcfloat; frame_size, decode_fec: cint): cint; cdecl;
|
---|
129 | opus_decoder_create: function(fs: cint; channels: cint; out error: cint): TOpusDecoder; cdecl;
|
---|
130 |
|
---|
131 | opus_decoder_ctli: function(st: TOpusDecoder; const reqrequest: word ; reqval : cint ): cint; cdecl;
|
---|
132 | opus_decoder_ctlp: function(st: TOpusDecoder; const reqrequest: word ; reqval : pointer ): cint; cdecl;
|
---|
133 | opus_decoder_ctlxy: function(st: TOpusDecoder; const reqrequest: word ; reqx : cint ; reqy : pointer ): cint; cdecl;
|
---|
134 | opus_decoder_ctln: function(st: TOpusDecoder; const reqrequest: word): cint; cdecl;
|
---|
135 |
|
---|
136 | opus_decoder_destroy: procedure(st: TOpusDecoder); cdecl;
|
---|
137 | opus_decoder_get_nb_samples: function(st: TOpusDecoder; const packet; len: cint): cint; cdecl;
|
---|
138 | opus_decoder_get_size: function(channels: cint): cint; cdecl;
|
---|
139 | opus_decoder_init: function(st: TOpusDecoder; Fs: cint; channels: cint): cint; cdecl;
|
---|
140 | opus_packet_get_bandwidth: function(const packet): cint; cdecl;
|
---|
141 | opus_packet_get_nb_channels: function(const packet): cint; cdecl;
|
---|
142 | opus_packet_get_nb_frames: function(const packet; len: cint): cint; cdecl;
|
---|
143 | opus_packet_get_nb_samples: function(const packet; len, fs: cint): cint; cdecl;
|
---|
144 | opus_packet_get_samples_per_frame: function(const packet; fs: cint): cint; cdecl;
|
---|
145 | opus_packet_parse: function(const packet; var out_toc: Pointer; var frames: TOpusFrames; var size: TOpusFrameSizes; var payload_offset: cint): cint; cdecl;
|
---|
146 | opus_pcm_soft_clip: procedure(pcm : pcfloat; frame_size, channels: cint; var softclip_mem: Double); cdecl;
|
---|
147 |
|
---|
148 | opus_multistream_packet_pad: function(var data; len, new_len, nb_streams: cint): cint; cdecl;
|
---|
149 | opus_multistream_packet_unpad: function(var data; len, nb_streams: cint): cint; cdecl;
|
---|
150 | opus_packet_pad: function(var data; len, new_len: cint): cint; cdecl;
|
---|
151 | opus_packet_unpad: function(var data; len: cint): cint; cdecl;
|
---|
152 | opus_repacketizer_cat: function(rp: TOpusRepacketizer; const data; len: cint): cint; cdecl;
|
---|
153 | opus_repacketizer_create: function: TOpusRepacketizer; cdecl;
|
---|
154 | opus_repacketizer_destroy: procedure(rp: TOpusRepacketizer); cdecl;
|
---|
155 | opus_repacketizer_get_nb_frames: function(rp: TOpusRepacketizer): cint; cdecl;
|
---|
156 | opus_repacketizer_get_size: function: cint; cdecl;
|
---|
157 | opus_repacketizer_init: function(rp: TOpusRepacketizer): TOpusRepacketizer; cdecl;
|
---|
158 | opus_repacketizer_out: function(rp: TOpusRepacketizer; var data; maxlen: cint): cint; cdecl;
|
---|
159 | opus_repacketizer_out_range: function(rp: TOpusRepacketizer; var data; maxlen: cint): cint; cdecl;
|
---|
160 |
|
---|
161 | opus_multistream_decode: function(st: TOpusMSDecoder; const data; len: cint; pcm : pcfloat; frame_size, decode_fec: cint): cint; cdecl;
|
---|
162 | opus_multistream_decode_float: function(st: TOpusMSDecoder; const data; len: cint; pcm : pcfloat; frame_size, decode_fec: cint): cint; cdecl;
|
---|
163 | opus_multistream_decoder_create: function(fs: cint; channels, streams, coupled_streams: cint; const mapping: array of Byte; out error: cint): TOpusMSDecoder; cdecl;
|
---|
164 |
|
---|
165 | opus_multistream_decoder_ctli: function(st: TOpusMSDecoder; const reqrequest: word ; reqval : cint ): cint; cdecl;
|
---|
166 | opus_multistream_decoder_ctlp: function(st: TOpusMSDecoder; const reqrequest: word ; reqval : pointer ): cint; cdecl;
|
---|
167 | opus_multistream_decoder_ctlxy: function(st: TOpusMSDecoder; const reqrequest: word ; reqx : cint ; reqy : pointer ): cint; cdecl;
|
---|
168 | opus_multistream_decoder_ctln: function(st: TOpusMSDecoder; const reqrequest: word): cint; cdecl;
|
---|
169 |
|
---|
170 | opus_multistream_decoder_destroy: procedure(st: TOpusMSDecoder); cdecl;
|
---|
171 | opus_multistream_decoder_get_size: function(streams, coupled_streams: cint): cint; cdecl;
|
---|
172 | opus_multistream_decoder_init: function(st: TOpusMSDecoder; fs: cint; channels, streams, coupled_streams: cint; const mapping: array of Byte): cint; cdecl;
|
---|
173 |
|
---|
174 | opus_multistream_encode: function(st: TOpusMSEncoder; pcm : pcfloat; frame_size: cint; var data; max_data_bytes: cint): cint; cdecl;
|
---|
175 | opus_multistream_encode_float: function(st: TOpusMSEncoder; pcm : pcfloat; frame_size: cint; var data; max_data_bytes: cint): cint; cdecl;
|
---|
176 | opus_multistream_encoder_create: function(Fs: cint; channels, streams, coupled_streams: cint; const mapping: array of Byte; application: cint; out error: cint): TOpusMSEncoder; cdecl;
|
---|
177 |
|
---|
178 | opus_multistream_encoder_ctli: function(st: TOpusMSEncoder; const reqrequest: word ; reqval : cint ): cint; cdecl;
|
---|
179 | opus_multistream_encoder_ctlp: function(st: TOpusMSEncoder; const reqrequest: word ; reqval : pointer ): cint; cdecl;
|
---|
180 | opus_multistream_encoder_ctlxy: function(st: TOpusMSEncoder; const reqrequest: word ; reqx : cint ; reqy : pointer ): cint; cdecl;
|
---|
181 | opus_multistream_encoder_ctln: function(st: TOpusMSEncoder; const reqrequest: word ): cint; cdecl;
|
---|
182 |
|
---|
183 | opus_multistream_encoder_destroy: procedure(st: TOpusMSEncoder); cdecl;
|
---|
184 | opus_multistream_encoder_get_size: function(streams, coupled_streams: cint): cint; cdecl;
|
---|
185 | opus_multistream_encoder_init: function(st: TOpusMSEncoder; fs: cint; channels, streams, coupled_streams: cint; const mapping: array of Byte; application: cint): cint; cdecl;
|
---|
186 |
|
---|
187 | opus_multistream_surround_encoder_create: function(Fs: cint; channels, mapping_family, streams, coupled_streams: cint; const mapping: array of Byte; application: cint; out error: cint): TOpusMSEncoder; cdecl;
|
---|
188 | opus_multistream_surround_encoder_get_size: function(channels, mapping_family: cint): cint; cdecl;
|
---|
189 | opus_multistream_surround_encoder_init: function(st: TOpusMSEncoder; fs: cint; channels, mapping_family, streams, coupled_streams: cint; const mapping: array of Byte; application: cint): cint; cdecl;
|
---|
190 |
|
---|
191 | function opus_encoder_ctl(st: TOpusEncoder; const req: TOpusCTLRequestRecord): Integer; inline;
|
---|
192 | function opus_decoder_ctl(st: TOpusdecoder; const req: TOpusCTLRequestRecord): Integer; inline;
|
---|
193 |
|
---|
194 | function opus_multistream_encoder_ctl(st: TOpusMSEncoder; const req: TOpusCTLRequestRecord): cint; inline;
|
---|
195 | function opus_multistream_decoder_ctl(st: TOpusMSdecoder; const req: TOpusCTLRequestRecord): cint; inline;
|
---|
196 |
|
---|
197 | // Macros for opus_encode_ctl.
|
---|
198 | function OPUS_GET_APPLICATION(var x: cint): TOpusCTLRequestRecord; inline;
|
---|
199 | function OPUS_GET_BITRATE(var x: cint): TOpusCTLRequestRecord; inline;
|
---|
200 | function OPUS_GET_COMPLEXITY(var x: cint): TOpusCTLRequestRecord; inline;
|
---|
201 | function OPUS_GET_DTX(var x: cint): TOpusCTLRequestRecord; inline;
|
---|
202 | function OPUS_GET_EXPERT_FRAME_DURATION(var x: cint): TOpusCTLRequestRecord; inline;
|
---|
203 | function OPUS_GET_FORCE_CHANNELS(var x: cint): TOpusCTLRequestRecord; inline;
|
---|
204 | function OPUS_GET_LOOKAHEAD(var x: cint): TOpusCTLRequestRecord; inline;
|
---|
205 | function OPUS_GET_LSB_DEPTH(var x: cint): TOpusCTLRequestRecord; inline;
|
---|
206 | function OPUS_GET_MAX_BANDWIDTH(var x: cint): TOpusCTLRequestRecord; inline;
|
---|
207 | function OPUS_GET_PACKET_LOSS_PERC(var x: cint): TOpusCTLRequestRecord; inline;
|
---|
208 | function OPUS_GET_PREDICTION_DISABLED(var x: cint): TOpusCTLRequestRecord; inline;
|
---|
209 | function OPUS_GET_SIGNAL(var x: cint): TOpusCTLRequestRecord; inline;
|
---|
210 | function OPUS_GET_VBR(var x: cint): TOpusCTLRequestRecord; inline;
|
---|
211 | function OPUS_GET_VBR_CONSTRAINT(var x: cint): TOpusCTLRequestRecord; inline;
|
---|
212 |
|
---|
213 | function OPUS_SET_APPLICATION(x: cint): TOpusCTLRequestRecord; inline;
|
---|
214 | function OPUS_SET_BANDWIDTH(x: cint): TOpusCTLRequestRecord; inline;
|
---|
215 | function OPUS_SET_BITRATE(x: cint): TOpusCTLRequestRecord; inline;
|
---|
216 | function OPUS_SET_COMPLEXITY(x: cint): TOpusCTLRequestRecord; inline;
|
---|
217 | function OPUS_SET_DTX(x: cint): TOpusCTLRequestRecord; inline;
|
---|
218 | function OPUS_SET_EXPERT_FRAME_DURATION(x: cint): TOpusCTLRequestRecord; inline;
|
---|
219 | function OPUS_SET_FORCE_CHANNELS(x: cint): TOpusCTLRequestRecord; inline;
|
---|
220 | function OPUS_SET_INBAND_FEC(x: cint): TOpusCTLRequestRecord; inline;
|
---|
221 | function OPUS_SET_LSB_DEPTH(x: cint): TOpusCTLRequestRecord; inline;
|
---|
222 | function OPUS_SET_MAX_BANDWIDTH(x: cint): TOpusCTLRequestRecord; inline;
|
---|
223 | function OPUS_SET_PACKET_LOSS_PERC(x: cint): TOpusCTLRequestRecord; inline;
|
---|
224 | function OPUS_SET_PREDICTION_DISABLED(x: cint): TOpusCTLRequestRecord; inline;
|
---|
225 | function OPUS_SET_SIGNAL(x: cint): TOpusCTLRequestRecord; inline;
|
---|
226 | function OPUS_SET_VBR(x: cint): TOpusCTLRequestRecord; inline;
|
---|
227 | function OPUS_SET_VBR_CONSTRAINT(x: cint): TOpusCTLRequestRecord; inline;
|
---|
228 |
|
---|
229 | // For opus_decoder_ctl and opus_encoder_ctl.
|
---|
230 | function OPUS_GET_BANDWIDTH(var x: cint): TOpusCTLRequestRecord; inline;
|
---|
231 | function OPUS_GET_FINAL_RANGE(var x: Cardinal): TOpusCTLRequestRecord; inline;
|
---|
232 | function OPUS_GET_SAMPLE_RATE(var x: cint): TOpusCTLRequestRecord; inline;
|
---|
233 | function OPUS_RESET_STATE: TOpusCTLRequestRecord; inline;
|
---|
234 |
|
---|
235 | // For the opus_decode_ctl.
|
---|
236 | function OPUS_GET_GAIN(var x: cint): TOpusCTLRequestRecord; inline;
|
---|
237 | function OPUS_GET_LAST_PACKET_DURATION(var x: cint): TOpusCTLRequestRecord; inline;
|
---|
238 | function OPUS_GET_PITCH(var x: cint): TOpusCTLRequestRecord; inline;
|
---|
239 | function OPUS_SET_GAIN(x: cint): TOpusCTLRequestRecord; inline;
|
---|
240 |
|
---|
241 | function OPUS_MULTISTREAM_GET_DECODER_STATE(x: cint; var y: cint): TOpusCTLRequestRecord; inline;
|
---|
242 | function OPUS_MULTISTREAM_GET_ENCODER_STATE(x: cint; var y: cint): TOpusCTLRequestRecord; inline;
|
---|
243 |
|
---|
244 | var op_Handle:TLibHandle=dynlibs.NilHandle;
|
---|
245 |
|
---|
246 | var ReferenceCounter : cardinal = 0;
|
---|
247 |
|
---|
248 | function op_IsLoaded : boolean; inline;
|
---|
249 |
|
---|
250 | Function op_Load(const libfilename:string) :boolean;
|
---|
251 |
|
---|
252 | Procedure op_Unload;
|
---|
253 |
|
---|
254 | implementation
|
---|
255 |
|
---|
256 | function op_IsLoaded: boolean;
|
---|
257 | begin
|
---|
258 | Result := (op_Handle <> dynlibs.NilHandle);
|
---|
259 | end;
|
---|
260 |
|
---|
261 | Procedure op_Unload;
|
---|
262 | begin
|
---|
263 | // < Reference counting
|
---|
264 | if ReferenceCounter > 0 then
|
---|
265 | dec(ReferenceCounter);
|
---|
266 | if ReferenceCounter > 0 then
|
---|
267 | exit;
|
---|
268 | // >
|
---|
269 | if op_IsLoaded then
|
---|
270 | begin
|
---|
271 | DynLibs.UnloadLibrary(op_Handle);
|
---|
272 | op_Handle:=DynLibs.NilHandle;
|
---|
273 | end;
|
---|
274 | end;
|
---|
275 |
|
---|
276 | Function op_Load (const libfilename:string) :boolean;
|
---|
277 | begin
|
---|
278 | Result := False;
|
---|
279 | if op_Handle<>0 then
|
---|
280 | begin
|
---|
281 | Inc(ReferenceCounter);
|
---|
282 | result:=true {is it already there ?}
|
---|
283 | end else
|
---|
284 | begin {go & load the library}
|
---|
285 | if Length(libfilename) = 0 then exit;
|
---|
286 | op_Handle:=DynLibs.SafeLoadLibrary(libfilename); // obtain the handle we want
|
---|
287 | if op_Handle <> DynLibs.NilHandle then
|
---|
288 | begin {now we tie the functions to the VARs from above}
|
---|
289 | Pointer(opus_get_version_string):=DynLibs.GetProcedureAddress(OP_Handle,PChar('opus_get_version_string'));
|
---|
290 | Pointer(opus_strerror):=DynLibs.GetProcedureAddress(OP_Handle,PChar('opus_strerror'));
|
---|
291 | Pointer(opus_encode):=DynLibs.GetProcedureAddress(OP_Handle,PChar('opus_encode'));
|
---|
292 | Pointer(opus_encode_float):=DynLibs.GetProcedureAddress(OP_Handle,PChar('opus_encode_float'));
|
---|
293 | Pointer(opus_encoder_create):=DynLibs.GetProcedureAddress(OP_Handle,PChar('opus_encoder_create'));
|
---|
294 |
|
---|
295 | Pointer(opus_encoder_ctli):=DynLibs.GetProcedureAddress(OP_Handle,PChar('opus_encoder_ctl'));
|
---|
296 | Pointer(opus_encoder_ctlp):=DynLibs.GetProcedureAddress(OP_Handle,PChar('opus_encoder_ctl'));
|
---|
297 | Pointer(opus_encoder_ctlxy):=DynLibs.GetProcedureAddress(OP_Handle,PChar('opus_encoder_ctl'));
|
---|
298 | Pointer(opus_encoder_ctln):=DynLibs.GetProcedureAddress(OP_Handle,PChar('opus_encoder_ctl'));
|
---|
299 |
|
---|
300 | Pointer(opus_encoder_destroy):=DynLibs.GetProcedureAddress(OP_Handle,PChar('opus_encoder_destroy'));
|
---|
301 | Pointer(opus_encoder_get_size):=DynLibs.GetProcedureAddress(OP_Handle,PChar('opus_encoder_get_size'));
|
---|
302 | Pointer(opus_encoder_init):=DynLibs.GetProcedureAddress(OP_Handle,PChar('opus_encoder_init'));
|
---|
303 | Pointer(opus_decode):=DynLibs.GetProcedureAddress(OP_Handle,PChar('opus_decode'));
|
---|
304 | Pointer(opus_decode_float):=DynLibs.GetProcedureAddress(OP_Handle,PChar('opus_decode_float'));
|
---|
305 | Pointer(opus_decoder_create):=DynLibs.GetProcedureAddress(OP_Handle,PChar('opus_decoder_create'));
|
---|
306 |
|
---|
307 | Pointer(opus_decoder_ctli):=DynLibs.GetProcedureAddress(OP_Handle,PChar('opus_decoder_ctl'));
|
---|
308 | Pointer(opus_decoder_ctlp):=DynLibs.GetProcedureAddress(OP_Handle,PChar('opus_decoder_ctl'));
|
---|
309 | Pointer(opus_decoder_ctlxy):=DynLibs.GetProcedureAddress(OP_Handle,PChar('opus_decoder_ctl'));
|
---|
310 | Pointer(opus_decoder_ctln):=DynLibs.GetProcedureAddress(OP_Handle,PChar('opus_decoder_ctl'));
|
---|
311 |
|
---|
312 | Pointer(opus_decoder_destroy):=DynLibs.GetProcedureAddress(OP_Handle,PChar('opus_decoder_destroy'));
|
---|
313 | Pointer(opus_decoder_get_nb_samples):=DynLibs.GetProcedureAddress(OP_Handle,PChar('opus_decoder_get_nb_samples'));
|
---|
314 | Pointer(opus_decoder_get_size):=DynLibs.GetProcedureAddress(OP_Handle,PChar('opus_decoder_get_size'));
|
---|
315 | Pointer(opus_decoder_init):=DynLibs.GetProcedureAddress(OP_Handle,PChar('opus_decoder_init'));
|
---|
316 | Pointer(opus_packet_get_bandwidth):=DynLibs.GetProcedureAddress(OP_Handle,PChar('opus_packet_get_bandwidth'));
|
---|
317 | Pointer(opus_packet_get_nb_channels):=DynLibs.GetProcedureAddress(OP_Handle,PChar('opus_packet_get_nb_channels'));
|
---|
318 | Pointer(opus_packet_get_nb_frames):=DynLibs.GetProcedureAddress(OP_Handle,PChar('opus_packet_get_nb_frames'));
|
---|
319 | Pointer(opus_packet_get_nb_samples):=DynLibs.GetProcedureAddress(OP_Handle,PChar('opus_packet_get_nb_samples'));
|
---|
320 | Pointer(opus_packet_get_samples_per_frame):=DynLibs.GetProcedureAddress(OP_Handle,PChar('opus_packet_get_samples_per_frame'));
|
---|
321 | Pointer( opus_packet_parse):=DynLibs.GetProcedureAddress(OP_Handle,PChar(' opus_packet_parse'));
|
---|
322 | Pointer(opus_pcm_soft_clip):=DynLibs.GetProcedureAddress(OP_Handle,PChar('opus_pcm_soft_clip'));
|
---|
323 | Pointer(opus_multistream_packet_pad):=DynLibs.GetProcedureAddress(OP_Handle,PChar('opus_multistream_packet_pad'));
|
---|
324 | Pointer(opus_multistream_packet_unpad):=DynLibs.GetProcedureAddress(OP_Handle,PChar('opus_multistream_packet_unpad'));
|
---|
325 | Pointer(opus_packet_pad):=DynLibs.GetProcedureAddress(OP_Handle,PChar('opus_packet_pad'));
|
---|
326 | Pointer(opus_packet_unpad):=DynLibs.GetProcedureAddress(OP_Handle,PChar('opus_packet_unpad'));
|
---|
327 | Pointer(opus_repacketizer_cat):=DynLibs.GetProcedureAddress(OP_Handle,PChar('opus_repacketizer_cat'));
|
---|
328 | Pointer(opus_repacketizer_create):=DynLibs.GetProcedureAddress(OP_Handle,PChar('opus_repacketizer_create'));
|
---|
329 | Pointer(opus_repacketizer_destroy):=DynLibs.GetProcedureAddress(OP_Handle,PChar('oopus_repacketizer_destroy'));
|
---|
330 | Pointer(opus_repacketizer_get_nb_frames):=DynLibs.GetProcedureAddress(OP_Handle,PChar('opus_repacketizer_get_nb_frames'));
|
---|
331 | Pointer(opus_repacketizer_get_size):=DynLibs.GetProcedureAddress(OP_Handle,PChar('opus_repacketizer_get_size'));
|
---|
332 | Pointer(opus_repacketizer_init):=DynLibs.GetProcedureAddress(OP_Handle,PChar('opus_repacketizer_init'));
|
---|
333 | Pointer(opus_repacketizer_out):=DynLibs.GetProcedureAddress(OP_Handle,PChar('opus_repacketizer_out'));
|
---|
334 | Pointer(opus_repacketizer_out_range):=DynLibs.GetProcedureAddress(OP_Handle,PChar('opus_repacketizer_out_range'));
|
---|
335 | Pointer(opus_multistream_decode):=DynLibs.GetProcedureAddress(OP_Handle,PChar('opus_multistream_decode'));
|
---|
336 | Pointer(opus_multistream_decode_float):=DynLibs.GetProcedureAddress(OP_Handle,PChar('opus_multistream_decode_float'));
|
---|
337 | Pointer(opus_multistream_decoder_create):=DynLibs.GetProcedureAddress(OP_Handle,PChar('opus_multistream_decoder_create'));
|
---|
338 |
|
---|
339 | Pointer(opus_multistream_decoder_ctli):=DynLibs.GetProcedureAddress(OP_Handle,PChar('opus_multistream_decoder_ctl'));
|
---|
340 | Pointer(opus_multistream_decoder_ctlp):=DynLibs.GetProcedureAddress(OP_Handle,PChar('opus_multistream_decoder_ctl'));
|
---|
341 | Pointer(opus_multistream_decoder_ctlxy):=DynLibs.GetProcedureAddress(OP_Handle,PChar('opus_multistream_decoder_ctl'));
|
---|
342 | Pointer(opus_multistream_decoder_ctln):=DynLibs.GetProcedureAddress(OP_Handle,PChar('opus_multistream_decoder_ctl'));
|
---|
343 |
|
---|
344 | Pointer(opus_multistream_decoder_destroy):=DynLibs.GetProcedureAddress(OP_Handle,PChar('opus_multistream_decoder_destroy'));
|
---|
345 | Pointer(opus_multistream_decoder_get_size):=DynLibs.GetProcedureAddress(OP_Handle,PChar('opus_multistream_decoder_get_size'));
|
---|
346 | Pointer(opus_multistream_decoder_init):=DynLibs.GetProcedureAddress(OP_Handle,PChar('opus_multistream_decoder_init'));
|
---|
347 | Pointer(opus_multistream_encode):=DynLibs.GetProcedureAddress(OP_Handle,PChar('opus_multistream_encode'));
|
---|
348 | Pointer(opus_multistream_encode_float):=DynLibs.GetProcedureAddress(OP_Handle,PChar('opus_multistream_encode_float'));
|
---|
349 | Pointer(opus_multistream_encoder_create):=DynLibs.GetProcedureAddress(OP_Handle,PChar('opus_multistream_encoder_create'));
|
---|
350 |
|
---|
351 | Pointer(opus_multistream_encoder_ctli):=DynLibs.GetProcedureAddress(OP_Handle,PChar('opus_multistream_encoder_ctl'));
|
---|
352 | Pointer(opus_multistream_encoder_ctlp):=DynLibs.GetProcedureAddress(OP_Handle,PChar('opus_multistream_encoder_ctl'));
|
---|
353 | Pointer(opus_multistream_encoder_ctlxy):=DynLibs.GetProcedureAddress(OP_Handle,PChar('opus_multistream_encoder_ctl'));
|
---|
354 | Pointer(opus_multistream_encoder_ctln):=DynLibs.GetProcedureAddress(OP_Handle,PChar('opus_multistream_encoder_ctl'));
|
---|
355 |
|
---|
356 | Pointer(opus_multistream_encoder_destroy):=DynLibs.GetProcedureAddress(OP_Handle,PChar('opus_multistream_encoder_destroy'));
|
---|
357 | Pointer(opus_multistream_encoder_get_size):=DynLibs.GetProcedureAddress(OP_Handle,PChar('opus_multistream_encoder_get_size'));
|
---|
358 | Pointer(opus_multistream_encoder_init):=DynLibs.GetProcedureAddress(OP_Handle,PChar('opus_multistream_encoder_init'));
|
---|
359 | Pointer(opus_multistream_surround_encoder_create):=DynLibs.GetProcedureAddress(OP_Handle,PChar('opus_multistream_surround_encoder_create'));
|
---|
360 | Pointer(opus_multistream_surround_encoder_get_size):=DynLibs.GetProcedureAddress(OP_Handle,PChar('opus_multistream_surround_encoder_get_size'));
|
---|
361 | Pointer(opus_multistream_surround_encoder_init):=DynLibs.GetProcedureAddress(OP_Handle,PChar('opus_multistream_surround_encoder_init'));
|
---|
362 |
|
---|
363 | end;
|
---|
364 | Result := op_IsLoaded;
|
---|
365 | ReferenceCounter:=1;
|
---|
366 | end;
|
---|
367 |
|
---|
368 | end;
|
---|
369 |
|
---|
370 |
|
---|
371 | function OPUS_GET_APPLICATION(var x: cint): TOpusCTLRequestRecord; inline;
|
---|
372 | begin
|
---|
373 | Result.Request := OPUS_GET_APPLICATION_REQUEST;
|
---|
374 | Result.ReqType := orPointer;
|
---|
375 | Result.PtrValue := @x;
|
---|
376 | end;
|
---|
377 |
|
---|
378 | function OPUS_GET_BITRATE(var x: cint): TOpusCTLRequestRecord; inline;
|
---|
379 | begin
|
---|
380 | Result.Request := OPUS_GET_BITRATE_REQUEST;
|
---|
381 | Result.ReqType := orPointer;
|
---|
382 | Result.PtrValue := @x;
|
---|
383 | end;
|
---|
384 |
|
---|
385 | function OPUS_GET_COMPLEXITY(var x: cint): TOpusCTLRequestRecord; inline;
|
---|
386 | begin
|
---|
387 | Result.Request := OPUS_GET_COMPLEXITY_REQUEST;
|
---|
388 | Result.ReqType := orPointer;
|
---|
389 | Result.PtrValue := @x;
|
---|
390 | end;
|
---|
391 |
|
---|
392 | function OPUS_GET_DTX(var x: cint): TOpusCTLRequestRecord; inline;
|
---|
393 | begin
|
---|
394 | Result.Request := OPUS_GET_DTX_REQUEST;
|
---|
395 | Result.ReqType := orPointer;
|
---|
396 | Result.PtrValue := @x;
|
---|
397 | end;
|
---|
398 |
|
---|
399 | function OPUS_GET_EXPERT_FRAME_DURATION(var x: cint): TOpusCTLRequestRecord; inline;
|
---|
400 | begin
|
---|
401 | Result.Request := OPUS_GET_EXPERT_FRAME_DURATION_REQUEST;
|
---|
402 | Result.ReqType := orPointer;
|
---|
403 | Result.PtrValue := @x;
|
---|
404 | end;
|
---|
405 |
|
---|
406 | function OPUS_GET_FORCE_CHANNELS(var x: cint): TOpusCTLRequestRecord; inline;
|
---|
407 | begin
|
---|
408 | Result.Request := OPUS_GET_FORCE_CHANNELS_REQUEST;
|
---|
409 | Result.ReqType := orPointer;
|
---|
410 | Result.PtrValue := @x;
|
---|
411 | end;
|
---|
412 |
|
---|
413 | function OPUS_GET_LOOKAHEAD(var x: cint): TOpusCTLRequestRecord; inline;
|
---|
414 | begin
|
---|
415 | Result.Request := OPUS_GET_LOOKAHEAD_REQUEST;
|
---|
416 | Result.ReqType := orPointer;
|
---|
417 | Result.PtrValue := @x;
|
---|
418 | end;
|
---|
419 |
|
---|
420 | function OPUS_GET_LSB_DEPTH(var x: cint): TOpusCTLRequestRecord; inline;
|
---|
421 | begin
|
---|
422 | Result.Request := OPUS_GET_LSB_DEPTH_REQUEST;
|
---|
423 | Result.ReqType := orPointer;
|
---|
424 | Result.PtrValue := @x;
|
---|
425 | end;
|
---|
426 |
|
---|
427 | function OPUS_GET_MAX_BANDWIDTH(var x: cint): TOpusCTLRequestRecord; inline;
|
---|
428 | begin
|
---|
429 | Result.Request := OPUS_GET_MAX_BANDWIDTH_REQUEST;
|
---|
430 | Result.ReqType := orPointer;
|
---|
431 | Result.PtrValue := @x;
|
---|
432 | end;
|
---|
433 |
|
---|
434 | function OPUS_GET_PACKET_LOSS_PERC(var x: cint): TOpusCTLRequestRecord; inline;
|
---|
435 | begin
|
---|
436 | Result.Request := OPUS_GET_PACKET_LOSS_PERC_REQUEST;
|
---|
437 | Result.ReqType := orPointer;
|
---|
438 | Result.PtrValue := @x;
|
---|
439 | end;
|
---|
440 |
|
---|
441 | function OPUS_GET_PREDICTION_DISABLED(var x: cint): TOpusCTLRequestRecord; inline;
|
---|
442 | begin
|
---|
443 | Result.Request := OPUS_GET_PREDICTION_DISABLED_REQUEST;
|
---|
444 | Result.ReqType := orPointer;
|
---|
445 | Result.PtrValue := @x;
|
---|
446 | end;
|
---|
447 |
|
---|
448 | function OPUS_GET_SIGNAL(var x: cint): TOpusCTLRequestRecord; inline;
|
---|
449 | begin
|
---|
450 | Result.Request := OPUS_GET_SIGNAL_REQUEST;
|
---|
451 | Result.ReqType := orPointer;
|
---|
452 | Result.PtrValue := @x;
|
---|
453 | end;
|
---|
454 |
|
---|
455 | function OPUS_GET_VBR(var x: cint): TOpusCTLRequestRecord; inline;
|
---|
456 | begin
|
---|
457 | Result.Request := OPUS_GET_VBR_REQUEST;
|
---|
458 | Result.ReqType := orPointer;
|
---|
459 | Result.PtrValue := @x;
|
---|
460 | end;
|
---|
461 |
|
---|
462 | function OPUS_GET_VBR_CONSTRAINT(var x: cint): TOpusCTLRequestRecord; inline;
|
---|
463 | begin
|
---|
464 | Result.Request := OPUS_GET_VBR_CONSTRAINT_REQUEST;
|
---|
465 | Result.ReqType := orPointer;
|
---|
466 | Result.PtrValue := @x;
|
---|
467 | end;
|
---|
468 |
|
---|
469 | function OPUS_SET_APPLICATION(x: cint): TOpusCTLRequestRecord; inline;
|
---|
470 | begin
|
---|
471 | Result.Request := OPUS_SET_APPLICATION_REQUEST;
|
---|
472 | Result.ReqType := orInteger;
|
---|
473 | Result.IntValue := x;
|
---|
474 | end;
|
---|
475 |
|
---|
476 | function OPUS_SET_BANDWIDTH(x: cint): TOpusCTLRequestRecord; inline;
|
---|
477 | begin
|
---|
478 | Result.Request := OPUS_SET_BANDWIDTH_REQUEST;
|
---|
479 | Result.ReqType := orInteger;
|
---|
480 | Result.IntValue := x;
|
---|
481 | end;
|
---|
482 |
|
---|
483 | function OPUS_SET_BITRATE(x: cint): TOpusCTLRequestRecord; inline;
|
---|
484 | begin
|
---|
485 | Result.Request := OPUS_SET_BITRATE_REQUEST;
|
---|
486 | Result.ReqType := orInteger;
|
---|
487 | Result.IntValue := x;
|
---|
488 | end;
|
---|
489 |
|
---|
490 | function OPUS_SET_COMPLEXITY(x: cint): TOpusCTLRequestRecord; inline;
|
---|
491 | begin
|
---|
492 | Result.Request := OPUS_SET_COMPLEXITY_REQUEST;
|
---|
493 | Result.ReqType := orInteger;
|
---|
494 | Result.IntValue := x;
|
---|
495 | end;
|
---|
496 |
|
---|
497 | function OPUS_SET_DTX(x: cint): TOpusCTLRequestRecord; inline;
|
---|
498 | begin
|
---|
499 | Result.Request := OPUS_SET_DTX_REQUEST;
|
---|
500 | Result.ReqType := orInteger;
|
---|
501 | Result.IntValue := x;
|
---|
502 | end;
|
---|
503 |
|
---|
504 | function OPUS_SET_EXPERT_FRAME_DURATION(x: cint): TOpusCTLRequestRecord; inline;
|
---|
505 | begin
|
---|
506 | Result.Request := OPUS_SET_EXPERT_FRAME_DURATION_REQUEST;
|
---|
507 | Result.ReqType := orInteger;
|
---|
508 | Result.IntValue := x;
|
---|
509 | end;
|
---|
510 |
|
---|
511 | function OPUS_SET_FORCE_CHANNELS(x: cint): TOpusCTLRequestRecord; inline;
|
---|
512 | begin
|
---|
513 | Result.Request := OPUS_SET_FORCE_CHANNELS_REQUEST;
|
---|
514 | Result.ReqType := orInteger;
|
---|
515 | Result.IntValue := x;
|
---|
516 | end;
|
---|
517 |
|
---|
518 | function OPUS_SET_INBAND_FEC(x: cint): TOpusCTLRequestRecord; inline;
|
---|
519 | begin
|
---|
520 | Result.Request := OPUS_SET_INBAND_FEC_REQUEST;
|
---|
521 | Result.ReqType := orInteger;
|
---|
522 | Result.IntValue := x;
|
---|
523 | end;
|
---|
524 |
|
---|
525 | function OPUS_SET_LSB_DEPTH(x: cint): TOpusCTLRequestRecord; inline;
|
---|
526 | begin
|
---|
527 | Result.Request := OPUS_SET_LSB_DEPTH_REQUEST;
|
---|
528 | Result.ReqType := orInteger;
|
---|
529 | Result.IntValue := x;
|
---|
530 | end;
|
---|
531 |
|
---|
532 | function OPUS_SET_MAX_BANDWIDTH(x: cint): TOpusCTLRequestRecord; inline;
|
---|
533 | begin
|
---|
534 | Result.Request := OPUS_SET_MAX_BANDWIDTH_REQUEST;
|
---|
535 | Result.ReqType := orInteger;
|
---|
536 | Result.IntValue := x;
|
---|
537 | end;
|
---|
538 |
|
---|
539 | function OPUS_SET_PACKET_LOSS_PERC(x: cint): TOpusCTLRequestRecord; inline;
|
---|
540 | begin
|
---|
541 | Result.Request := OPUS_SET_PACKET_LOSS_PERC_REQUEST;
|
---|
542 | Result.ReqType := orInteger;
|
---|
543 | Result.IntValue := x;
|
---|
544 | end;
|
---|
545 |
|
---|
546 | function OPUS_SET_PREDICTION_DISABLED(x: cint): TOpusCTLRequestRecord; inline;
|
---|
547 | begin
|
---|
548 | Result.Request := OPUS_SET_PREDICTION_DISABLED_REQUEST;
|
---|
549 | Result.ReqType := orInteger;
|
---|
550 | Result.IntValue := x;
|
---|
551 | end;
|
---|
552 |
|
---|
553 | function OPUS_SET_SIGNAL(x: cint): TOpusCTLRequestRecord; inline;
|
---|
554 | begin
|
---|
555 | Result.Request := OPUS_SET_SIGNAL_REQUEST;
|
---|
556 | Result.ReqType := orInteger;
|
---|
557 | Result.IntValue := x;
|
---|
558 | end;
|
---|
559 |
|
---|
560 | function OPUS_SET_VBR(x: cint): TOpusCTLRequestRecord; inline;
|
---|
561 | begin
|
---|
562 | Result.Request := OPUS_SET_VBR_REQUEST;
|
---|
563 | Result.ReqType := orInteger;
|
---|
564 | Result.IntValue := x;
|
---|
565 | end;
|
---|
566 |
|
---|
567 | function OPUS_SET_VBR_CONSTRAINT(x: cint): TOpusCTLRequestRecord; inline;
|
---|
568 | begin
|
---|
569 | Result.Request := OPUS_SET_VBR_CONSTRAINT_REQUEST;
|
---|
570 | Result.ReqType := orInteger;
|
---|
571 | Result.IntValue := x;
|
---|
572 | end;
|
---|
573 |
|
---|
574 | function OPUS_GET_BANDWIDTH(var x: cint): TOpusCTLRequestRecord; inline;
|
---|
575 | begin
|
---|
576 | Result.Request := OPUS_GET_BANDWIDTH_REQUEST;
|
---|
577 | Result.ReqType := orPointer;
|
---|
578 | Result.PtrValue := @x;
|
---|
579 | end;
|
---|
580 |
|
---|
581 | function OPUS_GET_FINAL_RANGE(var x: Cardinal): TOpusCTLRequestRecord; inline;
|
---|
582 | begin
|
---|
583 | Result.Request := OPUS_GET_BANDWIDTH_REQUEST;
|
---|
584 | Result.ReqType := orPointer;
|
---|
585 | Result.PtrValue := @x;
|
---|
586 | end;
|
---|
587 |
|
---|
588 | function OPUS_GET_SAMPLE_RATE(var x: cint): TOpusCTLRequestRecord; inline;
|
---|
589 | begin
|
---|
590 | Result.Request := OPUS_GET_BANDWIDTH_REQUEST;
|
---|
591 | Result.ReqType := orPointer;
|
---|
592 | Result.PtrValue := @x;
|
---|
593 | end;
|
---|
594 |
|
---|
595 | function OPUS_RESET_STATE: TOpusCTLRequestRecord; inline;
|
---|
596 | begin
|
---|
597 | Result.Request := OPUS_RESET_STATE_REQUEST;
|
---|
598 | Result.ReqType := orNoValue;
|
---|
599 | end;
|
---|
600 |
|
---|
601 | function OPUS_GET_GAIN(var x: cint): TOpusCTLRequestRecord; inline;
|
---|
602 | begin
|
---|
603 | Result.Request := OPUS_GET_GAIN_REQUEST;
|
---|
604 | Result.ReqType := orPointer;
|
---|
605 | Result.PtrValue := @x;
|
---|
606 | end;
|
---|
607 |
|
---|
608 | function OPUS_GET_LAST_PACKET_DURATION(var x: cint): TOpusCTLRequestRecord; inline;
|
---|
609 | begin
|
---|
610 | Result.Request := OPUS_GET_LAST_PACKET_DURATION_REQUEST;
|
---|
611 | Result.ReqType := orPointer;
|
---|
612 | Result.PtrValue := @x;
|
---|
613 | end;
|
---|
614 |
|
---|
615 | function OPUS_GET_PITCH(var x: cint): TOpusCTLRequestRecord; inline;
|
---|
616 | begin
|
---|
617 | Result.Request := OPUS_GET_PITCH_REQUEST;
|
---|
618 | Result.ReqType := orPointer;
|
---|
619 | Result.PtrValue := @x;
|
---|
620 | end;
|
---|
621 |
|
---|
622 | function OPUS_SET_GAIN(x: cint): TOpusCTLRequestRecord; inline;
|
---|
623 | begin
|
---|
624 | Result.Request := OPUS_SET_GAIN_REQUEST;
|
---|
625 | Result.ReqType := orInteger;
|
---|
626 | Result.IntValue := x;
|
---|
627 | end;
|
---|
628 |
|
---|
629 | function OPUS_MULTISTREAM_GET_DECODER_STATE(x: cint; var y: cint): TOpusCTLRequestRecord; inline;
|
---|
630 | begin
|
---|
631 | Result.Request := OPUS_MULTISTREAM_GET_DECODER_STATE_REQUEST;
|
---|
632 | Result.ReqType := orXY;
|
---|
633 | Result.XValue := x;
|
---|
634 | Result.YValue := @y;
|
---|
635 | end;
|
---|
636 |
|
---|
637 | function OPUS_MULTISTREAM_GET_ENCODER_STATE(x: cint; var y: cint): TOpusCTLRequestRecord; inline;
|
---|
638 | begin
|
---|
639 | Result.Request := OPUS_MULTISTREAM_GET_ENCODER_STATE_REQUEST;
|
---|
640 | Result.ReqType := orXY;
|
---|
641 | Result.XValue := x;
|
---|
642 | Result.YValue := @y;
|
---|
643 | end;
|
---|
644 |
|
---|
645 | function opus_encoder_ctl(st: TOpusEncoder; const req: TOpusCTLRequestRecord): Integer; inline;
|
---|
646 | begin
|
---|
647 | case req.ReqType of
|
---|
648 | orPointer: Result := opus_encoder_ctlp(st, req.Request, req.PtrValue);
|
---|
649 | orInteger: Result := opus_encoder_ctli(st, req.Request, req.IntValue);
|
---|
650 | orXY: Result := opus_encoder_ctlxy(st, req.Request, req.XValue, req.YValue);
|
---|
651 | orNoValue: Result := opus_encoder_ctln(st, req.Request);
|
---|
652 | else
|
---|
653 | Result := OPUS_BAD_ARG;
|
---|
654 | end;
|
---|
655 | end;
|
---|
656 |
|
---|
657 | function opus_decoder_ctl(st: TOpusDecoder; const req: TOpusCTLRequestRecord): Integer; inline;
|
---|
658 | begin
|
---|
659 | case req.ReqType of
|
---|
660 | orPointer: Result := opus_decoder_ctlp(st, req.Request, req.PtrValue);
|
---|
661 | orInteger: Result := opus_decoder_ctli(st, req.Request, req.IntValue);
|
---|
662 | orXY: Result := opus_decoder_ctlxy(st, req.Request, req.XValue, req.YValue);
|
---|
663 | orNoValue: Result := opus_decoder_ctln(st, req.Request);
|
---|
664 | else
|
---|
665 | Result := OPUS_BAD_ARG;
|
---|
666 | end;
|
---|
667 | end;
|
---|
668 |
|
---|
669 | function opus_multistream_encoder_ctl(st: TOpusMSEncoder; const req: TOpusCTLRequestRecord): Integer; inline;
|
---|
670 | begin
|
---|
671 | case req.ReqType of
|
---|
672 | orPointer: Result := opus_multistream_encoder_ctlp(st, req.Request, req.PtrValue);
|
---|
673 | orInteger: Result := opus_multistream_encoder_ctli(st, req.Request, req.IntValue);
|
---|
674 | orXY: Result := opus_multistream_encoder_ctlxy(st, req.Request, req.XValue, req.YValue);
|
---|
675 | orNoValue: Result := opus_multistream_encoder_ctln(st, req.Request);
|
---|
676 | else
|
---|
677 | Result := OPUS_BAD_ARG;
|
---|
678 | end;
|
---|
679 | end;
|
---|
680 |
|
---|
681 | function opus_multistream_decoder_ctl(st: TOpusMSDecoder; const req: TOpusCTLRequestRecord): Integer; inline;
|
---|
682 | begin
|
---|
683 | case req.ReqType of
|
---|
684 | orPointer: Result := opus_multistream_decoder_ctlp(st, req.Request, req.PtrValue);
|
---|
685 | orInteger: Result := opus_multistream_decoder_ctli(st, req.Request, req.IntValue);
|
---|
686 | orXY: Result := opus_multistream_decoder_ctlxy(st, req.Request, req.XValue, req.YValue);
|
---|
687 | orNoValue: Result := opus_multistream_decoder_ctln(st, req.Request);
|
---|
688 | else
|
---|
689 | Result := OPUS_BAD_ARG;
|
---|
690 | end;
|
---|
691 | end;
|
---|
692 |
|
---|
693 | end.
|
---|