diff --git a/.github/ISSUE_TEMPLATE/bug_report.yml b/.github/ISSUE_TEMPLATE/bug_report.yml index a1af7cd..a312ed3 100644 --- a/.github/ISSUE_TEMPLATE/bug_report.yml +++ b/.github/ISSUE_TEMPLATE/bug_report.yml @@ -16,7 +16,7 @@ body: attributes: label: QuickPlay version description: From the settings page (gear in the title bar) or `waveflow-quickplay --version`. - placeholder: "1.5.0" + placeholder: "1.6.0" validations: required: true @@ -84,7 +84,7 @@ body: label: Steps to reproduce description: Numbered steps a stranger could follow on a fresh install. placeholder: | - 1. Install QuickPlay 1.5.0 with the Windows installer. + 1. Install QuickPlay 1.6.0 with the Windows installer. 2. Right-click a 24-bit FLAC → "Play with QuickPlay". 3. Observe the status line. validations: diff --git a/Cargo.lock b/Cargo.lock index 51d3217..162bc4d 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -107,6 +107,16 @@ version = "1.0.104" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "330a5ed07fa54e4702c9d6c4174f74427fc0ef6e214bbd677ae50a5099946470" +[[package]] +name = "ape-decoder" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "95097ef8efebf7b1e1d638b77935cfce25576163614427b464efe256bb8b2ec1" +dependencies = [ + "crc32fast", + "md-5 0.10.6", +] + [[package]] name = "arboard" version = "3.7.0" @@ -123,7 +133,7 @@ dependencies = [ "objc2-foundation 0.3.2", "parking_lot", "percent-encoding", - "windows-sys 0.61.2", + "windows-sys 0.59.0", "x11rb", ] @@ -153,7 +163,7 @@ checksum = "82f6aeea286b8eb4dd3431a1be1b59d290ace00f5bfd8e2a159bc2a05e2c1667" dependencies = [ "proc-macro2", "quote", - "syn 3.0.9", + "syn 3.0.10", ] [[package]] @@ -334,7 +344,7 @@ checksum = "6a1f896587b6f2c069c73d2f0913e2d590c3990285cd2f0b6aa02b786b4c679c" dependencies = [ "proc-macro2", "quote", - "syn 3.0.9", + "syn 3.0.10", ] [[package]] @@ -377,7 +387,7 @@ checksum = "43b32313e937c8721c9d17ee9bf60699a6402b4b7c2cb6ac1bee0ffcaa4b4e5e" dependencies = [ "bitflags 2.13.2", "polling", - "rustix 1.1.5", + "rustix 1.1.6", "tracing", ] @@ -400,16 +410,16 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "138efcf0940a02ebf0cc8d1eff41a1682a46b431630f4c52450d6265876021fa" dependencies = [ "calloop 0.14.5", - "rustix 1.1.5", + "rustix 1.1.6", "wayland-backend", "wayland-client", ] [[package]] name = "cc" -version = "1.8.0" +version = "1.11.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6651c9ed80effdc7db0ff72512157f901af5e3549e341e24b1dd4887d836d838" +checksum = "4ff2a8126fff0f8c839080d619675a585e61720bb12d2baceae45769fd66f155" dependencies = [ "find-msvc-tools", "jobserver", @@ -476,9 +486,9 @@ dependencies = [ [[package]] name = "clipboard-win" -version = "5.4.1" +version = "5.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bde03770d3df201d4fb868f2c9c59e66a3e4e2bd06692a0fe701e7103c7e84d4" +checksum = "052af7878466feccda12ba7a6a67d019d712f296809559b47c12c8cc196d3a9a" dependencies = [ "error-code", ] @@ -678,9 +688,9 @@ checksum = "217698eaf96b4a3f0bc4f3662aaa55bdf913cd54d7204591faa790070c6d0853" [[package]] name = "crc32fast" -version = "1.5.2" +version = "1.5.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "01a7799fd6b852db0e61728dde9a204c423b44d689dbd432522543614b490e78" +checksum = "2b929dd2a135771f40afabd1073f85eed59c800b7c61901e5c254270497dad64" dependencies = [ "cfg-if", ] @@ -736,9 +746,9 @@ dependencies = [ [[package]] name = "ctutils" -version = "0.4.3" +version = "0.4.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "03bb0e1cc970d482d121d9a1744999169b69a07470b3d644a7894e53fcaf4574" +checksum = "261af4dc7a06ea8a527a8717d8cbba3417530d6ea14e1edb3de6b67806be474f" dependencies = [ "cmov", ] @@ -807,7 +817,7 @@ dependencies = [ "libc", "option-ext", "redox_users", - "windows-sys 0.61.2", + "windows-sys 0.59.0", ] [[package]] @@ -836,7 +846,7 @@ checksum = "c6232dd377dcc64799954cbd3a9bb882e9cdc1308ccd87b1c098f1fb2eaf82a8" dependencies = [ "proc-macro2", "quote", - "syn 3.0.9", + "syn 3.0.10", ] [[package]] @@ -1019,9 +1029,9 @@ dependencies = [ [[package]] name = "encoding_rs" -version = "0.8.42" +version = "0.8.44" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8e985e0451871ad22fb8d2b6b076e2028a502a0d3950998c2c5c0a4f9b5d9679" +checksum = "89253175e704ab869b04f9db224d38630e0211a53841a79181deae0889e169f5" dependencies = [ "cfg-if", "core_detect", @@ -1075,7 +1085,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "39cab71617ae0d63f51a36d69f866391735b51691dbda63cf6f96d042b63efeb" dependencies = [ "libc", - "windows-sys 0.61.2", + "windows-sys 0.59.0", ] [[package]] @@ -1154,15 +1164,15 @@ checksum = "b97b65636e5b9ef369943878ac74335ba1c55c1cb6adbf1e2c293c624248d693" [[package]] name = "find-msvc-tools" -version = "0.1.14" +version = "0.1.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "aedcfb3409746eddb02b9e19ebda1c3394f759a152e48ee875a0844d1b955484" +checksum = "1c66915cc5391097de7a2b0b972e8505aa33c0df401fd3a6811dbdb32881ba48" [[package]] name = "flate2" -version = "1.1.10" +version = "1.1.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6e634e2e0ebac1ee034020da1ca582e17ffe4e0f5e985823721e168928136dcb" +checksum = "626d4928326b646e70f65ed36fc7cf9f206bdb68a0019ee7c6b4709da4e084c4" dependencies = [ "crc32fast", "miniz_oxide 0.9.1", @@ -1219,7 +1229,7 @@ checksum = "ea5190182e6915eb873ddbc16e23b711b6eb1f9c00a0d0a3a91b5f6228475225" dependencies = [ "proc-macro2", "quote", - "syn 3.0.9", + "syn 3.0.10", ] [[package]] @@ -1324,7 +1334,7 @@ version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1bd49230192a3797a9a4d6abe9b3eed6f7fa4c8a8a4947977c6f80025f92cbd8" dependencies = [ - "rustix 1.1.5", + "rustix 1.1.6", "windows-link", ] @@ -1406,9 +1416,9 @@ dependencies = [ [[package]] name = "globset" -version = "0.4.20" +version = "0.4.21" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "07c34a9410465b45bd9787443bc7370f37735bad04b0f0cd57ff1a3186c98988" +checksum = "f98b0d85522dc0a824cfebbc9594ff4a9b289c568bea0370319dfbdf20ccdd2d" dependencies = [ "aho-corasick", "bstr", @@ -1726,9 +1736,9 @@ dependencies = [ [[package]] name = "icu_collections" -version = "2.3.0" +version = "2.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fa68d21081c4a05d5a901a1c62add574c77048b6a1c67be3b50ce0b60d4ca513" +checksum = "fe090a42a0d3140fed8c63263ed1fecc02422cb2f4bfe55cd8de2de1b8e105dd" dependencies = [ "displaydoc", "potential_utf", @@ -1740,9 +1750,9 @@ dependencies = [ [[package]] name = "icu_locale_core" -version = "2.3.0" +version = "2.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d56e28588da92eee5c3201a6eff33fabdd49b62269c8938d4ff050ce4d900deb" +checksum = "25d29b57c17c6528d0dc4c2141cfa2d08200465acb537a3909c8b9b8a4a984c0" dependencies = [ "displaydoc", "litemap", @@ -1753,9 +1763,9 @@ dependencies = [ [[package]] name = "icu_normalizer" -version = "2.3.0" +version = "2.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "12f9cf5f235641ed274641dd81c3f28d870e276763d0797aeeab72317b1c646f" +checksum = "404a3b8c486f205c87fe7f23ab6894d84a4ad76d6e4671ae1981ba7def87c599" dependencies = [ "icu_collections", "icu_normalizer_data", @@ -1767,15 +1777,15 @@ dependencies = [ [[package]] name = "icu_normalizer_data" -version = "2.3.0" +version = "2.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1563da1ed3e0b3bf3d74c9b85917ac9c56464d2f57242270c09c9e752f8021a0" +checksum = "20f0088bfb7441f7a37fa0c9e20cb1e9cba1cac6b9ce8cd2a6dc44294f8e8cbc" [[package]] name = "icu_properties" -version = "2.3.0" +version = "2.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7e7ca276ad3145661a65914e6daf131ca5120cd3dcee8f8f3214b8875184a148" +checksum = "2ea83d991c56158f7cf898bf86436c1dfe7c07ee82fe88951f2695c9f37a379f" dependencies = [ "displaydoc", "icu_collections", @@ -1788,15 +1798,15 @@ dependencies = [ [[package]] name = "icu_properties_data" -version = "2.3.0" +version = "2.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e590f038c1464a96894fd6d10127e90a8be4509f56ff7ecef851b15cee0b7caa" +checksum = "b98f29af82d02b163fe50161388350e743bb3107cc8e8c2f7314cb505faddfcf" [[package]] name = "icu_provider" -version = "2.3.1" +version = "2.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d27bbb9d3abbefac45d55f647c9de1d44aafcd1186eb91879afef17c396c3e73" +checksum = "413099315636c588ee8f011190b329b971a09a8fae9d157e01dcae8379468514" dependencies = [ "displaydoc", "icu_locale_core", @@ -1809,9 +1819,9 @@ dependencies = [ [[package]] name = "id3" -version = "1.17.2" +version = "1.17.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ef8be496a46468ba3d43690775aa3a79102ce4daf7d99e8072589aae1a3cd955" +checksum = "33cf1819f31542d9f81db9caa644f91bcf8a375f6de0ce649e4596778b955ab7" dependencies = [ "bitflags 2.13.2", "byteorder", @@ -1886,9 +1896,9 @@ dependencies = [ [[package]] name = "interprocess" -version = "2.4.7" +version = "2.4.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a4a4fff6c51dece332bdbf3af5fe376c49cfc8dced782725e95be0bb489e35d7" +checksum = "0f0ed453af5ae3bdbf68e41dde07eae0bffcc986419f63521ba9c89d82988c70" dependencies = [ "doctest-file", "libc", @@ -1914,9 +1924,9 @@ dependencies = [ [[package]] name = "itoa" -version = "1.0.18" +version = "1.0.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8f42a60cbdf9a97f5d2305f08a87dc4e09308d1276d28c869c684d7777685682" +checksum = "3bd1574e617a9a6c1f8f8181bd7e841e1f20e4277607ef28945765188d6284d4" [[package]] name = "jni" @@ -1988,9 +1998,9 @@ dependencies = [ [[package]] name = "js-sys" -version = "0.3.106" +version = "0.3.107" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7883d941dae510fb2d978fc3fe018c71c9e2892fd38854de3e8b92c2e5ad9cc5" +checksum = "8dc09d2154098bbf4ef54eab6b117a3c24cbbffe94046b16ee6d6d4510584d3a" dependencies = [ "cfg-if", "futures-util", @@ -2127,14 +2137,14 @@ checksum = "fdbca1b60ba7cea959ffc84ac27f3dbdbacd6dfda168c7eabbc00e48654bb9fd" dependencies = [ "proc-macro2", "quote", - "syn 3.0.9", + "syn 3.0.10", ] [[package]] name = "log" -version = "0.4.34" +version = "0.4.35" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f9f8bd3e56ce4dfc153cf470fffbfa98c7620958b312ca5c3a4b8d5181fd13c6" +checksum = "5d15f86d12da44cd8d4ec3c73984537eb7f4cadcb9776a575a0a8a05ca11005c" [[package]] name = "lru-slab" @@ -2157,6 +2167,16 @@ dependencies = [ "regex-automata", ] +[[package]] +name = "md-5" +version = "0.10.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d89e7ee0cfbedfc4da3340218492196241d89eefb6dab27de5df917a6d2e78cf" +dependencies = [ + "cfg-if", + "digest 0.10.7", +] + [[package]] name = "md-5" version = "0.11.0" @@ -2175,9 +2195,9 @@ checksum = "cf8baf1c55e62ffcace7a9f06f4bd9cd3f0c4beb022d3b367256b91b87513d98" [[package]] name = "memmap2" -version = "0.9.11" +version = "0.9.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d1219ed1b7f229ee7104d281dd01d6802fe28bb6e95d292942c4daacdeb798c0" +checksum = "6b0ca1155a9ecc25aa12e8313a119f32edf0255fea2f44839c4ac0a12b2ac157" dependencies = [ "libc", ] @@ -2314,7 +2334,7 @@ version = "0.50.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7957b9740744892f114936ab4a57b3f487491bbeafaf8083688b16841a4240e5" dependencies = [ - "windows-sys 0.61.2", + "windows-sys 0.59.0", ] [[package]] @@ -2738,9 +2758,9 @@ checksum = "04744f49eae99ab78e0d5c0b603ab218f515ea8cfe5a456d7629ad883a3b6e7d" [[package]] name = "opusic-sys" -version = "0.7.5" +version = "0.7.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c9d1ecdf206421bc74343ab3bb2f30ad2abbfee41fa341f7181fecbaf957769a" +checksum = "986d749e9dc12035f11bf3ecc83a2a696ff7534d4143be9469a4a0faa25b9fd1" dependencies = [ "cmake", ] @@ -2882,7 +2902,7 @@ dependencies = [ "concurrent-queue", "hermit-abi", "pin-project-lite", - "rustix 1.1.5", + "rustix 1.1.6", "windows-sys 0.61.2", ] @@ -3032,7 +3052,7 @@ dependencies = [ "once_cell", "socket2", "tracing", - "windows-sys 0.61.2", + "windows-sys 0.59.0", ] [[package]] @@ -3248,9 +3268,9 @@ dependencies = [ [[package]] name = "resvg" -version = "0.48.1" +version = "0.49.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "67e3803f97b999e80cbf7c6ecdd07a8102204d92e1633cf48783720c521196bd" +checksum = "1572844b6727a1bf842190e9947641a68ac44bed83f50afb4bd1407a2564bee8" dependencies = [ "bytemuck", "log", @@ -3313,9 +3333,9 @@ dependencies = [ [[package]] name = "roxmltree" -version = "0.21.1" +version = "0.21.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f1964b10c76125c36f8afe190065a4bf9a87bf324842c05701330bba9f1cacbb" +checksum = "9da7f59328b09405b181fee1018925fad50f157afb43c0c0f5c522c256dd5907" dependencies = [ "memchr", ] @@ -3392,15 +3412,15 @@ dependencies = [ [[package]] name = "rustix" -version = "1.1.5" +version = "1.1.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "891efababe418670775f199f0d233d84843c227a0949a883ce15b37c78d6629d" +checksum = "e5e76742e5294153d4dde1207dbec5bdd81eef6fabdc0d2118babadabfd858aa" dependencies = [ "bitflags 2.13.2", "errno", "libc", "linux-raw-sys 0.12.1", - "windows-sys 0.61.2", + "windows-sys 0.59.0", ] [[package]] @@ -3429,9 +3449,9 @@ dependencies = [ [[package]] name = "rustls-webpki" -version = "0.103.15" +version = "0.103.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f3c3cf1d8b1e7d4927e2d154c3fcb02979afb9939629c62cd9048d4f07b60ac2" +checksum = "4443b1b6d39d7c663139942cc4558262562d2c84123bb6282ef177009ca8b281" dependencies = [ "ring", "rustls-pki-types", @@ -3444,6 +3464,12 @@ version = "1.0.23" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cf54715a573b99ac80df0bc206da022bcd442c974952c7b9720069370852e21f" +[[package]] +name = "rusty_aac" +version = "2.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "93388483e43ffd3bb3c347794a849edb204438258d8642b8449992a56433798a" + [[package]] name = "ryu" version = "1.0.23" @@ -3510,7 +3536,7 @@ checksum = "e7a5d71263a5a7d47b41f6b3f06ba276f10cc18b0931f1799f710578e2309348" dependencies = [ "proc-macro2", "quote", - "syn 3.0.9", + "syn 3.0.10", ] [[package]] @@ -3528,9 +3554,9 @@ dependencies = [ [[package]] name = "serde_spanned" -version = "1.1.2" +version = "1.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4e7523beb55eece201a2356bee0bbca0d1ab466c14c07703b2e0ee6d42cb0c2c" +checksum = "9c187e0a369471c550af028cba56d4f4fa2a489ad28151ae95a4d340a2a8b782" dependencies = [ "serde_core", ] @@ -3678,9 +3704,9 @@ dependencies = [ [[package]] name = "smallvec" -version = "1.16.3" +version = "1.16.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5b3dc8af474f516a851ff4bd12db780f948b9250ad37211e4eec0bccea54e01b" +checksum = "149309498a5f7334b12ddae0cad8aba81ce785fe91755068867e017cf98fee46" dependencies = [ "serde", ] @@ -3723,7 +3749,7 @@ dependencies = [ "libc", "log", "memmap2", - "rustix 1.1.5", + "rustix 1.1.6", "thiserror 2.0.21", "wayland-backend", "wayland-client", @@ -3901,7 +3927,7 @@ dependencies = [ "hmac", "itoa", "log", - "md-5", + "md-5 0.11.0", "memchr", "rand", "serde", @@ -3985,9 +4011,9 @@ checksum = "13c2bddecc57b384dee18652358fb23172facb8a2c51ccc10d74c157bdea3292" [[package]] name = "svgtypes" -version = "0.16.1" +version = "0.16.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "695b5790b3131dafa99b3bbfd25a216edb3d216dad9ca208d4657bfb8f2abc3d" +checksum = "9f12b12995e3638c70618c1facb1ce65302f6a6f706b675f07c58a5d7391120e" dependencies = [ "kurbo", "siphasher", @@ -4167,9 +4193,9 @@ dependencies = [ [[package]] name = "syn" -version = "3.0.9" +version = "3.0.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d78c8dee4c7bf0e14673097256fed6142ce9d3b85a408189d07482442145823b" +checksum = "4ae9ccbea3a7b0b09443036490c8f34a8b1b760fd345e5c0dae0aac718faea79" dependencies = [ "proc-macro2", "quote", @@ -4193,7 +4219,7 @@ checksum = "901704edd0dfe137f1987838ee4f259e4e063c31371bdb423f7ae38ec6f77f02" dependencies = [ "proc-macro2", "quote", - "syn 3.0.9", + "syn 3.0.10", ] [[package]] @@ -4242,7 +4268,7 @@ checksum = "fe5197923287db20a58125f0bc85c062f7f2c892de97b18c356f9efb14b28524" dependencies = [ "proc-macro2", "quote", - "syn 3.0.9", + "syn 3.0.10", ] [[package]] @@ -4296,9 +4322,9 @@ dependencies = [ [[package]] name = "tinystr" -version = "0.8.4" +version = "0.8.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b1e27c91459209c2986af3dcf603a5a74a4368754ce37414f59acc971167f643" +checksum = "abc840c238154d58f9e86b2792261edfde565a17696e1cda1a449de27979801a" dependencies = [ "displaydoc", "zerovec", @@ -4312,9 +4338,9 @@ checksum = "fd3ca314f692efd6c868f8408f53fe444634a845f96c028b97d35f6a1f79f0ee" [[package]] name = "tokio" -version = "1.53.3" +version = "1.54.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ce3335fa71841cda333a58d7615b03901380ecf09d59b3296d21f8bbac0dde4e" +checksum = "b52fd3255258d26fac7264ab5a76b53c13367136dc011d3d6ad4f8ed070396a3" dependencies = [ "bytes", "libc", @@ -4336,9 +4362,9 @@ dependencies = [ [[package]] name = "toml" -version = "1.1.8+spec-1.1.0" +version = "1.2.1+spec-1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "20489e00e4d8741d6be680764cc12e270655e375a20d1011e844a9c3379e678d" +checksum = "d5755c51863cdac711f1956baf8eb9588e060755f7d3c4c979e70ea1e1f32cd7" dependencies = [ "indexmap", "serde_core", @@ -4351,18 +4377,18 @@ dependencies = [ [[package]] name = "toml_datetime" -version = "1.1.2+spec-1.1.0" +version = "1.1.3+spec-1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2b86d767906c6c42421dcba507eb9d203e779497710a47782a224bb871653053" +checksum = "173f25c883cd2176a2d8212155638c0a60d484a9d84546d270866f40f56b6e49" dependencies = [ "serde_core", ] [[package]] name = "toml_edit" -version = "0.25.17+spec-1.1.0" +version = "0.25.19+spec-1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e3641d5bbb5349a79e1020a242d251efbc546ad8048d133958323ce9c40a9c9c" +checksum = "dd43688c4858d7264ae1cf9a9f874a67c3feb74a883b1cd7bebd6a4ea8307218" dependencies = [ "indexmap", "toml_datetime", @@ -4381,9 +4407,9 @@ dependencies = [ [[package]] name = "toml_writer" -version = "1.1.3+spec-1.1.0" +version = "1.2.0+spec-1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "06bdbd8cfc056b8d2e2e85f29b56a3bdbecb527cef81eb39e3e7b98af4652770" +checksum = "009dbb7700f11c55ef83aebbe4c0e9cf1f1ac0844bd8d6f00dc38f302026e13a" [[package]] name = "tower" @@ -4552,9 +4578,9 @@ dependencies = [ [[package]] name = "unicode-properties" -version = "0.1.4" +version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7df058c713841ad818f1dc5d3fd88063241cc61f49f5fbea4b951e8cf5a8d71d" +checksum = "993ad287eb20e8ba755312801cfe1413e0f25d604075863acaddca10b04c1833" [[package]] name = "unicode-segmentation" @@ -4564,9 +4590,9 @@ checksum = "c6f5d3c3b1bf09027a88a6bc961fc00497d651009560b5463668dc81b0fa87a8" [[package]] name = "unicode-width" -version = "0.2.2" +version = "0.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b4ac048d71ede7ee76d585517add45da530660ef4390e49b098733c6e897f254" +checksum = "ca718471876992059f251e33aafc334346ada08042b7661dd1fe313a9bced557" [[package]] name = "untrusted" @@ -4588,9 +4614,9 @@ dependencies = [ [[package]] name = "usvg" -version = "0.48.1" +version = "0.49.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "977d0a4abdef933f424a99fe09f95576e089b90aebc6f016a3bc813762493e91" +checksum = "d09b73ee83641d390ad7ffd9000f347b16eb128e437675b6ff277ea5c7fcf22c" dependencies = [ "data-url", "imagesize", @@ -4607,15 +4633,24 @@ dependencies = [ [[package]] name = "utf8_iter" -version = "1.0.4" +version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b6c140620e7ffbb22c2dee59cafe6084a59b5ffc27a8859a5f0d494b5d52b6be" +checksum = "af3bd9d3e571c26fcce9d033b87ea5ab061b8d2ffe9b7a5675d810d68f03edf0" +dependencies = [ + "utf_types", +] + +[[package]] +name = "utf_types" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3a3b425286980a367278453f3b6d28cdcb134b574e5a35824a6ff5eebad50bb6" [[package]] name = "uuid" -version = "1.28.0" +version = "1.29.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7cc1186384beb7dd8eedea376413fd654937285ea6c9cfbb928dc3043ea4b606" +checksum = "bed99139f7dac9b5cfe5f17be4d66dc7079a34dee1d74bcc77217119240e267c" dependencies = [ "getrandom 0.4.3", "js-sys", @@ -4716,12 +4751,11 @@ dependencies = [ [[package]] name = "wasm-bindgen" -version = "0.2.129" +version = "0.2.130" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9bb54f33acc68fd454578d9820b0bde1a1a3d17aa17bb7b6595806d02886d409" +checksum = "a0181c14ddd6c7b8b0b0132a5f1ea2f32be0d893cd3ea97b6e3b28886b8a3d1c" dependencies = [ "cfg-if", - "once_cell", "rustversion", "wasm-bindgen-macro", "wasm-bindgen-shared", @@ -4729,9 +4763,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-futures" -version = "0.4.79" +version = "0.4.80" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3cbab34de2d982e9b48e18d216d04c4a6f641066ff19ffb699980f591ee3610e" +checksum = "5e14e0327cb5368ad60ccb22d04a9827a693c95a926d8d125e9fa39e0baec501" dependencies = [ "js-sys", "tokio", @@ -4740,9 +4774,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro" -version = "0.2.129" +version = "0.2.130" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2e29d0c35b16e224a7eeb5cd2d25e3e1968fbd65604117b44d3b789d00ee8535" +checksum = "6e931a02a39abdbf66966fc35902b5ed58344750a70885bed4ebb3d8eaf28ed9" dependencies = [ "quote", "wasm-bindgen-macro-support", @@ -4750,34 +4784,36 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro-support" -version = "0.2.129" +version = "0.2.130" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6f501a8bc3719dba86ef8ae4728879c08001bea749eb1333ac5b91e040e2a6b7" +checksum = "2ca4b54280e455bd831e33a6b8e734baf432fe63fbc35c42ac14ce67a043a53a" dependencies = [ "bumpalo", "proc-macro2", "quote", - "syn 3.0.9", + "syn 3.0.10", "wasm-bindgen-shared", ] [[package]] name = "wasm-bindgen-shared" -version = "0.2.129" +version = "0.2.130" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "23f0c9c52aa7cd7d77769a4cfe2a9adb1b331f489a41d912ce14513d5ab995c6" +checksum = "3b1f9c3798725016c6ee5f2f57869ec0831e8bbc0ab0310a86e787e97f41389e" dependencies = [ "unicode-ident", ] [[package]] name = "waveflow-core" -version = "1.9.1" -source = "git+https://github.com/InstaZDLL/WaveFlow?rev=14ff457b5e78be39b541bac07f36e62e5751d867#14ff457b5e78be39b541bac07f36e62e5751d867" +version = "2.0.0" +source = "git+https://github.com/InstaZDLL/WaveFlow?rev=567fc858d1fd7e62a39be052be195c6cbdf47a45#567fc858d1fd7e62a39be052be195c6cbdf47a45" dependencies = [ "anyhow", + "ape-decoder", "async-trait", "blake3", + "cc", "chardetng", "chrono", "encoding_rs", @@ -4787,7 +4823,7 @@ dependencies = [ "id3", "image", "lofty", - "md-5", + "md-5 0.11.0", "opusic-sys", "pinyin", "realfft", @@ -4796,6 +4832,7 @@ dependencies = [ "resvg", "roxmltree", "rubato", + "rusty_aac", "serde", "serde_json", "sqlx", @@ -4803,14 +4840,16 @@ dependencies = [ "thiserror 2.0.21", "tiny-skia", "tracing", + "url", "usvg", "uuid", + "wavicle", "windows-sys 0.61.2", ] [[package]] name = "waveflow-quickplay" -version = "1.5.0" +version = "1.6.0" dependencies = [ "cpal", "crossbeam-channel", @@ -4844,6 +4883,12 @@ dependencies = [ "x11-dl", ] +[[package]] +name = "wavicle" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e312eaf22b4a7e5b7bf038edb3a7e4703c7b86dfabaea49d17af85e55eb76ab" + [[package]] name = "wayland-backend" version = "0.3.17" @@ -4852,7 +4897,7 @@ checksum = "38a91b4eaddff87b1cd1074985e3713da4af2c49742d1b356b2c01670a67a078" dependencies = [ "cc", "downcast-rs", - "rustix 1.1.5", + "rustix 1.1.6", "scoped-tls", "smallvec", "wayland-sys", @@ -4865,7 +4910,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e3c36a0f861ad76d0901f2800b46321410d9f73f2ea88aac0650d86c32688073" dependencies = [ "bitflags 2.13.2", - "rustix 1.1.5", + "rustix 1.1.6", "wayland-backend", "wayland-scanner", ] @@ -4887,7 +4932,7 @@ version = "0.31.14" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4a52d18780be9b1314328a3de5f930b73d2200112e3849ca6cb11822793fb34d" dependencies = [ - "rustix 1.1.5", + "rustix 1.1.6", "wayland-client", "xcursor", ] @@ -4981,9 +5026,9 @@ dependencies = [ [[package]] name = "web-sys" -version = "0.3.106" +version = "0.3.107" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "88261b9deccee56594c11a3460c462c41f58d148598fe70ad77070126a68aba4" +checksum = "d7d179596ff5ec0f6de4db64d54011bde6289cc49603d3a6e4ce3f329207ab88" dependencies = [ "js-sys", "wasm-bindgen", @@ -5001,9 +5046,9 @@ dependencies = [ [[package]] name = "webpki-roots" -version = "1.0.9" +version = "1.0.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7dcd9d09a39985f5344844e66b0c530a33843579125f23e21e9f0f220850f22a" +checksum = "f5f280bbb2b287bc8e7de7e3852945a0ff50d1bbcb5ed42b6c7a568c546df171" dependencies = [ "rustls-pki-types", ] @@ -5151,7 +5196,7 @@ version = "0.1.11" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c2a7b1c03c876122aa43f3020e6c3c3ee5c05081c9a00739faf7503aeba10d22" dependencies = [ - "windows-sys 0.61.2", + "windows-sys 0.59.0", ] [[package]] @@ -5417,9 +5462,9 @@ dependencies = [ [[package]] name = "winnow" -version = "1.0.4" +version = "1.0.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "23b97319f7b8343df12cc98938e5c3eb436064524c8d2b4e30a1d3a36eecdf81" +checksum = "8c3b93199df0ab874cdf0c6a94f0a0dc3423fe41f1cafb62b8bd7b1deb277aef" dependencies = [ "memchr", ] @@ -5468,7 +5513,7 @@ dependencies = [ "libc", "libloading", "once_cell", - "rustix 1.1.5", + "rustix 1.1.6", "x11rb-protocol", ] @@ -5511,9 +5556,9 @@ checksum = "e450f9b2ed1dff33c94c12589a87338689467b9c4f5d8a5710bd09a847d2c8a7" [[package]] name = "yoke" -version = "0.8.3" +version = "0.8.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "709fe23a0424b6a435d82152b1bd3fdfb0833487d5fa90d05d42762a9891fef5" +checksum = "417ef3fcf6c300b7dbd25c85531a746931c02ad536f3cf4786ed1e88223340b3" dependencies = [ "stable_deref_trait", "yoke-derive", @@ -5528,7 +5573,7 @@ checksum = "ec8ebde2db3681e8c9980cc27822030e68752690ddfa9473e739aeb4dbde6d71" dependencies = [ "proc-macro2", "quote", - "syn 3.0.9", + "syn 3.0.10", "synstructure", ] @@ -5569,7 +5614,7 @@ checksum = "f75b4683f6c7f45248d4d64056a24298c6281e0993356d7d1b4a1a962ef10d4a" dependencies = [ "proc-macro2", "quote", - "syn 3.0.9", + "syn 3.0.10", "synstructure", ] @@ -5592,9 +5637,9 @@ dependencies = [ [[package]] name = "zerovec" -version = "0.11.8" +version = "0.11.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bb0464e17806c1d976d5cba29399c7f08e516e279e2ba493f63123b5fca67dd8" +checksum = "f58a2799cfe9a1670c7ea8edbd52ef8edb93cb37a7f83bf31ba9e35d9dae6a40" dependencies = [ "yoke", "zerofrom", @@ -5603,13 +5648,13 @@ dependencies = [ [[package]] name = "zerovec-derive" -version = "0.11.6" +version = "0.11.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "34df6fc39dbd26ddc9c10e6a2984476e13acce22e64e4487636ef494369225da" +checksum = "c3743ddbf47738d929cd1ae2e199d40d0162979dfe31aef8ae646d2bf00bf97a" dependencies = [ "proc-macro2", "quote", - "syn 3.0.9", + "syn 3.0.10", ] [[package]] diff --git a/Cargo.toml b/Cargo.toml index 0314385..3b53e1e 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "waveflow-quickplay" -version = "1.5.0" +version = "1.6.0" description = "WaveFlow QuickPlay — a standalone, lightweight egui/eframe audio player built on WaveFlow's Rust audio infrastructure." authors = ["InstaZDLL "] edition = "2021" @@ -31,7 +31,7 @@ publish = false # next door; bump the `rev` to pick up core changes. For local work against # a WaveFlow checkout, override it from the command line: # cargo build --config 'patch."https://github.com/InstaZDLL/WaveFlow".waveflow-core.path="../WaveFlow/src-tauri/crates/core"' -waveflow-core = { git = "https://github.com/InstaZDLL/WaveFlow", rev = "14ff457b5e78be39b541bac07f36e62e5751d867", features = [ +waveflow-core = { git = "https://github.com/InstaZDLL/WaveFlow", rev = "567fc858d1fd7e62a39be052be195c6cbdf47a45", features = [ "playback", ] } diff --git a/README.md b/README.md index 3698ec0..72e24f9 100644 --- a/README.md +++ b/README.md @@ -12,7 +12,7 @@

- Version 1.5.0 + Version 1.6.0 Windows, Linux and macOS Opens in under 300 ms GPL-3.0-only @@ -99,7 +99,7 @@ They are complementary, not two sizes of the same thing: QuickPlay deliberately ### 🎧 Playback -- **Every format WaveFlow plays**: MP3, FLAC, WAV, AIFF, Vorbis, Opus, AAC, ALAC, DSF and DFF, with the desktop app's own decoders. +- **Every format WaveFlow plays**: MP3, FLAC, WAV, AIFF, Vorbis, Opus, AAC, ALAC, WavPack, Monkey's Audio (APE), DSF and DFF, with the desktop app's own decoders (WaveFlow 2.0.0). Hybrid (lossy) WavPack and floating-point APE are not decoded. - **Files, folders and playlists** from the command line, a drop on either window or the open dialog; folders are walked four levels deep without blocking the window. An `.m3u` or `.m3u8` playlist queues its files in its own order, whether it gives them as absolute paths, paths relative to it or `file://` URLs, and whatever code page wrote it; web addresses and files that are not there are left out. A network share (`\\host\share`) is followed only from a playlist on that same host, since on Windows merely opening one can make Windows authenticate to that host with your current credentials; mapped drives always work. - **Instant pause, clean seeks**, no clicks or pops: the audio thread never waits on the interface. - **Auto-advance** with the track's tail played out; broken files are skipped and flagged in the playlist. @@ -131,7 +131,7 @@ They are complementary, not two sizes of the same thing: QuickPlay deliberately - **One instance**: a second launch hands its files to the open player and exits. Plain launch replaces the queue and plays, `--enqueue` appends; Explorer's "Play with" / "Add to playlist" hand a whole multi-selection to one process. - `--register` adds *Play with QuickPlay* and *Add to QuickPlay playlist* to the context menu of every audio extension, of `.m3u` / `.m3u8` playlists and of folders, plus an "Open with" entry and a Settings › Default apps entry, for the current user and without administrator rights. Once QuickPlay is the default player for a format, its files show a WaveFlow document icon with the format (FLAC, MP3, …). If you made QuickPlay the default player before these icons came, pick it again for each format (Settings › Default apps, or *Open with › Always*) to get them: Windows keeps the earlier choice, which has one icon for every format. On Linux it writes a `.desktop` entry with the audio and M3U MIME types. `--unregister` removes it all. - The default handler for the extensions is left to you (Settings › Default apps, or `xdg-mime default app.waveflow.quickplay.desktop audio/flac`). -- **macOS**: the app declares the audio formats it plays, so once it is in Applications Finder lists it under *Open With* for them, a multi-selection included. To make it the default player for a format, select a file, *Get Info › Open with › WaveFlow QuickPlay › Change All*. DSF and DFF files then show the same WaveFlow document icon with the format as on Windows, everywhere. The formats macOS itself knows (FLAC, MP3, AAC, playlists…) keep macOS's own icon in the icon and list views (or the cover, with icon previews on), even with icon previews turned off; for them the WaveFlow icon shows in the *Get Info* window (its header and title bar). Finder has no per-app menu entries, so there is no *Add to playlist* there. +- **macOS**: the app declares the audio formats it plays, so once it is in Applications Finder lists it under *Open With* for them, a multi-selection included. To make it the default player for a format, select a file, *Get Info › Open with › WaveFlow QuickPlay › Change All*. DSF, DFF, WavPack and APE files then show the same WaveFlow document icon with the format as on Windows, everywhere. The formats macOS itself knows (FLAC, MP3, AAC, playlists…) keep macOS's own icon in the icon and list views (or the cover, with icon previews on), even with icon previews turned off; for them the WaveFlow icon shows in the *Get Info* window (its header and title bar). Finder has no per-app menu entries, so there is no *Add to playlist* there. ### ⚙️ Settings and languages diff --git a/assets/file-icons/ape.ico b/assets/file-icons/ape.ico new file mode 100644 index 0000000..fe74ecc Binary files /dev/null and b/assets/file-icons/ape.ico differ diff --git a/assets/file-icons/svg/ape.svg b/assets/file-icons/svg/ape.svg new file mode 100644 index 0000000..5e3736d --- /dev/null +++ b/assets/file-icons/svg/ape.svg @@ -0,0 +1,10 @@ + +QuickPlay APE fileWaveFlow symbol on a folded audio document. Transparent background. All lettering is outlined. + + + + + + + + \ No newline at end of file diff --git a/assets/file-icons/svg/wv.svg b/assets/file-icons/svg/wv.svg new file mode 100644 index 0000000..43a3f5e --- /dev/null +++ b/assets/file-icons/svg/wv.svg @@ -0,0 +1,10 @@ + +QuickPlay WV fileWaveFlow symbol on a folded audio document. Transparent background. All lettering is outlined. + + + + + + + + \ No newline at end of file diff --git a/assets/file-icons/wv.ico b/assets/file-icons/wv.ico new file mode 100644 index 0000000..50e0cc3 Binary files /dev/null and b/assets/file-icons/wv.ico differ diff --git a/docs/ARCHITECTURE.md b/docs/ARCHITECTURE.md index 08af8b4..444d9c2 100644 --- a/docs/ARCHITECTURE.md +++ b/docs/ARCHITECTURE.md @@ -297,8 +297,8 @@ as `play` does, without the burst rule (Explorer's one process per file); a multi-selection arrives in one piece. Each format is its own document type with a `CFBundleTypeIconFile`, the same document icons as on Windows, for the files whose default player -is QuickPlay. DSF and DFF, which macOS has no type for, show them -everywhere. For the types macOS declares itself (FLAC, MP3, AAC, M3U…) +is QuickPlay. DSF, DFF, WavPack and APE, which macOS has no type for, +show them everywhere. For the types macOS declares itself (FLAC, MP3, AAC, M3U…) Finder's icon and list views keep the system's icon (or the cover, with icon previews on), even with icon previews turned off (checked on macOS 26.7); the icon appears in the Get Info window (header and title bar). The `.icns` files in diff --git a/docs/releases/v1.6.0.md b/docs/releases/v1.6.0.md new file mode 100644 index 0000000..46a513d --- /dev/null +++ b/docs/releases/v1.6.0.md @@ -0,0 +1,35 @@ +

+ WaveFlow QuickPlay +

+ +# WaveFlow QuickPlay 1.6.0 + +Your audio files now look like WaveFlow files when QuickPlay is their default player, and QuickPlay plays WavPack and Monkey's Audio. + +## New + +- **WavPack (`.wv`) and Monkey's Audio (`.ape`)**: QuickPlay now decodes with the engine of WaveFlow 2.0.0, which reads both, stereo or multichannel. They are registered like the other formats: the context menu and *Open with* on Windows and Linux, *Open With* on macOS, Default apps and the per-format icons. +- **An icon per format on Windows**: once QuickPlay is the default player for a format, its files show a WaveFlow document with the format on it (FLAC, MP3, WAV, AIFF, Ogg, Opus, M4A, MP4, AAC, WavPack, APE, DSF, DFF, M3U, M3U8), in every Explorer view, as a badge on cover thumbnails, and in the file's properties. The *Type* column says "FLAC audio file" and so on, in QuickPlay's language. +- **QuickPlay in Settings › Default apps on Windows**: it is listed there with every format it plays, so it can be made the default player for each one in one place. *Open with › Always use this app* works too. QuickPlay still never makes itself the default: that stays your choice. +- **Format icons on macOS**: once QuickPlay is the default player for a format (*Get Info › Open with › Change All*), its files get the same WaveFlow document icon. DSF, DFF, WavPack and APE files show it everywhere in Finder. For the formats macOS knows itself (FLAC, MP3, AAC, playlists…), Finder keeps its own icon in the icon and list views and shows QuickPlay's in the *Get Info* window: that is Finder's choice, not something an app can change. + +## Install + +- **Windows**: download `waveflow-quickplay_1.6.0_x64-setup.exe`. It installs for the current user without administrator rights and registers the context-menu entries, the per-format icons and the Default apps entry. Run it over an earlier version to upgrade; your settings live in their own file and are kept. +- **Linux**, on x86_64 (`amd64`, `x86_64` in the file name) or Arm (`arm64`, `aarch64`): the `.deb` for Debian and Ubuntu, the `.rpm` for Fedora, RHEL and openSUSE, or the `.AppImage` for any distribution (make it executable and run it). The `.deb` and the `.rpm` install the desktop entry, so QuickPlay appears in *Open with* for audio files and playlists. An AppImage installs nothing: run it once with `--register` for the same entry. +- **macOS**: download `waveflow-quickplay_1.6.0_macos-universal.dmg`, open it and drag *WaveFlow QuickPlay* to Applications. The app is signed ad hoc, not by an Apple Developer ID, so macOS blocks the first launch: open System Settings › Privacy & Security and choose *Open Anyway* (on macOS 14 and earlier, right-click the app and choose *Open*). + +1.2.0 to 1.5.0, installed from the Windows installer, the macOS app or an AppImage, update themselves to 1.6.0: they download it at launch and install it when you close QuickPlay, once it says "QuickPlay 1.6.0 will be installed when you close it", for six seconds in the status line under the title; closed before that, it picks up again at the next launch. Missed the message? Close QuickPlay, open it again and look at the version in the settings page; if it is still the old one after a launch or two, install 1.6.0 by hand. That takes *Check for updates at launch*, at the bottom of the settings page, which is on unless you turned it off. If it is off, either turn it back on and start QuickPlay again (the check runs only at launch), or install 1.6.0 by hand. 1.0.0 and 1.1.0 do not look for updates, so they are upgraded by hand once. + +SHA-256 checksums are in `SHA256SUMS-windows.txt`, `SHA256SUMS-linux.txt` (x86_64), `SHA256SUMS-linux-aarch64.txt` and `SHA256SUMS-macos.txt`. `latest.json` is what the updater reads: it lists the packages that update themselves (the Windows installer, the macOS app and the two AppImages), each with its signature. + +> [!NOTE] +> The Windows installer is signed with WaveFlow's self-signed certificate, so Windows may still show a SmartScreen warning on first launch. + +## Known limitations + +- **Some WavPack and Monkey's Audio files** are not decoded by WaveFlow 2.0.0's engine: hybrid WavPack (with or without its `.wvc` correction file), DSD WavPack, floating-point APE, 32-bit APE with more than one channel (stereo included), and APE older than format 3950. Such files are left out when they are queued. +- **Already made QuickPlay your default player on Windows?** Pick it again for each format (Settings › Default apps, or *Open with › Always use this app*) to get the new icons. Windows keeps the choice you made before, which points at an entry with one icon for every format, and no app may change that choice for you. +- **On macOS** the icons show only once QuickPlay is the default player for a format, and, for the formats macOS knows itself, only in the *Get Info* window (see above). +- **Linux** has no per-format icons: a file's icon there comes from the icon theme, whatever the default player, so QuickPlay leaves it alone. +- A `.deb`, an `.rpm` and a copy run from a read-only place (the disk image itself, or an app macOS runs from a translocated copy because it was not moved to Applications) are never replaced by QuickPlay: they only say that a new version is out. diff --git a/packaging/app.waveflow.quickplay.desktop b/packaging/app.waveflow.quickplay.desktop index b27980a..5f9d0bb 100644 --- a/packaging/app.waveflow.quickplay.desktop +++ b/packaging/app.waveflow.quickplay.desktop @@ -13,7 +13,7 @@ Exec=waveflow-quickplay %F Icon=app.waveflow.quickplay Terminal=false Categories=AudioVideo;Audio;Player; -MimeType=audio/flac;audio/mpeg;audio/mp4;audio/x-m4a;audio/aac;audio/x-aac;audio/ogg;audio/vorbis;audio/x-vorbis+ogg;audio/opus;audio/x-opus+ogg;audio/wav;audio/x-wav;audio/vnd.wave;audio/aiff;audio/x-aiff;audio/x-dsf;audio/x-dff;audio/x-dsd;audio/x-mpegurl;audio/mpegurl;application/vnd.apple.mpegurl; +MimeType=audio/flac;audio/mpeg;audio/mp4;audio/x-m4a;audio/aac;audio/x-aac;audio/ogg;audio/vorbis;audio/x-vorbis+ogg;audio/opus;audio/x-opus+ogg;audio/wav;audio/x-wav;audio/vnd.wave;audio/aiff;audio/x-aiff;audio/x-dsf;audio/x-dff;audio/x-dsd;audio/x-wavpack;audio/x-ape;audio/x-mpegurl;audio/mpegurl;application/vnd.apple.mpegurl; StartupWMClass=app.waveflow.quickplay Actions=Enqueue; diff --git a/packaging/macos/Info.plist b/packaging/macos/Info.plist index 01cab3c..cdc68ed 100644 --- a/packaging/macos/Info.plist +++ b/packaging/macos/Info.plist @@ -11,7 +11,7 @@ One entry per format, each with its document icon (bundle.sh copies packaging/macos/file-icons/*.icns into Resources, file-icons.sh makes them), for the files QuickPlay is the default player of: everywhere for - DSF and DFF; for the types macOS declares itself, Finder's icon and list + DSF, DFF, WavPack and APE; for the types macOS declares itself, Finder's icon and list views keep the system's icon and Get Info shows this one. --> @@ -133,6 +133,34 @@ aac + + CFBundleTypeName + WavPack audio file + CFBundleTypeIconFile + wv.icns + CFBundleTypeRole + Viewer + LSHandlerRank + Alternate + CFBundleTypeExtensions + + wv + + + + CFBundleTypeName + Monkey's Audio file + CFBundleTypeIconFile + ape.icns + CFBundleTypeRole + Viewer + LSHandlerRank + Alternate + CFBundleTypeExtensions + + ape + + CFBundleTypeName DSF audio file diff --git a/packaging/macos/file-icons.sh b/packaging/macos/file-icons.sh index a689b02..f3f78b6 100755 --- a/packaging/macos/file-icons.sh +++ b/packaging/macos/file-icons.sh @@ -17,7 +17,7 @@ src="$root/assets/file-icons/svg" out="$here/file-icons" # The formats Info.plist gives an icon of their own. .aif and .oga use the # aiff and ogg icons; .mp4 is not declared on macOS. -formats=(flac mp3 wav aiff ogg opus m4a aac dsf dff m3u m3u8) +formats=(flac mp3 wav aiff ogg opus m4a aac wv ape dsf dff m3u m3u8) # (type, pixels) for each entry: 16 pt and 32 pt @2x (ic11, ic12), then # 128 to 512 pt, each @1x and @2x. No 16 or 32 pixel frame: Finder (macOS # 26) draws the PNG types for them, icp4 and icp5, as noise, and iconutil diff --git a/packaging/macos/file-icons/ape.icns b/packaging/macos/file-icons/ape.icns new file mode 100644 index 0000000..02bfe32 Binary files /dev/null and b/packaging/macos/file-icons/ape.icns differ diff --git a/packaging/macos/file-icons/wv.icns b/packaging/macos/file-icons/wv.icns new file mode 100644 index 0000000..8cad965 Binary files /dev/null and b/packaging/macos/file-icons/wv.icns differ diff --git a/packaging/quickplay.desktop b/packaging/quickplay.desktop index 34ff462..d47c9c7 100644 --- a/packaging/quickplay.desktop +++ b/packaging/quickplay.desktop @@ -13,7 +13,7 @@ Exec={{exec}} %F Icon={{icon}} Terminal=false Categories={{categories}} -MimeType=audio/flac;audio/mpeg;audio/mp4;audio/x-m4a;audio/aac;audio/x-aac;audio/ogg;audio/vorbis;audio/x-vorbis+ogg;audio/opus;audio/x-opus+ogg;audio/wav;audio/x-wav;audio/vnd.wave;audio/aiff;audio/x-aiff;audio/x-dsf;audio/x-dff;audio/x-dsd;audio/x-mpegurl;audio/mpegurl;application/vnd.apple.mpegurl; +MimeType=audio/flac;audio/mpeg;audio/mp4;audio/x-m4a;audio/aac;audio/x-aac;audio/ogg;audio/vorbis;audio/x-vorbis+ogg;audio/opus;audio/x-opus+ogg;audio/wav;audio/x-wav;audio/vnd.wave;audio/aiff;audio/x-aiff;audio/x-dsf;audio/x-dff;audio/x-dsd;audio/x-wavpack;audio/x-ape;audio/x-mpegurl;audio/mpegurl;application/vnd.apple.mpegurl; StartupWMClass=app.waveflow.quickplay Actions=Enqueue; diff --git a/src/app.rs b/src/app.rs index ab32e0f..6fea7af 100644 --- a/src/app.rs +++ b/src/app.rs @@ -248,6 +248,15 @@ impl QuickPlayApp { let ctx = app.ctx.clone(); app.update_check = Some(update::spawn_check(move || ctx.request_repaint())); } + // An AppImage that updated itself still has the desktop entry an + // older version wrote: bring it up to date, off the UI thread. + if cfg!(target_os = "linux") { + std::thread::spawn(|| match crate::integration::refresh_if_outdated() { + Ok(true) => tracing::info!("desktop entry brought up to date"), + Ok(false) => {} + Err(err) => tracing::warn!(%err, "desktop entry not brought up to date"), + }); + } if !files.is_empty() { app.add_paths(&files, true); } @@ -529,16 +538,28 @@ impl QuickPlayApp { /// Expand `inputs` and append them. With `autoplay`, start the first new /// row when nothing is playing. fn add_paths(&mut self, inputs: &[PathBuf], autoplay: bool) { - if inputs.iter().any(|p| p.is_dir() || library::is_playlist(p)) { - // Folders are walked and playlists read on the loader's thread; - // the result comes back as `LoaderEvent::Scanned`. - self.set_status(self.t().status_scanning); - self.loader - .request_scan(inputs.to_vec(), autoplay, self.scan_generation); + if inputs.is_empty() { return; } - let paths = library::collect_audio_paths(inputs); - self.add_resolved(paths, !inputs.is_empty(), autoplay); + // Folders are walked, playlists read and files checked on the + // loader's scan thread (a check can read the file's header); the + // result comes back as `LoaderEvent::Scanned`. Only a walk is long + // enough to say so. + let walk = inputs.iter().any(|p| p.is_dir() || library::is_playlist(p)); + match self + .loader + .request_scan(inputs.to_vec(), autoplay, self.scan_generation) + { + Ok(()) if walk => self.set_status(self.t().status_scanning), + Ok(()) => {} + Err(err) => { + // No thread for it: check the files here rather than lose + // them. + tracing::warn!(%err, "scan thread failed to start; scanning here"); + let paths = library::collect_audio_paths(inputs); + self.add_resolved(paths, true, autoplay); + } + } } /// Queues already-expanded audio paths. @@ -733,6 +754,7 @@ impl QuickPlayApp { fn clear(&mut self) { self.queue.clear(); self.scan_generation += 1; + self.loader.forget_scans(); self.generation += 1; self.selected = None; self.playing_id = None; @@ -861,18 +883,29 @@ impl QuickPlayApp { } fn pump_loader_events(&mut self) { - for event in self.loader.poll() { + let events = self.loader.poll(); + // A slow scan keeps finished ones waiting: look again when it + // stops holding them, as nothing else may wake the window. + if let Some(wait) = self.loader.scan_wait() { + self.ctx.request_repaint_after(wait); + } + for event in events { match event { LoaderEvent::Scanned { paths, autoplay, generation, + .. } => { // Requested for a queue that has been cleared since. if generation != self.scan_generation { continue; } - self.status = None; + // The "scanning" line goes; another message stays. + let scanning = self.t().status_scanning; + if self.status.as_ref().is_some_and(|(s, _)| s == scanning) { + self.status = None; + } self.add_resolved(paths, true, autoplay); } LoaderEvent::Meta { id, meta } => { diff --git a/src/audio/decoder.rs b/src/audio/decoder.rs index ecd64f8..4751a5e 100644 --- a/src/audio/decoder.rs +++ b/src/audio/decoder.rs @@ -18,9 +18,22 @@ use super::engine::{AudioCmd, EngineEvent}; use super::output::RING_CAPACITY; use super::spectrum::SpectrumAnalyzer; use super::state::{PlayerState, SharedPlayback}; +use waveflow_core::playback::channels::ChannelLayout; use waveflow_core::playback::replay_gain::TrackGain; use waveflow_core::playback::stream::ActiveStream; +/// The speakers of the default output, which cpal opens in shared mode: +/// on Windows and macOS the mix format's channels in WAVE order, on Linux +/// an ALSA PCM's default order (rear pair before the centre and the LFE), +/// as WaveFlow's engine takes them for the same outputs. +fn output_layout(channels: usize) -> ChannelLayout { + if cfg!(target_os = "linux") { + ChannelLayout::alsa_default(channels) + } else { + ChannelLayout::from_count(channels) + } +} + /// Where the decoder's events go, plus a wake-up for the UI loop (egui /// repaints only when asked; the engine asks). #[derive(Clone)] @@ -401,6 +414,7 @@ fn play_track( ) -> Exit { let dst_rate = shared.sample_rate(); let dst_channels = shared.channels(); + let dst_layout = output_layout(dst_channels); let mut scratch: Vec = Vec::with_capacity(16_384); let mut logged_rate = false; let bitrate = BitrateMeter::new(stream.packets_read); @@ -471,7 +485,7 @@ fn play_track( let before = session.out.len(); match session .stream - .decode_next(&mut session.out, &mut scratch, dst_rate, dst_channels) + .decode_next(&mut session.out, &mut scratch, dst_rate, &dst_layout) { Ok(false) => { session.feed_spectrum(before, dst_rate, dst_channels); diff --git a/src/file_icons.rs b/src/file_icons.rs index 49a43a1..1d8194c 100644 --- a/src/file_icons.rs +++ b/src/file_icons.rs @@ -25,6 +25,8 @@ pub const FILE_ICONS: &[(&str, u16)] = &[ ("dff", 112), ("m3u", 113), ("m3u8", 114), + ("wv", 115), + ("ape", 116), ]; /// The icon of an extension with no file of its own. diff --git a/src/integration.rs b/src/integration.rs index 0c71dc3..f4ff6ad 100644 --- a/src/integration.rs +++ b/src/integration.rs @@ -86,6 +86,16 @@ pub fn relabel(lang: Lang) -> io::Result { Ok(true) } +/// At launch, rewrites the file-manager entries this executable registered +/// when they are not what this version writes. An AppImage updates itself +/// in place, so its desktop entry keeps the list of types of the version +/// that wrote it (1.6.0 adds WavPack and Monkey's Audio); the installers +/// and packages bring their own entries up to date. `Ok(false)` when +/// nothing was registered from here or the entries are current. +pub fn refresh_if_outdated() -> io::Result { + platform::refresh_if_outdated(&exe_path()?) +} + #[cfg(windows)] mod platform { use super::*; @@ -330,6 +340,13 @@ mod platform { Some(PathBuf::from(&rest[..end])) } + /// Every way the Windows entries get here re-runs `--register` on an + /// upgrade (the installer, the updater's installer); a copy started by + /// hand does not update itself. + pub fn refresh_if_outdated(_exe: &std::path::Path) -> io::Result { + Ok(false) + } + pub fn is_registered_at(exe: &std::path::Path) -> bool { registered_exe().is_some_and(|registered| { registered @@ -624,7 +641,7 @@ mod platform { use super::*; const DESKTOP_ID: &str = "app.waveflow.quickplay"; - const MIME_TYPES: &str = "audio/flac;audio/mpeg;audio/mp4;audio/x-m4a;audio/aac;audio/x-aac;audio/ogg;audio/vorbis;audio/x-vorbis+ogg;audio/opus;audio/x-opus+ogg;audio/wav;audio/x-wav;audio/vnd.wave;audio/aiff;audio/x-aiff;audio/x-dsf;audio/x-dff;audio/x-dsd;audio/x-mpegurl;audio/mpegurl;application/vnd.apple.mpegurl;"; + const MIME_TYPES: &str = "audio/flac;audio/mpeg;audio/mp4;audio/x-m4a;audio/aac;audio/x-aac;audio/ogg;audio/vorbis;audio/x-vorbis+ogg;audio/opus;audio/x-opus+ogg;audio/wav;audio/x-wav;audio/vnd.wave;audio/aiff;audio/x-aiff;audio/x-dsf;audio/x-dff;audio/x-dsd;audio/x-wavpack;audio/x-ape;audio/x-mpegurl;audio/mpegurl;application/vnd.apple.mpegurl;"; fn data_dir() -> io::Result { dirs::data_dir().ok_or_else(|| io::Error::other("no XDG data directory")) @@ -720,6 +737,75 @@ mod platform { ) } + /// Whether `existing`, the desktop entry on disk, is one `--register` + /// wrote for `exe` and differs from `current`, what this version writes + /// for it. Its `Exec` and `TryExec` must both be the ones written for + /// `exe` (the same since 1.2.0): an entry for another copy, or one + /// edited by hand (another `Exec`, D-Bus activation), is left alone. + fn is_outdated_entry_of(existing: &str, exe: &str, current: &str) -> bool { + let exec = desktop_string(&format!("{} %F", exec_quote(exe))); + existing.contains(&format!("\nExec={exec}\n")) + && existing.contains(&format!("\nTryExec={}\n", desktop_string(exe))) + && !existing.contains("\nDBusActivatable=") + && existing != current + } + + /// Rewrites the desktop entry `--register` wrote for `exe` when an + /// older version wrote it (see [`is_outdated_entry_of`]). + pub fn refresh_if_outdated(exe: &std::path::Path) -> io::Result { + let exe = exe.to_string_lossy(); + let existing = match std::fs::read_to_string(desktop_file()?) { + Ok(text) => text, + Err(e) if e.kind() == io::ErrorKind::NotFound => return Ok(false), + Err(e) => return Err(e), + }; + if !is_outdated_entry_of(&existing, &exe, &desktop_entry(&exe)) { + return Ok(false); + } + register(std::path::Path::new(exe.as_ref()), Lang::En.strings())?; + Ok(true) + } + + /// Writes `bytes` to `path` through a file of this call's own beside it, + /// renamed over `path` once complete: the desktop never reads half an + /// entry, and two writers (a launch bringing the entry up to date and + /// `--register`) never share a file. + fn write_atomically(path: &std::path::Path, bytes: &[u8]) -> io::Result<()> { + use std::io::Write; + use std::sync::atomic::{AtomicU32, Ordering}; + static NEXT: AtomicU32 = AtomicU32::new(0); + let name = path + .file_name() + .and_then(|n| n.to_str()) + .ok_or_else(|| io::Error::other("no file name"))?; + loop { + let n = NEXT.fetch_add(1, Ordering::Relaxed); + let tmp = path.with_file_name(format!(".{name}.{}-{n}.tmp", std::process::id())); + let mut file = match std::fs::OpenOptions::new() + .write(true) + .create_new(true) + .open(&tmp) + { + Ok(file) => file, + // Left by an earlier process with the same id: next name. + Err(e) if e.kind() == io::ErrorKind::AlreadyExists && n < 1000 => continue, + Err(e) => return Err(e), + }; + let written = file + .write_all(bytes) + .and_then(|()| file.sync_all()) + .and_then(|()| { + drop(file); + std::fs::rename(&tmp, path) + }); + if written.is_err() { + let _ = std::fs::remove_file(&tmp); + } + return written; + } + } + + /// Writes the desktop entry for `exe` and the icon it names. pub fn register(exe: &std::path::Path, _t: &Strings) -> io::Result { // `exe_path` has made sure the path is Unicode. let entry = desktop_entry(&exe.to_string_lossy()); @@ -730,8 +816,8 @@ mod platform { std::fs::create_dir_all(parent)?; } } - std::fs::write(&desktop, entry)?; - std::fs::write(&icon, include_bytes!("../assets/icon-128.png"))?; + write_atomically(&desktop, entry.as_bytes())?; + write_atomically(&icon, include_bytes!("../assets/icon-128.png"))?; refresh(); Ok(format!( "wrote {} and its icon; QuickPlay now appears in \"Open with\" for audio files. To make it the default: xdg-mime default {DESKTOP_ID}.desktop audio/flac (per type).", @@ -774,6 +860,42 @@ mod platform { ); assert!(!entry.contains("new\nline")); } + + /// An entry an older version wrote for this executable is + /// rewritten; the current one, or one for another copy, is not. + #[test] + fn only_an_outdated_entry_of_this_copy_is_rewritten() { + let exe = "/home/u/Apps/waveflow-quickplay.AppImage"; + let current = desktop_entry(exe); + let older = current.replace("audio/x-wavpack;audio/x-ape;", ""); + assert_ne!(older, current); + assert!(is_outdated_entry_of(&older, exe, ¤t)); + assert!(!is_outdated_entry_of(¤t, exe, ¤t)); + let other = desktop_entry("/opt/other/waveflow-quickplay"); + assert!(!is_outdated_entry_of(&other, exe, ¤t)); + // Edited by hand: another Exec, or D-Bus activation. + let wrapped = older.replace("\nExec=\"/home/u/Apps/", "\nExec=env X=1 \"/home/u/Apps/"); + assert_ne!(wrapped, older); + assert!(!is_outdated_entry_of(&wrapped, exe, ¤t)); + let dbus = older.replace( + "\nTerminal=false\n", + "\nTerminal=false\nDBusActivatable=true\n", + ); + assert!(!is_outdated_entry_of(&dbus, exe, ¤t)); + } + + /// The file is replaced whole, and nothing is left beside it. + #[test] + fn an_entry_is_written_whole() { + let dir = std::env::temp_dir().join(format!("qp-desktop-{}", std::process::id())); + std::fs::create_dir_all(&dir).unwrap(); + let path = dir.join("app.waveflow.quickplay.desktop"); + write_atomically(&path, b"old").unwrap(); + write_atomically(&path, b"new entry").unwrap(); + assert_eq!(std::fs::read(&path).unwrap(), b"new entry"); + assert_eq!(std::fs::read_dir(&dir).unwrap().count(), 1); + let _ = std::fs::remove_dir_all(&dir); + } } } @@ -785,6 +907,11 @@ mod platform { false } + /// The bundle's Info.plist comes with each version. + pub fn refresh_if_outdated(_exe: &std::path::Path) -> io::Result { + Ok(false) + } + #[cfg(target_os = "macos")] pub fn register(_exe: &std::path::Path, _t: &Strings) -> io::Result { Ok("nothing to register on macOS: the app declares the audio formats itself, so Finder offers it under Open With once WaveFlow QuickPlay is in Applications.".into()) diff --git a/src/library.rs b/src/library.rs index bfc848f..fa20311 100644 --- a/src/library.rs +++ b/src/library.rs @@ -2,8 +2,10 @@ //! folder cover — off the UI thread, through the same `waveflow-core` //! helpers the desktop scanner uses. +use std::collections::{HashMap, VecDeque}; use std::path::{Path, PathBuf}; use std::sync::Arc; +use std::time::{Duration, Instant}; use crossbeam_channel::{unbounded, Receiver, Sender}; use lofty::picture::PictureType; @@ -450,6 +452,8 @@ pub enum LoaderEvent { }, /// Folders expanded off the UI thread (see [`Loader::request_scan`]). Scanned { + /// Which request this answers, for [`Loader::poll`]'s ordering. + seq: u64, paths: Vec, autoplay: bool, /// The `generation` the scan was requested with, handed back as is. @@ -459,15 +463,45 @@ pub enum LoaderEvent { /// Two worker threads: one walks the metadata queue in order, the other /// decodes covers and always skips to the most recent request — the user -/// who presses Next five times wants the fifth cover, not the five. +/// who presses Next five times wants the fifth cover, not the five. Scans +/// get a thread each (see [`Loader::request_scan`]). pub struct Loader { meta_tx: Sender<(u64, PathBuf)>, cover_tx: Sender<(u64, PathBuf)>, tx: Sender, notify: Arc, rx: Receiver, + next_scan: u64, + /// Scans not handed out yet, oldest first, and since when the oldest + /// has been waited for (running, not waiting for a thread). + scan_order: VecDeque, + head_since: Instant, + /// Scans done that wait for an older one. + scans_done: HashMap, + /// Scan threads started and not yet answered, stuck ones included. + scans_running: usize, + /// Scans asked for while [`MAX_SCANS`] were running, oldest first. + scans_waiting: VecDeque, } +/// A scan waiting for a thread. +struct ScanRequest { + seq: u64, + inputs: Vec, + autoplay: bool, + generation: u64, +} + +/// How long a scan may keep the ones asked for after it waiting: past +/// this, a later scan that is done is handed out, and the slow one (a +/// share that does not answer) when it comes. +const SCAN_HOLD: Duration = Duration::from_secs(2); + +/// Most scan threads at once: a share that does not answer can hold one +/// for minutes, and a burst of launches asks for one each. The others +/// wait their turn, in order. +const MAX_SCANS: usize = 8; + impl Loader { pub fn new(notify: Arc) -> Self { let (tx, rx) = unbounded::(); @@ -517,34 +551,119 @@ impl Loader { tx: tx_events, notify: notify_events, rx, + next_scan: 0, + scan_order: VecDeque::new(), + head_since: Instant::now(), + scans_done: HashMap::new(), + scans_running: 0, + scans_waiting: VecDeque::new(), } } - /// Expands files and folders on a thread of its own: a dropped library - /// root can hold tens of thousands of entries, and the stats would - /// freeze the window if done on the UI thread. - /// `generation` comes back with the result, so the caller can tell a - /// scan it has since given up on. - pub fn request_scan(&self, inputs: Vec, autoplay: bool, generation: u64) { + /// Starts the thread of one scan. + fn spawn_scan(&mut self, request: ScanRequest) -> std::io::Result<()> { + let ScanRequest { + seq, + inputs, + autoplay, + generation, + } = request; let (tx, notify) = (self.tx.clone(), self.notify.clone()); - let spawned = std::thread::Builder::new() + std::thread::Builder::new() .name("quickplay-scan".into()) .spawn(move || { - let paths = collect_audio_paths(&inputs); let event = LoaderEvent::Scanned { - paths, + seq, + paths: collect_audio_paths(&inputs), autoplay, generation, }; if tx.send(event).is_ok() { notify(); } - }); - if let Err(err) = spawned { - tracing::error!(%err, "scan thread failed to start"); + })?; + self.scans_running += 1; + // The wait for the oldest counts from when it runs. + if self.scan_order.front() == Some(&seq) { + self.head_since = Instant::now(); + } + Ok(()) + } + + /// Starts the scans that wait, as threads free up. One whose thread + /// cannot start is done here rather than lost. + fn start_waiting_scans(&mut self) { + while self.scans_running < MAX_SCANS { + let Some(request) = self.scans_waiting.pop_front() else { + break; + }; + let (seq, autoplay, generation) = (request.seq, request.autoplay, request.generation); + let inputs = request.inputs.clone(); + if let Err(err) = self.spawn_scan(request) { + tracing::warn!(%err, "scan thread failed to start; scanning here"); + let event = LoaderEvent::Scanned { + seq, + paths: collect_audio_paths(&inputs), + autoplay, + generation, + }; + self.scans_done.insert(seq, event); + } } } + /// Expands files and folders on a thread of the request's own: a + /// dropped library root can hold tens of thousands of entries, and + /// checking a file can read its header (Ogg, WavPack, Monkey's Audio), + /// which on a slow share would freeze the window on the UI thread, and + /// on a shared thread hold up every add after it. [`Loader::poll`] + /// hands the results out in the order they were asked for. + /// `generation` comes back with the result, so the caller can tell a + /// scan it has since given up on. At most [`MAX_SCANS`] run at once; + /// the next ones wait their turn. An error when no thread could start + /// for a scan that had one free. + pub fn request_scan( + &mut self, + inputs: Vec, + autoplay: bool, + generation: u64, + ) -> std::io::Result<()> { + let seq = self.next_scan; + let request = ScanRequest { + seq, + inputs, + autoplay, + generation, + }; + if self.scans_running < MAX_SCANS && self.scans_waiting.is_empty() { + self.scan_order.push_back(seq); + if let Err(err) = self.spawn_scan(request) { + self.scan_order.pop_back(); + return Err(err); + } + } else { + self.scan_order.push_back(seq); + self.scans_waiting.push_back(request); + } + self.next_scan += 1; + Ok(()) + } + + /// Stops ordering the scans under way, for a queue that was cleared: + /// their results are handed out as they come, and dropped by their + /// generation. Those still waiting for a thread are not started. + pub fn forget_scans(&mut self) { + self.scan_order.clear(); + self.scans_done.clear(); + self.scans_waiting.clear(); + } + + /// How long until [`Loader::poll`] stops keeping finished scans behind + /// a slow one, when it keeps any. + pub fn scan_wait(&self) -> Option { + (!self.scans_done.is_empty()).then(|| SCAN_HOLD.saturating_sub(self.head_since.elapsed())) + } + pub fn request_meta(&self, id: u64, path: PathBuf) { let _ = self.meta_tx.send((id, path)); } @@ -553,8 +672,35 @@ impl Loader { let _ = self.cover_tx.send((id, path)); } - pub fn poll(&self) -> Vec { - self.rx.try_iter().collect() + /// Everything the workers have finished. Scans come in the order they + /// were asked for, except that one still running after [`SCAN_HOLD`] + /// no longer holds back the ones done after it. + pub fn poll(&mut self) -> Vec { + let mut out = Vec::new(); + let received: Vec = self.rx.try_iter().collect(); + for event in received { + if matches!(event, LoaderEvent::Scanned { .. }) { + self.scans_running = self.scans_running.saturating_sub(1); + } + match &event { + LoaderEvent::Scanned { seq, .. } if self.scan_order.contains(seq) => { + self.scans_done.insert(*seq, event); + } + _ => out.push(event), + } + } + self.start_waiting_scans(); + while let Some(&head) = self.scan_order.front() { + if let Some(event) = self.scans_done.remove(&head) { + out.push(event); + } else if self.scans_done.is_empty() || self.head_since.elapsed() < SCAN_HOLD { + break; + } + // Handed out, or given up on waiting for: the next one is first. + self.scan_order.pop_front(); + self.head_since = Instant::now(); + } + out } } @@ -564,7 +710,9 @@ mod tests { #[cfg(windows)] use super::{location, may_follow, Location}; use std::path::{Path, PathBuf}; - use waveflow_core::audio_format::dsd::parser::{DsdChannels, DsdContainer, DsdLayout}; + use waveflow_core::audio_format::dsd::parser::{ + DsdChannels, DsdContainer, DsdLayout, DsdSpeakers, + }; #[cfg(windows)] #[test] @@ -680,10 +828,95 @@ mod tests { assert_eq!(percent_decode("/%FF.flac"), None); } + /// Scans come back in the order asked for; one still running after + /// `SCAN_HOLD` stops holding the others, and comes when it comes; a + /// cleared queue's scans are handed out as they arrive. + #[test] + fn scans_come_back_in_order_unless_one_is_stuck() { + use super::{Loader, LoaderEvent, SCAN_HOLD}; + let mut loader = Loader::new(std::sync::Arc::new(|| {})); + let done = |loader: &Loader, seq: u64| { + let event = LoaderEvent::Scanned { + seq, + paths: Vec::new(), + autoplay: false, + generation: 0, + }; + loader.tx.send(event).unwrap(); + }; + let seqs = |events: Vec| -> Vec { + events + .into_iter() + .filter_map(|e| match e { + LoaderEvent::Scanned { seq, .. } => Some(seq), + _ => None, + }) + .collect() + }; + loader.scan_order.extend([0, 1]); + done(&loader, 1); + assert!(seqs(loader.poll()).is_empty(), "1 waits for 0"); + assert!(loader.scan_wait().is_some()); + done(&loader, 0); + assert_eq!(seqs(loader.poll()), [0, 1]); + assert!(loader.scan_wait().is_none()); + + loader.scan_order.extend([2, 3]); + done(&loader, 3); + loader.head_since = std::time::Instant::now() - SCAN_HOLD; + assert_eq!(seqs(loader.poll()), [3], "2 is stuck: 3 goes past it"); + done(&loader, 2); + assert_eq!(seqs(loader.poll()), [2], "the stuck one when it comes"); + + loader.scan_order.push_back(4); + loader.forget_scans(); + done(&loader, 4); + assert_eq!(seqs(loader.poll()), [4]); + } + + /// Past `MAX_SCANS` running, a scan waits for a thread, keeps its place + /// in the order and starts when one answers. + #[test] + fn scans_past_the_limit_wait_their_turn() { + use super::{Loader, LoaderEvent, MAX_SCANS}; + let mut loader = Loader::new(std::sync::Arc::new(|| {})); + loader.scans_running = MAX_SCANS; + loader.request_scan(Vec::new(), false, 7).unwrap(); + assert_eq!(loader.scans_waiting.len(), 1); + assert_eq!(loader.scan_order, [0]); + // One of the running scans answers (for a cleared queue). + loader + .tx + .send(LoaderEvent::Scanned { + seq: 99, + paths: Vec::new(), + autoplay: false, + generation: 0, + }) + .unwrap(); + let mut got = Vec::new(); + for _ in 0..200 { + got.extend(loader.poll().into_iter().filter_map(|e| match e { + LoaderEvent::Scanned { + seq, generation, .. + } => Some((seq, generation)), + _ => None, + })); + if got.len() == 2 { + break; + } + std::thread::sleep(std::time::Duration::from_millis(10)); + } + assert!(loader.scans_waiting.is_empty()); + assert_eq!(got, [(99, 0), (0, 7)]); + assert_eq!(loader.scans_running, MAX_SCANS - 1); + } + fn layout(sample_rate_hz: u32, channels: DsdChannels) -> DsdLayout { DsdLayout { container: DsdContainer::Dsf, channels, + speakers: DsdSpeakers::DsfType(2), sample_rate_hz, samples_per_channel: 0, data_offset: 0,