[169] | 1 | //codecfilter.h: |
---|
| 2 | |
---|
[668] | 3 | /* |
---|
[4708] | 4 | * Copyright (C) Philipp 'ph3-der-loewe' Schafft - 2008-2011 |
---|
[668] | 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 |
---|
[3517] | 21 | * the Free Software Foundation, 51 Franklin Street, Fifth Floor, |
---|
| 22 | * Boston, MA 02110-1301, USA. |
---|
[668] | 23 | * |
---|
| 24 | */ |
---|
| 25 | |
---|
[169] | 26 | #ifndef _CODECFILTER_H_ |
---|
| 27 | #define _CODECFILTER_H_ |
---|
| 28 | |
---|
| 29 | #include <roaraudio.h> |
---|
| 30 | |
---|
[170] | 31 | #define CODECFILTER_USERDATA_T void * |
---|
| 32 | |
---|
[195] | 33 | struct roar_stream_server; |
---|
[170] | 34 | |
---|
[2816] | 35 | #define ROAR_CODECFILTER_NONE 0x00 |
---|
| 36 | #define ROAR_CODECFILTER_READ 0x01 |
---|
| 37 | #define ROAR_CODECFILTER_WRITE 0x02 |
---|
| 38 | #define ROAR_CODECFILTER_PRETHRU 0x04 /* we have support for prethru */ |
---|
| 39 | #define ROAR_CODECFILTER_PRETHRU_NN 0x08 /* prethru Not Needed */ |
---|
[612] | 40 | |
---|
[1238] | 41 | |
---|
| 42 | #define ROAR_CODECFILTER_CTL_NOOP ROAR_STREAM_CTL_COMP_CF|0x0000 /* noop... */ |
---|
| 43 | #define ROAR_CODECFILTER_CTL_BASE ROAR_STREAM_CTL_COMP_CF|0x0000 /* Base ops... */ |
---|
| 44 | #define ROAR_CODECFILTER_CTL_META ROAR_STREAM_CTL_COMP_CF|0x1000 /* Meta data things... */ |
---|
[2603] | 45 | #define ROAR_CODECFILTER_CTL_VIRTUAL ROAR_STREAM_CTL_COMP_CF|0x2000 /* container/virtual stream things... */ |
---|
[1238] | 46 | |
---|
[2083] | 47 | #define ROAR_CODECFILTER_CTL_SET 0x0002 |
---|
| 48 | #define ROAR_CODECFILTER_CTL_GET 0x0003 |
---|
| 49 | |
---|
[1238] | 50 | #define ROAR_CODECFILTER_CTL_UPDATE 0x0001 |
---|
[2603] | 51 | #define ROAR_CODECFILTER_CTL_DELETE 0x0004 |
---|
[2624] | 52 | #define ROAR_CODECFILTER_CTL_NEW 0x0005 |
---|
[1238] | 53 | |
---|
[2083] | 54 | #define ROAR_CODECFILTER_CTL_Q 0x0010 |
---|
| 55 | #define ROAR_CODECFILTER_CTL_SET_Q ROAR_CODECFILTER_CTL_BASE|ROAR_CODECFILTER_CTL_Q|ROAR_CODECFILTER_CTL_SET |
---|
| 56 | #define ROAR_CODECFILTER_CTL_GET_Q ROAR_CODECFILTER_CTL_BASE|ROAR_CODECFILTER_CTL_Q|ROAR_CODECFILTER_CTL_GET |
---|
| 57 | |
---|
[1238] | 58 | #define ROAR_CODECFILTER_CTL_META_UPDATE ROAR_CODECFILTER_CTL_META|ROAR_CODECFILTER_CTL_UPDATE |
---|
| 59 | |
---|
[2603] | 60 | #define ROAR_CODECFILTER_CTL_VIRTUAL_DELETE ROAR_CODECFILTER_CTL_VIRTUAL|ROAR_CODECFILTER_CTL_DELETE |
---|
[2624] | 61 | #define ROAR_CODECFILTER_CTL_VIRTUAL_NEW ROAR_CODECFILTER_CTL_VIRTUAL|ROAR_CODECFILTER_CTL_NEW |
---|
[2603] | 62 | |
---|
| 63 | |
---|
[1238] | 64 | #define ROAR_CODECFILTER_CTL2CMD(x) ((x) & (~ROAR_STREAM_CTL_COMP_CF)) |
---|
| 65 | |
---|
[170] | 66 | struct roar_codecfilter { |
---|
[176] | 67 | int codec; |
---|
[170] | 68 | char * name; |
---|
| 69 | char * desc; |
---|
[171] | 70 | char * options; |
---|
[2679] | 71 | void * setup; |
---|
[612] | 72 | int flags; |
---|
[2679] | 73 | unsigned int subsystems; |
---|
[193] | 74 | int (*open )(CODECFILTER_USERDATA_T * inst, int codec, |
---|
[171] | 75 | struct roar_stream_server * info, |
---|
| 76 | struct roar_codecfilter * filter); |
---|
[170] | 77 | int (*close)(CODECFILTER_USERDATA_T inst); |
---|
| 78 | int (*pause)(CODECFILTER_USERDATA_T inst, int newstate); |
---|
| 79 | int (*write)(CODECFILTER_USERDATA_T inst, char * buf, int len); |
---|
| 80 | int (*read )(CODECFILTER_USERDATA_T inst, char * buf, int len); |
---|
| 81 | int (*flush)(CODECFILTER_USERDATA_T inst); |
---|
[1144] | 82 | int (*delay)(CODECFILTER_USERDATA_T inst, uint_least32_t * delay); |
---|
[1223] | 83 | int (*ctl )(CODECFILTER_USERDATA_T inst, int cmd, void * data); |
---|
[170] | 84 | }; |
---|
| 85 | |
---|
[172] | 86 | |
---|
| 87 | #include "codecfilter_cmd.h" |
---|
[561] | 88 | #include "codecfilter_wave.h" |
---|
[4004] | 89 | #include "codecfilter_au.h" |
---|
[561] | 90 | |
---|
| 91 | |
---|
[204] | 92 | #ifdef ROAR_HAVE_LIBVORBISFILE |
---|
| 93 | #include "codecfilter_vorbis.h" |
---|
| 94 | #endif |
---|
[172] | 95 | |
---|
[323] | 96 | #ifdef ROAR_HAVE_LIBCELT |
---|
| 97 | #include "codecfilter_celt.h" |
---|
| 98 | #endif |
---|
[172] | 99 | |
---|
[371] | 100 | #ifdef ROAR_HAVE_LIBSPEEX |
---|
| 101 | #include "codecfilter_speex.h" |
---|
| 102 | #endif |
---|
| 103 | |
---|
[851] | 104 | #ifdef ROAR_HAVE_LIBSNDFILE |
---|
| 105 | #include "codecfilter_sndfile.h" |
---|
| 106 | #endif |
---|
| 107 | |
---|
[992] | 108 | #ifdef ROAR_HAVE_LIBFISHSOUND |
---|
| 109 | #include "codecfilter_fishsound.h" |
---|
| 110 | #endif |
---|
| 111 | |
---|
[4590] | 112 | #ifdef ROAR_HAVE_LIBFLAC |
---|
| 113 | #include "codecfilter_flac.h" |
---|
| 114 | #endif |
---|
| 115 | |
---|
[2686] | 116 | #include "container_framework.h" |
---|
| 117 | |
---|
[992] | 118 | //cf alaw/mulaw: |
---|
[783] | 119 | #include <libroardsp/libroardsp.h> |
---|
| 120 | |
---|
[170] | 121 | void print_codecfilterlist (void); |
---|
| 122 | |
---|
| 123 | int codecfilter_open (CODECFILTER_USERDATA_T * inst, |
---|
| 124 | int * codecfilter_id, char * codecfilter /* NOTE: this is not part of struct roar_codecfilter's def! */, |
---|
[193] | 125 | int codec, struct roar_stream_server * info); |
---|
[170] | 126 | int codecfilter_close(CODECFILTER_USERDATA_T inst, int codecfilter); |
---|
| 127 | int codecfilter_pause(CODECFILTER_USERDATA_T inst, int codecfilter, int newstate); |
---|
| 128 | int codecfilter_write(CODECFILTER_USERDATA_T inst, int codecfilter, char * buf, int len); |
---|
| 129 | int codecfilter_read (CODECFILTER_USERDATA_T inst, int codecfilter, char * buf, int len); |
---|
| 130 | int codecfilter_flush(CODECFILTER_USERDATA_T inst, int codecfilter); |
---|
[1144] | 131 | int codecfilter_delay(CODECFILTER_USERDATA_T inst, int codecfilter, uint_least32_t * delay); |
---|
[1224] | 132 | int codecfilter_ctl (CODECFILTER_USERDATA_T inst, int codecfilter, int_least32_t cmd, void * data); |
---|
[1144] | 133 | |
---|
| 134 | int codecfilter_delay_fulldyn(CODECFILTER_USERDATA_T inst, uint_least32_t * delay); |
---|
[3604] | 135 | int codecfilter_delay_zero(CODECFILTER_USERDATA_T inst, uint_least32_t * delay); |
---|
[1144] | 136 | |
---|
[170] | 137 | |
---|
[736] | 138 | // codecfilter without a own .h: |
---|
| 139 | int cf_alaw_open(CODECFILTER_USERDATA_T * inst, int codec, |
---|
| 140 | struct roar_stream_server * info, |
---|
| 141 | struct roar_codecfilter * filter); |
---|
| 142 | |
---|
| 143 | int cf_alaw_close(CODECFILTER_USERDATA_T inst); |
---|
| 144 | |
---|
| 145 | int cf_alaw_read(CODECFILTER_USERDATA_T inst, char * buf, int len); |
---|
| 146 | int cf_alaw_write(CODECFILTER_USERDATA_T inst, char * buf, int len); |
---|
[170] | 147 | |
---|
[922] | 148 | int cf_mulaw_open(CODECFILTER_USERDATA_T * inst, int codec, |
---|
| 149 | struct roar_stream_server * info, |
---|
| 150 | struct roar_codecfilter * filter); |
---|
| 151 | |
---|
| 152 | int cf_mulaw_close(CODECFILTER_USERDATA_T inst); |
---|
| 153 | |
---|
| 154 | int cf_mulaw_read(CODECFILTER_USERDATA_T inst, char * buf, int len); |
---|
| 155 | int cf_mulaw_write(CODECFILTER_USERDATA_T inst, char * buf, int len); |
---|
[1144] | 156 | // cf_mulaw_delay() would be exactly the same as cf_alaw_delay() so it is just used by mulaw, too. |
---|
[922] | 157 | |
---|
[2686] | 158 | CONT_FW_SETUP_TYPE(cf_raum_setup); |
---|
| 159 | |
---|
[169] | 160 | #endif |
---|
| 161 | |
---|
| 162 | //ll |
---|