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