1 | //codecfilter.c: |
---|
2 | |
---|
3 | /* |
---|
4 | * Copyright (C) Philipp 'ph3-der-loewe' Schafft - 2008-2011 |
---|
5 | * |
---|
6 | * This file is part of roard a part of RoarAudio, |
---|
7 | * a cross-platform sound system for both, home and professional use. |
---|
8 | * See README for details. |
---|
9 | * |
---|
10 | * This file is free software; you can redistribute it and/or modify |
---|
11 | * it under the terms of the GNU General Public License version 3 |
---|
12 | * as published by the Free Software Foundation. |
---|
13 | * |
---|
14 | * RoarAudio is distributed in the hope that it will be useful, |
---|
15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
---|
17 | * GNU General Public License for more details. |
---|
18 | * |
---|
19 | * You should have received a copy of the GNU General Public License |
---|
20 | * along with this software; see the file COPYING. If not, write to |
---|
21 | * the Free Software Foundation, 51 Franklin Street, Fifth Floor, |
---|
22 | * Boston, MA 02110-1301, USA. |
---|
23 | * |
---|
24 | */ |
---|
25 | |
---|
26 | #define ROAR_REQUIRE_LIBVORBISFILE |
---|
27 | |
---|
28 | #include "roard.h" |
---|
29 | |
---|
30 | #ifndef ROAR_WITHOUT_CF_CMD |
---|
31 | #if !defined(ROAR_HAVE_UNIX) || !defined(ROAR_HAVE_BSDSOCKETS) || !defined(ROAR_HAVE_IO_POSIX) |
---|
32 | #define ROAR_WITHOUT_CF_CMD |
---|
33 | #endif |
---|
34 | #endif |
---|
35 | |
---|
36 | #define _DUMMY_FILTER(codec,name,desc,flags,subsystem,delay) {(codec),(name),(desc),NULL,NULL,(flags),(subsystem), \ |
---|
37 | NULL, NULL, NULL, NULL, NULL, NULL, (delay), NULL } |
---|
38 | |
---|
39 | #define _PCM_FILTER(codec) _DUMMY_FILTER(codec, "PCM", "Native PCM Support", \ |
---|
40 | ROAR_CODECFILTER_READ|ROAR_CODECFILTER_WRITE|ROAR_CODECFILTER_PRETHRU_NN, \ |
---|
41 | ROAR_SUBSYS_WAVEFORM, codecfilter_delay_zero) |
---|
42 | |
---|
43 | struct roar_codecfilter g_codecfilter[] = { |
---|
44 | _DUMMY_FILTER(-1, "null", "null codec filter", ROAR_CODECFILTER_NONE, ROAR_SUBSYS_NONE, NULL), |
---|
45 | _PCM_FILTER(ROAR_CODEC_PCM_S_LE), |
---|
46 | _PCM_FILTER(ROAR_CODEC_PCM_S_BE), |
---|
47 | _PCM_FILTER(ROAR_CODEC_PCM_S_PDP), |
---|
48 | _PCM_FILTER(ROAR_CODEC_PCM_U_LE), |
---|
49 | _PCM_FILTER(ROAR_CODEC_PCM_U_BE), |
---|
50 | _PCM_FILTER(ROAR_CODEC_PCM_U_PDP), |
---|
51 | #ifndef ROAR_WITHOUT_DCOMP_MIDI |
---|
52 | _DUMMY_FILTER(ROAR_CODEC_MIDI, "MIDI", "Native MIDI Support", |
---|
53 | ROAR_CODECFILTER_READ|ROAR_CODECFILTER_WRITE|ROAR_CODECFILTER_PRETHRU_NN, ROAR_SUBSYS_MIDI, NULL), |
---|
54 | #endif |
---|
55 | #ifndef ROAR_WITHOUT_DCOMP_LIGHT |
---|
56 | {ROAR_CODEC_DMX512, "DMX512", "Native DMX512 Support", NULL, NULL, |
---|
57 | ROAR_CODECFILTER_READ|ROAR_CODECFILTER_WRITE|ROAR_CODECFILTER_PRETHRU_NN, ROAR_SUBSYS_LIGHT, |
---|
58 | NULL, NULL, NULL, NULL, NULL, NULL, codecfilter_delay_zero, NULL}, |
---|
59 | #endif |
---|
60 | #ifndef ROAR_WITHOUT_DCOMP_RDTCS |
---|
61 | {ROAR_CODEC_RDS, "RDS", "Native RDS Support", NULL, NULL, |
---|
62 | ROAR_CODECFILTER_WRITE|ROAR_CODECFILTER_PRETHRU_NN, ROAR_SUBSYS_RDTCS, |
---|
63 | NULL, NULL, NULL, NULL, NULL, NULL, codecfilter_delay_zero, NULL}, |
---|
64 | #endif |
---|
65 | |
---|
66 | /* |
---|
67 | #ifdef ROAR_HAVE_LIBSNDFILE |
---|
68 | {ROAR_CODEC_RIFF_WAVE, "sndfile", "libsndfile codec filter", NULL, ROAR_CODECFILTER_READ|ROAR_CODECFILTER_WRITE, |
---|
69 | cf_sndfile_open, cf_sndfile_close, NULL, cf_sndfile_write, cf_sndfile_read, NULL}, |
---|
70 | #else |
---|
71 | */ |
---|
72 | #ifndef ROAR_WITHOUT_CF_WAVE |
---|
73 | {ROAR_CODEC_RIFF_WAVE, "RIFF/WAVE", "RIFF/WAVE", NULL, NULL, |
---|
74 | ROAR_CODECFILTER_READ|ROAR_CODECFILTER_WRITE|ROAR_CODECFILTER_PRETHRU, ROAR_SUBSYS_WAVEFORM, |
---|
75 | cf_wave_open, cf_wave_close, NULL, cf_wave_write, cf_wave_read, NULL, NULL, cf_wave_ctl}, |
---|
76 | #endif |
---|
77 | //#endif |
---|
78 | |
---|
79 | #ifndef ROAR_WITHOUT_CF_AU |
---|
80 | {ROAR_CODEC_AU, "AU", "AU", NULL, NULL, |
---|
81 | ROAR_CODECFILTER_READ|ROAR_CODECFILTER_WRITE|ROAR_CODECFILTER_PRETHRU, ROAR_SUBSYS_WAVEFORM, |
---|
82 | cf_au_open, cf_au_close, NULL, cf_au_write, cf_au_read, NULL, NULL, cf_au_ctl}, |
---|
83 | #endif |
---|
84 | |
---|
85 | #ifdef ROAR_HAVE_LIBRAUM |
---|
86 | {ROAR_CODEC_RAUM, "RAUM", "RAUM Container Format", NULL, cf_raum_setup, ROAR_CODECFILTER_WRITE, |
---|
87 | ROAR_SUBSYS_WAVEFORM|ROAR_SUBSYS_MIDI|ROAR_SUBSYS_LIGHT|ROAR_SUBSYS_RAW|ROAR_SUBSYS_COMPLEX, |
---|
88 | cont_fw_cf_open, cont_fw_cf_close, NULL, cont_fw_cf_write, cont_fw_cf_read, cont_fw_cf_flush, NULL, cont_fw_cf_ctl}, |
---|
89 | #endif |
---|
90 | |
---|
91 | #ifdef ROAR_HAVE_LIBOGG |
---|
92 | {ROAR_CODEC_OGG, "Ogg", "Ogg Container Format", NULL, NULL, ROAR_CODECFILTER_NONE, |
---|
93 | ROAR_SUBSYS_WAVEFORM|ROAR_SUBSYS_MIDI, |
---|
94 | NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL}, |
---|
95 | #endif |
---|
96 | |
---|
97 | #ifdef ROAR_SUPPORT_ALAW |
---|
98 | {ROAR_CODEC_ALAW, "alaw", "A-Law", NULL, NULL, |
---|
99 | #ifdef ROAR_SUPPORT_ALAW_RW |
---|
100 | ROAR_CODECFILTER_READ|ROAR_CODECFILTER_WRITE|ROAR_CODECFILTER_PRETHRU_NN, |
---|
101 | #else |
---|
102 | ROAR_CODECFILTER_READ|ROAR_CODECFILTER_PRETHRU_NN, |
---|
103 | #endif |
---|
104 | ROAR_SUBSYS_WAVEFORM, |
---|
105 | cf_alaw_open, cf_alaw_close, NULL, |
---|
106 | #ifdef ROAR_SUPPORT_ALAW_RW |
---|
107 | cf_alaw_write, |
---|
108 | #else |
---|
109 | NULL, |
---|
110 | #endif |
---|
111 | cf_alaw_read, NULL, codecfilter_delay_zero, NULL}, |
---|
112 | #endif |
---|
113 | |
---|
114 | #ifdef ROAR_SUPPORT_MULAW |
---|
115 | {ROAR_CODEC_MULAW, "mulaw", "mu-Law", NULL, NULL, |
---|
116 | #ifdef ROAR_SUPPORT_MULAW_RW |
---|
117 | ROAR_CODECFILTER_READ|ROAR_CODECFILTER_WRITE|ROAR_CODECFILTER_PRETHRU_NN, |
---|
118 | #else |
---|
119 | ROAR_CODECFILTER_READ|ROAR_CODECFILTER_PRETHRU_NN, |
---|
120 | #endif |
---|
121 | ROAR_SUBSYS_WAVEFORM, |
---|
122 | cf_mulaw_open, cf_mulaw_close, NULL, |
---|
123 | #ifdef ROAR_SUPPORT_MULAW_RW |
---|
124 | cf_mulaw_write, |
---|
125 | #else |
---|
126 | NULL, |
---|
127 | #endif |
---|
128 | cf_mulaw_read, NULL, codecfilter_delay_zero, NULL}, |
---|
129 | #endif |
---|
130 | |
---|
131 | #ifndef ROAR_WITHOUT_CF_CMD |
---|
132 | #ifdef ROAR_HAVE_BIN_OGG123 |
---|
133 | {ROAR_CODEC_OGG_GENERAL, "cmd", "ogg123", |
---|
134 | ROAR_HAVE_BIN_OGG123 " -q -d raw -f - -", NULL, ROAR_CODECFILTER_READ, ROAR_SUBSYS_WAVEFORM, |
---|
135 | cf_cmd_open, NULL, NULL, NULL, NULL, NULL, codecfilter_delay_fulldyn, NULL}, |
---|
136 | #endif |
---|
137 | #endif |
---|
138 | |
---|
139 | #ifdef ROAR_HAVE_LIBVORBISFILE |
---|
140 | {ROAR_CODEC_OGG_VORBIS, "oggvorbis", "Ogg Vorbis decoder", NULL, NULL, |
---|
141 | #ifdef ROAR_HAVE_LIBVORBISENC |
---|
142 | ROAR_CODECFILTER_READ|ROAR_CODECFILTER_WRITE|ROAR_CODECFILTER_PRETHRU, |
---|
143 | #else |
---|
144 | ROAR_CODECFILTER_READ, |
---|
145 | #endif |
---|
146 | ROAR_SUBSYS_WAVEFORM, |
---|
147 | cf_vorbis_open, cf_vorbis_close, NULL, cf_vorbis_write, cf_vorbis_read, NULL, codecfilter_delay_fulldyn, cf_vorbis_ctl}, |
---|
148 | #else |
---|
149 | #ifndef ROAR_WITHOUT_CF_CMD |
---|
150 | #ifdef ROAR_HAVE_BIN_OGG123 |
---|
151 | {ROAR_CODEC_OGG_VORBIS, "cmd", "ogg123", |
---|
152 | ROAR_HAVE_BIN_OGG123 " -q -d raw -f - -", NULL, ROAR_CODECFILTER_READ, ROAR_SUBSYS_WAVEFORM, |
---|
153 | cf_cmd_open, NULL, NULL, NULL, NULL, NULL, codecfilter_delay_fulldyn, NULL}, |
---|
154 | #endif |
---|
155 | #endif |
---|
156 | #endif |
---|
157 | |
---|
158 | #ifdef ROAR_HAVE_LIBFISHSOUND |
---|
159 | {ROAR_CODEC_OGG_SPEEX, "fishsound", "libfishsound Xiph Codec library", |
---|
160 | NULL, NULL, ROAR_CODECFILTER_READ, ROAR_SUBSYS_WAVEFORM, |
---|
161 | cf_fishsound_open, cf_fishsound_close, NULL, NULL, cf_fishsound_read, NULL, codecfilter_delay_fulldyn, NULL}, |
---|
162 | |
---|
163 | {ROAR_CODEC_OGG_FLAC, "fishsound", "libfishsound Xiph Codec library", |
---|
164 | NULL, NULL, ROAR_CODECFILTER_READ, ROAR_SUBSYS_WAVEFORM, |
---|
165 | cf_fishsound_open, cf_fishsound_close, NULL, NULL, cf_fishsound_read, NULL, codecfilter_delay_fulldyn, NULL}, |
---|
166 | #endif |
---|
167 | |
---|
168 | #ifndef ROAR_WITHOUT_CF_CMD |
---|
169 | #ifdef ROAR_HAVE_BIN_TIMIDITY |
---|
170 | {ROAR_CODEC_MIDI_FILE, "MIDIFILE", "timidity MIDI synth", |
---|
171 | ROAR_HAVE_BIN_TIMIDITY " -Or1sl -s %R -o - -", NULL, ROAR_CODECFILTER_READ, ROAR_SUBSYS_WAVEFORM, |
---|
172 | cf_cmd_open, NULL, NULL, NULL, NULL, NULL, codecfilter_delay_fulldyn, NULL}, |
---|
173 | #endif |
---|
174 | #endif |
---|
175 | |
---|
176 | #ifdef ROAR_HAVE_LIBCELT |
---|
177 | {ROAR_CODEC_ROAR_CELT, "RoarCELT", "RoarAudio CELT", NULL, NULL, |
---|
178 | ROAR_CODECFILTER_READ|ROAR_CODECFILTER_WRITE|ROAR_CODECFILTER_PRETHRU, |
---|
179 | ROAR_SUBSYS_WAVEFORM, |
---|
180 | cf_celt_open, cf_celt_close, NULL, cf_celt_write, cf_celt_read, NULL, cf_celt_delay, NULL}, |
---|
181 | #endif |
---|
182 | |
---|
183 | #ifdef ROAR_HAVE_LIBSPEEX |
---|
184 | {ROAR_CODEC_ROAR_SPEEX, "RoarSpeex", "RoarAudio Speex", NULL, NULL, |
---|
185 | ROAR_CODECFILTER_READ|ROAR_CODECFILTER_WRITE|ROAR_CODECFILTER_PRETHRU, |
---|
186 | ROAR_SUBSYS_WAVEFORM, |
---|
187 | cf_speex_open, cf_speex_close, NULL, cf_speex_write, cf_speex_read, NULL, NULL, NULL}, |
---|
188 | #endif |
---|
189 | |
---|
190 | #ifndef ROAR_WITHOUT_CF_CMD |
---|
191 | #if defined(ROAR_HAVE_BIN_FLAC) && !defined(ROAR_HAVE_LIBFLAC) |
---|
192 | {ROAR_CODEC_FLAC, "cmd", "flac", |
---|
193 | #if BYTE_ORDER == BIG_ENDIAN |
---|
194 | ROAR_HAVE_BIN_FLAC " --silent --force-raw-format --sign=signed --endian=big -d - -o -", |
---|
195 | #elif BYTE_ORDER == LITTLE_ENDIAN |
---|
196 | ROAR_HAVE_BIN_FLAC " --silent --force-raw-format --sign=signed --endian=little -d - -o -", |
---|
197 | #else |
---|
198 | "false", |
---|
199 | #endif |
---|
200 | NULL, ROAR_CODECFILTER_READ, ROAR_SUBSYS_WAVEFORM, |
---|
201 | cf_cmd_open, NULL, NULL, NULL, NULL, NULL, codecfilter_delay_fulldyn, NULL}, |
---|
202 | #endif |
---|
203 | #endif |
---|
204 | |
---|
205 | #ifdef ROAR_HAVE_LIBFLAC |
---|
206 | {ROAR_CODEC_FLAC, "FLAC", "flac codec", NULL, NULL, ROAR_CODECFILTER_READ, ROAR_SUBSYS_WAVEFORM, |
---|
207 | cf_flac_open, cf_flac_close, NULL, NULL, cf_flac_read, NULL, codecfilter_delay_fulldyn, NULL}, |
---|
208 | #endif |
---|
209 | |
---|
210 | #ifndef ROAR_WITHOUT_DCOMP_LIGHT |
---|
211 | _DUMMY_FILTER(ROAR_CODEC_ROARDMX, "RoarDMX", "Native RoarDMX Support", |
---|
212 | ROAR_CODECFILTER_READ|ROAR_CODECFILTER_WRITE|ROAR_CODECFILTER_PRETHRU_NN, ROAR_SUBSYS_LIGHT, NULL), |
---|
213 | #endif |
---|
214 | |
---|
215 | {-1, NULL, NULL, NULL, NULL, ROAR_CODECFILTER_NONE, ROAR_SUBSYS_NONE, |
---|
216 | NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL} // end of list |
---|
217 | }; |
---|
218 | |
---|
219 | void print_codecfilterlist (void) { |
---|
220 | int i; |
---|
221 | int flags; |
---|
222 | char mode[5]; |
---|
223 | char delay[6]; |
---|
224 | char subsys[7] = " "; |
---|
225 | uint_least32_t d; |
---|
226 | |
---|
227 | printf(" Codec Filtername Mode Subsys Delay - Description\n"); |
---|
228 | printf("-------------------------------------------------------------\n"); |
---|
229 | |
---|
230 | for (i = 0; g_codecfilter[i].name != NULL; i++) { |
---|
231 | strncpy(subsys, " ", 6); |
---|
232 | |
---|
233 | if ( g_codecfilter[i].subsystems & ROAR_SUBSYS_WAVEFORM ) |
---|
234 | subsys[0] = 'W'; |
---|
235 | if ( g_codecfilter[i].subsystems & ROAR_SUBSYS_MIDI ) |
---|
236 | subsys[1] = 'M'; |
---|
237 | if ( g_codecfilter[i].subsystems & ROAR_SUBSYS_CB ) |
---|
238 | subsys[2] = 'C'; |
---|
239 | if ( g_codecfilter[i].subsystems & ROAR_SUBSYS_LIGHT ) |
---|
240 | subsys[3] = 'L'; |
---|
241 | if ( g_codecfilter[i].subsystems & ROAR_SUBSYS_RAW ) |
---|
242 | subsys[4] = 'R'; |
---|
243 | if ( g_codecfilter[i].subsystems & ROAR_SUBSYS_COMPLEX ) |
---|
244 | subsys[5] = 'X'; |
---|
245 | |
---|
246 | flags = g_codecfilter[i].flags; |
---|
247 | |
---|
248 | if ( flags == ROAR_CODECFILTER_NONE ) { |
---|
249 | strcpy(mode, "none"); |
---|
250 | } else { |
---|
251 | strcpy(mode, " "); |
---|
252 | if ( flags & ROAR_CODECFILTER_READ ) |
---|
253 | mode[0] = 'r'; |
---|
254 | if ( flags & ROAR_CODECFILTER_WRITE ) |
---|
255 | mode[1] = 'w'; |
---|
256 | if ( flags & ROAR_CODECFILTER_PRETHRU ) |
---|
257 | mode[2] = 'P'; |
---|
258 | if ( flags & ROAR_CODECFILTER_PRETHRU_NN ) |
---|
259 | mode[2] = 'p'; |
---|
260 | } |
---|
261 | |
---|
262 | *delay = 0; |
---|
263 | if ( g_codecfilter[i].codec == -1 ) { // null codec filter |
---|
264 | strcpy(delay, "0ms"); |
---|
265 | } else if ( g_codecfilter[i].delay == NULL ) { |
---|
266 | strcpy(delay, "?"); |
---|
267 | } else { |
---|
268 | if ( codecfilter_delay(NULL, i, &d) == -1 ) { |
---|
269 | strcpy(delay, "dyn"); |
---|
270 | } else { |
---|
271 | snprintf(delay, 5, "%ims", (int)(d/(uint_least32_t)1000)); |
---|
272 | } |
---|
273 | } |
---|
274 | |
---|
275 | printf(" %-12s %-12s %-4s %6s %-5s - %s\n", |
---|
276 | roar_codec2str(g_codecfilter[i].codec), |
---|
277 | g_codecfilter[i].name, |
---|
278 | mode, |
---|
279 | subsys, |
---|
280 | delay, |
---|
281 | g_codecfilter[i].desc |
---|
282 | ); |
---|
283 | } |
---|
284 | } |
---|
285 | |
---|
286 | int codecfilter_open (CODECFILTER_USERDATA_T * inst, |
---|
287 | int * codecfilter_id, char * codecfilter /* NOTE: this is not part of struct roar_codecfilter's def! */, |
---|
288 | int codec, struct roar_stream_server * info) { |
---|
289 | int i; |
---|
290 | struct roar_codecfilter * filter = NULL; |
---|
291 | |
---|
292 | *codecfilter_id = -1; |
---|
293 | |
---|
294 | ROAR_DBG("codecfilter_open(*): codecfilter='%s', info->id=%i", codecfilter, ROAR_STREAM(info)->id); |
---|
295 | |
---|
296 | for (i = 0; g_codecfilter[i].name != NULL; i++) { |
---|
297 | ROAR_DBG("codecfilter_open(*): g_codecfilter[i].codec <-> codec => %i <-> %i", g_codecfilter[i].codec, codec); |
---|
298 | if ( g_codecfilter[i].codec == codec ) { |
---|
299 | if ( !codecfilter || strcmp(codecfilter, g_codecfilter[i].name) == 0 ) { |
---|
300 | *codecfilter_id = i; |
---|
301 | filter = &g_codecfilter[i]; |
---|
302 | break; |
---|
303 | } |
---|
304 | } |
---|
305 | } |
---|
306 | |
---|
307 | info->codecfilter = *codecfilter_id; |
---|
308 | |
---|
309 | if (*codecfilter_id != -1) { |
---|
310 | if ( filter->open != NULL ) { |
---|
311 | if ( (i = filter->open(inst, codec, info, filter)) == -1 ) { |
---|
312 | info->codecfilter = *codecfilter_id = -1; |
---|
313 | } |
---|
314 | return i; |
---|
315 | } else { |
---|
316 | // in case we can not open the filter we will not use it |
---|
317 | *codecfilter_id = -1; |
---|
318 | info->codecfilter = -1; |
---|
319 | } |
---|
320 | return 0; |
---|
321 | } |
---|
322 | |
---|
323 | return -1; // we found no filter -> ok |
---|
324 | } |
---|
325 | |
---|
326 | int codecfilter_close(CODECFILTER_USERDATA_T inst, int codecfilter) { |
---|
327 | ROAR_DBG("codecfilter_close(inst=%p, codecfilter=%i) = ?", inst, codecfilter); |
---|
328 | |
---|
329 | if ( codecfilter == -1 ) |
---|
330 | return -1; |
---|
331 | |
---|
332 | if ( g_codecfilter[codecfilter].close ) |
---|
333 | return g_codecfilter[codecfilter].close(inst); |
---|
334 | |
---|
335 | return 0; |
---|
336 | } |
---|
337 | |
---|
338 | int codecfilter_pause(CODECFILTER_USERDATA_T inst, int codecfilter, int newstate) { |
---|
339 | if ( codecfilter == -1 ) |
---|
340 | return -1; |
---|
341 | |
---|
342 | if ( g_codecfilter[codecfilter].pause ) |
---|
343 | return g_codecfilter[codecfilter].pause(inst, newstate); |
---|
344 | |
---|
345 | return 0; |
---|
346 | } |
---|
347 | |
---|
348 | int codecfilter_write(CODECFILTER_USERDATA_T inst, int codecfilter, char * buf, int len) { |
---|
349 | if ( codecfilter == -1 ) |
---|
350 | return -1; |
---|
351 | |
---|
352 | if ( g_codecfilter[codecfilter].write ) |
---|
353 | return g_codecfilter[codecfilter].write(inst, buf, len); |
---|
354 | |
---|
355 | return 0; |
---|
356 | } |
---|
357 | |
---|
358 | int codecfilter_read (CODECFILTER_USERDATA_T inst, int codecfilter, char * buf, int len) { |
---|
359 | if ( codecfilter == -1 ) |
---|
360 | return -1; |
---|
361 | |
---|
362 | errno = 0; |
---|
363 | |
---|
364 | if ( g_codecfilter[codecfilter].read ) |
---|
365 | return g_codecfilter[codecfilter].read(inst, buf, len); |
---|
366 | |
---|
367 | return 0; |
---|
368 | } |
---|
369 | |
---|
370 | int codecfilter_flush(CODECFILTER_USERDATA_T inst, int codecfilter) { |
---|
371 | if ( codecfilter == -1 ) |
---|
372 | return -1; |
---|
373 | |
---|
374 | if ( g_codecfilter[codecfilter].flush ) |
---|
375 | return g_codecfilter[codecfilter].flush(inst); |
---|
376 | |
---|
377 | return 0; |
---|
378 | } |
---|
379 | |
---|
380 | int codecfilter_delay(CODECFILTER_USERDATA_T inst, int codecfilter, uint_least32_t * delay) { |
---|
381 | ROAR_DBG("codecfilter_delay(inst=%p, codecfilter=%i, *delay=?) = ?", inst, codecfilter); |
---|
382 | |
---|
383 | if ( codecfilter == -1 ) |
---|
384 | return -1; |
---|
385 | |
---|
386 | if ( g_codecfilter[codecfilter].delay ) |
---|
387 | return g_codecfilter[codecfilter].delay(inst, delay); |
---|
388 | |
---|
389 | return -1; |
---|
390 | } |
---|
391 | |
---|
392 | int codecfilter_ctl (CODECFILTER_USERDATA_T inst, int codecfilter, int_least32_t cmd, void * data) { |
---|
393 | ROAR_DBG("codecfilter_ctl(inst=%p, codecfilter=%i, cmd=0x%.8x, data=%p) = ?", inst, codecfilter, cmd, data); |
---|
394 | if ( codecfilter == -1 ) |
---|
395 | return -1; |
---|
396 | |
---|
397 | if ( g_codecfilter[codecfilter].ctl ) |
---|
398 | return g_codecfilter[codecfilter].ctl(inst, cmd, data); |
---|
399 | |
---|
400 | return -1; |
---|
401 | } |
---|
402 | |
---|
403 | |
---|
404 | int codecfilter_delay_fulldyn(CODECFILTER_USERDATA_T inst, uint_least32_t * delay) { |
---|
405 | *delay = 0; // just to be sure |
---|
406 | return -1; |
---|
407 | } |
---|
408 | |
---|
409 | int codecfilter_delay_zero(CODECFILTER_USERDATA_T inst, uint_least32_t * delay) { |
---|
410 | // this codec does not create any addition latency. |
---|
411 | |
---|
412 | *delay = 0; |
---|
413 | return 0; |
---|
414 | } |
---|
415 | |
---|
416 | //ll |
---|