1 | //streams.h: |
---|
2 | |
---|
3 | /* |
---|
4 | * Copyright (C) Philipp 'ph3-der-loewe' Schafft - 2008-2012 |
---|
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, 51 Franklin Street, Fifth Floor, |
---|
22 | * Boston, MA 02110-1301, USA. |
---|
23 | * |
---|
24 | */ |
---|
25 | |
---|
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 | |
---|
37 | //#define ROAR_STREAM(x) ((struct roar_stream*)(x)) |
---|
38 | #define ROAR_STREAM_SERVER(x) ((struct roar_stream_server*)(x)) |
---|
39 | |
---|
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 | |
---|
50 | #define ROAR_STREAM_CTL_TYPE_VOID 0x00000000 |
---|
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 */ |
---|
54 | |
---|
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 | |
---|
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; |
---|
69 | int mt; |
---|
70 | size_t refc; |
---|
71 | size_t channels; |
---|
72 | struct roar_ltm_vals * cur; |
---|
73 | struct roar_ltm_vals ** history; |
---|
74 | }; |
---|
75 | |
---|
76 | extern 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; |
---|
83 | struct roar_mixer_settings mixer; |
---|
84 | #ifdef ROAR_SUPPORT_META |
---|
85 | struct roar_meta meta[ROAR_META_MAX_PER_STREAM]; |
---|
86 | #endif |
---|
87 | int is_new; |
---|
88 | int codecfilter; |
---|
89 | int codec_orgi; |
---|
90 | CODECFILTER_USERDATA_T codecfilter_inst; |
---|
91 | int socktype; |
---|
92 | int pre_underruns; |
---|
93 | int post_underruns; |
---|
94 | struct roar_vio_calls vio; |
---|
95 | int primary; |
---|
96 | int driver_id; |
---|
97 | // struct roardsp_filterchain fc; |
---|
98 | uint32_t flags; |
---|
99 | uint32_t flags_protection; |
---|
100 | uint_least32_t delay; |
---|
101 | char * name; |
---|
102 | int ready; |
---|
103 | struct roar_buffer * outputbuffer; |
---|
104 | int state; |
---|
105 | struct roar_buffer * prethru; |
---|
106 | struct roar_vio_calls jumbo; |
---|
107 | struct roar_vio_calls * viop; |
---|
108 | int mixer_stream; |
---|
109 | struct roardsp_chanmap chanmap; |
---|
110 | int role; |
---|
111 | int parent_stream; |
---|
112 | struct roar_stream_ltm ltm[MAX_LTM_WINDOWS_PER_STREAM]; |
---|
113 | #ifndef ROAR_WITHOUT_DCOMP_MIXER |
---|
114 | struct hwmixer_stream * mixerstream; |
---|
115 | #endif |
---|
116 | size_t single_sink_c; |
---|
117 | size_t single_sink_self_c; |
---|
118 | } * g_streams[ROAR_STREAMS_MAX]; |
---|
119 | |
---|
120 | extern int streams_recsource_id; |
---|
121 | |
---|
122 | void streams_change_sync_num(int id, int diff); |
---|
123 | |
---|
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); |
---|
131 | int streams_get_client (int id); |
---|
132 | |
---|
133 | int streams_set_dir (int id, int dir, int defaults); |
---|
134 | int streams_get_dir (int id); |
---|
135 | |
---|
136 | int streams_set_mixer_stream(int id, int mixer); |
---|
137 | int streams_get_mixer_stream(int id); |
---|
138 | |
---|
139 | int streams_set_role (int id, int role); |
---|
140 | |
---|
141 | int streams_dir2subsys (int dir); |
---|
142 | int streams_get_subsys (int id); |
---|
143 | int streams_get_ssdir (int id); |
---|
144 | |
---|
145 | int streams_new_virtual (int parent, struct roar_stream_server ** stream); |
---|
146 | |
---|
147 | int streams_set_fh (int id, int fh); |
---|
148 | int streams_get_fh (int id); |
---|
149 | int streams_set_null_io(int id); |
---|
150 | int streams_get (int id, struct roar_stream_server ** stream); |
---|
151 | int streams_get_clientobj (int id, struct roar_stream ** stream); |
---|
152 | |
---|
153 | int streams_set_socktype (int id, int socktype); |
---|
154 | int streams_get_socktype (int id); |
---|
155 | |
---|
156 | int streams_is_ready (int id); |
---|
157 | int streams_is_new (int id); |
---|
158 | |
---|
159 | int streams_set_primary (int id, int prim); |
---|
160 | int streams_mark_primary (int id); |
---|
161 | int streams_set_sync (int id, int sync); |
---|
162 | int streams_set_mmap (int id, int reset); |
---|
163 | int streams_set_single_sink(int id, int reset); |
---|
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); |
---|
168 | |
---|
169 | int streams_protect_flag (int id, uint32_t flag); |
---|
170 | |
---|
171 | int streams_set_name (int id, char * name); |
---|
172 | char * streams_get_name (int id); |
---|
173 | |
---|
174 | int streams_calc_delay (int id); |
---|
175 | int streams_set_mixer (int id); |
---|
176 | |
---|
177 | int streams_set_map (int id, char * map, size_t len); |
---|
178 | |
---|
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); |
---|
181 | struct roar_stream_ltm * streams_ltm_get(int id, int mt, int window); |
---|
182 | |
---|
183 | struct hwmixer_stream * streams_get_mixerstream(int id); |
---|
184 | int streams_set_mixerstream(int id, struct hwmixer_stream * mstream); |
---|
185 | int streams_read_mixervalues(int id); |
---|
186 | |
---|
187 | int streams_ctl (int id, int_least32_t cmd, void * data); |
---|
188 | |
---|
189 | int stream_add_buffer (int id, struct roar_buffer ** buf); |
---|
190 | int stream_shift_out_buffer (int id, void * data, size_t * len); |
---|
191 | |
---|
192 | int stream_outputbuffer_request(int id, struct roar_buffer ** buf, size_t len); |
---|
193 | int stream_outputbuffer_destroy(int id); |
---|
194 | |
---|
195 | int stream_prethru_add(int id, struct roar_buffer ** buf); |
---|
196 | int stream_prethru_add_data(int id, void ** buf, size_t len); |
---|
197 | int stream_prethru_destroy(int id); |
---|
198 | int stream_prethru_send(int dst, int src); |
---|
199 | |
---|
200 | int streams_check (int id); |
---|
201 | int streams_send_mon (int id); |
---|
202 | int streams_send_filter_all(void); |
---|
203 | int streams_send_filter(int id); |
---|
204 | |
---|
205 | int streams_get_mixbuffers (void *** bufferlist, struct roar_audio_info * info, unsigned int pos); |
---|
206 | int streams_get_outputbuffer (int id, void ** buffer, size_t size); |
---|
207 | int streams_fill_mixbuffer (int id, struct roar_audio_info * info); |
---|
208 | int streams_fill_mixbuffer2 (int id, struct roar_audio_info * info); |
---|
209 | |
---|
210 | ssize_t stream_vio_read (int stream, void * buf, size_t count); |
---|
211 | ssize_t stream_vio_write(int stream, void * buf, size_t count); |
---|
212 | int stream_vio_ctl (int stream, roar_vio_ctl_t cmd, void * data); |
---|
213 | ssize_t stream_vio_s_read (struct roar_stream_server * stream, void * buf, size_t count); |
---|
214 | ssize_t stream_vio_s_write(struct roar_stream_server * stream, void * buf, size_t count); |
---|
215 | int stream_vio_s_ctl (struct roar_stream_server * stream, roar_vio_ctl_t cmd, void * data); |
---|
216 | |
---|
217 | #endif |
---|
218 | |
---|
219 | //ll |
---|