[169] | 1 | //codecfilter.c: |
---|
| 2 | |
---|
[668] | 3 | /* |
---|
| 4 | * Copyright (C) Philipp 'ph3-der-loewe' Schafft - 2008 |
---|
| 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, 675 Mass Ave, Cambridge, MA 02139, USA. |
---|
| 22 | * |
---|
| 23 | */ |
---|
| 24 | |
---|
[1185] | 25 | #define ROAR_REQUIRE_LIBVORBISFILE |
---|
| 26 | |
---|
[169] | 27 | #include "roard.h" |
---|
| 28 | |
---|
[1481] | 29 | #ifndef ROAR_WITHOUT_CF_CMD |
---|
| 30 | #if !defined(ROAR_HAVE_UNIX) || !defined(ROAR_HAVE_BSDSOCKETS) || !defined(ROAR_HAVE_IO_POSIX) |
---|
| 31 | #define ROAR_WITHOUT_CF_CMD |
---|
| 32 | #endif |
---|
| 33 | #endif |
---|
| 34 | |
---|
[173] | 35 | struct roar_codecfilter g_codecfilter[] = { |
---|
[2679] | 36 | {-1, "null", "null codec filter", NULL, NULL, ROAR_CODECFILTER_NONE, ROAR_SUBSYS_NONE, |
---|
[1223] | 37 | NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL}, |
---|
[2816] | 38 | {-1, "PCM", "Native PCM Support", NULL, NULL, |
---|
| 39 | ROAR_CODECFILTER_READ|ROAR_CODECFILTER_WRITE|ROAR_CODECFILTER_PRETHRU_NN, ROAR_SUBSYS_WAVEFORM, |
---|
| 40 | NULL, NULL, NULL, NULL, NULL, NULL, cf_alaw_delay, NULL}, |
---|
| 41 | {ROAR_CODEC_MIDI, "MIDI", "Native MIDI Support", NULL, NULL, |
---|
| 42 | ROAR_CODECFILTER_READ|ROAR_CODECFILTER_WRITE|ROAR_CODECFILTER_PRETHRU_NN, ROAR_SUBSYS_MIDI, |
---|
| 43 | NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL}, |
---|
| 44 | {ROAR_CODEC_DMX512, "DMX512", "Native DMX512 Support", NULL, NULL, |
---|
| 45 | ROAR_CODECFILTER_READ|ROAR_CODECFILTER_WRITE|ROAR_CODECFILTER_PRETHRU_NN, ROAR_SUBSYS_LIGHT, |
---|
| 46 | NULL, NULL, NULL, NULL, NULL, NULL, cf_alaw_delay, NULL}, |
---|
[201] | 47 | |
---|
[1012] | 48 | /* |
---|
[851] | 49 | #ifdef ROAR_HAVE_LIBSNDFILE |
---|
[1012] | 50 | {ROAR_CODEC_RIFF_WAVE, "sndfile", "libsndfile codec filter", NULL, ROAR_CODECFILTER_READ|ROAR_CODECFILTER_WRITE, |
---|
| 51 | cf_sndfile_open, cf_sndfile_close, NULL, cf_sndfile_write, cf_sndfile_read, NULL}, |
---|
[851] | 52 | #else |
---|
[1012] | 53 | */ |
---|
[2505] | 54 | #ifndef ROAR_WITHOUT_CF_WAVE |
---|
[2679] | 55 | {ROAR_CODEC_RIFF_WAVE, "RIFF/WAVE", "RIFF/WAVE", NULL, NULL, |
---|
[2816] | 56 | ROAR_CODECFILTER_READ|ROAR_CODECFILTER_WRITE|ROAR_CODECFILTER_PRETHRU, ROAR_SUBSYS_WAVEFORM, |
---|
[2604] | 57 | cf_wave_open, cf_wave_close, NULL, cf_wave_write, cf_wave_read, NULL, NULL, cf_wave_ctl}, |
---|
[2505] | 58 | #endif |
---|
[1012] | 59 | //#endif |
---|
[561] | 60 | |
---|
[2686] | 61 | #ifdef ROAR_HAVE_LIBRAUM |
---|
[2690] | 62 | {ROAR_CODEC_RAUM, "RAUM", "RAUM Container Format", NULL, cf_raum_setup, ROAR_CODECFILTER_WRITE, |
---|
[2686] | 63 | ROAR_SUBSYS_WAVEFORM|ROAR_SUBSYS_MIDI|ROAR_SUBSYS_LIGHT|ROAR_SUBSYS_RAW|ROAR_SUBSYS_COMPLEX, |
---|
[2701] | 64 | 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}, |
---|
[2686] | 65 | #endif |
---|
| 66 | |
---|
[2816] | 67 | #ifdef ROAR_HAVE_LIBOGG |
---|
| 68 | {ROAR_CODEC_OGG, "Ogg", "Ogg Container Format", NULL, NULL, ROAR_CODECFILTER_NONE, |
---|
| 69 | ROAR_SUBSYS_WAVEFORM|ROAR_SUBSYS_MIDI, |
---|
| 70 | NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL}, |
---|
| 71 | #endif |
---|
| 72 | |
---|
[1065] | 73 | #ifdef ROAR_SUPPORT_ALAW |
---|
[2679] | 74 | {ROAR_CODEC_ALAW, "alaw", "A-Law", NULL, NULL, |
---|
[1065] | 75 | #ifdef ROAR_SUPPORT_ALAW_RW |
---|
[2816] | 76 | ROAR_CODECFILTER_READ|ROAR_CODECFILTER_WRITE|ROAR_CODECFILTER_PRETHRU_NN, |
---|
[1065] | 77 | #else |
---|
[2816] | 78 | ROAR_CODECFILTER_READ|ROAR_CODECFILTER_PRETHRU_NN, |
---|
[1065] | 79 | #endif |
---|
[2679] | 80 | ROAR_SUBSYS_WAVEFORM, |
---|
[1065] | 81 | cf_alaw_open, cf_alaw_close, NULL, |
---|
| 82 | #ifdef ROAR_SUPPORT_ALAW_RW |
---|
| 83 | cf_alaw_write, |
---|
| 84 | #else |
---|
| 85 | NULL, |
---|
| 86 | #endif |
---|
[1223] | 87 | cf_alaw_read, NULL, cf_alaw_delay, NULL}, |
---|
[1065] | 88 | #endif |
---|
[736] | 89 | |
---|
[1065] | 90 | #ifdef ROAR_SUPPORT_MULAW |
---|
[2679] | 91 | {ROAR_CODEC_MULAW, "mulaw", "mu-Law", NULL, NULL, |
---|
[1065] | 92 | #ifdef ROAR_SUPPORT_MULAW_RW |
---|
[2816] | 93 | ROAR_CODECFILTER_READ|ROAR_CODECFILTER_WRITE|ROAR_CODECFILTER_PRETHRU_NN, |
---|
[1065] | 94 | #else |
---|
[2816] | 95 | ROAR_CODECFILTER_READ|ROAR_CODECFILTER_PRETHRU_NN, |
---|
[1065] | 96 | #endif |
---|
[2679] | 97 | ROAR_SUBSYS_WAVEFORM, |
---|
[1065] | 98 | cf_mulaw_open, cf_mulaw_close, NULL, |
---|
| 99 | #ifdef ROAR_SUPPORT_MULAW_RW |
---|
| 100 | cf_mulaw_write, |
---|
| 101 | #else |
---|
| 102 | NULL, |
---|
| 103 | #endif |
---|
[1223] | 104 | cf_mulaw_read, NULL, cf_alaw_delay, NULL}, |
---|
[1065] | 105 | #endif |
---|
[922] | 106 | |
---|
[1199] | 107 | #ifndef ROAR_WITHOUT_CF_CMD |
---|
[749] | 108 | #ifdef ROAR_HAVE_BIN_OGG123 |
---|
[201] | 109 | {ROAR_CODEC_OGG_GENERAL, "cmd", "ogg123", |
---|
[2679] | 110 | ROAR_HAVE_BIN_OGG123 " -q -d raw -f - -", NULL, ROAR_CODECFILTER_READ, ROAR_SUBSYS_WAVEFORM, |
---|
[1223] | 111 | cf_cmd_open, NULL, NULL, NULL, NULL, NULL, codecfilter_delay_fulldyn, NULL}, |
---|
[749] | 112 | #endif |
---|
[1199] | 113 | #endif |
---|
[201] | 114 | |
---|
[362] | 115 | #ifdef ROAR_HAVE_LIBVORBISFILE |
---|
[2679] | 116 | {ROAR_CODEC_OGG_VORBIS, "oggvorbis", "Ogg Vorbis decoder", NULL, NULL, |
---|
[612] | 117 | #ifdef ROAR_HAVE_LIBVORBISENC |
---|
[2816] | 118 | ROAR_CODECFILTER_READ|ROAR_CODECFILTER_WRITE|ROAR_CODECFILTER_PRETHRU, |
---|
[612] | 119 | #else |
---|
| 120 | ROAR_CODECFILTER_READ, |
---|
| 121 | #endif |
---|
[2679] | 122 | ROAR_SUBSYS_WAVEFORM, |
---|
[1238] | 123 | cf_vorbis_open, cf_vorbis_close, NULL, cf_vorbis_write, cf_vorbis_read, NULL, codecfilter_delay_fulldyn, cf_vorbis_ctl}, |
---|
[976] | 124 | #else |
---|
[1199] | 125 | #ifndef ROAR_WITHOUT_CF_CMD |
---|
[976] | 126 | #ifdef ROAR_HAVE_BIN_OGG123 |
---|
| 127 | {ROAR_CODEC_OGG_VORBIS, "cmd", "ogg123", |
---|
[2679] | 128 | ROAR_HAVE_BIN_OGG123 " -q -d raw -f - -", NULL, ROAR_CODECFILTER_READ, ROAR_SUBSYS_WAVEFORM, |
---|
[1223] | 129 | cf_cmd_open, NULL, NULL, NULL, NULL, NULL, codecfilter_delay_fulldyn, NULL}, |
---|
[976] | 130 | #endif |
---|
[362] | 131 | #endif |
---|
[1199] | 132 | #endif |
---|
[205] | 133 | |
---|
[994] | 134 | #ifdef ROAR_HAVE_LIBFISHSOUND |
---|
[998] | 135 | {ROAR_CODEC_OGG_SPEEX, "fishsound", "libfishsound Xiph Codec library", |
---|
[2679] | 136 | NULL, NULL, ROAR_CODECFILTER_READ, ROAR_SUBSYS_WAVEFORM, |
---|
[1223] | 137 | cf_fishsound_open, cf_fishsound_close, NULL, NULL, cf_fishsound_read, NULL, codecfilter_delay_fulldyn, NULL}, |
---|
[995] | 138 | |
---|
[998] | 139 | {ROAR_CODEC_OGG_FLAC, "fishsound", "libfishsound Xiph Codec library", |
---|
[2679] | 140 | NULL, NULL, ROAR_CODECFILTER_READ, ROAR_SUBSYS_WAVEFORM, |
---|
[1223] | 141 | cf_fishsound_open, cf_fishsound_close, NULL, NULL, cf_fishsound_read, NULL, codecfilter_delay_fulldyn, NULL}, |
---|
[994] | 142 | #endif |
---|
| 143 | |
---|
[1199] | 144 | #ifndef ROAR_WITHOUT_CF_CMD |
---|
[749] | 145 | #ifdef ROAR_HAVE_BIN_TIMIDITY |
---|
[221] | 146 | {ROAR_CODEC_MIDI_FILE, "MIDIFILE", "timidity MIDI synth", |
---|
[2679] | 147 | ROAR_HAVE_BIN_TIMIDITY " -Or1sl -s %R -o - -", NULL, ROAR_CODECFILTER_READ, ROAR_SUBSYS_WAVEFORM, |
---|
[1223] | 148 | cf_cmd_open, NULL, NULL, NULL, NULL, NULL, codecfilter_delay_fulldyn, NULL}, |
---|
[749] | 149 | #endif |
---|
[1199] | 150 | #endif |
---|
[221] | 151 | |
---|
[361] | 152 | #ifdef ROAR_HAVE_LIBCELT |
---|
[2816] | 153 | {ROAR_CODEC_ROAR_CELT, "RoarCELT", "RoarAudio CELT", NULL, NULL, |
---|
| 154 | ROAR_CODECFILTER_READ|ROAR_CODECFILTER_WRITE|ROAR_CODECFILTER_PRETHRU, |
---|
[2679] | 155 | ROAR_SUBSYS_WAVEFORM, |
---|
[1223] | 156 | cf_celt_open, cf_celt_close, NULL, cf_celt_write, cf_celt_read, NULL, cf_celt_delay, NULL}, |
---|
[361] | 157 | #endif |
---|
[330] | 158 | |
---|
[373] | 159 | #ifdef ROAR_HAVE_LIBSPEEX |
---|
[2816] | 160 | {ROAR_CODEC_ROAR_SPEEX, "RoarSpeex", "RoarAudio Speex", NULL, NULL, |
---|
| 161 | ROAR_CODECFILTER_READ|ROAR_CODECFILTER_WRITE|ROAR_CODECFILTER_PRETHRU, |
---|
[2679] | 162 | ROAR_SUBSYS_WAVEFORM, |
---|
[1223] | 163 | cf_speex_open, cf_speex_close, NULL, cf_speex_write, cf_speex_read, NULL, NULL, NULL}, |
---|
[373] | 164 | #endif |
---|
| 165 | |
---|
[1199] | 166 | #ifndef ROAR_WITHOUT_CF_CMD |
---|
[749] | 167 | #ifdef ROAR_HAVE_BIN_FLAC |
---|
[612] | 168 | {ROAR_CODEC_FLAC, "cmd", "flac", |
---|
[201] | 169 | #if BYTE_ORDER == BIG_ENDIAN |
---|
[749] | 170 | ROAR_HAVE_BIN_FLAC " --silent --force-raw-format --sign=signed --endian=big -d - -o -", |
---|
[201] | 171 | #elif BYTE_ORDER == LITTLE_ENDIAN |
---|
[749] | 172 | ROAR_HAVE_BIN_FLAC " --silent --force-raw-format --sign=signed --endian=little -d - -o -", |
---|
[201] | 173 | #else |
---|
| 174 | "false", |
---|
| 175 | #endif |
---|
[2679] | 176 | NULL, ROAR_CODECFILTER_READ, ROAR_SUBSYS_WAVEFORM, |
---|
[1223] | 177 | cf_cmd_open, NULL, NULL, NULL, NULL, NULL, codecfilter_delay_fulldyn, NULL}, |
---|
[749] | 178 | #endif |
---|
[1199] | 179 | #endif |
---|
[179] | 180 | |
---|
[2816] | 181 | {ROAR_CODEC_ROARDMX, "RoarDMX", "Native RoarDMX Support", NULL, NULL, |
---|
| 182 | ROAR_CODECFILTER_READ|ROAR_CODECFILTER_WRITE|ROAR_CODECFILTER_PRETHRU_NN, ROAR_SUBSYS_LIGHT, |
---|
| 183 | NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL}, |
---|
| 184 | |
---|
[2679] | 185 | {-1, NULL, NULL, NULL, NULL, ROAR_CODECFILTER_NONE, ROAR_SUBSYS_NONE, |
---|
| 186 | NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL} // end of list |
---|
[173] | 187 | }; |
---|
| 188 | |
---|
[175] | 189 | void print_codecfilterlist (void) { |
---|
| 190 | int i; |
---|
[613] | 191 | int flags; |
---|
| 192 | char mode[5]; |
---|
[1144] | 193 | char delay[6]; |
---|
[2680] | 194 | char subsys[7] = " "; |
---|
[1144] | 195 | uint_least32_t d; |
---|
[613] | 196 | |
---|
[2680] | 197 | printf(" Codec Filtername Mode Subsys Delay - Description\n"); |
---|
| 198 | printf("-------------------------------------------------------------\n"); |
---|
[175] | 199 | |
---|
| 200 | for (i = 0; g_codecfilter[i].name != NULL; i++) { |
---|
[2680] | 201 | strncpy(subsys, " ", 6); |
---|
| 202 | |
---|
| 203 | if ( g_codecfilter[i].subsystems & ROAR_SUBSYS_WAVEFORM ) |
---|
| 204 | subsys[0] = 'W'; |
---|
| 205 | if ( g_codecfilter[i].subsystems & ROAR_SUBSYS_MIDI ) |
---|
| 206 | subsys[1] = 'M'; |
---|
| 207 | if ( g_codecfilter[i].subsystems & ROAR_SUBSYS_CB ) |
---|
| 208 | subsys[2] = 'C'; |
---|
| 209 | if ( g_codecfilter[i].subsystems & ROAR_SUBSYS_LIGHT ) |
---|
| 210 | subsys[3] = 'L'; |
---|
| 211 | if ( g_codecfilter[i].subsystems & ROAR_SUBSYS_RAW ) |
---|
| 212 | subsys[4] = 'R'; |
---|
[2681] | 213 | if ( g_codecfilter[i].subsystems & ROAR_SUBSYS_COMPLEX ) |
---|
| 214 | subsys[5] = 'X'; |
---|
[2680] | 215 | |
---|
[613] | 216 | flags = g_codecfilter[i].flags; |
---|
| 217 | |
---|
| 218 | if ( flags == ROAR_CODECFILTER_NONE ) { |
---|
| 219 | strcpy(mode, "none"); |
---|
| 220 | } else { |
---|
| 221 | strcpy(mode, " "); |
---|
| 222 | if ( flags & ROAR_CODECFILTER_READ ) |
---|
| 223 | mode[0] = 'r'; |
---|
| 224 | if ( flags & ROAR_CODECFILTER_WRITE ) |
---|
| 225 | mode[1] = 'w'; |
---|
[2816] | 226 | if ( flags & ROAR_CODECFILTER_PRETHRU ) |
---|
| 227 | mode[2] = 'P'; |
---|
| 228 | if ( flags & ROAR_CODECFILTER_PRETHRU_NN ) |
---|
| 229 | mode[2] = 'p'; |
---|
[613] | 230 | } |
---|
[1144] | 231 | |
---|
| 232 | *delay = 0; |
---|
| 233 | if ( g_codecfilter[i].codec == -1 ) { // null codec filter |
---|
| 234 | strcpy(delay, "0ms"); |
---|
| 235 | } else if ( g_codecfilter[i].delay == NULL ) { |
---|
| 236 | strcpy(delay, "?"); |
---|
| 237 | } else { |
---|
| 238 | if ( codecfilter_delay(NULL, i, &d) == -1 ) { |
---|
| 239 | strcpy(delay, "dyn"); |
---|
| 240 | } else { |
---|
| 241 | snprintf(delay, 5, "%ims", d/1000); |
---|
| 242 | } |
---|
| 243 | } |
---|
[613] | 244 | |
---|
[2680] | 245 | printf(" %-12s %-12s %-4s %6s %-5s - %s\n", |
---|
[178] | 246 | roar_codec2str(g_codecfilter[i].codec), |
---|
| 247 | g_codecfilter[i].name, |
---|
[613] | 248 | mode, |
---|
[2680] | 249 | subsys, |
---|
[1144] | 250 | delay, |
---|
[552] | 251 | g_codecfilter[i].desc |
---|
| 252 | ); |
---|
[175] | 253 | } |
---|
| 254 | } |
---|
| 255 | |
---|
[194] | 256 | int codecfilter_open (CODECFILTER_USERDATA_T * inst, |
---|
| 257 | int * codecfilter_id, char * codecfilter /* NOTE: this is not part of struct roar_codecfilter's def! */, |
---|
| 258 | int codec, struct roar_stream_server * info) { |
---|
| 259 | int i; |
---|
| 260 | struct roar_codecfilter * filter = NULL; |
---|
| 261 | |
---|
| 262 | *codecfilter_id = -1; |
---|
| 263 | |
---|
[486] | 264 | ROAR_DBG("codecfilter_open(*): codecfilter='%s', info->id=%i", codecfilter, ROAR_STREAM(info)->id); |
---|
| 265 | |
---|
[194] | 266 | for (i = 0; g_codecfilter[i].name != NULL; i++) { |
---|
[2693] | 267 | ROAR_DBG("codecfilter_open(*): g_codecfilter[i].codec <-> codec => %i <-> %i", g_codecfilter[i].codec, codec); |
---|
[194] | 268 | if ( g_codecfilter[i].codec == codec ) { |
---|
| 269 | if ( !codecfilter || strcmp(codecfilter, g_codecfilter[i].name) == 0 ) { |
---|
| 270 | *codecfilter_id = i; |
---|
| 271 | filter = &g_codecfilter[i]; |
---|
| 272 | break; |
---|
| 273 | } |
---|
| 274 | } |
---|
| 275 | } |
---|
| 276 | |
---|
[196] | 277 | info->codecfilter = *codecfilter_id; |
---|
[194] | 278 | |
---|
| 279 | if (*codecfilter_id != -1) { |
---|
[571] | 280 | if ( filter->open ) { |
---|
| 281 | if ( (i = filter->open(inst, codec, info, filter)) == -1 ) { |
---|
| 282 | info->codecfilter = *codecfilter_id = -1; |
---|
| 283 | } |
---|
| 284 | return i; |
---|
| 285 | } |
---|
[194] | 286 | return 0; |
---|
| 287 | } |
---|
| 288 | |
---|
[571] | 289 | return 0; // we found no filter -> ok |
---|
[194] | 290 | } |
---|
| 291 | |
---|
[180] | 292 | int codecfilter_close(CODECFILTER_USERDATA_T inst, int codecfilter) { |
---|
| 293 | ROAR_DBG("codecfilter_close(inst=%p, codecfilter=%i) = ?", inst, codecfilter); |
---|
| 294 | |
---|
| 295 | if ( codecfilter == -1 ) |
---|
| 296 | return -1; |
---|
| 297 | |
---|
| 298 | if ( g_codecfilter[codecfilter].close ) |
---|
| 299 | return g_codecfilter[codecfilter].close(inst); |
---|
| 300 | |
---|
| 301 | return 0; |
---|
| 302 | } |
---|
| 303 | |
---|
| 304 | int codecfilter_pause(CODECFILTER_USERDATA_T inst, int codecfilter, int newstate) { |
---|
| 305 | if ( codecfilter == -1 ) |
---|
| 306 | return -1; |
---|
| 307 | |
---|
| 308 | if ( g_codecfilter[codecfilter].pause ) |
---|
| 309 | return g_codecfilter[codecfilter].pause(inst, newstate); |
---|
| 310 | |
---|
| 311 | return 0; |
---|
| 312 | } |
---|
| 313 | |
---|
| 314 | int codecfilter_write(CODECFILTER_USERDATA_T inst, int codecfilter, char * buf, int len) { |
---|
| 315 | if ( codecfilter == -1 ) |
---|
| 316 | return -1; |
---|
| 317 | |
---|
| 318 | if ( g_codecfilter[codecfilter].write ) |
---|
| 319 | return g_codecfilter[codecfilter].write(inst, buf, len); |
---|
| 320 | |
---|
| 321 | return 0; |
---|
| 322 | } |
---|
| 323 | |
---|
| 324 | int codecfilter_read (CODECFILTER_USERDATA_T inst, int codecfilter, char * buf, int len) { |
---|
| 325 | if ( codecfilter == -1 ) |
---|
| 326 | return -1; |
---|
| 327 | |
---|
[541] | 328 | errno = 0; |
---|
| 329 | |
---|
[180] | 330 | if ( g_codecfilter[codecfilter].read ) |
---|
| 331 | return g_codecfilter[codecfilter].read(inst, buf, len); |
---|
| 332 | |
---|
| 333 | return 0; |
---|
| 334 | } |
---|
| 335 | |
---|
| 336 | int codecfilter_flush(CODECFILTER_USERDATA_T inst, int codecfilter) { |
---|
| 337 | if ( codecfilter == -1 ) |
---|
| 338 | return -1; |
---|
| 339 | |
---|
| 340 | if ( g_codecfilter[codecfilter].flush ) |
---|
| 341 | return g_codecfilter[codecfilter].flush(inst); |
---|
| 342 | |
---|
| 343 | return 0; |
---|
| 344 | } |
---|
| 345 | |
---|
[1144] | 346 | int codecfilter_delay(CODECFILTER_USERDATA_T inst, int codecfilter, uint_least32_t * delay) { |
---|
| 347 | ROAR_DBG("codecfilter_delay(inst=%p, codecfilter=%i, *delay=?) = ?", inst, codecfilter); |
---|
| 348 | |
---|
| 349 | if ( codecfilter == -1 ) |
---|
| 350 | return -1; |
---|
| 351 | |
---|
| 352 | if ( g_codecfilter[codecfilter].delay ) |
---|
| 353 | return g_codecfilter[codecfilter].delay(inst, delay); |
---|
| 354 | |
---|
| 355 | return -1; |
---|
| 356 | } |
---|
| 357 | |
---|
[1224] | 358 | int codecfilter_ctl (CODECFILTER_USERDATA_T inst, int codecfilter, int_least32_t cmd, void * data) { |
---|
[2086] | 359 | ROAR_DBG("codecfilter_ctl(inst=%p, codecfilter=%i, cmd=0x%.8x, data=%p) = ?", inst, codecfilter, cmd, data); |
---|
[1224] | 360 | if ( codecfilter == -1 ) |
---|
| 361 | return -1; |
---|
| 362 | |
---|
| 363 | if ( g_codecfilter[codecfilter].ctl ) |
---|
| 364 | return g_codecfilter[codecfilter].ctl(inst, cmd, data); |
---|
| 365 | |
---|
| 366 | return -1; |
---|
| 367 | } |
---|
| 368 | |
---|
| 369 | |
---|
[1144] | 370 | int codecfilter_delay_fulldyn(CODECFILTER_USERDATA_T inst, uint_least32_t * delay) { |
---|
| 371 | *delay = 0; // just to be sure |
---|
| 372 | return -1; |
---|
| 373 | } |
---|
| 374 | |
---|
[169] | 375 | //ll |
---|