From d575adf63b7e87196b636ee91061692a685b605f Mon Sep 17 00:00:00 2001 From: Minijackson Date: Sun, 2 Sep 2018 16:04:22 +0200 Subject: First working version --- .gitignore | 2 + Cargo.lock | 955 +++++++++++++++++++++++++++++ Cargo.toml | 21 + build.rs | 5 + src/dbus_api/equalizing_manager.rs | 291 +++++++++ src/dbus_api/mod.rs | 3 + src/dbus_api/server_lookup.rs | 188 ++++++ src/dbus_api/sink.rs | 1128 ++++++++++++++++++++++++++++++++++ src/main.rs | 132 ++++ src/parsing/equalizer_apo.lalrpop | 42 ++ src/parsing/equalizer_apo.rs | 1164 ++++++++++++++++++++++++++++++++++++ src/parsing/mod.rs | 3 + src/utils.rs | 71 +++ 13 files changed, 4005 insertions(+) create mode 100644 .gitignore create mode 100644 Cargo.lock create mode 100644 Cargo.toml create mode 100644 build.rs create mode 100644 src/dbus_api/equalizing_manager.rs create mode 100644 src/dbus_api/mod.rs create mode 100644 src/dbus_api/server_lookup.rs create mode 100644 src/dbus_api/sink.rs create mode 100644 src/main.rs create mode 100644 src/parsing/equalizer_apo.lalrpop create mode 100644 src/parsing/equalizer_apo.rs create mode 100644 src/parsing/mod.rs create mode 100644 src/utils.rs diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..53eaa21 --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +/target +**/*.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 @@ +[[package]] +name = "aho-corasick" +version = "0.6.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "memchr 2.0.2 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "ansi_term" +version = "0.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "winapi 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "arrayref" +version = "0.3.5" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "ascii-canvas" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "term 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "atty" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "atty" +version = "0.2.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)", + "termion 1.5.1 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "backtrace" +version = "0.3.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "backtrace-sys 0.1.24 (registry+https://github.com/rust-lang/crates.io-index)", + "cfg-if 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)", + "rustc-demangle 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "backtrace-sys" +version = "0.1.24" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "cc 1.0.23 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "bit-set" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "bit-vec 0.4.4 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "bit-vec" +version = "0.4.4" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "bitflags" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "block-buffer" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "arrayref 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)", + "byte-tools 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "byte-tools" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "cc" +version = "1.0.23" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "cfg-if" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "clap" +version = "2.32.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "ansi_term 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)", + "atty 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)", + "bitflags 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)", + "strsim 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", + "textwrap 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)", + "unicode-width 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", + "vec_map 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "clap" +version = "3.0.0-alpha.1" +source = "git+https://github.com/kbknapp/clap-rs?branch=v3-master#eaa0700e7ed76f37d245a6878deb3b8e81754d6c" +dependencies = [ + "ansi_term 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)", + "atty 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)", + "bitflags 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)", + "clap_derive 0.3.0 (git+https://github.com/clap-rs/clap_derive)", + "indexmap 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", + "strsim 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", + "textwrap 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)", + "unicode-width 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", + "vec_map 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "clap-log-flag" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "env_logger 0.5.13 (registry+https://github.com/rust-lang/crates.io-index)", + "failure 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.4.4 (registry+https://github.com/rust-lang/crates.io-index)", + "pretty_env_logger 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)", + "structopt 0.2.10 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "clap-verbosity-flag" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "env_logger 0.5.13 (registry+https://github.com/rust-lang/crates.io-index)", + "failure 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.4.4 (registry+https://github.com/rust-lang/crates.io-index)", + "structopt 0.2.10 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "clap_derive" +version = "0.3.0" +source = "git+https://github.com/clap-rs/clap_derive#2fad2c8ae4b5c61a2bf343b4eed636d60bb161bf" +dependencies = [ + "proc-macro2 0.4.15 (registry+https://github.com/rust-lang/crates.io-index)", + "quote 0.6.8 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 0.14.9 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "cloudabi" +version = "0.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "bitflags 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "dbus" +version = "0.6.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)", + "libdbus-sys 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "diff" +version = "0.1.11" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "digest" +version = "0.7.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "generic-array 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "docopt" +version = "0.8.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "lazy_static 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "regex 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.75 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_derive 1.0.75 (registry+https://github.com/rust-lang/crates.io-index)", + "strsim 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "either" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "ena" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "env_logger" +version = "0.5.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "atty 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)", + "humantime 1.1.1 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.4.4 (registry+https://github.com/rust-lang/crates.io-index)", + "regex 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)", + "termcolor 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "failure" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "backtrace 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", + "failure_derive 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "failure_derive" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "proc-macro2 0.4.15 (registry+https://github.com/rust-lang/crates.io-index)", + "quote 0.6.8 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 0.14.9 (registry+https://github.com/rust-lang/crates.io-index)", + "synstructure 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "fake-simd" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "fixedbitset" +version = "0.1.9" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "fuchsia-zircon" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "bitflags 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)", + "fuchsia-zircon-sys 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "fuchsia-zircon-sys" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "generic-array" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "typenum 1.10.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "humantime" +version = "1.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "quick-error 1.2.2 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "indexmap" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "itertools" +version = "0.7.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "either 1.5.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "kernel32-sys" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi-build 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "lalrpop" +version = "0.15.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "ascii-canvas 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "atty 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", + "bit-set 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", + "diff 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)", + "digest 0.7.5 (registry+https://github.com/rust-lang/crates.io-index)", + "docopt 0.8.3 (registry+https://github.com/rust-lang/crates.io-index)", + "ena 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", + "itertools 0.7.8 (registry+https://github.com/rust-lang/crates.io-index)", + "lalrpop-snap 0.15.2 (registry+https://github.com/rust-lang/crates.io-index)", + "lalrpop-util 0.15.2 (registry+https://github.com/rust-lang/crates.io-index)", + "petgraph 0.4.13 (registry+https://github.com/rust-lang/crates.io-index)", + "regex 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)", + "regex-syntax 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.75 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_derive 1.0.75 (registry+https://github.com/rust-lang/crates.io-index)", + "sha2 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)", + "string_cache 0.7.3 (registry+https://github.com/rust-lang/crates.io-index)", + "term 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", + "unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "lalrpop-snap" +version = "0.15.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "ascii-canvas 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "atty 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", + "bit-set 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", + "diff 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)", + "ena 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", + "itertools 0.7.8 (registry+https://github.com/rust-lang/crates.io-index)", + "lalrpop-util 0.15.2 (registry+https://github.com/rust-lang/crates.io-index)", + "petgraph 0.4.13 (registry+https://github.com/rust-lang/crates.io-index)", + "regex 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)", + "regex-syntax 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", + "string_cache 0.7.3 (registry+https://github.com/rust-lang/crates.io-index)", + "term 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", + "unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "lalrpop-util" +version = "0.15.2" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "lazy_static" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "version_check 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "libc" +version = "0.2.43" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "libdbus-sys" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "pkg-config 0.3.14 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "log" +version = "0.4.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "cfg-if 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "memchr" +version = "2.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "new_debug_unreachable" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "unreachable 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "ordermap" +version = "0.3.5" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "petgraph" +version = "0.4.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "fixedbitset 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)", + "ordermap 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "phf_generator" +version = "0.7.23" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "phf_shared 0.7.23 (registry+https://github.com/rust-lang/crates.io-index)", + "rand 0.5.5 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "phf_shared" +version = "0.7.23" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "siphasher 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "pkg-config" +version = "0.3.14" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "precomputed-hash" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "pretty_env_logger" +version = "0.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "ansi_term 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)", + "env_logger 0.5.13 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.4.4 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "proc-macro2" +version = "0.3.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "proc-macro2" +version = "0.4.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "quick-error" +version = "1.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "quote" +version = "0.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "proc-macro2 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "quote" +version = "0.6.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "proc-macro2 0.4.15 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "rand" +version = "0.5.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "cloudabi 0.0.3 (registry+https://github.com/rust-lang/crates.io-index)", + "fuchsia-zircon 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)", + "rand_core 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "rand_core" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "redox_syscall" +version = "0.1.40" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "redox_termios" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "redox_syscall 0.1.40 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "regex" +version = "0.2.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "aho-corasick 0.6.8 (registry+https://github.com/rust-lang/crates.io-index)", + "memchr 2.0.2 (registry+https://github.com/rust-lang/crates.io-index)", + "regex-syntax 0.5.6 (registry+https://github.com/rust-lang/crates.io-index)", + "thread_local 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", + "utf8-ranges 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "regex" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "aho-corasick 0.6.8 (registry+https://github.com/rust-lang/crates.io-index)", + "memchr 2.0.2 (registry+https://github.com/rust-lang/crates.io-index)", + "regex-syntax 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)", + "thread_local 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", + "utf8-ranges 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "regex-syntax" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "regex-syntax" +version = "0.5.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "ucd-util 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "regex-syntax" +version = "0.6.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "ucd-util 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "rustc-demangle" +version = "0.1.9" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "serde" +version = "1.0.75" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "serde_derive" +version = "1.0.75" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "proc-macro2 0.4.15 (registry+https://github.com/rust-lang/crates.io-index)", + "quote 0.6.8 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 0.14.9 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "set_eq" +version = "0.1.0" +dependencies = [ + "clap 3.0.0-alpha.1 (git+https://github.com/kbknapp/clap-rs?branch=v3-master)", + "clap-log-flag 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "clap-verbosity-flag 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", + "dbus 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)", + "failure 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", + "lalrpop 0.15.2 (registry+https://github.com/rust-lang/crates.io-index)", + "lalrpop-util 0.15.2 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.4.4 (registry+https://github.com/rust-lang/crates.io-index)", + "regex 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)", + "structopt 0.2.10 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "sha2" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "block-buffer 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", + "byte-tools 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", + "digest 0.7.5 (registry+https://github.com/rust-lang/crates.io-index)", + "fake-simd 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "siphasher" +version = "0.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "string_cache" +version = "0.7.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "lazy_static 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "new_debug_unreachable 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", + "phf_shared 0.7.23 (registry+https://github.com/rust-lang/crates.io-index)", + "precomputed-hash 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.75 (registry+https://github.com/rust-lang/crates.io-index)", + "string_cache_codegen 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)", + "string_cache_shared 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "string_cache_codegen" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "phf_generator 0.7.23 (registry+https://github.com/rust-lang/crates.io-index)", + "phf_shared 0.7.23 (registry+https://github.com/rust-lang/crates.io-index)", + "proc-macro2 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", + "quote 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)", + "string_cache_shared 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "string_cache_shared" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "strsim" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "strsim" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "structopt" +version = "0.2.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "clap 2.32.0 (registry+https://github.com/rust-lang/crates.io-index)", + "structopt-derive 0.2.10 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "structopt-derive" +version = "0.2.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "proc-macro2 0.4.15 (registry+https://github.com/rust-lang/crates.io-index)", + "quote 0.6.8 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 0.14.9 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "syn" +version = "0.14.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "proc-macro2 0.4.15 (registry+https://github.com/rust-lang/crates.io-index)", + "quote 0.6.8 (registry+https://github.com/rust-lang/crates.io-index)", + "unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "synstructure" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "proc-macro2 0.4.15 (registry+https://github.com/rust-lang/crates.io-index)", + "quote 0.6.8 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 0.14.9 (registry+https://github.com/rust-lang/crates.io-index)", + "unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "term" +version = "0.4.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "termcolor" +version = "1.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "wincolor 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "termion" +version = "1.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)", + "redox_syscall 0.1.40 (registry+https://github.com/rust-lang/crates.io-index)", + "redox_termios 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "textwrap" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "unicode-width 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "thread_local" +version = "0.3.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "lazy_static 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "typenum" +version = "1.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "ucd-util" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "unicode-width" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "unicode-xid" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "unreachable" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "void 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "utf8-ranges" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "vec_map" +version = "0.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "version_check" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "void" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "winapi" +version = "0.2.8" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "winapi" +version = "0.3.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "winapi-i686-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi-x86_64-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "winapi-build" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "winapi-i686-pc-windows-gnu" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "winapi-util" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "winapi 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "winapi-x86_64-pc-windows-gnu" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "wincolor" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "winapi 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi-util 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[metadata] +"checksum aho-corasick 0.6.8 (registry+https://github.com/rust-lang/crates.io-index)" = "68f56c7353e5a9547cbd76ed90f7bb5ffc3ba09d4ea9bd1d8c06c8b1142eeb5a" +"checksum ansi_term 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ee49baf6cb617b853aa8d93bf420db2383fab46d314482ca2803b40d5fde979b" +"checksum arrayref 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)" = "0d382e583f07208808f6b1249e60848879ba3543f57c32277bf52d69c2f0f0ee" +"checksum ascii-canvas 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "b385d69402821a1c254533a011a312531cbcc0e3e24f19bbb4747a5a2daf37e2" +"checksum atty 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "d0fd4c0631f06448cc45a6bbb3b710ebb7ff8ccb96a0800c994afe23a70d5df2" +"checksum atty 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)" = "9a7d5b8723950951411ee34d271d99dddcc2035a16ab25310ea2c8cfd4369652" +"checksum backtrace 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)" = "89a47830402e9981c5c41223151efcced65a0510c13097c769cede7efb34782a" +"checksum backtrace-sys 0.1.24 (registry+https://github.com/rust-lang/crates.io-index)" = "c66d56ac8dabd07f6aacdaf633f4b8262f5b3601a810a0dcddffd5c22c69daa0" +"checksum bit-set 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "d9bf6104718e80d7b26a68fdbacff3481cfc05df670821affc7e9cbc1884400c" +"checksum bit-vec 0.4.4 (registry+https://github.com/rust-lang/crates.io-index)" = "02b4ff8b16e6076c3e14220b39fbc1fabb6737522281a388998046859400895f" +"checksum bitflags 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)" = "228047a76f468627ca71776ecdebd732a3423081fcf5125585bcd7c49886ce12" +"checksum block-buffer 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "a076c298b9ecdb530ed9d967e74a6027d6a7478924520acddcddc24c1c8ab3ab" +"checksum byte-tools 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "560c32574a12a89ecd91f5e742165893f86e3ab98d21f8ea548658eb9eef5f40" +"checksum cc 1.0.23 (registry+https://github.com/rust-lang/crates.io-index)" = "c37f0efaa4b9b001fa6f02d4b644dee4af97d3414df07c51e3e4f015f3a3e131" +"checksum cfg-if 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "0c4e7bb64a8ebb0d856483e1e682ea3422f883c5f5615a90d51a2c82fe87fdd3" +"checksum clap 2.32.0 (registry+https://github.com/rust-lang/crates.io-index)" = "b957d88f4b6a63b9d70d5f454ac8011819c6efa7727858f458ab71c756ce2d3e" +"checksum clap 3.0.0-alpha.1 (git+https://github.com/kbknapp/clap-rs?branch=v3-master)" = "" +"checksum clap-log-flag 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "9b05213138aad9c0f820773c51e829eae4189986435aa5c115a6465b385892a5" +"checksum clap-verbosity-flag 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "bda14f5323b2b747f52908c5b7b8af7790784088bc7c2957a11695e39ad476dc" +"checksum clap_derive 0.3.0 (git+https://github.com/clap-rs/clap_derive)" = "" +"checksum cloudabi 0.0.3 (registry+https://github.com/rust-lang/crates.io-index)" = "ddfc5b9aa5d4507acaf872de71051dfd0e309860e88966e1051e462a077aac4f" +"checksum dbus 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)" = "3e34c238dfb3f5881d46ad301403cd8f8ecf946e2a4e89bdd1166728b68b5008" +"checksum diff 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)" = "3c2b69f912779fbb121ceb775d74d51e915af17aaebc38d28a592843a2dd0a3a" +"checksum digest 0.7.5 (registry+https://github.com/rust-lang/crates.io-index)" = "5b29c278aa8fd30796bd977169e8004b4aa88cdcd2f32a6eb22bc2d5d38df94a" +"checksum docopt 0.8.3 (registry+https://github.com/rust-lang/crates.io-index)" = "d8acd393692c503b168471874953a2531df0e9ab77d0b6bbc582395743300a4a" +"checksum either 1.5.0 (registry+https://github.com/rust-lang/crates.io-index)" = "3be565ca5c557d7f59e7cfcf1844f9e3033650c929c6566f511e8005f205c1d0" +"checksum ena 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)" = "cabe5a5078ac8c506d3e4430763b1ba9b609b1286913e7d08e581d1c2de9b7e5" +"checksum env_logger 0.5.13 (registry+https://github.com/rust-lang/crates.io-index)" = "15b0a4d2e39f8420210be8b27eeda28029729e2fd4291019455016c348240c38" +"checksum failure 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "7efb22686e4a466b1ec1a15c2898f91fa9cb340452496dca654032de20ff95b9" +"checksum failure_derive 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "946d0e98a50d9831f5d589038d2ca7f8f455b1c21028c0db0e84116a12696426" +"checksum fake-simd 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "e88a8acf291dafb59c2d96e8f59828f3838bb1a70398823ade51a84de6a6deed" +"checksum fixedbitset 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)" = "86d4de0081402f5e88cdac65c8dcdcc73118c1a7a465e2a05f0da05843a8ea33" +"checksum fuchsia-zircon 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "2e9763c69ebaae630ba35f74888db465e49e259ba1bc0eda7d06f4a067615d82" +"checksum fuchsia-zircon-sys 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "3dcaa9ae7725d12cdb85b3ad99a434db70b468c09ded17e012d86b5c1010f7a7" +"checksum generic-array 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ef25c5683767570c2bbd7deba372926a55eaae9982d7726ee2a1050239d45b9d" +"checksum humantime 1.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "0484fda3e7007f2a4a0d9c3a703ca38c71c54c55602ce4660c419fd32e188c9e" +"checksum indexmap 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "08173ba1e906efb6538785a8844dd496f5d34f0a2d88038e95195172fc667220" +"checksum itertools 0.7.8 (registry+https://github.com/rust-lang/crates.io-index)" = "f58856976b776fedd95533137617a02fb25719f40e7d9b01c7043cd65474f450" +"checksum kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "7507624b29483431c0ba2d82aece8ca6cdba9382bff4ddd0f7490560c056098d" +"checksum lalrpop 0.15.2 (registry+https://github.com/rust-lang/crates.io-index)" = "ba451f7bd819b7afc99d4cf4bdcd5a4861e64955ba9680ac70df3a50625ad6cf" +"checksum lalrpop-snap 0.15.2 (registry+https://github.com/rust-lang/crates.io-index)" = "60013fd6be14317d43f47658b1440956a9ca48a9ed0257e0e0a59aac13e43a1f" +"checksum lalrpop-util 0.15.2 (registry+https://github.com/rust-lang/crates.io-index)" = "60c6c48ba857cd700673ce88907cadcdd7e2cd7783ed02378537c5ffd4f6460c" +"checksum lazy_static 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ca488b89a5657b0a2ecd45b95609b3e848cf1755da332a0da46e2b2b1cb371a7" +"checksum libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)" = "76e3a3ef172f1a0b9a9ff0dd1491ae5e6c948b94479a3021819ba7d860c8645d" +"checksum libdbus-sys 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "8720f9274907052cb50313f91201597868da9d625f8dd125f2aca5bddb7e83a1" +"checksum log 0.4.4 (registry+https://github.com/rust-lang/crates.io-index)" = "cba860f648db8e6f269df990180c2217f333472b4a6e901e97446858487971e2" +"checksum memchr 2.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "a3b4142ab8738a78c51896f704f83c11df047ff1bda9a92a661aa6361552d93d" +"checksum new_debug_unreachable 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "0cdc457076c78ab54d5e0d6fa7c47981757f1e34dc39ff92787f217dede586c4" +"checksum ordermap 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)" = "a86ed3f5f244b372d6b1a00b72ef7f8876d0bc6a78a4c9985c53614041512063" +"checksum petgraph 0.4.13 (registry+https://github.com/rust-lang/crates.io-index)" = "9c3659d1ee90221741f65dd128d9998311b0e40c5d3c23a62445938214abce4f" +"checksum phf_generator 0.7.23 (registry+https://github.com/rust-lang/crates.io-index)" = "03dc191feb9b08b0dc1330d6549b795b9d81aec19efe6b4a45aec8d4caee0c4b" +"checksum phf_shared 0.7.23 (registry+https://github.com/rust-lang/crates.io-index)" = "b539898d22d4273ded07f64a05737649dc69095d92cb87c7097ec68e3f150b93" +"checksum pkg-config 0.3.14 (registry+https://github.com/rust-lang/crates.io-index)" = "676e8eb2b1b4c9043511a9b7bea0915320d7e502b0a079fb03f9635a5252b18c" +"checksum precomputed-hash 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "925383efa346730478fb4838dbe9137d2a47675ad789c546d150a6e1dd4ab31c" +"checksum pretty_env_logger 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)" = "8ae1b463255bf6613ad435f8997cb57f5d045ef35eb255f5a3d6085be936bd79" +"checksum proc-macro2 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)" = "1b06e2f335f48d24442b35a19df506a835fb3547bc3c06ef27340da9acf5cae7" +"checksum proc-macro2 0.4.15 (registry+https://github.com/rust-lang/crates.io-index)" = "295af93acfb1d5be29c16ca5b3f82d863836efd9cb0c14fd83811eb9a110e452" +"checksum quick-error 1.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "9274b940887ce9addde99c4eee6b5c44cc494b182b97e73dc8ffdcb3397fd3f0" +"checksum quote 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)" = "9949cfe66888ffe1d53e6ec9d9f3b70714083854be20fd5e271b232a017401e8" +"checksum quote 0.6.8 (registry+https://github.com/rust-lang/crates.io-index)" = "dd636425967c33af890042c483632d33fa7a18f19ad1d7ea72e8998c6ef8dea5" +"checksum rand 0.5.5 (registry+https://github.com/rust-lang/crates.io-index)" = "e464cd887e869cddcae8792a4ee31d23c7edd516700695608f5b98c67ee0131c" +"checksum rand_core 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "edecf0f94da5551fc9b492093e30b041a891657db7940ee221f9d2f66e82eef2" +"checksum redox_syscall 0.1.40 (registry+https://github.com/rust-lang/crates.io-index)" = "c214e91d3ecf43e9a4e41e578973adeb14b474f2bee858742d127af75a0112b1" +"checksum redox_termios 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "7e891cfe48e9100a70a3b6eb652fef28920c117d366339687bd5576160db0f76" +"checksum regex 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)" = "9329abc99e39129fcceabd24cf5d85b4671ef7c29c50e972bc5afe32438ec384" +"checksum regex 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)" = "67d0301b0c6804eca7e3c275119d0b01ff3b7ab9258a65709e608a66312a1025" +"checksum regex-syntax 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)" = "8e931c58b93d86f080c734bfd2bce7dd0079ae2331235818133c8be7f422e20e" +"checksum regex-syntax 0.5.6 (registry+https://github.com/rust-lang/crates.io-index)" = "7d707a4fa2637f2dca2ef9fd02225ec7661fe01a53623c1e6515b6916511f7a7" +"checksum regex-syntax 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)" = "747ba3b235651f6e2f67dfa8bcdcd073ddb7c243cb21c442fc12395dfcac212d" +"checksum rustc-demangle 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)" = "bcfe5b13211b4d78e5c2cadfebd7769197d95c639c35a50057eb4c05de811395" +"checksum serde 1.0.75 (registry+https://github.com/rust-lang/crates.io-index)" = "22d340507cea0b7e6632900a176101fea959c7065d93ba555072da90aaaafc87" +"checksum serde_derive 1.0.75 (registry+https://github.com/rust-lang/crates.io-index)" = "234fc8b737737b148ccd625175fc6390f5e4dacfdaa543cb93a3430d984a9119" +"checksum sha2 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)" = "9eb6be24e4c23a84d7184280d2722f7f2731fcdd4a9d886efbfe4413e4847ea0" +"checksum siphasher 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "0b8de496cf83d4ed58b6be86c3a275b8602f6ffe98d3024a869e124147a9a3ac" +"checksum string_cache 0.7.3 (registry+https://github.com/rust-lang/crates.io-index)" = "25d70109977172b127fe834e5449e5ab1740b9ba49fa18a2020f509174f25423" +"checksum string_cache_codegen 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)" = "35293b05cf1494e8ddd042a7df6756bf18d07f42d234f32e71dce8a7aabb0191" +"checksum string_cache_shared 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "b1884d1bc09741d466d9b14e6d37ac89d6909cbcac41dd9ae982d4d063bbedfc" +"checksum strsim 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)" = "b4d15c810519a91cf877e7e36e63fe068815c678181439f2f29e2562147c3694" +"checksum strsim 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "bb4f380125926a99e52bc279241539c018323fab05ad6368b56f93d9369ff550" +"checksum structopt 0.2.10 (registry+https://github.com/rust-lang/crates.io-index)" = "d8e9ad6a11096cbecdcca0cc6aa403fdfdbaeda2fb3323a39c98e6a166a1e45a" +"checksum structopt-derive 0.2.10 (registry+https://github.com/rust-lang/crates.io-index)" = "4cbce8ccdc62166bd594c14396a3242bf94c337a51dbfa9be1076dd74b3db2af" +"checksum syn 0.14.9 (registry+https://github.com/rust-lang/crates.io-index)" = "261ae9ecaa397c42b960649561949d69311f08eeaea86a65696e6e46517cf741" +"checksum synstructure 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "85bb9b7550d063ea184027c9b8c20ac167cd36d3e06b3a40bceb9d746dc1a7b7" +"checksum term 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)" = "fa63644f74ce96fbeb9b794f66aff2a52d601cbd5e80f4b97123e3899f4570f1" +"checksum termcolor 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)" = "ff3bac0e465b59f194e7037ed404b0326e56ff234d767edc4c5cc9cd49e7a2c7" +"checksum termion 1.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "689a3bdfaab439fd92bc87df5c4c78417d3cbe537487274e9b0b2dce76e92096" +"checksum textwrap 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)" = "307686869c93e71f94da64286f9a9524c0f308a9e1c87a583de8e9c9039ad3f6" +"checksum thread_local 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)" = "c6b53e329000edc2b34dbe8545fd20e55a333362d0a321909685a19bd28c3f1b" +"checksum typenum 1.10.0 (registry+https://github.com/rust-lang/crates.io-index)" = "612d636f949607bdf9b123b4a6f6d966dedf3ff669f7f045890d3a4a73948169" +"checksum ucd-util 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "fd2be2d6639d0f8fe6cdda291ad456e23629558d466e2789d2c3e9892bda285d" +"checksum unicode-width 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "882386231c45df4700b275c7ff55b6f3698780a650026380e72dabe76fa46526" +"checksum unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "fc72304796d0818e357ead4e000d19c9c174ab23dc11093ac919054d20a6a7fc" +"checksum unreachable 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "382810877fe448991dfc7f0dd6e3ae5d58088fd0ea5e35189655f84e6814fa56" +"checksum utf8-ranges 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "fd70f467df6810094968e2fce0ee1bd0e87157aceb026a8c083bcf5e25b9efe4" +"checksum vec_map 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)" = "05c78687fb1a80548ae3250346c3db86a80a7cdd77bda190189f2d0a0987c81a" +"checksum version_check 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)" = "7716c242968ee87e5542f8021178248f267f295a5c4803beae8b8b7fd9bc6051" +"checksum void 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "6a02e4885ed3bc0f2de90ea6dd45ebcbb66dacffe03547fadbb0eeae2770887d" +"checksum winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)" = "167dc9d6949a9b857f3451275e911c3f44255842c1f7a76f33c55103a909087a" +"checksum winapi 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)" = "773ef9dcc5f24b7d850d0ff101e542ff24c3b090a9768e03ff889fdef41f00fd" +"checksum winapi-build 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "2d315eee3b34aca4797b2da6b13ed88266e6d612562a0c46390af8299fc699bc" +"checksum winapi-i686-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" +"checksum winapi-util 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "afc5508759c5bf4285e61feb862b6083c8480aec864fa17a81fdec6f69b461ab" +"checksum winapi-x86_64-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" +"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 @@ +[package] +name = "set_eq" +version = "0.1.0" +authors = ["Minijackson "] + +[build-dependencies] +lalrpop = "0.15.2" + +[dependencies] +dbus = "0.6.2" + +clap = { git = "https://github.com/kbknapp/clap-rs", branch = "v3-master" } +clap-verbosity-flag = "0.2" +clap-log-flag = "0.1" +structopt = "0.2" + +log = "0.4.4" +failure = "0.1.2" + +lalrpop-util = "0.15.2" +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 @@ +extern crate lalrpop; + +fn main() { + lalrpop::process_root().unwrap(); +} 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 @@ +// This code was autogenerated with dbus-codegen-rust, see https://github.com/diwic/dbus-rs + +#![allow(dead_code)] +use dbus as dbus; +use dbus::arg; +use dbus::tree; + +pub trait OrgPulseAudioExtEqualizing1Manager { + type Err; + fn remove_profile(&self, name: &str) -> Result<(), Self::Err>; + fn get_interface_revision(&self) -> Result; + fn get_equalized_sinks(&self) -> Result>, Self::Err>; + fn get_profiles(&self) -> Result, Self::Err>; +} + +impl<'a, C: ::std::ops::Deref> OrgPulseAudioExtEqualizing1Manager for dbus::ConnPath<'a, C> { + type Err = dbus::Error; + + fn remove_profile(&self, name: &str) -> Result<(), Self::Err> { + let mut m = try!(self.method_call_with_args(&"org.PulseAudio.Ext.Equalizing1.Manager".into(), &"RemoveProfile".into(), |msg| { + let mut i = arg::IterAppend::new(msg); + i.append(name); + })); + try!(m.as_result()); + Ok(()) + } + + fn get_interface_revision(&self) -> Result { + ::get(&self, "org.PulseAudio.Ext.Equalizing1.Manager", "InterfaceRevision") + } + + fn get_equalized_sinks(&self) -> Result>, Self::Err> { + ::get(&self, "org.PulseAudio.Ext.Equalizing1.Manager", "EqualizedSinks") + } + + fn get_profiles(&self) -> Result, Self::Err> { + ::get(&self, "org.PulseAudio.Ext.Equalizing1.Manager", "Profiles") + } +} + +pub fn org_pulse_audio_ext_equalizing1_manager_server(factory: &tree::Factory, D>, data: D::Interface, f: F) -> tree::Interface, D> +where + D: tree::DataType, + D::Method: Default, + D::Property: Default, + T: OrgPulseAudioExtEqualizing1Manager, + F: 'static + for <'z> Fn(& 'z tree::MethodInfo, D>) -> & 'z T, +{ + let i = factory.interface("org.PulseAudio.Ext.Equalizing1.Manager", data); + let f = ::std::sync::Arc::new(f); + let fclone = f.clone(); + let h = move |minfo: &tree::MethodInfo, D>| { + let mut i = minfo.msg.iter_init(); + let name: &str = try!(i.read()); + let d = fclone(minfo); + try!(d.remove_profile(name)); + let rm = minfo.msg.method_return(); + Ok(vec!(rm)) + }; + let m = factory.method("RemoveProfile", Default::default(), h); + let m = m.in_arg(("name", "s")); + let i = i.add_m(m); + + let p = factory.property::("InterfaceRevision", Default::default()); + let p = p.access(tree::Access::Read); + let fclone = f.clone(); + let p = p.on_get(move |a, pinfo| { + let minfo = pinfo.to_method_info(); + let d = fclone(&minfo); + a.append(try!(d.get_interface_revision())); + Ok(()) + }); + let i = i.add_p(p); + + let p = factory.property::, _>("EqualizedSinks", Default::default()); + let p = p.access(tree::Access::Read); + let fclone = f.clone(); + let p = p.on_get(move |a, pinfo| { + let minfo = pinfo.to_method_info(); + let d = fclone(&minfo); + a.append(try!(d.get_equalized_sinks())); + Ok(()) + }); + let i = i.add_p(p); + + let p = factory.property::, _>("Profiles", Default::default()); + let p = p.access(tree::Access::Read); + let fclone = f.clone(); + let p = p.on_get(move |a, pinfo| { + let minfo = pinfo.to_method_info(); + let d = fclone(&minfo); + a.append(try!(d.get_profiles())); + Ok(()) + }); + let i = i.add_p(p); + i +} + +#[derive(Debug, Default)] +pub struct OrgPulseAudioExtEqualizing1ManagerSinkAdded { + pub sink: dbus::Path<'static>, +} + +impl dbus::SignalArgs for OrgPulseAudioExtEqualizing1ManagerSinkAdded { + const NAME: &'static str = "SinkAdded"; + const INTERFACE: &'static str = "org.PulseAudio.Ext.Equalizing1.Manager"; + fn append(&self, i: &mut arg::IterAppend) { + (&self.sink as &arg::RefArg).append(i); + } + fn get(&mut self, i: &mut arg::Iter) -> Result<(), arg::TypeMismatchError> { + self.sink = try!(i.read()); + Ok(()) + } +} + +#[derive(Debug, Default)] +pub struct OrgPulseAudioExtEqualizing1ManagerSinkRemoved { + pub sink: dbus::Path<'static>, +} + +impl dbus::SignalArgs for OrgPulseAudioExtEqualizing1ManagerSinkRemoved { + const NAME: &'static str = "SinkRemoved"; + const INTERFACE: &'static str = "org.PulseAudio.Ext.Equalizing1.Manager"; + fn append(&self, i: &mut arg::IterAppend) { + (&self.sink as &arg::RefArg).append(i); + } + fn get(&mut self, i: &mut arg::Iter) -> Result<(), arg::TypeMismatchError> { + self.sink = try!(i.read()); + Ok(()) + } +} + +#[derive(Debug, Default)] +pub struct OrgPulseAudioExtEqualizing1ManagerProfilesChanged { +} + +impl dbus::SignalArgs for OrgPulseAudioExtEqualizing1ManagerProfilesChanged { + const NAME: &'static str = "ProfilesChanged"; + const INTERFACE: &'static str = "org.PulseAudio.Ext.Equalizing1.Manager"; + fn append(&self, _: &mut arg::IterAppend) { + } + fn get(&mut self, _: &mut arg::Iter) -> Result<(), arg::TypeMismatchError> { + Ok(()) + } +} + +pub trait OrgFreedesktopDBusIntrospectable { + type Err; + fn introspect(&self) -> Result; +} + +impl<'a, C: ::std::ops::Deref> OrgFreedesktopDBusIntrospectable for dbus::ConnPath<'a, C> { + type Err = dbus::Error; + + fn introspect(&self) -> Result { + let mut m = try!(self.method_call_with_args(&"org.freedesktop.DBus.Introspectable".into(), &"Introspect".into(), |_| { + })); + try!(m.as_result()); + let mut i = m.iter_init(); + let data: String = try!(i.read()); + Ok(data) + } +} + +pub fn org_freedesktop_dbus_introspectable_server(factory: &tree::Factory, D>, data: D::Interface, f: F) -> tree::Interface, D> +where + D: tree::DataType, + D::Method: Default, + T: OrgFreedesktopDBusIntrospectable, + F: 'static + for <'z> Fn(& 'z tree::MethodInfo, D>) -> & 'z T, +{ + let i = factory.interface("org.freedesktop.DBus.Introspectable", data); + let f = ::std::sync::Arc::new(f); + let fclone = f.clone(); + let h = move |minfo: &tree::MethodInfo, D>| { + let d = fclone(minfo); + let data = try!(d.introspect()); + let rm = minfo.msg.method_return(); + let rm = rm.append1(data); + Ok(vec!(rm)) + }; + let m = factory.method("Introspect", Default::default(), h); + let m = m.out_arg(("data", "s")); + let i = i.add_m(m); + i +} + +pub trait OrgFreedesktopDBusProperties { + type Err; + fn get(&self, interface_name: &str, property_name: &str) -> Result>, Self::Err>; + fn set(&self, interface_name: &str, property_name: &str, value: arg::Variant>) -> Result<(), Self::Err>; + fn get_all(&self, interface_name: &str) -> Result<::std::collections::HashMap>>, Self::Err>; +} + +impl<'a, C: ::std::ops::Deref> OrgFreedesktopDBusProperties for dbus::ConnPath<'a, C> { + type Err = dbus::Error; + + fn get(&self, interface_name: &str, property_name: &str) -> Result>, Self::Err> { + let mut m = try!(self.method_call_with_args(&"org.freedesktop.DBus.Properties".into(), &"Get".into(), |msg| { + let mut i = arg::IterAppend::new(msg); + i.append(interface_name); + i.append(property_name); + })); + try!(m.as_result()); + let mut i = m.iter_init(); + let value: arg::Variant> = try!(i.read()); + Ok(value) + } + + fn set(&self, interface_name: &str, property_name: &str, value: arg::Variant>) -> Result<(), Self::Err> { + let mut m = try!(self.method_call_with_args(&"org.freedesktop.DBus.Properties".into(), &"Set".into(), |msg| { + let mut i = arg::IterAppend::new(msg); + i.append(interface_name); + i.append(property_name); + i.append(value); + })); + try!(m.as_result()); + Ok(()) + } + + fn get_all(&self, interface_name: &str) -> Result<::std::collections::HashMap>>, Self::Err> { + let mut m = try!(self.method_call_with_args(&"org.freedesktop.DBus.Properties".into(), &"GetAll".into(), |msg| { + let mut i = arg::IterAppend::new(msg); + i.append(interface_name); + })); + try!(m.as_result()); + let mut i = m.iter_init(); + let props: ::std::collections::HashMap>> = try!(i.read()); + Ok(props) + } +} + +pub fn org_freedesktop_dbus_properties_server(factory: &tree::Factory, D>, data: D::Interface, f: F) -> tree::Interface, D> +where + D: tree::DataType, + D::Method: Default, + T: OrgFreedesktopDBusProperties, + F: 'static + for <'z> Fn(& 'z tree::MethodInfo, D>) -> & 'z T, +{ + let i = factory.interface("org.freedesktop.DBus.Properties", data); + let f = ::std::sync::Arc::new(f); + let fclone = f.clone(); + let h = move |minfo: &tree::MethodInfo, D>| { + let mut i = minfo.msg.iter_init(); + let interface_name: &str = try!(i.read()); + let property_name: &str = try!(i.read()); + let d = fclone(minfo); + let value = try!(d.get(interface_name, property_name)); + let rm = minfo.msg.method_return(); + let rm = rm.append1(value); + Ok(vec!(rm)) + }; + let m = factory.method("Get", Default::default(), h); + let m = m.in_arg(("interface_name", "s")); + let m = m.in_arg(("property_name", "s")); + let m = m.out_arg(("value", "v")); + let i = i.add_m(m); + + let fclone = f.clone(); + let h = move |minfo: &tree::MethodInfo, D>| { + let mut i = minfo.msg.iter_init(); + let interface_name: &str = try!(i.read()); + let property_name: &str = try!(i.read()); + let value: arg::Variant> = try!(i.read()); + let d = fclone(minfo); + try!(d.set(interface_name, property_name, value)); + let rm = minfo.msg.method_return(); + Ok(vec!(rm)) + }; + let m = factory.method("Set", Default::default(), h); + let m = m.in_arg(("interface_name", "s")); + let m = m.in_arg(("property_name", "s")); + let m = m.in_arg(("value", "v")); + let i = i.add_m(m); + + let fclone = f.clone(); + let h = move |minfo: &tree::MethodInfo, D>| { + let mut i = minfo.msg.iter_init(); + let interface_name: &str = try!(i.read()); + let d = fclone(minfo); + let props = try!(d.get_all(interface_name)); + let rm = minfo.msg.method_return(); + let rm = rm.append1(props); + Ok(vec!(rm)) + }; + let m = factory.method("GetAll", Default::default(), h); + let m = m.in_arg(("interface_name", "s")); + let m = m.out_arg(("props", "a{sv}")); + let i = i.add_m(m); + i +} 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 @@ +pub mod equalizing_manager; +pub mod server_lookup; +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 @@ +// This code was autogenerated with dbus-codegen-rust, see https://github.com/diwic/dbus-rs + +#![allow(dead_code)] +use dbus as dbus; +use dbus::arg; +use dbus::tree; + +pub trait OrgPulseAudioServerLookup1 { + type Err; + fn get_address(&self) -> Result; +} + +impl<'a, C: ::std::ops::Deref> OrgPulseAudioServerLookup1 for dbus::ConnPath<'a, C> { + type Err = dbus::Error; + + fn get_address(&self) -> Result { + ::get(&self, "org.PulseAudio.ServerLookup1", "Address") + } +} + +pub fn org_pulse_audio_server_lookup1_server(factory: &tree::Factory, D>, data: D::Interface, f: F) -> tree::Interface, D> +where + D: tree::DataType, + D::Method: Default, + D::Property: Default, + T: OrgPulseAudioServerLookup1, + F: 'static + for <'z> Fn(& 'z tree::MethodInfo, D>) -> & 'z T, +{ + let i = factory.interface("org.PulseAudio.ServerLookup1", data); + let f = ::std::sync::Arc::new(f); + let p = factory.property::<&str, _>("Address", Default::default()); + let p = p.access(tree::Access::Read); + let fclone = f.clone(); + let p = p.on_get(move |a, pinfo| { + let minfo = pinfo.to_method_info(); + let d = fclone(&minfo); + a.append(try!(d.get_address())); + Ok(()) + }); + let i = i.add_p(p); + i +} + +pub trait OrgFreedesktopDBusIntrospectable { + type Err; + fn introspect(&self) -> Result; +} + +impl<'a, C: ::std::ops::Deref> OrgFreedesktopDBusIntrospectable for dbus::ConnPath<'a, C> { + type Err = dbus::Error; + + fn introspect(&self) -> Result { + let mut m = try!(self.method_call_with_args(&"org.freedesktop.DBus.Introspectable".into(), &"Introspect".into(), |_| { + })); + try!(m.as_result()); + let mut i = m.iter_init(); + let data: String = try!(i.read()); + Ok(data) + } +} + +pub fn org_freedesktop_dbus_introspectable_server(factory: &tree::Factory, D>, data: D::Interface, f: F) -> tree::Interface, D> +where + D: tree::DataType, + D::Method: Default, + T: OrgFreedesktopDBusIntrospectable, + F: 'static + for <'z> Fn(& 'z tree::MethodInfo, D>) -> & 'z T, +{ + let i = factory.interface("org.freedesktop.DBus.Introspectable", data); + let f = ::std::sync::Arc::new(f); + let fclone = f.clone(); + let h = move |minfo: &tree::MethodInfo, D>| { + let d = fclone(minfo); + let data = try!(d.introspect()); + let rm = minfo.msg.method_return(); + let rm = rm.append1(data); + Ok(vec!(rm)) + }; + let m = factory.method("Introspect", Default::default(), h); + let m = m.out_arg(("data", "s")); + let i = i.add_m(m); + i +} + +pub trait OrgFreedesktopDBusProperties { + type Err; + fn get(&self, interface_name: &str, property_name: &str) -> Result>, Self::Err>; + fn set(&self, interface_name: &str, property_name: &str, value: arg::Variant>) -> Result<(), Self::Err>; + fn get_all(&self, interface_name: &str) -> Result<::std::collections::HashMap>>, Self::Err>; +} + +impl<'a, C: ::std::ops::Deref> OrgFreedesktopDBusProperties for dbus::ConnPath<'a, C> { + type Err = dbus::Error; + + fn get(&self, interface_name: &str, property_name: &str) -> Result>, Self::Err> { + let mut m = try!(self.method_call_with_args(&"org.freedesktop.DBus.Properties".into(), &"Get".into(), |msg| { + let mut i = arg::IterAppend::new(msg); + i.append(interface_name); + i.append(property_name); + })); + try!(m.as_result()); + let mut i = m.iter_init(); + let value: arg::Variant> = try!(i.read()); + Ok(value) + } + + fn set(&self, interface_name: &str, property_name: &str, value: arg::Variant>) -> Result<(), Self::Err> { + let mut m = try!(self.method_call_with_args(&"org.freedesktop.DBus.Properties".into(), &"Set".into(), |msg| { + let mut i = arg::IterAppend::new(msg); + i.append(interface_name); + i.append(property_name); + i.append(value); + })); + try!(m.as_result()); + Ok(()) + } + + fn get_all(&self, interface_name: &str) -> Result<::std::collections::HashMap>>, Self::Err> { + let mut m = try!(self.method_call_with_args(&"org.freedesktop.DBus.Properties".into(), &"GetAll".into(), |msg| { + let mut i = arg::IterAppend::new(msg); + i.append(interface_name); + })); + try!(m.as_result()); + let mut i = m.iter_init(); + let props: ::std::collections::HashMap>> = try!(i.read()); + Ok(props) + } +} + +pub fn org_freedesktop_dbus_properties_server(factory: &tree::Factory, D>, data: D::Interface, f: F) -> tree::Interface, D> +where + D: tree::DataType, + D::Method: Default, + T: OrgFreedesktopDBusProperties, + F: 'static + for <'z> Fn(& 'z tree::MethodInfo, D>) -> & 'z T, +{ + let i = factory.interface("org.freedesktop.DBus.Properties", data); + let f = ::std::sync::Arc::new(f); + let fclone = f.clone(); + let h = move |minfo: &tree::MethodInfo, D>| { + let mut i = minfo.msg.iter_init(); + let interface_name: &str = try!(i.read()); + let property_name: &str = try!(i.read()); + let d = fclone(minfo); + let value = try!(d.get(interface_name, property_name)); + let rm = minfo.msg.method_return(); + let rm = rm.append1(value); + Ok(vec!(rm)) + }; + let m = factory.method("Get", Default::default(), h); + let m = m.in_arg(("interface_name", "s")); + let m = m.in_arg(("property_name", "s")); + let m = m.out_arg(("value", "v")); + let i = i.add_m(m); + + let fclone = f.clone(); + let h = move |minfo: &tree::MethodInfo, D>| { + let mut i = minfo.msg.iter_init(); + let interface_name: &str = try!(i.read()); + let property_name: &str = try!(i.read()); + let value: arg::Variant> = try!(i.read()); + let d = fclone(minfo); + try!(d.set(interface_name, property_name, value)); + let rm = minfo.msg.method_return(); + Ok(vec!(rm)) + }; + let m = factory.method("Set", Default::default(), h); + let m = m.in_arg(("interface_name", "s")); + let m = m.in_arg(("property_name", "s")); + let m = m.in_arg(("value", "v")); + let i = i.add_m(m); + + let fclone = f.clone(); + let h = move |minfo: &tree::MethodInfo, D>| { + let mut i = minfo.msg.iter_init(); + let interface_name: &str = try!(i.read()); + let d = fclone(minfo); + let props = try!(d.get_all(interface_name)); + let rm = minfo.msg.method_return(); + let rm = rm.append1(props); + Ok(vec!(rm)) + }; + let m = factory.method("GetAll", Default::default(), h); + let m = m.in_arg(("interface_name", "s")); + let m = m.out_arg(("props", "a{sv}")); + let i = i.add_m(m); + i +} 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 @@ +// This code was autogenerated with dbus-codegen-rust, see https://github.com/diwic/dbus-rs + +#![allow(dead_code)] +use dbus as dbus; +use dbus::arg; +use dbus::tree; + +pub trait OrgPulseAudioExtEqualizing1Equalizer { + type Err; + fn filter_at_points(&self, channel: u32, xs: Vec) -> Result<(Vec, f64), Self::Err>; + fn seed_filter(&self, channel: u32, xs: Vec, ys: Vec, preamp: f64) -> Result<(), Self::Err>; + fn save_profile(&self, channel: u32, name: &str) -> Result<(), Self::Err>; + fn load_profile(&self, channel: u32, name: &str) -> Result<(), Self::Err>; + fn set_filter(&self, channel: u32, ys: Vec, preamp: f64) -> Result<(), Self::Err>; + fn get_filter(&self, channel: u32) -> Result<(Vec, f64), Self::Err>; + fn save_state(&self) -> Result<(), Self::Err>; + fn base_profile(&self, channel: u32) -> Result; + fn get_interface_revision(&self) -> Result; + fn get_sample_rate(&self) -> Result; + fn get_filter_sample_rate(&self) -> Result; + fn get_nfilter_coefficients(&self) -> Result; + fn get_nchannels(&self) -> Result; +} + +impl<'a, C: ::std::ops::Deref> OrgPulseAudioExtEqualizing1Equalizer for dbus::ConnPath<'a, C> { + type Err = dbus::Error; + + fn filter_at_points(&self, channel: u32, xs: Vec) -> Result<(Vec, f64), Self::Err> { + let mut m = try!(self.method_call_with_args(&"org.PulseAudio.Ext.Equalizing1.Equalizer".into(), &"FilterAtPoints".into(), |msg| { + let mut i = arg::IterAppend::new(msg); + i.append(channel); + i.append(xs); + })); + try!(m.as_result()); + let mut i = m.iter_init(); + let ys: Vec = try!(i.read()); + let preamp: f64 = try!(i.read()); + Ok((ys, preamp)) + } + + fn seed_filter(&self, channel: u32, xs: Vec, ys: Vec, preamp: f64) -> Result<(), Self::Err> { + let mut m = try!(self.method_call_with_args(&"org.PulseAudio.Ext.Equalizing1.Equalizer".into(), &"SeedFilter".into(), |msg| { + let mut i = arg::IterAppend::new(msg); + i.append(channel); + i.append(xs); + i.append(ys); + i.append(preamp); + })); + try!(m.as_result()); + Ok(()) + } + + fn save_profile(&self, channel: u32, name: &str) -> Result<(), Self::Err> { + let mut m = try!(self.method_call_with_args(&"org.PulseAudio.Ext.Equalizing1.Equalizer".into(), &"SaveProfile".into(), |msg| { + let mut i = arg::IterAppend::new(msg); + i.append(channel); + i.append(name); + })); + try!(m.as_result()); + Ok(()) + } + + fn load_profile(&self, channel: u32, name: &str) -> Result<(), Self::Err> { + let mut m = try!(self.method_call_with_args(&"org.PulseAudio.Ext.Equalizing1.Equalizer".into(), &"LoadProfile".into(), |msg| { + let mut i = arg::IterAppend::new(msg); + i.append(channel); + i.append(name); + })); + try!(m.as_result()); + Ok(()) + } + + fn set_filter(&self, channel: u32, ys: Vec, preamp: f64) -> Result<(), Self::Err> { + let mut m = try!(self.method_call_with_args(&"org.PulseAudio.Ext.Equalizing1.Equalizer".into(), &"SetFilter".into(), |msg| { + let mut i = arg::IterAppend::new(msg); + i.append(channel); + i.append(ys); + i.append(preamp); + })); + try!(m.as_result()); + Ok(()) + } + + fn get_filter(&self, channel: u32) -> Result<(Vec, f64), Self::Err> { + let mut m = try!(self.method_call_with_args(&"org.PulseAudio.Ext.Equalizing1.Equalizer".into(), &"GetFilter".into(), |msg| { + let mut i = arg::IterAppend::new(msg); + i.append(channel); + })); + try!(m.as_result()); + let mut i = m.iter_init(); + let ys: Vec = try!(i.read()); + let preamp: f64 = try!(i.read()); + Ok((ys, preamp)) + } + + fn save_state(&self) -> Result<(), Self::Err> { + let mut m = try!(self.method_call_with_args(&"org.PulseAudio.Ext.Equalizing1.Equalizer".into(), &"SaveState".into(), |_| { + })); + try!(m.as_result()); + Ok(()) + } + + fn base_profile(&self, channel: u32) -> Result { + let mut m = try!(self.method_call_with_args(&"org.PulseAudio.Ext.Equalizing1.Equalizer".into(), &"BaseProfile".into(), |msg| { + let mut i = arg::IterAppend::new(msg); + i.append(channel); + })); + try!(m.as_result()); + let mut i = m.iter_init(); + let name: String = try!(i.read()); + Ok(name) + } + + fn get_interface_revision(&self) -> Result { + ::get(&self, "org.PulseAudio.Ext.Equalizing1.Equalizer", "InterfaceRevision") + } + + fn get_sample_rate(&self) -> Result { + ::get(&self, "org.PulseAudio.Ext.Equalizing1.Equalizer", "SampleRate") + } + + fn get_filter_sample_rate(&self) -> Result { + ::get(&self, "org.PulseAudio.Ext.Equalizing1.Equalizer", "FilterSampleRate") + } + + fn get_nfilter_coefficients(&self) -> Result { + ::get(&self, "org.PulseAudio.Ext.Equalizing1.Equalizer", "NFilterCoefficients") + } + + fn get_nchannels(&self) -> Result { + ::get(&self, "org.PulseAudio.Ext.Equalizing1.Equalizer", "NChannels") + } +} + +pub fn org_pulse_audio_ext_equalizing1_equalizer_server(factory: &tree::Factory, D>, data: D::Interface, f: F) -> tree::Interface, D> +where + D: tree::DataType, + D::Method: Default, + D::Property: Default, + T: OrgPulseAudioExtEqualizing1Equalizer, + F: 'static + for <'z> Fn(& 'z tree::MethodInfo, D>) -> & 'z T, +{ + let i = factory.interface("org.PulseAudio.Ext.Equalizing1.Equalizer", data); + let f = ::std::sync::Arc::new(f); + let fclone = f.clone(); + let h = move |minfo: &tree::MethodInfo, D>| { + let mut i = minfo.msg.iter_init(); + let channel: u32 = try!(i.read()); + let xs: Vec = try!(i.read()); + let d = fclone(minfo); + let (ys, preamp) = try!(d.filter_at_points(channel, xs)); + let rm = minfo.msg.method_return(); + let rm = rm.append1(ys); + let rm = rm.append1(preamp); + Ok(vec!(rm)) + }; + let m = factory.method("FilterAtPoints", Default::default(), h); + let m = m.in_arg(("channel", "u")); + let m = m.in_arg(("xs", "au")); + let m = m.out_arg(("ys", "ad")); + let m = m.out_arg(("preamp", "d")); + let i = i.add_m(m); + + let fclone = f.clone(); + let h = move |minfo: &tree::MethodInfo, D>| { + let mut i = minfo.msg.iter_init(); + let channel: u32 = try!(i.read()); + let xs: Vec = try!(i.read()); + let ys: Vec = try!(i.read()); + let preamp: f64 = try!(i.read()); + let d = fclone(minfo); + try!(d.seed_filter(channel, xs, ys, preamp)); + let rm = minfo.msg.method_return(); + Ok(vec!(rm)) + }; + let m = factory.method("SeedFilter", Default::default(), h); + let m = m.in_arg(("channel", "u")); + let m = m.in_arg(("xs", "au")); + let m = m.in_arg(("ys", "ad")); + let m = m.in_arg(("preamp", "d")); + let i = i.add_m(m); + + let fclone = f.clone(); + let h = move |minfo: &tree::MethodInfo, D>| { + let mut i = minfo.msg.iter_init(); + let channel: u32 = try!(i.read()); + let name: &str = try!(i.read()); + let d = fclone(minfo); + try!(d.save_profile(channel, name)); + let rm = minfo.msg.method_return(); + Ok(vec!(rm)) + }; + let m = factory.method("SaveProfile", Default::default(), h); + let m = m.in_arg(("channel", "u")); + let m = m.in_arg(("name", "s")); + let i = i.add_m(m); + + let fclone = f.clone(); + let h = move |minfo: &tree::MethodInfo, D>| { + let mut i = minfo.msg.iter_init(); + let channel: u32 = try!(i.read()); + let name: &str = try!(i.read()); + let d = fclone(minfo); + try!(d.load_profile(channel, name)); + let rm = minfo.msg.method_return(); + Ok(vec!(rm)) + }; + let m = factory.method("LoadProfile", Default::default(), h); + let m = m.in_arg(("channel", "u")); + let m = m.in_arg(("name", "s")); + let i = i.add_m(m); + + let fclone = f.clone(); + let h = move |minfo: &tree::MethodInfo, D>| { + let mut i = minfo.msg.iter_init(); + let channel: u32 = try!(i.read()); + let ys: Vec = try!(i.read()); + let preamp: f64 = try!(i.read()); + let d = fclone(minfo); + try!(d.set_filter(channel, ys, preamp)); + let rm = minfo.msg.method_return(); + Ok(vec!(rm)) + }; + let m = factory.method("SetFilter", Default::default(), h); + let m = m.in_arg(("channel", "u")); + let m = m.in_arg(("ys", "ad")); + let m = m.in_arg(("preamp", "d")); + let i = i.add_m(m); + + let fclone = f.clone(); + let h = move |minfo: &tree::MethodInfo, D>| { + let mut i = minfo.msg.iter_init(); + let channel: u32 = try!(i.read()); + let d = fclone(minfo); + let (ys, preamp) = try!(d.get_filter(channel)); + let rm = minfo.msg.method_return(); + let rm = rm.append1(ys); + let rm = rm.append1(preamp); + Ok(vec!(rm)) + }; + let m = factory.method("GetFilter", Default::default(), h); + let m = m.in_arg(("channel", "u")); + let m = m.out_arg(("ys", "ad")); + let m = m.out_arg(("preamp", "d")); + let i = i.add_m(m); + + let fclone = f.clone(); + let h = move |minfo: &tree::MethodInfo, D>| { + let d = fclone(minfo); + try!(d.save_state()); + let rm = minfo.msg.method_return(); + Ok(vec!(rm)) + }; + let m = factory.method("SaveState", Default::default(), h); + let i = i.add_m(m); + + let fclone = f.clone(); + let h = move |minfo: &tree::MethodInfo, D>| { + let mut i = minfo.msg.iter_init(); + let channel: u32 = try!(i.read()); + let d = fclone(minfo); + let name = try!(d.base_profile(channel)); + let rm = minfo.msg.method_return(); + let rm = rm.append1(name); + Ok(vec!(rm)) + }; + let m = factory.method("BaseProfile", Default::default(), h); + let m = m.in_arg(("channel", "u")); + let m = m.out_arg(("name", "s")); + let i = i.add_m(m); + + let p = factory.property::("InterfaceRevision", Default::default()); + let p = p.access(tree::Access::Read); + let fclone = f.clone(); + let p = p.on_get(move |a, pinfo| { + let minfo = pinfo.to_method_info(); + let d = fclone(&minfo); + a.append(try!(d.get_interface_revision())); + Ok(()) + }); + let i = i.add_p(p); + + let p = factory.property::("SampleRate", Default::default()); + let p = p.access(tree::Access::Read); + let fclone = f.clone(); + let p = p.on_get(move |a, pinfo| { + let minfo = pinfo.to_method_info(); + let d = fclone(&minfo); + a.append(try!(d.get_sample_rate())); + Ok(()) + }); + let i = i.add_p(p); + + let p = factory.property::("FilterSampleRate", Default::default()); + let p = p.access(tree::Access::Read); + let fclone = f.clone(); + let p = p.on_get(move |a, pinfo| { + let minfo = pinfo.to_method_info(); + let d = fclone(&minfo); + a.append(try!(d.get_filter_sample_rate())); + Ok(()) + }); + let i = i.add_p(p); + + let p = factory.property::("NFilterCoefficients", Default::default()); + let p = p.access(tree::Access::Read); + let fclone = f.clone(); + let p = p.on_get(move |a, pinfo| { + let minfo = pinfo.to_method_info(); + let d = fclone(&minfo); + a.append(try!(d.get_nfilter_coefficients())); + Ok(()) + }); + let i = i.add_p(p); + + let p = factory.property::("NChannels", Default::default()); + let p = p.access(tree::Access::Read); + let fclone = f.clone(); + let p = p.on_get(move |a, pinfo| { + let minfo = pinfo.to_method_info(); + let d = fclone(&minfo); + a.append(try!(d.get_nchannels())); + Ok(()) + }); + let i = i.add_p(p); + i +} + +#[derive(Debug, Default)] +pub struct OrgPulseAudioExtEqualizing1EqualizerFilterChanged { +} + +impl dbus::SignalArgs for OrgPulseAudioExtEqualizing1EqualizerFilterChanged { + const NAME: &'static str = "FilterChanged"; + const INTERFACE: &'static str = "org.PulseAudio.Ext.Equalizing1.Equalizer"; + fn append(&self, _: &mut arg::IterAppend) { + } + fn get(&mut self, _: &mut arg::Iter) -> Result<(), arg::TypeMismatchError> { + Ok(()) + } +} + +#[derive(Debug, Default)] +pub struct OrgPulseAudioExtEqualizing1EqualizerSinkReconfigured { +} + +impl dbus::SignalArgs for OrgPulseAudioExtEqualizing1EqualizerSinkReconfigured { + const NAME: &'static str = "SinkReconfigured"; + const INTERFACE: &'static str = "org.PulseAudio.Ext.Equalizing1.Equalizer"; + fn append(&self, _: &mut arg::IterAppend) { + } + fn get(&mut self, _: &mut arg::Iter) -> Result<(), arg::TypeMismatchError> { + Ok(()) + } +} + +pub trait OrgPulseAudioCore1Device { + type Err; + fn suspend(&self, suspend: bool) -> Result<(), Self::Err>; + fn get_port_by_name(&self, name: &str) -> Result, Self::Err>; + fn get_index(&self) -> Result; + fn get_name(&self) -> Result; + fn get_driver(&self) -> Result; + fn get_owner_module(&self) -> Result, Self::Err>; + fn get_card(&self) -> Result, Self::Err>; + fn get_sample_format(&self) -> Result; + fn get_sample_rate(&self) -> Result; + fn get_channels(&self) -> Result, Self::Err>; + fn get_volume(&self) -> Result, Self::Err>; + fn set_volume(&self, value: Vec) -> Result<(), Self::Err>; + fn get_has_flat_volume(&self) -> Result; + fn get_has_convertible_to_decibel_volume(&self) -> Result; + fn get_base_volume(&self) -> Result; + fn get_volume_steps(&self) -> Result; + fn get_mute(&self) -> Result; + fn set_mute(&self, value: bool) -> Result<(), Self::Err>; + fn get_has_hardware_volume(&self) -> Result; + fn get_has_hardware_mute(&self) -> Result; + fn get_configured_latency(&self) -> Result; + fn get_has_dynamic_latency(&self) -> Result; + fn get_latency(&self) -> Result; + fn get_is_hardware_device(&self) -> Result; + fn get_is_network_device(&self) -> Result; + fn get_state(&self) -> Result; + fn get_ports(&self) -> Result>, Self::Err>; + fn get_active_port(&self) -> Result, Self::Err>; + fn set_active_port(&self, value: dbus::Path<'static>) -> Result<(), Self::Err>; + fn get_property_list(&self) -> Result<::std::collections::HashMap>, Self::Err>; +} + +impl<'a, C: ::std::ops::Deref> OrgPulseAudioCore1Device for dbus::ConnPath<'a, C> { + type Err = dbus::Error; + + fn suspend(&self, suspend: bool) -> Result<(), Self::Err> { + let mut m = try!(self.method_call_with_args(&"org.PulseAudio.Core1.Device".into(), &"Suspend".into(), |msg| { + let mut i = arg::IterAppend::new(msg); + i.append(suspend); + })); + try!(m.as_result()); + Ok(()) + } + + fn get_port_by_name(&self, name: &str) -> Result, Self::Err> { + let mut m = try!(self.method_call_with_args(&"org.PulseAudio.Core1.Device".into(), &"GetPortByName".into(), |msg| { + let mut i = arg::IterAppend::new(msg); + i.append(name); + })); + try!(m.as_result()); + let mut i = m.iter_init(); + let port: dbus::Path<'static> = try!(i.read()); + Ok(port) + } + + fn get_index(&self) -> Result { + ::get(&self, "org.PulseAudio.Core1.Device", "Index") + } + + fn get_name(&self) -> Result { + ::get(&self, "org.PulseAudio.Core1.Device", "Name") + } + + fn get_driver(&self) -> Result { + ::get(&self, "org.PulseAudio.Core1.Device", "Driver") + } + + fn get_owner_module(&self) -> Result, Self::Err> { + ::get(&self, "org.PulseAudio.Core1.Device", "OwnerModule") + } + + fn get_card(&self) -> Result, Self::Err> { + ::get(&self, "org.PulseAudio.Core1.Device", "Card") + } + + fn get_sample_format(&self) -> Result { + ::get(&self, "org.PulseAudio.Core1.Device", "SampleFormat") + } + + fn get_sample_rate(&self) -> Result { + ::get(&self, "org.PulseAudio.Core1.Device", "SampleRate") + } + + fn get_channels(&self) -> Result, Self::Err> { + ::get(&self, "org.PulseAudio.Core1.Device", "Channels") + } + + fn get_volume(&self) -> Result, Self::Err> { + ::get(&self, "org.PulseAudio.Core1.Device", "Volume") + } + + fn get_has_flat_volume(&self) -> Result { + ::get(&self, "org.PulseAudio.Core1.Device", "HasFlatVolume") + } + + fn get_has_convertible_to_decibel_volume(&self) -> Result { + ::get(&self, "org.PulseAudio.Core1.Device", "HasConvertibleToDecibelVolume") + } + + fn get_base_volume(&self) -> Result { + ::get(&self, "org.PulseAudio.Core1.Device", "BaseVolume") + } + + fn get_volume_steps(&self) -> Result { + ::get(&self, "org.PulseAudio.Core1.Device", "VolumeSteps") + } + + fn get_mute(&self) -> Result { + ::get(&self, "org.PulseAudio.Core1.Device", "Mute") + } + + fn get_has_hardware_volume(&self) -> Result { + ::get(&self, "org.PulseAudio.Core1.Device", "HasHardwareVolume") + } + + fn get_has_hardware_mute(&self) -> Result { + ::get(&self, "org.PulseAudio.Core1.Device", "HasHardwareMute") + } + + fn get_configured_latency(&self) -> Result { + ::get(&self, "org.PulseAudio.Core1.Device", "ConfiguredLatency") + } + + fn get_has_dynamic_latency(&self) -> Result { + ::get(&self, "org.PulseAudio.Core1.Device", "HasDynamicLatency") + } + + fn get_latency(&self) -> Result { + ::get(&self, "org.PulseAudio.Core1.Device", "Latency") + } + + fn get_is_hardware_device(&self) -> Result { + ::get(&self, "org.PulseAudio.Core1.Device", "IsHardwareDevice") + } + + fn get_is_network_device(&self) -> Result { + ::get(&self, "org.PulseAudio.Core1.Device", "IsNetworkDevice") + } + + fn get_state(&self) -> Result { + ::get(&self, "org.PulseAudio.Core1.Device", "State") + } + + fn get_ports(&self) -> Result>, Self::Err> { + ::get(&self, "org.PulseAudio.Core1.Device", "Ports") + } + + fn get_active_port(&self) -> Result, Self::Err> { + ::get(&self, "org.PulseAudio.Core1.Device", "ActivePort") + } + + fn get_property_list(&self) -> Result<::std::collections::HashMap>, Self::Err> { + ::get(&self, "org.PulseAudio.Core1.Device", "PropertyList") + } + + fn set_volume(&self, value: Vec) -> Result<(), Self::Err> { + ::set(&self, "org.PulseAudio.Core1.Device", "Volume", value) + } + + fn set_mute(&self, value: bool) -> Result<(), Self::Err> { + ::set(&self, "org.PulseAudio.Core1.Device", "Mute", value) + } + + fn set_active_port(&self, value: dbus::Path<'static>) -> Result<(), Self::Err> { + ::set(&self, "org.PulseAudio.Core1.Device", "ActivePort", value) + } +} + +pub fn org_pulse_audio_core1_device_server(factory: &tree::Factory, D>, data: D::Interface, f: F) -> tree::Interface, D> +where + D: tree::DataType, + D::Method: Default, + D::Property: Default, + T: OrgPulseAudioCore1Device, + F: 'static + for <'z> Fn(& 'z tree::MethodInfo, D>) -> & 'z T, +{ + let i = factory.interface("org.PulseAudio.Core1.Device", data); + let f = ::std::sync::Arc::new(f); + let fclone = f.clone(); + let h = move |minfo: &tree::MethodInfo, D>| { + let mut i = minfo.msg.iter_init(); + let suspend: bool = try!(i.read()); + let d = fclone(minfo); + try!(d.suspend(suspend)); + let rm = minfo.msg.method_return(); + Ok(vec!(rm)) + }; + let m = factory.method("Suspend", Default::default(), h); + let m = m.in_arg(("suspend", "b")); + let i = i.add_m(m); + + let fclone = f.clone(); + let h = move |minfo: &tree::MethodInfo, D>| { + let mut i = minfo.msg.iter_init(); + let name: &str = try!(i.read()); + let d = fclone(minfo); + let port = try!(d.get_port_by_name(name)); + let rm = minfo.msg.method_return(); + let rm = rm.append1(port); + Ok(vec!(rm)) + }; + let m = factory.method("GetPortByName", Default::default(), h); + let m = m.in_arg(("name", "s")); + let m = m.out_arg(("port", "o")); + let i = i.add_m(m); + + let p = factory.property::("Index", Default::default()); + let p = p.access(tree::Access::Read); + let fclone = f.clone(); + let p = p.on_get(move |a, pinfo| { + let minfo = pinfo.to_method_info(); + let d = fclone(&minfo); + a.append(try!(d.get_index())); + Ok(()) + }); + let i = i.add_p(p); + + let p = factory.property::<&str, _>("Name", Default::default()); + let p = p.access(tree::Access::Read); + let fclone = f.clone(); + let p = p.on_get(move |a, pinfo| { + let minfo = pinfo.to_method_info(); + let d = fclone(&minfo); + a.append(try!(d.get_name())); + Ok(()) + }); + let i = i.add_p(p); + + let p = factory.property::<&str, _>("Driver", Default::default()); + let p = p.access(tree::Access::Read); + let fclone = f.clone(); + let p = p.on_get(move |a, pinfo| { + let minfo = pinfo.to_method_info(); + let d = fclone(&minfo); + a.append(try!(d.get_driver())); + Ok(()) + }); + let i = i.add_p(p); + + let p = factory.property::("OwnerModule", Default::default()); + let p = p.access(tree::Access::Read); + let fclone = f.clone(); + let p = p.on_get(move |a, pinfo| { + let minfo = pinfo.to_method_info(); + let d = fclone(&minfo); + a.append(try!(d.get_owner_module())); + Ok(()) + }); + let i = i.add_p(p); + + let p = factory.property::("Card", Default::default()); + let p = p.access(tree::Access::Read); + let fclone = f.clone(); + let p = p.on_get(move |a, pinfo| { + let minfo = pinfo.to_method_info(); + let d = fclone(&minfo); + a.append(try!(d.get_card())); + Ok(()) + }); + let i = i.add_p(p); + + let p = factory.property::("SampleFormat", Default::default()); + let p = p.access(tree::Access::Read); + let fclone = f.clone(); + let p = p.on_get(move |a, pinfo| { + let minfo = pinfo.to_method_info(); + let d = fclone(&minfo); + a.append(try!(d.get_sample_format())); + Ok(()) + }); + let i = i.add_p(p); + + let p = factory.property::("SampleRate", Default::default()); + let p = p.access(tree::Access::Read); + let fclone = f.clone(); + let p = p.on_get(move |a, pinfo| { + let minfo = pinfo.to_method_info(); + let d = fclone(&minfo); + a.append(try!(d.get_sample_rate())); + Ok(()) + }); + let i = i.add_p(p); + + let p = factory.property::, _>("Channels", Default::default()); + let p = p.access(tree::Access::Read); + let fclone = f.clone(); + let p = p.on_get(move |a, pinfo| { + let minfo = pinfo.to_method_info(); + let d = fclone(&minfo); + a.append(try!(d.get_channels())); + Ok(()) + }); + let i = i.add_p(p); + + let p = factory.property::, _>("Volume", Default::default()); + let p = p.access(tree::Access::ReadWrite); + let fclone = f.clone(); + let p = p.on_get(move |a, pinfo| { + let minfo = pinfo.to_method_info(); + let d = fclone(&minfo); + a.append(try!(d.get_volume())); + Ok(()) + }); + let fclone = f.clone(); + let p = p.on_set(move |iter, pinfo| { + let minfo = pinfo.to_method_info(); + let d = fclone(&minfo); + try!(d.set_volume(try!(iter.read()))); + Ok(()) + }); + let i = i.add_p(p); + + let p = factory.property::("HasFlatVolume", Default::default()); + let p = p.access(tree::Access::Read); + let fclone = f.clone(); + let p = p.on_get(move |a, pinfo| { + let minfo = pinfo.to_method_info(); + let d = fclone(&minfo); + a.append(try!(d.get_has_flat_volume())); + Ok(()) + }); + let i = i.add_p(p); + + let p = factory.property::("HasConvertibleToDecibelVolume", Default::default()); + let p = p.access(tree::Access::Read); + let fclone = f.clone(); + let p = p.on_get(move |a, pinfo| { + let minfo = pinfo.to_method_info(); + let d = fclone(&minfo); + a.append(try!(d.get_has_convertible_to_decibel_volume())); + Ok(()) + }); + let i = i.add_p(p); + + let p = factory.property::("BaseVolume", Default::default()); + let p = p.access(tree::Access::Read); + let fclone = f.clone(); + let p = p.on_get(move |a, pinfo| { + let minfo = pinfo.to_method_info(); + let d = fclone(&minfo); + a.append(try!(d.get_base_volume())); + Ok(()) + }); + let i = i.add_p(p); + + let p = factory.property::("VolumeSteps", Default::default()); + let p = p.access(tree::Access::Read); + let fclone = f.clone(); + let p = p.on_get(move |a, pinfo| { + let minfo = pinfo.to_method_info(); + let d = fclone(&minfo); + a.append(try!(d.get_volume_steps())); + Ok(()) + }); + let i = i.add_p(p); + + let p = factory.property::("Mute", Default::default()); + let p = p.access(tree::Access::ReadWrite); + let fclone = f.clone(); + let p = p.on_get(move |a, pinfo| { + let minfo = pinfo.to_method_info(); + let d = fclone(&minfo); + a.append(try!(d.get_mute())); + Ok(()) + }); + let fclone = f.clone(); + let p = p.on_set(move |iter, pinfo| { + let minfo = pinfo.to_method_info(); + let d = fclone(&minfo); + try!(d.set_mute(try!(iter.read()))); + Ok(()) + }); + let i = i.add_p(p); + + let p = factory.property::("HasHardwareVolume", Default::default()); + let p = p.access(tree::Access::Read); + let fclone = f.clone(); + let p = p.on_get(move |a, pinfo| { + let minfo = pinfo.to_method_info(); + let d = fclone(&minfo); + a.append(try!(d.get_has_hardware_volume())); + Ok(()) + }); + let i = i.add_p(p); + + let p = factory.property::("HasHardwareMute", Default::default()); + let p = p.access(tree::Access::Read); + let fclone = f.clone(); + let p = p.on_get(move |a, pinfo| { + let minfo = pinfo.to_method_info(); + let d = fclone(&minfo); + a.append(try!(d.get_has_hardware_mute())); + Ok(()) + }); + let i = i.add_p(p); + + let p = factory.property::("ConfiguredLatency", Default::default()); + let p = p.access(tree::Access::Read); + let fclone = f.clone(); + let p = p.on_get(move |a, pinfo| { + let minfo = pinfo.to_method_info(); + let d = fclone(&minfo); + a.append(try!(d.get_configured_latency())); + Ok(()) + }); + let i = i.add_p(p); + + let p = factory.property::("HasDynamicLatency", Default::default()); + let p = p.access(tree::Access::Read); + let fclone = f.clone(); + let p = p.on_get(move |a, pinfo| { + let minfo = pinfo.to_method_info(); + let d = fclone(&minfo); + a.append(try!(d.get_has_dynamic_latency())); + Ok(()) + }); + let i = i.add_p(p); + + let p = factory.property::("Latency", Default::default()); + let p = p.access(tree::Access::Read); + let fclone = f.clone(); + let p = p.on_get(move |a, pinfo| { + let minfo = pinfo.to_method_info(); + let d = fclone(&minfo); + a.append(try!(d.get_latency())); + Ok(()) + }); + let i = i.add_p(p); + + let p = factory.property::("IsHardwareDevice", Default::default()); + let p = p.access(tree::Access::Read); + let fclone = f.clone(); + let p = p.on_get(move |a, pinfo| { + let minfo = pinfo.to_method_info(); + let d = fclone(&minfo); + a.append(try!(d.get_is_hardware_device())); + Ok(()) + }); + let i = i.add_p(p); + + let p = factory.property::("IsNetworkDevice", Default::default()); + let p = p.access(tree::Access::Read); + let fclone = f.clone(); + let p = p.on_get(move |a, pinfo| { + let minfo = pinfo.to_method_info(); + let d = fclone(&minfo); + a.append(try!(d.get_is_network_device())); + Ok(()) + }); + let i = i.add_p(p); + + let p = factory.property::("State", Default::default()); + let p = p.access(tree::Access::Read); + let fclone = f.clone(); + let p = p.on_get(move |a, pinfo| { + let minfo = pinfo.to_method_info(); + let d = fclone(&minfo); + a.append(try!(d.get_state())); + Ok(()) + }); + let i = i.add_p(p); + + let p = factory.property::, _>("Ports", Default::default()); + let p = p.access(tree::Access::Read); + let fclone = f.clone(); + let p = p.on_get(move |a, pinfo| { + let minfo = pinfo.to_method_info(); + let d = fclone(&minfo); + a.append(try!(d.get_ports())); + Ok(()) + }); + let i = i.add_p(p); + + let p = factory.property::("ActivePort", Default::default()); + let p = p.access(tree::Access::ReadWrite); + let fclone = f.clone(); + let p = p.on_get(move |a, pinfo| { + let minfo = pinfo.to_method_info(); + let d = fclone(&minfo); + a.append(try!(d.get_active_port())); + Ok(()) + }); + let fclone = f.clone(); + let p = p.on_set(move |iter, pinfo| { + let minfo = pinfo.to_method_info(); + let d = fclone(&minfo); + try!(d.set_active_port(try!(iter.read()))); + Ok(()) + }); + let i = i.add_p(p); + + let p = factory.property::<::std::collections::HashMap<&str, Vec>, _>("PropertyList", Default::default()); + let p = p.access(tree::Access::Read); + let fclone = f.clone(); + let p = p.on_get(move |a, pinfo| { + let minfo = pinfo.to_method_info(); + let d = fclone(&minfo); + a.append(try!(d.get_property_list())); + Ok(()) + }); + let i = i.add_p(p); + i +} + +#[derive(Debug, Default)] +pub struct OrgPulseAudioCore1DeviceVolumeUpdated { + pub volume: Vec, +} + +impl dbus::SignalArgs for OrgPulseAudioCore1DeviceVolumeUpdated { + const NAME: &'static str = "VolumeUpdated"; + const INTERFACE: &'static str = "org.PulseAudio.Core1.Device"; + fn append(&self, i: &mut arg::IterAppend) { + (&self.volume as &arg::RefArg).append(i); + } + fn get(&mut self, i: &mut arg::Iter) -> Result<(), arg::TypeMismatchError> { + self.volume = try!(i.read()); + Ok(()) + } +} + +#[derive(Debug, Default)] +pub struct OrgPulseAudioCore1DeviceMuteUpdated { + pub muted: bool, +} + +impl dbus::SignalArgs for OrgPulseAudioCore1DeviceMuteUpdated { + const NAME: &'static str = "MuteUpdated"; + const INTERFACE: &'static str = "org.PulseAudio.Core1.Device"; + fn append(&self, i: &mut arg::IterAppend) { + (&self.muted as &arg::RefArg).append(i); + } + fn get(&mut self, i: &mut arg::Iter) -> Result<(), arg::TypeMismatchError> { + self.muted = try!(i.read()); + Ok(()) + } +} + +#[derive(Debug, Default)] +pub struct OrgPulseAudioCore1DeviceStateUpdated { + pub state: u32, +} + +impl dbus::SignalArgs for OrgPulseAudioCore1DeviceStateUpdated { + const NAME: &'static str = "StateUpdated"; + const INTERFACE: &'static str = "org.PulseAudio.Core1.Device"; + fn append(&self, i: &mut arg::IterAppend) { + (&self.state as &arg::RefArg).append(i); + } + fn get(&mut self, i: &mut arg::Iter) -> Result<(), arg::TypeMismatchError> { + self.state = try!(i.read()); + Ok(()) + } +} + +#[derive(Debug, Default)] +pub struct OrgPulseAudioCore1DeviceActivePortUpdated { + pub port: dbus::Path<'static>, +} + +impl dbus::SignalArgs for OrgPulseAudioCore1DeviceActivePortUpdated { + const NAME: &'static str = "ActivePortUpdated"; + const INTERFACE: &'static str = "org.PulseAudio.Core1.Device"; + fn append(&self, i: &mut arg::IterAppend) { + (&self.port as &arg::RefArg).append(i); + } + fn get(&mut self, i: &mut arg::Iter) -> Result<(), arg::TypeMismatchError> { + self.port = try!(i.read()); + Ok(()) + } +} + +#[derive(Debug, Default)] +pub struct OrgPulseAudioCore1DevicePropertyListUpdated { + pub property_list: ::std::collections::HashMap>, +} + +impl dbus::SignalArgs for OrgPulseAudioCore1DevicePropertyListUpdated { + const NAME: &'static str = "PropertyListUpdated"; + const INTERFACE: &'static str = "org.PulseAudio.Core1.Device"; + fn append(&self, i: &mut arg::IterAppend) { + (&self.property_list as &arg::RefArg).append(i); + } + fn get(&mut self, i: &mut arg::Iter) -> Result<(), arg::TypeMismatchError> { + self.property_list = try!(i.read()); + Ok(()) + } +} + +pub trait OrgPulseAudioCore1Sink { + type Err; + fn get_monitor_source(&self) -> Result, Self::Err>; +} + +impl<'a, C: ::std::ops::Deref> OrgPulseAudioCore1Sink for dbus::ConnPath<'a, C> { + type Err = dbus::Error; + + fn get_monitor_source(&self) -> Result, Self::Err> { + ::get(&self, "org.PulseAudio.Core1.Sink", "MonitorSource") + } +} + +pub fn org_pulse_audio_core1_sink_server(factory: &tree::Factory, D>, data: D::Interface, f: F) -> tree::Interface, D> +where + D: tree::DataType, + D::Method: Default, + D::Property: Default, + T: OrgPulseAudioCore1Sink, + F: 'static + for <'z> Fn(& 'z tree::MethodInfo, D>) -> & 'z T, +{ + let i = factory.interface("org.PulseAudio.Core1.Sink", data); + let f = ::std::sync::Arc::new(f); + let p = factory.property::("MonitorSource", Default::default()); + let p = p.access(tree::Access::Read); + let fclone = f.clone(); + let p = p.on_get(move |a, pinfo| { + let minfo = pinfo.to_method_info(); + let d = fclone(&minfo); + a.append(try!(d.get_monitor_source())); + Ok(()) + }); + let i = i.add_p(p); + i +} + +pub trait OrgFreedesktopDBusIntrospectable { + type Err; + fn introspect(&self) -> Result; +} + +impl<'a, C: ::std::ops::Deref> OrgFreedesktopDBusIntrospectable for dbus::ConnPath<'a, C> { + type Err = dbus::Error; + + fn introspect(&self) -> Result { + let mut m = try!(self.method_call_with_args(&"org.freedesktop.DBus.Introspectable".into(), &"Introspect".into(), |_| { + })); + try!(m.as_result()); + let mut i = m.iter_init(); + let data: String = try!(i.read()); + Ok(data) + } +} + +pub fn org_freedesktop_dbus_introspectable_server(factory: &tree::Factory, D>, data: D::Interface, f: F) -> tree::Interface, D> +where + D: tree::DataType, + D::Method: Default, + T: OrgFreedesktopDBusIntrospectable, + F: 'static + for <'z> Fn(& 'z tree::MethodInfo, D>) -> & 'z T, +{ + let i = factory.interface("org.freedesktop.DBus.Introspectable", data); + let f = ::std::sync::Arc::new(f); + let fclone = f.clone(); + let h = move |minfo: &tree::MethodInfo, D>| { + let d = fclone(minfo); + let data = try!(d.introspect()); + let rm = minfo.msg.method_return(); + let rm = rm.append1(data); + Ok(vec!(rm)) + }; + let m = factory.method("Introspect", Default::default(), h); + let m = m.out_arg(("data", "s")); + let i = i.add_m(m); + i +} + +pub trait OrgFreedesktopDBusProperties { + type Err; + fn get(&self, interface_name: &str, property_name: &str) -> Result>, Self::Err>; + fn set(&self, interface_name: &str, property_name: &str, value: arg::Variant>) -> Result<(), Self::Err>; + fn get_all(&self, interface_name: &str) -> Result<::std::collections::HashMap>>, Self::Err>; +} + +impl<'a, C: ::std::ops::Deref> OrgFreedesktopDBusProperties for dbus::ConnPath<'a, C> { + type Err = dbus::Error; + + fn get(&self, interface_name: &str, property_name: &str) -> Result>, Self::Err> { + let mut m = try!(self.method_call_with_args(&"org.freedesktop.DBus.Properties".into(), &"Get".into(), |msg| { + let mut i = arg::IterAppend::new(msg); + i.append(interface_name); + i.append(property_name); + })); + try!(m.as_result()); + let mut i = m.iter_init(); + let value: arg::Variant> = try!(i.read()); + Ok(value) + } + + fn set(&self, interface_name: &str, property_name: &str, value: arg::Variant>) -> Result<(), Self::Err> { + let mut m = try!(self.method_call_with_args(&"org.freedesktop.DBus.Properties".into(), &"Set".into(), |msg| { + let mut i = arg::IterAppend::new(msg); + i.append(interface_name); + i.append(property_name); + i.append(value); + })); + try!(m.as_result()); + Ok(()) + } + + fn get_all(&self, interface_name: &str) -> Result<::std::collections::HashMap>>, Self::Err> { + let mut m = try!(self.method_call_with_args(&"org.freedesktop.DBus.Properties".into(), &"GetAll".into(), |msg| { + let mut i = arg::IterAppend::new(msg); + i.append(interface_name); + })); + try!(m.as_result()); + let mut i = m.iter_init(); + let props: ::std::collections::HashMap>> = try!(i.read()); + Ok(props) + } +} + +pub fn org_freedesktop_dbus_properties_server(factory: &tree::Factory, D>, data: D::Interface, f: F) -> tree::Interface, D> +where + D: tree::DataType, + D::Method: Default, + T: OrgFreedesktopDBusProperties, + F: 'static + for <'z> Fn(& 'z tree::MethodInfo, D>) -> & 'z T, +{ + let i = factory.interface("org.freedesktop.DBus.Properties", data); + let f = ::std::sync::Arc::new(f); + let fclone = f.clone(); + let h = move |minfo: &tree::MethodInfo, D>| { + let mut i = minfo.msg.iter_init(); + let interface_name: &str = try!(i.read()); + let property_name: &str = try!(i.read()); + let d = fclone(minfo); + let value = try!(d.get(interface_name, property_name)); + let rm = minfo.msg.method_return(); + let rm = rm.append1(value); + Ok(vec!(rm)) + }; + let m = factory.method("Get", Default::default(), h); + let m = m.in_arg(("interface_name", "s")); + let m = m.in_arg(("property_name", "s")); + let m = m.out_arg(("value", "v")); + let i = i.add_m(m); + + let fclone = f.clone(); + let h = move |minfo: &tree::MethodInfo, D>| { + let mut i = minfo.msg.iter_init(); + let interface_name: &str = try!(i.read()); + let property_name: &str = try!(i.read()); + let value: arg::Variant> = try!(i.read()); + let d = fclone(minfo); + try!(d.set(interface_name, property_name, value)); + let rm = minfo.msg.method_return(); + Ok(vec!(rm)) + }; + let m = factory.method("Set", Default::default(), h); + let m = m.in_arg(("interface_name", "s")); + let m = m.in_arg(("property_name", "s")); + let m = m.in_arg(("value", "v")); + let i = i.add_m(m); + + let fclone = f.clone(); + let h = move |minfo: &tree::MethodInfo, D>| { + let mut i = minfo.msg.iter_init(); + let interface_name: &str = try!(i.read()); + let d = fclone(minfo); + let props = try!(d.get_all(interface_name)); + let rm = minfo.msg.method_return(); + let rm = rm.append1(props); + Ok(vec!(rm)) + }; + let m = factory.method("GetAll", Default::default(), h); + let m = m.in_arg(("interface_name", "s")); + let m = m.out_arg(("props", "a{sv}")); + let i = i.add_m(m); + i +} 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 @@ +extern crate dbus; + +#[macro_use] +extern crate log; +#[macro_use] +extern crate failure; + +extern crate clap; +extern crate clap_log_flag; +extern crate clap_verbosity_flag; +extern crate structopt; + +use structopt::StructOpt; + +use failure::Error; + +//use dbus::stdintf::org_freedesktop_dbus::Properties; +use dbus::Connection; + +use dbus_api::sink::OrgPulseAudioExtEqualizing1Equalizer; + +mod dbus_api; +mod parsing; +mod utils; + +use utils::*; + +#[derive(StructOpt, Debug)] +enum Command { + #[structopt(name = "load")] + Load(LoadCli), + #[structopt(name = "reset")] + Reset(ResetCli), +} + +#[derive(StructOpt, Debug)] +struct LoadCli { +} + +#[derive(StructOpt, Debug)] +struct ResetCli { +} + +#[derive(StructOpt, Debug)] +struct Cli { + #[structopt(flatten)] + verbose: clap_verbosity_flag::Verbosity, + #[structopt(flatten)] + log: clap_log_flag::Log, + #[structopt(subcommand)] + cmd: Command, +} + +#[derive(Fail, Debug)] +#[fail(display = "No equalized sink found")] +struct NoEqualizedSink; + +#[derive(Debug)] +pub struct Filter { + preamp: f64, + frequencies: Vec, + coefficients: Vec, +} + +impl Filter { + fn pad(self, filter_rate: u32) -> Self { + Filter { + preamp: self.preamp, + frequencies: vec![0u32] + .into_iter() + .chain(self.frequencies.into_iter()) + .chain(vec![filter_rate / 2u32]) + .collect(), + coefficients: vec![1f64] + .into_iter() + .chain(self.coefficients.into_iter()) + .chain(vec![1f64]) + .collect(), + } + } +} + +fn main() -> Result<(), Error> { + let args = Cli::from_args(); + args.log.log_all(args.verbose.log_level())?; + + use Command::*; + + match args.cmd { + Load(args) => load(args), + Reset(args)=> reset(args), + } +} + +fn reset(args: ResetCli) -> Result<(), Error> { + let conn = connect()?; + let conn_sink = get_equalized_sink(&conn)?; + let filter_rate = conn_sink.get_filter_sample_rate()?; + let filter = Filter { + preamp: 1f64, + frequencies: vec![], + coefficients: vec![], + }.pad(filter_rate); + + send_filter(&conn_sink, filter)?; + + Ok(()) +} + +fn load(args: LoadCli) -> Result<(), Error> { + let conn = connect()?; + let conn_sink = get_equalized_sink(&conn)?; + let filter = read_filter()?; + let filter_rate = conn_sink.get_filter_sample_rate()?; + send_filter(&conn_sink, filter.pad(filter_rate))?; + + Ok(()) +} + +/* +fn introspect(conn: &dbus::ConnPath<&Connection>) { + let mut thing = conn + .method_call_with_args( + &"org.freedesktop.DBus.Introspectable".into(), + &"Introspect".into(), + |_| {}, + ).unwrap(); + thing.as_result().unwrap(); + + println!("{}", thing.iter_init().read::().unwrap()); +} +*/ 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 @@ +use ::Filter; + +use std::str::FromStr; + +grammar; + +pub Main: Filter = { + => { + let coefficients: Vec<_> = eq.1.iter().map(|decibel| 10f64.powf(decibel / 10f64)).collect(); + // TODO: add decibel_to_ratio conversion function + let preamp = 10f64.powf(preamp / 10f64); + Filter { preamp, frequencies: eq.0, coefficients } + } +} + +Preamp: f64 = { + "Preamp:" +} + +Eq: (Vec, Vec) = { + "GraphicEQ:" ";")+> => { + let mut values = values; + values.push(end); + values.into_iter().unzip() + } +} + +Decibel: f64 = { + "dB" +} + +Float: f64 = { + , + => <> as f64, + => <> as f64, +} + +RawFloat: f64 = r"-?[0-9]*\.[0-9]+" => f64::from_str(<>).unwrap(); +SignedInteger: i32 = r"-[0-9]+" => i32::from_str(<>).unwrap(); +Integer: u32 = r"[0-9]+"=> u32::from_str(<>).unwrap(); + +// 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 @@ +// auto-generated: "lalrpop 0.15.2" +// sha256: 81b6fa5856d7887b20715c2c7f6137db1927ece087e2db9f4bf1fcd8943365c5 +use ::Filter; +use std::str::FromStr; +#[allow(unused_extern_crates)] +extern crate lalrpop_util as __lalrpop_util; + +#[cfg_attr(rustfmt, rustfmt_skip)] +mod __parse__Main { + #![allow(non_snake_case, non_camel_case_types, unused_mut, unused_variables, unused_imports, unused_parens)] + + use ::Filter; + use std::str::FromStr; + #[allow(unused_extern_crates)] + extern crate lalrpop_util as __lalrpop_util; + use super::__intern_token::Token; + #[allow(dead_code)] + pub enum __Symbol<'input> + { + Variant0(&'input str), + Variant1((u32, f64)), + Variant2(::std::vec::Vec<(u32, f64)>), + Variant3(f64), + Variant4((Vec, Vec)), + Variant5(u32), + Variant6(Filter), + Variant7(i32), + } + const __ACTION: &'static [i8] = &[ + // State 0 + 0, 0, 4, 0, 0, 0, 0, + // State 1 + 0, 0, 0, 0, 0, 0, 0, + // State 2 + 0, 6, 0, 0, 0, 0, 0, + // State 3 + 0, 0, 0, 0, 12, 13, 14, + // State 4 + 0, 0, 0, 0, 0, 0, 0, + // State 5 + 0, 0, 0, 0, 0, 0, 14, + // State 6 + 0, -12, 0, 0, 0, 0, 0, + // State 7 + 0, 0, 0, 17, 0, 0, 0, + // State 8 + -9, 0, 0, -9, 0, 0, 0, + // State 9 + -7, 0, 0, -7, 0, 0, 0, + // State 10 + -8, 0, 0, -8, 0, 0, 0, + // State 11 + -13, 0, 0, -13, 0, 0, 0, + // State 12 + -14, 0, 0, -14, 0, 0, 0, + // State 13 + -10, 0, 0, -10, -10, -10, -10, + // State 14 + 0, 0, 0, 0, 0, 0, 14, + // State 15 + 0, 0, 0, 0, 12, 13, 14, + // State 16 + 0, -5, 0, 0, 0, 0, 0, + // State 17 + 0, 0, 0, 0, 12, 13, 14, + // State 18 + 21, 0, 0, 0, 0, 0, 0, + // State 19 + 22, 0, 0, 0, 0, 0, 0, + // State 20 + 0, 0, 0, 0, 0, 0, -2, + // State 21 + 0, 0, 0, 0, 0, 0, -3, + ]; + const __EOF_ACTION: &'static [i8] = &[ + // State 0 + 0, + // State 1 + -15, + // State 2 + 0, + // State 3 + 0, + // State 4 + -11, + // State 5 + 0, + // State 6 + 0, + // State 7 + 0, + // State 8 + -9, + // State 9 + -7, + // State 10 + -8, + // State 11 + -13, + // State 12 + -14, + // State 13 + -10, + // State 14 + 0, + // State 15 + 0, + // State 16 + 0, + // State 17 + 0, + // State 18 + 0, + // State 19 + -6, + // State 20 + 0, + // State 21 + 0, + ]; + const __GOTO: &'static [i8] = &[ + // State 0 + 0, 0, 0, 0, 0, 0, 0, 2, 3, 0, 0, 0, + // State 1 + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + // State 2 + 0, 0, 0, 0, 5, 0, 0, 0, 0, 0, 0, 0, + // State 3 + 0, 0, 0, 7, 0, 8, 9, 0, 0, 10, 11, 0, + // State 4 + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + // State 5 + 0, 15, 0, 0, 0, 0, 16, 0, 0, 0, 0, 0, + // State 6 + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + // State 7 + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + // State 8 + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + // State 9 + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + // State 10 + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + // State 11 + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + // State 12 + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + // State 13 + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + // State 14 + 0, 0, 0, 0, 0, 0, 18, 0, 0, 0, 0, 0, + // State 15 + 0, 0, 0, 0, 0, 19, 9, 0, 0, 10, 11, 0, + // State 16 + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + // State 17 + 0, 0, 0, 0, 0, 20, 9, 0, 0, 10, 11, 0, + // State 18 + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + // State 19 + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + // State 20 + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + // State 21 + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + ]; + fn __expected_tokens(__state: usize) -> Vec<::std::string::String> { + const __TERMINAL: &'static [&'static str] = &[ + r###"";""###, + r###""GraphicEQ:""###, + r###""Preamp:""###, + r###""dB""###, + r###"r#"-?[0-9]*\\.[0-9]+"#"###, + r###"r#"-[0-9]+"#"###, + r###"r#"[0-9]+"#"###, + ]; + __ACTION[(__state * 7)..].iter().zip(__TERMINAL).filter_map(|(&state, terminal)| { + if state == 0 { + None + } else { + Some(terminal.to_string()) + } + }).collect() + } + pub struct MainParser { + builder: super::__intern_token::__MatcherBuilder, + _priv: (), + } + + impl MainParser { + pub fn new() -> MainParser { + let __builder = super::__intern_token::__MatcherBuilder::new(); + MainParser { + builder: __builder, + _priv: (), + } + } + + #[allow(dead_code)] + pub fn parse< + 'input, + >( + &self, + input: &'input str, + ) -> Result, &'static str>> + { + let mut __tokens = self.builder.matcher(input); + let mut __states = vec![0_i8]; + let mut __symbols = vec![]; + let mut __integer; + let mut __lookahead; + let __last_location = &mut Default::default(); + '__shift: loop { + __lookahead = match __tokens.next() { + Some(Ok(v)) => v, + None => break '__shift, + Some(Err(e)) => return Err(e), + }; + *__last_location = __lookahead.2.clone(); + __integer = match __lookahead.1 { + Token(3, _) if true => 0, + Token(4, _) if true => 1, + Token(5, _) if true => 2, + Token(6, _) if true => 3, + Token(0, _) if true => 4, + Token(1, _) if true => 5, + Token(2, _) if true => 6, + _ => { + let __state = *__states.last().unwrap() as usize; + let __error = __lalrpop_util::ParseError::UnrecognizedToken { + token: Some(__lookahead), + expected: __expected_tokens(__state), + }; + return Err(__error); + } + }; + '__inner: loop { + let __state = *__states.last().unwrap() as usize; + let __action = __ACTION[__state * 7 + __integer]; + if __action > 0 { + let __symbol = match __integer { + 0 => match __lookahead.1 { + Token(3, __tok0) => __Symbol::Variant0((__tok0)), + _ => unreachable!(), + }, + 1 => match __lookahead.1 { + Token(4, __tok0) => __Symbol::Variant0((__tok0)), + _ => unreachable!(), + }, + 2 => match __lookahead.1 { + Token(5, __tok0) => __Symbol::Variant0((__tok0)), + _ => unreachable!(), + }, + 3 => match __lookahead.1 { + Token(6, __tok0) => __Symbol::Variant0((__tok0)), + _ => unreachable!(), + }, + 4 => match __lookahead.1 { + Token(0, __tok0) => __Symbol::Variant0((__tok0)), + _ => unreachable!(), + }, + 5 => match __lookahead.1 { + Token(1, __tok0) => __Symbol::Variant0((__tok0)), + _ => unreachable!(), + }, + 6 => match __lookahead.1 { + Token(2, __tok0) => __Symbol::Variant0((__tok0)), + _ => unreachable!(), + }, + _ => unreachable!(), + }; + __states.push(__action - 1); + __symbols.push((__lookahead.0, __symbol, __lookahead.2)); + continue '__shift; + } else if __action < 0 { + if let Some(r) = __reduce(input, __action, Some(&__lookahead.0), &mut __states, &mut __symbols, ::std::marker::PhantomData::<()>) { + if r.is_err() { + return r; + } + return Err(__lalrpop_util::ParseError::ExtraToken { token: __lookahead }); + } + } else { + let mut __err_lookahead = Some(__lookahead); + let mut __err_integer: Option = Some(__integer); + let __state = *__states.last().unwrap() as usize; + let __error = __lalrpop_util::ParseError::UnrecognizedToken { + token: __err_lookahead, + expected: __expected_tokens(__state), + }; + return Err(__error) + } + } + } + loop { + let __state = *__states.last().unwrap() as usize; + let __action = __EOF_ACTION[__state]; + if __action < 0 { + if let Some(r) = __reduce(input, __action, None, &mut __states, &mut __symbols, ::std::marker::PhantomData::<()>) { + return r; + } + } else { + let mut __err_lookahead = None; + let mut __err_integer: Option = None; + let __state = *__states.last().unwrap() as usize; + let __error = __lalrpop_util::ParseError::UnrecognizedToken { + token: __err_lookahead, + expected: __expected_tokens(__state), + }; + return Err(__error) + } + } + } + } + pub(crate) fn __reduce< + 'input, + >( + input: &'input str, + __action: i8, + __lookahead_start: Option<&usize>, + __states: &mut ::std::vec::Vec, + __symbols: &mut ::std::vec::Vec<(usize,__Symbol<'input>,usize)>, + _: ::std::marker::PhantomData<()>, + ) -> Option, &'static str>>> + { + let (__pop_states, __symbol, __nonterminal) = match -__action { + 1 => { + __reduce1(input, __action, __lookahead_start, __states, __symbols, ::std::marker::PhantomData::<()>) + } + 2 => { + __reduce2(input, __action, __lookahead_start, __states, __symbols, ::std::marker::PhantomData::<()>) + } + 3 => { + __reduce3(input, __action, __lookahead_start, __states, __symbols, ::std::marker::PhantomData::<()>) + } + 4 => { + __reduce4(input, __action, __lookahead_start, __states, __symbols, ::std::marker::PhantomData::<()>) + } + 5 => { + __reduce5(input, __action, __lookahead_start, __states, __symbols, ::std::marker::PhantomData::<()>) + } + 6 => { + __reduce6(input, __action, __lookahead_start, __states, __symbols, ::std::marker::PhantomData::<()>) + } + 7 => { + __reduce7(input, __action, __lookahead_start, __states, __symbols, ::std::marker::PhantomData::<()>) + } + 8 => { + __reduce8(input, __action, __lookahead_start, __states, __symbols, ::std::marker::PhantomData::<()>) + } + 9 => { + __reduce9(input, __action, __lookahead_start, __states, __symbols, ::std::marker::PhantomData::<()>) + } + 10 => { + __reduce10(input, __action, __lookahead_start, __states, __symbols, ::std::marker::PhantomData::<()>) + } + 11 => { + __reduce11(input, __action, __lookahead_start, __states, __symbols, ::std::marker::PhantomData::<()>) + } + 12 => { + __reduce12(input, __action, __lookahead_start, __states, __symbols, ::std::marker::PhantomData::<()>) + } + 13 => { + __reduce13(input, __action, __lookahead_start, __states, __symbols, ::std::marker::PhantomData::<()>) + } + 14 => { + __reduce14(input, __action, __lookahead_start, __states, __symbols, ::std::marker::PhantomData::<()>) + } + 15 => { + // __Main = Main => ActionFn(0); + let __sym0 = __pop_Variant6(__symbols); + let __start = __sym0.0.clone(); + let __end = __sym0.2.clone(); + let __nt = super::__action0::<>(input, __sym0); + return Some(Ok(__nt)); + } + _ => panic!("invalid action code {}", __action) + }; + let __states_len = __states.len(); + __states.truncate(__states_len - __pop_states); + __symbols.push(__symbol); + let __state = *__states.last().unwrap() as usize; + let __next_state = __GOTO[__state * 12 + __nonterminal] - 1; + __states.push(__next_state); + None + } + fn __pop_Variant4< + 'input, + >( + __symbols: &mut ::std::vec::Vec<(usize,__Symbol<'input>,usize)> + ) -> (usize, (Vec, Vec), usize) + { + match __symbols.pop().unwrap() { + (__l, __Symbol::Variant4(__v), __r) => (__l, __v, __r), + _ => panic!("symbol type mismatch") + } + } + fn __pop_Variant1< + 'input, + >( + __symbols: &mut ::std::vec::Vec<(usize,__Symbol<'input>,usize)> + ) -> (usize, (u32, f64), usize) + { + match __symbols.pop().unwrap() { + (__l, __Symbol::Variant1(__v), __r) => (__l, __v, __r), + _ => panic!("symbol type mismatch") + } + } + fn __pop_Variant6< + 'input, + >( + __symbols: &mut ::std::vec::Vec<(usize,__Symbol<'input>,usize)> + ) -> (usize, Filter, usize) + { + match __symbols.pop().unwrap() { + (__l, __Symbol::Variant6(__v), __r) => (__l, __v, __r), + _ => panic!("symbol type mismatch") + } + } + fn __pop_Variant3< + 'input, + >( + __symbols: &mut ::std::vec::Vec<(usize,__Symbol<'input>,usize)> + ) -> (usize, f64, usize) + { + match __symbols.pop().unwrap() { + (__l, __Symbol::Variant3(__v), __r) => (__l, __v, __r), + _ => panic!("symbol type mismatch") + } + } + fn __pop_Variant7< + 'input, + >( + __symbols: &mut ::std::vec::Vec<(usize,__Symbol<'input>,usize)> + ) -> (usize, i32, usize) + { + match __symbols.pop().unwrap() { + (__l, __Symbol::Variant7(__v), __r) => (__l, __v, __r), + _ => panic!("symbol type mismatch") + } + } + fn __pop_Variant5< + 'input, + >( + __symbols: &mut ::std::vec::Vec<(usize,__Symbol<'input>,usize)> + ) -> (usize, u32, usize) + { + match __symbols.pop().unwrap() { + (__l, __Symbol::Variant5(__v), __r) => (__l, __v, __r), + _ => panic!("symbol type mismatch") + } + } + fn __pop_Variant2< + 'input, + >( + __symbols: &mut ::std::vec::Vec<(usize,__Symbol<'input>,usize)> + ) -> (usize, ::std::vec::Vec<(u32, f64)>, usize) + { + match __symbols.pop().unwrap() { + (__l, __Symbol::Variant2(__v), __r) => (__l, __v, __r), + _ => panic!("symbol type mismatch") + } + } + fn __pop_Variant0< + 'input, + >( + __symbols: &mut ::std::vec::Vec<(usize,__Symbol<'input>,usize)> + ) -> (usize, &'input str, usize) + { + match __symbols.pop().unwrap() { + (__l, __Symbol::Variant0(__v), __r) => (__l, __v, __r), + _ => panic!("symbol type mismatch") + } + } + pub(crate) fn __reduce1< + 'input, + >( + input: &'input str, + __action: i8, + __lookahead_start: Option<&usize>, + __states: &mut ::std::vec::Vec, + __symbols: &mut ::std::vec::Vec<(usize,__Symbol<'input>,usize)>, + _: ::std::marker::PhantomData<()>, + ) -> (usize, (usize,__Symbol<'input>,usize), usize) + { + // (<(Integer Float)> ";") = Integer, Float, ";" => ActionFn(15); + let __sym2 = __pop_Variant0(__symbols); + let __sym1 = __pop_Variant3(__symbols); + let __sym0 = __pop_Variant5(__symbols); + let __start = __sym0.0.clone(); + let __end = __sym2.2.clone(); + let __nt = super::__action15::<>(input, __sym0, __sym1, __sym2); + let __symbol = (__start, __Symbol::Variant1(__nt), __end); + (3, __symbol, 0) + } + pub(crate) fn __reduce2< + 'input, + >( + input: &'input str, + __action: i8, + __lookahead_start: Option<&usize>, + __states: &mut ::std::vec::Vec, + __symbols: &mut ::std::vec::Vec<(usize,__Symbol<'input>,usize)>, + _: ::std::marker::PhantomData<()>, + ) -> (usize, (usize,__Symbol<'input>,usize), usize) + { + // (<(Integer Float)> ";")+ = Integer, Float, ";" => ActionFn(17); + let __sym2 = __pop_Variant0(__symbols); + let __sym1 = __pop_Variant3(__symbols); + let __sym0 = __pop_Variant5(__symbols); + let __start = __sym0.0.clone(); + let __end = __sym2.2.clone(); + let __nt = super::__action17::<>(input, __sym0, __sym1, __sym2); + let __symbol = (__start, __Symbol::Variant2(__nt), __end); + (3, __symbol, 1) + } + pub(crate) fn __reduce3< + 'input, + >( + input: &'input str, + __action: i8, + __lookahead_start: Option<&usize>, + __states: &mut ::std::vec::Vec, + __symbols: &mut ::std::vec::Vec<(usize,__Symbol<'input>,usize)>, + _: ::std::marker::PhantomData<()>, + ) -> (usize, (usize,__Symbol<'input>,usize), usize) + { + // (<(Integer Float)> ";")+ = (<(Integer Float)> ";")+, Integer, Float, ";" => ActionFn(18); + let __sym3 = __pop_Variant0(__symbols); + let __sym2 = __pop_Variant3(__symbols); + let __sym1 = __pop_Variant5(__symbols); + let __sym0 = __pop_Variant2(__symbols); + let __start = __sym0.0.clone(); + let __end = __sym3.2.clone(); + let __nt = super::__action18::<>(input, __sym0, __sym1, __sym2, __sym3); + let __symbol = (__start, __Symbol::Variant2(__nt), __end); + (4, __symbol, 1) + } + pub(crate) fn __reduce4< + 'input, + >( + input: &'input str, + __action: i8, + __lookahead_start: Option<&usize>, + __states: &mut ::std::vec::Vec, + __symbols: &mut ::std::vec::Vec<(usize,__Symbol<'input>,usize)>, + _: ::std::marker::PhantomData<()>, + ) -> (usize, (usize,__Symbol<'input>,usize), usize) + { + // (Integer Float) = Integer, Float => ActionFn(14); + let __sym1 = __pop_Variant3(__symbols); + let __sym0 = __pop_Variant5(__symbols); + let __start = __sym0.0.clone(); + let __end = __sym1.2.clone(); + let __nt = super::__action14::<>(input, __sym0, __sym1); + let __symbol = (__start, __Symbol::Variant1(__nt), __end); + (2, __symbol, 2) + } + pub(crate) fn __reduce5< + 'input, + >( + input: &'input str, + __action: i8, + __lookahead_start: Option<&usize>, + __states: &mut ::std::vec::Vec, + __symbols: &mut ::std::vec::Vec<(usize,__Symbol<'input>,usize)>, + _: ::std::marker::PhantomData<()>, + ) -> (usize, (usize,__Symbol<'input>,usize), usize) + { + // Decibel = Float, "dB" => ActionFn(4); + let __sym1 = __pop_Variant0(__symbols); + let __sym0 = __pop_Variant3(__symbols); + let __start = __sym0.0.clone(); + let __end = __sym1.2.clone(); + let __nt = super::__action4::<>(input, __sym0, __sym1); + let __symbol = (__start, __Symbol::Variant3(__nt), __end); + (2, __symbol, 3) + } + pub(crate) fn __reduce6< + 'input, + >( + input: &'input str, + __action: i8, + __lookahead_start: Option<&usize>, + __states: &mut ::std::vec::Vec, + __symbols: &mut ::std::vec::Vec<(usize,__Symbol<'input>,usize)>, + _: ::std::marker::PhantomData<()>, + ) -> (usize, (usize,__Symbol<'input>,usize), usize) + { + // Eq = "GraphicEQ:", (<(Integer Float)> ";")+, Integer, Float => ActionFn(16); + let __sym3 = __pop_Variant3(__symbols); + let __sym2 = __pop_Variant5(__symbols); + let __sym1 = __pop_Variant2(__symbols); + let __sym0 = __pop_Variant0(__symbols); + let __start = __sym0.0.clone(); + let __end = __sym3.2.clone(); + let __nt = super::__action16::<>(input, __sym0, __sym1, __sym2, __sym3); + let __symbol = (__start, __Symbol::Variant4(__nt), __end); + (4, __symbol, 4) + } + pub(crate) fn __reduce7< + 'input, + >( + input: &'input str, + __action: i8, + __lookahead_start: Option<&usize>, + __states: &mut ::std::vec::Vec, + __symbols: &mut ::std::vec::Vec<(usize,__Symbol<'input>,usize)>, + _: ::std::marker::PhantomData<()>, + ) -> (usize, (usize,__Symbol<'input>,usize), usize) + { + // Float = RawFloat => ActionFn(5); + let __sym0 = __pop_Variant3(__symbols); + let __start = __sym0.0.clone(); + let __end = __sym0.2.clone(); + let __nt = super::__action5::<>(input, __sym0); + let __symbol = (__start, __Symbol::Variant3(__nt), __end); + (1, __symbol, 5) + } + pub(crate) fn __reduce8< + 'input, + >( + input: &'input str, + __action: i8, + __lookahead_start: Option<&usize>, + __states: &mut ::std::vec::Vec, + __symbols: &mut ::std::vec::Vec<(usize,__Symbol<'input>,usize)>, + _: ::std::marker::PhantomData<()>, + ) -> (usize, (usize,__Symbol<'input>,usize), usize) + { + // Float = SignedInteger => ActionFn(6); + let __sym0 = __pop_Variant7(__symbols); + let __start = __sym0.0.clone(); + let __end = __sym0.2.clone(); + let __nt = super::__action6::<>(input, __sym0); + let __symbol = (__start, __Symbol::Variant3(__nt), __end); + (1, __symbol, 5) + } + pub(crate) fn __reduce9< + 'input, + >( + input: &'input str, + __action: i8, + __lookahead_start: Option<&usize>, + __states: &mut ::std::vec::Vec, + __symbols: &mut ::std::vec::Vec<(usize,__Symbol<'input>,usize)>, + _: ::std::marker::PhantomData<()>, + ) -> (usize, (usize,__Symbol<'input>,usize), usize) + { + // Float = Integer => ActionFn(7); + let __sym0 = __pop_Variant5(__symbols); + let __start = __sym0.0.clone(); + let __end = __sym0.2.clone(); + let __nt = super::__action7::<>(input, __sym0); + let __symbol = (__start, __Symbol::Variant3(__nt), __end); + (1, __symbol, 5) + } + pub(crate) fn __reduce10< + 'input, + >( + input: &'input str, + __action: i8, + __lookahead_start: Option<&usize>, + __states: &mut ::std::vec::Vec, + __symbols: &mut ::std::vec::Vec<(usize,__Symbol<'input>,usize)>, + _: ::std::marker::PhantomData<()>, + ) -> (usize, (usize,__Symbol<'input>,usize), usize) + { + // Integer = r#"[0-9]+"# => ActionFn(10); + let __sym0 = __pop_Variant0(__symbols); + let __start = __sym0.0.clone(); + let __end = __sym0.2.clone(); + let __nt = super::__action10::<>(input, __sym0); + let __symbol = (__start, __Symbol::Variant5(__nt), __end); + (1, __symbol, 6) + } + pub(crate) fn __reduce11< + 'input, + >( + input: &'input str, + __action: i8, + __lookahead_start: Option<&usize>, + __states: &mut ::std::vec::Vec, + __symbols: &mut ::std::vec::Vec<(usize,__Symbol<'input>,usize)>, + _: ::std::marker::PhantomData<()>, + ) -> (usize, (usize,__Symbol<'input>,usize), usize) + { + // Main = Preamp, Eq => ActionFn(1); + let __sym1 = __pop_Variant4(__symbols); + let __sym0 = __pop_Variant3(__symbols); + let __start = __sym0.0.clone(); + let __end = __sym1.2.clone(); + let __nt = super::__action1::<>(input, __sym0, __sym1); + let __symbol = (__start, __Symbol::Variant6(__nt), __end); + (2, __symbol, 7) + } + pub(crate) fn __reduce12< + 'input, + >( + input: &'input str, + __action: i8, + __lookahead_start: Option<&usize>, + __states: &mut ::std::vec::Vec, + __symbols: &mut ::std::vec::Vec<(usize,__Symbol<'input>,usize)>, + _: ::std::marker::PhantomData<()>, + ) -> (usize, (usize,__Symbol<'input>,usize), usize) + { + // Preamp = "Preamp:", Decibel => ActionFn(2); + let __sym1 = __pop_Variant3(__symbols); + let __sym0 = __pop_Variant0(__symbols); + let __start = __sym0.0.clone(); + let __end = __sym1.2.clone(); + let __nt = super::__action2::<>(input, __sym0, __sym1); + let __symbol = (__start, __Symbol::Variant3(__nt), __end); + (2, __symbol, 8) + } + pub(crate) fn __reduce13< + 'input, + >( + input: &'input str, + __action: i8, + __lookahead_start: Option<&usize>, + __states: &mut ::std::vec::Vec, + __symbols: &mut ::std::vec::Vec<(usize,__Symbol<'input>,usize)>, + _: ::std::marker::PhantomData<()>, + ) -> (usize, (usize,__Symbol<'input>,usize), usize) + { + // RawFloat = r#"-?[0-9]*\\.[0-9]+"# => ActionFn(8); + let __sym0 = __pop_Variant0(__symbols); + let __start = __sym0.0.clone(); + let __end = __sym0.2.clone(); + let __nt = super::__action8::<>(input, __sym0); + let __symbol = (__start, __Symbol::Variant3(__nt), __end); + (1, __symbol, 9) + } + pub(crate) fn __reduce14< + 'input, + >( + input: &'input str, + __action: i8, + __lookahead_start: Option<&usize>, + __states: &mut ::std::vec::Vec, + __symbols: &mut ::std::vec::Vec<(usize,__Symbol<'input>,usize)>, + _: ::std::marker::PhantomData<()>, + ) -> (usize, (usize,__Symbol<'input>,usize), usize) + { + // SignedInteger = r#"-[0-9]+"# => ActionFn(9); + let __sym0 = __pop_Variant0(__symbols); + let __start = __sym0.0.clone(); + let __end = __sym0.2.clone(); + let __nt = super::__action9::<>(input, __sym0); + let __symbol = (__start, __Symbol::Variant7(__nt), __end); + (1, __symbol, 10) + } +} +pub use self::__parse__Main::MainParser; +#[cfg_attr(rustfmt, rustfmt_skip)] +mod __intern_token { + #![allow(unused_imports)] + use ::Filter; + use std::str::FromStr; + #[allow(unused_extern_crates)] + extern crate lalrpop_util as __lalrpop_util; + extern crate regex as __regex; + use std::fmt as __fmt; + + #[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord)] + pub struct Token<'input>(pub usize, pub &'input str); + impl<'a> __fmt::Display for Token<'a> { + fn fmt(&self, formatter: &mut __fmt::Formatter) -> Result<(), __fmt::Error> { + __fmt::Display::fmt(self.1, formatter) + } + } + + pub struct __MatcherBuilder { + regex_set: __regex::RegexSet, + regex_vec: Vec<__regex::Regex>, + } + + impl __MatcherBuilder { + pub fn new() -> __MatcherBuilder { + let __strs: &[&str] = &[ + "^((?u:\\-)?(?u:[0-9])*(?u:\\.)(?u:[0-9])+)", + "^((?u:\\-)(?u:[0-9])+)", + "^((?u:[0-9])+)", + "^((?u:;))", + "^((?u:GraphicEQ:))", + "^((?u:Preamp:))", + "^((?u:dB))", + ]; + let __regex_set = __regex::RegexSet::new(__strs).unwrap(); + let __regex_vec = vec![ + __regex::Regex::new("^((?u:\\-)?(?u:[0-9])*(?u:\\.)(?u:[0-9])+)").unwrap(), + __regex::Regex::new("^((?u:\\-)(?u:[0-9])+)").unwrap(), + __regex::Regex::new("^((?u:[0-9])+)").unwrap(), + __regex::Regex::new("^((?u:;))").unwrap(), + __regex::Regex::new("^((?u:GraphicEQ:))").unwrap(), + __regex::Regex::new("^((?u:Preamp:))").unwrap(), + __regex::Regex::new("^((?u:dB))").unwrap(), + ]; + __MatcherBuilder { regex_set: __regex_set, regex_vec: __regex_vec } + } + pub fn matcher<'input, 'builder>(&'builder self, s: &'input str) -> __Matcher<'input, 'builder> { + __Matcher { + text: s, + consumed: 0, + regex_set: &self.regex_set, + regex_vec: &self.regex_vec, + } + } + } + + pub struct __Matcher<'input, 'builder> { + text: &'input str, + consumed: usize, + regex_set: &'builder __regex::RegexSet, + regex_vec: &'builder Vec<__regex::Regex>, + } + + impl<'input, 'builder> Iterator for __Matcher<'input, 'builder> { + type Item = Result<(usize, Token<'input>, usize), __lalrpop_util::ParseError,&'static str>>; + + fn next(&mut self) -> Option { + let __text = self.text.trim_left(); + let __whitespace = self.text.len() - __text.len(); + let __start_offset = self.consumed + __whitespace; + if __text.is_empty() { + self.text = __text; + self.consumed = __start_offset; + None + } else { + let __matches = self.regex_set.matches(__text); + if !__matches.matched_any() { + Some(Err(__lalrpop_util::ParseError::InvalidToken { + location: __start_offset, + })) + } else { + let mut __longest_match = 0; + let mut __index = 0; + for __i in 0 .. 7 { + if __matches.matched(__i) { + let __match = self.regex_vec[__i].find(__text).unwrap(); + let __len = __match.end(); + if __len >= __longest_match { + __longest_match = __len; + __index = __i; + } + } + } + let __result = &__text[..__longest_match]; + let __remaining = &__text[__longest_match..]; + let __end_offset = __start_offset + __longest_match; + self.text = __remaining; + self.consumed = __end_offset; + Some(Ok((__start_offset, Token(__index, __result), __end_offset))) + } + } + } + } +} +pub use self::__intern_token::Token; + +#[allow(unused_variables)] +fn __action0< + 'input, +>( + input: &'input str, + (_, __0, _): (usize, Filter, usize), +) -> Filter +{ + (__0) +} + +#[allow(unused_variables)] +fn __action1< + 'input, +>( + input: &'input str, + (_, preamp, _): (usize, f64, usize), + (_, eq, _): (usize, (Vec, Vec), usize), +) -> Filter +{ + { + let coefficients: Vec<_> = eq.1.iter().map(|decibel| 10f64.powf(decibel / 10f64)).collect(); + // TODO: add decibel_to_ratio conversion function + let preamp = 10f64.powf(preamp / 10f64); + Filter { preamp, frequencies: eq.0, coefficients } + } +} + +#[allow(unused_variables)] +fn __action2< + 'input, +>( + input: &'input str, + (_, _, _): (usize, &'input str, usize), + (_, __0, _): (usize, f64, usize), +) -> f64 +{ + (__0) +} + +#[allow(unused_variables)] +fn __action3< + 'input, +>( + input: &'input str, + (_, _, _): (usize, &'input str, usize), + (_, values, _): (usize, ::std::vec::Vec<(u32, f64)>, usize), + (_, end, _): (usize, (u32, f64), usize), +) -> (Vec, Vec) +{ + { + let mut values = values; + values.push(end); + values.into_iter().unzip() + } +} + +#[allow(unused_variables)] +fn __action4< + 'input, +>( + input: &'input str, + (_, __0, _): (usize, f64, usize), + (_, _, _): (usize, &'input str, usize), +) -> f64 +{ + (__0) +} + +#[allow(unused_variables)] +fn __action5< + 'input, +>( + input: &'input str, + (_, __0, _): (usize, f64, usize), +) -> f64 +{ + (__0) +} + +#[allow(unused_variables)] +fn __action6< + 'input, +>( + input: &'input str, + (_, __0, _): (usize, i32, usize), +) -> f64 +{ + __0 as f64 +} + +#[allow(unused_variables)] +fn __action7< + 'input, +>( + input: &'input str, + (_, __0, _): (usize, u32, usize), +) -> f64 +{ + __0 as f64 +} + +#[allow(unused_variables)] +fn __action8< + 'input, +>( + input: &'input str, + (_, __0, _): (usize, &'input str, usize), +) -> f64 +{ + f64::from_str(__0).unwrap() +} + +#[allow(unused_variables)] +fn __action9< + 'input, +>( + input: &'input str, + (_, __0, _): (usize, &'input str, usize), +) -> i32 +{ + i32::from_str(__0).unwrap() +} + +#[allow(unused_variables)] +fn __action10< + 'input, +>( + input: &'input str, + (_, __0, _): (usize, &'input str, usize), +) -> u32 +{ + u32::from_str(__0).unwrap() +} + +#[allow(unused_variables)] +fn __action11< + 'input, +>( + input: &'input str, + (_, __0, _): (usize, (u32, f64), usize), +) -> ::std::vec::Vec<(u32, f64)> +{ + vec![__0] +} + +#[allow(unused_variables)] +fn __action12< + 'input, +>( + input: &'input str, + (_, v, _): (usize, ::std::vec::Vec<(u32, f64)>, usize), + (_, e, _): (usize, (u32, f64), usize), +) -> ::std::vec::Vec<(u32, f64)> +{ + { let mut v = v; v.push(e); v } +} + +#[allow(unused_variables)] +fn __action13< + 'input, +>( + input: &'input str, + (_, __0, _): (usize, (u32, f64), usize), + (_, _, _): (usize, &'input str, usize), +) -> (u32, f64) +{ + (__0) +} + +#[allow(unused_variables)] +fn __action14< + 'input, +>( + input: &'input str, + (_, __0, _): (usize, u32, usize), + (_, __1, _): (usize, f64, usize), +) -> (u32, f64) +{ + (__0, __1) +} + +#[allow(unused_variables)] +fn __action15< + 'input, +>( + input: &'input str, + __0: (usize, u32, usize), + __1: (usize, f64, usize), + __2: (usize, &'input str, usize), +) -> (u32, f64) +{ + let __start0 = __0.0.clone(); + let __end0 = __1.2.clone(); + let __temp0 = __action14( + input, + __0, + __1, + ); + let __temp0 = (__start0, __temp0, __end0); + __action13( + input, + __temp0, + __2, + ) +} + +#[allow(unused_variables)] +fn __action16< + 'input, +>( + input: &'input str, + __0: (usize, &'input str, usize), + __1: (usize, ::std::vec::Vec<(u32, f64)>, usize), + __2: (usize, u32, usize), + __3: (usize, f64, usize), +) -> (Vec, Vec) +{ + let __start0 = __2.0.clone(); + let __end0 = __3.2.clone(); + let __temp0 = __action14( + input, + __2, + __3, + ); + let __temp0 = (__start0, __temp0, __end0); + __action3( + input, + __0, + __1, + __temp0, + ) +} + +#[allow(unused_variables)] +fn __action17< + 'input, +>( + input: &'input str, + __0: (usize, u32, usize), + __1: (usize, f64, usize), + __2: (usize, &'input str, usize), +) -> ::std::vec::Vec<(u32, f64)> +{ + let __start0 = __0.0.clone(); + let __end0 = __2.2.clone(); + let __temp0 = __action15( + input, + __0, + __1, + __2, + ); + let __temp0 = (__start0, __temp0, __end0); + __action11( + input, + __temp0, + ) +} + +#[allow(unused_variables)] +fn __action18< + 'input, +>( + input: &'input str, + __0: (usize, ::std::vec::Vec<(u32, f64)>, usize), + __1: (usize, u32, usize), + __2: (usize, f64, usize), + __3: (usize, &'input str, usize), +) -> ::std::vec::Vec<(u32, f64)> +{ + let __start0 = __1.0.clone(); + let __end0 = __3.2.clone(); + let __temp0 = __action15( + input, + __1, + __2, + __3, + ); + let __temp0 = (__start0, __temp0, __end0); + __action12( + input, + __0, + __temp0, + ) +} + +pub trait __ToTriple<'input, > { + type Error; + fn to_triple(value: Self) -> Result<(usize,Token<'input>,usize),Self::Error>; +} + +impl<'input, > __ToTriple<'input, > for (usize, Token<'input>, usize) { + type Error = &'static str; + fn to_triple(value: Self) -> Result<(usize,Token<'input>,usize),&'static str> { + Ok(value) + } +} +impl<'input, > __ToTriple<'input, > for Result<(usize, Token<'input>, usize),&'static str> { + type Error = &'static str; + fn to_triple(value: Self) -> Result<(usize,Token<'input>,usize),&'static str> { + value + } +} 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 @@ +pub mod equalizer_apo; + +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 @@ +use ::{Filter, NoEqualizedSink}; + +use parsing::EqualizerApoParser; + +use ::dbus_api::equalizing_manager::OrgPulseAudioExtEqualizing1Manager; +use ::dbus_api::server_lookup::OrgPulseAudioServerLookup1; +use ::dbus_api::sink::OrgPulseAudioExtEqualizing1Equalizer; + +use dbus::{BusType, Connection, ConnPath}; +use failure::{Error, ResultExt}; + +use std::io::{self, Read}; + +pub fn connect() -> Result { + let pulse_sock_path = + get_pulse_dbus_sock().context("While looking up PulseAudio's D-Bus socket path")?; + info!("PulseAudio's D-Bus socket path is: {}", pulse_sock_path); + + trace!("Connecting to PulseAudio's D-Bus socket"); + Ok(Connection::open_private(&pulse_sock_path)?) +} + +pub fn get_equalized_sink<'a>(conn: &'a Connection) -> Result, Error> { + let conn_manager = conn.with_path("org.PulseAudio.Core1", "/org/pulseaudio/equalizing1", 2000); + + // TODO: make that a command-line option + trace!("Getting (one of) the equalized sink(s)"); + let mut sinks = conn_manager.get_equalized_sinks()?; + let sink_path = sinks.pop().ok_or(NoEqualizedSink {})?; + info!("Using equalized sink: {:?}", sink_path.as_cstr()); + + trace!("Connecting to equalized sink"); + Ok(conn.with_path("org.PulseAudio.Core1", sink_path, 2000)) +} + +pub fn send_filter(conn_sink: &ConnPath<&Connection>, filter: Filter) -> Result<(), Error> { + let channel = conn_sink.get_nchannels()?; + info!("Using channel: {}", channel); + trace!("Sending filter"); + conn_sink.seed_filter( + channel, + filter.frequencies, + filter.coefficients, + filter.preamp, + )?; + Ok(()) +} + +pub fn read_filter() -> Result { + let mut buffer = String::new(); + let stdin = io::stdin(); + let mut handle = stdin.lock(); + + info!("Reading filter in GraphicEQ format from the command line"); + handle.read_to_string(&mut buffer)?; + + // TODO: lifetime issue when "throwing" parse error + let filter = EqualizerApoParser::new().parse(&buffer).unwrap(); + info!("Parsed filter: {:?}", filter); + + Ok(filter) +} + +fn get_pulse_dbus_sock() -> Result { + trace!("Connecting to the D-Bus' session bus"); + let conn = Connection::get_private(BusType::Session)?; + let conn = conn.with_path("org.PulseAudio1", "/org/pulseaudio/server_lookup1", 2000); + + trace!("Checking PulseAudio's D-Bus socket path"); + Ok(conn.get_address()?) +} -- cgit v1.2.3