[0] | 1 | //streams.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 | |
---|
[0] | 26 | #ifndef _STREAMS_H_ |
---|
| 27 | #define _STREAMS_H_ |
---|
| 28 | |
---|
| 29 | #include <roaraudio.h> |
---|
| 30 | |
---|
| 31 | /* |
---|
| 32 | Defined in <roaraudio/streams.h> |
---|
| 33 | |
---|
| 34 | #define ROAR_STREAMS_MAX 64 |
---|
| 35 | */ |
---|
| 36 | |
---|
[21] | 37 | //#define ROAR_STREAM(x) ((struct roar_stream*)(x)) |
---|
[0] | 38 | #define ROAR_STREAM_SERVER(x) ((struct roar_stream_server*)(x)) |
---|
| 39 | |
---|
[1224] | 40 | // stream ctls...: |
---|
| 41 | |
---|
| 42 | #define ROAR_STREAM_CTL_COMPMASK 0xFF000000 |
---|
| 43 | #define ROAR_STREAM_CTL_TYPEMASK 0x00FF0000 |
---|
| 44 | #define ROAR_STREAM_CTL_CMDMASK 0x0000FFFF |
---|
| 45 | |
---|
| 46 | #define ROAR_STREAM_CTL_COMP_BASE 0x00000000 |
---|
| 47 | #define ROAR_STREAM_CTL_COMP_CF 0x01000000 |
---|
| 48 | #define ROAR_STREAM_CTL_COMP_DRV 0x02000000 |
---|
| 49 | |
---|
[2288] | 50 | #define ROAR_STREAM_CTL_TYPE_VOID 0x00000000 |
---|
[2082] | 51 | #define ROAR_STREAM_CTL_TYPE_INT 0x00010000 |
---|
| 52 | #define ROAR_STREAM_CTL_TYPE_FLOAT 0x00020000 |
---|
| 53 | #define ROAR_STREAM_CTL_TYPE_FPI100 0x00030000 /* fix point integter int/100 */ |
---|
[1224] | 54 | |
---|
[3542] | 55 | #define STREAM_DIR_NONE 0x00 |
---|
| 56 | #define STREAM_DIR_IN 0x01 |
---|
| 57 | #define STREAM_DIR_OUT 0x02 |
---|
| 58 | #define STREAM_DIR_BIDIR (STREAM_DIR_IN|STREAM_DIR_OUT) |
---|
| 59 | |
---|
[4270] | 60 | #define MAX_LTM_WINDOWS_PER_STREAM 1 |
---|
| 61 | |
---|
| 62 | struct roar_ltm_vals { |
---|
| 63 | int64_t rms; |
---|
| 64 | }; |
---|
| 65 | |
---|
| 66 | struct roar_stream_ltm { |
---|
| 67 | int window; |
---|
| 68 | int parent_window; |
---|
[4272] | 69 | int mt; |
---|
[4270] | 70 | size_t refc; |
---|
[4272] | 71 | size_t channels; |
---|
| 72 | struct roar_ltm_vals * cur; |
---|
| 73 | struct roar_ltm_vals ** history; |
---|
[4270] | 74 | }; |
---|
| 75 | |
---|
[0] | 76 | struct roar_stream_server { |
---|
| 77 | struct roar_stream _stream; |
---|
| 78 | unsigned int pos_abs; |
---|
| 79 | int client; |
---|
| 80 | struct roar_buffer * buffer; |
---|
| 81 | size_t need_extra; |
---|
| 82 | void * output; |
---|
[16] | 83 | struct roar_mixer_settings mixer; |
---|
[1493] | 84 | #ifdef ROAR_SUPPORT_META |
---|
[87] | 85 | struct roar_meta meta[ROAR_META_MAX_PER_STREAM]; |
---|
[1493] | 86 | #endif |
---|
[125] | 87 | int is_new; |
---|
[241] | 88 | int codecfilter; |
---|
[240] | 89 | int codec_orgi; |
---|
[241] | 90 | CODECFILTER_USERDATA_T codecfilter_inst; |
---|
[377] | 91 | int socktype; |
---|
[494] | 92 | int pre_underruns; |
---|
| 93 | int post_underruns; |
---|
[592] | 94 | struct roar_vio_calls vio; |
---|
[643] | 95 | int primary; |
---|
[930] | 96 | int driver_id; |
---|
[1857] | 97 | // struct roardsp_filterchain fc; |
---|
[4550] | 98 | uint32_t flags; |
---|
| 99 | uint32_t flags_protection; |
---|
[1137] | 100 | uint_least32_t delay; |
---|
[1842] | 101 | char * name; |
---|
[1913] | 102 | int ready; |
---|
[2151] | 103 | struct roar_buffer * outputbuffer; |
---|
[2611] | 104 | int state; |
---|
[2816] | 105 | struct roar_buffer * prethru; |
---|
[3042] | 106 | struct roar_vio_calls jumbo; |
---|
| 107 | struct roar_vio_calls * viop; |
---|
[3213] | 108 | int mixer_stream; |
---|
[3334] | 109 | struct roardsp_chanmap chanmap; |
---|
[3630] | 110 | int role; |
---|
[4099] | 111 | int parent_stream; |
---|
[4270] | 112 | struct roar_stream_ltm ltm[MAX_LTM_WINDOWS_PER_STREAM]; |
---|
[4753] | 113 | #ifndef ROAR_WITHOUT_DCOMP_MIXER |
---|
[4361] | 114 | struct hwmixer_stream * mixerstream; |
---|
[4753] | 115 | #endif |
---|
[4541] | 116 | size_t single_sink_c; |
---|
[4545] | 117 | size_t single_sink_self_c; |
---|
[0] | 118 | } * g_streams[ROAR_STREAMS_MAX]; |
---|
| 119 | |
---|
[2417] | 120 | int streams_recsource_id; |
---|
[2254] | 121 | |
---|
[4846] | 122 | void streams_change_sync_num(int id, int diff); |
---|
| 123 | |
---|
[0] | 124 | int streams_init (void); |
---|
| 125 | int streams_free (void); |
---|
| 126 | |
---|
| 127 | int streams_new (void); |
---|
| 128 | int streams_delete (int id); |
---|
| 129 | |
---|
| 130 | int streams_set_client (int id, int client); |
---|
[766] | 131 | int streams_get_client (int id); |
---|
[0] | 132 | |
---|
[1609] | 133 | int streams_set_dir (int id, int dir, int defaults); |
---|
[2249] | 134 | int streams_get_dir (int id); |
---|
[1609] | 135 | |
---|
[3213] | 136 | int streams_set_mixer_stream(int id, int mixer); |
---|
[4543] | 137 | int streams_get_mixer_stream(int id); |
---|
[3213] | 138 | |
---|
[3630] | 139 | int streams_set_role (int id, int role); |
---|
| 140 | |
---|
[4614] | 141 | int streams_dir2subsys (int dir); |
---|
[2415] | 142 | int streams_get_subsys (int id); |
---|
[3542] | 143 | int streams_get_ssdir (int id); |
---|
[2415] | 144 | |
---|
[2594] | 145 | int streams_new_virtual (int parent, struct roar_stream_server ** stream); |
---|
[2593] | 146 | |
---|
[0] | 147 | int streams_set_fh (int id, int fh); |
---|
[66] | 148 | int streams_get_fh (int id); |
---|
[2606] | 149 | int streams_set_null_io(int id); |
---|
[0] | 150 | int streams_get (int id, struct roar_stream_server ** stream); |
---|
[4521] | 151 | int streams_get_clientobj (int id, struct roar_stream ** stream); |
---|
[0] | 152 | |
---|
[377] | 153 | int streams_set_socktype (int id, int socktype); |
---|
| 154 | int streams_get_socktype (int id); |
---|
| 155 | |
---|
[3921] | 156 | int streams_is_ready (int id); |
---|
[4819] | 157 | int streams_is_new (int id); |
---|
[3921] | 158 | |
---|
[643] | 159 | int streams_set_primary (int id, int prim); |
---|
| 160 | int streams_mark_primary (int id); |
---|
[1116] | 161 | int streams_set_sync (int id, int sync); |
---|
[1928] | 162 | int streams_set_mmap (int id, int reset); |
---|
[4537] | 163 | int streams_set_single_sink(int id, int reset); |
---|
[4550] | 164 | int streams_set_flag (int id, uint32_t flag); |
---|
| 165 | int streams_set_rawflag (int id, uint32_t flag); |
---|
| 166 | int streams_reset_flag (int id, uint32_t flag); |
---|
| 167 | int streams_get_flag (int id, uint32_t flag); |
---|
[643] | 168 | |
---|
[4552] | 169 | int streams_protect_flag (int id, uint32_t flag); |
---|
| 170 | |
---|
[1842] | 171 | int streams_set_name (int id, char * name); |
---|
| 172 | char * streams_get_name (int id); |
---|
| 173 | |
---|
[1223] | 174 | int streams_calc_delay (int id); |
---|
[1590] | 175 | int streams_set_mixer (int id); |
---|
[1223] | 176 | |
---|
[3542] | 177 | int streams_set_map (int id, char * map, size_t len); |
---|
| 178 | |
---|
[4272] | 179 | int streams_ltm_ctl (int id, int mt, int window, int cmd); |
---|
| 180 | int streams_ltm_calc (int id, struct roar_audio_info * info, void * data, size_t len); |
---|
[4289] | 181 | struct roar_stream_ltm * streams_ltm_get(int id, int mt, int window); |
---|
[4272] | 182 | |
---|
[4361] | 183 | struct hwmixer_stream * streams_get_mixerstream(int id); |
---|
| 184 | int streams_set_mixerstream(int id, struct hwmixer_stream * mstream); |
---|
[4379] | 185 | int streams_read_mixervalues(int id); |
---|
[4361] | 186 | |
---|
[1224] | 187 | int streams_ctl (int id, int_least32_t cmd, void * data); |
---|
[1142] | 188 | |
---|
[0] | 189 | int stream_add_buffer (int id, struct roar_buffer * buf); |
---|
| 190 | //int stream_get_buffer (int id, struct roar_buffer ** buf); |
---|
[2061] | 191 | int stream_shift_out_buffer (int id, void * data, size_t * len); |
---|
[0] | 192 | int stream_shift_buffer (int id, struct roar_buffer ** buf); |
---|
| 193 | int stream_unshift_buffer (int id, struct roar_buffer * buf); |
---|
| 194 | |
---|
[2151] | 195 | int stream_outputbuffer_request(int id, struct roar_buffer ** buf, size_t len); |
---|
| 196 | int stream_outputbuffer_destroy(int id); |
---|
| 197 | |
---|
[2816] | 198 | int stream_prethru_add(int id, struct roar_buffer * buf); |
---|
| 199 | int stream_prethru_add_data(int id, void ** buf, size_t len); |
---|
| 200 | int stream_prethru_destroy(int id); |
---|
| 201 | int stream_prethru_send(int dst, int src); |
---|
| 202 | |
---|
[0] | 203 | int streams_check (int id); |
---|
| 204 | int streams_send_mon (int id); |
---|
[5022] | 205 | int streams_send_filter_all(void); |
---|
[0] | 206 | int streams_send_filter(int id); |
---|
| 207 | |
---|
| 208 | int streams_get_mixbuffers (void *** bufferlist, struct roar_audio_info * info, unsigned int pos); |
---|
| 209 | int streams_get_outputbuffer (int id, void ** buffer, size_t size); |
---|
| 210 | int streams_fill_mixbuffer (int id, struct roar_audio_info * info); |
---|
[2061] | 211 | int streams_fill_mixbuffer2 (int id, struct roar_audio_info * info); |
---|
[0] | 212 | |
---|
[596] | 213 | ssize_t stream_vio_read (int stream, void *buf, size_t count); |
---|
| 214 | ssize_t stream_vio_write(int stream, void *buf, size_t count); |
---|
[4815] | 215 | int stream_vio_ctl (int stream, int cmd, void * data); |
---|
[596] | 216 | ssize_t stream_vio_s_read (struct roar_stream_server * stream, void *buf, size_t count); |
---|
| 217 | ssize_t stream_vio_s_write(struct roar_stream_server * stream, void *buf, size_t count); |
---|
[4815] | 218 | int stream_vio_s_ctl (struct roar_stream_server * stream, int cmd, void * data); |
---|
[0] | 219 | |
---|
| 220 | #endif |
---|
| 221 | |
---|
| 222 | //ll |
---|