diff options
author | Minijackson <minijackson@riseup.net> | 2018-09-02 16:04:22 +0200 |
---|---|---|
committer | Minijackson <minijackson@riseup.net> | 2018-09-02 16:04:22 +0200 |
commit | d575adf63b7e87196b636ee91061692a685b605f (patch) | |
tree | d5e1f535a8252db8ae739f00403a8e50281c6b48 | |
download | set_eq-d575adf63b7e87196b636ee91061692a685b605f.tar.gz set_eq-d575adf63b7e87196b636ee91061692a685b605f.zip |
First working version
-rw-r--r-- | .gitignore | 2 | ||||
-rw-r--r-- | Cargo.lock | 955 | ||||
-rw-r--r-- | Cargo.toml | 21 | ||||
-rw-r--r-- | build.rs | 5 | ||||
-rw-r--r-- | src/dbus_api/equalizing_manager.rs | 291 | ||||
-rw-r--r-- | src/dbus_api/mod.rs | 3 | ||||
-rw-r--r-- | src/dbus_api/server_lookup.rs | 188 | ||||
-rw-r--r-- | src/dbus_api/sink.rs | 1128 | ||||
-rw-r--r-- | src/main.rs | 132 | ||||
-rw-r--r-- | src/parsing/equalizer_apo.lalrpop | 42 | ||||
-rw-r--r-- | src/parsing/equalizer_apo.rs | 1164 | ||||
-rw-r--r-- | src/parsing/mod.rs | 3 | ||||
-rw-r--r-- | src/utils.rs | 71 |
13 files changed, 4005 insertions, 0 deletions
diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..53eaa21 --- /dev/null +++ b/.gitignore | |||
@@ -0,0 +1,2 @@ | |||
1 | /target | ||
2 | **/*.rs.bk | ||
diff --git a/Cargo.lock b/Cargo.lock new file mode 100644 index 0000000..46a6dd4 --- /dev/null +++ b/Cargo.lock | |||
@@ -0,0 +1,955 @@ | |||
1 | [[package]] | ||
2 | name = "aho-corasick" | ||
3 | version = "0.6.8" | ||
4 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
5 | dependencies = [ | ||
6 | "memchr 2.0.2 (registry+https://github.com/rust-lang/crates.io-index)", | ||
7 | ] | ||
8 | |||
9 | [[package]] | ||
10 | name = "ansi_term" | ||
11 | version = "0.11.0" | ||
12 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
13 | dependencies = [ | ||
14 | "winapi 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)", | ||
15 | ] | ||
16 | |||
17 | [[package]] | ||
18 | name = "arrayref" | ||
19 | version = "0.3.5" | ||
20 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
21 | |||
22 | [[package]] | ||
23 | name = "ascii-canvas" | ||
24 | version = "1.0.0" | ||
25 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
26 | dependencies = [ | ||
27 | "term 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", | ||
28 | ] | ||
29 | |||
30 | [[package]] | ||
31 | name = "atty" | ||
32 | version = "0.1.2" | ||
33 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
34 | dependencies = [ | ||
35 | "kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", | ||
36 | "libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)", | ||
37 | "winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", | ||
38 | ] | ||
39 | |||
40 | [[package]] | ||
41 | name = "atty" | ||
42 | version = "0.2.11" | ||
43 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
44 | dependencies = [ | ||
45 | "libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)", | ||
46 | "termion 1.5.1 (registry+https://github.com/rust-lang/crates.io-index)", | ||
47 | "winapi 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)", | ||
48 | ] | ||
49 | |||
50 | [[package]] | ||
51 | name = "backtrace" | ||
52 | version = "0.3.9" | ||
53 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
54 | dependencies = [ | ||
55 | "backtrace-sys 0.1.24 (registry+https://github.com/rust-lang/crates.io-index)", | ||
56 | "cfg-if 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", | ||
57 | "libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)", | ||
58 | "rustc-demangle 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)", | ||
59 | "winapi 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)", | ||
60 | ] | ||
61 | |||
62 | [[package]] | ||
63 | name = "backtrace-sys" | ||
64 | version = "0.1.24" | ||
65 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
66 | dependencies = [ | ||
67 | "cc 1.0.23 (registry+https://github.com/rust-lang/crates.io-index)", | ||
68 | "libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)", | ||
69 | ] | ||
70 | |||
71 | [[package]] | ||
72 | name = "bit-set" | ||
73 | version = "0.4.0" | ||
74 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
75 | dependencies = [ | ||
76 | "bit-vec 0.4.4 (registry+https://github.com/rust-lang/crates.io-index)", | ||
77 | ] | ||
78 | |||
79 | [[package]] | ||
80 | name = "bit-vec" | ||
81 | version = "0.4.4" | ||
82 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
83 | |||
84 | [[package]] | ||
85 | name = "bitflags" | ||
86 | version = "1.0.4" | ||
87 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
88 | |||
89 | [[package]] | ||
90 | name = "block-buffer" | ||
91 | version = "0.3.3" | ||
92 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
93 | dependencies = [ | ||
94 | "arrayref 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)", | ||
95 | "byte-tools 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", | ||
96 | ] | ||
97 | |||
98 | [[package]] | ||
99 | name = "byte-tools" | ||
100 | version = "0.2.0" | ||
101 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
102 | |||
103 | [[package]] | ||
104 | name = "cc" | ||
105 | version = "1.0.23" | ||
106 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
107 | |||
108 | [[package]] | ||
109 | name = "cfg-if" | ||
110 | version = "0.1.5" | ||
111 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
112 | |||
113 | [[package]] | ||
114 | name = "clap" | ||
115 | version = "2.32.0" | ||
116 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
117 | dependencies = [ | ||
118 | "ansi_term 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)", | ||
119 | "atty 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)", | ||
120 | "bitflags 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)", | ||
121 | "strsim 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", | ||
122 | "textwrap 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)", | ||
123 | "unicode-width 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", | ||
124 | "vec_map 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)", | ||
125 | ] | ||
126 | |||
127 | [[package]] | ||
128 | name = "clap" | ||
129 | version = "3.0.0-alpha.1" | ||
130 | source = "git+https://github.com/kbknapp/clap-rs?branch=v3-master#eaa0700e7ed76f37d245a6878deb3b8e81754d6c" | ||
131 | dependencies = [ | ||
132 | "ansi_term 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)", | ||
133 | "atty 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)", | ||
134 | "bitflags 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)", | ||
135 | "clap_derive 0.3.0 (git+https://github.com/clap-rs/clap_derive)", | ||
136 | "indexmap 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", | ||
137 | "strsim 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", | ||
138 | "textwrap 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)", | ||
139 | "unicode-width 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", | ||
140 | "vec_map 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)", | ||
141 | ] | ||
142 | |||
143 | [[package]] | ||
144 | name = "clap-log-flag" | ||
145 | version = "0.1.0" | ||
146 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
147 | dependencies = [ | ||
148 | "env_logger 0.5.13 (registry+https://github.com/rust-lang/crates.io-index)", | ||
149 | "failure 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", | ||
150 | "log 0.4.4 (registry+https://github.com/rust-lang/crates.io-index)", | ||
151 | "pretty_env_logger 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)", | ||
152 | "structopt 0.2.10 (registry+https://github.com/rust-lang/crates.io-index)", | ||
153 | ] | ||
154 | |||
155 | [[package]] | ||
156 | name = "clap-verbosity-flag" | ||
157 | version = "0.2.0" | ||
158 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
159 | dependencies = [ | ||
160 | "env_logger 0.5.13 (registry+https://github.com/rust-lang/crates.io-index)", | ||
161 | "failure 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", | ||
162 | "log 0.4.4 (registry+https://github.com/rust-lang/crates.io-index)", | ||
163 | "structopt 0.2.10 (registry+https://github.com/rust-lang/crates.io-index)", | ||
164 | ] | ||
165 | |||
166 | [[package]] | ||
167 | name = "clap_derive" | ||
168 | version = "0.3.0" | ||
169 | source = "git+https://github.com/clap-rs/clap_derive#2fad2c8ae4b5c61a2bf343b4eed636d60bb161bf" | ||
170 | dependencies = [ | ||
171 | "proc-macro2 0.4.15 (registry+https://github.com/rust-lang/crates.io-index)", | ||
172 | "quote 0.6.8 (registry+https://github.com/rust-lang/crates.io-index)", | ||
173 | "syn 0.14.9 (registry+https://github.com/rust-lang/crates.io-index)", | ||
174 | ] | ||
175 | |||
176 | [[package]] | ||
177 | name = "cloudabi" | ||
178 | version = "0.0.3" | ||
179 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
180 | dependencies = [ | ||
181 | "bitflags 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)", | ||
182 | ] | ||
183 | |||
184 | [[package]] | ||
185 | name = "dbus" | ||
186 | version = "0.6.2" | ||
187 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
188 | dependencies = [ | ||
189 | "libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)", | ||
190 | "libdbus-sys 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", | ||
191 | ] | ||
192 | |||
193 | [[package]] | ||
194 | name = "diff" | ||
195 | version = "0.1.11" | ||
196 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
197 | |||
198 | [[package]] | ||
199 | name = "digest" | ||
200 | version = "0.7.5" | ||
201 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
202 | dependencies = [ | ||
203 | "generic-array 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", | ||
204 | ] | ||
205 | |||
206 | [[package]] | ||
207 | name = "docopt" | ||
208 | version = "0.8.3" | ||
209 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
210 | dependencies = [ | ||
211 | "lazy_static 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", | ||
212 | "regex 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)", | ||
213 | "serde 1.0.75 (registry+https://github.com/rust-lang/crates.io-index)", | ||
214 | "serde_derive 1.0.75 (registry+https://github.com/rust-lang/crates.io-index)", | ||
215 | "strsim 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)", | ||
216 | ] | ||
217 | |||
218 | [[package]] | ||
219 | name = "either" | ||
220 | version = "1.5.0" | ||
221 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
222 | |||
223 | [[package]] | ||
224 | name = "ena" | ||
225 | version = "0.5.0" | ||
226 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
227 | |||
228 | [[package]] | ||
229 | name = "env_logger" | ||
230 | version = "0.5.13" | ||
231 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
232 | dependencies = [ | ||
233 | "atty 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)", | ||
234 | "humantime 1.1.1 (registry+https://github.com/rust-lang/crates.io-index)", | ||
235 | "log 0.4.4 (registry+https://github.com/rust-lang/crates.io-index)", | ||
236 | "regex 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)", | ||
237 | "termcolor 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)", | ||
238 | ] | ||
239 | |||
240 | [[package]] | ||
241 | name = "failure" | ||
242 | version = "0.1.2" | ||
243 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
244 | dependencies = [ | ||
245 | "backtrace 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", | ||
246 | "failure_derive 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", | ||
247 | ] | ||
248 | |||
249 | [[package]] | ||
250 | name = "failure_derive" | ||
251 | version = "0.1.2" | ||
252 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
253 | dependencies = [ | ||
254 | "proc-macro2 0.4.15 (registry+https://github.com/rust-lang/crates.io-index)", | ||
255 | "quote 0.6.8 (registry+https://github.com/rust-lang/crates.io-index)", | ||
256 | "syn 0.14.9 (registry+https://github.com/rust-lang/crates.io-index)", | ||
257 | "synstructure 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", | ||
258 | ] | ||
259 | |||
260 | [[package]] | ||
261 | name = "fake-simd" | ||
262 | version = "0.1.2" | ||
263 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
264 | |||
265 | [[package]] | ||
266 | name = "fixedbitset" | ||
267 | version = "0.1.9" | ||
268 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
269 | |||
270 | [[package]] | ||
271 | name = "fuchsia-zircon" | ||
272 | version = "0.3.3" | ||
273 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
274 | dependencies = [ | ||
275 | "bitflags 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)", | ||
276 | "fuchsia-zircon-sys 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", | ||
277 | ] | ||
278 | |||
279 | [[package]] | ||
280 | name = "fuchsia-zircon-sys" | ||
281 | version = "0.3.3" | ||
282 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
283 | |||
284 | [[package]] | ||
285 | name = "generic-array" | ||
286 | version = "0.9.0" | ||
287 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
288 | dependencies = [ | ||
289 | "typenum 1.10.0 (registry+https://github.com/rust-lang/crates.io-index)", | ||
290 | ] | ||
291 | |||
292 | [[package]] | ||
293 | name = "humantime" | ||
294 | version = "1.1.1" | ||
295 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
296 | dependencies = [ | ||
297 | "quick-error 1.2.2 (registry+https://github.com/rust-lang/crates.io-index)", | ||
298 | ] | ||
299 | |||
300 | [[package]] | ||
301 | name = "indexmap" | ||
302 | version = "1.0.1" | ||
303 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
304 | |||
305 | [[package]] | ||
306 | name = "itertools" | ||
307 | version = "0.7.8" | ||
308 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
309 | dependencies = [ | ||
310 | "either 1.5.0 (registry+https://github.com/rust-lang/crates.io-index)", | ||
311 | ] | ||
312 | |||
313 | [[package]] | ||
314 | name = "kernel32-sys" | ||
315 | version = "0.2.2" | ||
316 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
317 | dependencies = [ | ||
318 | "winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", | ||
319 | "winapi-build 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", | ||
320 | ] | ||
321 | |||
322 | [[package]] | ||
323 | name = "lalrpop" | ||
324 | version = "0.15.2" | ||
325 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
326 | dependencies = [ | ||
327 | "ascii-canvas 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", | ||
328 | "atty 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", | ||
329 | "bit-set 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", | ||
330 | "diff 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)", | ||
331 | "digest 0.7.5 (registry+https://github.com/rust-lang/crates.io-index)", | ||
332 | "docopt 0.8.3 (registry+https://github.com/rust-lang/crates.io-index)", | ||
333 | "ena 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", | ||
334 | "itertools 0.7.8 (registry+https://github.com/rust-lang/crates.io-index)", | ||
335 | "lalrpop-snap 0.15.2 (registry+https://github.com/rust-lang/crates.io-index)", | ||
336 | "lalrpop-util 0.15.2 (registry+https://github.com/rust-lang/crates.io-index)", | ||
337 | "petgraph 0.4.13 (registry+https://github.com/rust-lang/crates.io-index)", | ||
338 | "regex 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)", | ||
339 | "regex-syntax 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", | ||
340 | "serde 1.0.75 (registry+https://github.com/rust-lang/crates.io-index)", | ||
341 | "serde_derive 1.0.75 (registry+https://github.com/rust-lang/crates.io-index)", | ||
342 | "sha2 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)", | ||
343 | "string_cache 0.7.3 (registry+https://github.com/rust-lang/crates.io-index)", | ||
344 | "term 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", | ||
345 | "unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", | ||
346 | ] | ||
347 | |||
348 | [[package]] | ||
349 | name = "lalrpop-snap" | ||
350 | version = "0.15.2" | ||
351 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
352 | dependencies = [ | ||
353 | "ascii-canvas 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", | ||
354 | "atty 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", | ||
355 | "bit-set 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", | ||
356 | "diff 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)", | ||
357 | "ena 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", | ||
358 | "itertools 0.7.8 (registry+https://github.com/rust-lang/crates.io-index)", | ||
359 | "lalrpop-util 0.15.2 (registry+https://github.com/rust-lang/crates.io-index)", | ||
360 | "petgraph 0.4.13 (registry+https://github.com/rust-lang/crates.io-index)", | ||
361 | "regex 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)", | ||
362 | "regex-syntax 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", | ||
363 | "string_cache 0.7.3 (registry+https://github.com/rust-lang/crates.io-index)", | ||
364 | "term 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", | ||
365 | "unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", | ||
366 | ] | ||
367 | |||
368 | [[package]] | ||
369 | name = "lalrpop-util" | ||
370 | version = "0.15.2" | ||
371 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
372 | |||
373 | [[package]] | ||
374 | name = "lazy_static" | ||
375 | version = "1.1.0" | ||
376 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
377 | dependencies = [ | ||
378 | "version_check 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", | ||
379 | ] | ||
380 | |||
381 | [[package]] | ||
382 | name = "libc" | ||
383 | version = "0.2.43" | ||
384 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
385 | |||
386 | [[package]] | ||
387 | name = "libdbus-sys" | ||
388 | version = "0.1.3" | ||
389 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
390 | dependencies = [ | ||
391 | "pkg-config 0.3.14 (registry+https://github.com/rust-lang/crates.io-index)", | ||
392 | ] | ||
393 | |||
394 | [[package]] | ||
395 | name = "log" | ||
396 | version = "0.4.4" | ||
397 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
398 | dependencies = [ | ||
399 | "cfg-if 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", | ||
400 | ] | ||
401 | |||
402 | [[package]] | ||
403 | name = "memchr" | ||
404 | version = "2.0.2" | ||
405 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
406 | dependencies = [ | ||
407 | "libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)", | ||
408 | ] | ||
409 | |||
410 | [[package]] | ||
411 | name = "new_debug_unreachable" | ||
412 | version = "1.0.1" | ||
413 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
414 | dependencies = [ | ||
415 | "unreachable 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", | ||
416 | ] | ||
417 | |||
418 | [[package]] | ||
419 | name = "ordermap" | ||
420 | version = "0.3.5" | ||
421 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
422 | |||
423 | [[package]] | ||
424 | name = "petgraph" | ||
425 | version = "0.4.13" | ||
426 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
427 | dependencies = [ | ||
428 | "fixedbitset 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)", | ||
429 | "ordermap 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)", | ||
430 | ] | ||
431 | |||
432 | [[package]] | ||
433 | name = "phf_generator" | ||
434 | version = "0.7.23" | ||
435 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
436 | dependencies = [ | ||
437 | "phf_shared 0.7.23 (registry+https://github.com/rust-lang/crates.io-index)", | ||
438 | "rand 0.5.5 (registry+https://github.com/rust-lang/crates.io-index)", | ||
439 | ] | ||
440 | |||
441 | [[package]] | ||
442 | name = "phf_shared" | ||
443 | version = "0.7.23" | ||
444 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
445 | dependencies = [ | ||
446 | "siphasher 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", | ||
447 | ] | ||
448 | |||
449 | [[package]] | ||
450 | name = "pkg-config" | ||
451 | version = "0.3.14" | ||
452 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
453 | |||
454 | [[package]] | ||
455 | name = "precomputed-hash" | ||
456 | version = "0.1.1" | ||
457 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
458 | |||
459 | [[package]] | ||
460 | name = "pretty_env_logger" | ||
461 | version = "0.2.4" | ||
462 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
463 | dependencies = [ | ||
464 | "ansi_term 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)", | ||
465 | "env_logger 0.5.13 (registry+https://github.com/rust-lang/crates.io-index)", | ||
466 | "log 0.4.4 (registry+https://github.com/rust-lang/crates.io-index)", | ||
467 | ] | ||
468 | |||
469 | [[package]] | ||
470 | name = "proc-macro2" | ||
471 | version = "0.3.8" | ||
472 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
473 | dependencies = [ | ||
474 | "unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", | ||
475 | ] | ||
476 | |||
477 | [[package]] | ||
478 | name = "proc-macro2" | ||
479 | version = "0.4.15" | ||
480 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
481 | dependencies = [ | ||
482 | "unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", | ||
483 | ] | ||
484 | |||
485 | [[package]] | ||
486 | name = "quick-error" | ||
487 | version = "1.2.2" | ||
488 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
489 | |||
490 | [[package]] | ||
491 | name = "quote" | ||
492 | version = "0.5.2" | ||
493 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
494 | dependencies = [ | ||
495 | "proc-macro2 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", | ||
496 | ] | ||
497 | |||
498 | [[package]] | ||
499 | name = "quote" | ||
500 | version = "0.6.8" | ||
501 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
502 | dependencies = [ | ||
503 | "proc-macro2 0.4.15 (registry+https://github.com/rust-lang/crates.io-index)", | ||
504 | ] | ||
505 | |||
506 | [[package]] | ||
507 | name = "rand" | ||
508 | version = "0.5.5" | ||
509 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
510 | dependencies = [ | ||
511 | "cloudabi 0.0.3 (registry+https://github.com/rust-lang/crates.io-index)", | ||
512 | "fuchsia-zircon 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", | ||
513 | "libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)", | ||
514 | "rand_core 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", | ||
515 | "winapi 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)", | ||
516 | ] | ||
517 | |||
518 | [[package]] | ||
519 | name = "rand_core" | ||
520 | version = "0.2.1" | ||
521 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
522 | |||
523 | [[package]] | ||
524 | name = "redox_syscall" | ||
525 | version = "0.1.40" | ||
526 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
527 | |||
528 | [[package]] | ||
529 | name = "redox_termios" | ||
530 | version = "0.1.1" | ||
531 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
532 | dependencies = [ | ||
533 | "redox_syscall 0.1.40 (registry+https://github.com/rust-lang/crates.io-index)", | ||
534 | ] | ||
535 | |||
536 | [[package]] | ||
537 | name = "regex" | ||
538 | version = "0.2.11" | ||
539 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
540 | dependencies = [ | ||
541 | "aho-corasick 0.6.8 (registry+https://github.com/rust-lang/crates.io-index)", | ||
542 | "memchr 2.0.2 (registry+https://github.com/rust-lang/crates.io-index)", | ||
543 | "regex-syntax 0.5.6 (registry+https://github.com/rust-lang/crates.io-index)", | ||
544 | "thread_local 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", | ||
545 | "utf8-ranges 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", | ||
546 | ] | ||
547 | |||
548 | [[package]] | ||
549 | name = "regex" | ||
550 | version = "1.0.4" | ||
551 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
552 | dependencies = [ | ||
553 | "aho-corasick 0.6.8 (registry+https://github.com/rust-lang/crates.io-index)", | ||
554 | "memchr 2.0.2 (registry+https://github.com/rust-lang/crates.io-index)", | ||
555 | "regex-syntax 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)", | ||
556 | "thread_local 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", | ||
557 | "utf8-ranges 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", | ||
558 | ] | ||
559 | |||
560 | [[package]] | ||
561 | name = "regex-syntax" | ||
562 | version = "0.4.2" | ||
563 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
564 | |||
565 | [[package]] | ||
566 | name = "regex-syntax" | ||
567 | version = "0.5.6" | ||
568 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
569 | dependencies = [ | ||
570 | "ucd-util 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", | ||
571 | ] | ||
572 | |||
573 | [[package]] | ||
574 | name = "regex-syntax" | ||
575 | version = "0.6.2" | ||
576 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
577 | dependencies = [ | ||
578 | "ucd-util 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", | ||
579 | ] | ||
580 | |||
581 | [[package]] | ||
582 | name = "rustc-demangle" | ||
583 | version = "0.1.9" | ||
584 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
585 | |||
586 | [[package]] | ||
587 | name = "serde" | ||
588 | version = "1.0.75" | ||
589 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
590 | |||
591 | [[package]] | ||
592 | name = "serde_derive" | ||
593 | version = "1.0.75" | ||
594 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
595 | dependencies = [ | ||
596 | "proc-macro2 0.4.15 (registry+https://github.com/rust-lang/crates.io-index)", | ||
597 | "quote 0.6.8 (registry+https://github.com/rust-lang/crates.io-index)", | ||
598 | "syn 0.14.9 (registry+https://github.com/rust-lang/crates.io-index)", | ||
599 | ] | ||
600 | |||
601 | [[package]] | ||
602 | name = "set_eq" | ||
603 | version = "0.1.0" | ||
604 | dependencies = [ | ||
605 | "clap 3.0.0-alpha.1 (git+https://github.com/kbknapp/clap-rs?branch=v3-master)", | ||
606 | "clap-log-flag 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", | ||
607 | "clap-verbosity-flag 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", | ||
608 | "dbus 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)", | ||
609 | "failure 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", | ||
610 | "lalrpop 0.15.2 (registry+https://github.com/rust-lang/crates.io-index)", | ||
611 | "lalrpop-util 0.15.2 (registry+https://github.com/rust-lang/crates.io-index)", | ||
612 | "log 0.4.4 (registry+https://github.com/rust-lang/crates.io-index)", | ||
613 | "regex 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)", | ||
614 | "structopt 0.2.10 (registry+https://github.com/rust-lang/crates.io-index)", | ||
615 | ] | ||
616 | |||
617 | [[package]] | ||
618 | name = "sha2" | ||
619 | version = "0.7.1" | ||
620 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
621 | dependencies = [ | ||
622 | "block-buffer 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", | ||
623 | "byte-tools 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", | ||
624 | "digest 0.7.5 (registry+https://github.com/rust-lang/crates.io-index)", | ||
625 | "fake-simd 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", | ||
626 | ] | ||
627 | |||
628 | [[package]] | ||
629 | name = "siphasher" | ||
630 | version = "0.2.3" | ||
631 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
632 | |||
633 | [[package]] | ||
634 | name = "string_cache" | ||
635 | version = "0.7.3" | ||
636 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
637 | dependencies = [ | ||
638 | "lazy_static 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", | ||
639 | "new_debug_unreachable 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", | ||
640 | "phf_shared 0.7.23 (registry+https://github.com/rust-lang/crates.io-index)", | ||
641 | "precomputed-hash 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", | ||
642 | "serde 1.0.75 (registry+https://github.com/rust-lang/crates.io-index)", | ||
643 | "string_cache_codegen 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)", | ||
644 | "string_cache_shared 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", | ||
645 | ] | ||
646 | |||
647 | [[package]] | ||
648 | name = "string_cache_codegen" | ||
649 | version = "0.4.1" | ||
650 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
651 | dependencies = [ | ||
652 | "phf_generator 0.7.23 (registry+https://github.com/rust-lang/crates.io-index)", | ||
653 | "phf_shared 0.7.23 (registry+https://github.com/rust-lang/crates.io-index)", | ||
654 | "proc-macro2 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", | ||
655 | "quote 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)", | ||
656 | "string_cache_shared 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", | ||
657 | ] | ||
658 | |||
659 | [[package]] | ||
660 | name = "string_cache_shared" | ||
661 | version = "0.3.0" | ||
662 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
663 | |||
664 | [[package]] | ||
665 | name = "strsim" | ||
666 | version = "0.6.0" | ||
667 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
668 | |||
669 | [[package]] | ||
670 | name = "strsim" | ||
671 | version = "0.7.0" | ||
672 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
673 | |||
674 | [[package]] | ||
675 | name = "structopt" | ||
676 | version = "0.2.10" | ||
677 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
678 | dependencies = [ | ||
679 | "clap 2.32.0 (registry+https://github.com/rust-lang/crates.io-index)", | ||
680 | "structopt-derive 0.2.10 (registry+https://github.com/rust-lang/crates.io-index)", | ||
681 | ] | ||
682 | |||
683 | [[package]] | ||
684 | name = "structopt-derive" | ||
685 | version = "0.2.10" | ||
686 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
687 | dependencies = [ | ||
688 | "proc-macro2 0.4.15 (registry+https://github.com/rust-lang/crates.io-index)", | ||
689 | "quote 0.6.8 (registry+https://github.com/rust-lang/crates.io-index)", | ||
690 | "syn 0.14.9 (registry+https://github.com/rust-lang/crates.io-index)", | ||
691 | ] | ||
692 | |||
693 | [[package]] | ||
694 | name = "syn" | ||
695 | version = "0.14.9" | ||
696 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
697 | dependencies = [ | ||
698 | "proc-macro2 0.4.15 (registry+https://github.com/rust-lang/crates.io-index)", | ||
699 | "quote 0.6.8 (registry+https://github.com/rust-lang/crates.io-index)", | ||
700 | "unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", | ||
701 | ] | ||
702 | |||
703 | [[package]] | ||
704 | name = "synstructure" | ||
705 | version = "0.9.0" | ||
706 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
707 | dependencies = [ | ||
708 | "proc-macro2 0.4.15 (registry+https://github.com/rust-lang/crates.io-index)", | ||
709 | "quote 0.6.8 (registry+https://github.com/rust-lang/crates.io-index)", | ||
710 | "syn 0.14.9 (registry+https://github.com/rust-lang/crates.io-index)", | ||
711 | "unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", | ||
712 | ] | ||
713 | |||
714 | [[package]] | ||
715 | name = "term" | ||
716 | version = "0.4.6" | ||
717 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
718 | dependencies = [ | ||
719 | "kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", | ||
720 | "winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", | ||
721 | ] | ||
722 | |||
723 | [[package]] | ||
724 | name = "termcolor" | ||
725 | version = "1.0.3" | ||
726 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
727 | dependencies = [ | ||
728 | "wincolor 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", | ||
729 | ] | ||
730 | |||
731 | [[package]] | ||
732 | name = "termion" | ||
733 | version = "1.5.1" | ||
734 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
735 | dependencies = [ | ||
736 | "libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)", | ||
737 | "redox_syscall 0.1.40 (registry+https://github.com/rust-lang/crates.io-index)", | ||
738 | "redox_termios 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", | ||
739 | ] | ||
740 | |||
741 | [[package]] | ||
742 | name = "textwrap" | ||
743 | version = "0.10.0" | ||
744 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
745 | dependencies = [ | ||
746 | "unicode-width 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", | ||
747 | ] | ||
748 | |||
749 | [[package]] | ||
750 | name = "thread_local" | ||
751 | version = "0.3.6" | ||
752 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
753 | dependencies = [ | ||
754 | "lazy_static 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", | ||
755 | ] | ||
756 | |||
757 | [[package]] | ||
758 | name = "typenum" | ||
759 | version = "1.10.0" | ||
760 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
761 | |||
762 | [[package]] | ||
763 | name = "ucd-util" | ||
764 | version = "0.1.1" | ||
765 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
766 | |||
767 | [[package]] | ||
768 | name = "unicode-width" | ||
769 | version = "0.1.5" | ||
770 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
771 | |||
772 | [[package]] | ||
773 | name = "unicode-xid" | ||
774 | version = "0.1.0" | ||
775 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
776 | |||
777 | [[package]] | ||
778 | name = "unreachable" | ||
779 | version = "1.0.0" | ||
780 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
781 | dependencies = [ | ||
782 | "void 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", | ||
783 | ] | ||
784 | |||
785 | [[package]] | ||
786 | name = "utf8-ranges" | ||
787 | version = "1.0.1" | ||
788 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
789 | |||
790 | [[package]] | ||
791 | name = "vec_map" | ||
792 | version = "0.8.1" | ||
793 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
794 | |||
795 | [[package]] | ||
796 | name = "version_check" | ||
797 | version = "0.1.4" | ||
798 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
799 | |||
800 | [[package]] | ||
801 | name = "void" | ||
802 | version = "1.0.2" | ||
803 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
804 | |||
805 | [[package]] | ||
806 | name = "winapi" | ||
807 | version = "0.2.8" | ||
808 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
809 | |||
810 | [[package]] | ||
811 | name = "winapi" | ||
812 | version = "0.3.5" | ||
813 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
814 | dependencies = [ | ||
815 | "winapi-i686-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", | ||
816 | "winapi-x86_64-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", | ||
817 | ] | ||
818 | |||
819 | [[package]] | ||
820 | name = "winapi-build" | ||
821 | version = "0.1.1" | ||
822 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
823 | |||
824 | [[package]] | ||
825 | name = "winapi-i686-pc-windows-gnu" | ||
826 | version = "0.4.0" | ||
827 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
828 | |||
829 | [[package]] | ||
830 | name = "winapi-util" | ||
831 | version = "0.1.1" | ||
832 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
833 | dependencies = [ | ||
834 | "winapi 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)", | ||
835 | ] | ||
836 | |||
837 | [[package]] | ||
838 | name = "winapi-x86_64-pc-windows-gnu" | ||
839 | version = "0.4.0" | ||
840 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
841 | |||
842 | [[package]] | ||
843 | name = "wincolor" | ||
844 | version = "1.0.1" | ||
845 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
846 | dependencies = [ | ||
847 | "winapi 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)", | ||
848 | "winapi-util 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", | ||
849 | ] | ||
850 | |||
851 | [metadata] | ||
852 | "checksum aho-corasick 0.6.8 (registry+https://github.com/rust-lang/crates.io-index)" = "68f56c7353e5a9547cbd76ed90f7bb5ffc3ba09d4ea9bd1d8c06c8b1142eeb5a" | ||
853 | "checksum ansi_term 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ee49baf6cb617b853aa8d93bf420db2383fab46d314482ca2803b40d5fde979b" | ||
854 | "checksum arrayref 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)" = "0d382e583f07208808f6b1249e60848879ba3543f57c32277bf52d69c2f0f0ee" | ||
855 | "checksum ascii-canvas 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "b385d69402821a1c254533a011a312531cbcc0e3e24f19bbb4747a5a2daf37e2" | ||
856 | "checksum atty 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "d0fd4c0631f06448cc45a6bbb3b710ebb7ff8ccb96a0800c994afe23a70d5df2" | ||
857 | "checksum atty 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)" = "9a7d5b8723950951411ee34d271d99dddcc2035a16ab25310ea2c8cfd4369652" | ||
858 | "checksum backtrace 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)" = "89a47830402e9981c5c41223151efcced65a0510c13097c769cede7efb34782a" | ||
859 | "checksum backtrace-sys 0.1.24 (registry+https://github.com/rust-lang/crates.io-index)" = "c66d56ac8dabd07f6aacdaf633f4b8262f5b3601a810a0dcddffd5c22c69daa0" | ||
860 | "checksum bit-set 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "d9bf6104718e80d7b26a68fdbacff3481cfc05df670821affc7e9cbc1884400c" | ||
861 | "checksum bit-vec 0.4.4 (registry+https://github.com/rust-lang/crates.io-index)" = "02b4ff8b16e6076c3e14220b39fbc1fabb6737522281a388998046859400895f" | ||
862 | "checksum bitflags 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)" = "228047a76f468627ca71776ecdebd732a3423081fcf5125585bcd7c49886ce12" | ||
863 | "checksum block-buffer 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "a076c298b9ecdb530ed9d967e74a6027d6a7478924520acddcddc24c1c8ab3ab" | ||
864 | "checksum byte-tools 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "560c32574a12a89ecd91f5e742165893f86e3ab98d21f8ea548658eb9eef5f40" | ||
865 | "checksum cc 1.0.23 (registry+https://github.com/rust-lang/crates.io-index)" = "c37f0efaa4b9b001fa6f02d4b644dee4af97d3414df07c51e3e4f015f3a3e131" | ||
866 | "checksum cfg-if 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "0c4e7bb64a8ebb0d856483e1e682ea3422f883c5f5615a90d51a2c82fe87fdd3" | ||
867 | "checksum clap 2.32.0 (registry+https://github.com/rust-lang/crates.io-index)" = "b957d88f4b6a63b9d70d5f454ac8011819c6efa7727858f458ab71c756ce2d3e" | ||
868 | "checksum clap 3.0.0-alpha.1 (git+https://github.com/kbknapp/clap-rs?branch=v3-master)" = "<none>" | ||
869 | "checksum clap-log-flag 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "9b05213138aad9c0f820773c51e829eae4189986435aa5c115a6465b385892a5" | ||
870 | "checksum clap-verbosity-flag 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "bda14f5323b2b747f52908c5b7b8af7790784088bc7c2957a11695e39ad476dc" | ||
871 | "checksum clap_derive 0.3.0 (git+https://github.com/clap-rs/clap_derive)" = "<none>" | ||
872 | "checksum cloudabi 0.0.3 (registry+https://github.com/rust-lang/crates.io-index)" = "ddfc5b9aa5d4507acaf872de71051dfd0e309860e88966e1051e462a077aac4f" | ||
873 | "checksum dbus 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)" = "3e34c238dfb3f5881d46ad301403cd8f8ecf946e2a4e89bdd1166728b68b5008" | ||
874 | "checksum diff 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)" = "3c2b69f912779fbb121ceb775d74d51e915af17aaebc38d28a592843a2dd0a3a" | ||
875 | "checksum digest 0.7.5 (registry+https://github.com/rust-lang/crates.io-index)" = "5b29c278aa8fd30796bd977169e8004b4aa88cdcd2f32a6eb22bc2d5d38df94a" | ||
876 | "checksum docopt 0.8.3 (registry+https://github.com/rust-lang/crates.io-index)" = "d8acd393692c503b168471874953a2531df0e9ab77d0b6bbc582395743300a4a" | ||
877 | "checksum either 1.5.0 (registry+https://github.com/rust-lang/crates.io-index)" = "3be565ca5c557d7f59e7cfcf1844f9e3033650c929c6566f511e8005f205c1d0" | ||
878 | "checksum ena 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)" = "cabe5a5078ac8c506d3e4430763b1ba9b609b1286913e7d08e581d1c2de9b7e5" | ||
879 | "checksum env_logger 0.5.13 (registry+https://github.com/rust-lang/crates.io-index)" = "15b0a4d2e39f8420210be8b27eeda28029729e2fd4291019455016c348240c38" | ||
880 | "checksum failure 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "7efb22686e4a466b1ec1a15c2898f91fa9cb340452496dca654032de20ff95b9" | ||
881 | "checksum failure_derive 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "946d0e98a50d9831f5d589038d2ca7f8f455b1c21028c0db0e84116a12696426" | ||
882 | "checksum fake-simd 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "e88a8acf291dafb59c2d96e8f59828f3838bb1a70398823ade51a84de6a6deed" | ||
883 | "checksum fixedbitset 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)" = "86d4de0081402f5e88cdac65c8dcdcc73118c1a7a465e2a05f0da05843a8ea33" | ||
884 | "checksum fuchsia-zircon 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "2e9763c69ebaae630ba35f74888db465e49e259ba1bc0eda7d06f4a067615d82" | ||
885 | "checksum fuchsia-zircon-sys 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "3dcaa9ae7725d12cdb85b3ad99a434db70b468c09ded17e012d86b5c1010f7a7" | ||
886 | "checksum generic-array 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ef25c5683767570c2bbd7deba372926a55eaae9982d7726ee2a1050239d45b9d" | ||
887 | "checksum humantime 1.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "0484fda3e7007f2a4a0d9c3a703ca38c71c54c55602ce4660c419fd32e188c9e" | ||
888 | "checksum indexmap 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "08173ba1e906efb6538785a8844dd496f5d34f0a2d88038e95195172fc667220" | ||
889 | "checksum itertools 0.7.8 (registry+https://github.com/rust-lang/crates.io-index)" = "f58856976b776fedd95533137617a02fb25719f40e7d9b01c7043cd65474f450" | ||
890 | "checksum kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "7507624b29483431c0ba2d82aece8ca6cdba9382bff4ddd0f7490560c056098d" | ||
891 | "checksum lalrpop 0.15.2 (registry+https://github.com/rust-lang/crates.io-index)" = "ba451f7bd819b7afc99d4cf4bdcd5a4861e64955ba9680ac70df3a50625ad6cf" | ||
892 | "checksum lalrpop-snap 0.15.2 (registry+https://github.com/rust-lang/crates.io-index)" = "60013fd6be14317d43f47658b1440956a9ca48a9ed0257e0e0a59aac13e43a1f" | ||
893 | "checksum lalrpop-util 0.15.2 (registry+https://github.com/rust-lang/crates.io-index)" = "60c6c48ba857cd700673ce88907cadcdd7e2cd7783ed02378537c5ffd4f6460c" | ||
894 | "checksum lazy_static 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ca488b89a5657b0a2ecd45b95609b3e848cf1755da332a0da46e2b2b1cb371a7" | ||
895 | "checksum libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)" = "76e3a3ef172f1a0b9a9ff0dd1491ae5e6c948b94479a3021819ba7d860c8645d" | ||
896 | "checksum libdbus-sys 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "8720f9274907052cb50313f91201597868da9d625f8dd125f2aca5bddb7e83a1" | ||
897 | "checksum log 0.4.4 (registry+https://github.com/rust-lang/crates.io-index)" = "cba860f648db8e6f269df990180c2217f333472b4a6e901e97446858487971e2" | ||
898 | "checksum memchr 2.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "a3b4142ab8738a78c51896f704f83c11df047ff1bda9a92a661aa6361552d93d" | ||
899 | "checksum new_debug_unreachable 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "0cdc457076c78ab54d5e0d6fa7c47981757f1e34dc39ff92787f217dede586c4" | ||
900 | "checksum ordermap 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)" = "a86ed3f5f244b372d6b1a00b72ef7f8876d0bc6a78a4c9985c53614041512063" | ||
901 | "checksum petgraph 0.4.13 (registry+https://github.com/rust-lang/crates.io-index)" = "9c3659d1ee90221741f65dd128d9998311b0e40c5d3c23a62445938214abce4f" | ||
902 | "checksum phf_generator 0.7.23 (registry+https://github.com/rust-lang/crates.io-index)" = "03dc191feb9b08b0dc1330d6549b795b9d81aec19efe6b4a45aec8d4caee0c4b" | ||
903 | "checksum phf_shared 0.7.23 (registry+https://github.com/rust-lang/crates.io-index)" = "b539898d22d4273ded07f64a05737649dc69095d92cb87c7097ec68e3f150b93" | ||
904 | "checksum pkg-config 0.3.14 (registry+https://github.com/rust-lang/crates.io-index)" = "676e8eb2b1b4c9043511a9b7bea0915320d7e502b0a079fb03f9635a5252b18c" | ||
905 | "checksum precomputed-hash 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "925383efa346730478fb4838dbe9137d2a47675ad789c546d150a6e1dd4ab31c" | ||
906 | "checksum pretty_env_logger 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)" = "8ae1b463255bf6613ad435f8997cb57f5d045ef35eb255f5a3d6085be936bd79" | ||
907 | "checksum proc-macro2 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)" = "1b06e2f335f48d24442b35a19df506a835fb3547bc3c06ef27340da9acf5cae7" | ||
908 | "checksum proc-macro2 0.4.15 (registry+https://github.com/rust-lang/crates.io-index)" = "295af93acfb1d5be29c16ca5b3f82d863836efd9cb0c14fd83811eb9a110e452" | ||
909 | "checksum quick-error 1.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "9274b940887ce9addde99c4eee6b5c44cc494b182b97e73dc8ffdcb3397fd3f0" | ||
910 | "checksum quote 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)" = "9949cfe66888ffe1d53e6ec9d9f3b70714083854be20fd5e271b232a017401e8" | ||
911 | "checksum quote 0.6.8 (registry+https://github.com/rust-lang/crates.io-index)" = "dd636425967c33af890042c483632d33fa7a18f19ad1d7ea72e8998c6ef8dea5" | ||
912 | "checksum rand 0.5.5 (registry+https://github.com/rust-lang/crates.io-index)" = "e464cd887e869cddcae8792a4ee31d23c7edd516700695608f5b98c67ee0131c" | ||
913 | "checksum rand_core 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "edecf0f94da5551fc9b492093e30b041a891657db7940ee221f9d2f66e82eef2" | ||
914 | "checksum redox_syscall 0.1.40 (registry+https://github.com/rust-lang/crates.io-index)" = "c214e91d3ecf43e9a4e41e578973adeb14b474f2bee858742d127af75a0112b1" | ||
915 | "checksum redox_termios 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "7e891cfe48e9100a70a3b6eb652fef28920c117d366339687bd5576160db0f76" | ||
916 | "checksum regex 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)" = "9329abc99e39129fcceabd24cf5d85b4671ef7c29c50e972bc5afe32438ec384" | ||
917 | "checksum regex 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)" = "67d0301b0c6804eca7e3c275119d0b01ff3b7ab9258a65709e608a66312a1025" | ||
918 | "checksum regex-syntax 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)" = "8e931c58b93d86f080c734bfd2bce7dd0079ae2331235818133c8be7f422e20e" | ||
919 | "checksum regex-syntax 0.5.6 (registry+https://github.com/rust-lang/crates.io-index)" = "7d707a4fa2637f2dca2ef9fd02225ec7661fe01a53623c1e6515b6916511f7a7" | ||
920 | "checksum regex-syntax 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)" = "747ba3b235651f6e2f67dfa8bcdcd073ddb7c243cb21c442fc12395dfcac212d" | ||
921 | "checksum rustc-demangle 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)" = "bcfe5b13211b4d78e5c2cadfebd7769197d95c639c35a50057eb4c05de811395" | ||
922 | "checksum serde 1.0.75 (registry+https://github.com/rust-lang/crates.io-index)" = "22d340507cea0b7e6632900a176101fea959c7065d93ba555072da90aaaafc87" | ||
923 | "checksum serde_derive 1.0.75 (registry+https://github.com/rust-lang/crates.io-index)" = "234fc8b737737b148ccd625175fc6390f5e4dacfdaa543cb93a3430d984a9119" | ||
924 | "checksum sha2 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)" = "9eb6be24e4c23a84d7184280d2722f7f2731fcdd4a9d886efbfe4413e4847ea0" | ||
925 | "checksum siphasher 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "0b8de496cf83d4ed58b6be86c3a275b8602f6ffe98d3024a869e124147a9a3ac" | ||
926 | "checksum string_cache 0.7.3 (registry+https://github.com/rust-lang/crates.io-index)" = "25d70109977172b127fe834e5449e5ab1740b9ba49fa18a2020f509174f25423" | ||
927 | "checksum string_cache_codegen 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)" = "35293b05cf1494e8ddd042a7df6756bf18d07f42d234f32e71dce8a7aabb0191" | ||
928 | "checksum string_cache_shared 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "b1884d1bc09741d466d9b14e6d37ac89d6909cbcac41dd9ae982d4d063bbedfc" | ||
929 | "checksum strsim 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)" = "b4d15c810519a91cf877e7e36e63fe068815c678181439f2f29e2562147c3694" | ||
930 | "checksum strsim 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "bb4f380125926a99e52bc279241539c018323fab05ad6368b56f93d9369ff550" | ||
931 | "checksum structopt 0.2.10 (registry+https://github.com/rust-lang/crates.io-index)" = "d8e9ad6a11096cbecdcca0cc6aa403fdfdbaeda2fb3323a39c98e6a166a1e45a" | ||
932 | "checksum structopt-derive 0.2.10 (registry+https://github.com/rust-lang/crates.io-index)" = "4cbce8ccdc62166bd594c14396a3242bf94c337a51dbfa9be1076dd74b3db2af" | ||
933 | "checksum syn 0.14.9 (registry+https://github.com/rust-lang/crates.io-index)" = "261ae9ecaa397c42b960649561949d69311f08eeaea86a65696e6e46517cf741" | ||
934 | "checksum synstructure 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "85bb9b7550d063ea184027c9b8c20ac167cd36d3e06b3a40bceb9d746dc1a7b7" | ||
935 | "checksum term 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)" = "fa63644f74ce96fbeb9b794f66aff2a52d601cbd5e80f4b97123e3899f4570f1" | ||
936 | "checksum termcolor 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)" = "ff3bac0e465b59f194e7037ed404b0326e56ff234d767edc4c5cc9cd49e7a2c7" | ||
937 | "checksum termion 1.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "689a3bdfaab439fd92bc87df5c4c78417d3cbe537487274e9b0b2dce76e92096" | ||
938 | "checksum textwrap 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)" = "307686869c93e71f94da64286f9a9524c0f308a9e1c87a583de8e9c9039ad3f6" | ||
939 | "checksum thread_local 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)" = "c6b53e329000edc2b34dbe8545fd20e55a333362d0a321909685a19bd28c3f1b" | ||
940 | "checksum typenum 1.10.0 (registry+https://github.com/rust-lang/crates.io-index)" = "612d636f949607bdf9b123b4a6f6d966dedf3ff669f7f045890d3a4a73948169" | ||
941 | "checksum ucd-util 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "fd2be2d6639d0f8fe6cdda291ad456e23629558d466e2789d2c3e9892bda285d" | ||
942 | "checksum unicode-width 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "882386231c45df4700b275c7ff55b6f3698780a650026380e72dabe76fa46526" | ||
943 | "checksum unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "fc72304796d0818e357ead4e000d19c9c174ab23dc11093ac919054d20a6a7fc" | ||
944 | "checksum unreachable 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "382810877fe448991dfc7f0dd6e3ae5d58088fd0ea5e35189655f84e6814fa56" | ||
945 | "checksum utf8-ranges 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "fd70f467df6810094968e2fce0ee1bd0e87157aceb026a8c083bcf5e25b9efe4" | ||
946 | "checksum vec_map 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)" = "05c78687fb1a80548ae3250346c3db86a80a7cdd77bda190189f2d0a0987c81a" | ||
947 | "checksum version_check 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)" = "7716c242968ee87e5542f8021178248f267f295a5c4803beae8b8b7fd9bc6051" | ||
948 | "checksum void 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "6a02e4885ed3bc0f2de90ea6dd45ebcbb66dacffe03547fadbb0eeae2770887d" | ||
949 | "checksum winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)" = "167dc9d6949a9b857f3451275e911c3f44255842c1f7a76f33c55103a909087a" | ||
950 | "checksum winapi 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)" = "773ef9dcc5f24b7d850d0ff101e542ff24c3b090a9768e03ff889fdef41f00fd" | ||
951 | "checksum winapi-build 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "2d315eee3b34aca4797b2da6b13ed88266e6d612562a0c46390af8299fc699bc" | ||
952 | "checksum winapi-i686-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" | ||
953 | "checksum winapi-util 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "afc5508759c5bf4285e61feb862b6083c8480aec864fa17a81fdec6f69b461ab" | ||
954 | "checksum winapi-x86_64-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" | ||
955 | "checksum wincolor 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "561ed901ae465d6185fa7864d63fbd5720d0ef718366c9a4dc83cf6170d7e9ba" | ||
diff --git a/Cargo.toml b/Cargo.toml new file mode 100644 index 0000000..7a9cbb3 --- /dev/null +++ b/Cargo.toml | |||
@@ -0,0 +1,21 @@ | |||
1 | [package] | ||
2 | name = "set_eq" | ||
3 | version = "0.1.0" | ||
4 | authors = ["Minijackson <minijackson@riseup.net>"] | ||
5 | |||
6 | [build-dependencies] | ||
7 | lalrpop = "0.15.2" | ||
8 | |||
9 | [dependencies] | ||
10 | dbus = "0.6.2" | ||
11 | |||
12 | clap = { git = "https://github.com/kbknapp/clap-rs", branch = "v3-master" } | ||
13 | clap-verbosity-flag = "0.2" | ||
14 | clap-log-flag = "0.1" | ||
15 | structopt = "0.2" | ||
16 | |||
17 | log = "0.4.4" | ||
18 | failure = "0.1.2" | ||
19 | |||
20 | lalrpop-util = "0.15.2" | ||
21 | regex = "1.0.4" | ||
diff --git a/build.rs b/build.rs new file mode 100644 index 0000000..23c7d3f --- /dev/null +++ b/build.rs | |||
@@ -0,0 +1,5 @@ | |||
1 | extern crate lalrpop; | ||
2 | |||
3 | fn main() { | ||
4 | lalrpop::process_root().unwrap(); | ||
5 | } | ||
diff --git a/src/dbus_api/equalizing_manager.rs b/src/dbus_api/equalizing_manager.rs new file mode 100644 index 0000000..5f6574f --- /dev/null +++ b/src/dbus_api/equalizing_manager.rs | |||
@@ -0,0 +1,291 @@ | |||
1 | // This code was autogenerated with dbus-codegen-rust, see https://github.com/diwic/dbus-rs | ||
2 | |||
3 | #![allow(dead_code)] | ||
4 | use dbus as dbus; | ||
5 | use dbus::arg; | ||
6 | use dbus::tree; | ||
7 | |||
8 | pub trait OrgPulseAudioExtEqualizing1Manager { | ||
9 | type Err; | ||
10 | fn remove_profile(&self, name: &str) -> Result<(), Self::Err>; | ||
11 | fn get_interface_revision(&self) -> Result<u32, Self::Err>; | ||
12 | fn get_equalized_sinks(&self) -> Result<Vec<dbus::Path<'static>>, Self::Err>; | ||
13 | fn get_profiles(&self) -> Result<Vec<String>, Self::Err>; | ||
14 | } | ||
15 | |||
16 | impl<'a, C: ::std::ops::Deref<Target=dbus::Connection>> OrgPulseAudioExtEqualizing1Manager for dbus::ConnPath<'a, C> { | ||
17 | type Err = dbus::Error; | ||
18 | |||
19 | fn remove_profile(&self, name: &str) -> Result<(), Self::Err> { | ||
20 | let mut m = try!(self.method_call_with_args(&"org.PulseAudio.Ext.Equalizing1.Manager".into(), &"RemoveProfile".into(), |msg| { | ||
21 | let mut i = arg::IterAppend::new(msg); | ||
22 | i.append(name); | ||
23 | })); | ||
24 | try!(m.as_result()); | ||
25 | Ok(()) | ||
26 | } | ||
27 | |||
28 | fn get_interface_revision(&self) -> Result<u32, Self::Err> { | ||
29 | <Self as dbus::stdintf::org_freedesktop_dbus::Properties>::get(&self, "org.PulseAudio.Ext.Equalizing1.Manager", "InterfaceRevision") | ||
30 | } | ||
31 | |||
32 | fn get_equalized_sinks(&self) -> Result<Vec<dbus::Path<'static>>, Self::Err> { | ||
33 | <Self as dbus::stdintf::org_freedesktop_dbus::Properties>::get(&self, "org.PulseAudio.Ext.Equalizing1.Manager", "EqualizedSinks") | ||
34 | } | ||
35 | |||
36 | fn get_profiles(&self) -> Result<Vec<String>, Self::Err> { | ||
37 | <Self as dbus::stdintf::org_freedesktop_dbus::Properties>::get(&self, "org.PulseAudio.Ext.Equalizing1.Manager", "Profiles") | ||
38 | } | ||
39 | } | ||
40 | |||
41 | pub fn org_pulse_audio_ext_equalizing1_manager_server<F, T, D>(factory: &tree::Factory<tree::MTFn<D>, D>, data: D::Interface, f: F) -> tree::Interface<tree::MTFn<D>, D> | ||
42 | where | ||
43 | D: tree::DataType, | ||
44 | D::Method: Default, | ||
45 | D::Property: Default, | ||
46 | T: OrgPulseAudioExtEqualizing1Manager<Err=tree::MethodErr>, | ||
47 | F: 'static + for <'z> Fn(& 'z tree::MethodInfo<tree::MTFn<D>, D>) -> & 'z T, | ||
48 | { | ||
49 | let i = factory.interface("org.PulseAudio.Ext.Equalizing1.Manager", data); | ||
50 | let f = ::std::sync::Arc::new(f); | ||
51 | let fclone = f.clone(); | ||
52 | let h = move |minfo: &tree::MethodInfo<tree::MTFn<D>, D>| { | ||
53 | let mut i = minfo.msg.iter_init(); | ||
54 | let name: &str = try!(i.read()); | ||
55 | let d = fclone(minfo); | ||
56 | try!(d.remove_profile(name)); | ||
57 | let rm = minfo.msg.method_return(); | ||
58 | Ok(vec!(rm)) | ||
59 | }; | ||
60 | let m = factory.method("RemoveProfile", Default::default(), h); | ||
61 | let m = m.in_arg(("name", "s")); | ||
62 | let i = i.add_m(m); | ||
63 | |||
64 | let p = factory.property::<u32, _>("InterfaceRevision", Default::default()); | ||
65 | let p = p.access(tree::Access::Read); | ||
66 | let fclone = f.clone(); | ||
67 | let p = p.on_get(move |a, pinfo| { | ||
68 | let minfo = pinfo.to_method_info(); | ||
69 | let d = fclone(&minfo); | ||
70 | a.append(try!(d.get_interface_revision())); | ||
71 | Ok(()) | ||
72 | }); | ||
73 | let i = i.add_p(p); | ||
74 | |||
75 | let p = factory.property::<Vec<dbus::Path>, _>("EqualizedSinks", Default::default()); | ||
76 | let p = p.access(tree::Access::Read); | ||
77 | let fclone = f.clone(); | ||
78 | let p = p.on_get(move |a, pinfo| { | ||
79 | let minfo = pinfo.to_method_info(); | ||
80 | let d = fclone(&minfo); | ||
81 | a.append(try!(d.get_equalized_sinks())); | ||
82 | Ok(()) | ||
83 | }); | ||
84 | let i = i.add_p(p); | ||
85 | |||
86 | let p = factory.property::<Vec<&str>, _>("Profiles", Default::default()); | ||
87 | let p = p.access(tree::Access::Read); | ||
88 | let fclone = f.clone(); | ||
89 | let p = p.on_get(move |a, pinfo| { | ||
90 | let minfo = pinfo.to_method_info(); | ||
91 | let d = fclone(&minfo); | ||
92 | a.append(try!(d.get_profiles())); | ||
93 | Ok(()) | ||
94 | }); | ||
95 | let i = i.add_p(p); | ||
96 | i | ||
97 | } | ||
98 | |||
99 | #[derive(Debug, Default)] | ||
100 | pub struct OrgPulseAudioExtEqualizing1ManagerSinkAdded { | ||
101 | pub sink: dbus::Path<'static>, | ||
102 | } | ||
103 | |||
104 | impl dbus::SignalArgs for OrgPulseAudioExtEqualizing1ManagerSinkAdded { | ||
105 | const NAME: &'static str = "SinkAdded"; | ||
106 | const INTERFACE: &'static str = "org.PulseAudio.Ext.Equalizing1.Manager"; | ||
107 | fn append(&self, i: &mut arg::IterAppend) { | ||
108 | (&self.sink as &arg::RefArg).append(i); | ||
109 | } | ||
110 | fn get(&mut self, i: &mut arg::Iter) -> Result<(), arg::TypeMismatchError> { | ||
111 | self.sink = try!(i.read()); | ||
112 | Ok(()) | ||
113 | } | ||
114 | } | ||
115 | |||
116 | #[derive(Debug, Default)] | ||
117 | pub struct OrgPulseAudioExtEqualizing1ManagerSinkRemoved { | ||
118 | pub sink: dbus::Path<'static>, | ||
119 | } | ||
120 | |||
121 | impl dbus::SignalArgs for OrgPulseAudioExtEqualizing1ManagerSinkRemoved { | ||
122 | const NAME: &'static str = "SinkRemoved"; | ||
123 | const INTERFACE: &'static str = "org.PulseAudio.Ext.Equalizing1.Manager"; | ||
124 | fn append(&self, i: &mut arg::IterAppend) { | ||
125 | (&self.sink as &arg::RefArg).append(i); | ||
126 | } | ||
127 | fn get(&mut self, i: &mut arg::Iter) -> Result<(), arg::TypeMismatchError> { | ||
128 | self.sink = try!(i.read()); | ||
129 | Ok(()) | ||
130 | } | ||
131 | } | ||
132 | |||
133 | #[derive(Debug, Default)] | ||
134 | pub struct OrgPulseAudioExtEqualizing1ManagerProfilesChanged { | ||
135 | } | ||
136 | |||
137 | impl dbus::SignalArgs for OrgPulseAudioExtEqualizing1ManagerProfilesChanged { | ||
138 | const NAME: &'static str = "ProfilesChanged"; | ||
139 | const INTERFACE: &'static str = "org.PulseAudio.Ext.Equalizing1.Manager"; | ||
140 | fn append(&self, _: &mut arg::IterAppend) { | ||
141 | } | ||
142 | fn get(&mut self, _: &mut arg::Iter) -> Result<(), arg::TypeMismatchError> { | ||
143 | Ok(()) | ||
144 | } | ||
145 | } | ||
146 | |||
147 | pub trait OrgFreedesktopDBusIntrospectable { | ||
148 | type Err; | ||
149 | fn introspect(&self) -> Result<String, Self::Err>; | ||
150 | } | ||
151 | |||
152 | impl<'a, C: ::std::ops::Deref<Target=dbus::Connection>> OrgFreedesktopDBusIntrospectable for dbus::ConnPath<'a, C> { | ||
153 | type Err = dbus::Error; | ||
154 | |||
155 | fn introspect(&self) -> Result<String, Self::Err> { | ||
156 | let mut m = try!(self.method_call_with_args(&"org.freedesktop.DBus.Introspectable".into(), &"Introspect".into(), |_| { | ||
157 | })); | ||
158 | try!(m.as_result()); | ||
159 | let mut i = m.iter_init(); | ||
160 | let data: String = try!(i.read()); | ||
161 | Ok(data) | ||
162 | } | ||
163 | } | ||
164 | |||
165 | pub fn org_freedesktop_dbus_introspectable_server<F, T, D>(factory: &tree::Factory<tree::MTFn<D>, D>, data: D::Interface, f: F) -> tree::Interface<tree::MTFn<D>, D> | ||
166 | where | ||
167 | D: tree::DataType, | ||
168 | D::Method: Default, | ||
169 | T: OrgFreedesktopDBusIntrospectable<Err=tree::MethodErr>, | ||
170 | F: 'static + for <'z> Fn(& 'z tree::MethodInfo<tree::MTFn<D>, D>) -> & 'z T, | ||
171 | { | ||
172 | let i = factory.interface("org.freedesktop.DBus.Introspectable", data); | ||
173 | let f = ::std::sync::Arc::new(f); | ||
174 | let fclone = f.clone(); | ||
175 | let h = move |minfo: &tree::MethodInfo<tree::MTFn<D>, D>| { | ||
176 | let d = fclone(minfo); | ||
177 | let data = try!(d.introspect()); | ||
178 | let rm = minfo.msg.method_return(); | ||
179 | let rm = rm.append1(data); | ||
180 | Ok(vec!(rm)) | ||
181 | }; | ||
182 | let m = factory.method("Introspect", Default::default(), h); | ||
183 | let m = m.out_arg(("data", "s")); | ||
184 | let i = i.add_m(m); | ||
185 | i | ||
186 | } | ||
187 | |||
188 | pub trait OrgFreedesktopDBusProperties { | ||
189 | type Err; | ||
190 | fn get(&self, interface_name: &str, property_name: &str) -> Result<arg::Variant<Box<arg::RefArg>>, Self::Err>; | ||
191 | fn set(&self, interface_name: &str, property_name: &str, value: arg::Variant<Box<arg::RefArg>>) -> Result<(), Self::Err>; | ||
192 | fn get_all(&self, interface_name: &str) -> Result<::std::collections::HashMap<String, arg::Variant<Box<arg::RefArg>>>, Self::Err>; | ||
193 | } | ||
194 | |||
195 | impl<'a, C: ::std::ops::Deref<Target=dbus::Connection>> OrgFreedesktopDBusProperties for dbus::ConnPath<'a, C> { | ||
196 | type Err = dbus::Error; | ||
197 | |||
198 | fn get(&self, interface_name: &str, property_name: &str) -> Result<arg::Variant<Box<arg::RefArg>>, Self::Err> { | ||
199 | let mut m = try!(self.method_call_with_args(&"org.freedesktop.DBus.Properties".into(), &"Get".into(), |msg| { | ||
200 | let mut i = arg::IterAppend::new(msg); | ||
201 | i.append(interface_name); | ||
202 | i.append(property_name); | ||
203 | })); | ||
204 | try!(m.as_result()); | ||
205 | let mut i = m.iter_init(); | ||
206 | let value: arg::Variant<Box<arg::RefArg>> = try!(i.read()); | ||
207 | Ok(value) | ||
208 | } | ||
209 | |||
210 | fn set(&self, interface_name: &str, property_name: &str, value: arg::Variant<Box<arg::RefArg>>) -> Result<(), Self::Err> { | ||
211 | let mut m = try!(self.method_call_with_args(&"org.freedesktop.DBus.Properties".into(), &"Set".into(), |msg| { | ||
212 | let mut i = arg::IterAppend::new(msg); | ||
213 | i.append(interface_name); | ||
214 | i.append(property_name); | ||
215 | i.append(value); | ||
216 | })); | ||
217 | try!(m.as_result()); | ||
218 | Ok(()) | ||
219 | } | ||
220 | |||
221 | fn get_all(&self, interface_name: &str) -> Result<::std::collections::HashMap<String, arg::Variant<Box<arg::RefArg>>>, Self::Err> { | ||
222 | let mut m = try!(self.method_call_with_args(&"org.freedesktop.DBus.Properties".into(), &"GetAll".into(), |msg| { | ||
223 | let mut i = arg::IterAppend::new(msg); | ||
224 | i.append(interface_name); | ||
225 | })); | ||
226 | try!(m.as_result()); | ||
227 | let mut i = m.iter_init(); | ||
228 | let props: ::std::collections::HashMap<String, arg::Variant<Box<arg::RefArg>>> = try!(i.read()); | ||
229 | Ok(props) | ||
230 | } | ||
231 | } | ||
232 | |||
233 | pub fn org_freedesktop_dbus_properties_server<F, T, D>(factory: &tree::Factory<tree::MTFn<D>, D>, data: D::Interface, f: F) -> tree::Interface<tree::MTFn<D>, D> | ||
234 | where | ||
235 | D: tree::DataType, | ||
236 | D::Method: Default, | ||
237 | T: OrgFreedesktopDBusProperties<Err=tree::MethodErr>, | ||
238 | F: 'static + for <'z> Fn(& 'z tree::MethodInfo<tree::MTFn<D>, D>) -> & 'z T, | ||
239 | { | ||
240 | let i = factory.interface("org.freedesktop.DBus.Properties", data); | ||
241 | let f = ::std::sync::Arc::new(f); | ||
242 | let fclone = f.clone(); | ||
243 | let h = move |minfo: &tree::MethodInfo<tree::MTFn<D>, D>| { | ||
244 | let mut i = minfo.msg.iter_init(); | ||
245 | let interface_name: &str = try!(i.read()); | ||
246 | let property_name: &str = try!(i.read()); | ||
247 | let d = fclone(minfo); | ||
248 | let value = try!(d.get(interface_name, property_name)); | ||
249 | let rm = minfo.msg.method_return(); | ||
250 | let rm = rm.append1(value); | ||
251 | Ok(vec!(rm)) | ||
252 | }; | ||
253 | let m = factory.method("Get", Default::default(), h); | ||
254 | let m = m.in_arg(("interface_name", "s")); | ||
255 | let m = m.in_arg(("property_name", "s")); | ||
256 | let m = m.out_arg(("value", "v")); | ||
257 | let i = i.add_m(m); | ||
258 | |||
259 | let fclone = f.clone(); | ||
260 | let h = move |minfo: &tree::MethodInfo<tree::MTFn<D>, D>| { | ||
261 | let mut i = minfo.msg.iter_init(); | ||
262 | let interface_name: &str = try!(i.read()); | ||
263 | let property_name: &str = try!(i.read()); | ||
264 | let value: arg::Variant<Box<arg::RefArg>> = try!(i.read()); | ||
265 | let d = fclone(minfo); | ||
266 | try!(d.set(interface_name, property_name, value)); | ||
267 | let rm = minfo.msg.method_return(); | ||
268 | Ok(vec!(rm)) | ||
269 | }; | ||
270 | let m = factory.method("Set", Default::default(), h); | ||
271 | let m = m.in_arg(("interface_name", "s")); | ||
272 | let m = m.in_arg(("property_name", "s")); | ||
273 | let m = m.in_arg(("value", "v")); | ||
274 | let i = i.add_m(m); | ||
275 | |||
276 | let fclone = f.clone(); | ||
277 | let h = move |minfo: &tree::MethodInfo<tree::MTFn<D>, D>| { | ||
278 | let mut i = minfo.msg.iter_init(); | ||
279 | let interface_name: &str = try!(i.read()); | ||
280 | let d = fclone(minfo); | ||
281 | let props = try!(d.get_all(interface_name)); | ||
282 | let rm = minfo.msg.method_return(); | ||
283 | let rm = rm.append1(props); | ||
284 | Ok(vec!(rm)) | ||
285 | }; | ||
286 | let m = factory.method("GetAll", Default::default(), h); | ||
287 | let m = m.in_arg(("interface_name", "s")); | ||
288 | let m = m.out_arg(("props", "a{sv}")); | ||
289 | let i = i.add_m(m); | ||
290 | i | ||
291 | } | ||
diff --git a/src/dbus_api/mod.rs b/src/dbus_api/mod.rs new file mode 100644 index 0000000..a184c55 --- /dev/null +++ b/src/dbus_api/mod.rs | |||
@@ -0,0 +1,3 @@ | |||
1 | pub mod equalizing_manager; | ||
2 | pub mod server_lookup; | ||
3 | pub mod sink; | ||
diff --git a/src/dbus_api/server_lookup.rs b/src/dbus_api/server_lookup.rs new file mode 100644 index 0000000..78ad4bd --- /dev/null +++ b/src/dbus_api/server_lookup.rs | |||
@@ -0,0 +1,188 @@ | |||
1 | // This code was autogenerated with dbus-codegen-rust, see https://github.com/diwic/dbus-rs | ||
2 | |||
3 | #![allow(dead_code)] | ||
4 | use dbus as dbus; | ||
5 | use dbus::arg; | ||
6 | use dbus::tree; | ||
7 | |||
8 | pub trait OrgPulseAudioServerLookup1 { | ||
9 | type Err; | ||
10 | fn get_address(&self) -> Result<String, Self::Err>; | ||
11 | } | ||
12 | |||
13 | impl<'a, C: ::std::ops::Deref<Target=dbus::Connection>> OrgPulseAudioServerLookup1 for dbus::ConnPath<'a, C> { | ||
14 | type Err = dbus::Error; | ||
15 | |||
16 | fn get_address(&self) -> Result<String, Self::Err> { | ||
17 | <Self as dbus::stdintf::org_freedesktop_dbus::Properties>::get(&self, "org.PulseAudio.ServerLookup1", "Address") | ||
18 | } | ||
19 | } | ||
20 | |||
21 | pub fn org_pulse_audio_server_lookup1_server<F, T, D>(factory: &tree::Factory<tree::MTFn<D>, D>, data: D::Interface, f: F) -> tree::Interface<tree::MTFn<D>, D> | ||
22 | where | ||
23 | D: tree::DataType, | ||
24 | D::Method: Default, | ||
25 | D::Property: Default, | ||
26 | T: OrgPulseAudioServerLookup1<Err=tree::MethodErr>, | ||
27 | F: 'static + for <'z> Fn(& 'z tree::MethodInfo<tree::MTFn<D>, D>) -> & 'z T, | ||
28 | { | ||
29 | let i = factory.interface("org.PulseAudio.ServerLookup1", data); | ||
30 | let f = ::std::sync::Arc::new(f); | ||
31 | let p = factory.property::<&str, _>("Address", Default::default()); | ||
32 | let p = p.access(tree::Access::Read); | ||
33 | let fclone = f.clone(); | ||
34 | let p = p.on_get(move |a, pinfo| { | ||
35 | let minfo = pinfo.to_method_info(); | ||
36 | let d = fclone(&minfo); | ||
37 | a.append(try!(d.get_address())); | ||
38 | Ok(()) | ||
39 | }); | ||
40 | let i = i.add_p(p); | ||
41 | i | ||
42 | } | ||
43 | |||
44 | pub trait OrgFreedesktopDBusIntrospectable { | ||
45 | type Err; | ||
46 | fn introspect(&self) -> Result<String, Self::Err>; | ||
47 | } | ||
48 | |||
49 | impl<'a, C: ::std::ops::Deref<Target=dbus::Connection>> OrgFreedesktopDBusIntrospectable for dbus::ConnPath<'a, C> { | ||
50 | type Err = dbus::Error; | ||
51 | |||
52 | fn introspect(&self) -> Result<String, Self::Err> { | ||
53 | let mut m = try!(self.method_call_with_args(&"org.freedesktop.DBus.Introspectable".into(), &"Introspect".into(), |_| { | ||
54 | })); | ||
55 | try!(m.as_result()); | ||
56 | let mut i = m.iter_init(); | ||
57 | let data: String = try!(i.read()); | ||
58 | Ok(data) | ||
59 | } | ||
60 | } | ||
61 | |||
62 | pub fn org_freedesktop_dbus_introspectable_server<F, T, D>(factory: &tree::Factory<tree::MTFn<D>, D>, data: D::Interface, f: F) -> tree::Interface<tree::MTFn<D>, D> | ||
63 | where | ||
64 | D: tree::DataType, | ||
65 | D::Method: Default, | ||
66 | T: OrgFreedesktopDBusIntrospectable<Err=tree::MethodErr>, | ||
67 | F: 'static + for <'z> Fn(& 'z tree::MethodInfo<tree::MTFn<D>, D>) -> & 'z T, | ||
68 | { | ||
69 | let i = factory.interface("org.freedesktop.DBus.Introspectable", data); | ||
70 | let f = ::std::sync::Arc::new(f); | ||
71 | let fclone = f.clone(); | ||
72 | let h = move |minfo: &tree::MethodInfo<tree::MTFn<D>, D>| { | ||
73 | let d = fclone(minfo); | ||
74 | let data = try!(d.introspect()); | ||
75 | let rm = minfo.msg.method_return(); | ||
76 | let rm = rm.append1(data); | ||
77 | Ok(vec!(rm)) | ||
78 | }; | ||
79 | let m = factory.method("Introspect", Default::default(), h); | ||
80 | let m = m.out_arg(("data", "s")); | ||
81 | let i = i.add_m(m); | ||
82 | i | ||
83 | } | ||
84 | |||
85 | pub trait OrgFreedesktopDBusProperties { | ||
86 | type Err; | ||
87 | fn get(&self, interface_name: &str, property_name: &str) -> Result<arg::Variant<Box<arg::RefArg>>, Self::Err>; | ||
88 | fn set(&self, interface_name: &str, property_name: &str, value: arg::Variant<Box<arg::RefArg>>) -> Result<(), Self::Err>; | ||
89 | fn get_all(&self, interface_name: &str) -> Result<::std::collections::HashMap<String, arg::Variant<Box<arg::RefArg>>>, Self::Err>; | ||
90 | } | ||
91 | |||
92 | impl<'a, C: ::std::ops::Deref<Target=dbus::Connection>> OrgFreedesktopDBusProperties for dbus::ConnPath<'a, C> { | ||
93 | type Err = dbus::Error; | ||
94 | |||
95 | fn get(&self, interface_name: &str, property_name: &str) -> Result<arg::Variant<Box<arg::RefArg>>, Self::Err> { | ||
96 | let mut m = try!(self.method_call_with_args(&"org.freedesktop.DBus.Properties".into(), &"Get".into(), |msg| { | ||
97 | let mut i = arg::IterAppend::new(msg); | ||
98 | i.append(interface_name); | ||
99 | i.append(property_name); | ||
100 | })); | ||
101 | try!(m.as_result()); | ||
102 | let mut i = m.iter_init(); | ||
103 | let value: arg::Variant<Box<arg::RefArg>> = try!(i.read()); | ||
104 | Ok(value) | ||
105 | } | ||
106 | |||
107 | fn set(&self, interface_name: &str, property_name: &str, value: arg::Variant<Box<arg::RefArg>>) -> Result<(), Self::Err> { | ||
108 | let mut m = try!(self.method_call_with_args(&"org.freedesktop.DBus.Properties".into(), &"Set".into(), |msg| { | ||
109 | let mut i = arg::IterAppend::new(msg); | ||
110 | i.append(interface_name); | ||
111 | i.append(property_name); | ||
112 | i.append(value); | ||
113 | })); | ||
114 | try!(m.as_result()); | ||
115 | Ok(()) | ||
116 | } | ||
117 | |||
118 | fn get_all(&self, interface_name: &str) -> Result<::std::collections::HashMap<String, arg::Variant<Box<arg::RefArg>>>, Self::Err> { | ||
119 | let mut m = try!(self.method_call_with_args(&"org.freedesktop.DBus.Properties".into(), &"GetAll".into(), |msg| { | ||
120 | let mut i = arg::IterAppend::new(msg); | ||
121 | i.append(interface_name); | ||
122 | })); | ||
123 | try!(m.as_result()); | ||
124 | let mut i = m.iter_init(); | ||
125 | let props: ::std::collections::HashMap<String, arg::Variant<Box<arg::RefArg>>> = try!(i.read()); | ||
126 | Ok(props) | ||
127 | } | ||
128 | } | ||
129 | |||
130 | pub fn org_freedesktop_dbus_properties_server<F, T, D>(factory: &tree::Factory<tree::MTFn<D>, D>, data: D::Interface, f: F) -> tree::Interface<tree::MTFn<D>, D> | ||
131 | where | ||
132 | D: tree::DataType, | ||
133 | D::Method: Default, | ||
134 | T: OrgFreedesktopDBusProperties<Err=tree::MethodErr>, | ||
135 | F: 'static + for <'z> Fn(& 'z tree::MethodInfo<tree::MTFn<D>, D>) -> & 'z T, | ||
136 | { | ||
137 | let i = factory.interface("org.freedesktop.DBus.Properties", data); | ||
138 | let f = ::std::sync::Arc::new(f); | ||
139 | let fclone = f.clone(); | ||
140 | let h = move |minfo: &tree::MethodInfo<tree::MTFn<D>, D>| { | ||
141 | let mut i = minfo.msg.iter_init(); | ||
142 | let interface_name: &str = try!(i.read()); | ||
143 | let property_name: &str = try!(i.read()); | ||
144 | let d = fclone(minfo); | ||
145 | let value = try!(d.get(interface_name, property_name)); | ||
146 | let rm = minfo.msg.method_return(); | ||
147 | let rm = rm.append1(value); | ||
148 | Ok(vec!(rm)) | ||
149 | }; | ||
150 | let m = factory.method("Get", Default::default(), h); | ||
151 | let m = m.in_arg(("interface_name", "s")); | ||
152 | let m = m.in_arg(("property_name", "s")); | ||
153 | let m = m.out_arg(("value", "v")); | ||
154 | let i = i.add_m(m); | ||
155 | |||
156 | let fclone = f.clone(); | ||
157 | let h = move |minfo: &tree::MethodInfo<tree::MTFn<D>, D>| { | ||
158 | let mut i = minfo.msg.iter_init(); | ||
159 | let interface_name: &str = try!(i.read()); | ||
160 | let property_name: &str = try!(i.read()); | ||
161 | let value: arg::Variant<Box<arg::RefArg>> = try!(i.read()); | ||
162 | let d = fclone(minfo); | ||
163 | try!(d.set(interface_name, property_name, value)); | ||
164 | let rm = minfo.msg.method_return(); | ||
165 | Ok(vec!(rm)) | ||
166 | }; | ||
167 | let m = factory.method("Set", Default::default(), h); | ||
168 | let m = m.in_arg(("interface_name", "s")); | ||
169 | let m = m.in_arg(("property_name", "s")); | ||
170 | let m = m.in_arg(("value", "v")); | ||
171 | let i = i.add_m(m); | ||
172 | |||
173 | let fclone = f.clone(); | ||
174 | let h = move |minfo: &tree::MethodInfo<tree::MTFn<D>, D>| { | ||
175 | let mut i = minfo.msg.iter_init(); | ||
176 | let interface_name: &str = try!(i.read()); | ||
177 | let d = fclone(minfo); | ||
178 | let props = try!(d.get_all(interface_name)); | ||
179 | let rm = minfo.msg.method_return(); | ||
180 | let rm = rm.append1(props); | ||
181 | Ok(vec!(rm)) | ||
182 | }; | ||
183 | let m = factory.method("GetAll", Default::default(), h); | ||
184 | let m = m.in_arg(("interface_name", "s")); | ||
185 | let m = m.out_arg(("props", "a{sv}")); | ||
186 | let i = i.add_m(m); | ||
187 | i | ||
188 | } | ||
diff --git a/src/dbus_api/sink.rs b/src/dbus_api/sink.rs new file mode 100644 index 0000000..6bd1756 --- /dev/null +++ b/src/dbus_api/sink.rs | |||
@@ -0,0 +1,1128 @@ | |||
1 | // This code was autogenerated with dbus-codegen-rust, see https://github.com/diwic/dbus-rs | ||
2 | |||
3 | #![allow(dead_code)] | ||
4 | use dbus as dbus; | ||
5 | use dbus::arg; | ||
6 | use dbus::tree; | ||
7 | |||
8 | pub trait OrgPulseAudioExtEqualizing1Equalizer { | ||
9 | type Err; | ||
10 | fn filter_at_points(&self, channel: u32, xs: Vec<u32>) -> Result<(Vec<f64>, f64), Self::Err>; | ||
11 | fn seed_filter(&self, channel: u32, xs: Vec<u32>, ys: Vec<f64>, preamp: f64) -> Result<(), Self::Err>; | ||
12 | fn save_profile(&self, channel: u32, name: &str) -> Result<(), Self::Err>; | ||
13 | fn load_profile(&self, channel: u32, name: &str) -> Result<(), Self::Err>; | ||
14 | fn set_filter(&self, channel: u32, ys: Vec<f64>, preamp: f64) -> Result<(), Self::Err>; | ||
15 | fn get_filter(&self, channel: u32) -> Result<(Vec<f64>, f64), Self::Err>; | ||
16 | fn save_state(&self) -> Result<(), Self::Err>; | ||
17 | fn base_profile(&self, channel: u32) -> Result<String, Self::Err>; | ||
18 | fn get_interface_revision(&self) -> Result<u32, Self::Err>; | ||
19 | fn get_sample_rate(&self) -> Result<u32, Self::Err>; | ||
20 | fn get_filter_sample_rate(&self) -> Result<u32, Self::Err>; | ||
21 | fn get_nfilter_coefficients(&self) -> Result<u32, Self::Err>; | ||
22 | fn get_nchannels(&self) -> Result<u32, Self::Err>; | ||
23 | } | ||
24 | |||
25 | impl<'a, C: ::std::ops::Deref<Target=dbus::Connection>> OrgPulseAudioExtEqualizing1Equalizer for dbus::ConnPath<'a, C> { | ||
26 | type Err = dbus::Error; | ||
27 | |||
28 | fn filter_at_points(&self, channel: u32, xs: Vec<u32>) -> Result<(Vec<f64>, f64), Self::Err> { | ||
29 | let mut m = try!(self.method_call_with_args(&"org.PulseAudio.Ext.Equalizing1.Equalizer".into(), &"FilterAtPoints".into(), |msg| { | ||
30 | let mut i = arg::IterAppend::new(msg); | ||
31 | i.append(channel); | ||
32 | i.append(xs); | ||
33 | })); | ||
34 | try!(m.as_result()); | ||
35 | let mut i = m.iter_init(); | ||
36 | let ys: Vec<f64> = try!(i.read()); | ||
37 | let preamp: f64 = try!(i.read()); | ||
38 | Ok((ys, preamp)) | ||
39 | } | ||
40 | |||
41 | fn seed_filter(&self, channel: u32, xs: Vec<u32>, ys: Vec<f64>, preamp: f64) -> Result<(), Self::Err> { | ||
42 | let mut m = try!(self.method_call_with_args(&"org.PulseAudio.Ext.Equalizing1.Equalizer".into(), &"SeedFilter".into(), |msg| { | ||
43 | let mut i = arg::IterAppend::new(msg); | ||
44 | i.append(channel); | ||
45 | i.append(xs); | ||
46 | i.append(ys); | ||
47 | i.append(preamp); | ||
48 | })); | ||
49 | try!(m.as_result()); | ||
50 | Ok(()) | ||
51 | } | ||
52 | |||
53 | fn save_profile(&self, channel: u32, name: &str) -> Result<(), Self::Err> { | ||
54 | let mut m = try!(self.method_call_with_args(&"org.PulseAudio.Ext.Equalizing1.Equalizer".into(), &"SaveProfile".into(), |msg| { | ||
55 | let mut i = arg::IterAppend::new(msg); | ||
56 | i.append(channel); | ||
57 | i.append(name); | ||
58 | })); | ||
59 | try!(m.as_result()); | ||
60 | Ok(()) | ||
61 | } | ||
62 | |||
63 | fn load_profile(&self, channel: u32, name: &str) -> Result<(), Self::Err> { | ||
64 | let mut m = try!(self.method_call_with_args(&"org.PulseAudio.Ext.Equalizing1.Equalizer".into(), &"LoadProfile".into(), |msg| { | ||
65 | let mut i = arg::IterAppend::new(msg); | ||
66 | i.append(channel); | ||
67 | i.append(name); | ||
68 | })); | ||
69 | try!(m.as_result()); | ||
70 | Ok(()) | ||
71 | } | ||
72 | |||
73 | fn set_filter(&self, channel: u32, ys: Vec<f64>, preamp: f64) -> Result<(), Self::Err> { | ||
74 | let mut m = try!(self.method_call_with_args(&"org.PulseAudio.Ext.Equalizing1.Equalizer".into(), &"SetFilter".into(), |msg| { | ||
75 | let mut i = arg::IterAppend::new(msg); | ||
76 | i.append(channel); | ||
77 | i.append(ys); | ||
78 | i.append(preamp); | ||
79 | })); | ||
80 | try!(m.as_result()); | ||
81 | Ok(()) | ||
82 | } | ||
83 | |||
84 | fn get_filter(&self, channel: u32) -> Result<(Vec<f64>, f64), Self::Err> { | ||
85 | let mut m = try!(self.method_call_with_args(&"org.PulseAudio.Ext.Equalizing1.Equalizer".into(), &"GetFilter".into(), |msg| { | ||
86 | let mut i = arg::IterAppend::new(msg); | ||
87 | i.append(channel); | ||
88 | })); | ||
89 | try!(m.as_result()); | ||
90 | let mut i = m.iter_init(); | ||
91 | let ys: Vec<f64> = try!(i.read()); | ||
92 | let preamp: f64 = try!(i.read()); | ||
93 | Ok((ys, preamp)) | ||
94 | } | ||
95 | |||
96 | fn save_state(&self) -> Result<(), Self::Err> { | ||
97 | let mut m = try!(self.method_call_with_args(&"org.PulseAudio.Ext.Equalizing1.Equalizer".into(), &"SaveState".into(), |_| { | ||
98 | })); | ||
99 | try!(m.as_result()); | ||
100 | Ok(()) | ||
101 | } | ||
102 | |||
103 | fn base_profile(&self, channel: u32) -> Result<String, Self::Err> { | ||
104 | let mut m = try!(self.method_call_with_args(&"org.PulseAudio.Ext.Equalizing1.Equalizer".into(), &"BaseProfile".into(), |msg| { | ||
105 | let mut i = arg::IterAppend::new(msg); | ||
106 | i.append(channel); | ||
107 | })); | ||
108 | try!(m.as_result()); | ||
109 | let mut i = m.iter_init(); | ||
110 | let name: String = try!(i.read()); | ||
111 | Ok(name) | ||
112 | } | ||
113 | |||
114 | fn get_interface_revision(&self) -> Result<u32, Self::Err> { | ||
115 | <Self as dbus::stdintf::org_freedesktop_dbus::Properties>::get(&self, "org.PulseAudio.Ext.Equalizing1.Equalizer", "InterfaceRevision") | ||
116 | } | ||
117 | |||
118 | fn get_sample_rate(&self) -> Result<u32, Self::Err> { | ||
119 | <Self as dbus::stdintf::org_freedesktop_dbus::Properties>::get(&self, "org.PulseAudio.Ext.Equalizing1.Equalizer", "SampleRate") | ||
120 | } | ||
121 | |||
122 | fn get_filter_sample_rate(&self) -> Result<u32, Self::Err> { | ||
123 | <Self as dbus::stdintf::org_freedesktop_dbus::Properties>::get(&self, "org.PulseAudio.Ext.Equalizing1.Equalizer", "FilterSampleRate") | ||
124 | } | ||
125 | |||
126 | fn get_nfilter_coefficients(&self) -> Result<u32, Self::Err> { | ||
127 | <Self as dbus::stdintf::org_freedesktop_dbus::Properties>::get(&self, "org.PulseAudio.Ext.Equalizing1.Equalizer", "NFilterCoefficients") | ||
128 | } | ||
129 | |||
130 | fn get_nchannels(&self) -> Result<u32, Self::Err> { | ||
131 | <Self as dbus::stdintf::org_freedesktop_dbus::Properties>::get(&self, "org.PulseAudio.Ext.Equalizing1.Equalizer", "NChannels") | ||
132 | } | ||
133 | } | ||
134 | |||
135 | pub fn org_pulse_audio_ext_equalizing1_equalizer_server<F, T, D>(factory: &tree::Factory<tree::MTFn<D>, D>, data: D::Interface, f: F) -> tree::Interface<tree::MTFn<D>, D> | ||
136 | where | ||
137 | D: tree::DataType, | ||
138 | D::Method: Default, | ||
139 | D::Property: Default, | ||
140 | T: OrgPulseAudioExtEqualizing1Equalizer<Err=tree::MethodErr>, | ||
141 | F: 'static + for <'z> Fn(& 'z tree::MethodInfo<tree::MTFn<D>, D>) -> & 'z T, | ||
142 | { | ||
143 | let i = factory.interface("org.PulseAudio.Ext.Equalizing1.Equalizer", data); | ||
144 | let f = ::std::sync::Arc::new(f); | ||
145 | let fclone = f.clone(); | ||
146 | let h = move |minfo: &tree::MethodInfo<tree::MTFn<D>, D>| { | ||
147 | let mut i = minfo.msg.iter_init(); | ||
148 | let channel: u32 = try!(i.read()); | ||
149 | let xs: Vec<u32> = try!(i.read()); | ||
150 | let d = fclone(minfo); | ||
151 | let (ys, preamp) = try!(d.filter_at_points(channel, xs)); | ||
152 | let rm = minfo.msg.method_return(); | ||
153 | let rm = rm.append1(ys); | ||
154 | let rm = rm.append1(preamp); | ||
155 | Ok(vec!(rm)) | ||
156 | }; | ||
157 | let m = factory.method("FilterAtPoints", Default::default(), h); | ||
158 | let m = m.in_arg(("channel", "u")); | ||
159 | let m = m.in_arg(("xs", "au")); | ||
160 | let m = m.out_arg(("ys", "ad")); | ||
161 | let m = m.out_arg(("preamp", "d")); | ||
162 | let i = i.add_m(m); | ||
163 | |||
164 | let fclone = f.clone(); | ||
165 | let h = move |minfo: &tree::MethodInfo<tree::MTFn<D>, D>| { | ||
166 | let mut i = minfo.msg.iter_init(); | ||
167 | let channel: u32 = try!(i.read()); | ||
168 | let xs: Vec<u32> = try!(i.read()); | ||
169 | let ys: Vec<f64> = try!(i.read()); | ||
170 | let preamp: f64 = try!(i.read()); | ||
171 | let d = fclone(minfo); | ||
172 | try!(d.seed_filter(channel, xs, ys, preamp)); | ||
173 | let rm = minfo.msg.method_return(); | ||
174 | Ok(vec!(rm)) | ||
175 | }; | ||
176 | let m = factory.method("SeedFilter", Default::default(), h); | ||
177 | let m = m.in_arg(("channel", "u")); | ||
178 | let m = m.in_arg(("xs", "au")); | ||
179 | let m = m.in_arg(("ys", "ad")); | ||
180 | let m = m.in_arg(("preamp", "d")); | ||
181 | let i = i.add_m(m); | ||
182 | |||
183 | let fclone = f.clone(); | ||
184 | let h = move |minfo: &tree::MethodInfo<tree::MTFn<D>, D>| { | ||
185 | let mut i = minfo.msg.iter_init(); | ||
186 | let channel: u32 = try!(i.read()); | ||
187 | let name: &str = try!(i.read()); | ||
188 | let d = fclone(minfo); | ||
189 | try!(d.save_profile(channel, name)); | ||
190 | let rm = minfo.msg.method_return(); | ||
191 | Ok(vec!(rm)) | ||
192 | }; | ||
193 | let m = factory.method("SaveProfile", Default::default(), h); | ||
194 | let m = m.in_arg(("channel", "u")); | ||
195 | let m = m.in_arg(("name", "s")); | ||
196 | let i = i.add_m(m); | ||
197 | |||
198 | let fclone = f.clone(); | ||
199 | let h = move |minfo: &tree::MethodInfo<tree::MTFn<D>, D>| { | ||
200 | let mut i = minfo.msg.iter_init(); | ||
201 | let channel: u32 = try!(i.read()); | ||
202 | let name: &str = try!(i.read()); | ||
203 | let d = fclone(minfo); | ||
204 | try!(d.load_profile(channel, name)); | ||
205 | let rm = minfo.msg.method_return(); | ||
206 | Ok(vec!(rm)) | ||
207 | }; | ||
208 | let m = factory.method("LoadProfile", Default::default(), h); | ||
209 | let m = m.in_arg(("channel", "u")); | ||
210 | let m = m.in_arg(("name", "s")); | ||
211 | let i = i.add_m(m); | ||
212 | |||
213 | let fclone = f.clone(); | ||
214 | let h = move |minfo: &tree::MethodInfo<tree::MTFn<D>, D>| { | ||
215 | let mut i = minfo.msg.iter_init(); | ||
216 | let channel: u32 = try!(i.read()); | ||
217 | let ys: Vec<f64> = try!(i.read()); | ||
218 | let preamp: f64 = try!(i.read()); | ||
219 | let d = fclone(minfo); | ||
220 | try!(d.set_filter(channel, ys, preamp)); | ||
221 | let rm = minfo.msg.method_return(); | ||
222 | Ok(vec!(rm)) | ||
223 | }; | ||
224 | let m = factory.method("SetFilter", Default::default(), h); | ||
225 | let m = m.in_arg(("channel", "u")); | ||
226 | let m = m.in_arg(("ys", "ad")); | ||
227 | let m = m.in_arg(("preamp", "d")); | ||
228 | let i = i.add_m(m); | ||
229 | |||
230 | let fclone = f.clone(); | ||
231 | let h = move |minfo: &tree::MethodInfo<tree::MTFn<D>, D>| { | ||
232 | let mut i = minfo.msg.iter_init(); | ||
233 | let channel: u32 = try!(i.read()); | ||
234 | let d = fclone(minfo); | ||
235 | let (ys, preamp) = try!(d.get_filter(channel)); | ||
236 | let rm = minfo.msg.method_return(); | ||
237 | let rm = rm.append1(ys); | ||
238 | let rm = rm.append1(preamp); | ||
239 | Ok(vec!(rm)) | ||
240 | }; | ||
241 | let m = factory.method("GetFilter", Default::default(), h); | ||
242 | let m = m.in_arg(("channel", "u")); | ||
243 | let m = m.out_arg(("ys", "ad")); | ||
244 | let m = m.out_arg(("preamp", "d")); | ||
245 | let i = i.add_m(m); | ||
246 | |||
247 | let fclone = f.clone(); | ||
248 | let h = move |minfo: &tree::MethodInfo<tree::MTFn<D>, D>| { | ||
249 | let d = fclone(minfo); | ||
250 | try!(d.save_state()); | ||
251 | let rm = minfo.msg.method_return(); | ||
252 | Ok(vec!(rm)) | ||
253 | }; | ||
254 | let m = factory.method("SaveState", Default::default(), h); | ||
255 | let i = i.add_m(m); | ||
256 | |||
257 | let fclone = f.clone(); | ||
258 | let h = move |minfo: &tree::MethodInfo<tree::MTFn<D>, D>| { | ||
259 | let mut i = minfo.msg.iter_init(); | ||
260 | let channel: u32 = try!(i.read()); | ||
261 | let d = fclone(minfo); | ||
262 | let name = try!(d.base_profile(channel)); | ||
263 | let rm = minfo.msg.method_return(); | ||
264 | let rm = rm.append1(name); | ||
265 | Ok(vec!(rm)) | ||
266 | }; | ||
267 | let m = factory.method("BaseProfile", Default::default(), h); | ||
268 | let m = m.in_arg(("channel", "u")); | ||
269 | let m = m.out_arg(("name", "s")); | ||
270 | let i = i.add_m(m); | ||
271 | |||
272 | let p = factory.property::<u32, _>("InterfaceRevision", Default::default()); | ||
273 | let p = p.access(tree::Access::Read); | ||
274 | let fclone = f.clone(); | ||
275 | let p = p.on_get(move |a, pinfo| { | ||
276 | let minfo = pinfo.to_method_info(); | ||
277 | let d = fclone(&minfo); | ||
278 | a.append(try!(d.get_interface_revision())); | ||
279 | Ok(()) | ||
280 | }); | ||
281 | let i = i.add_p(p); | ||
282 | |||
283 | let p = factory.property::<u32, _>("SampleRate", Default::default()); | ||
284 | let p = p.access(tree::Access::Read); | ||
285 | let fclone = f.clone(); | ||
286 | let p = p.on_get(move |a, pinfo| { | ||
287 | let minfo = pinfo.to_method_info(); | ||
288 | let d = fclone(&minfo); | ||
289 | a.append(try!(d.get_sample_rate())); | ||
290 | Ok(()) | ||
291 | }); | ||
292 | let i = i.add_p(p); | ||
293 | |||
294 | let p = factory.property::<u32, _>("FilterSampleRate", Default::default()); | ||
295 | let p = p.access(tree::Access::Read); | ||
296 | let fclone = f.clone(); | ||
297 | let p = p.on_get(move |a, pinfo| { | ||
298 | let minfo = pinfo.to_method_info(); | ||
299 | let d = fclone(&minfo); | ||
300 | a.append(try!(d.get_filter_sample_rate())); | ||
301 | Ok(()) | ||
302 | }); | ||
303 | let i = i.add_p(p); | ||
304 | |||
305 | let p = factory.property::<u32, _>("NFilterCoefficients", Default::default()); | ||
306 | let p = p.access(tree::Access::Read); | ||
307 | let fclone = f.clone(); | ||
308 | let p = p.on_get(move |a, pinfo| { | ||
309 | let minfo = pinfo.to_method_info(); | ||
310 | let d = fclone(&minfo); | ||
311 | a.append(try!(d.get_nfilter_coefficients())); | ||
312 | Ok(()) | ||
313 | }); | ||
314 | let i = i.add_p(p); | ||
315 | |||
316 | let p = factory.property::<u32, _>("NChannels", Default::default()); | ||
317 | let p = p.access(tree::Access::Read); | ||
318 | let fclone = f.clone(); | ||
319 | let p = p.on_get(move |a, pinfo| { | ||
320 | let minfo = pinfo.to_method_info(); | ||
321 | let d = fclone(&minfo); | ||
322 | a.append(try!(d.get_nchannels())); | ||
323 | Ok(()) | ||
324 | }); | ||
325 | let i = i.add_p(p); | ||
326 | i | ||
327 | } | ||
328 | |||
329 | #[derive(Debug, Default)] | ||
330 | pub struct OrgPulseAudioExtEqualizing1EqualizerFilterChanged { | ||
331 | } | ||
332 | |||
333 | impl dbus::SignalArgs for OrgPulseAudioExtEqualizing1EqualizerFilterChanged { | ||
334 | const NAME: &'static str = "FilterChanged"; | ||
335 | const INTERFACE: &'static str = "org.PulseAudio.Ext.Equalizing1.Equalizer"; | ||
336 | fn append(&self, _: &mut arg::IterAppend) { | ||
337 | } | ||
338 | fn get(&mut self, _: &mut arg::Iter) -> Result<(), arg::TypeMismatchError> { | ||
339 | Ok(()) | ||
340 | } | ||
341 | } | ||
342 | |||
343 | #[derive(Debug, Default)] | ||
344 | pub struct OrgPulseAudioExtEqualizing1EqualizerSinkReconfigured { | ||
345 | } | ||
346 | |||
347 | impl dbus::SignalArgs for OrgPulseAudioExtEqualizing1EqualizerSinkReconfigured { | ||
348 | const NAME: &'static str = "SinkReconfigured"; | ||
349 | const INTERFACE: &'static str = "org.PulseAudio.Ext.Equalizing1.Equalizer"; | ||
350 | fn append(&self, _: &mut arg::IterAppend) { | ||
351 | } | ||
352 | fn get(&mut self, _: &mut arg::Iter) -> Result<(), arg::TypeMismatchError> { | ||
353 | Ok(()) | ||
354 | } | ||
355 | } | ||
356 | |||
357 | pub trait OrgPulseAudioCore1Device { | ||
358 | type Err; | ||
359 | fn suspend(&self, suspend: bool) -> Result<(), Self::Err>; | ||
360 | fn get_port_by_name(&self, name: &str) -> Result<dbus::Path<'static>, Self::Err>; | ||
361 | fn get_index(&self) -> Result<u32, Self::Err>; | ||
362 | fn get_name(&self) -> Result<String, Self::Err>; | ||
363 | fn get_driver(&self) -> Result<String, Self::Err>; | ||
364 | fn get_owner_module(&self) -> Result<dbus::Path<'static>, Self::Err>; | ||
365 | fn get_card(&self) -> Result<dbus::Path<'static>, Self::Err>; | ||
366 | fn get_sample_format(&self) -> Result<u32, Self::Err>; | ||
367 | fn get_sample_rate(&self) -> Result<u32, Self::Err>; | ||
368 | fn get_channels(&self) -> Result<Vec<u32>, Self::Err>; | ||
369 | fn get_volume(&self) -> Result<Vec<u32>, Self::Err>; | ||
370 | fn set_volume(&self, value: Vec<u32>) -> Result<(), Self::Err>; | ||
371 | fn get_has_flat_volume(&self) -> Result<bool, Self::Err>; | ||
372 | fn get_has_convertible_to_decibel_volume(&self) -> Result<bool, Self::Err>; | ||
373 | fn get_base_volume(&self) -> Result<u32, Self::Err>; | ||
374 | fn get_volume_steps(&self) -> Result<u32, Self::Err>; | ||
375 | fn get_mute(&self) -> Result<bool, Self::Err>; | ||
376 | fn set_mute(&self, value: bool) -> Result<(), Self::Err>; | ||
377 | fn get_has_hardware_volume(&self) -> Result<bool, Self::Err>; | ||
378 | fn get_has_hardware_mute(&self) -> Result<bool, Self::Err>; | ||
379 | fn get_configured_latency(&self) -> Result<u64, Self::Err>; | ||
380 | fn get_has_dynamic_latency(&self) -> Result<bool, Self::Err>; | ||
381 | fn get_latency(&self) -> Result<u64, Self::Err>; | ||
382 | fn get_is_hardware_device(&self) -> Result<bool, Self::Err>; | ||
383 | fn get_is_network_device(&self) -> Result<bool, Self::Err>; | ||
384 | fn get_state(&self) -> Result<u32, Self::Err>; | ||
385 | fn get_ports(&self) -> Result<Vec<dbus::Path<'static>>, Self::Err>; | ||
386 | fn get_active_port(&self) -> Result<dbus::Path<'static>, Self::Err>; | ||
387 | fn set_active_port(&self, value: dbus::Path<'static>) -> Result<(), Self::Err>; | ||
388 | fn get_property_list(&self) -> Result<::std::collections::HashMap<String, Vec<u8>>, Self::Err>; | ||
389 | } | ||
390 | |||
391 | impl<'a, C: ::std::ops::Deref<Target=dbus::Connection>> OrgPulseAudioCore1Device for dbus::ConnPath<'a, C> { | ||
392 | type Err = dbus::Error; | ||
393 | |||
394 | fn suspend(&self, suspend: bool) -> Result<(), Self::Err> { | ||
395 | let mut m = try!(self.method_call_with_args(&"org.PulseAudio.Core1.Device".into(), &"Suspend".into(), |msg| { | ||
396 | let mut i = arg::IterAppend::new(msg); | ||
397 | i.append(suspend); | ||
398 | })); | ||
399 | try!(m.as_result()); | ||
400 | Ok(()) | ||
401 | } | ||
402 | |||
403 | fn get_port_by_name(&self, name: &str) -> Result<dbus::Path<'static>, Self::Err> { | ||
404 | let mut m = try!(self.method_call_with_args(&"org.PulseAudio.Core1.Device".into(), &"GetPortByName".into(), |msg| { | ||
405 | let mut i = arg::IterAppend::new(msg); | ||
406 | i.append(name); | ||
407 | })); | ||
408 | try!(m.as_result()); | ||
409 | let mut i = m.iter_init(); | ||
410 | let port: dbus::Path<'static> = try!(i.read()); | ||
411 | Ok(port) | ||
412 | } | ||
413 | |||
414 | fn get_index(&self) -> Result<u32, Self::Err> { | ||
415 | <Self as dbus::stdintf::org_freedesktop_dbus::Properties>::get(&self, "org.PulseAudio.Core1.Device", "Index") | ||
416 | } | ||
417 | |||
418 | fn get_name(&self) -> Result<String, Self::Err> { | ||
419 | <Self as dbus::stdintf::org_freedesktop_dbus::Properties>::get(&self, "org.PulseAudio.Core1.Device", "Name") | ||
420 | } | ||
421 | |||
422 | fn get_driver(&self) -> Result<String, Self::Err> { | ||
423 | <Self as dbus::stdintf::org_freedesktop_dbus::Properties>::get(&self, "org.PulseAudio.Core1.Device", "Driver") | ||
424 | } | ||
425 | |||
426 | fn get_owner_module(&self) -> Result<dbus::Path<'static>, Self::Err> { | ||
427 | <Self as dbus::stdintf::org_freedesktop_dbus::Properties>::get(&self, "org.PulseAudio.Core1.Device", "OwnerModule") | ||
428 | } | ||
429 | |||
430 | fn get_card(&self) -> Result<dbus::Path<'static>, Self::Err> { | ||
431 | <Self as dbus::stdintf::org_freedesktop_dbus::Properties>::get(&self, "org.PulseAudio.Core1.Device", "Card") | ||
432 | } | ||
433 | |||
434 | fn get_sample_format(&self) -> Result<u32, Self::Err> { | ||
435 | <Self as dbus::stdintf::org_freedesktop_dbus::Properties>::get(&self, "org.PulseAudio.Core1.Device", "SampleFormat") | ||
436 | } | ||
437 | |||
438 | fn get_sample_rate(&self) -> Result<u32, Self::Err> { | ||
439 | <Self as dbus::stdintf::org_freedesktop_dbus::Properties>::get(&self, "org.PulseAudio.Core1.Device", "SampleRate") | ||
440 | } | ||
441 | |||
442 | fn get_channels(&self) -> Result<Vec<u32>, Self::Err> { | ||
443 | <Self as dbus::stdintf::org_freedesktop_dbus::Properties>::get(&self, "org.PulseAudio.Core1.Device", "Channels") | ||
444 | } | ||
445 | |||
446 | fn get_volume(&self) -> Result<Vec<u32>, Self::Err> { | ||
447 | <Self as dbus::stdintf::org_freedesktop_dbus::Properties>::get(&self, "org.PulseAudio.Core1.Device", "Volume") | ||
448 | } | ||
449 | |||
450 | fn get_has_flat_volume(&self) -> Result<bool, Self::Err> { | ||
451 | <Self as dbus::stdintf::org_freedesktop_dbus::Properties>::get(&self, "org.PulseAudio.Core1.Device", "HasFlatVolume") | ||
452 | } | ||
453 | |||
454 | fn get_has_convertible_to_decibel_volume(&self) -> Result<bool, Self::Err> { | ||
455 | <Self as dbus::stdintf::org_freedesktop_dbus::Properties>::get(&self, "org.PulseAudio.Core1.Device", "HasConvertibleToDecibelVolume") | ||
456 | } | ||
457 | |||
458 | fn get_base_volume(&self) -> Result<u32, Self::Err> { | ||
459 | <Self as dbus::stdintf::org_freedesktop_dbus::Properties>::get(&self, "org.PulseAudio.Core1.Device", "BaseVolume") | ||
460 | } | ||
461 | |||
462 | fn get_volume_steps(&self) -> Result<u32, Self::Err> { | ||
463 | <Self as dbus::stdintf::org_freedesktop_dbus::Properties>::get(&self, "org.PulseAudio.Core1.Device", "VolumeSteps") | ||
464 | } | ||
465 | |||
466 | fn get_mute(&self) -> Result<bool, Self::Err> { | ||
467 | <Self as dbus::stdintf::org_freedesktop_dbus::Properties>::get(&self, "org.PulseAudio.Core1.Device", "Mute") | ||
468 | } | ||
469 | |||
470 | fn get_has_hardware_volume(&self) -> Result<bool, Self::Err> { | ||
471 | <Self as dbus::stdintf::org_freedesktop_dbus::Properties>::get(&self, "org.PulseAudio.Core1.Device", "HasHardwareVolume") | ||
472 | } | ||
473 | |||
474 | fn get_has_hardware_mute(&self) -> Result<bool, Self::Err> { | ||
475 | <Self as dbus::stdintf::org_freedesktop_dbus::Properties>::get(&self, "org.PulseAudio.Core1.Device", "HasHardwareMute") | ||
476 | } | ||
477 | |||
478 | fn get_configured_latency(&self) -> Result<u64, Self::Err> { | ||
479 | <Self as dbus::stdintf::org_freedesktop_dbus::Properties>::get(&self, "org.PulseAudio.Core1.Device", "ConfiguredLatency") | ||
480 | } | ||
481 | |||
482 | fn get_has_dynamic_latency(&self) -> Result<bool, Self::Err> { | ||
483 | <Self as dbus::stdintf::org_freedesktop_dbus::Properties>::get(&self, "org.PulseAudio.Core1.Device", "HasDynamicLatency") | ||
484 | } | ||
485 | |||
486 | fn get_latency(&self) -> Result<u64, Self::Err> { | ||
487 | <Self as dbus::stdintf::org_freedesktop_dbus::Properties>::get(&self, "org.PulseAudio.Core1.Device", "Latency") | ||
488 | } | ||
489 | |||
490 | fn get_is_hardware_device(&self) -> Result<bool, Self::Err> { | ||
491 | <Self as dbus::stdintf::org_freedesktop_dbus::Properties>::get(&self, "org.PulseAudio.Core1.Device", "IsHardwareDevice") | ||
492 | } | ||
493 | |||
494 | fn get_is_network_device(&self) -> Result<bool, Self::Err> { | ||
495 | <Self as dbus::stdintf::org_freedesktop_dbus::Properties>::get(&self, "org.PulseAudio.Core1.Device", "IsNetworkDevice") | ||
496 | } | ||
497 | |||
498 | fn get_state(&self) -> Result<u32, Self::Err> { | ||
499 | <Self as dbus::stdintf::org_freedesktop_dbus::Properties>::get(&self, "org.PulseAudio.Core1.Device", "State") | ||
500 | } | ||
501 | |||
502 | fn get_ports(&self) -> Result<Vec<dbus::Path<'static>>, Self::Err> { | ||
503 | <Self as dbus::stdintf::org_freedesktop_dbus::Properties>::get(&self, "org.PulseAudio.Core1.Device", "Ports") | ||
504 | } | ||
505 | |||
506 | fn get_active_port(&self) -> Result<dbus::Path<'static>, Self::Err> { | ||
507 | <Self as dbus::stdintf::org_freedesktop_dbus::Properties>::get(&self, "org.PulseAudio.Core1.Device", "ActivePort") | ||
508 | } | ||
509 | |||
510 | fn get_property_list(&self) -> Result<::std::collections::HashMap<String, Vec<u8>>, Self::Err> { | ||
511 | <Self as dbus::stdintf::org_freedesktop_dbus::Properties>::get(&self, "org.PulseAudio.Core1.Device", "PropertyList") | ||
512 | } | ||
513 | |||
514 | fn set_volume(&self, value: Vec<u32>) -> Result<(), Self::Err> { | ||
515 | <Self as dbus::stdintf::org_freedesktop_dbus::Properties>::set(&self, "org.PulseAudio.Core1.Device", "Volume", value) | ||
516 | } | ||
517 | |||
518 | fn set_mute(&self, value: bool) -> Result<(), Self::Err> { | ||
519 | <Self as dbus::stdintf::org_freedesktop_dbus::Properties>::set(&self, "org.PulseAudio.Core1.Device", "Mute", value) | ||
520 | } | ||
521 | |||
522 | fn set_active_port(&self, value: dbus::Path<'static>) -> Result<(), Self::Err> { | ||
523 | <Self as dbus::stdintf::org_freedesktop_dbus::Properties>::set(&self, "org.PulseAudio.Core1.Device", "ActivePort", value) | ||
524 | } | ||
525 | } | ||
526 | |||
527 | pub fn org_pulse_audio_core1_device_server<F, T, D>(factory: &tree::Factory<tree::MTFn<D>, D>, data: D::Interface, f: F) -> tree::Interface<tree::MTFn<D>, D> | ||
528 | where | ||
529 | D: tree::DataType, | ||
530 | D::Method: Default, | ||
531 | D::Property: Default, | ||
532 | T: OrgPulseAudioCore1Device<Err=tree::MethodErr>, | ||
533 | F: 'static + for <'z> Fn(& 'z tree::MethodInfo<tree::MTFn<D>, D>) -> & 'z T, | ||
534 | { | ||
535 | let i = factory.interface("org.PulseAudio.Core1.Device", data); | ||
536 | let f = ::std::sync::Arc::new(f); | ||
537 | let fclone = f.clone(); | ||
538 | let h = move |minfo: &tree::MethodInfo<tree::MTFn<D>, D>| { | ||
539 | let mut i = minfo.msg.iter_init(); | ||
540 | let suspend: bool = try!(i.read()); | ||
541 | let d = fclone(minfo); | ||
542 | try!(d.suspend(suspend)); | ||
543 | let rm = minfo.msg.method_return(); | ||
544 | Ok(vec!(rm)) | ||
545 | }; | ||
546 | let m = factory.method("Suspend", Default::default(), h); | ||
547 | let m = m.in_arg(("suspend", "b")); | ||
548 | let i = i.add_m(m); | ||
549 | |||
550 | let fclone = f.clone(); | ||
551 | let h = move |minfo: &tree::MethodInfo<tree::MTFn<D>, D>| { | ||
552 | let mut i = minfo.msg.iter_init(); | ||
553 | let name: &str = try!(i.read()); | ||
554 | let d = fclone(minfo); | ||
555 | let port = try!(d.get_port_by_name(name)); | ||
556 | let rm = minfo.msg.method_return(); | ||
557 | let rm = rm.append1(port); | ||
558 | Ok(vec!(rm)) | ||
559 | }; | ||
560 | let m = factory.method("GetPortByName", Default::default(), h); | ||
561 | let m = m.in_arg(("name", "s")); | ||
562 | let m = m.out_arg(("port", "o")); | ||
563 | let i = i.add_m(m); | ||
564 | |||
565 | let p = factory.property::<u32, _>("Index", Default::default()); | ||
566 | let p = p.access(tree::Access::Read); | ||
567 | let fclone = f.clone(); | ||
568 | let p = p.on_get(move |a, pinfo| { | ||
569 | let minfo = pinfo.to_method_info(); | ||
570 | let d = fclone(&minfo); | ||
571 | a.append(try!(d.get_index())); | ||
572 | Ok(()) | ||
573 | }); | ||
574 | let i = i.add_p(p); | ||
575 | |||
576 | let p = factory.property::<&str, _>("Name", Default::default()); | ||
577 | let p = p.access(tree::Access::Read); | ||
578 | let fclone = f.clone(); | ||
579 | let p = p.on_get(move |a, pinfo| { | ||
580 | let minfo = pinfo.to_method_info(); | ||
581 | let d = fclone(&minfo); | ||
582 | a.append(try!(d.get_name())); | ||
583 | Ok(()) | ||
584 | }); | ||
585 | let i = i.add_p(p); | ||
586 | |||
587 | let p = factory.property::<&str, _>("Driver", Default::default()); | ||
588 | let p = p.access(tree::Access::Read); | ||
589 | let fclone = f.clone(); | ||
590 | let p = p.on_get(move |a, pinfo| { | ||
591 | let minfo = pinfo.to_method_info(); | ||
592 | let d = fclone(&minfo); | ||
593 | a.append(try!(d.get_driver())); | ||
594 | Ok(()) | ||
595 | }); | ||
596 | let i = i.add_p(p); | ||
597 | |||
598 | let p = factory.property::<dbus::Path, _>("OwnerModule", Default::default()); | ||
599 | let p = p.access(tree::Access::Read); | ||
600 | let fclone = f.clone(); | ||
601 | let p = p.on_get(move |a, pinfo| { | ||
602 | let minfo = pinfo.to_method_info(); | ||
603 | let d = fclone(&minfo); | ||
604 | a.append(try!(d.get_owner_module())); | ||
605 | Ok(()) | ||
606 | }); | ||
607 | let i = i.add_p(p); | ||
608 | |||
609 | let p = factory.property::<dbus::Path, _>("Card", Default::default()); | ||
610 | let p = p.access(tree::Access::Read); | ||
611 | let fclone = f.clone(); | ||
612 | let p = p.on_get(move |a, pinfo| { | ||
613 | let minfo = pinfo.to_method_info(); | ||
614 | let d = fclone(&minfo); | ||
615 | a.append(try!(d.get_card())); | ||
616 | Ok(()) | ||
617 | }); | ||
618 | let i = i.add_p(p); | ||
619 | |||
620 | let p = factory.property::<u32, _>("SampleFormat", Default::default()); | ||
621 | let p = p.access(tree::Access::Read); | ||
622 | let fclone = f.clone(); | ||
623 | let p = p.on_get(move |a, pinfo| { | ||
624 | let minfo = pinfo.to_method_info(); | ||
625 | let d = fclone(&minfo); | ||
626 | a.append(try!(d.get_sample_format())); | ||
627 | Ok(()) | ||
628 | }); | ||
629 | let i = i.add_p(p); | ||
630 | |||
631 | let p = factory.property::<u32, _>("SampleRate", Default::default()); | ||
632 | let p = p.access(tree::Access::Read); | ||
633 | let fclone = f.clone(); | ||
634 | let p = p.on_get(move |a, pinfo| { | ||
635 | let minfo = pinfo.to_method_info(); | ||
636 | let d = fclone(&minfo); | ||
637 | a.append(try!(d.get_sample_rate())); | ||
638 | Ok(()) | ||
639 | }); | ||
640 | let i = i.add_p(p); | ||
641 | |||
642 | let p = factory.property::<Vec<u32>, _>("Channels", Default::default()); | ||
643 | let p = p.access(tree::Access::Read); | ||
644 | let fclone = f.clone(); | ||
645 | let p = p.on_get(move |a, pinfo| { | ||
646 | let minfo = pinfo.to_method_info(); | ||
647 | let d = fclone(&minfo); | ||
648 | a.append(try!(d.get_channels())); | ||
649 | Ok(()) | ||
650 | }); | ||
651 | let i = i.add_p(p); | ||
652 | |||
653 | let p = factory.property::<Vec<u32>, _>("Volume", Default::default()); | ||
654 | let p = p.access(tree::Access::ReadWrite); | ||
655 | let fclone = f.clone(); | ||
656 | let p = p.on_get(move |a, pinfo| { | ||
657 | let minfo = pinfo.to_method_info(); | ||
658 | let d = fclone(&minfo); | ||
659 | a.append(try!(d.get_volume())); | ||
660 | Ok(()) | ||
661 | }); | ||
662 | let fclone = f.clone(); | ||
663 | let p = p.on_set(move |iter, pinfo| { | ||
664 | let minfo = pinfo.to_method_info(); | ||
665 | let d = fclone(&minfo); | ||
666 | try!(d.set_volume(try!(iter.read()))); | ||
667 | Ok(()) | ||
668 | }); | ||
669 | let i = i.add_p(p); | ||
670 | |||
671 | let p = factory.property::<bool, _>("HasFlatVolume", Default::default()); | ||
672 | let p = p.access(tree::Access::Read); | ||
673 | let fclone = f.clone(); | ||
674 | let p = p.on_get(move |a, pinfo| { | ||
675 | let minfo = pinfo.to_method_info(); | ||
676 | let d = fclone(&minfo); | ||
677 | a.append(try!(d.get_has_flat_volume())); | ||
678 | Ok(()) | ||
679 | }); | ||
680 | let i = i.add_p(p); | ||
681 | |||
682 | let p = factory.property::<bool, _>("HasConvertibleToDecibelVolume", Default::default()); | ||
683 | let p = p.access(tree::Access::Read); | ||
684 | let fclone = f.clone(); | ||
685 | let p = p.on_get(move |a, pinfo| { | ||
686 | let minfo = pinfo.to_method_info(); | ||
687 | let d = fclone(&minfo); | ||
688 | a.append(try!(d.get_has_convertible_to_decibel_volume())); | ||
689 | Ok(()) | ||
690 | }); | ||
691 | let i = i.add_p(p); | ||
692 | |||
693 | let p = factory.property::<u32, _>("BaseVolume", Default::default()); | ||
694 | let p = p.access(tree::Access::Read); | ||
695 | let fclone = f.clone(); | ||
696 | let p = p.on_get(move |a, pinfo| { | ||
697 | let minfo = pinfo.to_method_info(); | ||
698 | let d = fclone(&minfo); | ||
699 | a.append(try!(d.get_base_volume())); | ||
700 | Ok(()) | ||
701 | }); | ||
702 | let i = i.add_p(p); | ||
703 | |||
704 | let p = factory.property::<u32, _>("VolumeSteps", Default::default()); | ||
705 | let p = p.access(tree::Access::Read); | ||
706 | let fclone = f.clone(); | ||
707 | let p = p.on_get(move |a, pinfo| { | ||
708 | let minfo = pinfo.to_method_info(); | ||
709 | let d = fclone(&minfo); | ||
710 | a.append(try!(d.get_volume_steps())); | ||
711 | Ok(()) | ||
712 | }); | ||
713 | let i = i.add_p(p); | ||
714 | |||
715 | let p = factory.property::<bool, _>("Mute", Default::default()); | ||
716 | let p = p.access(tree::Access::ReadWrite); | ||
717 | let fclone = f.clone(); | ||
718 | let p = p.on_get(move |a, pinfo| { | ||
719 | let minfo = pinfo.to_method_info(); | ||
720 | let d = fclone(&minfo); | ||
721 | a.append(try!(d.get_mute())); | ||
722 | Ok(()) | ||
723 | }); | ||
724 | let fclone = f.clone(); | ||
725 | let p = p.on_set(move |iter, pinfo| { | ||
726 | let minfo = pinfo.to_method_info(); | ||
727 | let d = fclone(&minfo); | ||
728 | try!(d.set_mute(try!(iter.read()))); | ||
729 | Ok(()) | ||
730 | }); | ||
731 | let i = i.add_p(p); | ||
732 | |||
733 | let p = factory.property::<bool, _>("HasHardwareVolume", Default::default()); | ||
734 | let p = p.access(tree::Access::Read); | ||
735 | let fclone = f.clone(); | ||
736 | let p = p.on_get(move |a, pinfo| { | ||
737 | let minfo = pinfo.to_method_info(); | ||
738 | let d = fclone(&minfo); | ||
739 | a.append(try!(d.get_has_hardware_volume())); | ||
740 | Ok(()) | ||
741 | }); | ||
742 | let i = i.add_p(p); | ||
743 | |||
744 | let p = factory.property::<bool, _>("HasHardwareMute", Default::default()); | ||
745 | let p = p.access(tree::Access::Read); | ||
746 | let fclone = f.clone(); | ||
747 | let p = p.on_get(move |a, pinfo| { | ||
748 | let minfo = pinfo.to_method_info(); | ||
749 | let d = fclone(&minfo); | ||
750 | a.append(try!(d.get_has_hardware_mute())); | ||
751 | Ok(()) | ||
752 | }); | ||
753 | let i = i.add_p(p); | ||
754 | |||
755 | let p = factory.property::<u64, _>("ConfiguredLatency", Default::default()); | ||
756 | let p = p.access(tree::Access::Read); | ||
757 | let fclone = f.clone(); | ||
758 | let p = p.on_get(move |a, pinfo| { | ||
759 | let minfo = pinfo.to_method_info(); | ||
760 | let d = fclone(&minfo); | ||
761 | a.append(try!(d.get_configured_latency())); | ||
762 | Ok(()) | ||
763 | }); | ||
764 | let i = i.add_p(p); | ||
765 | |||
766 | let p = factory.property::<bool, _>("HasDynamicLatency", Default::default()); | ||
767 | let p = p.access(tree::Access::Read); | ||
768 | let fclone = f.clone(); | ||
769 | let p = p.on_get(move |a, pinfo| { | ||
770 | let minfo = pinfo.to_method_info(); | ||
771 | let d = fclone(&minfo); | ||
772 | a.append(try!(d.get_has_dynamic_latency())); | ||
773 | Ok(()) | ||
774 | }); | ||
775 | let i = i.add_p(p); | ||
776 | |||
777 | let p = factory.property::<u64, _>("Latency", Default::default()); | ||
778 | let p = p.access(tree::Access::Read); | ||
779 | let fclone = f.clone(); | ||
780 | let p = p.on_get(move |a, pinfo| { | ||
781 | let minfo = pinfo.to_method_info(); | ||
782 | let d = fclone(&minfo); | ||
783 | a.append(try!(d.get_latency())); | ||
784 | Ok(()) | ||
785 | }); | ||
786 | let i = i.add_p(p); | ||
787 | |||
788 | let p = factory.property::<bool, _>("IsHardwareDevice", Default::default()); | ||
789 | let p = p.access(tree::Access::Read); | ||
790 | let fclone = f.clone(); | ||
791 | let p = p.on_get(move |a, pinfo| { | ||
792 | let minfo = pinfo.to_method_info(); | ||
793 | let d = fclone(&minfo); | ||
794 | a.append(try!(d.get_is_hardware_device())); | ||
795 | Ok(()) | ||
796 | }); | ||
797 | let i = i.add_p(p); | ||
798 | |||
799 | let p = factory.property::<bool, _>("IsNetworkDevice", Default::default()); | ||
800 | let p = p.access(tree::Access::Read); | ||
801 | let fclone = f.clone(); | ||
802 | let p = p.on_get(move |a, pinfo| { | ||
803 | let minfo = pinfo.to_method_info(); | ||
804 | let d = fclone(&minfo); | ||
805 | a.append(try!(d.get_is_network_device())); | ||
806 | Ok(()) | ||
807 | }); | ||
808 | let i = i.add_p(p); | ||
809 | |||
810 | let p = factory.property::<u32, _>("State", Default::default()); | ||
811 | let p = p.access(tree::Access::Read); | ||
812 | let fclone = f.clone(); | ||
813 | let p = p.on_get(move |a, pinfo| { | ||
814 | let minfo = pinfo.to_method_info(); | ||
815 | let d = fclone(&minfo); | ||
816 | a.append(try!(d.get_state())); | ||
817 | Ok(()) | ||
818 | }); | ||
819 | let i = i.add_p(p); | ||
820 | |||
821 | let p = factory.property::<Vec<dbus::Path>, _>("Ports", Default::default()); | ||
822 | let p = p.access(tree::Access::Read); | ||
823 | let fclone = f.clone(); | ||
824 | let p = p.on_get(move |a, pinfo| { | ||
825 | let minfo = pinfo.to_method_info(); | ||
826 | let d = fclone(&minfo); | ||
827 | a.append(try!(d.get_ports())); | ||
828 | Ok(()) | ||
829 | }); | ||
830 | let i = i.add_p(p); | ||
831 | |||
832 | let p = factory.property::<dbus::Path, _>("ActivePort", Default::default()); | ||
833 | let p = p.access(tree::Access::ReadWrite); | ||
834 | let fclone = f.clone(); | ||
835 | let p = p.on_get(move |a, pinfo| { | ||
836 | let minfo = pinfo.to_method_info(); | ||
837 | let d = fclone(&minfo); | ||
838 | a.append(try!(d.get_active_port())); | ||
839 | Ok(()) | ||
840 | }); | ||
841 | let fclone = f.clone(); | ||
842 | let p = p.on_set(move |iter, pinfo| { | ||
843 | let minfo = pinfo.to_method_info(); | ||
844 | let d = fclone(&minfo); | ||
845 | try!(d.set_active_port(try!(iter.read()))); | ||
846 | Ok(()) | ||
847 | }); | ||
848 | let i = i.add_p(p); | ||
849 | |||
850 | let p = factory.property::<::std::collections::HashMap<&str, Vec<u8>>, _>("PropertyList", Default::default()); | ||
851 | let p = p.access(tree::Access::Read); | ||
852 | let fclone = f.clone(); | ||
853 | let p = p.on_get(move |a, pinfo| { | ||
854 | let minfo = pinfo.to_method_info(); | ||
855 | let d = fclone(&minfo); | ||
856 | a.append(try!(d.get_property_list())); | ||
857 | Ok(()) | ||
858 | }); | ||
859 | let i = i.add_p(p); | ||
860 | i | ||
861 | } | ||
862 | |||
863 | #[derive(Debug, Default)] | ||
864 | pub struct OrgPulseAudioCore1DeviceVolumeUpdated { | ||
865 | pub volume: Vec<u32>, | ||
866 | } | ||
867 | |||
868 | impl dbus::SignalArgs for OrgPulseAudioCore1DeviceVolumeUpdated { | ||
869 | const NAME: &'static str = "VolumeUpdated"; | ||
870 | const INTERFACE: &'static str = "org.PulseAudio.Core1.Device"; | ||
871 | fn append(&self, i: &mut arg::IterAppend) { | ||
872 | (&self.volume as &arg::RefArg).append(i); | ||
873 | } | ||
874 | fn get(&mut self, i: &mut arg::Iter) -> Result<(), arg::TypeMismatchError> { | ||
875 | self.volume = try!(i.read()); | ||
876 | Ok(()) | ||
877 | } | ||
878 | } | ||
879 | |||
880 | #[derive(Debug, Default)] | ||
881 | pub struct OrgPulseAudioCore1DeviceMuteUpdated { | ||
882 | pub muted: bool, | ||
883 | } | ||
884 | |||
885 | impl dbus::SignalArgs for OrgPulseAudioCore1DeviceMuteUpdated { | ||
886 | const NAME: &'static str = "MuteUpdated"; | ||
887 | const INTERFACE: &'static str = "org.PulseAudio.Core1.Device"; | ||
888 | fn append(&self, i: &mut arg::IterAppend) { | ||
889 | (&self.muted as &arg::RefArg).append(i); | ||
890 | } | ||
891 | fn get(&mut self, i: &mut arg::Iter) -> Result<(), arg::TypeMismatchError> { | ||
892 | self.muted = try!(i.read()); | ||
893 | Ok(()) | ||
894 | } | ||
895 | } | ||
896 | |||
897 | #[derive(Debug, Default)] | ||
898 | pub struct OrgPulseAudioCore1DeviceStateUpdated { | ||
899 | pub state: u32, | ||
900 | } | ||
901 | |||
902 | impl dbus::SignalArgs for OrgPulseAudioCore1DeviceStateUpdated { | ||
903 | const NAME: &'static str = "StateUpdated"; | ||
904 | const INTERFACE: &'static str = "org.PulseAudio.Core1.Device"; | ||
905 | fn append(&self, i: &mut arg::IterAppend) { | ||
906 | (&self.state as &arg::RefArg).append(i); | ||
907 | } | ||
908 | fn get(&mut self, i: &mut arg::Iter) -> Result<(), arg::TypeMismatchError> { | ||
909 | self.state = try!(i.read()); | ||
910 | Ok(()) | ||
911 | } | ||
912 | } | ||
913 | |||
914 | #[derive(Debug, Default)] | ||
915 | pub struct OrgPulseAudioCore1DeviceActivePortUpdated { | ||
916 | pub port: dbus::Path<'static>, | ||
917 | } | ||
918 | |||
919 | impl dbus::SignalArgs for OrgPulseAudioCore1DeviceActivePortUpdated { | ||
920 | const NAME: &'static str = "ActivePortUpdated"; | ||
921 | const INTERFACE: &'static str = "org.PulseAudio.Core1.Device"; | ||
922 | fn append(&self, i: &mut arg::IterAppend) { | ||
923 | (&self.port as &arg::RefArg).append(i); | ||
924 | } | ||
925 | fn get(&mut self, i: &mut arg::Iter) -> Result<(), arg::TypeMismatchError> { | ||
926 | self.port = try!(i.read()); | ||
927 | Ok(()) | ||
928 | } | ||
929 | } | ||
930 | |||
931 | #[derive(Debug, Default)] | ||
932 | pub struct OrgPulseAudioCore1DevicePropertyListUpdated { | ||
933 | pub property_list: ::std::collections::HashMap<String, Vec<u8>>, | ||
934 | } | ||
935 | |||
936 | impl dbus::SignalArgs for OrgPulseAudioCore1DevicePropertyListUpdated { | ||
937 | const NAME: &'static str = "PropertyListUpdated"; | ||
938 | const INTERFACE: &'static str = "org.PulseAudio.Core1.Device"; | ||
939 | fn append(&self, i: &mut arg::IterAppend) { | ||
940 | (&self.property_list as &arg::RefArg).append(i); | ||
941 | } | ||
942 | fn get(&mut self, i: &mut arg::Iter) -> Result<(), arg::TypeMismatchError> { | ||
943 | self.property_list = try!(i.read()); | ||
944 | Ok(()) | ||
945 | } | ||
946 | } | ||
947 | |||
948 | pub trait OrgPulseAudioCore1Sink { | ||
949 | type Err; | ||
950 | fn get_monitor_source(&self) -> Result<dbus::Path<'static>, Self::Err>; | ||
951 | } | ||
952 | |||
953 | impl<'a, C: ::std::ops::Deref<Target=dbus::Connection>> OrgPulseAudioCore1Sink for dbus::ConnPath<'a, C> { | ||
954 | type Err = dbus::Error; | ||
955 | |||
956 | fn get_monitor_source(&self) -> Result<dbus::Path<'static>, Self::Err> { | ||
957 | <Self as dbus::stdintf::org_freedesktop_dbus::Properties>::get(&self, "org.PulseAudio.Core1.Sink", "MonitorSource") | ||
958 | } | ||
959 | } | ||
960 | |||
961 | pub fn org_pulse_audio_core1_sink_server<F, T, D>(factory: &tree::Factory<tree::MTFn<D>, D>, data: D::Interface, f: F) -> tree::Interface<tree::MTFn<D>, D> | ||
962 | where | ||
963 | D: tree::DataType, | ||
964 | D::Method: Default, | ||
965 | D::Property: Default, | ||
966 | T: OrgPulseAudioCore1Sink<Err=tree::MethodErr>, | ||
967 | F: 'static + for <'z> Fn(& 'z tree::MethodInfo<tree::MTFn<D>, D>) -> & 'z T, | ||
968 | { | ||
969 | let i = factory.interface("org.PulseAudio.Core1.Sink", data); | ||
970 | let f = ::std::sync::Arc::new(f); | ||
971 | let p = factory.property::<dbus::Path, _>("MonitorSource", Default::default()); | ||
972 | let p = p.access(tree::Access::Read); | ||
973 | let fclone = f.clone(); | ||
974 | let p = p.on_get(move |a, pinfo| { | ||
975 | let minfo = pinfo.to_method_info(); | ||
976 | let d = fclone(&minfo); | ||
977 | a.append(try!(d.get_monitor_source())); | ||
978 | Ok(()) | ||
979 | }); | ||
980 | let i = i.add_p(p); | ||
981 | i | ||
982 | } | ||
983 | |||
984 | pub trait OrgFreedesktopDBusIntrospectable { | ||
985 | type Err; | ||
986 | fn introspect(&self) -> Result<String, Self::Err>; | ||
987 | } | ||
988 | |||
989 | impl<'a, C: ::std::ops::Deref<Target=dbus::Connection>> OrgFreedesktopDBusIntrospectable for dbus::ConnPath<'a, C> { | ||
990 | type Err = dbus::Error; | ||
991 | |||
992 | fn introspect(&self) -> Result<String, Self::Err> { | ||
993 | let mut m = try!(self.method_call_with_args(&"org.freedesktop.DBus.Introspectable".into(), &"Introspect".into(), |_| { | ||
994 | })); | ||
995 | try!(m.as_result()); | ||
996 | let mut i = m.iter_init(); | ||
997 | let data: String = try!(i.read()); | ||
998 | Ok(data) | ||
999 | } | ||
1000 | } | ||
1001 | |||
1002 | pub fn org_freedesktop_dbus_introspectable_server<F, T, D>(factory: &tree::Factory<tree::MTFn<D>, D>, data: D::Interface, f: F) -> tree::Interface<tree::MTFn<D>, D> | ||
1003 | where | ||
1004 | D: tree::DataType, | ||
1005 | D::Method: Default, | ||
1006 | T: OrgFreedesktopDBusIntrospectable<Err=tree::MethodErr>, | ||
1007 | F: 'static + for <'z> Fn(& 'z tree::MethodInfo<tree::MTFn<D>, D>) -> & 'z T, | ||
1008 | { | ||
1009 | let i = factory.interface("org.freedesktop.DBus.Introspectable", data); | ||
1010 | let f = ::std::sync::Arc::new(f); | ||
1011 | let fclone = f.clone(); | ||
1012 | let h = move |minfo: &tree::MethodInfo<tree::MTFn<D>, D>| { | ||
1013 | let d = fclone(minfo); | ||
1014 | let data = try!(d.introspect()); | ||
1015 | let rm = minfo.msg.method_return(); | ||
1016 | let rm = rm.append1(data); | ||
1017 | Ok(vec!(rm)) | ||
1018 | }; | ||
1019 | let m = factory.method("Introspect", Default::default(), h); | ||
1020 | let m = m.out_arg(("data", "s")); | ||
1021 | let i = i.add_m(m); | ||
1022 | i | ||
1023 | } | ||
1024 | |||
1025 | pub trait OrgFreedesktopDBusProperties { | ||
1026 | type Err; | ||
1027 | fn get(&self, interface_name: &str, property_name: &str) -> Result<arg::Variant<Box<arg::RefArg>>, Self::Err>; | ||
1028 | fn set(&self, interface_name: &str, property_name: &str, value: arg::Variant<Box<arg::RefArg>>) -> Result<(), Self::Err>; | ||
1029 | fn get_all(&self, interface_name: &str) -> Result<::std::collections::HashMap<String, arg::Variant<Box<arg::RefArg>>>, Self::Err>; | ||
1030 | } | ||
1031 | |||
1032 | impl<'a, C: ::std::ops::Deref<Target=dbus::Connection>> OrgFreedesktopDBusProperties for dbus::ConnPath<'a, C> { | ||
1033 | type Err = dbus::Error; | ||
1034 | |||
1035 | fn get(&self, interface_name: &str, property_name: &str) -> Result<arg::Variant<Box<arg::RefArg>>, Self::Err> { | ||
1036 | let mut m = try!(self.method_call_with_args(&"org.freedesktop.DBus.Properties".into(), &"Get".into(), |msg| { | ||
1037 | let mut i = arg::IterAppend::new(msg); | ||
1038 | i.append(interface_name); | ||
1039 | i.append(property_name); | ||
1040 | })); | ||
1041 | try!(m.as_result()); | ||
1042 | let mut i = m.iter_init(); | ||
1043 | let value: arg::Variant<Box<arg::RefArg>> = try!(i.read()); | ||
1044 | Ok(value) | ||
1045 | } | ||
1046 | |||
1047 | fn set(&self, interface_name: &str, property_name: &str, value: arg::Variant<Box<arg::RefArg>>) -> Result<(), Self::Err> { | ||
1048 | let mut m = try!(self.method_call_with_args(&"org.freedesktop.DBus.Properties".into(), &"Set".into(), |msg| { | ||
1049 | let mut i = arg::IterAppend::new(msg); | ||
1050 | i.append(interface_name); | ||
1051 | i.append(property_name); | ||
1052 | i.append(value); | ||
1053 | })); | ||
1054 | try!(m.as_result()); | ||
1055 | Ok(()) | ||
1056 | } | ||
1057 | |||
1058 | fn get_all(&self, interface_name: &str) -> Result<::std::collections::HashMap<String, arg::Variant<Box<arg::RefArg>>>, Self::Err> { | ||
1059 | let mut m = try!(self.method_call_with_args(&"org.freedesktop.DBus.Properties".into(), &"GetAll".into(), |msg| { | ||
1060 | let mut i = arg::IterAppend::new(msg); | ||
1061 | i.append(interface_name); | ||
1062 | })); | ||
1063 | try!(m.as_result()); | ||
1064 | let mut i = m.iter_init(); | ||
1065 | let props: ::std::collections::HashMap<String, arg::Variant<Box<arg::RefArg>>> = try!(i.read()); | ||
1066 | Ok(props) | ||
1067 | } | ||
1068 | } | ||
1069 | |||
1070 | pub fn org_freedesktop_dbus_properties_server<F, T, D>(factory: &tree::Factory<tree::MTFn<D>, D>, data: D::Interface, f: F) -> tree::Interface<tree::MTFn<D>, D> | ||
1071 | where | ||
1072 | D: tree::DataType, | ||
1073 | D::Method: Default, | ||
1074 | T: OrgFreedesktopDBusProperties<Err=tree::MethodErr>, | ||
1075 | F: 'static + for <'z> Fn(& 'z tree::MethodInfo<tree::MTFn<D>, D>) -> & 'z T, | ||
1076 | { | ||
1077 | let i = factory.interface("org.freedesktop.DBus.Properties", data); | ||
1078 | let f = ::std::sync::Arc::new(f); | ||
1079 | let fclone = f.clone(); | ||
1080 | let h = move |minfo: &tree::MethodInfo<tree::MTFn<D>, D>| { | ||
1081 | let mut i = minfo.msg.iter_init(); | ||
1082 | let interface_name: &str = try!(i.read()); | ||
1083 | let property_name: &str = try!(i.read()); | ||
1084 | let d = fclone(minfo); | ||
1085 | let value = try!(d.get(interface_name, property_name)); | ||
1086 | let rm = minfo.msg.method_return(); | ||
1087 | let rm = rm.append1(value); | ||
1088 | Ok(vec!(rm)) | ||
1089 | }; | ||
1090 | let m = factory.method("Get", Default::default(), h); | ||
1091 | let m = m.in_arg(("interface_name", "s")); | ||
1092 | let m = m.in_arg(("property_name", "s")); | ||
1093 | let m = m.out_arg(("value", "v")); | ||
1094 | let i = i.add_m(m); | ||
1095 | |||
1096 | let fclone = f.clone(); | ||
1097 | let h = move |minfo: &tree::MethodInfo<tree::MTFn<D>, D>| { | ||
1098 | let mut i = minfo.msg.iter_init(); | ||
1099 | let interface_name: &str = try!(i.read()); | ||
1100 | let property_name: &str = try!(i.read()); | ||
1101 | let value: arg::Variant<Box<arg::RefArg>> = try!(i.read()); | ||
1102 | let d = fclone(minfo); | ||
1103 | try!(d.set(interface_name, property_name, value)); | ||
1104 | let rm = minfo.msg.method_return(); | ||
1105 | Ok(vec!(rm)) | ||
1106 | }; | ||
1107 | let m = factory.method("Set", Default::default(), h); | ||
1108 | let m = m.in_arg(("interface_name", "s")); | ||
1109 | let m = m.in_arg(("property_name", "s")); | ||
1110 | let m = m.in_arg(("value", "v")); | ||
1111 | let i = i.add_m(m); | ||
1112 | |||
1113 | let fclone = f.clone(); | ||
1114 | let h = move |minfo: &tree::MethodInfo<tree::MTFn<D>, D>| { | ||
1115 | let mut i = minfo.msg.iter_init(); | ||
1116 | let interface_name: &str = try!(i.read()); | ||
1117 | let d = fclone(minfo); | ||
1118 | let props = try!(d.get_all(interface_name)); | ||
1119 | let rm = minfo.msg.method_return(); | ||
1120 | let rm = rm.append1(props); | ||
1121 | Ok(vec!(rm)) | ||
1122 | }; | ||
1123 | let m = factory.method("GetAll", Default::default(), h); | ||
1124 | let m = m.in_arg(("interface_name", "s")); | ||
1125 | let m = m.out_arg(("props", "a{sv}")); | ||
1126 | let i = i.add_m(m); | ||
1127 | i | ||
1128 | } | ||
diff --git a/src/main.rs b/src/main.rs new file mode 100644 index 0000000..10c9434 --- /dev/null +++ b/src/main.rs | |||
@@ -0,0 +1,132 @@ | |||
1 | extern crate dbus; | ||
2 | |||
3 | #[macro_use] | ||
4 | extern crate log; | ||
5 | #[macro_use] | ||
6 | extern crate failure; | ||
7 | |||
8 | extern crate clap; | ||
9 | extern crate clap_log_flag; | ||
10 | extern crate clap_verbosity_flag; | ||
11 | extern crate structopt; | ||
12 | |||
13 | use structopt::StructOpt; | ||
14 | |||
15 | use failure::Error; | ||
16 | |||
17 | //use dbus::stdintf::org_freedesktop_dbus::Properties; | ||
18 | use dbus::Connection; | ||
19 | |||
20 | use dbus_api::sink::OrgPulseAudioExtEqualizing1Equalizer; | ||
21 | |||
22 | mod dbus_api; | ||
23 | mod parsing; | ||
24 | mod utils; | ||
25 | |||
26 | use utils::*; | ||
27 | |||
28 | #[derive(StructOpt, Debug)] | ||
29 | enum Command { | ||
30 | #[structopt(name = "load")] | ||
31 | Load(LoadCli), | ||
32 | #[structopt(name = "reset")] | ||
33 | Reset(ResetCli), | ||
34 | } | ||
35 | |||
36 | #[derive(StructOpt, Debug)] | ||
37 | struct LoadCli { | ||
38 | } | ||
39 | |||
40 | #[derive(StructOpt, Debug)] | ||
41 | struct ResetCli { | ||
42 | } | ||
43 | |||
44 | #[derive(StructOpt, Debug)] | ||
45 | struct Cli { | ||
46 | #[structopt(flatten)] | ||
47 | verbose: clap_verbosity_flag::Verbosity, | ||
48 | #[structopt(flatten)] | ||
49 | log: clap_log_flag::Log, | ||
50 | #[structopt(subcommand)] | ||
51 | cmd: Command, | ||
52 | } | ||
53 | |||
54 | #[derive(Fail, Debug)] | ||
55 | #[fail(display = "No equalized sink found")] | ||
56 | struct NoEqualizedSink; | ||
57 | |||
58 | #[derive(Debug)] | ||
59 | pub struct Filter { | ||
60 | preamp: f64, | ||
61 | frequencies: Vec<u32>, | ||
62 | coefficients: Vec<f64>, | ||
63 | } | ||
64 | |||
65 | impl Filter { | ||
66 | fn pad(self, filter_rate: u32) -> Self { | ||
67 | Filter { | ||
68 | preamp: self.preamp, | ||
69 | frequencies: vec![0u32] | ||
70 | .into_iter() | ||
71 | .chain(self.frequencies.into_iter()) | ||
72 | .chain(vec![filter_rate / 2u32]) | ||
73 | .collect(), | ||
74 | coefficients: vec![1f64] | ||
75 | .into_iter() | ||
76 | .chain(self.coefficients.into_iter()) | ||
77 | .chain(vec![1f64]) | ||
78 | .collect(), | ||
79 | } | ||
80 | } | ||
81 | } | ||
82 | |||
83 | fn main() -> Result<(), Error> { | ||
84 | let args = Cli::from_args(); | ||
85 | args.log.log_all(args.verbose.log_level())?; | ||
86 | |||
87 | use Command::*; | ||
88 | |||
89 | match args.cmd { | ||
90 | Load(args) => load(args), | ||
91 | Reset(args)=> reset(args), | ||
92 | } | ||
93 | } | ||
94 | |||
95 | fn reset(args: ResetCli) -> Result<(), Error> { | ||
96 | let conn = connect()?; | ||
97 | let conn_sink = get_equalized_sink(&conn)?; | ||
98 | let filter_rate = conn_sink.get_filter_sample_rate()?; | ||
99 | let filter = Filter { | ||
100 | preamp: 1f64, | ||
101 | frequencies: vec![], | ||
102 | coefficients: vec![], | ||
103 | }.pad(filter_rate); | ||
104 | |||
105 | send_filter(&conn_sink, filter)?; | ||
106 | |||
107 | Ok(()) | ||
108 | } | ||
109 | |||
110 | fn load(args: LoadCli) -> Result<(), Error> { | ||
111 | let conn = connect()?; | ||
112 | let conn_sink = get_equalized_sink(&conn)?; | ||
113 | let filter = read_filter()?; | ||
114 | let filter_rate = conn_sink.get_filter_sample_rate()?; | ||
115 | send_filter(&conn_sink, filter.pad(filter_rate))?; | ||
116 | |||
117 | Ok(()) | ||
118 | } | ||
119 | |||
120 | /* | ||
121 | fn introspect(conn: &dbus::ConnPath<&Connection>) { | ||
122 | let mut thing = conn | ||
123 | .method_call_with_args( | ||
124 | &"org.freedesktop.DBus.Introspectable".into(), | ||
125 | &"Introspect".into(), | ||
126 | |_| {}, | ||
127 | ).unwrap(); | ||
128 | thing.as_result().unwrap(); | ||
129 | |||
130 | println!("{}", thing.iter_init().read::<String>().unwrap()); | ||
131 | } | ||
132 | */ | ||
diff --git a/src/parsing/equalizer_apo.lalrpop b/src/parsing/equalizer_apo.lalrpop new file mode 100644 index 0000000..b1faad9 --- /dev/null +++ b/src/parsing/equalizer_apo.lalrpop | |||
@@ -0,0 +1,42 @@ | |||
1 | use ::Filter; | ||
2 | |||
3 | use std::str::FromStr; | ||
4 | |||
5 | grammar; | ||
6 | |||
7 | pub Main: Filter = { | ||
8 | <preamp: Preamp> <eq: Eq> => { | ||
9 | let coefficients: Vec<_> = eq.1.iter().map(|decibel| 10f64.powf(decibel / 10f64)).collect(); | ||
10 | // TODO: add decibel_to_ratio conversion function | ||
11 | let preamp = 10f64.powf(preamp / 10f64); | ||
12 | Filter { preamp, frequencies: eq.0, coefficients } | ||
13 | } | ||
14 | } | ||
15 | |||
16 | Preamp: f64 = { | ||
17 | "Preamp:" <Decibel> | ||
18 | } | ||
19 | |||
20 | Eq: (Vec<u32>, Vec<f64>) = { | ||
21 | "GraphicEQ:" <values:(<(Integer Float)> ";")+> <end:(Integer Float)> => { | ||
22 | let mut values = values; | ||
23 | values.push(end); | ||
24 | values.into_iter().unzip() | ||
25 | } | ||
26 | } | ||
27 | |||
28 | Decibel: f64 = { | ||
29 | <Float> "dB" | ||
30 | } | ||
31 | |||
32 | Float: f64 = { | ||
33 | <RawFloat>, | ||
34 | <SignedInteger> => <> as f64, | ||
35 | <Integer> => <> as f64, | ||
36 | } | ||
37 | |||
38 | RawFloat: f64 = r"-?[0-9]*\.[0-9]+" => f64::from_str(<>).unwrap(); | ||
39 | SignedInteger: i32 = r"-[0-9]+" => i32::from_str(<>).unwrap(); | ||
40 | Integer: u32 = r"[0-9]+"=> u32::from_str(<>).unwrap(); | ||
41 | |||
42 | // vim: ft=rust | ||
diff --git a/src/parsing/equalizer_apo.rs b/src/parsing/equalizer_apo.rs new file mode 100644 index 0000000..3fab396 --- /dev/null +++ b/src/parsing/equalizer_apo.rs | |||
@@ -0,0 +1,1164 @@ | |||
1 | // auto-generated: "lalrpop 0.15.2" | ||
2 | // sha256: 81b6fa5856d7887b20715c2c7f6137db1927ece087e2db9f4bf1fcd8943365c5 | ||
3 | use ::Filter; | ||
4 | use std::str::FromStr; | ||
5 | #[allow(unused_extern_crates)] | ||
6 | extern crate lalrpop_util as __lalrpop_util; | ||
7 | |||
8 | #[cfg_attr(rustfmt, rustfmt_skip)] | ||
9 | mod __parse__Main { | ||
10 | #![allow(non_snake_case, non_camel_case_types, unused_mut, unused_variables, unused_imports, unused_parens)] | ||
11 | |||
12 | use ::Filter; | ||
13 | use std::str::FromStr; | ||
14 | #[allow(unused_extern_crates)] | ||
15 | extern crate lalrpop_util as __lalrpop_util; | ||
16 | use super::__intern_token::Token; | ||
17 | #[allow(dead_code)] | ||
18 | pub enum __Symbol<'input> | ||
19 | { | ||
20 | Variant0(&'input str), | ||
21 | Variant1((u32, f64)), | ||
22 | Variant2(::std::vec::Vec<(u32, f64)>), | ||
23 | Variant3(f64), | ||
24 | Variant4((Vec<u32>, Vec<f64>)), | ||
25 | Variant5(u32), | ||
26 | Variant6(Filter), | ||
27 | Variant7(i32), | ||
28 | } | ||
29 | const __ACTION: &'static [i8] = &[ | ||
30 | // State 0 | ||
31 | 0, 0, 4, 0, 0, 0, 0, | ||
32 | // State 1 | ||
33 | 0, 0, 0, 0, 0, 0, 0, | ||
34 | // State 2 | ||
35 | 0, 6, 0, 0, 0, 0, 0, | ||
36 | // State 3 | ||
37 | 0, 0, 0, 0, 12, 13, 14, | ||
38 | // State 4 | ||
39 | 0, 0, 0, 0, 0, 0, 0, | ||
40 | // State 5 | ||
41 | 0, 0, 0, 0, 0, 0, 14, | ||
42 | // State 6 | ||
43 | 0, -12, 0, 0, 0, 0, 0, | ||
44 | // State 7 | ||
45 | 0, 0, 0, 17, 0, 0, 0, | ||
46 | // State 8 | ||
47 | -9, 0, 0, -9, 0, 0, 0, | ||
48 | // State 9 | ||
49 | -7, 0, 0, -7, 0, 0, 0, | ||
50 | // State 10 | ||
51 | -8, 0, 0, -8, 0, 0, 0, | ||
52 | // State 11 | ||
53 | -13, 0, 0, -13, 0, 0, 0, | ||
54 | // State 12 | ||
55 | -14, 0, 0, -14, 0, 0, 0, | ||
56 | // State 13 | ||
57 | -10, 0, 0, -10, -10, -10, -10, | ||
58 | // State 14 | ||
59 | 0, 0, 0, 0, 0, 0, 14, | ||
60 | // State 15 | ||
61 | 0, 0, 0, 0, 12, 13, 14, | ||
62 | // State 16 | ||
63 | 0, -5, 0, 0, 0, 0, 0, | ||
64 | // State 17 | ||
65 | 0, 0, 0, 0, 12, 13, 14, | ||
66 | // State 18 | ||
67 | 21, 0, 0, 0, 0, 0, 0, | ||
68 | // State 19 | ||
69 | 22, 0, 0, 0, 0, 0, 0, | ||
70 | // State 20 | ||
71 | 0, 0, 0, 0, 0, 0, -2, | ||
72 | // State 21 | ||
73 | 0, 0, 0, 0, 0, 0, -3, | ||
74 | ]; | ||
75 | const __EOF_ACTION: &'static [i8] = &[ | ||
76 | // State 0 | ||
77 | 0, | ||
78 | // State 1 | ||
79 | -15, | ||
80 | // State 2 | ||
81 | 0, | ||
82 | // State 3 | ||
83 | 0, | ||
84 | // State 4 | ||
85 | -11, | ||
86 | // State 5 | ||
87 | 0, | ||
88 | // State 6 | ||
89 | 0, | ||
90 | // State 7 | ||
91 | 0, | ||
92 | // State 8 | ||
93 | -9, | ||
94 | // State 9 | ||
95 | -7, | ||
96 | // State 10 | ||
97 | -8, | ||
98 | // State 11 | ||
99 | -13, | ||
100 | // State 12 | ||
101 | -14, | ||
102 | // State 13 | ||
103 | -10, | ||
104 | // State 14 | ||
105 | 0, | ||
106 | // State 15 | ||
107 | 0, | ||
108 | // State 16 | ||
109 | 0, | ||
110 | // State 17 | ||
111 | 0, | ||
112 | // State 18 | ||
113 | 0, | ||
114 | // State 19 | ||
115 | -6, | ||
116 | // State 20 | ||
117 | 0, | ||
118 | // State 21 | ||
119 | 0, | ||
120 | ]; | ||
121 | const __GOTO: &'static [i8] = &[ | ||
122 | // State 0 | ||
123 | 0, 0, 0, 0, 0, 0, 0, 2, 3, 0, 0, 0, | ||
124 | // State 1 | ||
125 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, | ||
126 | // State 2 | ||
127 | 0, 0, 0, 0, 5, 0, 0, 0, 0, 0, 0, 0, | ||
128 | // State 3 | ||
129 | 0, 0, 0, 7, 0, 8, 9, 0, 0, 10, 11, 0, | ||
130 | // State 4 | ||
131 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, | ||
132 | // State 5 | ||
133 | 0, 15, 0, 0, 0, 0, 16, 0, 0, 0, 0, 0, | ||
134 | // State 6 | ||
135 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, | ||
136 | // State 7 | ||
137 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, | ||
138 | // State 8 | ||
139 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, | ||
140 | // State 9 | ||
141 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, | ||
142 | // State 10 | ||
143 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, | ||
144 | // State 11 | ||
145 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, | ||
146 | // State 12 | ||
147 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, | ||
148 | // State 13 | ||
149 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, | ||
150 | // State 14 | ||
151 | 0, 0, 0, 0, 0, 0, 18, 0, 0, 0, 0, 0, | ||
152 | // State 15 | ||
153 | 0, 0, 0, 0, 0, 19, 9, 0, 0, 10, 11, 0, | ||
154 | // State 16 | ||
155 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, | ||
156 | // State 17 | ||
157 | 0, 0, 0, 0, 0, 20, 9, 0, 0, 10, 11, 0, | ||
158 | // State 18 | ||
159 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, | ||
160 | // State 19 | ||
161 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, | ||
162 | // State 20 | ||
163 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, | ||
164 | // State 21 | ||
165 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, | ||
166 | ]; | ||
167 | fn __expected_tokens(__state: usize) -> Vec<::std::string::String> { | ||
168 | const __TERMINAL: &'static [&'static str] = &[ | ||
169 | r###"";""###, | ||
170 | r###""GraphicEQ:""###, | ||
171 | r###""Preamp:""###, | ||
172 | r###""dB""###, | ||
173 | r###"r#"-?[0-9]*\\.[0-9]+"#"###, | ||
174 | r###"r#"-[0-9]+"#"###, | ||
175 | r###"r#"[0-9]+"#"###, | ||
176 | ]; | ||
177 | __ACTION[(__state * 7)..].iter().zip(__TERMINAL).filter_map(|(&state, terminal)| { | ||
178 | if state == 0 { | ||
179 | None | ||
180 | } else { | ||
181 | Some(terminal.to_string()) | ||
182 | } | ||
183 | }).collect() | ||
184 | } | ||
185 | pub struct MainParser { | ||
186 | builder: super::__intern_token::__MatcherBuilder, | ||
187 | _priv: (), | ||
188 | } | ||
189 | |||
190 | impl MainParser { | ||
191 | pub fn new() -> MainParser { | ||
192 | let __builder = super::__intern_token::__MatcherBuilder::new(); | ||
193 | MainParser { | ||
194 | builder: __builder, | ||
195 | _priv: (), | ||
196 | } | ||
197 | } | ||
198 | |||
199 | #[allow(dead_code)] | ||
200 | pub fn parse< | ||
201 | 'input, | ||
202 | >( | ||
203 | &self, | ||
204 | input: &'input str, | ||
205 | ) -> Result<Filter, __lalrpop_util::ParseError<usize, Token<'input>, &'static str>> | ||
206 | { | ||
207 | let mut __tokens = self.builder.matcher(input); | ||
208 | let mut __states = vec![0_i8]; | ||
209 | let mut __symbols = vec![]; | ||
210 | let mut __integer; | ||
211 | let mut __lookahead; | ||
212 | let __last_location = &mut Default::default(); | ||
213 | '__shift: loop { | ||
214 | __lookahead = match __tokens.next() { | ||
215 | Some(Ok(v)) => v, | ||
216 | None => break '__shift, | ||
217 | Some(Err(e)) => return Err(e), | ||
218 | }; | ||
219 | *__last_location = __lookahead.2.clone(); | ||
220 | __integer = match __lookahead.1 { | ||
221 | Token(3, _) if true => 0, | ||
222 | Token(4, _) if true => 1, | ||
223 | Token(5, _) if true => 2, | ||
224 | Token(6, _) if true => 3, | ||
225 | Token(0, _) if true => 4, | ||
226 | Token(1, _) if true => 5, | ||
227 | Token(2, _) if true => 6, | ||
228 | _ => { | ||
229 | let __state = *__states.last().unwrap() as usize; | ||
230 | let __error = __lalrpop_util::ParseError::UnrecognizedToken { | ||
231 | token: Some(__lookahead), | ||
232 | expected: __expected_tokens(__state), | ||
233 | }; | ||
234 | return Err(__error); | ||
235 | } | ||
236 | }; | ||
237 | '__inner: loop { | ||
238 | let __state = *__states.last().unwrap() as usize; | ||
239 | let __action = __ACTION[__state * 7 + __integer]; | ||
240 | if __action > 0 { | ||
241 | let __symbol = match __integer { | ||
242 | 0 => match __lookahead.1 { | ||
243 | Token(3, __tok0) => __Symbol::Variant0((__tok0)), | ||
244 | _ => unreachable!(), | ||
245 | }, | ||
246 | 1 => match __lookahead.1 { | ||
247 | Token(4, __tok0) => __Symbol::Variant0((__tok0)), | ||
248 | _ => unreachable!(), | ||
249 | }, | ||
250 | 2 => match __lookahead.1 { | ||
251 | Token(5, __tok0) => __Symbol::Variant0((__tok0)), | ||
252 | _ => unreachable!(), | ||
253 | }, | ||
254 | 3 => match __lookahead.1 { | ||
255 | Token(6, __tok0) => __Symbol::Variant0((__tok0)), | ||
256 | _ => unreachable!(), | ||
257 | }, | ||
258 | 4 => match __lookahead.1 { | ||
259 | Token(0, __tok0) => __Symbol::Variant0((__tok0)), | ||
260 | _ => unreachable!(), | ||
261 | }, | ||
262 | 5 => match __lookahead.1 { | ||
263 | Token(1, __tok0) => __Symbol::Variant0((__tok0)), | ||
264 | _ => unreachable!(), | ||
265 | }, | ||
266 | 6 => match __lookahead.1 { | ||
267 | Token(2, __tok0) => __Symbol::Variant0((__tok0)), | ||
268 | _ => unreachable!(), | ||
269 | }, | ||
270 | _ => unreachable!(), | ||
271 | }; | ||
272 | __states.push(__action - 1); | ||
273 | __symbols.push((__lookahead.0, __symbol, __lookahead.2)); | ||
274 | continue '__shift; | ||
275 | } else if __action < 0 { | ||
276 | if let Some(r) = __reduce(input, __action, Some(&__lookahead.0), &mut __states, &mut __symbols, ::std::marker::PhantomData::<()>) { | ||
277 | if r.is_err() { | ||
278 | return r; | ||
279 | } | ||
280 | return Err(__lalrpop_util::ParseError::ExtraToken { token: __lookahead }); | ||
281 | } | ||
282 | } else { | ||
283 | let mut __err_lookahead = Some(__lookahead); | ||
284 | let mut __err_integer: Option<usize> = Some(__integer); | ||
285 | let __state = *__states.last().unwrap() as usize; | ||
286 | let __error = __lalrpop_util::ParseError::UnrecognizedToken { | ||
287 | token: __err_lookahead, | ||
288 | expected: __expected_tokens(__state), | ||
289 | }; | ||
290 | return Err(__error) | ||
291 | } | ||
292 | } | ||
293 | } | ||
294 | loop { | ||
295 | let __state = *__states.last().unwrap() as usize; | ||
296 | let __action = __EOF_ACTION[__state]; | ||
297 | if __action < 0 { | ||
298 | if let Some(r) = __reduce(input, __action, None, &mut __states, &mut __symbols, ::std::marker::PhantomData::<()>) { | ||
299 | return r; | ||
300 | } | ||
301 | } else { | ||
302 | let mut __err_lookahead = None; | ||
303 | let mut __err_integer: Option<usize> = None; | ||
304 | let __state = *__states.last().unwrap() as usize; | ||
305 | let __error = __lalrpop_util::ParseError::UnrecognizedToken { | ||
306 | token: __err_lookahead, | ||
307 | expected: __expected_tokens(__state), | ||
308 | }; | ||
309 | return Err(__error) | ||
310 | } | ||
311 | } | ||
312 | } | ||
313 | } | ||
314 | pub(crate) fn __reduce< | ||
315 | 'input, | ||
316 | >( | ||
317 | input: &'input str, | ||
318 | __action: i8, | ||
319 | __lookahead_start: Option<&usize>, | ||
320 | __states: &mut ::std::vec::Vec<i8>, | ||
321 | __symbols: &mut ::std::vec::Vec<(usize,__Symbol<'input>,usize)>, | ||
322 | _: ::std::marker::PhantomData<()>, | ||
323 | ) -> Option<Result<Filter,__lalrpop_util::ParseError<usize, Token<'input>, &'static str>>> | ||
324 | { | ||
325 | let (__pop_states, __symbol, __nonterminal) = match -__action { | ||
326 | 1 => { | ||
327 | __reduce1(input, __action, __lookahead_start, __states, __symbols, ::std::marker::PhantomData::<()>) | ||
328 | } | ||
329 | 2 => { | ||
330 | __reduce2(input, __action, __lookahead_start, __states, __symbols, ::std::marker::PhantomData::<()>) | ||
331 | } | ||
332 | 3 => { | ||
333 | __reduce3(input, __action, __lookahead_start, __states, __symbols, ::std::marker::PhantomData::<()>) | ||
334 | } | ||
335 | 4 => { | ||
336 | __reduce4(input, __action, __lookahead_start, __states, __symbols, ::std::marker::PhantomData::<()>) | ||
337 | } | ||
338 | 5 => { | ||
339 | __reduce5(input, __action, __lookahead_start, __states, __symbols, ::std::marker::PhantomData::<()>) | ||
340 | } | ||
341 | 6 => { | ||
342 | __reduce6(input, __action, __lookahead_start, __states, __symbols, ::std::marker::PhantomData::<()>) | ||
343 | } | ||
344 | 7 => { | ||
345 | __reduce7(input, __action, __lookahead_start, __states, __symbols, ::std::marker::PhantomData::<()>) | ||
346 | } | ||
347 | 8 => { | ||
348 | __reduce8(input, __action, __lookahead_start, __states, __symbols, ::std::marker::PhantomData::<()>) | ||
349 | } | ||
350 | 9 => { | ||
351 | __reduce9(input, __action, __lookahead_start, __states, __symbols, ::std::marker::PhantomData::<()>) | ||
352 | } | ||
353 | 10 => { | ||
354 | __reduce10(input, __action, __lookahead_start, __states, __symbols, ::std::marker::PhantomData::<()>) | ||
355 | } | ||
356 | 11 => { | ||
357 | __reduce11(input, __action, __lookahead_start, __states, __symbols, ::std::marker::PhantomData::<()>) | ||
358 | } | ||
359 | 12 => { | ||
360 | __reduce12(input, __action, __lookahead_start, __states, __symbols, ::std::marker::PhantomData::<()>) | ||
361 | } | ||
362 | 13 => { | ||
363 | __reduce13(input, __action, __lookahead_start, __states, __symbols, ::std::marker::PhantomData::<()>) | ||
364 | } | ||
365 | 14 => { | ||
366 | __reduce14(input, __action, __lookahead_start, __states, __symbols, ::std::marker::PhantomData::<()>) | ||
367 | } | ||
368 | 15 => { | ||
369 | // __Main = Main => ActionFn(0); | ||
370 | let __sym0 = __pop_Variant6(__symbols); | ||
371 | let __start = __sym0.0.clone(); | ||
372 | let __end = __sym0.2.clone(); | ||
373 | let __nt = super::__action0::<>(input, __sym0); | ||
374 | return Some(Ok(__nt)); | ||
375 | } | ||
376 | _ => panic!("invalid action code {}", __action) | ||
377 | }; | ||
378 | let __states_len = __states.len(); | ||
379 | __states.truncate(__states_len - __pop_states); | ||
380 | __symbols.push(__symbol); | ||
381 | let __state = *__states.last().unwrap() as usize; | ||
382 | let __next_state = __GOTO[__state * 12 + __nonterminal] - 1; | ||
383 | __states.push(__next_state); | ||
384 | None | ||
385 | } | ||
386 | fn __pop_Variant4< | ||
387 | 'input, | ||
388 | >( | ||
389 | __symbols: &mut ::std::vec::Vec<(usize,__Symbol<'input>,usize)> | ||
390 | ) -> (usize, (Vec<u32>, Vec<f64>), usize) | ||
391 | { | ||
392 | match __symbols.pop().unwrap() { | ||
393 | (__l, __Symbol::Variant4(__v), __r) => (__l, __v, __r), | ||
394 | _ => panic!("symbol type mismatch") | ||
395 | } | ||
396 | } | ||
397 | fn __pop_Variant1< | ||
398 | 'input, | ||
399 | >( | ||
400 | __symbols: &mut ::std::vec::Vec<(usize,__Symbol<'input>,usize)> | ||
401 | ) -> (usize, (u32, f64), usize) | ||
402 | { | ||
403 | match __symbols.pop().unwrap() { | ||
404 | (__l, __Symbol::Variant1(__v), __r) => (__l, __v, __r), | ||
405 | _ => panic!("symbol type mismatch") | ||
406 | } | ||
407 | } | ||
408 | fn __pop_Variant6< | ||
409 | 'input, | ||
410 | >( | ||
411 | __symbols: &mut ::std::vec::Vec<(usize,__Symbol<'input>,usize)> | ||
412 | ) -> (usize, Filter, usize) | ||
413 | { | ||
414 | match __symbols.pop().unwrap() { | ||
415 | (__l, __Symbol::Variant6(__v), __r) => (__l, __v, __r), | ||
416 | _ => panic!("symbol type mismatch") | ||
417 | } | ||
418 | } | ||
419 | fn __pop_Variant3< | ||
420 | 'input, | ||
421 | >( | ||
422 | __symbols: &mut ::std::vec::Vec<(usize,__Symbol<'input>,usize)> | ||
423 | ) -> (usize, f64, usize) | ||
424 | { | ||
425 | match __symbols.pop().unwrap() { | ||
426 | (__l, __Symbol::Variant3(__v), __r) => (__l, __v, __r), | ||
427 | _ => panic!("symbol type mismatch") | ||
428 | } | ||
429 | } | ||
430 | fn __pop_Variant7< | ||
431 | 'input, | ||
432 | >( | ||
433 | __symbols: &mut ::std::vec::Vec<(usize,__Symbol<'input>,usize)> | ||
434 | ) -> (usize, i32, usize) | ||
435 | { | ||
436 | match __symbols.pop().unwrap() { | ||
437 | (__l, __Symbol::Variant7(__v), __r) => (__l, __v, __r), | ||
438 | _ => panic!("symbol type mismatch") | ||
439 | } | ||
440 | } | ||
441 | fn __pop_Variant5< | ||
442 | 'input, | ||
443 | >( | ||
444 | __symbols: &mut ::std::vec::Vec<(usize,__Symbol<'input>,usize)> | ||
445 | ) -> (usize, u32, usize) | ||
446 | { | ||
447 | match __symbols.pop().unwrap() { | ||
448 | (__l, __Symbol::Variant5(__v), __r) => (__l, __v, __r), | ||
449 | _ => panic!("symbol type mismatch") | ||
450 | } | ||
451 | } | ||
452 | fn __pop_Variant2< | ||
453 | 'input, | ||
454 | >( | ||
455 | __symbols: &mut ::std::vec::Vec<(usize,__Symbol<'input>,usize)> | ||
456 | ) -> (usize, ::std::vec::Vec<(u32, f64)>, usize) | ||
457 | { | ||
458 | match __symbols.pop().unwrap() { | ||
459 | (__l, __Symbol::Variant2(__v), __r) => (__l, __v, __r), | ||
460 | _ => panic!("symbol type mismatch") | ||
461 | } | ||
462 | } | ||
463 | fn __pop_Variant0< | ||
464 | 'input, | ||
465 | >( | ||
466 | __symbols: &mut ::std::vec::Vec<(usize,__Symbol<'input>,usize)> | ||
467 | ) -> (usize, &'input str, usize) | ||
468 | { | ||
469 | match __symbols.pop().unwrap() { | ||
470 | (__l, __Symbol::Variant0(__v), __r) => (__l, __v, __r), | ||
471 | _ => panic!("symbol type mismatch") | ||
472 | } | ||
473 | } | ||
474 | pub(crate) fn __reduce1< | ||
475 | 'input, | ||
476 | >( | ||
477 | input: &'input str, | ||
478 | __action: i8, | ||
479 | __lookahead_start: Option<&usize>, | ||
480 | __states: &mut ::std::vec::Vec<i8>, | ||
481 | __symbols: &mut ::std::vec::Vec<(usize,__Symbol<'input>,usize)>, | ||
482 | _: ::std::marker::PhantomData<()>, | ||
483 | ) -> (usize, (usize,__Symbol<'input>,usize), usize) | ||
484 | { | ||
485 | // (<(Integer Float)> ";") = Integer, Float, ";" => ActionFn(15); | ||
486 | let __sym2 = __pop_Variant0(__symbols); | ||
487 | let __sym1 = __pop_Variant3(__symbols); | ||
488 | let __sym0 = __pop_Variant5(__symbols); | ||
489 | let __start = __sym0.0.clone(); | ||
490 | let __end = __sym2.2.clone(); | ||
491 | let __nt = super::__action15::<>(input, __sym0, __sym1, __sym2); | ||
492 | let __symbol = (__start, __Symbol::Variant1(__nt), __end); | ||
493 | (3, __symbol, 0) | ||
494 | } | ||
495 | pub(crate) fn __reduce2< | ||
496 | 'input, | ||
497 | >( | ||
498 | input: &'input str, | ||
499 | __action: i8, | ||
500 | __lookahead_start: Option<&usize>, | ||
501 | __states: &mut ::std::vec::Vec<i8>, | ||
502 | __symbols: &mut ::std::vec::Vec<(usize,__Symbol<'input>,usize)>, | ||
503 | _: ::std::marker::PhantomData<()>, | ||
504 | ) -> (usize, (usize,__Symbol<'input>,usize), usize) | ||
505 | { | ||
506 | // (<(Integer Float)> ";")+ = Integer, Float, ";" => ActionFn(17); | ||
507 | let __sym2 = __pop_Variant0(__symbols); | ||
508 | let __sym1 = __pop_Variant3(__symbols); | ||
509 | let __sym0 = __pop_Variant5(__symbols); | ||
510 | let __start = __sym0.0.clone(); | ||
511 | let __end = __sym2.2.clone(); | ||
512 | let __nt = super::__action17::<>(input, __sym0, __sym1, __sym2); | ||
513 | let __symbol = (__start, __Symbol::Variant2(__nt), __end); | ||
514 | (3, __symbol, 1) | ||
515 | } | ||
516 | pub(crate) fn __reduce3< | ||
517 | 'input, | ||
518 | >( | ||
519 | input: &'input str, | ||
520 | __action: i8, | ||
521 | __lookahead_start: Option<&usize>, | ||
522 | __states: &mut ::std::vec::Vec<i8>, | ||
523 | __symbols: &mut ::std::vec::Vec<(usize,__Symbol<'input>,usize)>, | ||
524 | _: ::std::marker::PhantomData<()>, | ||
525 | ) -> (usize, (usize,__Symbol<'input>,usize), usize) | ||
526 | { | ||
527 | // (<(Integer Float)> ";")+ = (<(Integer Float)> ";")+, Integer, Float, ";" => ActionFn(18); | ||
528 | let __sym3 = __pop_Variant0(__symbols); | ||
529 | let __sym2 = __pop_Variant3(__symbols); | ||
530 | let __sym1 = __pop_Variant5(__symbols); | ||
531 | let __sym0 = __pop_Variant2(__symbols); | ||
532 | let __start = __sym0.0.clone(); | ||
533 | let __end = __sym3.2.clone(); | ||
534 | let __nt = super::__action18::<>(input, __sym0, __sym1, __sym2, __sym3); | ||
535 | let __symbol = (__start, __Symbol::Variant2(__nt), __end); | ||
536 | (4, __symbol, 1) | ||
537 | } | ||
538 | pub(crate) fn __reduce4< | ||
539 | 'input, | ||
540 | >( | ||
541 | input: &'input str, | ||
542 | __action: i8, | ||
543 | __lookahead_start: Option<&usize>, | ||
544 | __states: &mut ::std::vec::Vec<i8>, | ||
545 | __symbols: &mut ::std::vec::Vec<(usize,__Symbol<'input>,usize)>, | ||
546 | _: ::std::marker::PhantomData<()>, | ||
547 | ) -> (usize, (usize,__Symbol<'input>,usize), usize) | ||
548 | { | ||
549 | // (Integer Float) = Integer, Float => ActionFn(14); | ||
550 | let __sym1 = __pop_Variant3(__symbols); | ||
551 | let __sym0 = __pop_Variant5(__symbols); | ||
552 | let __start = __sym0.0.clone(); | ||
553 | let __end = __sym1.2.clone(); | ||
554 | let __nt = super::__action14::<>(input, __sym0, __sym1); | ||
555 | let __symbol = (__start, __Symbol::Variant1(__nt), __end); | ||
556 | (2, __symbol, 2) | ||
557 | } | ||
558 | pub(crate) fn __reduce5< | ||
559 | 'input, | ||
560 | >( | ||
561 | input: &'input str, | ||
562 | __action: i8, | ||
563 | __lookahead_start: Option<&usize>, | ||
564 | __states: &mut ::std::vec::Vec<i8>, | ||
565 | __symbols: &mut ::std::vec::Vec<(usize,__Symbol<'input>,usize)>, | ||
566 | _: ::std::marker::PhantomData<()>, | ||
567 | ) -> (usize, (usize,__Symbol<'input>,usize), usize) | ||
568 | { | ||
569 | // Decibel = Float, "dB" => ActionFn(4); | ||
570 | let __sym1 = __pop_Variant0(__symbols); | ||
571 | let __sym0 = __pop_Variant3(__symbols); | ||
572 | let __start = __sym0.0.clone(); | ||
573 | let __end = __sym1.2.clone(); | ||
574 | let __nt = super::__action4::<>(input, __sym0, __sym1); | ||
575 | let __symbol = (__start, __Symbol::Variant3(__nt), __end); | ||
576 | (2, __symbol, 3) | ||
577 | } | ||
578 | pub(crate) fn __reduce6< | ||
579 | 'input, | ||
580 | >( | ||
581 | input: &'input str, | ||
582 | __action: i8, | ||
583 | __lookahead_start: Option<&usize>, | ||
584 | __states: &mut ::std::vec::Vec<i8>, | ||
585 | __symbols: &mut ::std::vec::Vec<(usize,__Symbol<'input>,usize)>, | ||
586 | _: ::std::marker::PhantomData<()>, | ||
587 | ) -> (usize, (usize,__Symbol<'input>,usize), usize) | ||
588 | { | ||
589 | // Eq = "GraphicEQ:", (<(Integer Float)> ";")+, Integer, Float => ActionFn(16); | ||
590 | let __sym3 = __pop_Variant3(__symbols); | ||
591 | let __sym2 = __pop_Variant5(__symbols); | ||
592 | let __sym1 = __pop_Variant2(__symbols); | ||
593 | let __sym0 = __pop_Variant0(__symbols); | ||
594 | let __start = __sym0.0.clone(); | ||
595 | let __end = __sym3.2.clone(); | ||
596 | let __nt = super::__action16::<>(input, __sym0, __sym1, __sym2, __sym3); | ||
597 | let __symbol = (__start, __Symbol::Variant4(__nt), __end); | ||
598 | (4, __symbol, 4) | ||
599 | } | ||
600 | pub(crate) fn __reduce7< | ||
601 | 'input, | ||
602 | >( | ||
603 | input: &'input str, | ||
604 | __action: i8, | ||
605 | __lookahead_start: Option<&usize>, | ||
606 | __states: &mut ::std::vec::Vec<i8>, | ||
607 | __symbols: &mut ::std::vec::Vec<(usize,__Symbol<'input>,usize)>, | ||
608 | _: ::std::marker::PhantomData<()>, | ||
609 | ) -> (usize, (usize,__Symbol<'input>,usize), usize) | ||
610 | { | ||
611 | // Float = RawFloat => ActionFn(5); | ||
612 | let __sym0 = __pop_Variant3(__symbols); | ||
613 | let __start = __sym0.0.clone(); | ||
614 | let __end = __sym0.2.clone(); | ||
615 | let __nt = super::__action5::<>(input, __sym0); | ||
616 | let __symbol = (__start, __Symbol::Variant3(__nt), __end); | ||
617 | (1, __symbol, 5) | ||
618 | } | ||
619 | pub(crate) fn __reduce8< | ||
620 | 'input, | ||
621 | >( | ||
622 | input: &'input str, | ||
623 | __action: i8, | ||
624 | __lookahead_start: Option<&usize>, | ||
625 | __states: &mut ::std::vec::Vec<i8>, | ||
626 | __symbols: &mut ::std::vec::Vec<(usize,__Symbol<'input>,usize)>, | ||
627 | _: ::std::marker::PhantomData<()>, | ||
628 | ) -> (usize, (usize,__Symbol<'input>,usize), usize) | ||
629 | { | ||
630 | // Float = SignedInteger => ActionFn(6); | ||
631 | let __sym0 = __pop_Variant7(__symbols); | ||
632 | let __start = __sym0.0.clone(); | ||
633 | let __end = __sym0.2.clone(); | ||
634 | let __nt = super::__action6::<>(input, __sym0); | ||
635 | let __symbol = (__start, __Symbol::Variant3(__nt), __end); | ||
636 | (1, __symbol, 5) | ||
637 | } | ||
638 | pub(crate) fn __reduce9< | ||
639 | 'input, | ||
640 | >( | ||
641 | input: &'input str, | ||
642 | __action: i8, | ||
643 | __lookahead_start: Option<&usize>, | ||
644 | __states: &mut ::std::vec::Vec<i8>, | ||
645 | __symbols: &mut ::std::vec::Vec<(usize,__Symbol<'input>,usize)>, | ||
646 | _: ::std::marker::PhantomData<()>, | ||
647 | ) -> (usize, (usize,__Symbol<'input>,usize), usize) | ||
648 | { | ||
649 | // Float = Integer => ActionFn(7); | ||
650 | let __sym0 = __pop_Variant5(__symbols); | ||
651 | let __start = __sym0.0.clone(); | ||
652 | let __end = __sym0.2.clone(); | ||
653 | let __nt = super::__action7::<>(input, __sym0); | ||
654 | let __symbol = (__start, __Symbol::Variant3(__nt), __end); | ||
655 | (1, __symbol, 5) | ||
656 | } | ||
657 | pub(crate) fn __reduce10< | ||
658 | 'input, | ||
659 | >( | ||
660 | input: &'input str, | ||
661 | __action: i8, | ||
662 | __lookahead_start: Option<&usize>, | ||
663 | __states: &mut ::std::vec::Vec<i8>, | ||
664 | __symbols: &mut ::std::vec::Vec<(usize,__Symbol<'input>,usize)>, | ||
665 | _: ::std::marker::PhantomData<()>, | ||
666 | ) -> (usize, (usize,__Symbol<'input>,usize), usize) | ||
667 | { | ||
668 | // Integer = r#"[0-9]+"# => ActionFn(10); | ||
669 | let __sym0 = __pop_Variant0(__symbols); | ||
670 | let __start = __sym0.0.clone(); | ||
671 | let __end = __sym0.2.clone(); | ||
672 | let __nt = super::__action10::<>(input, __sym0); | ||
673 | let __symbol = (__start, __Symbol::Variant5(__nt), __end); | ||
674 | (1, __symbol, 6) | ||
675 | } | ||
676 | pub(crate) fn __reduce11< | ||
677 | 'input, | ||
678 | >( | ||
679 | input: &'input str, | ||
680 | __action: i8, | ||
681 | __lookahead_start: Option<&usize>, | ||
682 | __states: &mut ::std::vec::Vec<i8>, | ||
683 | __symbols: &mut ::std::vec::Vec<(usize,__Symbol<'input>,usize)>, | ||
684 | _: ::std::marker::PhantomData<()>, | ||
685 | ) -> (usize, (usize,__Symbol<'input>,usize), usize) | ||
686 | { | ||
687 | // Main = Preamp, Eq => ActionFn(1); | ||
688 | let __sym1 = __pop_Variant4(__symbols); | ||
689 | let __sym0 = __pop_Variant3(__symbols); | ||
690 | let __start = __sym0.0.clone(); | ||
691 | let __end = __sym1.2.clone(); | ||
692 | let __nt = super::__action1::<>(input, __sym0, __sym1); | ||
693 | let __symbol = (__start, __Symbol::Variant6(__nt), __end); | ||
694 | (2, __symbol, 7) | ||
695 | } | ||
696 | pub(crate) fn __reduce12< | ||
697 | 'input, | ||
698 | >( | ||
699 | input: &'input str, | ||
700 | __action: i8, | ||
701 | __lookahead_start: Option<&usize>, | ||
702 | __states: &mut ::std::vec::Vec<i8>, | ||
703 | __symbols: &mut ::std::vec::Vec<(usize,__Symbol<'input>,usize)>, | ||
704 | _: ::std::marker::PhantomData<()>, | ||
705 | ) -> (usize, (usize,__Symbol<'input>,usize), usize) | ||
706 | { | ||
707 | // Preamp = "Preamp:", Decibel => ActionFn(2); | ||
708 | let __sym1 = __pop_Variant3(__symbols); | ||
709 | let __sym0 = __pop_Variant0(__symbols); | ||
710 | let __start = __sym0.0.clone(); | ||
711 | let __end = __sym1.2.clone(); | ||
712 | let __nt = super::__action2::<>(input, __sym0, __sym1); | ||
713 | let __symbol = (__start, __Symbol::Variant3(__nt), __end); | ||
714 | (2, __symbol, 8) | ||
715 | } | ||
716 | pub(crate) fn __reduce13< | ||
717 | 'input, | ||
718 | >( | ||
719 | input: &'input str, | ||
720 | __action: i8, | ||
721 | __lookahead_start: Option<&usize>, | ||
722 | __states: &mut ::std::vec::Vec<i8>, | ||
723 | __symbols: &mut ::std::vec::Vec<(usize,__Symbol<'input>,usize)>, | ||
724 | _: ::std::marker::PhantomData<()>, | ||
725 | ) -> (usize, (usize,__Symbol<'input>,usize), usize) | ||
726 | { | ||
727 | // RawFloat = r#"-?[0-9]*\\.[0-9]+"# => ActionFn(8); | ||
728 | let __sym0 = __pop_Variant0(__symbols); | ||
729 | let __start = __sym0.0.clone(); | ||
730 | let __end = __sym0.2.clone(); | ||
731 | let __nt = super::__action8::<>(input, __sym0); | ||
732 | let __symbol = (__start, __Symbol::Variant3(__nt), __end); | ||
733 | (1, __symbol, 9) | ||
734 | } | ||
735 | pub(crate) fn __reduce14< | ||
736 | 'input, | ||
737 | >( | ||
738 | input: &'input str, | ||
739 | __action: i8, | ||
740 | __lookahead_start: Option<&usize>, | ||
741 | __states: &mut ::std::vec::Vec<i8>, | ||
742 | __symbols: &mut ::std::vec::Vec<(usize,__Symbol<'input>,usize)>, | ||
743 | _: ::std::marker::PhantomData<()>, | ||
744 | ) -> (usize, (usize,__Symbol<'input>,usize), usize) | ||
745 | { | ||
746 | // SignedInteger = r#"-[0-9]+"# => ActionFn(9); | ||
747 | let __sym0 = __pop_Variant0(__symbols); | ||
748 | let __start = __sym0.0.clone(); | ||
749 | let __end = __sym0.2.clone(); | ||
750 | let __nt = super::__action9::<>(input, __sym0); | ||
751 | let __symbol = (__start, __Symbol::Variant7(__nt), __end); | ||
752 | (1, __symbol, 10) | ||
753 | } | ||
754 | } | ||
755 | pub use self::__parse__Main::MainParser; | ||
756 | #[cfg_attr(rustfmt, rustfmt_skip)] | ||
757 | mod __intern_token { | ||
758 | #![allow(unused_imports)] | ||
759 | use ::Filter; | ||
760 | use std::str::FromStr; | ||
761 | #[allow(unused_extern_crates)] | ||
762 | extern crate lalrpop_util as __lalrpop_util; | ||
763 | extern crate regex as __regex; | ||
764 | use std::fmt as __fmt; | ||
765 | |||
766 | #[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord)] | ||
767 | pub struct Token<'input>(pub usize, pub &'input str); | ||
768 | impl<'a> __fmt::Display for Token<'a> { | ||
769 | fn fmt(&self, formatter: &mut __fmt::Formatter) -> Result<(), __fmt::Error> { | ||
770 | __fmt::Display::fmt(self.1, formatter) | ||
771 | } | ||
772 | } | ||
773 | |||
774 | pub struct __MatcherBuilder { | ||
775 | regex_set: __regex::RegexSet, | ||
776 | regex_vec: Vec<__regex::Regex>, | ||
777 | } | ||
778 | |||
779 | impl __MatcherBuilder { | ||
780 | pub fn new() -> __MatcherBuilder { | ||
781 | let __strs: &[&str] = &[ | ||
782 | "^((?u:\\-)?(?u:[0-9])*(?u:\\.)(?u:[0-9])+)", | ||
783 | "^((?u:\\-)(?u:[0-9])+)", | ||
784 | "^((?u:[0-9])+)", | ||
785 | "^((?u:;))", | ||
786 | "^((?u:GraphicEQ:))", | ||
787 | "^((?u:Preamp:))", | ||
788 | "^((?u:dB))", | ||
789 | ]; | ||
790 | let __regex_set = __regex::RegexSet::new(__strs).unwrap(); | ||
791 | let __regex_vec = vec![ | ||
792 | __regex::Regex::new("^((?u:\\-)?(?u:[0-9])*(?u:\\.)(?u:[0-9])+)").unwrap(), | ||
793 | __regex::Regex::new("^((?u:\\-)(?u:[0-9])+)").unwrap(), | ||
794 | __regex::Regex::new("^((?u:[0-9])+)").unwrap(), | ||
795 | __regex::Regex::new("^((?u:;))").unwrap(), | ||
796 | __regex::Regex::new("^((?u:GraphicEQ:))").unwrap(), | ||
797 | __regex::Regex::new("^((?u:Preamp:))").unwrap(), | ||
798 | __regex::Regex::new("^((?u:dB))").unwrap(), | ||
799 | ]; | ||
800 | __MatcherBuilder { regex_set: __regex_set, regex_vec: __regex_vec } | ||
801 | } | ||
802 | pub fn matcher<'input, 'builder>(&'builder self, s: &'input str) -> __Matcher<'input, 'builder> { | ||
803 | __Matcher { | ||
804 | text: s, | ||
805 | consumed: 0, | ||
806 | regex_set: &self.regex_set, | ||
807 | regex_vec: &self.regex_vec, | ||
808 | } | ||
809 | } | ||
810 | } | ||
811 | |||
812 | pub struct __Matcher<'input, 'builder> { | ||
813 | text: &'input str, | ||
814 | consumed: usize, | ||
815 | regex_set: &'builder __regex::RegexSet, | ||
816 | regex_vec: &'builder Vec<__regex::Regex>, | ||
817 | } | ||
818 | |||
819 | impl<'input, 'builder> Iterator for __Matcher<'input, 'builder> { | ||
820 | type Item = Result<(usize, Token<'input>, usize), __lalrpop_util::ParseError<usize,Token<'input>,&'static str>>; | ||
821 | |||
822 | fn next(&mut self) -> Option<Self::Item> { | ||
823 | let __text = self.text.trim_left(); | ||
824 | let __whitespace = self.text.len() - __text.len(); | ||
825 | let __start_offset = self.consumed + __whitespace; | ||
826 | if __text.is_empty() { | ||
827 | self.text = __text; | ||
828 | self.consumed = __start_offset; | ||
829 | None | ||
830 | } else { | ||
831 | let __matches = self.regex_set.matches(__text); | ||
832 | if !__matches.matched_any() { | ||
833 | Some(Err(__lalrpop_util::ParseError::InvalidToken { | ||
834 | location: __start_offset, | ||
835 | })) | ||
836 | } else { | ||
837 | let mut __longest_match = 0; | ||
838 | let mut __index = 0; | ||
839 | for __i in 0 .. 7 { | ||
840 | if __matches.matched(__i) { | ||
841 | let __match = self.regex_vec[__i].find(__text).unwrap(); | ||
842 | let __len = __match.end(); | ||
843 | if __len >= __longest_match { | ||
844 | __longest_match = __len; | ||
845 | __index = __i; | ||
846 | } | ||
847 | } | ||
848 | } | ||
849 | let __result = &__text[..__longest_match]; | ||
850 | let __remaining = &__text[__longest_match..]; | ||
851 | let __end_offset = __start_offset + __longest_match; | ||
852 | self.text = __remaining; | ||
853 | self.consumed = __end_offset; | ||
854 | Some(Ok((__start_offset, Token(__index, __result), __end_offset))) | ||
855 | } | ||
856 | } | ||
857 | } | ||
858 | } | ||
859 | } | ||
860 | pub use self::__intern_token::Token; | ||
861 | |||
862 | #[allow(unused_variables)] | ||
863 | fn __action0< | ||
864 | 'input, | ||
865 | >( | ||
866 | input: &'input str, | ||
867 | (_, __0, _): (usize, Filter, usize), | ||
868 | ) -> Filter | ||
869 | { | ||
870 | (__0) | ||
871 | } | ||
872 | |||
873 | #[allow(unused_variables)] | ||
874 | fn __action1< | ||
875 | 'input, | ||
876 | >( | ||
877 | input: &'input str, | ||
878 | (_, preamp, _): (usize, f64, usize), | ||
879 | (_, eq, _): (usize, (Vec<u32>, Vec<f64>), usize), | ||
880 | ) -> Filter | ||
881 | { | ||
882 | { | ||
883 | let coefficients: Vec<_> = eq.1.iter().map(|decibel| 10f64.powf(decibel / 10f64)).collect(); | ||
884 | // TODO: add decibel_to_ratio conversion function | ||
885 | let preamp = 10f64.powf(preamp / 10f64); | ||
886 | Filter { preamp, frequencies: eq.0, coefficients } | ||
887 | } | ||
888 | } | ||
889 | |||
890 | #[allow(unused_variables)] | ||
891 | fn __action2< | ||
892 | 'input, | ||
893 | >( | ||
894 | input: &'input str, | ||
895 | (_, _, _): (usize, &'input str, usize), | ||
896 | (_, __0, _): (usize, f64, usize), | ||
897 | ) -> f64 | ||
898 | { | ||
899 | (__0) | ||
900 | } | ||
901 | |||
902 | #[allow(unused_variables)] | ||
903 | fn __action3< | ||
904 | 'input, | ||
905 | >( | ||
906 | input: &'input str, | ||
907 | (_, _, _): (usize, &'input str, usize), | ||
908 | (_, values, _): (usize, ::std::vec::Vec<(u32, f64)>, usize), | ||
909 | (_, end, _): (usize, (u32, f64), usize), | ||
910 | ) -> (Vec<u32>, Vec<f64>) | ||
911 | { | ||
912 | { | ||
913 | let mut values = values; | ||
914 | values.push(end); | ||
915 | values.into_iter().unzip() | ||
916 | } | ||
917 | } | ||
918 | |||
919 | #[allow(unused_variables)] | ||
920 | fn __action4< | ||
921 | 'input, | ||
922 | >( | ||
923 | input: &'input str, | ||
924 | (_, __0, _): (usize, f64, usize), | ||
925 | (_, _, _): (usize, &'input str, usize), | ||
926 | ) -> f64 | ||
927 | { | ||
928 | (__0) | ||
929 | } | ||
930 | |||
931 | #[allow(unused_variables)] | ||
932 | fn __action5< | ||
933 | 'input, | ||
934 | >( | ||
935 | input: &'input str, | ||
936 | (_, __0, _): (usize, f64, usize), | ||
937 | ) -> f64 | ||
938 | { | ||
939 | (__0) | ||
940 | } | ||
941 | |||
942 | #[allow(unused_variables)] | ||
943 | fn __action6< | ||
944 | 'input, | ||
945 | >( | ||
946 | input: &'input str, | ||
947 | (_, __0, _): (usize, i32, usize), | ||
948 | ) -> f64 | ||
949 | { | ||
950 | __0 as f64 | ||
951 | } | ||
952 | |||
953 | #[allow(unused_variables)] | ||
954 | fn __action7< | ||
955 | 'input, | ||
956 | >( | ||
957 | input: &'input str, | ||
958 | (_, __0, _): (usize, u32, usize), | ||
959 | ) -> f64 | ||
960 | { | ||
961 | __0 as f64 | ||
962 | } | ||
963 | |||
964 | #[allow(unused_variables)] | ||
965 | fn __action8< | ||
966 | 'input, | ||
967 | >( | ||
968 | input: &'input str, | ||
969 | (_, __0, _): (usize, &'input str, usize), | ||
970 | ) -> f64 | ||
971 | { | ||
972 | f64::from_str(__0).unwrap() | ||
973 | } | ||
974 | |||
975 | #[allow(unused_variables)] | ||
976 | fn __action9< | ||
977 | 'input, | ||
978 | >( | ||
979 | input: &'input str, | ||
980 | (_, __0, _): (usize, &'input str, usize), | ||
981 | ) -> i32 | ||
982 | { | ||
983 | i32::from_str(__0).unwrap() | ||
984 | } | ||
985 | |||
986 | #[allow(unused_variables)] | ||
987 | fn __action10< | ||
988 | 'input, | ||
989 | >( | ||
990 | input: &'input str, | ||
991 | (_, __0, _): (usize, &'input str, usize), | ||
992 | ) -> u32 | ||
993 | { | ||
994 | u32::from_str(__0).unwrap() | ||
995 | } | ||
996 | |||
997 | #[allow(unused_variables)] | ||
998 | fn __action11< | ||
999 | 'input, | ||
1000 | >( | ||
1001 | input: &'input str, | ||
1002 | (_, __0, _): (usize, (u32, f64), usize), | ||
1003 | ) -> ::std::vec::Vec<(u32, f64)> | ||
1004 | { | ||
1005 | vec![__0] | ||
1006 | } | ||
1007 | |||
1008 | #[allow(unused_variables)] | ||
1009 | fn __action12< | ||
1010 | 'input, | ||
1011 | >( | ||
1012 | input: &'input str, | ||
1013 | (_, v, _): (usize, ::std::vec::Vec<(u32, f64)>, usize), | ||
1014 | (_, e, _): (usize, (u32, f64), usize), | ||
1015 | ) -> ::std::vec::Vec<(u32, f64)> | ||
1016 | { | ||
1017 | { let mut v = v; v.push(e); v } | ||
1018 | } | ||
1019 | |||
1020 | #[allow(unused_variables)] | ||
1021 | fn __action13< | ||
1022 | 'input, | ||
1023 | >( | ||
1024 | input: &'input str, | ||
1025 | (_, __0, _): (usize, (u32, f64), usize), | ||
1026 | (_, _, _): (usize, &'input str, usize), | ||
1027 | ) -> (u32, f64) | ||
1028 | { | ||
1029 | (__0) | ||
1030 | } | ||
1031 | |||
1032 | #[allow(unused_variables)] | ||
1033 | fn __action14< | ||
1034 | 'input, | ||
1035 | >( | ||
1036 | input: &'input str, | ||
1037 | (_, __0, _): (usize, u32, usize), | ||
1038 | (_, __1, _): (usize, f64, usize), | ||
1039 | ) -> (u32, f64) | ||
1040 | { | ||
1041 | (__0, __1) | ||
1042 | } | ||
1043 | |||
1044 | #[allow(unused_variables)] | ||
1045 | fn __action15< | ||
1046 | 'input, | ||
1047 | >( | ||
1048 | input: &'input str, | ||
1049 | __0: (usize, u32, usize), | ||
1050 | __1: (usize, f64, usize), | ||
1051 | __2: (usize, &'input str, usize), | ||
1052 | ) -> (u32, f64) | ||
1053 | { | ||
1054 | let __start0 = __0.0.clone(); | ||
1055 | let __end0 = __1.2.clone(); | ||
1056 | let __temp0 = __action14( | ||
1057 | input, | ||
1058 | __0, | ||
1059 | __1, | ||
1060 | ); | ||
1061 | let __temp0 = (__start0, __temp0, __end0); | ||
1062 | __action13( | ||
1063 | input, | ||
1064 | __temp0, | ||
1065 | __2, | ||
1066 | ) | ||
1067 | } | ||
1068 | |||
1069 | #[allow(unused_variables)] | ||
1070 | fn __action16< | ||
1071 | 'input, | ||
1072 | >( | ||
1073 | input: &'input str, | ||
1074 | __0: (usize, &'input str, usize), | ||
1075 | __1: (usize, ::std::vec::Vec<(u32, f64)>, usize), | ||
1076 | __2: (usize, u32, usize), | ||
1077 | __3: (usize, f64, usize), | ||
1078 | ) -> (Vec<u32>, Vec<f64>) | ||
1079 | { | ||
1080 | let __start0 = __2.0.clone(); | ||
1081 | let __end0 = __3.2.clone(); | ||
1082 | let __temp0 = __action14( | ||
1083 | input, | ||
1084 | __2, | ||
1085 | __3, | ||
1086 | ); | ||
1087 | let __temp0 = (__start0, __temp0, __end0); | ||
1088 | __action3( | ||
1089 | input, | ||
1090 | __0, | ||
1091 | __1, | ||
1092 | __temp0, | ||
1093 | ) | ||
1094 | } | ||
1095 | |||
1096 | #[allow(unused_variables)] | ||
1097 | fn __action17< | ||
1098 | 'input, | ||
1099 | >( | ||
1100 | input: &'input str, | ||
1101 | __0: (usize, u32, usize), | ||
1102 | __1: (usize, f64, usize), | ||
1103 | __2: (usize, &'input str, usize), | ||
1104 | ) -> ::std::vec::Vec<(u32, f64)> | ||
1105 | { | ||
1106 | let __start0 = __0.0.clone(); | ||
1107 | let __end0 = __2.2.clone(); | ||
1108 | let __temp0 = __action15( | ||
1109 | input, | ||
1110 | __0, | ||
1111 | __1, | ||
1112 | __2, | ||
1113 | ); | ||
1114 | let __temp0 = (__start0, __temp0, __end0); | ||
1115 | __action11( | ||
1116 | input, | ||
1117 | __temp0, | ||
1118 | ) | ||
1119 | } | ||
1120 | |||
1121 | #[allow(unused_variables)] | ||
1122 | fn __action18< | ||
1123 | 'input, | ||
1124 | >( | ||
1125 | input: &'input str, | ||
1126 | __0: (usize, ::std::vec::Vec<(u32, f64)>, usize), | ||
1127 | __1: (usize, u32, usize), | ||
1128 | __2: (usize, f64, usize), | ||
1129 | __3: (usize, &'input str, usize), | ||
1130 | ) -> ::std::vec::Vec<(u32, f64)> | ||
1131 | { | ||
1132 | let __start0 = __1.0.clone(); | ||
1133 | let __end0 = __3.2.clone(); | ||
1134 | let __temp0 = __action15( | ||
1135 | input, | ||
1136 | __1, | ||
1137 | __2, | ||
1138 | __3, | ||
1139 | ); | ||
1140 | let __temp0 = (__start0, __temp0, __end0); | ||
1141 | __action12( | ||
1142 | input, | ||
1143 | __0, | ||
1144 | __temp0, | ||
1145 | ) | ||
1146 | } | ||
1147 | |||
1148 | pub trait __ToTriple<'input, > { | ||
1149 | type Error; | ||
1150 | fn to_triple(value: Self) -> Result<(usize,Token<'input>,usize),Self::Error>; | ||
1151 | } | ||
1152 | |||
1153 | impl<'input, > __ToTriple<'input, > for (usize, Token<'input>, usize) { | ||
1154 | type Error = &'static str; | ||
1155 | fn to_triple(value: Self) -> Result<(usize,Token<'input>,usize),&'static str> { | ||
1156 | Ok(value) | ||
1157 | } | ||
1158 | } | ||
1159 | impl<'input, > __ToTriple<'input, > for Result<(usize, Token<'input>, usize),&'static str> { | ||
1160 | type Error = &'static str; | ||
1161 | fn to_triple(value: Self) -> Result<(usize,Token<'input>,usize),&'static str> { | ||
1162 | value | ||
1163 | } | ||
1164 | } | ||
diff --git a/src/parsing/mod.rs b/src/parsing/mod.rs new file mode 100644 index 0000000..b613585 --- /dev/null +++ b/src/parsing/mod.rs | |||
@@ -0,0 +1,3 @@ | |||
1 | pub mod equalizer_apo; | ||
2 | |||
3 | pub use self::equalizer_apo::MainParser as EqualizerApoParser; | ||
diff --git a/src/utils.rs b/src/utils.rs new file mode 100644 index 0000000..5aae29d --- /dev/null +++ b/src/utils.rs | |||
@@ -0,0 +1,71 @@ | |||
1 | use ::{Filter, NoEqualizedSink}; | ||
2 | |||
3 | use parsing::EqualizerApoParser; | ||
4 | |||
5 | use ::dbus_api::equalizing_manager::OrgPulseAudioExtEqualizing1Manager; | ||
6 | use ::dbus_api::server_lookup::OrgPulseAudioServerLookup1; | ||
7 | use ::dbus_api::sink::OrgPulseAudioExtEqualizing1Equalizer; | ||
8 | |||
9 | use dbus::{BusType, Connection, ConnPath}; | ||
10 | use failure::{Error, ResultExt}; | ||
11 | |||
12 | use std::io::{self, Read}; | ||
13 | |||
14 | pub fn connect() -> Result<Connection, Error> { | ||
15 | let pulse_sock_path = | ||
16 | get_pulse_dbus_sock().context("While looking up PulseAudio's D-Bus socket path")?; | ||
17 | info!("PulseAudio's D-Bus socket path is: {}", pulse_sock_path); | ||
18 | |||
19 | trace!("Connecting to PulseAudio's D-Bus socket"); | ||
20 | Ok(Connection::open_private(&pulse_sock_path)?) | ||
21 | } | ||
22 | |||
23 | pub fn get_equalized_sink<'a>(conn: &'a Connection) -> Result<ConnPath<'a, &'a Connection>, Error> { | ||
24 | let conn_manager = conn.with_path("org.PulseAudio.Core1", "/org/pulseaudio/equalizing1", 2000); | ||
25 | |||
26 | // TODO: make that a command-line option | ||
27 | trace!("Getting (one of) the equalized sink(s)"); | ||
28 | let mut sinks = conn_manager.get_equalized_sinks()?; | ||
29 | let sink_path = sinks.pop().ok_or(NoEqualizedSink {})?; | ||
30 | info!("Using equalized sink: {:?}", sink_path.as_cstr()); | ||
31 | |||
32 | trace!("Connecting to equalized sink"); | ||
33 | Ok(conn.with_path("org.PulseAudio.Core1", sink_path, 2000)) | ||
34 | } | ||
35 | |||
36 | pub fn send_filter(conn_sink: &ConnPath<&Connection>, filter: Filter) -> Result<(), Error> { | ||
37 | let channel = conn_sink.get_nchannels()?; | ||
38 | info!("Using channel: {}", channel); | ||
39 | trace!("Sending filter"); | ||
40 | conn_sink.seed_filter( | ||
41 | channel, | ||
42 | filter.frequencies, | ||
43 | filter.coefficients, | ||
44 | filter.preamp, | ||
45 | )?; | ||
46 | Ok(()) | ||
47 | } | ||
48 | |||
49 | pub fn read_filter() -> Result<Filter, Error> { | ||
50 | let mut buffer = String::new(); | ||
51 | let stdin = io::stdin(); | ||
52 | let mut handle = stdin.lock(); | ||
53 | |||
54 | info!("Reading filter in GraphicEQ format from the command line"); | ||
55 | handle.read_to_string(&mut buffer)?; | ||
56 | |||
57 | // TODO: lifetime issue when "throwing" parse error | ||
58 | let filter = EqualizerApoParser::new().parse(&buffer).unwrap(); | ||
59 | info!("Parsed filter: {:?}", filter); | ||
60 | |||
61 | Ok(filter) | ||
62 | } | ||
63 | |||
64 | fn get_pulse_dbus_sock() -> Result<String, Error> { | ||
65 | trace!("Connecting to the D-Bus' session bus"); | ||
66 | let conn = Connection::get_private(BusType::Session)?; | ||
67 | let conn = conn.with_path("org.PulseAudio1", "/org/pulseaudio/server_lookup1", 2000); | ||
68 | |||
69 | trace!("Checking PulseAudio's D-Bus socket path"); | ||
70 | Ok(conn.get_address()?) | ||
71 | } | ||