[169] | 1 | //codecfilter.h: |
---|
| 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 | |
---|
[169] | 25 | #ifndef _CODECFILTER_H_ |
---|
| 26 | #define _CODECFILTER_H_ |
---|
| 27 | |
---|
| 28 | #include <roaraudio.h> |
---|
| 29 | |
---|
[170] | 30 | #define CODECFILTER_USERDATA_T void * |
---|
| 31 | |
---|
[195] | 32 | struct roar_stream_server; |
---|
[170] | 33 | |
---|
[612] | 34 | #define ROAR_CODECFILTER_NONE 0 |
---|
| 35 | #define ROAR_CODECFILTER_READ 1 |
---|
| 36 | #define ROAR_CODECFILTER_WRITE 2 |
---|
| 37 | |
---|
[1238] | 38 | |
---|
| 39 | #define ROAR_CODECFILTER_CTL_NOOP ROAR_STREAM_CTL_COMP_CF|0x0000 /* noop... */ |
---|
| 40 | #define ROAR_CODECFILTER_CTL_BASE ROAR_STREAM_CTL_COMP_CF|0x0000 /* Base ops... */ |
---|
| 41 | #define ROAR_CODECFILTER_CTL_META ROAR_STREAM_CTL_COMP_CF|0x1000 /* Meta data things... */ |
---|
| 42 | |
---|
| 43 | #define ROAR_CODECFILTER_CTL_UPDATE 0x0001 |
---|
| 44 | |
---|
| 45 | #define ROAR_CODECFILTER_CTL_META_UPDATE ROAR_CODECFILTER_CTL_META|ROAR_CODECFILTER_CTL_UPDATE |
---|
| 46 | |
---|
| 47 | #define ROAR_CODECFILTER_CTL2CMD(x) ((x) & (~ROAR_STREAM_CTL_COMP_CF)) |
---|
| 48 | |
---|
[170] | 49 | struct roar_codecfilter { |
---|
[176] | 50 | int codec; |
---|
[170] | 51 | char * name; |
---|
| 52 | char * desc; |
---|
[171] | 53 | char * options; |
---|
[612] | 54 | int flags; |
---|
[193] | 55 | int (*open )(CODECFILTER_USERDATA_T * inst, int codec, |
---|
[171] | 56 | struct roar_stream_server * info, |
---|
| 57 | struct roar_codecfilter * filter); |
---|
[170] | 58 | int (*close)(CODECFILTER_USERDATA_T inst); |
---|
| 59 | int (*pause)(CODECFILTER_USERDATA_T inst, int newstate); |
---|
| 60 | int (*write)(CODECFILTER_USERDATA_T inst, char * buf, int len); |
---|
| 61 | int (*read )(CODECFILTER_USERDATA_T inst, char * buf, int len); |
---|
| 62 | int (*flush)(CODECFILTER_USERDATA_T inst); |
---|
[1144] | 63 | int (*delay)(CODECFILTER_USERDATA_T inst, uint_least32_t * delay); |
---|
[1223] | 64 | int (*ctl )(CODECFILTER_USERDATA_T inst, int cmd, void * data); |
---|
[170] | 65 | }; |
---|
| 66 | |
---|
[172] | 67 | |
---|
| 68 | #include "codecfilter_cmd.h" |
---|
[561] | 69 | #include "codecfilter_wave.h" |
---|
| 70 | |
---|
| 71 | |
---|
[204] | 72 | #ifdef ROAR_HAVE_LIBVORBISFILE |
---|
| 73 | #include "codecfilter_vorbis.h" |
---|
| 74 | #endif |
---|
[172] | 75 | |
---|
[323] | 76 | #ifdef ROAR_HAVE_LIBCELT |
---|
| 77 | #include "codecfilter_celt.h" |
---|
| 78 | #endif |
---|
[172] | 79 | |
---|
[371] | 80 | #ifdef ROAR_HAVE_LIBSPEEX |
---|
| 81 | #include "codecfilter_speex.h" |
---|
| 82 | #endif |
---|
| 83 | |
---|
[851] | 84 | #ifdef ROAR_HAVE_LIBSNDFILE |
---|
| 85 | #include "codecfilter_sndfile.h" |
---|
| 86 | #endif |
---|
| 87 | |
---|
[992] | 88 | #ifdef ROAR_HAVE_LIBFISHSOUND |
---|
| 89 | #include "codecfilter_fishsound.h" |
---|
| 90 | #endif |
---|
| 91 | |
---|
| 92 | //cf alaw/mulaw: |
---|
[783] | 93 | #include <libroardsp/libroardsp.h> |
---|
| 94 | |
---|
[170] | 95 | void print_codecfilterlist (void); |
---|
| 96 | |
---|
| 97 | int codecfilter_open (CODECFILTER_USERDATA_T * inst, |
---|
| 98 | int * codecfilter_id, char * codecfilter /* NOTE: this is not part of struct roar_codecfilter's def! */, |
---|
[193] | 99 | int codec, struct roar_stream_server * info); |
---|
[170] | 100 | int codecfilter_close(CODECFILTER_USERDATA_T inst, int codecfilter); |
---|
| 101 | int codecfilter_pause(CODECFILTER_USERDATA_T inst, int codecfilter, int newstate); |
---|
| 102 | int codecfilter_write(CODECFILTER_USERDATA_T inst, int codecfilter, char * buf, int len); |
---|
| 103 | int codecfilter_read (CODECFILTER_USERDATA_T inst, int codecfilter, char * buf, int len); |
---|
| 104 | int codecfilter_flush(CODECFILTER_USERDATA_T inst, int codecfilter); |
---|
[1144] | 105 | int codecfilter_delay(CODECFILTER_USERDATA_T inst, int codecfilter, uint_least32_t * delay); |
---|
[1224] | 106 | int codecfilter_ctl (CODECFILTER_USERDATA_T inst, int codecfilter, int_least32_t cmd, void * data); |
---|
[1144] | 107 | |
---|
| 108 | int codecfilter_delay_fulldyn(CODECFILTER_USERDATA_T inst, uint_least32_t * delay); |
---|
| 109 | |
---|
[170] | 110 | |
---|
[736] | 111 | // codecfilter without a own .h: |
---|
| 112 | int cf_alaw_open(CODECFILTER_USERDATA_T * inst, int codec, |
---|
| 113 | struct roar_stream_server * info, |
---|
| 114 | struct roar_codecfilter * filter); |
---|
| 115 | |
---|
| 116 | int cf_alaw_close(CODECFILTER_USERDATA_T inst); |
---|
| 117 | |
---|
| 118 | int cf_alaw_read(CODECFILTER_USERDATA_T inst, char * buf, int len); |
---|
| 119 | int cf_alaw_write(CODECFILTER_USERDATA_T inst, char * buf, int len); |
---|
[1144] | 120 | int cf_alaw_delay(CODECFILTER_USERDATA_T inst, uint_least32_t * delay); |
---|
[170] | 121 | |
---|
[922] | 122 | int cf_mulaw_open(CODECFILTER_USERDATA_T * inst, int codec, |
---|
| 123 | struct roar_stream_server * info, |
---|
| 124 | struct roar_codecfilter * filter); |
---|
| 125 | |
---|
| 126 | int cf_mulaw_close(CODECFILTER_USERDATA_T inst); |
---|
| 127 | |
---|
| 128 | int cf_mulaw_read(CODECFILTER_USERDATA_T inst, char * buf, int len); |
---|
| 129 | int cf_mulaw_write(CODECFILTER_USERDATA_T inst, char * buf, int len); |
---|
[1144] | 130 | // cf_mulaw_delay() would be exactly the same as cf_alaw_delay() so it is just used by mulaw, too. |
---|
[922] | 131 | |
---|
[169] | 132 | #endif |
---|
| 133 | |
---|
| 134 | //ll |
---|