diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..c202dcf --- /dev/null +++ b/.dockerignore @@ -0,0 +1,15 @@ +# Build context for docker/*.Dockerfile and crates/voelin-gateway/Dockerfile: +# the sources only. Builds keep target/ in cache mounts, never in the context. +.git +.claude +target +dist +fuzz/target +fuzz/corpus +fuzz/artifacts +dev/.state +android/.gradle +android/build +android/app/build +android/local.properties +**/node_modules diff --git a/.github/workflows/audit.yml b/.github/workflows/audit.yml new file mode 100644 index 0000000..667df80 --- /dev/null +++ b/.github/workflows/audit.yml @@ -0,0 +1,21 @@ +name: Security audit + +# RustSec advisories for Cargo.lock (what `cargo audit` checks), daily, so +# new advisories show up without a push. CI's cargo-deny job checks the same +# on every push together with licenses and sources. + +on: + schedule: + - cron: "41 4 * * *" + workflow_dispatch: + +jobs: + advisories: + name: cargo-deny advisories + runs-on: ubuntu-24.04 + steps: + - uses: actions/checkout@v4 + - uses: EmbarkStudios/cargo-deny-action@v2 + with: + command: check advisories + arguments: --workspace diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 9101adc..b1cc4b5 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,10 +1,29 @@ name: CI +# Fast checks on every push to main and every PR: lint, tests, license and +# advisory checks, and the integration tests against TS3/TS6 servers. +# Packages are built only by release.yml (tags, or by hand), which also runs +# these checks through workflow_call. + +# Changes to documentation only need no build (same list twice: no YAML +# anchors in workflows). THIRD_PARTY_NOTICES.md is compiled into the app +# (About page) and checked below. on: push: branches: [main, master] + paths: + - "**" + - "!docs/**" + - "!**/*.md" + - "THIRD_PARTY_NOTICES.md" pull_request: + paths: + - "**" + - "!docs/**" + - "!**/*.md" + - "THIRD_PARTY_NOTICES.md" workflow_dispatch: + workflow_call: concurrency: group: ${{ github.workflow }}-${{ github.ref }} @@ -34,13 +53,11 @@ jobs: - name: clippy (workspace, report only) run: cargo clippy --workspace --all-targets + # Under Xvfb, so X11 tests (screen capture, global hotkeys through XTEST + # input) run instead of skipping. Windows tests run in release.yml. test: - name: test (${{ matrix.os }}) - strategy: - fail-fast: false - matrix: - os: [ubuntu-24.04, windows-2025] - runs-on: ${{ matrix.os }} + name: test (Linux) + runs-on: ubuntu-24.04 steps: - uses: actions/checkout@v4 - uses: ./.github/actions/system-deps @@ -49,67 +66,62 @@ jobs: - uses: Swatinem/rust-cache@v2 - name: Build run: cargo build --workspace --all-targets --locked - # Under Xvfb, so X11 tests (screen capture, global hotkeys through - # XTEST input) run instead of skipping. - - name: Test (Linux, Xvfb) - if: runner.os == 'Linux' - run: xvfb-run -a bash -c 'TSC_X11_TEST_DISPLAY="$DISPLAY" cargo test --workspace --locked' - name: Test - if: runner.os != 'Linux' - run: cargo test --workspace --locked + run: xvfb-run -a bash -c 'VOELIN_X11_TEST_DISPLAY="$DISPLAY" cargo test --workspace --locked' - release-build: - name: release build (${{ matrix.os }}) - strategy: - fail-fast: false - matrix: - include: - - os: ubuntu-24.04 - artifact: tsc-desktop-linux-x86_64 - - os: windows-2025 - artifact: tsc-desktop-windows-x86_64 - runs-on: ${{ matrix.os }} + # Windows-only code compiles and is lint-clean (MSVC, libvpx from vcpkg). + clippy-windows: + name: clippy (Windows) + runs-on: windows-2025 steps: - uses: actions/checkout@v4 - uses: ./.github/actions/system-deps - name: Install toolchain (rust-toolchain.toml) run: rustup toolchain install - uses: Swatinem/rust-cache@v2 - with: - key: release - - name: Build tsc-desktop - run: cargo build --release --locked -p tsc-ui - - name: Stage (Linux) - if: runner.os == 'Linux' - run: | - mkdir -p dist - cp target/release/tsc-desktop dist/ - cp packaging/linux/* dist/ - # The installer is built when NSIS is on the runner; unsigned. - - name: Stage (Windows) - if: runner.os == 'Windows' - shell: pwsh - run: | - New-Item -ItemType Directory -Force dist | Out-Null - Copy-Item target\release\tsc-desktop.exe dist\ - $makensis = (Get-Command makensis -ErrorAction SilentlyContinue).Source - if (-not $makensis) { - $makensis = "${env:ProgramFiles(x86)}\NSIS\makensis.exe" - } - if (Test-Path $makensis) { - $version = (cargo metadata --no-deps --format-version 1 | ConvertFrom-Json).packages | - Where-Object name -eq 'tsc-ui' | Select-Object -ExpandProperty version - & $makensis "/DVERSION=$version" "/DOUTDIR=$PWD\dist" packaging\windows\installer.nsi - if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE } - } else { - Write-Host "::notice::NSIS not found, uploading the executable only" - } - - uses: actions/upload-artifact@v4 - with: - name: ${{ matrix.artifact }} - path: dist/ - if-no-files-found: error + - name: clippy (own crates, deny warnings) + shell: bash + run: cargo clippy $(scripts/own-crates.sh) --all-targets --no-deps --locked -- -D warnings + # The Android-only code (docs/android.md), for the Android target. The APKs + # are built by release.yml. + clippy-android: + name: clippy (Android) + runs-on: ubuntu-24.04 + timeout-minutes: 45 + env: + NDK_VERSION: 27.3.13750724 + steps: + - uses: actions/checkout@v4 + - name: Install toolchain (rust-toolchain.toml) + run: | + rustup toolchain install + rustup target add aarch64-linux-android + - uses: Swatinem/rust-cache@v2 + with: + key: android + - uses: actions/setup-java@v4 + with: + distribution: temurin + java-version: 17 + - name: Android SDK packages + run: | + yes | "$ANDROID_HOME/cmdline-tools/latest/bin/sdkmanager" --licenses > /dev/null + "$ANDROID_HOME/cmdline-tools/latest/bin/sdkmanager" \ + "ndk;$NDK_VERSION" "platforms;android-36" > /dev/null + echo "ANDROID_NDK_HOME=$ANDROID_HOME/ndk/$NDK_VERSION" >> "$GITHUB_ENV" + # CMake (libopus) and Slint's Java helper. + echo "ANDROID_NDK_ROOT=$ANDROID_HOME/ndk/$NDK_VERSION" >> "$GITHUB_ENV" + echo "ANDROID_JAR=$ANDROID_HOME/platforms/android-36/android.jar" >> "$GITHUB_ENV" + - name: Install cargo-ndk + run: cargo install cargo-ndk --locked --version 4.1.2 + - name: clippy (Android target, deny warnings) + run: | + cargo ndk -t arm64-v8a --platform 29 clippy --locked -p voelin-android -p voelin-ui --no-deps -- -D warnings + cargo ndk -t arm64-v8a --platform 29 clippy --locked -p voelin-media --no-default-features --no-deps -- -D warnings + + # Licenses, bans, sources and RustSec advisories (the `cargo audit` + # database); audit.yml repeats the advisories check daily. deny: name: cargo-deny runs-on: ubuntu-24.04 @@ -121,10 +133,33 @@ jobs: with: arguments: --workspace + # THIRD_PARTY_NOTICES.md (shown in the About page) must match Cargo.lock. + # cargo-about's output is independent of the host (the graph is filtered + # by the targets in about.toml), so the committed file is compared exactly. + notices: + name: third-party notices + runs-on: ubuntu-24.04 + steps: + - uses: actions/checkout@v4 + - name: Install toolchain (rust-toolchain.toml) + run: rustup toolchain install + # Caches ~/.cargo/bin too, so cargo-about is built once. + - uses: Swatinem/rust-cache@v2 + with: + key: notices + - name: Install cargo-about + run: cargo install cargo-about --locked --version 0.9.2 --features cli + - name: Check THIRD_PARTY_NOTICES.md + run: scripts/notices.sh --check + + # voelinctl, the gateway, the engine and voelin-stream against real TS3 and TS6 + # servers, including a synthetic VP8 + Opus stream through the TS6 server + # (scripts/it-smoke.sh). smoke: name: integration smoke (TS3 + TS6) runs-on: ubuntu-24.04 needs: test + timeout-minutes: 45 steps: - uses: actions/checkout@v4 - uses: ./.github/actions/system-deps @@ -138,3 +173,45 @@ jobs: - name: Server logs if: failure() run: docker compose -f dev/docker-compose.yml logs --no-color + # Client, gateway and stream logs the script keeps in dev/.state. + - name: Upload smoke logs + if: failure() + uses: actions/upload-artifact@v4 + with: + name: smoke-logs + path: dev/.state/*.log + if-no-files-found: ignore + + # Our WebRTC peers against Chromium's (libwebrtc, as in the official TS6 + # client); see tests/interop/README.md. Informational: a failure is + # reported on the job but does not fail the workflow, since it depends on + # a browser download and the runner's network interfaces. + browser-interop: + name: browser interop (voelin-stream, Chromium) + runs-on: ubuntu-24.04 + needs: test + continue-on-error: true + timeout-minutes: 30 + env: + PLAYWRIGHT_VERSION: 1.56.1 + steps: + - uses: actions/checkout@v4 + - uses: ./.github/actions/system-deps + - name: Install toolchain (rust-toolchain.toml) + run: rustup toolchain install + - uses: Swatinem/rust-cache@v2 + - uses: actions/setup-node@v4 + with: + node-version: 22 + - name: Cache Playwright browsers + uses: actions/cache@v4 + with: + path: ~/.cache/ms-playwright + key: playwright-${{ env.PLAYWRIGHT_VERSION }}-chromium + # Global install: the test finds Playwright through `npm root -g`. + - name: Install Playwright and Chromium + run: | + npm install -g "playwright@$PLAYWRIGHT_VERSION" + playwright install --with-deps chromium + - name: Browser interop test + run: VOELIN_INTEROP=1 cargo test --locked -p voelin-stream --test browser_interop -- --nocapture diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml new file mode 100644 index 0000000..6eff963 --- /dev/null +++ b/.github/workflows/docker.yml @@ -0,0 +1,39 @@ +name: Docker builds + +# The local builds in docker/ (docs/building.md), checked at every release +# tag and on demand (Actions → Docker builds → Run workflow). Each build +# uploads what it made: the same kinds of packages as release.yml, the +# Windows one cross-compiled with mingw-w64. + +on: + push: + tags: ["v*"] + workflow_dispatch: + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + +jobs: + build: + name: docker (${{ matrix.platform }}) + strategy: + fail-fast: false + matrix: + platform: [linux, windows, android] + runs-on: ubuntu-24.04 + timeout-minutes: 120 + steps: + - uses: actions/checkout@v4 + # The Android build needs more room than the runner leaves free. + - name: Free disk space + run: | + sudo rm -rf /usr/local/lib/android /usr/share/dotnet /opt/ghc /usr/local/.ghcup + df -h / + - name: Build + run: scripts/docker-build.sh ${{ matrix.platform }} --progress=plain + - uses: actions/upload-artifact@v4 + with: + name: docker-${{ matrix.platform }} + path: dist/${{ matrix.platform }}/ + if-no-files-found: error diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..9ef67cc --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,245 @@ +name: Release + +# The packages (docs/building.md), made by scripts/package.sh like the Docker +# builds in docker/. A v* tag attaches them to a draft GitHub release; run by +# hand (Actions → Release → Run workflow) they are only uploaded as artifacts. +# The package jobs run alongside the checks, so a manual run yields packages +# even when a check fails; a release needs everything green. + +on: + push: + tags: ["v*"] + workflow_dispatch: + +concurrency: + group: release-build-${{ github.ref }} + cancel-in-progress: false + +permissions: + contents: read + +env: + CARGO_TERM_COLOR: always + RUST_BACKTRACE: "0" + +jobs: + # The same checks as every push (lint, Linux tests, Windows and Android + # clippy, deny, notices, integration tests). + checks: + uses: ./.github/workflows/ci.yml + + test-windows: + name: test (Windows) + runs-on: windows-2025 + steps: + - uses: actions/checkout@v4 + - uses: ./.github/actions/system-deps + - name: Install toolchain (rust-toolchain.toml) + run: rustup toolchain install + - uses: Swatinem/rust-cache@v2 + - name: Build + run: cargo build --workspace --all-targets --locked + - name: Test + run: cargo test --workspace --locked + + package-linux: + name: package (Linux) + runs-on: ubuntu-24.04 + steps: + - uses: actions/checkout@v4 + - uses: ./.github/actions/system-deps + - name: Install toolchain (rust-toolchain.toml) + run: rustup toolchain install + - uses: Swatinem/rust-cache@v2 + with: + key: release + - name: Build + run: cargo build --release --locked -p voelin-ui -p voelin-gateway + # dpkg-shlibdeps works out the .deb's dependencies. + - name: Package (.tar.gz, .deb) + run: | + sudo apt-get install -y --no-install-recommends dpkg-dev + scripts/package.sh linux dist + - uses: actions/upload-artifact@v4 + with: + name: voelin-linux-x86_64 + path: dist/ + if-no-files-found: error + + package-windows: + name: package (Windows) + runs-on: windows-2025 + steps: + - uses: actions/checkout@v4 + - uses: ./.github/actions/system-deps + - name: Install toolchain (rust-toolchain.toml) + run: rustup toolchain install + - uses: Swatinem/rust-cache@v2 + with: + key: release + - name: Build + run: cargo build --release --locked -p voelin-ui + # The installer is required here: install NSIS when the image lacks it. + - name: NSIS + shell: pwsh + run: | + $makensis = (Get-Command makensis -ErrorAction SilentlyContinue).Source + if (-not $makensis) { $makensis = "${env:ProgramFiles(x86)}\NSIS\makensis.exe" } + if (-not (Test-Path $makensis)) { + choco install nsis -y --no-progress + if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE } + } + "MAKENSIS=$($makensis.Replace('\', '/'))" >> $env:GITHUB_ENV + - name: Package (.zip, installer) + shell: bash + run: scripts/package.sh windows dist + - uses: actions/upload-artifact@v4 + with: + name: voelin-windows-x86_64 + path: dist/ + if-no-files-found: error + + # Flatpak bundle from packaging/flatpak (install with + # `flatpak install --user voelin.flatpak`). flatpak-builder builds + # offline, from the crates that flatpak-cargo-generator lists. + package-flatpak: + name: package (Flatpak) + runs-on: ubuntu-24.04 + timeout-minutes: 90 + container: + image: ghcr.io/flathub-infra/flatpak-github-actions:freedesktop-25.08 + options: --privileged + env: + # flatpak-builder-tools, pinned. + FBT_COMMIT: 41c20aa10819cdb2a4f3ca171758a96d1955c018 + steps: + - uses: actions/checkout@v4 + - name: Cargo sources + run: | + curl -sSfL -o /tmp/flatpak-cargo-generator.py \ + "https://raw.githubusercontent.com/flatpak/flatpak-builder-tools/$FBT_COMMIT/cargo/flatpak-cargo-generator.py" + python3 -m venv /tmp/venv + /tmp/venv/bin/pip install --quiet "aiohttp>=3.9.5,<4" "tomlkit>=0.13.3,<1" "PyYAML>=6.0.2,<7" + /tmp/venv/bin/python /tmp/flatpak-cargo-generator.py Cargo.lock -o packaging/flatpak/cargo-sources.json + - uses: flatpak/flatpak-github-actions/flatpak-builder@v6 + with: + bundle: voelin.flatpak + manifest-path: packaging/flatpak/io.github.faumaray.Voelin.yml + cache-key: flatpak-builder-${{ hashFiles('Cargo.lock') }} + upload-artifact: false + - uses: actions/upload-artifact@v4 + with: + name: voelin-flatpak-x86_64 + path: voelin.flatpak + if-no-files-found: error + + # The gateway's container image (crates/voelin-gateway/Dockerfile), saved as a + # file: `docker load -i tsgw-image.tar.gz`. + package-gateway-image: + name: package (gateway image) + runs-on: ubuntu-24.04 + steps: + - uses: actions/checkout@v4 + - name: Build and save + run: | + version=$(sed -n 's/^version = "\(.*\)"$/\1/p' crates/voelin-gateway/Cargo.toml | head -n 1) + docker build -f crates/voelin-gateway/Dockerfile -t "tsgw:$version" -t tsgw:latest . + mkdir -p dist + docker save "tsgw:$version" tsgw:latest | gzip > dist/tsgw-image.tar.gz + (cd dist && sha256sum tsgw-image.tar.gz > SHA256SUMS-gateway) + - uses: actions/upload-artifact@v4 + with: + name: tsgw-image + path: dist/ + if-no-files-found: error + + # The Android app (docs/android.md): a debug APK for arm64-v8a and x86_64 + # (emulators), and a signed release APK when the signing secrets are set + # (docs/release.md). + package-android: + name: package (Android) + runs-on: ubuntu-24.04 + timeout-minutes: 90 + env: + NDK_VERSION: 27.3.13750724 + steps: + - uses: actions/checkout@v4 + - name: Install toolchain (rust-toolchain.toml) + run: | + rustup toolchain install + rustup target add aarch64-linux-android x86_64-linux-android + - uses: Swatinem/rust-cache@v2 + with: + key: android + - uses: actions/setup-java@v4 + with: + distribution: temurin + java-version: 17 + - name: Android SDK packages + run: | + yes | "$ANDROID_HOME/cmdline-tools/latest/bin/sdkmanager" --licenses > /dev/null + "$ANDROID_HOME/cmdline-tools/latest/bin/sdkmanager" \ + "ndk;$NDK_VERSION" "platforms;android-36" "build-tools;36.0.0" > /dev/null + echo "ANDROID_NDK_HOME=$ANDROID_HOME/ndk/$NDK_VERSION" >> "$GITHUB_ENV" + # CMake (libopus) and Slint's Java helper. + echo "ANDROID_NDK_ROOT=$ANDROID_HOME/ndk/$NDK_VERSION" >> "$GITHUB_ENV" + echo "ANDROID_JAR=$ANDROID_HOME/platforms/android-36/android.jar" >> "$GITHUB_ENV" + - name: Install cargo-ndk + run: cargo install cargo-ndk --locked --version 4.1.2 + - name: Debug APK + working-directory: android + run: ./gradlew --no-daemon assembleDebug -Pvoelin.abis=arm64-v8a,x86_64 + # Only with the signing secrets; an unsigned release APK is not installable. + - name: Release APK (signed) + working-directory: android + env: + KEYSTORE_BASE64: ${{ secrets.ANDROID_KEYSTORE_BASE64 }} + VOELIN_SIGNING_STORE_PASSWORD: ${{ secrets.VOELIN_SIGNING_STORE_PASSWORD }} + VOELIN_SIGNING_KEY_ALIAS: ${{ secrets.VOELIN_SIGNING_KEY_ALIAS }} + VOELIN_SIGNING_KEY_PASSWORD: ${{ secrets.VOELIN_SIGNING_KEY_PASSWORD }} + run: | + if [ -z "$KEYSTORE_BASE64" ]; then + echo "::notice::No ANDROID_KEYSTORE_BASE64 secret: skipping the release APK" + exit 0 + fi + export VOELIN_SIGNING_STORE_FILE="$RUNNER_TEMP/release.jks" + echo "$KEYSTORE_BASE64" | base64 -d > "$VOELIN_SIGNING_STORE_FILE" + ./gradlew --no-daemon assembleRelease -Pvoelin.abis=arm64-v8a,x86_64 + rm -f "$VOELIN_SIGNING_STORE_FILE" + - name: Package + run: scripts/package.sh android dist + - uses: actions/upload-artifact@v4 + with: + name: voelin-android + path: dist/ + if-no-files-found: error + + # A v* tag: every package, attached to a draft GitHub release to review and + # publish by hand. + release: + name: draft release + if: startsWith(github.ref, 'refs/tags/v') + needs: [checks, test-windows, package-linux, package-windows, package-flatpak, package-gateway-image, package-android] + runs-on: ubuntu-24.04 + permissions: + contents: write + steps: + - uses: actions/download-artifact@v4 + with: + pattern: voelin-* + path: dist + merge-multiple: true + - uses: actions/download-artifact@v4 + with: + name: tsgw-image + path: dist + - name: Checksums + run: | + cd dist + rm -f SHA256SUMS-* + sha256sum -- * > SHA256SUMS + - uses: softprops/action-gh-release@v2 + with: + draft: true + generate_release_notes: true + files: dist/* diff --git a/.gitignore b/.gitignore index ec81357..e586912 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ /target/ /dev/.state/ +/dist/ diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 0000000..7769f98 --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,23 @@ +# Changelog + +User-visible changes of the apps and the `tsgw` gateway. The format follows +[Keep a Changelog](https://keepachangelog.com/en/1.1.0/); versions follow +[docs/release.md](docs/release.md#versioning). + +## [Unreleased] + +The first release is in preparation. + +### Added + +- Desktop app (Linux Wayland/X11, Windows): servers and bookmarks, channel + tree with talking indicators, server and channel chat, voice with + push-to-talk (global hotkeys), voice activation, echo cancellation, noise + suppression and gain control, per-user volume. +- Observing a server invisibly and chatting in channels without joining + them, through the `tsgw` gateway or own ServerQuery credentials. +- TeamSpeak 6 streams: watching and sharing screens with sound (VP8, VP9, + optional H.264 through Cisco's OpenH264, AV1 decoding). +- `tsgw`: companion gateway for server admins (presence, channel chat + relay, history). +- Opt-in local crash reports; third-party notices in the About page. diff --git a/Cargo.lock b/Cargo.lock index 8c97fa3..4525066 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -249,6 +249,27 @@ dependencies = [ "pkg-config", ] +[[package]] +name = "android-activity" +version = "0.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ee91c0c2905bae44f84bfa4e044536541df26b7703fd0888deeb9060fcc44289" +dependencies = [ + "android-properties", + "bitflags 2.13.2", + "cc", + "cesu8", + "jni 0.21.1", + "jni-sys 0.3.1", + "libc", + "log", + "ndk 0.8.0", + "ndk-context", + "ndk-sys 0.5.0+25.2.9519653", + "num_enum", + "thiserror 1.0.69", +] + [[package]] name = "android-activity" version = "0.6.1" @@ -258,16 +279,25 @@ dependencies = [ "android-properties", "bitflags 2.13.2", "cc", - "jni", + "jni 0.22.4", "libc", "log", - "ndk", + "ndk 0.9.0", "ndk-context", - "ndk-sys", + "ndk-sys 0.6.0+11769913", "num_enum", "thiserror 2.0.21", ] +[[package]] +name = "android-build" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f9fc9904ad2ad097c3c1cfe2eacaaf0fc24710936fa9ed941cb310b7c6ed2ab7" +dependencies = [ + "windows-sys 0.52.0", +] + [[package]] name = "android-properties" version = "0.2.2" @@ -1141,6 +1171,12 @@ dependencies = [ "subtle", ] +[[package]] +name = "cesu8" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6d43a04d8753f35258c91f8ec639f792891f748a1edbd759cf1dcea3382ad83c" + [[package]] name = "cexpr" version = "0.6.0" @@ -1525,11 +1561,11 @@ dependencies = [ "block2 0.6.2", "coreaudio-rs", "dasp_sample", - "jni", + "jni 0.22.4", "js-sys", "libc", "mach2", - "ndk", + "ndk 0.9.0", "ndk-context", "num-derive", "num-traits", @@ -3186,7 +3222,7 @@ dependencies = [ "hickory-proto", "idna", "ipnet", - "jni", + "jni 0.22.4", "rand 0.10.3", "thiserror 2.0.21", "tinyvec", @@ -3204,7 +3240,7 @@ dependencies = [ "data-encoding", "idna", "ipnet", - "jni", + "jni 0.22.4", "once_cell", "prefix-trie", "rand 0.10.3", @@ -3227,7 +3263,7 @@ dependencies = [ "hickory-proto", "ipconfig", "ipnet", - "jni", + "jni 0.22.4", "moka", "ndk-context", "once_cell", @@ -3407,6 +3443,23 @@ dependencies = [ "tracing", ] +[[package]] +name = "i-slint-backend-android-activity" +version = "1.18.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "70d538003a566d7312572ac1435be0704934e46a63d55abdabede513f72332cb" +dependencies = [ + "android-activity 0.5.2", + "android-activity 0.6.1", + "android-build", + "i-slint-common", + "i-slint-core", + "i-slint-renderer-skia", + "jni 0.22.4", + "ndk 0.9.0", + "raw-window-handle", +] + [[package]] name = "i-slint-backend-linuxkms" version = "1.18.1" @@ -3439,6 +3492,7 @@ checksum = "fb974705d61ba56034f6129ff61f3e6282a2c0c07752f25e6cb417d81c0f0958" dependencies = [ "cfg-if", "cfg_aliases", + "i-slint-backend-android-activity", "i-slint-backend-linuxkms", "i-slint-backend-testing", "i-slint-backend-winit", @@ -4088,6 +4142,22 @@ version = "1.0.18" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8f42a60cbdf9a97f5d2305f08a87dc4e09308d1276d28c869c684d7777685682" +[[package]] +name = "jni" +version = "0.21.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1a87aa2bb7d2af34197c04845522473242e1aa17c12f4935d5856491a7fb8c97" +dependencies = [ + "cesu8", + "cfg-if", + "combine", + "jni-sys 0.3.1", + "log", + "thiserror 1.0.69", + "walkdir", + "windows-sys 0.45.0", +] + [[package]] name = "jni" version = "0.22.4" @@ -4717,6 +4787,20 @@ version = "1.0.9" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "308d96db8debc727c3fd9744aac51751243420e46edf401010908da7f8d5e57c" +[[package]] +name = "ndk" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2076a31b7010b17a38c01907c45b945e8f11495ee4dd588309718901b1f7a5b7" +dependencies = [ + "bitflags 2.13.2", + "jni-sys 0.3.1", + "log", + "ndk-sys 0.5.0+25.2.9519653", + "num_enum", + "thiserror 1.0.69", +] + [[package]] name = "ndk" version = "0.9.0" @@ -4726,7 +4810,7 @@ dependencies = [ "bitflags 2.13.2", "jni-sys 0.3.1", "log", - "ndk-sys", + "ndk-sys 0.6.0+11769913", "num_enum", "raw-window-handle", "thiserror 1.0.69", @@ -4738,6 +4822,15 @@ version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "27b02d87554356db9e9a873add8782d4ea6e3e58ea071a9adb9a2e8ddb884a8b" +[[package]] +name = "ndk-sys" +version = "0.5.0+25.2.9519653" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8c196769dd60fd4f363e11d948139556a344e79d451aeb2fa2fd040738ef7691" +dependencies = [ + "jni-sys 0.3.1", +] + [[package]] name = "ndk-sys" version = "0.6.0+11769913" @@ -6893,7 +6986,7 @@ checksum = "1167586491e2b18b8bfbb293e8180ec17c201c4f076d7cb3070ca964e7598f98" dependencies = [ "core-foundation 0.10.1", "core-foundation-sys", - "jni", + "jni 0.22.4", "log", "once_cell", "rustls", @@ -7445,6 +7538,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "15e477d5ff6fec20909100ff8f7062432ebfbda7a62a0f37d0252aa126f38c83" dependencies = [ "const-field-offset", + "i-slint-backend-android-activity", "i-slint-backend-linuxkms", "i-slint-backend-selector", "i-slint-common", @@ -7586,7 +7680,7 @@ dependencies = [ "fastrand", "js-sys", "memmap2", - "ndk", + "ndk 0.9.0", "objc2 0.6.4", "objc2-core-foundation", "objc2-core-graphics", @@ -8574,210 +8668,6 @@ dependencies = [ "tsproto-types", ] -[[package]] -name = "tsc-audio" -version = "0.1.0" -dependencies = [ - "cpal", - "hound", - "opus2", - "rtrb", - "rubato", - "serde", - "serde_json", - "sonora", - "sonora-agc2", - "sonora-simd", - "thiserror 2.0.21", - "tracing", - "tsclientlib", - "tsproto-packets", -] - -[[package]] -name = "tsc-core" -version = "0.1.0" -dependencies = [ - "anyhow", - "futures", - "serde_json", - "thiserror 2.0.21", - "tokio", - "tokio-tungstenite 0.30.0", - "tracing", - "tsc-audio", - "tsc-gateway-proto", - "tsc-model", - "tsc-observer", - "tsc-query", - "tsc-stream", - "tsclientlib", - "tsproto-packets", -] - -[[package]] -name = "tsc-gateway" -version = "0.1.0" -dependencies = [ - "anyhow", - "axum", - "base64 0.22.1", - "clap", - "futures", - "rand 0.10.3", - "rusqlite", - "serde", - "serde_json", - "sha2 0.10.9", - "thiserror 2.0.21", - "tokio", - "tokio-tungstenite 0.30.0", - "toml", - "tracing", - "tracing-subscriber", - "tsc-gateway-proto", - "tsc-model", - "tsc-observer", - "tsc-query", -] - -[[package]] -name = "tsc-gateway-proto" -version = "0.1.0" -dependencies = [ - "base64 0.22.1", - "serde", - "serde_json", - "sha-1", - "sha2 0.10.9", - "thiserror 2.0.21", - "tsc-model", - "tsproto", - "tsproto-types", -] - -[[package]] -name = "tsc-media" -version = "0.1.0" -dependencies = [ - "ashpd", - "bzip2", - "dav1d", - "libvpx-native-sys", - "memmap2", - "openh264", - "pipewire", - "reqwest", - "rustix 1.1.5", - "sha2 0.10.9", - "str0m", - "thiserror 2.0.21", - "tokio", - "tracing", - "wasapi", - "windows-capture", - "x11rb", - "yuv", -] - -[[package]] -name = "tsc-model" -version = "0.1.0" -dependencies = [ - "serde", - "serde_json", -] - -[[package]] -name = "tsc-observer" -version = "0.1.0" -dependencies = [ - "thiserror 2.0.21", - "tokio", - "tracing", - "tsc-model", - "tsc-query", -] - -[[package]] -name = "tsc-platform" -version = "0.1.0" -dependencies = [ - "ashpd", - "dirs", - "futures-util", - "notify-rust", - "serde", - "serde_json", - "thiserror 2.0.21", - "tokio", - "tracing", - "windows 0.62.2", - "x11rb", -] - -[[package]] -name = "tsc-query" -version = "0.1.0" -dependencies = [ - "reqwest", - "russh", - "serde", - "serde_json", - "thiserror 2.0.21", - "tokio", - "tracing", -] - -[[package]] -name = "tsc-store" -version = "0.1.0" -dependencies = [ - "keyring", - "rusqlite", - "serde", - "serde_json", - "thiserror 2.0.21", - "tsclientlib", -] - -[[package]] -name = "tsc-stream" -version = "0.1.0" -dependencies = [ - "anyhow", - "futures", - "serde", - "serde_json", - "str0m", - "thiserror 2.0.21", - "tokio", - "tracing", - "tracing-subscriber", - "tsclientlib", - "tsproto-packets", -] - -[[package]] -name = "tsc-ui" -version = "0.1.0" -dependencies = [ - "anyhow", - "chrono", - "dirs", - "png", - "slint", - "slint-build", - "tokio", - "tracing", - "tracing-subscriber", - "tsc-core", - "tsc-model", - "tsc-query", - "tsc-store", - "tsclientlib", -] - [[package]] name = "tsclientlib" version = "0.2.0" @@ -8812,31 +8702,6 @@ dependencies = [ "url", ] -[[package]] -name = "tsctl" -version = "0.1.0" -dependencies = [ - "anyhow", - "base64 0.22.1", - "clap", - "dirs", - "futures", - "futures-util", - "serde_json", - "tokio", - "tokio-tungstenite 0.30.0", - "tracing", - "tracing-subscriber", - "tsc-audio", - "tsc-gateway-proto", - "tsc-model", - "tsc-observer", - "tsc-query", - "tsc-stream", - "tsclientlib", - "tsproto-packets", -] - [[package]] name = "tsproto" version = "0.2.0" @@ -9188,6 +9053,262 @@ dependencies = [ "syn 2.0.119", ] +[[package]] +name = "voelin-android" +version = "0.1.0" +dependencies = [ + "anyhow", + "jni 0.22.4", + "rustls-platform-verifier", + "slint", + "tokio", + "tracing", + "tracing-subscriber", + "voelin-core", + "voelin-media", + "voelin-model", + "voelin-platform", + "voelin-store", + "voelin-ui", +] + +[[package]] +name = "voelin-audio" +version = "0.1.0" +dependencies = [ + "cpal", + "hound", + "opus2", + "rtrb", + "rubato", + "serde", + "serde_json", + "sonora", + "sonora-agc2", + "sonora-simd", + "thiserror 2.0.21", + "tracing", + "tsclientlib", + "tsproto-packets", +] + +[[package]] +name = "voelin-core" +version = "0.1.0" +dependencies = [ + "anyhow", + "futures", + "serde_json", + "thiserror 2.0.21", + "tokio", + "tokio-tungstenite 0.30.0", + "tracing", + "tsclientlib", + "tsproto-packets", + "voelin-audio", + "voelin-gateway-proto", + "voelin-media", + "voelin-model", + "voelin-observer", + "voelin-query", + "voelin-stream", +] + +[[package]] +name = "voelin-gateway" +version = "0.1.0" +dependencies = [ + "anyhow", + "axum", + "base64 0.22.1", + "clap", + "futures", + "rand 0.10.3", + "rusqlite", + "serde", + "serde_json", + "sha2 0.10.9", + "thiserror 2.0.21", + "tokio", + "tokio-tungstenite 0.30.0", + "toml", + "tracing", + "tracing-subscriber", + "voelin-gateway-proto", + "voelin-model", + "voelin-observer", + "voelin-query", +] + +[[package]] +name = "voelin-gateway-proto" +version = "0.1.0" +dependencies = [ + "base64 0.22.1", + "serde", + "serde_json", + "sha-1", + "sha2 0.10.9", + "thiserror 2.0.21", + "tsproto", + "tsproto-types", + "voelin-model", +] + +[[package]] +name = "voelin-media" +version = "0.1.0" +dependencies = [ + "ashpd", + "bzip2", + "dav1d", + "libvpx-native-sys", + "memmap2", + "ndk 0.9.0", + "openh264", + "pipewire", + "reqwest", + "rustix 1.1.5", + "sha2 0.10.9", + "str0m", + "thiserror 2.0.21", + "tokio", + "tracing", + "wasapi", + "windows-capture", + "x11rb", + "yuv", +] + +[[package]] +name = "voelin-model" +version = "0.1.0" +dependencies = [ + "serde", + "serde_json", +] + +[[package]] +name = "voelin-observer" +version = "0.1.0" +dependencies = [ + "thiserror 2.0.21", + "tokio", + "tracing", + "voelin-model", + "voelin-query", +] + +[[package]] +name = "voelin-platform" +version = "0.1.0" +dependencies = [ + "ashpd", + "dirs", + "futures-util", + "notify-rust", + "serde", + "serde_json", + "thiserror 2.0.21", + "tokio", + "tracing", + "windows 0.62.2", + "x11rb", +] + +[[package]] +name = "voelin-query" +version = "0.1.0" +dependencies = [ + "reqwest", + "russh", + "serde", + "serde_json", + "thiserror 2.0.21", + "tokio", + "tracing", +] + +[[package]] +name = "voelin-store" +version = "0.1.0" +dependencies = [ + "keyring", + "rusqlite", + "serde", + "serde_json", + "thiserror 2.0.21", + "tsclientlib", +] + +[[package]] +name = "voelin-stream" +version = "0.1.0" +dependencies = [ + "anyhow", + "futures", + "serde", + "serde_json", + "str0m", + "thiserror 2.0.21", + "tokio", + "tracing", + "tracing-subscriber", + "tsclientlib", + "tsproto-packets", +] + +[[package]] +name = "voelin-ui" +version = "0.1.0" +dependencies = [ + "anyhow", + "chrono", + "dirs", + "png", + "serde", + "serde_json", + "slint", + "slint-build", + "tokio", + "tracing", + "tracing-subscriber", + "tsclientlib", + "voelin-audio", + "voelin-core", + "voelin-model", + "voelin-platform", + "voelin-query", + "voelin-store", +] + +[[package]] +name = "voelinctl" +version = "0.1.0" +dependencies = [ + "anyhow", + "base64 0.22.1", + "clap", + "dirs", + "futures", + "futures-util", + "png", + "serde_json", + "tokio", + "tokio-tungstenite 0.30.0", + "tracing", + "tracing-subscriber", + "tsclientlib", + "tsproto-packets", + "voelin-audio", + "voelin-core", + "voelin-gateway-proto", + "voelin-model", + "voelin-observer", + "voelin-query", + "voelin-stream", +] + [[package]] name = "vtable" version = "0.5.0" @@ -9449,7 +9570,7 @@ version = "1.2.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "62c35be770821a214dbc362fc26908c853e776c0004294d0b10b8a6bad582f94" dependencies = [ - "jni", + "jni 0.22.4", "log", "ndk-context", "objc2 0.6.4", @@ -9894,6 +10015,15 @@ dependencies = [ "windows-link 0.2.1", ] +[[package]] +name = "windows-sys" +version = "0.45.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "75283be5efb2831d37ea142365f009c02ec203cd29a3ebecbc093d52315b66d0" +dependencies = [ + "windows-targets 0.42.2", +] + [[package]] name = "windows-sys" version = "0.48.0" @@ -9921,6 +10051,21 @@ dependencies = [ "windows-link 0.2.1", ] +[[package]] +name = "windows-targets" +version = "0.42.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8e5180c00cd44c9b1c88adb3693291f1cd93605ded80c250a75d472756b4d071" +dependencies = [ + "windows_aarch64_gnullvm 0.42.2", + "windows_aarch64_msvc 0.42.2", + "windows_i686_gnu 0.42.2", + "windows_i686_msvc 0.42.2", + "windows_x86_64_gnu 0.42.2", + "windows_x86_64_gnullvm 0.42.2", + "windows_x86_64_msvc 0.42.2", +] + [[package]] name = "windows-targets" version = "0.48.5" @@ -9979,6 +10124,12 @@ dependencies = [ "windows-link 0.2.1", ] +[[package]] +name = "windows_aarch64_gnullvm" +version = "0.42.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "597a5118570b68bc08d8d59125332c54f1ba9d9adeedeef5b99b02ba2b0698f8" + [[package]] name = "windows_aarch64_gnullvm" version = "0.48.5" @@ -9991,6 +10142,12 @@ version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "32a4622180e7a0ec044bb555404c800bc9fd9ec262ec147edd5989ccd0c02cd3" +[[package]] +name = "windows_aarch64_msvc" +version = "0.42.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e08e8864a60f06ef0d0ff4ba04124db8b0fb3be5776a5cd47641e942e58c4d43" + [[package]] name = "windows_aarch64_msvc" version = "0.48.5" @@ -10003,6 +10160,12 @@ version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "09ec2a7bb152e2252b53fa7803150007879548bc709c039df7627cabbd05d469" +[[package]] +name = "windows_i686_gnu" +version = "0.42.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c61d927d8da41da96a81f029489353e68739737d3beca43145c8afec9a31a84f" + [[package]] name = "windows_i686_gnu" version = "0.48.5" @@ -10021,6 +10184,12 @@ version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0eee52d38c090b3caa76c563b86c3a4bd71ef1a819287c19d586d7334ae8ed66" +[[package]] +name = "windows_i686_msvc" +version = "0.42.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "44d840b6ec649f480a41c8d80f9c65108b92d89345dd94027bfe06ac444d1060" + [[package]] name = "windows_i686_msvc" version = "0.48.5" @@ -10033,6 +10202,12 @@ version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "240948bc05c5e7c6dabba28bf89d89ffce3e303022809e73deaefe4f6ec56c66" +[[package]] +name = "windows_x86_64_gnu" +version = "0.42.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8de912b8b8feb55c064867cf047dda097f92d51efad5b491dfb98f6bbb70cb36" + [[package]] name = "windows_x86_64_gnu" version = "0.48.5" @@ -10045,6 +10220,12 @@ version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "147a5c80aabfbf0c7d901cb5895d1de30ef2907eb21fbbab29ca94c5b08b1a78" +[[package]] +name = "windows_x86_64_gnullvm" +version = "0.42.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "26d41b46a36d453748aedef1486d5c7a85db22e56aff34643984ea85514e94a3" + [[package]] name = "windows_x86_64_gnullvm" version = "0.48.5" @@ -10057,6 +10238,12 @@ version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "24d5b23dc417412679681396f2b49f3de8c1473deb516bd34410872eff51ed0d" +[[package]] +name = "windows_x86_64_msvc" +version = "0.42.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9aec5da331524158c6d1a4ac0ab1541149c0b9505fde06423b02f5ef0106b9f0" + [[package]] name = "windows_x86_64_msvc" version = "0.48.5" @@ -10076,7 +10263,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a6755fa58a9f8350bd1e472d4c3fcc25f824ec358933bba33306d0b63df5978d" dependencies = [ "ahash", - "android-activity", + "android-activity 0.6.1", "atomic-waker", "bitflags 2.13.2", "block2 0.5.1", @@ -10091,7 +10278,7 @@ dependencies = [ "js-sys", "libc", "memmap2", - "ndk", + "ndk 0.9.0", "objc2 0.5.2", "objc2-app-kit 0.2.2", "objc2-foundation 0.2.2", diff --git a/Cargo.toml b/Cargo.toml index 1088f46..74c34d0 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -8,19 +8,20 @@ members = [ "crates/proto/tsproto", "crates/proto/ts-bookkeeping", "crates/proto/tsclientlib", - "crates/tsc-audio", - "crates/tsc-core", - "crates/tsc-gateway", - "crates/tsc-gateway-proto", - "crates/tsc-media", - "crates/tsc-model", - "crates/tsc-observer", - "crates/tsc-platform", - "crates/tsc-query", - "crates/tsc-store", - "crates/tsc-stream", - "crates/tsc-ui", - "tools/tsctl", + "crates/voelin-android", + "crates/voelin-audio", + "crates/voelin-core", + "crates/voelin-gateway", + "crates/voelin-gateway-proto", + "crates/voelin-media", + "crates/voelin-model", + "crates/voelin-observer", + "crates/voelin-platform", + "crates/voelin-query", + "crates/voelin-store", + "crates/voelin-stream", + "crates/voelin-ui", + "tools/voelinctl", ] default-members = [ "crates/proto/tsproto-types", @@ -29,25 +30,25 @@ default-members = [ "crates/proto/tsproto", "crates/proto/ts-bookkeeping", "crates/proto/tsclientlib", - "crates/tsc-audio", - "crates/tsc-core", - "crates/tsc-gateway", - "crates/tsc-gateway-proto", - "crates/tsc-model", - "crates/tsc-observer", - "crates/tsc-platform", - "crates/tsc-query", - "crates/tsc-store", - "crates/tsc-stream", - "crates/tsc-ui", - "tools/tsctl", + "crates/voelin-audio", + "crates/voelin-core", + "crates/voelin-gateway", + "crates/voelin-gateway-proto", + "crates/voelin-model", + "crates/voelin-observer", + "crates/voelin-platform", + "crates/voelin-query", + "crates/voelin-store", + "crates/voelin-stream", + "crates/voelin-ui", + "tools/voelinctl", ] [workspace.package] edition = "2024" rust-version = "1.94" license = "MIT OR Apache-2.0" -repository = "https://github.com/Faumaray/teamspeak_client_rs" +repository = "https://github.com/Faumaray/Voelin" publish = false [workspace.lints.rust] diff --git a/README.md b/README.md index 3aa1698..ba36a26 100644 --- a/README.md +++ b/README.md @@ -1,13 +1,13 @@ -# teamspeak_client_rs +# Voelin -A TeamSpeak 3 / TeamSpeak 6 compatible voice client written in Rust, for desktop +Voelin is a TeamSpeak 3 / TeamSpeak 6 compatible voice client written in Rust, for desktop (Linux Wayland/X11, Windows, later macOS) and mobile (Android, later iOS). It speaks the TeamSpeak client protocol itself (no official SDK). The protocol layer is a vendored fork of [ReSpeak/tsclientlib](https://github.com/ReSpeak/tsclientlib). > Not affiliated with or endorsed by TeamSpeak Systems GmbH. "TeamSpeak" is a -> trademark of its owner; the product name of this client is still to be decided. +> trademark of its owner. ## Goals @@ -28,66 +28,88 @@ Done so far (milestones M0–M4 and the first part of M5 of [the plan](docs/arch - `crates/proto/`: vendored tsclientlib, modernised (TS6 fields and stream messages, faster off-thread Init1 puzzle, `curve25519-dalek` 4, fuzzing fixes; see [UPSTREAM.md](crates/proto/UPSTREAM.md)) -- `crates/tsc-model`: server flavor detection (TS3 / TS6) and capabilities -- `crates/tsc-audio`: Opus voice encoding, framing, resampling, WAV, jitter buffer/mixer, cpal devices -- `crates/tsc-store`: SQLite store for identities, bookmarks, settings and chat history; keyring secrets -- `crates/tsc-query`: ServerQuery client over raw TCP, SSH and HTTP WebQuery (events, rate limiting, keepalive) -- `crates/tsc-observer`: invisible presence (events or polling) and channel-chat relays over ServerQuery -- `crates/tsc-gateway` (`tsgw`) + `tsc-gateway-proto`: companion gateway for server admins. Users log in +- `crates/voelin-model`: server flavor detection (TS3 / TS6) and capabilities +- `crates/voelin-audio`: Opus voice encoding, framing, resampling, WAV, jitter buffer/mixer, cpal devices +- `crates/voelin-store`: SQLite store for identities, bookmarks, settings and chat history; keyring secrets +- `crates/voelin-query`: ServerQuery client over raw TCP, SSH and HTTP WebQuery (events, rate limiting, keepalive) +- `crates/voelin-observer`: invisible presence (events or polling) and channel-chat relays over ServerQuery +- `crates/voelin-gateway` (`tsgw`) + `voelin-gateway-proto`: companion gateway for server admins. Users log in with their TeamSpeak identity and get presence, channel chat and history without joining voice, limited by their server permissions ([admin guide](docs/gateway-admin.md)) -- `crates/tsc-core`: client engine; sessions merge voice, gateway and query sources, route chat, run audio -- `crates/tsc-ui` (`tsc-desktop`): Slint desktop app: servers, channel tree with talking indicators, +- `crates/voelin-core`: client engine; sessions merge voice, gateway and query sources, route chat, run audio; + the media pipeline for streams (capture → VP8 + Opus → stream, stream → decoder) +- `crates/voelin-ui` (`voelin`): Slint desktop app: servers, channel tree with talking indicators, chat tabs (own channel via voice, other channels via relay), connect / observe invisibly, mute, push-to-talk -- `crates/tsc-stream`: TeamSpeak 6 streams: stream commands and notifications, JSON signalling, + (in the window and as a global hotkey), audio settings with a level meter, per-client volume, and on + TeamSpeak 6 streams: watch in a viewer, share the screen with sound +- `crates/voelin-stream`: TeamSpeak 6 streams: stream commands and notifications, JSON signalling, WebRTC peers (str0m) with host and STUN candidates. A live test streams VP8 + Opus between two clients through a TS6 server -- `tools/tsctl`: headless CLI: channel tree, chat, voice send/record, raw commands, stream events, +- `tools/voelinctl`: headless CLI: channel tree, chat, voice send/record, raw commands, stream events, `query`, `observe` (invisible presence), `relay` (channel chat without joining) and `gateway` - `dev/`: TeamSpeak 3.13 and TeamSpeak 6 (6.0.0-beta13.1) servers; `scripts/it-smoke.sh` checks tree, server chat, channel chat, a voice tone round-trip, invisible presence, relay chat and the gateway on both - `fuzz/`: cargo-fuzz targets for packets, commands and the license chain +- `android/` + `crates/voelin-android`: the Android app (the same Slint UI in a NativeActivity, + voice in a foreground service, screen sharing through MediaProjection, MediaCodec, Keystore + passwords). It builds; it has not run on a device yet ([docs/android.md](docs/android.md)) -Screen sharing has its protocol and transport layer (`tsc-stream`); capture, codecs and the UI -for it are in progress. No Android build yet. +Screen sharing works between our clients through a TeamSpeak 6 server (VP8 video, Opus audio); +interop with the official TeamSpeak 6 client is not verified yet. | Connected with voice | Observing invisibly through the gateway | |---|---| | ![voice](docs/screenshots/desktop-voice.png) | ![observe](docs/screenshots/desktop-observe.png) | +| **Watching a stream** | **Sharing the screen** | +| ![viewer](docs/screenshots/desktop-stream-viewer.png) | ![share](docs/screenshots/desktop-share-dialog.png) | ## Try it ```sh # Desktop app -cargo run -p tsc-ui --bin tsc-desktop +cargo run -p voelin-ui --bin voelin # Local servers (use REGISTRY=mirror.gcr.io if Docker Hub rate-limits you) docker compose -f dev/docker-compose.yml up -d -cargo run -p tsctl -- connect 127.0.0.1:9987 tree # TeamSpeak 3 -cargo run -p tsctl -- connect 127.0.0.1:9988 tree # TeamSpeak 6 -cargo run -p tsctl -- connect 127.0.0.1:9988 --nick me repl # interactive chat -cargo run -p tsctl -- connect 127.0.0.1:9988 --nick me voice send --tone 440 -cargo run -p tsctl -- connect 127.0.0.1:9988 --nick ear voice record out.wav +cargo run -p voelinctl -- connect 127.0.0.1:9987 tree # TeamSpeak 3 +cargo run -p voelinctl -- connect 127.0.0.1:9988 tree # TeamSpeak 6 +cargo run -p voelinctl -- connect 127.0.0.1:9988 --nick me repl # interactive chat +cargo run -p voelinctl -- connect 127.0.0.1:9988 --nick me voice send --tone 440 +cargo run -p voelinctl -- connect 127.0.0.1:9988 --nick ear voice record out.wav -# ServerQuery (dev password tsc-dev-admin): invisible presence and relay chat -cargo run -p tsctl -- observe ssh 127.0.0.1:10022 --secret tsc-dev-admin --allowlisted -cargo run -p tsctl -- relay ssh 127.0.0.1:10022 --secret tsc-dev-admin --allowlisted --channel 1 +# Streams (TeamSpeak 6): share the test pattern (or --source x11), watch and decode it +cargo run -p voelinctl -- connect 127.0.0.1:9988 --nick eye stream watch --save-frame shot.png & +cargo run -p voelinctl -- connect 127.0.0.1:9988 --nick me stream start --synthetic --auto-accept + +# ServerQuery (dev password voelin-dev-admin): invisible presence and relay chat +cargo run -p voelinctl -- observe ssh 127.0.0.1:10022 --secret voelin-dev-admin --allowlisted +cargo run -p voelinctl -- relay ssh 127.0.0.1:10022 --secret voelin-dev-admin --allowlisted --channel 1 # Gateway: users without voice, logging in with their identity -cargo run -p tsc-gateway -- --config dev/tsgw-ts6.toml & -cargo run -p tsctl -- gateway ws://127.0.0.1:7788/v1 --identity --presence --open channel:1 +cargo run -p voelin-gateway -- --config dev/tsgw-ts6.toml & +cargo run -p voelinctl -- gateway ws://127.0.0.1:7788/v1 --identity --presence --open channel:1 scripts/it-smoke.sh # all of the above, on both servers ``` -Other commands: `tsctl identity new`, `tsctl versions`, `tsctl connect listen|chat|raw`. -`tsctl --help` lists all options. +Other commands: `voelinctl identity new`, `voelinctl versions`, `voelinctl connect listen|chat|raw`. +`voelinctl --help` lists all options. + +Development switches of the desktop app (environment variables): `VOELIN_DATA_DIR` (database), +`VOELIN_AUTOCONNECT=voice|observe`, `VOELIN_SCREENSHOT=` (with `VOELIN_SCREENSHOT_DELAY`), +`VOELIN_DEMO_STREAM=1` (a local test stream in the viewer, no server needed), +`VOELIN_OPEN=share|settings[:]|about|client`, `VOELIN_AUTOWATCH=1`, `VOELIN_AUTOSHARE=test-pattern`. + +Ready-made packages (Linux `.tar.gz`/`.deb`/Flatpak, Windows zip and installer, Android APK, +and the `tsgw` gateway for Linux servers) come from the release workflow (version tags, or run by +hand), and `scripts/docker-build.sh` builds the same ones locally in Docker: see +[docs/building.md](docs/building.md). Building on Linux needs the ALSA headers (`libasound2-dev`), fontconfig and xkbcommon headers for the UI (`libfontconfig1-dev libxkbcommon-dev`), plus CMake and a C compiler for -the bundled libopus. +the bundled libopus; for streams also libvpx and PipeWire (see [docs/media.md](docs/media.md#build-requirements)). ## License @@ -95,5 +117,9 @@ The vendored crates in `crates/proto/` are `MIT OR Apache-2.0` (upstream `LICENSE-MIT` / `LICENSE-APACHE` are kept there). New crates are declared under the same terms in `Cargo.toml`. -Third-party notices: the UI toolkit, Slint, is used under its royalty-free license, which -requires an attribution in the app's About page. +Third-party notices: [THIRD_PARTY_NOTICES.md](THIRD_PARTY_NOTICES.md), generated from +`Cargo.lock` by `scripts/notices.sh` and shown in the app's About page. The UI toolkit, +Slint, is used under its royalty-free license, which requires an attribution in the +About page. + +Security issues: see [SECURITY.md](SECURITY.md). Releases: [docs/release.md](docs/release.md). diff --git a/SECURITY.md b/SECURITY.md new file mode 100644 index 0000000..e662c19 --- /dev/null +++ b/SECURITY.md @@ -0,0 +1,64 @@ +# Security + +## Reporting a vulnerability + +Please report security problems privately through GitHub: **Security > +Report a vulnerability** on +https://github.com/Faumaray/Voelin (private vulnerability +reporting). Do not open a public issue for them. If private reporting is not +available, open an issue asking for a contact, without details. + +Include what is affected (desktop app, Android app, `tsgw` gateway, `voelinctl`), +the version or commit, and how to reproduce. You should get an answer within +a week. Fixes are released as soon as they are ready and credited in the +changelog unless you prefer otherwise. + +Supported versions: until 1.0, only the latest release gets fixes. + +In scope: this repository's code and its packages. Problems in TeamSpeak +servers or the official clients belong to TeamSpeak Systems GmbH; problems in +dependencies to their projects (tell us too if this client is affected). + +## What the client stores + +Everything stays on the device; there is no telemetry and no account with +us. + +| What | Where | Protection | +|---|---|---| +| Identities (TeamSpeak private keys) | SQLite database `client.db` in the data directory (`~/.local/share/voelin`, Flatpak `~/.var/app//data/voelin`, `%APPDATA%\voelin`, Android app storage) | File permissions of the user account only; not encrypted. An identity is the account on every server that knows it: back it up, do not share the file | +| Server and ServerQuery passwords | OS keyring (Secret Service, Windows Credential Manager, Android Keystore), service `voelin` | Keyring; kept in memory for the session only when there is no keyring | +| Bookmarks, settings, chat history | `client.db` | File permissions; history stays until deleted | +| Crash reports (opt-in) | `crash-reports` in the state directory (`~/.local/state/voelin`, `%LOCALAPPDATA%\voelin`) | Local only, never uploaded. They contain the panic message and a backtrace, which may include server addresses or names; review before attaching one to an issue | +| OpenH264 (opt-in) | Downloaded from Cisco into the app's directories | Loaded only if its SHA-256 matches a known Cisco build | + +## What others can see + +- **Voice connections** use the TeamSpeak protocol's encryption. The server + and its admins see what any client sees: your nickname, identity, IP + address, channel and messages. +- **Streams (TeamSpeak 6)** are peer-to-peer WebRTC (DTLS-SRTP). Viewers and + streamers exchange ICE candidates, so **they learn each other's IP + addresses**, including local network addresses. Only watch and share + streams with people you are fine sharing your address with. +- **Relayed channel chat** (gateway or own ServerQuery login) is posted by a + query client as `[Nick] text`; people in that channel see it came through + a relay. + +## What the gateway (`tsgw`) stores + +The gateway is run by a server admin (see +[docs/gateway-admin.md](docs/gateway-admin.md)). In its SQLite database +(`history.path`, default `tsgw.db`): + +| Table | Contents | Retention | +|---|---|---| +| `tokens` | SHA-256 hashes of login tokens (never the tokens), the user's unique id and database id, expiry | Removed after expiry (`auth.token_ttl_hours`, default 30 days) | +| `messages` | Relayed server and channel chat: target, time, author unique id and name, text | `history.retention_days` (default 30); disable with `history.enabled = false` | +| `audit` | Time, unique id and action of every login and post | Not pruned automatically; the admin should rotate it | + +It holds no voice and no passwords of users: users log in by signing a +challenge with their identity key. The gateway's own ServerQuery credentials +(usually with admin rights) are in its config file, a password file or +`TSGW_QUERY_PASSWORD`: keep them readable only by the gateway's user. Serve +the gateway over TLS (`wss://`) only; tokens travel in its messages. diff --git a/THIRD_PARTY_NOTICES.md b/THIRD_PARTY_NOTICES.md new file mode 100644 index 0000000..9979541 --- /dev/null +++ b/THIRD_PARTY_NOTICES.md @@ -0,0 +1,11636 @@ +# Third-party notices + + + +This app is licensed under MIT OR Apache-2.0. It contains the third-party +software listed here, whose licenses require these notices. + +## Slint + +The user interface is built with Slint (https://slint.dev), used under the +Slint Royalty-free Desktop, Mobile, and Web Applications License 2.0 +(LicenseRef-Slint-Royalty-free-2.0, full text below). As that license requires, +the About page shows the AboutSlint widget. + +## OpenH264 + +OpenH264 Video Codec provided by Cisco Systems, Inc. + +The app does not include OpenH264. Only when you enable H.264 does it download +Cisco's prebuilt OpenH264 binary from ciscobinary.openh264.org, check it +against known checksums and load it at runtime; you can disable it again at +any time. Cisco distributes that binary under the BSD-2-Clause license +(Copyright (c) 2013, Cisco Systems; text below, used by openh264-sys2) and +covers the MPEG LA H.264 patent royalties for it. + +## tsclientlib + +The TeamSpeak protocol implementation is a fork of tsclientlib +(https://github.com/ReSpeak/tsclientlib), licensed under MIT OR Apache-2.0: + +````text +The MIT License (MIT) + +Copyright (c) 2017-2020 tsclientlib contributors + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. +```` + +## Native libraries + +- Opus (libopus), compiled into the app: BSD-3-Clause, Copyright 2001-2023 + Xiph.Org and contributors; text below, used by libopus_sys. +- AWS-LC (with code from BoringSSL and OpenSSL), compiled into the app: + notices and texts below under ISC, used by aws-lc-sys. +- libvpx (VP8 and VP9): the system library on Linux, compiled into the app on + Windows. Its license and patent grant: + +````text +Copyright (c) 2010, The WebM Project authors. All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are +met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + + * Neither the name of Google, nor the WebM Project, nor the names + of its contributors may be used to endorse or promote products + derived from this software without specific prior written + permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +Additional IP Rights Grant (Patents) +------------------------------------ + +"These implementations" means the copyrightable works that implement the WebM +codecs distributed by Google as part of the WebM Project. + +Google hereby grants to you a perpetual, worldwide, non-exclusive, no-charge, +royalty-free, irrevocable (except as stated in this section) patent license to +make, have made, use, offer to sell, sell, import, transfer, and otherwise +run, modify and propagate the contents of these implementations of WebM, where +such license applies only to those patent claims, both currently owned by +Google and acquired in the future, licensable by Google that are necessarily +infringed by these implementations of WebM. This grant does not include claims +that would be infringed only as a consequence of further modification of these +implementations. If you or your agent or exclusive licensee institute or order +or agree to the institution of patent litigation or any other patent +enforcement activity against any entity (including a cross-claim or +counterclaim in a lawsuit) alleging that any of these implementations of WebM +or any code incorporated within any of these implementations of WebM +constitute direct or contributory patent infringement, or inducement of +patent infringement, then any patent rights granted to you under this License +for these implementations of WebM shall terminate as of the date such +litigation is filed. +```` + +- Skia (Android app only: Slint draws with it there), compiled into the app + from rust-skia's prebuilt binaries (skia-bindings). Its license: + +````text +Copyright (c) 2011 Google Inc. All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are +met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + + * Neither the name of the copyright holder nor the names of its + contributors may be used to endorse or promote products derived + from this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +```` + + The Skia build includes further libraries under their own licenses: + FreeType (FreeType License: portions of this software are copyright © The + FreeType Project, www.freetype.org, all rights reserved), libpng (PNG + Reference Library License), libjpeg-turbo (IJG License, BSD-3-Clause and + zlib License: this software is based in part on the work of the Independent + JPEG Group), zlib (zlib License), Expat (MIT), Wuffs (Apache-2.0) and the + Vulkan Memory Allocator (MIT). + +Other system libraries the app uses at runtime (ALSA, PipeWire, fontconfig, +xkbcommon, the C and C++ runtimes) belong to the operating system and are not +distributed with it. + +## Rust crates + +Licenses of the Rust crates compiled into the apps, with the crates using +each text. Where a crate offers a choice of licenses, the one shown is the one +this app uses. Texts marked "standard text" were not included in the crate; +the crate's authors are listed as its copyright holders. + +| License | Crates | +|---|---| +| MIT License | 619 | +| Apache License 2.0 | 29 | +| Unicode License v3 | 26 | +| BSD 3-Clause "New" or "Revised" License | 22 | +| LicenseRef-Slint-Royalty-free-2.0 | 12 | +| ISC License | 8 | +| BSD 2-Clause "Simplified" License | 3 | +| zlib License | 3 | +| Boost Software License 1.0 | 2 | +| Mozilla Public License 2.0 | 2 | +| The Unlicense | 1 | +| bzip2 and libbzip2 License v1.0.6 | 1 | + +### Apache License 2.0 + +Used by: flagset 0.4.7, hound 3.5.1 + +````text + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + +```` + +Used by: moka 0.12.16 + +````text + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright 2020 - 2026 Tatsuya Kawano + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + +```` + +Used by: moxcms 0.8.1, pxfm 0.1.30, yuv 0.8.19 + +````text + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright 2024 Radzivon Bartoshyk + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + +```` + +Used by: cpal 0.18.2, imgref 1.12.3, self_cell 1.3.0, unicode-linebreak 0.1.5 + +````text + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + +```` + +Used by: gethostname 1.1.0 + +````text + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + +TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + +1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + +2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + +3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + +4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + +5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + +6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + +7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + +8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + +9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + +END OF TERMS AND CONDITIONS + +APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + +Copyright [yyyy] [name of copyright owner] + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + +```` + +Used by: glutin 0.32.3, glutin_egl_sys 0.7.1, glutin_glx_sys 0.6.1, glutin_wgl_sys 0.6.1 + +````text +Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "{}" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright 2022 Kirill Chibisov + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + +```` + +Used by: dpi 0.1.2, winit 0.30.13 + +````text +Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "{}" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright {yyyy} {name of copyright owner} + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +```` + +Standard text, used by: +- ab_glyph 0.2.32: Alex Butler (https://github.com/alexheretic/ab-glyph) +- ab_glyph_rasterizer 0.1.10: Alex Butler (https://github.com/alexheretic/ab-glyph) +- accesskit_winit 0.33.2: The AccessKit contributors (https://github.com/AccessKit/accesskit) +- audio-codec-algorithms 0.8.1 (https://github.com/karip/audio-codec-algorithms) +- aws-lc-sys 0.45.0: AWS-LC (https://github.com/aws/aws-lc-rs) +- owned_ttf_parser 0.25.1: Alex Butler (https://github.com/alexheretic/owned-ttf-parser) +- pageant 0.2.3: Eugene (https://github.com/warp-tech/russh) +- russh-cryptovec 0.62.0: Pierre-Étienne Meunier , Eugeny (https://github.com/warp-tech/russh) +- ryu 1.0.23: David Tolnay (https://github.com/dtolnay/ryu) +- sync_wrapper 1.0.2: Actyx AG (https://github.com/Actyx/sync_wrapper) + +````text +Apache License +Version 2.0, January 2004 +http://www.apache.org/licenses/ + +TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + +1. Definitions. + +"License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document. + +"Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License. + +"Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity. + +"You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License. + +"Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files. + +"Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types. + +"Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below). + +"Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof. + +"Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution." + +"Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work. + +2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form. + +3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed. + +4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions: + + (a) You must give any other recipients of the Work or Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License. + + You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License. + +5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions. + +6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file. + +7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License. + +8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages. + +9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability. + +END OF TERMS AND CONDITIONS + +APPENDIX: How to apply the Apache License to your work. + +To apply the Apache License to your work, attach the following boilerplate notice, with the fields enclosed by brackets "[]" replaced with your own identifying information. (Don't include the brackets!) The text should be enclosed in the appropriate comment syntax for the file format. We also recommend that a file or class name and description of purpose be included on the same "printed page" as the copyright notice for easier identification within third-party archives. + +Copyright [yyyy] [name of copyright owner] + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + +http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + +```` + +### BSD 2-Clause "Simplified" License + +Used by: openh264-sys2 0.9.8 + +````text +Copyright (c) 2013, Cisco Systems +All rights reserved. + +Redistribution and use in source and binary forms, with or without modification, +are permitted provided that the following conditions are met: + +* Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + +* Redistributions in binary form must reproduce the above copyright notice, this + list of conditions and the following disclaimer in the documentation and/or + other materials provided with the distribution. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND +ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR +ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON +ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +```` + +Used by: arrayref 0.3.9 + +````text +Copyright (c) 2015 David Roundy +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are +met: + +1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + +2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the + distribution. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +```` + +Standard text, used by: +- openh264 0.9.8: Ralf Biedert (https://github.com/ralfbiedert/openh264-rs) + +````text +Copyright (c) + +Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: + +1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. + +2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +```` + +### BSD 3-Clause "New" or "Revised" License + +Used by: encoding_rs 0.8.42 + +````text +// Copyright © WHATWG (Apple, Google, Mozilla, Microsoft). +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: +// +// 1. Redistributions of source code must retain the above copyright notice, this +// list of conditions and the following disclaimer. +// +// 2. Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following disclaimer in the documentation +// and/or other materials provided with the distribution. +// +// 3. Neither the name of the copyright holder nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +// SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, +// OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +/// The PUA code points special-cased in the GB18030 encoder. +pub(crate) static GB18030_2022_OVERRIDE_PUA: [u16; 18] = [ + 0xE78D, 0xE78E, 0xE78F, 0xE790, 0xE791, 0xE792, 0xE793, 0xE794, 0xE795, 0xE796, 0xE81E, 0xE826, + 0xE82B, 0xE82C, 0xE832, 0xE843, 0xE854, 0xE864, +]; + +/// The bytes corresponding to the PUA code points special-cased in the GB18030 encoder. +pub(crate) static GB18030_2022_OVERRIDE_BYTES: [[u8; 2]; 18] = [ + [0xA6, 0xD9], + [0xA6, 0xDA], + [0xA6, 0xDB], + [0xA6, 0xDC], + [0xA6, 0xDD], + [0xA6, 0xDE], + [0xA6, 0xDF], + [0xA6, 0xEC], + [0xA6, 0xED], + [0xA6, 0xF3], + [0xFE, 0x59], + [0xFE, 0x61], + [0xFE, 0x66], + [0xFE, 0x67], + [0xFE, 0x6D], + [0xFE, 0x7E], + [0xFE, 0x90], + [0xFE, 0xA0], +]; + +```` + +Used by: matchit 0.8.4 + +````text +BSD 3-Clause License + +Copyright (c) 2013, Julien Schmidt +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + +1. Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + +2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + +3. Neither the name of the copyright holder nor the names of its + contributors may be used to endorse or promote products derived from + this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE +FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, +OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +```` + +Used by: tiny-skia-path 0.11.4, tiny-skia-path 0.12.0, tiny-skia 0.11.4, tiny-skia 0.12.0 + +````text +Copyright (c) 2011 Google Inc. All rights reserved. +Copyright (c) 2020 Yevhenii Reizner All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are +met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + + * Neither the name of the copyright holder nor the names of its + contributors may be used to endorse or promote products derived + from this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +```` + +Used by: sonora-agc2 0.2.0, sonora-common-audio 0.2.0, sonora-fft 0.2.0, sonora-ns 0.2.0, sonora-simd 0.2.0, sonora 0.2.0 + +````text +Copyright (c) 2011, The WebRTC Project Authors. All rights reserved. +Copyright (c) 2016, Arun Raghavan and contributors. All rights reserved. +Copyright (c) 2026, dignifiedquire. All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are +met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + + * Neither the name of Google nor the names of its contributors may + be used to endorse or promote products derived from this software + without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +```` + +Used by: subtle 2.6.1 + +````text +Copyright (c) 2016-2017 Isis Agora Lovecruft, Henry de Valence. All rights reserved. +Copyright (c) 2016-2024 Isis Agora Lovecruft. All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are +met: + +1. Redistributions of source code must retain the above copyright +notice, this list of conditions and the following disclaimer. + +2. Redistributions in binary form must reproduce the above copyright +notice, this list of conditions and the following disclaimer in the +documentation and/or other materials provided with the distribution. + +3. Neither the name of the copyright holder nor the names of its +contributors may be used to endorse or promote products derived from +this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS +IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED +TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A +PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED +TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF +LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +```` + +Used by: curve25519-dalek 5.0.0 + +````text +Copyright (c) 2016-2021 isis agora lovecruft. All rights reserved. +Copyright (c) 2016-2021 Henry de Valence. All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are +met: + +1. Redistributions of source code must retain the above copyright +notice, this list of conditions and the following disclaimer. + +2. Redistributions in binary form must reproduce the above copyright +notice, this list of conditions and the following disclaimer in the +documentation and/or other materials provided with the distribution. + +3. Neither the name of the copyright holder nor the names of its +contributors may be used to endorse or promote products derived from +this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS +IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED +TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A +PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED +TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF +LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +```` + +Used by: ed25519-dalek 3.0.0 + +````text +Copyright (c) 2017-2019 isis agora lovecruft. All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are +met: + +1. Redistributions of source code must retain the above copyright +notice, this list of conditions and the following disclaimer. + +2. Redistributions in binary form must reproduce the above copyright +notice, this list of conditions and the following disclaimer in the +documentation and/or other materials provided with the distribution. + +3. Neither the name of the copyright holder nor the names of its +contributors may be used to endorse or promote products derived from +this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS +IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED +TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A +PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED +TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF +LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +```` + +Standard text, used by: +- aws-lc-sys 0.45.0: AWS-LC (https://github.com/aws/aws-lc-rs) +- curve25519-dalek 4.1.3: Isis Lovecruft , Henry de Valence (https://github.com/dalek-cryptography/curve25519-dalek/tree/main/curve25519-dalek) +- git-testament-derive 0.2.1: Daniel Silverstone (https://github.com/kinnison/git-testament/) +- git-testament 0.2.6: Daniel Silverstone (https://github.com/kinnison/git-testament/) +- sonora-aec3 0.2.0 (https://github.com/dignifiedquire/sonora) + +````text +Copyright (c) . + +Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: + +1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. + +2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. + +3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +```` + +Used by: libopus_sys 0.3.3 + +````text +Copyright 2001-2023 Xiph.Org, Skype Limited, Octasic, + Jean-Marc Valin, Timothy B. Terriberry, + CSIRO, Gregory Maxwell, Mark Borgerding, + Erik de Castro Lopo, Mozilla, Amazon + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions +are met: + +- Redistributions of source code must retain the above copyright +notice, this list of conditions and the following disclaimer. + +- Redistributions in binary form must reproduce the above copyright +notice, this list of conditions and the following disclaimer in the +documentation and/or other materials provided with the distribution. + +- Neither the name of Internet Society, IETF or IETF Trust, nor the +names of specific contributors, may be used to endorse or promote +products derived from this software without specific prior written +permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER +OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF +LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +Opus is subject to the royalty-free patent licenses which are +specified at: + +Xiph.Org Foundation: +https://datatracker.ietf.org/ipr/1524/ + +Microsoft Corporation: +https://datatracker.ietf.org/ipr/1914/ + +Broadcom Corporation: +https://datatracker.ietf.org/ipr/1526/ + +```` + +Used by: encoding_rs 0.8.42 + +````text +Copyright © WHATWG (Apple, Google, Mozilla, Microsoft). + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + +1. Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + +2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + +3. Neither the name of the copyright holder nor the names of its + contributors may be used to endorse or promote products derived from + this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE +FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, +OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +```` + +### Boost Software License 1.0 + +Used by: error-code 3.4.0 + +````text +Boost Software License - Version 1.0 - August 17th, 2003 + +Permission is hereby granted, free of charge, to any person or organization +obtaining a copy of the software and accompanying documentation covered by +this license (the "Software") to use, reproduce, display, distribute, +execute, and transmit the Software, and to prepare derivative works of the +Software, and to permit third-parties to whom the Software is furnished to +do so, all subject to the following: + +The copyright notices in the Software and this entire statement, including +the above license grant, this restriction and the following disclaimer, +must be included in all copies of the Software, in whole or in part, and +all derivative works of the Software, unless such copies or derivative +works are solely in the form of machine-executable object code generated by +a source language processor. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT +SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE +FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, +ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +DEALINGS IN THE SOFTWARE. + +```` + +Standard text, used by: +- clipboard-win 5.4.1: Douman (https://github.com/DoumanAsh/clipboard-win) + +````text +Boost Software License - Version 1.0 - August 17th, 2003 + +Permission is hereby granted, free of charge, to any person or organization obtaining a copy of the software and accompanying documentation covered by this license (the "Software") to use, reproduce, display, distribute, execute, and transmit the Software, and to prepare derivative works of the Software, and to permit third-parties to whom the Software is furnished to do so, all subject to the following: + +The copyright notices in the Software and this entire statement, including the above license grant, this restriction and the following disclaimer, must be included in all copies of the Software, in whole or in part, and all derivative works of the Software, unless such copies or derivative works are solely in the form of machine-executable object code generated by a source language processor. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +```` + +### ISC License + +Used by: untrusted 0.7.1, untrusted 0.9.0 + +````text +// Copyright 2015-2016 Brian Smith. +// +// Permission to use, copy, modify, and/or distribute this software for any +// purpose with or without fee is hereby granted, provided that the above +// copyright notice and this permission notice appear in all copies. +// +// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHORS DISCLAIM ALL WARRANTIES +// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF +// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR +// ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN +// ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF +// OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + +```` + +Used by: aws-lc-sys 0.45.0 + +````text +AWS Libcrypto (AWS-LC) + +AWS-LC is a fork of BoringSSL, which is itself a fork of OpenSSL. +Content from these and other sources retains their original licensing, +as described below. New files from AWS-LC are made available under the Apache-2.0 license OR the ISC +license. These licenses are reproduced at the bottom of this file. + +``` +Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. +SPDX-License-Identifier: Apache-2.0 OR ISC +``` + + +================================================================================ +BoringSSL +================================================================================ + +BoringSSL is a Google-maintained fork of OpenSSL. Historically, code +authored by Google for BoringSSL was licensed under the ISC License. +BoringSSL has since relicensed upstream to Apache License 2.0. Existing +AWS-LC code originating from BoringSSL retains its ISC license, while +newer code taken from BoringSSL is licensed under Apache License 2.0. + +``` +Copyright (c) 2014-2024 Google Inc. +SPDX-License-Identifier: ISC +``` + +Additional individual contributions to BoringSSL-derived code are +covered under the ISC license: + + - Brian Smith (Copyright 2016) + - Robert Nagy (Copyright 2022) + - Arm Ltd (Copyright 2020) + +``` +Copyright (c) 2025-2026 Google Inc. +SPDX-License-Identifier: Apache-2.0 +``` + +================================================================================ +OpenSSL +================================================================================ + +Code derived from the OpenSSL project is licensed under the +Apache License, Version 2.0. + +``` +Copyright (c) 1998-2011 The OpenSSL Project. All rights reserved. +SPDX-License-Identifier: Apache-2.0 +``` + +Some OpenSSL-derived files also carry the original SSLeay copyright: + +``` +Copyright (c) 1995-1998 Eric Young (eay@cryptsoft.com). All rights reserved. +SPDX-License-Identifier: Apache-2.0 +``` + +Portions of OpenSSL-derived code include contributions from: + + - Sun Microsystems, Inc. (Copyright 2002) + - Nokia (Copyright 2005) + - Intel Corporation (Copyright 2012-2021) + +These contributions are covered under the Apache-2.0 license. + +================================================================================ +mlkem-native +================================================================================ + +Code from the mlkem-native project is licensed under Apache License 2.0 or MIT or ISC. + +``` +Copyright (c) The mlkem-native project authors. +SPDX-License-Identifier: Apache-2.0 OR ISC OR MIT +``` + +================================================================================ +mldsa-native +================================================================================ + +Code from the mldsa-native project is licensed under Apache License 2.0 or MIT or ISC + +``` +Copyright (c) The mldsa-native project authors. +SPDX-License-Identifier: Apache-2.0 OR ISC OR MIT +``` + +================================================================================ +Third-Party Libraries (compiled into libcrypto/libssl) +================================================================================ + +Fiat Cryptography +----------------- +Synthesizing Correct-by-Construction Code for Cryptographic Primitives. +See third_party/fiat/LICENSE. + +``` +Copyright (c) 2015-2020 the fiat-crypto authors. +SPDX-License-Identifier: MIT +``` + +s2n-bignum +---------- +Integer arithmetic routines for cryptography. +See third_party/s2n-bignum/s2n-bignum-imported/LICENSE. + +``` +Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. +SPDX-License-Identifier: Apache-2.0 OR ISC OR MIT-0 +``` + +Note: ML-KEM/SHA3 code within s2n-bignum is licensed as +Apache-2.0 OR ISC OR MIT (with attribution), sourced from the +mlkem-native project. + +Jitter Entropy RNG +------------------- +CPU Jitter Random Number Generator Library. +See third_party/jitterentropy/jitterentropy-library/LICENSE. + +The Jitter Entropy library is dual-licensed under a BSD-style license +and the GNU General Public License Version 2. Amazon expressly elects +to distribute the package under the 3-Clause BSD License and NOT under +GNU General Public License Version 2. + +``` +Copyright (C) 2017 - 2025, Stephan Mueller . +SPDX-License-Identifier: BSD-3-Clause +``` + +Keccak / AES Reference Implementations +--------------------------------------- +Public domain (CC0) contributions. +https://creativecommons.org/public-domain/cc0 + +Code from sources and by authors listed in comments on top of the respective files. + + +================================================================================ +Third-Party Libraries (NOT compiled into libcrypto/libssl) +================================================================================ + +The following are used for testing and build tooling only. Distributing +code linked against AWS-LC (libcrypto/libssl) does NOT trigger these +license obligations. + +Google Test +----------- +See third_party/googletest/LICENSE. + +``` +Copyright 2008 Google Inc. +SPDX-License-Identifier: BSD-3-Clause +``` + +Go Standard Library +------------------- +Code in ssl/test/runner/ is derived from the Go standard library. + +``` +Copyright (c) The Go Authors. All rights reserved. +SPDX-License-Identifier: BSD-3-Clause +``` + +Wycheproof Test Vectors +------------------------ +Project Wycheproof is a community managed repository of test vectors that can be used by cryptography library +developers to test against known attacks, specification inconsistencies, and other various implementation bugs. + +See third_party/wycheproof_testvectors/LICENSE. + +``` +SPDX-License-Identifier: Apache-2.0 +``` + + +================================================================================ +Full License Texts +================================================================================ + +Apache License 2.0 +------------------ +Apache License +Version 2.0, January 2004 +http://www.apache.org/licenses/ + +TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files. + + "Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work. + 2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form. + 3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed. + 4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions: + (a) You must give any other recipients of the Work or Derivative Works a copy of this License; and + (b) You must cause any modified files to carry prominent notices stating that You changed the files; and + (c) You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and + (d) If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License. + + You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License. + 5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions. + 6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file. + 7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License. + 8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages. + 9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability. + +END OF TERMS AND CONDITIONS + +APPENDIX: How to apply the Apache License to your work. + +To apply the Apache License to your work, attach the following boilerplate notice, with the fields enclosed by brackets "[]" replaced with your own identifying information. (Don't include the brackets!) The text should be enclosed in the appropriate comment syntax for the file format. We also recommend that a file or class name and description of purpose be included on the same "printed page" as the copyright notice for easier identification within third-party archives. + +Copyright [yyyy] [name of copyright owner] + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + +http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + +ISC License +----------- +Permission to use, copy, modify, and/or distribute this software for +any purpose with or without fee is hereby granted, provided that the +above copyright notice and this permission notice appear in all copies. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL +WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE +AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL +DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR +PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER +TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR +PERFORMANCE OF THIS SOFTWARE. + +MIT License +----------- +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +BSD 3-Clause License +-------------------- +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions +are met: + +1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + +2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + +3. Neither the name of the copyright holder nor the names of its + contributors may be used to endorse or promote products derived + from this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +MIT No Attribution (MIT-0) +-------------------------- +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +```` + +Used by: simple_asn1 0.6.4 + +````text +Copyright (c) 2017 Adam Wick + +Permission to use, copy, modify, and/or distribute this software for any purpose +with or without fee is hereby granted, provided that the above copyright notice +and this permission notice appear in all copies. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH +REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND +FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, +INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS +OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER +TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF +THIS SOFTWARE. + +```` + +Used by: libloading 0.8.9 + +````text +Copyright © 2015, Simonas Kazlauskas + +Permission to use, copy, modify, and/or distribute this software for any purpose with or without +fee is hereby granted, provided that the above copyright notice and this permission notice appear +in all copies. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS +SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE +AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, +NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF +THIS SOFTWARE. + +```` + +Used by: rustls-webpki 0.103.15 + +````text +Except as otherwise noted, this project is licensed under the following +(ISC-style) terms: + +Copyright 2015 Brian Smith. + +Permission to use, copy, modify, and/or distribute this software for any +purpose with or without fee is hereby granted, provided that the above +copyright notice and this permission notice appear in all copies. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHORS DISCLAIM ALL WARRANTIES +WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR +ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN +ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF +OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + +The files under third-party/chromium are licensed as described in +third-party/chromium/LICENSE. + +```` + +Used by: libopus_sys 0.3.3 + +````text +ISC License + +Copyright (c) 2019, Lakelezz + +Permission to use, copy, modify, and/or distribute this software for any +purpose with or without fee is hereby granted, provided that the above +copyright notice and this permission notice appear in all copies. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES +WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR +ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN +ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF +OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + +```` + +Standard text, used by: +- aws-lc-rs 1.18.1: AWS-LibCrypto (https://github.com/aws/aws-lc-rs) + +````text +ISC License: + +Copyright (c) 2004-2010 by Internet Systems Consortium, Inc. ("ISC") +Copyright (c) 1995-2003 by Internet Software Consortium + +Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted, provided that the above copyright notice and this permission notice appear in all copies. + +THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + +```` + +### LicenseRef-Slint-Royalty-free-2.0 + +Used by: i-slint-backend-android-activity 1.18.1, i-slint-backend-selector 1.18.1, i-slint-backend-winit 1.18.1, i-slint-common 1.18.1, i-slint-compiler 1.18.1, i-slint-core-macros 1.18.1, i-slint-core 1.18.1, i-slint-renderer-femtovg 1.18.1, i-slint-renderer-skia 1.18.1, i-slint-renderer-software 1.18.1, slint-macros 1.18.1, slint 1.18.1 + +````text +# Slint Royalty-free Desktop, Mobile, and Web Applications License + +Version 2.0 + +## Preamble + +Slint is a toolkit that can be used to build user interfaces for applications. Slint (hereafter referred to as **Software**) is made available under different licenses by SixtyFPS GmbH incorporated at Oranienburger Str. 44, 16540 Hohen Neuendorf, Germany (**SixtyFPS**). The **Slint Royalty-free Desktop, Mobile, and Web Applications License** is suitable for those who develop desktop, mobile, or web applications and do not want to use open source components under copyleft licenses. + +## 1. Grant of Rights + +SixtyFPS hereby grants You a world-wide, royalty-free, non-exclusive license to use, reproduce, make available, modify, display, perform, distribute the Software as part of a Desktop, Mobile, or Web Application. + +A **Desktop Application** is a computer program that is designed to run on a general-purpose computer (PC or notebook), typically installed and executed locally on the computer's operating system. + +A **Mobile Application** is a computer program that is designed to run on a general-purpose mobile computer (mobile phone or tablet), typically installed and executed locally on the computer's operating system. + +A **Web Application** is a computer program that is designed to run in the sandbox environment provided by a web browser. + +Desktop Application, Mobile Application, and Web Application are hereafter referred to as **Application**. + +## 2. License Conditions - Attribution + +You may distribute the Software as part of an Application, modified or unmodified, provided that You do either of the following: + +(a) Display the [`AboutSlint`](https://docs.slint.dev/latest/docs/slint/reference/std-widgets/misc/aboutslint/) widget in an "About" screen or dialog that is accessible from the top level menu of the Application. In the absence of such a screen or dialog, display the widget in the "Splash Screen" of the Application. + +(b) Display the [Slint attribution badge](https://github.com/slint-ui/slint/tree/master/logo/MadeWithSlint-logo-whitebg.png) on a public webpage, preferably where the binaries of your Application can be downloaded from, in such a way that it can be easily found by any visitor to that page. + +## 3. Limitations + +The License does not permit to distribute or make the Software publicly available alone and without integration into an Application. For this purpose you may use the Software under the GNU General Public License, version 3. + +The License does not permit the use of the Software within Embedded Systems. An **Embedded System** is a computer system designed to perform a specific task within a larger mechanical or electrical system. + +The License does not permit the distribution of Application that exposes the APIs, in part or in total, of the Software. + +You may not remove or alter any license notices (including copyright notices, disclaimers of warranty, or limitations of liability) contained within the source code form of the Software. + +## 4. Warranty and Liability + +SixtyFPS is only liable for conflicting rights of third parties if SixtyFPS was aware of these rights without informing you. Unless required by applicable law or agreed to in writing, SixtyFPS provides the Software on an "as is" basis, without warranties or conditions of any kind, either express or implied, including, without limitation, any warranties or conditions of merchantability, or fitness for a particular purpose. + +Unless required by law, SixtyFPS won't be liable for any direct, indirect, incidental, or consequential damages arising in any way out of the use of the Software. + +```` + +### MIT License + +Used by: uds_windows 1.2.1 + +````text + MIT License + + Copyright (c) Microsoft Corporation. All rights reserved. + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to deal + in the Software without restriction, including without limitation the rights + to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in all + copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + SOFTWARE + +```` + +Used by: atomic-waker 1.1.2, futures-lite 2.6.1 + +````text +=============================================================================== + +Copyright (c) 2016 Alex Crichton +Copyright (c) 2017 The Tokio Authors + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + +=============================================================================== + +Copyright (c) 2016 Alex Crichton +Copyright (c) 2017 The Tokio Authors + +Permission is hereby granted, free of charge, to any +person obtaining a copy of this software and associated +documentation files (the "Software"), to deal in the +Software without restriction, including without +limitation the rights to use, copy, modify, merge, +publish, distribute, sublicense, and/or sell copies of +the Software, and to permit persons to whom the Software +is furnished to do so, subject to the following +conditions: + +The above copyright notice and this permission notice +shall be included in all copies or substantial portions +of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF +ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED +TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A +PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT +SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR +IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +DEALINGS IN THE SOFTWARE. + +```` + +Used by: sha-1 0.10.1, sha1 0.10.7, sha2 0.10.9 + +````text +Copyright (c) 2006-2009 Graydon Hoare +Copyright (c) 2009-2013 Mozilla Foundation +Copyright (c) 2016 Artyom Pavlov + +Permission is hereby granted, free of charge, to any +person obtaining a copy of this software and associated +documentation files (the "Software"), to deal in the +Software without restriction, including without +limitation the rights to use, copy, modify, merge, +publish, distribute, sublicense, and/or sell copies of +the Software, and to permit persons to whom the Software +is furnished to do so, subject to the following +conditions: + +The above copyright notice and this permission notice +shall be included in all copies or substantial portions +of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF +ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED +TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A +PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT +SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR +IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +DEALINGS IN THE SOFTWARE. + +```` + +Used by: lazy_static 1.5.0, rayon-core 1.13.0, rayon 1.12.0 + +````text +Copyright (c) 2010 The Rust Project Developers + +Permission is hereby granted, free of charge, to any +person obtaining a copy of this software and associated +documentation files (the "Software"), to deal in the +Software without restriction, including without +limitation the rights to use, copy, modify, merge, +publish, distribute, sublicense, and/or sell copies of +the Software, and to permit persons to whom the Software +is furnished to do so, subject to the following +conditions: + +The above copyright notice and this permission notice +shall be included in all copies or substantial portions +of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF +ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED +TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A +PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT +SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR +IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +DEALINGS IN THE SOFTWARE. + +```` + +Used by: euclid 0.22.14 + +````text +Copyright (c) 2012-2013 Mozilla Foundation + +Permission is hereby granted, free of charge, to any +person obtaining a copy of this software and associated +documentation files (the "Software"), to deal in the +Software without restriction, including without +limitation the rights to use, copy, modify, merge, +publish, distribute, sublicense, and/or sell copies of +the Software, and to permit persons to whom the Software +is furnished to do so, subject to the following +conditions: + +The above copyright notice and this permission notice +shall be included in all copies or substantial portions +of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF +ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED +TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A +PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT +SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR +IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +DEALINGS IN THE SOFTWARE. + +```` + +Used by: hex 0.4.3 + +````text +Copyright (c) 2013-2014 The Rust Project Developers. +Copyright (c) 2015-2020 The rust-hex Developers + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. + +```` + +Used by: form_urlencoded 1.2.2 + +````text +Copyright (c) 2013-2016 The rust-url developers + +Permission is hereby granted, free of charge, to any +person obtaining a copy of this software and associated +documentation files (the "Software"), to deal in the +Software without restriction, including without +limitation the rights to use, copy, modify, merge, +publish, distribute, sublicense, and/or sell copies of +the Software, and to permit persons to whom the Software +is furnished to do so, subject to the following +conditions: + +The above copyright notice and this permission notice +shall be included in all copies or substantial portions +of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF +ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED +TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A +PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT +SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR +IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +DEALINGS IN THE SOFTWARE. + +```` + +Used by: data-url 0.3.2, idna 1.1.0, percent-encoding 2.3.2, url 2.5.8 + +````text +Copyright (c) 2013-2025 The rust-url developers + +Permission is hereby granted, free of charge, to any +person obtaining a copy of this software and associated +documentation files (the "Software"), to deal in the +Software without restriction, including without +limitation the rights to use, copy, modify, merge, +publish, distribute, sublicense, and/or sell copies of +the Software, and to permit persons to whom the Software +is furnished to do so, subject to the following +conditions: + +The above copyright notice and this permission notice +shall be included in all copies or substantial portions +of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF +ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED +TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A +PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT +SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR +IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +DEALINGS IN THE SOFTWARE. + +```` + +Used by: cfg-if 1.0.5, openssl-probe 0.2.1, scoped-tls 1.0.1, socket2 0.6.5 + +````text +Copyright (c) 2014 Alex Crichton + +Permission is hereby granted, free of charge, to any +person obtaining a copy of this software and associated +documentation files (the "Software"), to deal in the +Software without restriction, including without +limitation the rights to use, copy, modify, merge, +publish, distribute, sublicense, and/or sell copies of +the Software, and to permit persons to whom the Software +is furnished to do so, subject to the following +conditions: + +The above copyright notice and this permission notice +shall be included in all copies or substantial portions +of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF +ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED +TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A +PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT +SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR +IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +DEALINGS IN THE SOFTWARE. + +```` + +Used by: mio 1.2.3 + +````text +Copyright (c) 2014 Carl Lerche and other MIO contributors + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. + +```` + +Used by: errno 0.3.14 + +````text +Copyright (c) 2014 Chris Wong + +Permission is hereby granted, free of charge, to any +person obtaining a copy of this software and associated +documentation files (the "Software"), to deal in the +Software without restriction, including without +limitation the rights to use, copy, modify, merge, +publish, distribute, sublicense, and/or sell copies of +the Software, and to permit persons to whom the Software +is furnished to do so, subject to the following +conditions: + +The above copyright notice and this permission notice +shall be included in all copies or substantial portions +of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF +ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED +TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A +PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT +SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR +IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +DEALINGS IN THE SOFTWARE. + +```` + +Used by: primal-check 0.3.4 + +````text +Copyright (c) 2014 Huon Wilson + +Permission is hereby granted, free of charge, to any +person obtaining a copy of this software and associated +documentation files (the "Software"), to deal in the +Software without restriction, including without +limitation the rights to use, copy, modify, merge, +publish, distribute, sublicense, and/or sell copies of +the Software, and to permit persons to whom the Software +is furnished to do so, subject to the following +conditions: + +The above copyright notice and this permission notice +shall be included in all copies or substantial portions +of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF +ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED +TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A +PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT +SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR +IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +DEALINGS IN THE SOFTWARE. +```` + +Used by: mime 0.3.17 + +````text +Copyright (c) 2014 Sean McArthur + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. + + +```` + +Used by: base64ct 1.8.3 + +````text +Copyright (c) 2014 Steve "Sc00bz" Thomas (steve at tobtu dot com) +Copyright (c) 2021-2025 The RustCrypto Project Developers + +Permission is hereby granted, free of charge, to any +person obtaining a copy of this software and associated +documentation files (the "Software"), to deal in the +Software without restriction, including without +limitation the rights to use, copy, modify, merge, +publish, distribute, sublicense, and/or sell copies of +the Software, and to permit persons to whom the Software +is furnished to do so, subject to the following +conditions: + +The above copyright notice and this permission notice +shall be included in all copies or substantial portions +of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF +ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED +TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A +PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT +SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR +IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +DEALINGS IN THE SOFTWARE. + +```` + +Used by: base16ct 0.2.0 + +````text +Copyright (c) 2014 Steve "Sc00bz" Thomas (steve at tobtu dot com) +Copyright (c) 2022 The RustCrypto Project Developers + +Permission is hereby granted, free of charge, to any +person obtaining a copy of this software and associated +documentation files (the "Software"), to deal in the +Software without restriction, including without +limitation the rights to use, copy, modify, merge, +publish, distribute, sublicense, and/or sell copies of +the Software, and to permit persons to whom the Software +is furnished to do so, subject to the following +conditions: + +The above copyright notice and this permission notice +shall be included in all copies or substantial portions +of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF +ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED +TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A +PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT +SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR +IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +DEALINGS IN THE SOFTWARE. + +```` + +Used by: base16ct 1.0.0 + +````text +Copyright (c) 2014 Steve "Sc00bz" Thomas (steve at tobtu dot com) +Copyright (c) 2022-2025 The RustCrypto Project Developers + +Permission is hereby granted, free of charge, to any +person obtaining a copy of this software and associated +documentation files (the "Software"), to deal in the +Software without restriction, including without +limitation the rights to use, copy, modify, merge, +publish, distribute, sublicense, and/or sell copies of +the Software, and to permit persons to whom the Software +is furnished to do so, subject to the following +conditions: + +The above copyright notice and this permission notice +shall be included in all copies or substantial portions +of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF +ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED +TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A +PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT +SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR +IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +DEALINGS IN THE SOFTWARE. + +```` + +Used by: bitflags 2.13.2, log 0.4.34, num-bigint 0.4.8, num-bigint 0.5.1, num-complex 0.4.6, num-derive 0.4.2, num-integer 0.1.47, num-iter 0.1.46, num-rational 0.4.2, num-traits 0.2.19, num 0.4.3, regex-automata 0.4.18, regex-syntax 0.8.11, regex 1.13.1 + +````text +Copyright (c) 2014 The Rust Project Developers + +Permission is hereby granted, free of charge, to any +person obtaining a copy of this software and associated +documentation files (the "Software"), to deal in the +Software without restriction, including without +limitation the rights to use, copy, modify, merge, +publish, distribute, sublicense, and/or sell copies of +the Software, and to permit persons to whom the Software +is furnished to do so, subject to the following +conditions: + +The above copyright notice and this permission notice +shall be included in all copies or substantial portions +of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF +ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED +TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A +PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT +SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR +IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +DEALINGS IN THE SOFTWARE. + +```` + +Used by: uuid 1.26.1 + +````text +Copyright (c) 2014 The Rust Project Developers +Copyright (c) 2018 Ashley Mannix, Christopher Armstrong, Dylan DPC, Hunar Roop Kahlon + +Permission is hereby granted, free of charge, to any +person obtaining a copy of this software and associated +documentation files (the "Software"), to deal in the +Software without restriction, including without +limitation the rights to use, copy, modify, merge, +publish, distribute, sublicense, and/or sell copies of +the Software, and to permit persons to whom the Software +is furnished to do so, subject to the following +conditions: + +The above copyright notice and this permission notice +shall be included in all copies or substantial portions +of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF +ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED +TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A +PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT +SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR +IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +DEALINGS IN THE SOFTWARE. + +```` + +Used by: libsqlite3-sys 0.38.2, rusqlite 0.40.2 + +````text +Copyright (c) 2014 The rusqlite developers + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. + +```` + +Used by: nom 8.0.0 + +````text +Copyright (c) 2014-2019 Geoffroy Couprie + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +```` + +Used by: float-cmp 0.9.0 + +````text +Copyright (c) 2014-2020 Optimal Computing (NZ) Ltd + +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the "Software"), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies +of the Software, and to permit persons to whom the Software is furnished to do +so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +IN THE SOFTWARE. + +```` + +Used by: bzip2 0.6.1 + +````text +Copyright (c) 2014-2025 Alex Crichton and Contributors + +Permission is hereby granted, free of charge, to any +person obtaining a copy of this software and associated +documentation files (the "Software"), to deal in the +Software without restriction, including without +limitation the rights to use, copy, modify, merge, +publish, distribute, sublicense, and/or sell copies of +the Software, and to permit persons to whom the Software +is furnished to do so, subject to the following +conditions: + +The above copyright notice and this permission notice +shall be included in all copies or substantial portions +of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF +ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED +TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A +PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT +SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR +IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +DEALINGS IN THE SOFTWARE. + +```` + +Used by: flate2 1.1.10 + +````text +Copyright (c) 2014-2026 Alex Crichton + +Permission is hereby granted, free of charge, to any +person obtaining a copy of this software and associated +documentation files (the "Software"), to deal in the +Software without restriction, including without +limitation the rights to use, copy, modify, merge, +publish, distribute, sublicense, and/or sell copies of +the Software, and to permit persons to whom the Software +is furnished to do so, subject to the following +conditions: + +The above copyright notice and this permission notice +shall be included in all copies or substantial portions +of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF +ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED +TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A +PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT +SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR +IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +DEALINGS IN THE SOFTWARE. + +```` + +Used by: hyper 1.11.1 + +````text +Copyright (c) 2014-2026 Sean McArthur + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. + +```` + +Used by: unicase 2.9.0 + +````text +Copyright (c) 2014-2026 Sean McArthur + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. + + +```` + +Used by: either 1.18.0, itertools 0.14.0, itertools 0.15.0, petgraph 0.8.3 + +````text +Copyright (c) 2015 + +Permission is hereby granted, free of charge, to any +person obtaining a copy of this software and associated +documentation files (the "Software"), to deal in the +Software without restriction, including without +limitation the rights to use, copy, modify, merge, +publish, distribute, sublicense, and/or sell copies of +the Software, and to permit persons to whom the Software +is furnished to do so, subject to the following +conditions: + +The above copyright notice and this permission notice +shall be included in all copies or substantial portions +of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF +ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED +TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A +PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT +SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR +IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +DEALINGS IN THE SOFTWARE. + +```` + +Used by: wayland-backend 0.3.17, wayland-client 0.31.15, wayland-cursor 0.31.14, wayland-protocols-plasma 0.3.12, wayland-protocols-wlr 0.3.12, wayland-protocols 0.32.13, wayland-scanner 0.31.11, wayland-sys 0.31.11 + +````text +Copyright (c) 2015 Elinor Berger + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. + +```` + +Used by: tempfile 3.27.0 + +````text +Copyright (c) 2015 Steven Allen + +Permission is hereby granted, free of charge, to any +person obtaining a copy of this software and associated +documentation files (the "Software"), to deal in the +Software without restriction, including without +limitation the rights to use, copy, modify, merge, +publish, distribute, sublicense, and/or sell copies of +the Software, and to permit persons to whom the Software +is furnished to do so, subject to the following +conditions: + +The above copyright notice and this permission notice +shall be included in all copies or substantial portions +of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF +ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED +TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A +PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT +SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR +IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +DEALINGS IN THE SOFTWARE. + +```` + +Used by: hickory-net 0.26.3, hickory-proto 0.26.3, hickory-resolver 0.26.3 + +````text +Copyright (c) 2015 The Hickory DNS Developers +Copyright (c) 2017 Google LLC. + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. + +```` + +Used by: bit-vec 0.6.3, heck 0.5.0, unicode-bidi 0.3.18, unicode-segmentation 1.13.3, unicode-width 0.2.2, unicode-xid 0.2.6 + +````text +Copyright (c) 2015 The Rust Project Developers + +Permission is hereby granted, free of charge, to any +person obtaining a copy of this software and associated +documentation files (the "Software"), to deal in the +Software without restriction, including without +limitation the rights to use, copy, modify, merge, +publish, distribute, sublicense, and/or sell copies of +the Software, and to permit persons to whom the Software +is furnished to do so, subject to the following +conditions: + +The above copyright notice and this permission notice +shall be included in all copies or substantial portions +of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF +ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED +TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A +PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT +SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR +IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +DEALINGS IN THE SOFTWARE. + +```` + +Used by: rustfft 6.4.1, strength_reduce 0.2.4 + +````text +Copyright (c) 2015 The RustFFT Developers + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. + +```` + +Used by: quick-error 2.0.1 + +````text +Copyright (c) 2015 The quick-error Developers + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. + +```` + +Used by: jni-sys 0.3.1, jni-sys 0.4.1 + +````text +Copyright (c) 2015 The rust-jni-sys Developers + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. + +```` + +Used by: fallible-iterator 0.3.0 + +````text +Copyright (c) 2015 The rust-openssl-verify Developers + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. + +```` + +Used by: dlib 0.5.3 + +````text +Copyright (c) 2015 Victor Berger + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. +```` + +Used by: png 0.18.1 + +````text +Copyright (c) 2015 nwin + +Permission is hereby granted, free of charge, to any +person obtaining a copy of this software and associated +documentation files (the "Software"), to deal in the +Software without restriction, including without +limitation the rights to use, copy, modify, merge, +publish, distribute, sublicense, and/or sell copies of +the Software, and to permit persons to whom the Software +is furnished to do so, subject to the following +conditions: + +The above copyright notice and this permission notice +shall be included in all copies or substantial portions +of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF +ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED +TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A +PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT +SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR +IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +DEALINGS IN THE SOFTWARE. + +```` + +Used by: schannel 0.1.29 + +````text +Copyright (c) 2015 steffengy + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +```` + +Used by: resolv-conf 0.7.6 + +````text +Copyright (c) 2015-2016 The resolv-conf Developers + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. + +```` + +Used by: fixedbitset 0.5.7 + +````text +Copyright (c) 2015-2017 + +Permission is hereby granted, free of charge, to any +person obtaining a copy of this software and associated +documentation files (the "Software"), to deal in the +Software without restriction, including without +limitation the rights to use, copy, modify, merge, +publish, distribute, sublicense, and/or sell copies of +the Software, and to permit persons to whom the Software +is furnished to do so, subject to the following +conditions: + +The above copyright notice and this permission notice +shall be included in all copies or substantial portions +of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF +ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED +TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A +PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT +SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR +IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +DEALINGS IN THE SOFTWARE. + +```` + +Used by: hkdf 0.12.4, hkdf 0.13.0 + +````text +Copyright (c) 2015-2018 Vlad Filippov +Copyright (c) 2018-2021 RustCrypto Developers + +Permission is hereby granted, free of charge, to any +person obtaining a copy of this software and associated +documentation files (the "Software"), to deal in the +Software without restriction, including without +limitation the rights to use, copy, modify, merge, +publish, distribute, sublicense, and/or sell copies of +the Software, and to permit persons to whom the Software +is furnished to do so, subject to the following +conditions: + +The above copyright notice and this permission notice +shall be included in all copies or substantial portions +of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF +ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED +TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A +PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT +SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR +IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +DEALINGS IN THE SOFTWARE. + +```` + +Used by: httparse 1.10.1 + +````text +Copyright (c) 2015-2025 Sean McArthur + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. + + +```` + +Used by: poly1305 0.9.1 + +````text +Copyright (c) 2015-2026 The RustCrypto Project Developers + +Permission is hereby granted, free of charge, to any +person obtaining a copy of this software and associated +documentation files (the "Software"), to deal in the +Software without restriction, including without +limitation the rights to use, copy, modify, merge, +publish, distribute, sublicense, and/or sell copies of +the Software, and to permit persons to whom the Software +is furnished to do so, subject to the following +conditions: + +The above copyright notice and this permission notice +shall be included in all copies or substantial portions +of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF +ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED +TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A +PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT +SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR +IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +DEALINGS IN THE SOFTWARE. + +```` + +Used by: futures-channel 0.3.34, futures-core 0.3.34, futures-executor 0.3.34, futures-io 0.3.34, futures-macro 0.3.34, futures-sink 0.3.34, futures-task 0.3.34, futures-util 0.3.34, futures 0.3.34 + +````text +Copyright (c) 2016 Alex Crichton +Copyright (c) 2017 The Tokio Authors + +Permission is hereby granted, free of charge, to any +person obtaining a copy of this software and associated +documentation files (the "Software"), to deal in the +Software without restriction, including without +limitation the rights to use, copy, modify, merge, +publish, distribute, sublicense, and/or sell copies of +the Software, and to permit persons to whom the Software +is furnished to do so, subject to the following +conditions: + +The above copyright notice and this permission notice +shall be included in all copies or substantial portions +of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF +ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED +TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A +PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT +SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR +IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +DEALINGS IN THE SOFTWARE. + +```` + +Used by: hashbrown 0.14.5, hashbrown 0.15.5, hashbrown 0.16.1, hashbrown 0.17.1 + +````text +Copyright (c) 2016 Amanieu d'Antras + +Permission is hereby granted, free of charge, to any +person obtaining a copy of this software and associated +documentation files (the "Software"), to deal in the +Software without restriction, including without +limitation the rights to use, copy, modify, merge, +publish, distribute, sublicense, and/or sell copies of +the Software, and to permit persons to whom the Software +is furnished to do so, subject to the following +conditions: + +The above copyright notice and this permission notice +shall be included in all copies or substantial portions +of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF +ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED +TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A +PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT +SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR +IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +DEALINGS IN THE SOFTWARE. + +```` + +Used by: serde_urlencoded 0.7.1 + +````text +Copyright (c) 2016 Anthony Ramine + +Permission is hereby granted, free of charge, to any +person obtaining a copy of this software and associated +documentation files (the "Software"), to deal in the +Software without restriction, including without +limitation the rights to use, copy, modify, merge, +publish, distribute, sublicense, and/or sell copies of +the Software, and to permit persons to whom the Software +is furnished to do so, subject to the following +conditions: + +The above copyright notice and this permission notice +shall be included in all copies or substantial portions +of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF +ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED +TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A +PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT +SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR +IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +DEALINGS IN THE SOFTWARE. + +```` + +Used by: utf8parse 0.2.2 + +````text +Copyright (c) 2016 Joe Wilm + +Permission is hereby granted, free of charge, to any +person obtaining a copy of this software and associated +documentation files (the "Software"), to deal in the +Software without restriction, including without +limitation the rights to use, copy, modify, merge, +publish, distribute, sublicense, and/or sell copies of +the Software, and to permit persons to whom the Software +is furnished to do so, subject to the following +conditions: + +The above copyright notice and this permission notice +shall be included in all copies or substantial portions +of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF +ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED +TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A +PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT +SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR +IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +DEALINGS IN THE SOFTWARE. + +```` + +Used by: hyper-rustls 0.27.10, rustls-native-certs 0.8.4, rustls 0.23.45 + +````text +Copyright (c) 2016 Joseph Birr-Pixton + +Permission is hereby granted, free of charge, to any +person obtaining a copy of this software and associated +documentation files (the "Software"), to deal in the +Software without restriction, including without +limitation the rights to use, copy, modify, merge, +publish, distribute, sublicense, and/or sell copies of +the Software, and to permit persons to whom the Software +is furnished to do so, subject to the following +conditions: + +The above copyright notice and this permission notice +shall be included in all copies or substantial portions +of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF +ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED +TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A +PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT +SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR +IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +DEALINGS IN THE SOFTWARE. + +```` + +Used by: yasna 0.6.0 + +````text +Copyright (c) 2016 Masaki Hara + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +```` + +Used by: httpdate 1.0.3 + +````text +Copyright (c) 2016 Pyfisch + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. + +```` + +Used by: opus2 0.4.0 + +````text +Copyright (c) 2016 Tad Hardesty + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. + +```` + +Used by: lock_api 0.4.14, parking_lot 0.12.5, parking_lot_core 0.9.12, thread_local 1.1.10 + +````text +Copyright (c) 2016 The Rust Project Developers + +Permission is hereby granted, free of charge, to any +person obtaining a copy of this software and associated +documentation files (the "Software"), to deal in the +Software without restriction, including without +limitation the rights to use, copy, modify, merge, +publish, distribute, sublicense, and/or sell copies of +the Software, and to permit persons to whom the Software +is furnished to do so, subject to the following +conditions: + +The above copyright notice and this permission notice +shall be included in all copies or substantial portions +of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF +ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED +TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A +PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT +SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR +IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +DEALINGS IN THE SOFTWARE. + +```` + +Used by: fallible-streaming-iterator 0.1.9 + +````text +Copyright (c) 2016 The fallible-streaming-iterator Developers + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. + +```` + +Used by: keyring-core 1.0.0, keyring 4.2.0, zbus-secret-service-keyring-store 1.0.1 + +````text +Copyright (c) 2016 keyring Developers + +Permission is hereby granted, free of charge, to any +person obtaining a copy of this software and associated +documentation files (the "Software"), to deal in the +Software without restriction, including without +limitation the rights to use, copy, modify, merge, +publish, distribute, sublicense, and/or sell copies of +the Software, and to permit persons to whom the Software +is furnished to do so, subject to the following +conditions: + +The above copyright notice and this permission notice +shall be included in all copies or substantial portions +of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF +ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED +TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A +PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT +SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR +IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +DEALINGS IN THE SOFTWARE. + +```` + +Used by: windows-native-keyring-store 1.1.0 + +````text +Copyright (c) 2016 keyring Developers + +Permission is hereby granted, free of charge, to any +person obtaining a copy of this software and associated +documentation files (the "Software"), to deal in the +Software without restriction, including without +limitation the rights to use, copy, modify, merge, +publish, distribute, sublicense, and/or sell copies of +the Software, and to permit persons to whom the Software +is furnished to do so, subject to the following +conditions: + +The above copyright notice and this permission notice +shall be included in all copies or substantial portions +of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF +ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED +TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A +PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT +SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR +IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +DEALINGS IN THE SOFTWARE. + +```` + +Used by: indexmap 2.14.2 + +````text +Copyright (c) 2016--2017 + +Permission is hereby granted, free of charge, to any +person obtaining a copy of this software and associated +documentation files (the "Software"), to deal in the +Software without restriction, including without +limitation the rights to use, copy, modify, merge, +publish, distribute, sublicense, and/or sell copies of +the Software, and to permit persons to whom the Software +is furnished to do so, subject to the following +conditions: + +The above copyright notice and this permission notice +shall be included in all copies or substantial portions +of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF +ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED +TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A +PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT +SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR +IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +DEALINGS IN THE SOFTWARE. + +```` + +Used by: equivalent 1.0.2 + +````text +Copyright (c) 2016--2023 + +Permission is hereby granted, free of charge, to any +person obtaining a copy of this software and associated +documentation files (the "Software"), to deal in the +Software without restriction, including without +limitation the rights to use, copy, modify, merge, +publish, distribute, sublicense, and/or sell copies of +the Software, and to permit persons to whom the Software +is furnished to do so, subject to the following +conditions: + +The above copyright notice and this permission notice +shall be included in all copies or substantial portions +of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF +ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED +TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A +PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT +SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR +IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +DEALINGS IN THE SOFTWARE. + +```` + +Used by: scopeguard 1.2.0 + +````text +Copyright (c) 2016-2019 Ulrik Sverdrup "bluss" and scopeguard developers + +Permission is hereby granted, free of charge, to any +person obtaining a copy of this software and associated +documentation files (the "Software"), to deal in the +Software without restriction, including without +limitation the rights to use, copy, modify, merge, +publish, distribute, sublicense, and/or sell copies of +the Software, and to permit persons to whom the Software +is furnished to do so, subject to the following +conditions: + +The above copyright notice and this permission notice +shall be included in all copies or substantial portions +of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF +ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED +TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A +PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT +SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR +IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +DEALINGS IN THE SOFTWARE. + +```` + +Used by: cipher 0.4.4 + +````text +Copyright (c) 2016-2020 RustCrypto Developers + +Permission is hereby granted, free of charge, to any +person obtaining a copy of this software and associated +documentation files (the "Software"), to deal in the +Software without restriction, including without +limitation the rights to use, copy, modify, merge, +publish, distribute, sublicense, and/or sell copies of +the Software, and to permit persons to whom the Software +is furnished to do so, subject to the following +conditions: + +The above copyright notice and this permission notice +shall be included in all copies or substantial portions +of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF +ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED +TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A +PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT +SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR +IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +DEALINGS IN THE SOFTWARE. + +```` + +Used by: blowfish 0.10.0 + +````text +Copyright (c) 2016-2024 The RustCrypto Project Developers + +Permission is hereby granted, free of charge, to any +person obtaining a copy of this software and associated +documentation files (the "Software"), to deal in the +Software without restriction, including without +limitation the rights to use, copy, modify, merge, +publish, distribute, sublicense, and/or sell copies of +the Software, and to permit persons to whom the Software +is furnished to do so, subject to the following +conditions: + +The above copyright notice and this permission notice +shall be included in all copies or substantial portions +of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF +ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED +TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A +PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT +SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR +IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +DEALINGS IN THE SOFTWARE. + +```` + +Used by: cipher 0.5.2 + +````text +Copyright (c) 2016-2025 RustCrypto Developers + +Permission is hereby granted, free of charge, to any +person obtaining a copy of this software and associated +documentation files (the "Software"), to deal in the +Software without restriction, including without +limitation the rights to use, copy, modify, merge, +publish, distribute, sublicense, and/or sell copies of +the Software, and to permit persons to whom the Software +is furnished to do so, subject to the following +conditions: + +The above copyright notice and this permission notice +shall be included in all copies or substantial portions +of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF +ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED +TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A +PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT +SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR +IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +DEALINGS IN THE SOFTWARE. + +```` + +Used by: reqwest 0.13.5 + +````text +Copyright (c) 2016-2026 Sean McArthur + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. + + +```` + +Used by: sha1 0.11.0, sha2 0.11.0 + +````text +Copyright (c) 2016-2026 The RustCrypto Project Developers +Copyright (c) 2016 Artyom Pavlov +Copyright (c) 2009-2013 Mozilla Foundation +Copyright (c) 2006-2009 Graydon Hoare + +Permission is hereby granted, free of charge, to any +person obtaining a copy of this software and associated +documentation files (the "Software"), to deal in the +Software without restriction, including without +limitation the rights to use, copy, modify, merge, +publish, distribute, sublicense, and/or sell copies of +the Software, and to permit persons to whom the Software +is furnished to do so, subject to the following +conditions: + +The above copyright notice and this permission notice +shall be included in all copies or substantial portions +of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF +ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED +TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A +PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT +SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR +IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +DEALINGS IN THE SOFTWARE. + +```` + +Used by: tungstenite 0.29.0, tungstenite 0.30.0 + +````text +Copyright (c) 2017 Alexey Galakhov +Copyright (c) 2016 Jason Housley + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. + +```` + +Used by: cmac 0.7.2, digest 0.10.7, hmac 0.12.1, hmac 0.13.0 + +````text +Copyright (c) 2017 Artyom Pavlov + +Permission is hereby granted, free of charge, to any +person obtaining a copy of this software and associated +documentation files (the "Software"), to deal in the +Software without restriction, including without +limitation the rights to use, copy, modify, merge, +publish, distribute, sublicense, and/or sell copies of +the Software, and to permit persons to whom the Software +is furnished to do so, subject to the following +conditions: + +The above copyright notice and this permission notice +shall be included in all copies or substantial portions +of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF +ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED +TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A +PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT +SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR +IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +DEALINGS IN THE SOFTWARE. + +```` + +Used by: pbkdf2 0.13.0 + +````text +Copyright (c) 2017 Artyom Pavlov +Copyright (c) 2018-2023 The RustCrypto Project Developers + +Permission is hereby granted, free of charge, to any +person obtaining a copy of this software and associated +documentation files (the "Software"), to deal in the +Software without restriction, including without +limitation the rights to use, copy, modify, merge, +publish, distribute, sublicense, and/or sell copies of +the Software, and to permit persons to whom the Software +is furnished to do so, subject to the following +conditions: + +The above copyright notice and this permission notice +shall be included in all copies or substantial portions +of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF +ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED +TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A +PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT +SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR +IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +DEALINGS IN THE SOFTWARE. + +```` + +Used by: fnv 1.0.7 + +````text +Copyright (c) 2017 Contributors + +Permission is hereby granted, free of charge, to any +person obtaining a copy of this software and associated +documentation files (the "Software"), to deal in the +Software without restriction, including without +limitation the rights to use, copy, modify, merge, +publish, distribute, sublicense, and/or sell copies of +the Software, and to permit persons to whom the Software +is furnished to do so, subject to the following +conditions: + +The above copyright notice and this permission notice +shall be included in all copies or substantial portions +of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF +ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED +TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A +PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT +SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR +IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +DEALINGS IN THE SOFTWARE. + +```` + +Used by: tokio-tungstenite 0.29.0, tokio-tungstenite 0.30.0 + +````text +Copyright (c) 2017 Daniel Abramov +Copyright (c) 2017 Alexey Galakhov + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. + +```` + +Used by: memoffset 0.9.1 + +````text +Copyright (c) 2017 Gilad Naaman + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. +```` + +Used by: ipconfig 0.3.4 + +````text +Copyright (c) 2017 Liran Ringel + +Permission is hereby granted, free of charge, to any +person obtaining a copy of this software and associated +documentation files (the "Software"), to deal in the +Software without restriction, including without +limitation the rights to use, copy, modify, merge, +publish, distribute, sublicense, and/or sell copies of +the Software, and to permit persons to whom the Software +is furnished to do so, subject to the following +conditions: + +The above copyright notice and this permission notice +shall be included in all copies or substantial portions +of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF +ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED +TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A +PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT +SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR +IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +DEALINGS IN THE SOFTWARE. + +```` + +Used by: enumflags2_derive 0.7.12 + +````text +Copyright (c) 2017 Maik Klein + +Permission is hereby granted, free of charge, to any +person obtaining a copy of this software and associated +documentation files (the "Software"), to deal in the +Software without restriction, including without +limitation the rights to use, copy, modify, merge, +publish, distribute, sublicense, and/or sell copies of +the Software, and to permit persons to whom the Software +is furnished to do so, subject to the following +conditions: + +The above copyright notice and this permission notice +shall be included in all copies or substantial portions +of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF +ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED +TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A +PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT +SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR +IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +DEALINGS IN THE SOFTWARE. + +```` + +Used by: by_address 1.2.1 + +````text +Copyright (c) 2017 Matt Brubeck + +Permission is hereby granted, free of charge, to any +person obtaining a copy of this software and associated +documentation files (the "Software"), to deal in the +Software without restriction, including without +limitation the rights to use, copy, modify, merge, +publish, distribute, sublicense, and/or sell copies of +the Software, and to permit persons to whom the Software +is furnished to do so, subject to the following +conditions: + +The above copyright notice and this permission notice +shall be included in all copies or substantial portions +of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF +ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED +TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A +PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT +SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR +IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +DEALINGS IN THE SOFTWARE. + +```` + +Used by: keyboard-types 0.7.0 + +````text +Copyright (c) 2017 Pyfisch + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. +```` + +Used by: stable_deref_trait 1.2.1 + +````text +Copyright (c) 2017 Robert Grosse + +Permission is hereby granted, free of charge, to any +person obtaining a copy of this software and associated +documentation files (the "Software"), to deal in the +Software without restriction, including without +limitation the rights to use, copy, modify, merge, +publish, distribute, sublicense, and/or sell copies of +the Software, and to permit persons to whom the Software +is furnished to do so, subject to the following +conditions: + +The above copyright notice and this permission notice +shall be included in all copies or substantial portions +of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF +ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED +TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A +PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT +SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR +IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +DEALINGS IN THE SOFTWARE. +```` + +Used by: h2 0.4.19 + +````text +Copyright (c) 2017 h2 authors + +Permission is hereby granted, free of charge, to any +person obtaining a copy of this software and associated +documentation files (the "Software"), to deal in the +Software without restriction, including without +limitation the rights to use, copy, modify, merge, +publish, distribute, sublicense, and/or sell copies of +the Software, and to permit persons to whom the Software +is furnished to do so, subject to the following +conditions: + +The above copyright notice and this permission notice +shall be included in all copies or substantial portions +of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF +ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED +TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A +PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT +SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR +IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +DEALINGS IN THE SOFTWARE. + +```` + +Used by: http 1.5.0 + +````text +Copyright (c) 2017 http-rs authors + +Permission is hereby granted, free of charge, to any +person obtaining a copy of this software and associated +documentation files (the "Software"), to deal in the +Software without restriction, including without +limitation the rights to use, copy, modify, merge, +publish, distribute, sublicense, and/or sell copies of +the Software, and to permit persons to whom the Software +is furnished to do so, subject to the following +conditions: + +The above copyright notice and this permission notice +shall be included in all copies or substantial portions +of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF +ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED +TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A +PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT +SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR +IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +DEALINGS IN THE SOFTWARE. + +```` + +Used by: tokio-rustls 0.26.5 + +````text +Copyright (c) 2017 quininer kel + +Permission is hereby granted, free of charge, to any +person obtaining a copy of this software and associated +documentation files (the "Software"), to deal in the +Software without restriction, including without +limitation the rights to use, copy, modify, merge, +publish, distribute, sublicense, and/or sell copies of +the Software, and to permit persons to whom the Software +is furnished to do so, subject to the following +conditions: + +The above copyright notice and this permission notice +shall be included in all copies or substantial portions +of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF +ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED +TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A +PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT +SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR +IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +DEALINGS IN THE SOFTWARE. + +```` + +Used by: signal-hook-registry 1.4.8 + +````text +Copyright (c) 2017 tokio-jsonrpc developers + +Permission is hereby granted, free of charge, to any +person obtaining a copy of this software and associated +documentation files (the "Software"), to deal in the +Software without restriction, including without +limitation the rights to use, copy, modify, merge, +publish, distribute, sublicense, and/or sell copies of +the Software, and to permit persons to whom the Software +is furnished to do so, subject to the following +conditions: + +The above copyright notice and this permission notice +shall be included in all copies or substantial portions +of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF +ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED +TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A +PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT +SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR +IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +DEALINGS IN THE SOFTWARE. + +```` + +Used by: core_detect 1.0.0 + +````text +Copyright (c) 2017-2020 The Rust Project Developers + +Permission is hereby granted, free of charge, to any +person obtaining a copy of this software and associated +documentation files (the "Software"), to deal in the +Software without restriction, including without +limitation the rights to use, copy, modify, merge, +publish, distribute, sublicense, and/or sell copies of +the Software, and to permit persons to whom the Software +is furnished to do so, subject to the following +conditions: + +The above copyright notice and this permission notice +shall be included in all copies or substantial portions +of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF +ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED +TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A +PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT +SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR +IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +DEALINGS IN THE SOFTWARE. + +```` + +Used by: enumflags2 0.7.12 + +````text +Copyright (c) 2017-2023 Maik Klein, Maja Kądziołka + +Permission is hereby granted, free of charge, to any +person obtaining a copy of this software and associated +documentation files (the "Software"), to deal in the +Software without restriction, including without +limitation the rights to use, copy, modify, merge, +publish, distribute, sublicense, and/or sell copies of +the Software, and to permit persons to whom the Software +is furnished to do so, subject to the following +conditions: + +The above copyright notice and this permission notice +shall be included in all copies or substantial portions +of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF +ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED +TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A +PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT +SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR +IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +DEALINGS IN THE SOFTWARE. + +```` + +Used by: digest 0.11.3 + +````text +Copyright (c) 2017-2025 RustCrypto Developers +Copyright (c) 2017 Artyom Pavlov + +Permission is hereby granted, free of charge, to any +person obtaining a copy of this software and associated +documentation files (the "Software"), to deal in the +Software without restriction, including without +limitation the rights to use, copy, modify, merge, +publish, distribute, sublicense, and/or sell copies of +the Software, and to permit persons to whom the Software +is furnished to do so, subject to the following +conditions: + +The above copyright notice and this permission notice +shall be included in all copies or substantial portions +of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF +ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED +TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A +PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT +SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR +IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +DEALINGS IN THE SOFTWARE. + +```` + +Used by: blake2 0.11.0 + +````text +Copyright (c) 2017-2026 The RustCrypto Project Developers +Copyright (c) 2017 Artyom Pavlov +Copyright (c) 2015-2016 The blake2-rfc Developers, Cesar Barros + +Permission is hereby granted, free of charge, to any +person obtaining a copy of this software and associated +documentation files (the "Software"), to deal in the +Software without restriction, including without +limitation the rights to use, copy, modify, merge, +publish, distribute, sublicense, and/or sell copies of +the Software, and to permit persons to whom the Software +is furnished to do so, subject to the following +conditions: + +The above copyright notice and this permission notice +shall be included in all copies or substantial portions +of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF +ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED +TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A +PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT +SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR +IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +DEALINGS IN THE SOFTWARE. + +```` + +Used by: aes 0.8.4 + +````text +Copyright (c) 2018 Artyom Pavlov + +Permission is hereby granted, free of charge, to any +person obtaining a copy of this software and associated +documentation files (the "Software"), to deal in the +Software without restriction, including without +limitation the rights to use, copy, modify, merge, +publish, distribute, sublicense, and/or sell copies of +the Software, and to permit persons to whom the Software +is furnished to do so, subject to the following +conditions: + +The above copyright notice and this permission notice +shall be included in all copies or substantial portions +of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF +ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED +TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A +PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT +SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR +IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +DEALINGS IN THE SOFTWARE. + +```` + +Used by: bytes 1.12.1 + +````text +Copyright (c) 2018 Carl Lerche + +Permission is hereby granted, free of charge, to any +person obtaining a copy of this software and associated +documentation files (the "Software"), to deal in the +Software without restriction, including without +limitation the rights to use, copy, modify, merge, +publish, distribute, sublicense, and/or sell copies of +the Software, and to permit persons to whom the Software +is furnished to do so, subject to the following +conditions: + +The above copyright notice and this permission notice +shall be included in all copies or substantial portions +of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF +ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED +TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A +PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT +SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR +IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +DEALINGS IN THE SOFTWARE. + +```` + +Used by: kurbo 0.13.1, polycool 0.4.0 + +````text +Copyright (c) 2018 Raph Levien + +Permission is hereby granted, free of charge, to any +person obtaining a copy of this software and associated +documentation files (the "Software"), to deal in the +Software without restriction, including without +limitation the rights to use, copy, modify, merge, +publish, distribute, sublicense, and/or sell copies of +the Software, and to permit persons to whom the Software +is furnished to do so, subject to the following +conditions: + +The above copyright notice and this permission notice +shall be included in all copies or substantial portions +of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF +ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED +TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A +PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT +SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR +IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +DEALINGS IN THE SOFTWARE. + +```` + +Used by: smallvec 1.16.2 + +````text +Copyright (c) 2018 The Servo Project Developers + +Permission is hereby granted, free of charge, to any +person obtaining a copy of this software and associated +documentation files (the "Software"), to deal in the +Software without restriction, including without +limitation the rights to use, copy, modify, merge, +publish, distribute, sublicense, and/or sell copies of +the Software, and to permit persons to whom the Software +is furnished to do so, subject to the following +conditions: + +The above copyright notice and this permission notice +shall be included in all copies or substantial portions +of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF +ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED +TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A +PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT +SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR +IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +DEALINGS IN THE SOFTWARE. + +```` + +Used by: pin-utils 0.1.0 + +````text +Copyright (c) 2018 The pin-utils authors + +Permission is hereby granted, free of charge, to any +person obtaining a copy of this software and associated +documentation files (the "Software"), to deal in the +Software without restriction, including without +limitation the rights to use, copy, modify, merge, +publish, distribute, sublicense, and/or sell copies of +the Software, and to permit persons to whom the Software +is furnished to do so, subject to the following +conditions: + +The above copyright notice and this permission notice +shall be included in all copies or substantial portions +of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF +ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED +TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A +PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT +SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR +IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +DEALINGS IN THE SOFTWARE. + +```` + +Used by: ahash 0.8.12 + +````text +Copyright (c) 2018 Tom Kaitchuck + +Permission is hereby granted, free of charge, to any +person obtaining a copy of this software and associated +documentation files (the "Software"), to deal in the +Software without restriction, including without +limitation the rights to use, copy, modify, merge, +publish, distribute, sublicense, and/or sell copies of +the Software, and to permit persons to whom the Software +is furnished to do so, subject to the following +conditions: + +The above copyright notice and this permission notice +shall be included in all copies or substantial portions +of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF +ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED +TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A +PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT +SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR +IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +DEALINGS IN THE SOFTWARE. + +```` + +Used by: smithay-client-toolkit 0.19.2 + +````text +Copyright (c) 2018 Victor Berger + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. +```` + +Used by: calloop 0.13.0 + +````text +Copyright (c) 2018 Victor Berger + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. + +```` + +Used by: svgtypes 0.16.1, ttf-parser 0.25.1 + +````text +Copyright (c) 2018 Yevhenii Reizner + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. + + +```` + +Used by: want 0.3.1 + +````text +Copyright (c) 2018-2019 Sean McArthur + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. + + +```` + +Used by: block-buffer 0.10.4, dbl 0.3.2 + +````text +Copyright (c) 2018-2019 The RustCrypto Project Developers + +Permission is hereby granted, free of charge, to any +person obtaining a copy of this software and associated +documentation files (the "Software"), to deal in the +Software without restriction, including without +limitation the rights to use, copy, modify, merge, +publish, distribute, sublicense, and/or sell copies of +the Software, and to permit persons to whom the Software +is furnished to do so, subject to the following +conditions: + +The above copyright notice and this permission notice +shall be included in all copies or substantial portions +of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF +ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED +TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A +PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT +SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR +IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +DEALINGS IN THE SOFTWARE. + +```` + +Used by: dirs-sys 0.5.0, dirs 6.0.0 + +````text +Copyright (c) 2018-2019 dirs-rs contributors + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. + +```` + +Used by: ecdsa 0.16.9, rfc6979 0.4.0 + +````text +Copyright (c) 2018-2022 RustCrypto Developers + +Permission is hereby granted, free of charge, to any +person obtaining a copy of this software and associated +documentation files (the "Software"), to deal in the +Software without restriction, including without +limitation the rights to use, copy, modify, merge, +publish, distribute, sublicense, and/or sell copies of +the Software, and to permit persons to whom the Software +is furnished to do so, subject to the following +conditions: + +The above copyright notice and this permission notice +shall be included in all copies or substantial portions +of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF +ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED +TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A +PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT +SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR +IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +DEALINGS IN THE SOFTWARE. + +```` + +Used by: cbc 0.2.1, ctr 0.10.1, ctr 0.9.2 + +````text +Copyright (c) 2018-2022 RustCrypto Developers +Copyright (c) 2018 Artyom Pavlov + +Permission is hereby granted, free of charge, to any +person obtaining a copy of this software and associated +documentation files (the "Software"), to deal in the +Software without restriction, including without +limitation the rights to use, copy, modify, merge, +publish, distribute, sublicense, and/or sell copies of +the Software, and to permit persons to whom the Software +is furnished to do so, subject to the following +conditions: + +The above copyright notice and this permission notice +shall be included in all copies or substantial portions +of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF +ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED +TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A +PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT +SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR +IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +DEALINGS IN THE SOFTWARE. + +```` + +Used by: signature 2.2.0 + +````text +Copyright (c) 2018-2023 RustCrypto Developers + +Permission is hereby granted, free of charge, to any +person obtaining a copy of this software and associated +documentation files (the "Software"), to deal in the +Software without restriction, including without +limitation the rights to use, copy, modify, merge, +publish, distribute, sublicense, and/or sell copies of +the Software, and to permit persons to whom the Software +is furnished to do so, subject to the following +conditions: + +The above copyright notice and this permission notice +shall be included in all copies or substantial portions +of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF +ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED +TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A +PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT +SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR +IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +DEALINGS IN THE SOFTWARE. + +```` + +Used by: try-lock 0.2.5 + +````text +Copyright (c) 2018-2023 Sean McArthur +Copyright (c) 2016 Alex Crichton + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. + + +```` + +Used by: aes 0.9.3 + +````text +Copyright (c) 2018-2024 The RustCrypto Project Developers +Copyright (c) 2018 Artyom Pavlov + +Permission is hereby granted, free of charge, to any +person obtaining a copy of this software and associated +documentation files (the "Software"), to deal in the +Software without restriction, including without +limitation the rights to use, copy, modify, merge, +publish, distribute, sublicense, and/or sell copies of +the Software, and to permit persons to whom the Software +is furnished to do so, subject to the following +conditions: + +The above copyright notice and this permission notice +shall be included in all copies or substantial portions +of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF +ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED +TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A +PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT +SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR +IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +DEALINGS IN THE SOFTWARE. + +```` + +Used by: getrandom 0.2.17 + +````text +Copyright (c) 2018-2024 The rust-random Project Developers +Copyright (c) 2014 The Rust Project Developers + +Permission is hereby granted, free of charge, to any +person obtaining a copy of this software and associated +documentation files (the "Software"), to deal in the +Software without restriction, including without +limitation the rights to use, copy, modify, merge, +publish, distribute, sublicense, and/or sell copies of +the Software, and to permit persons to whom the Software +is furnished to do so, subject to the following +conditions: + +The above copyright notice and this permission notice +shall be included in all copies or substantial portions +of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF +ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED +TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A +PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT +SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR +IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +DEALINGS IN THE SOFTWARE. + +```` + +Used by: block-buffer 0.12.1, block-padding 0.4.2 + +````text +Copyright (c) 2018-2025 The RustCrypto Project Developers + +Permission is hereby granted, free of charge, to any +person obtaining a copy of this software and associated +documentation files (the "Software"), to deal in the +Software without restriction, including without +limitation the rights to use, copy, modify, merge, +publish, distribute, sublicense, and/or sell copies of +the Software, and to permit persons to whom the Software +is furnished to do so, subject to the following +conditions: + +The above copyright notice and this permission notice +shall be included in all copies or substantial portions +of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF +ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED +TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A +PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT +SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR +IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +DEALINGS IN THE SOFTWARE. + +```` + +Used by: hex-literal 1.1.0 + +````text +Copyright (c) 2018-2025 The RustCrypto Project Developers +Copyright (c) 2018 Artyom Pavlov + +Permission is hereby granted, free of charge, to any +person obtaining a copy of this software and associated +documentation files (the "Software"), to deal in the +Software without restriction, including without +limitation the rights to use, copy, modify, merge, +publish, distribute, sublicense, and/or sell copies of +the Software, and to permit persons to whom the Software +is furnished to do so, subject to the following +conditions: + +The above copyright notice and this permission notice +shall be included in all copies or substantial portions +of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF +ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED +TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A +PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT +SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR +IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +DEALINGS IN THE SOFTWARE. + +```` + +Used by: getrandom 0.3.4 + +````text +Copyright (c) 2018-2025 The rust-random Project Developers +Copyright (c) 2014 The Rust Project Developers + +Permission is hereby granted, free of charge, to any +person obtaining a copy of this software and associated +documentation files (the "Software"), to deal in the +Software without restriction, including without +limitation the rights to use, copy, modify, merge, +publish, distribute, sublicense, and/or sell copies of +the Software, and to permit persons to whom the Software +is furnished to do so, subject to the following +conditions: + +The above copyright notice and this permission notice +shall be included in all copies or substantial portions +of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF +ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED +TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A +PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT +SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR +IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +DEALINGS IN THE SOFTWARE. + +```` + +Used by: ecdsa 0.17.0, ed25519 3.0.0, rfc6979 0.6.0, signature 3.0.0 + +````text +Copyright (c) 2018-2026 RustCrypto Developers + +Permission is hereby granted, free of charge, to any +person obtaining a copy of this software and associated +documentation files (the "Software"), to deal in the +Software without restriction, including without +limitation the rights to use, copy, modify, merge, +publish, distribute, sublicense, and/or sell copies of +the Software, and to permit persons to whom the Software +is furnished to do so, subject to the following +conditions: + +The above copyright notice and this permission notice +shall be included in all copies or substantial portions +of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF +ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED +TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A +PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT +SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR +IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +DEALINGS IN THE SOFTWARE. + +```` + +Used by: rand_core 0.10.1 + +````text +Copyright (c) 2018-2026 The Rand Project Developers + +Permission is hereby granted, free of charge, to any +person obtaining a copy of this software and associated +documentation files (the "Software"), to deal in the +Software without restriction, including without +limitation the rights to use, copy, modify, merge, +publish, distribute, sublicense, and/or sell copies of +the Software, and to permit persons to whom the Software +is furnished to do so, subject to the following +conditions: + +The above copyright notice and this permission notice +shall be included in all copies or substantial portions +of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF +ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED +TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A +PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT +SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR +IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +DEALINGS IN THE SOFTWARE. + +```` + +Used by: keccak 0.2.2, zeroize 1.9.0 + +````text +Copyright (c) 2018-2026 The RustCrypto Project Developers + +Permission is hereby granted, free of charge, to any +person obtaining a copy of this software and associated +documentation files (the "Software"), to deal in the +Software without restriction, including without +limitation the rights to use, copy, modify, merge, +publish, distribute, sublicense, and/or sell copies of +the Software, and to permit persons to whom the Software +is furnished to do so, subject to the following +conditions: + +The above copyright notice and this permission notice +shall be included in all copies or substantial portions +of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF +ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED +TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A +PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT +SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR +IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +DEALINGS IN THE SOFTWARE. + +```` + +Used by: getrandom 0.4.3 + +````text +Copyright (c) 2018-2026 The rust-random Project Developers +Copyright (c) 2014 The Rust Project Developers + +Permission is hereby granted, free of charge, to any +person obtaining a copy of this software and associated +documentation files (the "Software"), to deal in the +Software without restriction, including without +limitation the rights to use, copy, modify, merge, +publish, distribute, sublicense, and/or sell copies of +the Software, and to permit persons to whom the Software +is furnished to do so, subject to the following +conditions: + +The above copyright notice and this permission notice +shall be included in all copies or substantial portions +of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF +ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED +TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A +PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT +SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR +IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +DEALINGS IN THE SOFTWARE. + +```` + +Used by: slab 0.4.12 + +````text +Copyright (c) 2019 Carl Lerche + +Permission is hereby granted, free of charge, to any +person obtaining a copy of this software and associated +documentation files (the "Software"), to deal in the +Software without restriction, including without +limitation the rights to use, copy, modify, merge, +publish, distribute, sublicense, and/or sell copies of +the Software, and to permit persons to whom the Software +is furnished to do so, subject to the following +conditions: + +The above copyright notice and this permission notice +shall be included in all copies or substantial portions +of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF +ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED +TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A +PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT +SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR +IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +DEALINGS IN THE SOFTWARE. + +```` + +Used by: sharded-slab 0.1.7 + +````text +Copyright (c) 2019 Eliza Weisman + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. + +```` + +Used by: matchers 0.2.0 + +````text +Copyright (c) 2019 Eliza Weisman + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. + +```` + +Used by: font-types 0.12.5, read-fonts 0.41.0, skrifa 0.44.0 + +````text +Copyright (c) 2019 Fontations Developers + +Permission is hereby granted, free of charge, to any +person obtaining a copy of this software and associated +documentation files (the "Software"), to deal in the +Software without restriction, including without +limitation the rights to use, copy, modify, merge, +publish, distribute, sublicense, and/or sell copies of +the Software, and to permit persons to whom the Software +is furnished to do so, subject to the following +conditions: + +The above copyright notice and this permission notice +shall be included in all copies or substantial portions +of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF +ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED +TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A +PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT +SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR +IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +DEALINGS IN THE SOFTWARE. + +```` + +Used by: wl-clipboard-rs 0.9.3 + +````text +Copyright (c) 2019 Ivan Molodetskikh + +Permission is hereby granted, free of charge, to any +person obtaining a copy of this software and associated +documentation files (the "Software"), to deal in the +Software without restriction, including without +limitation the rights to use, copy, modify, merge, +publish, distribute, sublicense, and/or sell copies of +the Software, and to permit persons to whom the Software +is furnished to do so, subject to the following +conditions: + +The above copyright notice and this permission notice +shall be included in all copies or substantial portions +of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF +ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED +TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A +PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT +SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR +IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +DEALINGS IN THE SOFTWARE. + +```` + +Used by: bcrypt-pbkdf 0.11.0 + +````text +Copyright (c) 2019 Jack Grigg +Copyright (c) 2019-2026 The RustCrypto Project Developers + +Permission is hereby granted, free of charge, to any +person obtaining a copy of this software and associated +documentation files (the "Software"), to deal in the +Software without restriction, including without +limitation the rights to use, copy, modify, merge, +publish, distribute, sublicense, and/or sell copies of +the Software, and to permit persons to whom the Software +is furnished to do so, subject to the following +conditions: + +The above copyright notice and this permission notice +shall be included in all copies or substantial portions +of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF +ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED +TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A +PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT +SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR +IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +DEALINGS IN THE SOFTWARE. + +```` + +Used by: ppv-lite86 0.2.21 + +````text +Copyright (c) 2019 The CryptoCorrosion Contributors + +Permission is hereby granted, free of charge, to any +person obtaining a copy of this software and associated +documentation files (the "Software"), to deal in the +Software without restriction, including without +limitation the rights to use, copy, modify, merge, +publish, distribute, sublicense, and/or sell copies of +the Software, and to permit persons to whom the Software +is furnished to do so, subject to the following +conditions: + +The above copyright notice and this permission notice +shall be included in all copies or substantial portions +of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF +ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED +TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A +PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT +SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR +IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +DEALINGS IN THE SOFTWARE. + +```` + +Used by: aead 0.5.2 + +````text +Copyright (c) 2019 The RustCrypto Project Developers +Copyright (c) 2019 MobileCoin, LLC + +Permission is hereby granted, free of charge, to any +person obtaining a copy of this software and associated +documentation files (the "Software"), to deal in the +Software without restriction, including without +limitation the rights to use, copy, modify, merge, +publish, distribute, sublicense, and/or sell copies of +the Software, and to permit persons to whom the Software +is furnished to do so, subject to the following +conditions: + +The above copyright notice and this permission notice +shall be included in all copies or substantial portions +of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF +ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED +TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A +PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT +SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR +IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +DEALINGS IN THE SOFTWARE. + +```` + +Used by: tracing-attributes 0.1.31, tracing-core 0.1.36, tracing-log 0.2.0, tracing-subscriber 0.3.23, tracing 0.1.44 + +````text +Copyright (c) 2019 Tokio Contributors + +Permission is hereby granted, free of charge, to any +person obtaining a copy of this software and associated +documentation files (the "Software"), to deal in the +Software without restriction, including without +limitation the rights to use, copy, modify, merge, +publish, distribute, sublicense, and/or sell copies of +the Software, and to permit persons to whom the Software +is furnished to do so, subject to the following +conditions: + +The above copyright notice and this permission notice +shall be included in all copies or substantial portions +of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF +ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED +TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A +PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT +SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR +IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +DEALINGS IN THE SOFTWARE. + +```` + +Used by: tower-layer 0.3.3, tower-service 0.3.3, tower 0.5.3 + +````text +Copyright (c) 2019 Tower Contributors + +Permission is hereby granted, free of charge, to any +person obtaining a copy of this software and associated +documentation files (the "Software"), to deal in the +Software without restriction, including without +limitation the rights to use, copy, modify, merge, +publish, distribute, sublicense, and/or sell copies of +the Software, and to permit persons to whom the Software +is furnished to do so, subject to the following +conditions: + +The above copyright notice and this permission notice +shall be included in all copies or substantial portions +of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF +ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED +TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A +PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT +SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR +IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +DEALINGS IN THE SOFTWARE. + +```` + +Used by: pico-args 0.5.0 + +````text +Copyright (c) 2019 Yevhenii Reizner + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. + + +```` + +Used by: axum 0.8.9 + +````text +Copyright (c) 2019 axum Contributors + +Permission is hereby granted, free of charge, to any +person obtaining a copy of this software and associated +documentation files (the "Software"), to deal in the +Software without restriction, including without +limitation the rights to use, copy, modify, merge, +publish, distribute, sublicense, and/or sell copies of +the Software, and to permit persons to whom the Software +is furnished to do so, subject to the following +conditions: + +The above copyright notice and this permission notice +shall be included in all copies or substantial portions +of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF +ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED +TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A +PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT +SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR +IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +DEALINGS IN THE SOFTWARE. + +```` + +Used by: tower-http 0.6.11 + +````text +Copyright (c) 2019-2021 Tower Contributors + +Permission is hereby granted, free of charge, to any +person obtaining a copy of this software and associated +documentation files (the "Software"), to deal in the +Software without restriction, including without +limitation the rights to use, copy, modify, merge, +publish, distribute, sublicense, and/or sell copies of +the Software, and to permit persons to whom the Software +is furnished to do so, subject to the following +conditions: + +The above copyright notice and this permission notice +shall be included in all copies or substantial portions +of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF +ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED +TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A +PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT +SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR +IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +DEALINGS IN THE SOFTWARE. + +```` + +Used by: universal-hash 0.6.1 + +````text +Copyright (c) 2019-2025 RustCrypto Developers + +Permission is hereby granted, free of charge, to any +person obtaining a copy of this software and associated +documentation files (the "Software"), to deal in the +Software without restriction, including without +limitation the rights to use, copy, modify, merge, +publish, distribute, sublicense, and/or sell copies of +the Software, and to permit persons to whom the Software +is furnished to do so, subject to the following +conditions: + +The above copyright notice and this permission notice +shall be included in all copies or substantial portions +of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF +ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED +TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A +PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT +SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR +IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +DEALINGS IN THE SOFTWARE. + +```` + +Used by: http-body-util 0.1.5, http-body 1.1.0 + +````text +Copyright (c) 2019-2026 Sean McArthur & Hyper Contributors + +Permission is hereby granted, free of charge, to any +person obtaining a copy of this software and associated +documentation files (the "Software"), to deal in the +Software without restriction, including without +limitation the rights to use, copy, modify, merge, +publish, distribute, sublicense, and/or sell copies of +the Software, and to permit persons to whom the Software +is furnished to do so, subject to the following +conditions: + +The above copyright notice and this permission notice +shall be included in all copies or substantial portions +of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF +ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED +TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A +PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT +SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR +IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +DEALINGS IN THE SOFTWARE. + +```` + +Used by: aes-gcm 0.11.1, chacha20 0.10.2, ghash 0.6.0, polyval 0.7.3 + +````text +Copyright (c) 2019-2026 The RustCrypto Project Developers + +Permission is hereby granted, free of charge, to any +person obtaining a copy of this software and associated +documentation files (the "Software"), to deal in the +Software without restriction, including without +limitation the rights to use, copy, modify, merge, +publish, distribute, sublicense, and/or sell copies of +the Software, and to permit persons to whom the Software +is furnished to do so, subject to the following +conditions: + +The above copyright notice and this permission notice +shall be included in all copies or substantial portions +of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF +ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED +TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A +PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT +SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR +IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +DEALINGS IN THE SOFTWARE. + +```` + +Used by: salsa20 0.11.0 + +````text +Copyright (c) 2019-2026 The RustCrypto Project Developers +Copyright (c) 2019 Eric McCorkle + +Permission is hereby granted, free of charge, to any +person obtaining a copy of this software and associated +documentation files (the "Software"), to deal in the +Software without restriction, including without +limitation the rights to use, copy, modify, merge, +publish, distribute, sublicense, and/or sell copies of +the Software, and to permit persons to whom the Software +is furnished to do so, subject to the following +conditions: + +The above copyright notice and this permission notice +shall be included in all copies or substantial portions +of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF +ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED +TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A +PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT +SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR +IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +DEALINGS IN THE SOFTWARE. + +```` + +Used by: aead 0.6.1 + +````text +Copyright (c) 2019-2026 The RustCrypto Project Developers +Copyright (c) 2019 MobileCoin, LLC + +Permission is hereby granted, free of charge, to any +person obtaining a copy of this software and associated +documentation files (the "Software"), to deal in the +Software without restriction, including without +limitation the rights to use, copy, modify, merge, +publish, distribute, sublicense, and/or sell copies of +the Software, and to permit persons to whom the Software +is furnished to do so, subject to the following +conditions: + +The above copyright notice and this permission notice +shall be included in all copies or substantial portions +of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF +ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED +TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A +PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT +SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR +IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +DEALINGS IN THE SOFTWARE. + +```` + +Used by: iana-time-zone 0.1.65 + +````text +Copyright (c) 2020 Andrew D. Straw + +Permission is hereby granted, free of charge, to any +person obtaining a copy of this software and associated +documentation files (the "Software"), to deal in the +Software without restriction, including without +limitation the rights to use, copy, modify, merge, +publish, distribute, sublicense, and/or sell copies of +the Software, and to permit persons to whom the Software +is furnished to do so, subject to the following +conditions: + +The above copyright notice and this permission notice +shall be included in all copies or substantial portions +of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF +ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED +TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A +PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT +SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR +IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +DEALINGS IN THE SOFTWARE. + +```` + +Used by: typed-index-collections 3.5.0 + +````text +Copyright (c) 2020 Andrey Zheleznov + +Permission is hereby granted, free of charge, to any +person obtaining a copy of this software and associated +documentation files (the "Software"), to deal in the +Software without restriction, including without +limitation the rights to use, copy, modify, merge, +publish, distribute, sublicense, and/or sell copies of +the Software, and to permit persons to whom the Software +is furnished to do so, subject to the following +conditions: + +The above copyright notice and this permission notice +shall be included in all copies or substantial portions +of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF +ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED +TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A +PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT +SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR +IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +DEALINGS IN THE SOFTWARE. + +```` + +Used by: downcast-rs 1.2.1 + +````text +Copyright (c) 2020 Ashish Myles and contributors + +Permission is hereby granted, free of charge, to any +person obtaining a copy of this software and associated +documentation files (the "Software"), to deal in the +Software without restriction, including without +limitation the rights to use, copy, modify, merge, +publish, distribute, sublicense, and/or sell copies of +the Software, and to permit persons to whom the Software +is furnished to do so, subject to the following +conditions: + +The above copyright notice and this permission notice +shall be included in all copies or substantial portions +of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF +ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED +TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A +PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT +SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR +IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +DEALINGS IN THE SOFTWARE. + +```` + +Used by: swash 0.2.10 + +````text +Copyright (c) 2020 Chad Brokaw + +Permission is hereby granted, free of charge, to any +person obtaining a copy of this software and associated +documentation files (the "Software"), to deal in the +Software without restriction, including without +limitation the rights to use, copy, modify, merge, +publish, distribute, sublicense, and/or sell copies of +the Software, and to permit persons to whom the Software +is furnished to do so, subject to the following +conditions: + +The above copyright notice and this permission notice +shall be included in all copies or substantial portions +of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF +ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED +TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A +PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT +SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR +IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +DEALINGS IN THE SOFTWARE. +```` + +Used by: zeno 0.3.3 + +````text +Copyright (c) 2020 Chad Brokaw + +Permission is hereby granted, free of charge, to any +person obtaining a copy of this software and associated +documentation files (the "Software"), to deal in the +Software without restriction, including without +limitation the rights to use, copy, modify, merge, +publish, distribute, sublicense, and/or sell copies of +the Software, and to permit persons to whom the Software +is furnished to do so, subject to the following +conditions: + +The above copyright notice and this permission notice +shall be included in all copies or substantial portions +of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF +ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED +TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A +PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT +SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR +IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +DEALINGS IN THE SOFTWARE. +```` + +Used by: yazi 0.2.1 + +````text +Copyright (c) 2020 Chad Brokaw + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. + +```` + +Used by: scoped-tls-hkt 0.1.5 + +````text +Copyright (c) 2020 Diggory Blake + +Permission is hereby granted, free of charge, to any +person obtaining a copy of this software and associated +documentation files (the "Software"), to deal in the +Software without restriction, including without +limitation the rights to use, copy, modify, merge, +publish, distribute, sublicense, and/or sell copies of +the Software, and to permit persons to whom the Software +is furnished to do so, subject to the following +conditions: + +The above copyright notice and this permission notice +shall be included in all copies or substantial portions +of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF +ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED +TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A +PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT +SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR +IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +DEALINGS IN THE SOFTWARE. + +```` + +Used by: rubato 5.0.0 + +````text +Copyright (c) 2020 Henrik Enquist + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. +```` + +Used by: wasapi 0.24.0 + +````text +Copyright (c) 2020 Henrik Enquist + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. +```` + +Used by: pin-weak 1.1.0 + +````text +Copyright (c) 2020 Olivier Goffart + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. + +```` + +Used by: ccm 0.5.0, eax 0.5.0 + +````text +Copyright (c) 2020 The RustCrypto Project Developers + +Permission is hereby granted, free of charge, to any +person obtaining a copy of this software and associated +documentation files (the "Software"), to deal in the +Software without restriction, including without +limitation the rights to use, copy, modify, merge, +publish, distribute, sublicense, and/or sell copies of +the Software, and to permit persons to whom the Software +is furnished to do so, subject to the following +conditions: + +The above copyright notice and this permission notice +shall be included in all copies or substantial portions +of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF +ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED +TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A +PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT +SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR +IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +DEALINGS IN THE SOFTWARE. + +```` + +Used by: memmap2 0.9.11 + +````text +Copyright (c) 2020 Yevhenii Reizner +Copyright (c) 2015 Dan Burkert + +Permission is hereby granted, free of charge, to any +person obtaining a copy of this software and associated +documentation files (the "Software"), to deal in the +Software without restriction, including without +limitation the rights to use, copy, modify, merge, +publish, distribute, sublicense, and/or sell copies of +the Software, and to permit persons to whom the Software +is furnished to do so, subject to the following +conditions: + +The above copyright notice and this permission notice +shall be included in all copies or substantial portions +of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF +ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED +TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A +PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT +SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR +IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +DEALINGS IN THE SOFTWARE. + +```` + +Used by: clru 0.6.3 + +````text +Copyright (c) 2020 Élie ROUDNINSKI (marmeladema) + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. + +```` + +Used by: p384 0.14.0 + +````text +Copyright (c) 2020-2021 RustCrypto Developers + +Permission is hereby granted, free of charge, to any +person obtaining a copy of this software and associated +documentation files (the "Software"), to deal in the +Software without restriction, including without +limitation the rights to use, copy, modify, merge, +publish, distribute, sublicense, and/or sell copies of +the Software, and to permit persons to whom the Software +is furnished to do so, subject to the following +conditions: + +The above copyright notice and this permission notice +shall be included in all copies or substantial portions +of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF +ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED +TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A +PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT +SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR +IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +DEALINGS IN THE SOFTWARE. + +```` + +Used by: elliptic-curve 0.13.8 + +````text +Copyright (c) 2020-2022 RustCrypto Developers + +Permission is hereby granted, free of charge, to any +person obtaining a copy of this software and associated +documentation files (the "Software"), to deal in the +Software without restriction, including without +limitation the rights to use, copy, modify, merge, +publish, distribute, sublicense, and/or sell copies of +the Software, and to permit persons to whom the Software +is furnished to do so, subject to the following +conditions: + +The above copyright notice and this permission notice +shall be included in all copies or substantial portions +of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF +ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED +TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A +PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT +SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR +IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +DEALINGS IN THE SOFTWARE. + +```` + +Used by: const-oid 0.9.6, der_derive 0.7.3 + +````text +Copyright (c) 2020-2022 The RustCrypto Project Developers + +Permission is hereby granted, free of charge, to any +person obtaining a copy of this software and associated +documentation files (the "Software"), to deal in the +Software without restriction, including without +limitation the rights to use, copy, modify, merge, +publish, distribute, sublicense, and/or sell copies of +the Software, and to permit persons to whom the Software +is furnished to do so, subject to the following +conditions: + +The above copyright notice and this permission notice +shall be included in all copies or substantial portions +of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF +ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED +TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A +PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT +SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR +IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +DEALINGS IN THE SOFTWARE. + +```` + +Used by: p256 0.13.2, primeorder 0.13.6, primeorder 0.14.0 + +````text +Copyright (c) 2020-2023 RustCrypto Developers + +Permission is hereby granted, free of charge, to any +person obtaining a copy of this software and associated +documentation files (the "Software"), to deal in the +Software without restriction, including without +limitation the rights to use, copy, modify, merge, +publish, distribute, sublicense, and/or sell copies of +the Software, and to permit persons to whom the Software +is furnished to do so, subject to the following +conditions: + +The above copyright notice and this permission notice +shall be included in all copies or substantial portions +of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF +ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED +TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A +PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT +SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR +IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +DEALINGS IN THE SOFTWARE. + +```` + +Used by: der 0.7.10, pkcs8 0.10.2 + +````text +Copyright (c) 2020-2023 The RustCrypto Project Developers + +Permission is hereby granted, free of charge, to any +person obtaining a copy of this software and associated +documentation files (the "Software"), to deal in the +Software without restriction, including without +limitation the rights to use, copy, modify, merge, +publish, distribute, sublicense, and/or sell copies of +the Software, and to permit persons to whom the Software +is furnished to do so, subject to the following +conditions: + +The above copyright notice and this permission notice +shall be included in all copies or substantial portions +of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF +ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED +TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A +PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT +SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR +IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +DEALINGS IN THE SOFTWARE. + +```` + +Used by: cpufeatures 0.2.17 + +````text +Copyright (c) 2020-2025 The RustCrypto Project Developers + +Permission is hereby granted, free of charge, to any +person obtaining a copy of this software and associated +documentation files (the "Software"), to deal in the +Software without restriction, including without +limitation the rights to use, copy, modify, merge, +publish, distribute, sublicense, and/or sell copies of +the Software, and to permit persons to whom the Software +is furnished to do so, subject to the following +conditions: + +The above copyright notice and this permission notice +shall be included in all copies or substantial portions +of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF +ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED +TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A +PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT +SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR +IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +DEALINGS IN THE SOFTWARE. + +```` + +Used by: elliptic-curve 0.14.1, p256 0.14.0, p521 0.14.0 + +````text +Copyright (c) 2020-2026 RustCrypto Developers + +Permission is hereby granted, free of charge, to any +person obtaining a copy of this software and associated +documentation files (the "Software"), to deal in the +Software without restriction, including without +limitation the rights to use, copy, modify, merge, +publish, distribute, sublicense, and/or sell copies of +the Software, and to permit persons to whom the Software +is furnished to do so, subject to the following +conditions: + +The above copyright notice and this permission notice +shall be included in all copies or substantial portions +of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF +ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED +TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A +PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT +SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR +IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +DEALINGS IN THE SOFTWARE. + +```` + +Used by: const-oid 0.10.2, cpufeatures 0.3.1, der 0.8.2, pkcs8 0.11.0 + +````text +Copyright (c) 2020-2026 The RustCrypto Project Developers + +Permission is hereby granted, free of charge, to any +person obtaining a copy of this software and associated +documentation files (the "Software"), to deal in the +Software without restriction, including without +limitation the rights to use, copy, modify, merge, +publish, distribute, sublicense, and/or sell copies of +the Software, and to permit persons to whom the Software +is furnished to do so, subject to the following +conditions: + +The above copyright notice and this permission notice +shall be included in all copies or substantial portions +of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF +ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED +TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A +PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT +SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR +IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +DEALINGS IN THE SOFTWARE. + +```` + +Used by: sha3 0.11.0, sha3 0.12.0 + +````text +Copyright (c) 2020-2026 The RustCrypto Project Developers +Copyright (c) 2016-2023 Artyom Pavlov, Marek Kotewicz +Copyright (c) 2014 Sébastien Martini +Copyright (c) 2009-2013 Mozilla Foundation +Copyright (c) 2006-2009 Graydon Hoare + +Permission is hereby granted, free of charge, to any +person obtaining a copy of this software and associated +documentation files (the "Software"), to deal in the +Software without restriction, including without +limitation the rights to use, copy, modify, merge, +publish, distribute, sublicense, and/or sell copies of +the Software, and to permit persons to whom the Software +is furnished to do so, subject to the following +conditions: + +The above copyright notice and this permission notice +shall be included in all copies or substantial portions +of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF +ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED +TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A +PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT +SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR +IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +DEALINGS IN THE SOFTWARE. + +```` + +Used by: crypto-common 0.1.7 + +````text +Copyright (c) 2021 RustCrypto Developers + +Permission is hereby granted, free of charge, to any +person obtaining a copy of this software and associated +documentation files (the "Software"), to deal in the +Software without restriction, including without +limitation the rights to use, copy, modify, merge, +publish, distribute, sublicense, and/or sell copies of +the Software, and to permit persons to whom the Software +is furnished to do so, subject to the following +conditions: + +The above copyright notice and this permission notice +shall be included in all copies or substantial portions +of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF +ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED +TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A +PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT +SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR +IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +DEALINGS IN THE SOFTWARE. + +```` + +Used by: crypto-bigint 0.5.5, crypto-bigint 0.6.1, pem-rfc7468 0.7.0, x509-cert 0.2.5 + +````text +Copyright (c) 2021 The RustCrypto Project Developers + +Permission is hereby granted, free of charge, to any +person obtaining a copy of this software and associated +documentation files (the "Software"), to deal in the +Software without restriction, including without +limitation the rights to use, copy, modify, merge, +publish, distribute, sublicense, and/or sell copies of +the Software, and to permit persons to whom the Software +is furnished to do so, subject to the following +conditions: + +The above copyright notice and this permission notice +shall be included in all copies or substantial portions +of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF +ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED +TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A +PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT +SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR +IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +DEALINGS IN THE SOFTWARE. + +```` + +Used by: sec1 0.7.3 + +````text +Copyright (c) 2021-2022 The RustCrypto Project Developers + +Permission is hereby granted, free of charge, to any +person obtaining a copy of this software and associated +documentation files (the "Software"), to deal in the +Software without restriction, including without +limitation the rights to use, copy, modify, merge, +publish, distribute, sublicense, and/or sell copies of +the Software, and to permit persons to whom the Software +is furnished to do so, subject to the following +conditions: + +The above copyright notice and this permission notice +shall be included in all copies or substantial portions +of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF +ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED +TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A +PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT +SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR +IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +DEALINGS IN THE SOFTWARE. + +```` + +Used by: spki 0.7.3 + +````text +Copyright (c) 2021-2023 The RustCrypto Project Developers + +Permission is hereby granted, free of charge, to any +person obtaining a copy of this software and associated +documentation files (the "Software"), to deal in the +Software without restriction, including without +limitation the rights to use, copy, modify, merge, +publish, distribute, sublicense, and/or sell copies of +the Software, and to permit persons to whom the Software +is furnished to do so, subject to the following +conditions: + +The above copyright notice and this permission notice +shall be included in all copies or substantial portions +of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF +ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED +TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A +PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT +SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR +IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +DEALINGS IN THE SOFTWARE. + +```` + +Used by: pem-rfc7468 1.0.0, pkcs1 0.8.0-rc.4 + +````text +Copyright (c) 2021-2025 The RustCrypto Project Developers + +Permission is hereby granted, free of charge, to any +person obtaining a copy of this software and associated +documentation files (the "Software"), to deal in the +Software without restriction, including without +limitation the rights to use, copy, modify, merge, +publish, distribute, sublicense, and/or sell copies of +the Software, and to permit persons to whom the Software +is furnished to do so, subject to the following +conditions: + +The above copyright notice and this permission notice +shall be included in all copies or substantial portions +of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF +ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED +TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A +PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT +SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR +IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +DEALINGS IN THE SOFTWARE. + +```` + +Used by: crypto-common 0.2.2, kem 0.3.0 + +````text +Copyright (c) 2021-2026 RustCrypto Developers + +Permission is hereby granted, free of charge, to any +person obtaining a copy of this software and associated +documentation files (the "Software"), to deal in the +Software without restriction, including without +limitation the rights to use, copy, modify, merge, +publish, distribute, sublicense, and/or sell copies of +the Software, and to permit persons to whom the Software +is furnished to do so, subject to the following +conditions: + +The above copyright notice and this permission notice +shall be included in all copies or substantial portions +of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF +ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED +TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A +PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT +SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR +IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +DEALINGS IN THE SOFTWARE. + +```` + +Used by: argon2 0.6.0, crypto-bigint 0.7.5, pkcs5 0.8.1, scrypt 0.12.0, sec1 0.8.1, spki 0.8.0, ssh-encoding 0.3.0, ssh-key 0.7.0-rc.11 + +````text +Copyright (c) 2021-2026 The RustCrypto Project Developers + +Permission is hereby granted, free of charge, to any +person obtaining a copy of this software and associated +documentation files (the "Software"), to deal in the +Software without restriction, including without +limitation the rights to use, copy, modify, merge, +publish, distribute, sublicense, and/or sell copies of +the Software, and to permit persons to whom the Software +is furnished to do so, subject to the following +conditions: + +The above copyright notice and this permission notice +shall be included in all copies or substantial portions +of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF +ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED +TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A +PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT +SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR +IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +DEALINGS IN THE SOFTWARE. + +```` + +Used by: atspi-common 0.13.0, atspi-proxies 0.13.0, atspi 0.29.0 + +````text +Copyright (c) 2022 Tait Hoyem + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. + +```` + +Used by: inout 0.1.4 + +````text +Copyright (c) 2022 The RustCrypto Project Developers +Copyright (c) 2022 Artyom Pavlov + +Permission is hereby granted, free of charge, to any +person obtaining a copy of this software and associated +documentation files (the "Software"), to deal in the +Software without restriction, including without +limitation the rights to use, copy, modify, merge, +publish, distribute, sublicense, and/or sell copies of +the Software, and to permit persons to whom the Software +is furnished to do so, subject to the following +conditions: + +The above copyright notice and this permission notice +shall be included in all copies or substantial portions +of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF +ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED +TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A +PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT +SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR +IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +DEALINGS IN THE SOFTWARE. + +```` + +Used by: critical-section 1.2.0 + +````text +Copyright (c) 2022 The critical-section authors + +Permission is hereby granted, free of charge, to any +person obtaining a copy of this software and associated +documentation files (the "Software"), to deal in the +Software without restriction, including without +limitation the rights to use, copy, modify, merge, +publish, distribute, sublicense, and/or sell copies of +the Software, and to permit persons to whom the Software +is furnished to do so, subject to the following +conditions: + +The above copyright notice and this permission notice +shall be included in all copies or substantial portions +of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF +ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED +TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A +PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT +SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR +IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +DEALINGS IN THE SOFTWARE. + +```` + +Used by: transpose 0.2.3 + +````text +Copyright (c) 2022 The transpose Developers + +Permission is hereby granted, free of charge, to any +person obtaining a copy of this software and associated +documentation files (the "Software"), to deal in the +Software without restriction, including without +limitation the rights to use, copy, modify, merge, +publish, distribute, sublicense, and/or sell copies of +the Software, and to permit persons to whom the Software +is furnished to do so, subject to the following +conditions: + +The above copyright notice and this permission notice +shall be included in all copies or substantial portions +of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF +ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED +TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A +PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT +SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR +IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +DEALINGS IN THE SOFTWARE. + +```` + +Used by: strict-num 0.1.1 + +````text +Copyright (c) 2022 Yevhenii Reizner + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. + +```` + +Used by: xkeysym 0.2.1 + +````text +Copyright (c) 2022-2023 John Nunley + +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the "Software"), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies +of the Software, and to permit persons to whom the Software is furnished to do +so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. + +```` + +Used by: inout 0.2.2 + +````text +Copyright (c) 2022-2025 The RustCrypto Project Developers +Copyright (c) 2022 Artyom Pavlov + +Permission is hereby granted, free of charge, to any +person obtaining a copy of this software and associated +documentation files (the "Software"), to deal in the +Software without restriction, including without +limitation the rights to use, copy, modify, merge, +publish, distribute, sublicense, and/or sell copies of +the Software, and to permit persons to whom the Software +is furnished to do so, subject to the following +conditions: + +The above copyright notice and this permission notice +shall be included in all copies or substantial portions +of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF +ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED +TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A +PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT +SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR +IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +DEALINGS IN THE SOFTWARE. + +```` + +Used by: cmov 0.5.4, hybrid-array 0.4.15 + +````text +Copyright (c) 2022-2026 The RustCrypto Project Developers + +Permission is hereby granted, free of charge, to any +person obtaining a copy of this software and associated +documentation files (the "Software"), to deal in the +Software without restriction, including without +limitation the rights to use, copy, modify, merge, +publish, distribute, sublicense, and/or sell copies of +the Software, and to permit persons to whom the Software +is furnished to do so, subject to the following +conditions: + +The above copyright notice and this permission notice +shall be included in all copies or substantial portions +of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF +ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED +TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A +PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT +SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR +IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +DEALINGS IN THE SOFTWARE. + +```` + +Used by: rustls-pki-types 1.15.1 + +````text +Copyright (c) 2023 Dirkjan Ochtman + +Permission is hereby granted, free of charge, to any +person obtaining a copy of this software and associated +documentation files (the "Software"), to deal in the +Software without restriction, including without +limitation the rights to use, copy, modify, merge, +publish, distribute, sublicense, and/or sell copies of +the Software, and to permit persons to whom the Software +is furnished to do so, subject to the following +conditions: + +The above copyright notice and this permission notice +shall be included in all copies or substantial portions +of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF +ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED +TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A +PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT +SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR +IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +DEALINGS IN THE SOFTWARE. + +```` + +Used by: powerfmt 0.2.0 + +````text +Copyright (c) 2023 Jacob Pratt et al. + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. + +```` + +Used by: calloop-wayland-source 0.3.0 + +````text +Copyright (c) 2023 Kirill Chibisov + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. +```` + +Used by: cursor-icon 1.2.0, wayland-csd-frame 0.3.0 + +````text +Copyright (c) 2023 Kirill Chibisov + +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the "Software"), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies +of the Software, and to permit persons to whom the Software is furnished to do +so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. + +```` + +Used by: hyper-util 0.1.21 + +````text +Copyright (c) 2023-2025 Sean McArthur + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. + +```` + +Used by: cpubits 0.1.1, ssh-cipher 0.3.0 + +````text +Copyright (c) 2023-2026 The RustCrypto Project Developers + +Permission is hereby granted, free of charge, to any +person obtaining a copy of this software and associated +documentation files (the "Software"), to deal in the +Software without restriction, including without +limitation the rights to use, copy, modify, merge, +publish, distribute, sublicense, and/or sell copies of +the Software, and to permit persons to whom the Software +is furnished to do so, subject to the following +conditions: + +The above copyright notice and this permission notice +shall be included in all copies or substantial portions +of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF +ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED +TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A +PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT +SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR +IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +DEALINGS IN THE SOFTWARE. + +```` + +Used by: deranged 0.5.8 + +````text +Copyright (c) 2024 Jacob Pratt et al. + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. + +```` + +Used by: zbus 5.19.0, zbus_macros 5.19.0, zbus_names 4.3.4, zbus_xml 5.2.1, zvariant 5.15.0, zvariant_derive 5.15.0 + +````text +Copyright (c) 2024 Zeeshan Ali Khan & zbus contributors + +Permission is hereby granted, free of charge, to any +person obtaining a copy of this software and associated +documentation files (the "Software"), to deal in the +Software without restriction, including without +limitation the rights to use, copy, modify, merge, +publish, distribute, sublicense, and/or sell copies of +the Software, and to permit persons to whom the Software +is furnished to do so, subject to the following +conditions: + +The above copyright notice and this permission notice +shall be included in all copies or substantial portions +of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF +ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED +TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A +PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT +SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR +IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +DEALINGS IN THE SOFTWARE. + +```` + +Used by: primefield 0.14.0 + +````text +Copyright (c) 2024-2026 RustCrypto Developers + +Permission is hereby granted, free of charge, to any +person obtaining a copy of this software and associated +documentation files (the "Software"), to deal in the +Software without restriction, including without +limitation the rights to use, copy, modify, merge, +publish, distribute, sublicense, and/or sell copies of +the Software, and to permit persons to whom the Software +is furnished to do so, subject to the following +conditions: + +The above copyright notice and this permission notice +shall be included in all copies or substantial portions +of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF +ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED +TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A +PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT +SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR +IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +DEALINGS IN THE SOFTWARE. + +```` + +Used by: ml-kem 0.3.2, module-lattice 0.2.3 + +````text +Copyright (c) 2024-2026 RustCrypto Developers + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. + +```` + +Used by: windowfunctions 0.1.1 + +````text +Copyright (c) 2025 Henrik Enquist + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. +```` + +Used by: secret-service 5.2.0 + +````text +Copyright (c) 2025 secret-service Developers + +Permission is hereby granted, free of charge, to any +person obtaining a copy of this software and associated +documentation files (the "Software"), to deal in the +Software without restriction, including without +limitation the rights to use, copy, modify, merge, +publish, distribute, sublicense, and/or sell copies of +the Software, and to permit persons to whom the Software +is furnished to do so, subject to the following +conditions: + +The above copyright notice and this permission notice +shall be included in all copies or substantial portions +of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF +ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED +TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A +PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT +SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR +IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +DEALINGS IN THE SOFTWARE. + +```` + +Used by: ctutils 0.4.2 + +````text +Copyright (c) 2025-2026 The RustCrypto Project Developers + +Permission is hereby granted, free of charge, to any +person obtaining a copy of this software and associated +documentation files (the "Software"), to deal in the +Software without restriction, including without +limitation the rights to use, copy, modify, merge, +publish, distribute, sublicense, and/or sell copies of +the Software, and to permit persons to whom the Software +is furnished to do so, subject to the following +conditions: + +The above copyright notice and this permission notice +shall be included in all copies or substantial portions +of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF +ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED +TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A +PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT +SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR +IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +DEALINGS IN THE SOFTWARE. + +```` + +Used by: audioadapter-buffers 5.2.0, audioadapter-sample 5.2.0, audioadapter 5.0.0 + +````text +Copyright (c) 2026 Henrik Enquist + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. + +```` + +Used by: wnaf 0.14.1 + +````text +Copyright (c) 2026 RustCrypto Developers +Copyright (c) 2018-2025 `group` crate developers + +Permission is hereby granted, free of charge, to any +person obtaining a copy of this software and associated +documentation files (the "Software"), to deal in the +Software without restriction, including without +limitation the rights to use, copy, modify, merge, +publish, distribute, sublicense, and/or sell copies of +the Software, and to permit persons to whom the Software +is furnished to do so, subject to the following +conditions: + +The above copyright notice and this permission notice +shall be included in all copies or substantial portions +of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF +ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED +TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A +PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT +SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR +IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +DEALINGS IN THE SOFTWARE. + +```` + +Used by: sponge-cursor 0.1.0 + +````text +Copyright (c) 2026 The RustCrypto Project Developers + +Permission is hereby granted, free of charge, to any +person obtaining a copy of this software and associated +documentation files (the "Software"), to deal in the +Software without restriction, including without +limitation the rights to use, copy, modify, merge, +publish, distribute, sublicense, and/or sell copies of +the Software, and to permit persons to whom the Software +is furnished to do so, subject to the following +conditions: + +The above copyright notice and this permission notice +shall be included in all copies or substantial portions +of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF +ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED +TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A +PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT +SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR +IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +DEALINGS IN THE SOFTWARE. + +```` + +Used by: zcheapstr 1.1.0 + +````text +Copyright (c) 2026 Zeeshan Ali Khan & zcheapstr contributors + +Permission is hereby granted, free of charge, to any +person obtaining a copy of this software and associated +documentation files (the "Software"), to deal in the +Software without restriction, including without +limitation the rights to use, copy, modify, merge, +publish, distribute, sublicense, and/or sell copies of +the Software, and to permit persons to whom the Software +is furnished to do so, subject to the following +conditions: + +The above copyright notice and this permission notice +shall be included in all copies or substantial portions +of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF +ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED +TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A +PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT +SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR +IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +DEALINGS IN THE SOFTWARE. + +```` + +Used by: annotate-snippets 0.12.16, anstream 1.0.0, anstyle-parse 1.0.0, anstyle-query 1.1.5, anstyle-wincon 3.0.11, anstyle 1.0.14, clap 4.6.7, clap_builder 4.6.7, clap_derive 4.6.7, clap_lex 1.1.1, colorchoice 1.0.5, is_terminal_polyfill 1.70.2, once_cell_polyfill 1.70.2, serde_spanned 1.1.1, toml 1.1.6+spec-1.1.0, toml_datetime 1.1.1+spec-1.1.0, toml_edit 0.25.15+spec-1.1.0, toml_parser 1.1.3+spec-1.1.0, toml_writer 1.1.2+spec-1.1.0 + +````text +Copyright (c) Individual contributors + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. + +```` + +Used by: num-conv 0.2.2 + +````text +Copyright (c) Jacob Pratt + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. + +```` + +Used by: time-core 0.1.9, time-macros 0.2.32, time 0.3.55 + +````text +Copyright (c) Jacob Pratt et al. + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. + +```` + +Used by: libc 0.2.189 + +````text +Copyright (c) The Rust Project Developers + +Permission is hereby granted, free of charge, to any +person obtaining a copy of this software and associated +documentation files (the "Software"), to deal in the +Software without restriction, including without +limitation the rights to use, copy, modify, merge, +publish, distribute, sublicense, and/or sell copies of +the Software, and to permit persons to whom the Software +is furnished to do so, subject to the following +conditions: + +The above copyright notice and this permission notice +shall be included in all copies or substantial portions +of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF +ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED +TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A +PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT +SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR +IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +DEALINGS IN THE SOFTWARE. + +```` + +Used by: idna_adapter 1.2.2 + +````text +Copyright (c) The rust-url developers + +Permission is hereby granted, free of charge, to any +person obtaining a copy of this software and associated +documentation files (the "Software"), to deal in the +Software without restriction, including without +limitation the rights to use, copy, modify, merge, +publish, distribute, sublicense, and/or sell copies of +the Software, and to permit persons to whom the Software +is furnished to do so, subject to the following +conditions: + +The above copyright notice and this permission notice +shall be included in all copies or substantial portions +of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF +ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED +TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A +PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT +SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR +IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +DEALINGS IN THE SOFTWARE. + +```` + +Used by: arrayvec 0.7.8 + +````text +Copyright (c) Ulrik Sverdrup "bluss" 2015-2023 + +Permission is hereby granted, free of charge, to any +person obtaining a copy of this software and associated +documentation files (the "Software"), to deal in the +Software without restriction, including without +limitation the rights to use, copy, modify, merge, +publish, distribute, sublicense, and/or sell copies of +the Software, and to permit persons to whom the Software +is furnished to do so, subject to the following +conditions: + +The above copyright notice and this permission notice +shall be included in all copies or substantial portions +of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF +ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED +TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A +PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT +SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR +IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +DEALINGS IN THE SOFTWARE. + +```` + +Used by: synstructure 0.14.0 + +````text +Copyright 2016 Nika Layzell + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +```` + +Used by: ipnet 2.12.2 + +````text +Copyright 2017 Juniper Networks, Inc. + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +```` + +Used by: resvg 0.48.1, usvg 0.48.1 + +````text +Copyright 2017 the Resvg Authors + +Permission is hereby granted, free of charge, to any +person obtaining a copy of this software and associated +documentation files (the "Software"), to deal in the +Software without restriction, including without +limitation the rights to use, copy, modify, merge, +publish, distribute, sublicense, and/or sell copies of +the Software, and to permit persons to whom the Software +is furnished to do so, subject to the following +conditions: + +The above copyright notice and this permission notice +shall be included in all copies or substantial portions +of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF +ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED +TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A +PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT +SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR +IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +DEALINGS IN THE SOFTWARE. + +```` + +Used by: rand 0.10.3, rand 0.8.8, rand 0.9.5, rand_chacha 0.3.1, rand_chacha 0.9.0, rand_core 0.6.4, rand_core 0.9.5 + +````text +Copyright 2018 Developers of the Rand project +Copyright (c) 2014 The Rust Project Developers + +Permission is hereby granted, free of charge, to any +person obtaining a copy of this software and associated +documentation files (the "Software"), to deal in the +Software without restriction, including without +limitation the rights to use, copy, modify, merge, +publish, distribute, sublicense, and/or sell copies of +the Software, and to permit persons to whom the Software +is furnished to do so, subject to the following +conditions: + +The above copyright notice and this permission notice +shall be included in all copies or substantial portions +of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF +ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED +TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A +PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT +SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR +IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +DEALINGS IN THE SOFTWARE. + +```` + +Used by: as-raw-xcb-connection 1.0.1 + +````text +Copyright 2019 as-raw-xcb-connection Contributers + +Permission is hereby granted, free of charge, to any +person obtaining a copy of this software and associated +documentation files (the "Software"), to deal in the +Software without restriction, including without +limitation the rights to use, copy, modify, merge, +publish, distribute, sublicense, and/or sell copies of +the Software, and to permit persons to whom the Software +is furnished to do so, subject to the following +conditions: + +The above copyright notice and this permission notice +shall be included in all copies or substantial portions +of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF +ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED +TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A +PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT +SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR +IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +DEALINGS IN THE SOFTWARE. + +```` + +Used by: x11rb-protocol 0.13.2, x11rb 0.13.2 + +````text +Copyright 2019 x11rb Contributers + +Permission is hereby granted, free of charge, to any +person obtaining a copy of this software and associated +documentation files (the "Software"), to deal in the +Software without restriction, including without +limitation the rights to use, copy, modify, merge, +publish, distribute, sublicense, and/or sell copies of +the Software, and to permit persons to whom the Software +is furnished to do so, subject to the following +conditions: + +The above copyright notice and this permission notice +shall be included in all copies or substantial portions +of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF +ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED +TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A +PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT +SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR +IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +DEALINGS IN THE SOFTWARE. + +```` + +Used by: parlance 0.1.0, parley 0.11.1, parley_data 0.11.1 + +````text +Copyright 2020 the Parley Authors + +Permission is hereby granted, free of charge, to any +person obtaining a copy of this software and associated +documentation files (the "Software"), to deal in the +Software without restriction, including without +limitation the rights to use, copy, modify, merge, +publish, distribute, sublicense, and/or sell copies of +the Software, and to permit persons to whom the Software +is furnished to do so, subject to the following +conditions: + +The above copyright notice and this permission notice +shall be included in all copies or substantial portions +of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF +ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED +TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A +PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT +SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR +IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +DEALINGS IN THE SOFTWARE. + +```` + +Used by: femtovg 0.27.0 + +````text +Copyright 2021 Developers of the femtovg project + +Permission is hereby granted, free of charge, to any +person obtaining a copy of this software and associated +documentation files (the "Software"), to deal in the +Software without restriction, including without +limitation the rights to use, copy, modify, merge, +publish, distribute, sublicense, and/or sell copies of +the Software, and to permit persons to whom the Software +is furnished to do so, subject to the following +conditions: + +The above copyright notice and this permission notice +shall be included in all copies or substantial portions +of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF +ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED +TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A +PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT +SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR +IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +DEALINGS IN THE SOFTWARE. +```` + +Used by: softbuffer 0.4.8 + +````text +Copyright 2022 Kirill Chibisov + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies +of the Software, and to permit persons to whom the Software is furnished to do +so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL +THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. + + +```` + +Used by: dimpl 0.7.4, str0m 0.23.1 + +````text +Copyright 2022 Martin Algesten + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +```` + +Used by: prefix-trie 0.8.4 + +````text +Copyright 2022 Tibor Schneider + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +```` + +Used by: crypto-primes 0.7.2 + +````text +Copyright 2022-* Bogdan Opanchuk + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +```` + +Used by: zerocopy 0.8.58 + +````text +Copyright 2023 The Fuchsia Authors + +Permission is hereby granted, free of charge, to any +person obtaining a copy of this software and associated +documentation files (the "Software"), to deal in the +Software without restriction, including without +limitation the rights to use, copy, modify, merge, +publish, distribute, sublicense, and/or sell copies of +the Software, and to permit persons to whom the Software +is furnished to do so, subject to the following +conditions: + +The above copyright notice and this permission notice +shall be included in all copies or substantial portions +of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF +ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED +TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A +PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT +SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR +IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +DEALINGS IN THE SOFTWARE. + + +```` + +Used by: fontique 0.11.1 + +````text +Copyright 2024 the Parley Authors + +Permission is hereby granted, free of charge, to any +person obtaining a copy of this software and associated +documentation files (the "Software"), to deal in the +Software without restriction, including without +limitation the rights to use, copy, modify, merge, +publish, distribute, sublicense, and/or sell copies of +the Software, and to permit persons to whom the Software +is furnished to do so, subject to the following +conditions: + +The above copyright notice and this permission notice +shall be included in all copies or substantial portions +of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF +ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED +TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A +PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT +SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR +IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +DEALINGS IN THE SOFTWARE. + +```` + +Used by: encoding_rs 0.8.42, multiversion_no_op 1.0.0, utf8_iter 1.0.4 + +````text +Copyright Mozilla Foundation + +Permission is hereby granted, free of charge, to any +person obtaining a copy of this software and associated +documentation files (the "Software"), to deal in the +Software without restriction, including without +limitation the rights to use, copy, modify, merge, +publish, distribute, sublicense, and/or sell copies of +the Software, and to permit persons to whom the Software +is furnished to do so, subject to the following +conditions: + +The above copyright notice and this permission notice +shall be included in all copies or substantial portions +of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF +ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED +TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A +PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT +SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR +IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +DEALINGS IN THE SOFTWARE. + +```` + +Used by: libspa-sys 0.10.1, libspa 0.10.1, pipewire-sys 0.10.1, pipewire 0.10.1 + +````text +Copyright The pipewire-rs Contributors. + +Permission is hereby granted, free of charge, to any person obtaining a +copy of this software and associated documentation files (the "Software"), +to deal in the Software without restriction, including without limitation +the rights to use, copy, modify, merge, publish, distribute, sublicense, +and/or sell copies of the Software, and to permit persons to whom the +Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice (including the next +paragraph) shall be included in all copies or substantial portions of the +Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL +THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +DEALINGS IN THE SOFTWARE. + +```` + +Used by: wayland-protocols 0.32.13 + +````text +Copyright © 2008-2013 Kristian Høgsberg +Copyright © 2010-2013 Intel Corporation +Copyright © 2013 Rafael Antognolli +Copyright © 2013 Jasper St. Pierre +Copyright © 2014 Jonas Ådahl +Copyright © 2014 Jason Ekstrand +Copyright © 2014-2015 Collabora, Ltd. +Copyright © 2015 Red Hat Inc. + +Permission is hereby granted, free of charge, to any person obtaining a +copy of this software and associated documentation files (the "Software"), +to deal in the Software without restriction, including without limitation +the rights to use, copy, modify, merge, publish, distribute, sublicense, +and/or sell copies of the Software, and to permit persons to whom the +Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice (including the next +paragraph) shall be included in all copies or substantial portions of the +Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL +THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +DEALINGS IN THE SOFTWARE. + +--- + +The above is the version of the MIT "Expat" License used by X.org: + + http://cgit.freedesktop.org/xorg/xserver/tree/COPYING + +```` + +Used by: glutin-winit 0.5.0 + +````text +Copyright © 2022 Kirill Chibisov + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the “Software”), to deal +in the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies +of the Software, and to permit persons to whom the Software is furnished to do +so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL +THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. + +```` + +Used by: alsa 0.11.0 + +````text +MIT License + +Copyright (c) 2015-2021 David Henningsson, and other contributors. + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. + +```` + +Used by: field-offset 0.3.6 + +````text +MIT License + +Copyright (c) 2016-2021 Diggory Blake, and other contributors. + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. + +```` + +Used by: tree_magic_mini 3.2.2 + +````text +MIT License + +Copyright (c) 2017 Aaron Hancock + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. + +```` + +Used by: notify-rust 4.18.0 + +````text +MIT License + +Copyright (c) 2017 Hendrik Sollich + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. + +```` + +Used by: imagesize 0.15.0 + +````text +MIT License + +Copyright (c) 2017 Maiddog + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. + +```` + +Used by: static_assertions 1.1.0 + +````text +MIT License + +Copyright (c) 2017 Nikolai Vazquez + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. + +```` + +Used by: crc 3.4.0 + +````text +MIT License + +Copyright (c) 2017 crc-rs Developers + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. + +```` + +Used by: crc32fast 1.5.2 + +````text +MIT License + +Copyright (c) 2018 Sam Rijs, Alex Crichton and contributors + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. + +```` + +Used by: alsa-sys 0.4.0 + +````text +MIT License + +Copyright (c) 2018 diwic + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. + +```` + +Used by: crc-catalog 2.5.0 + +````text +MIT License + +Copyright (c) 2019 Akhil Velagapudi + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. + +```` + +Used by: enum_dispatch 0.3.13 + +````text +MIT License + +Copyright (c) 2019 Anton Lazarev + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. + +```` + +Used by: bytemuck 1.25.2, bytemuck_derive 1.12.1 + +````text +MIT License + +Copyright (c) 2019 Daniel "Lokathor" Gee. + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice (including the next paragraph) shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +```` + +Used by: rgb 0.8.53 + +````text +MIT License + +Copyright (c) 2019 Kornel + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. + +```` + +Used by: raw-window-handle 0.6.2 + +````text +MIT License + +Copyright (c) 2019 Osspial + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. + +```` + +Used by: strum 0.28.0, strum_macros 0.28.0 + +````text +MIT License + +Copyright (c) 2019 Peter Glotfelty + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. + +```` + +Used by: tokio-macros 2.7.2 + +````text +MIT License + +Copyright (c) 2019 Yoshua Wuyts +Copyright (c) Tokio Contributors + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. + +```` + +Used by: axum-core 0.5.6 + +````text +MIT License + +Copyright (c) 2019–2025 axum Contributors + +Permission is hereby granted, free of charge, to any +person obtaining a copy of this software and associated +documentation files (the "Software"), to deal in the +Software without restriction, including without +limitation the rights to use, copy, modify, merge, +publish, distribute, sublicense, and/or sell copies of +the Software, and to permit persons to whom the Software +is furnished to do so, subject to the following +conditions: + +The above copyright notice and this permission notice +shall be included in all copies or substantial portions +of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF +ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED +TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A +PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT +SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR +IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +DEALINGS IN THE SOFTWARE. +```` + +Used by: ashpd 0.13.13 + +````text +MIT License + +Copyright (c) 2020 Bilal Elmoussaoui + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. + +```` + +Used by: wide 1.7.1 + +````text +MIT License + +Copyright (c) 2020 Daniel "Lokathor" Gee + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. + +```` + +Used by: android-properties 0.2.2 + +````text +MIT License + +Copyright (c) 2020 Mikhail Lappo + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. + +```` + +Used by: xcursor 0.3.11 + +````text +MIT License + +Copyright (c) 2020 Samuele Esposito + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. + +```` + +Used by: sys-locale 0.3.2 + +````text +MIT License + +Copyright (c) 2021 1Password + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. + +```` + +Used by: tagptr 0.2.0 + +````text +MIT License + +Copyright (c) 2021 Oliver Giersch + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. + +```` + +Used by: sctp-proto 0.10.5 + +````text +MIT License + +Copyright (c) 2021-2026 WebRTC.rs +Copyright (c) 2026 Martin Algesten + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. + +```` + +Used by: rustls-platform-verifier 0.7.1 + +````text +MIT License + +Copyright (c) 2022 1Password + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. + +```` + +Used by: sctk-adwaita 0.10.1 + +````text +MIT License + +Copyright (c) 2022 Bartłomiej Maryńczak + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. + +```` + +Used by: matchit 0.8.4 + +````text +MIT License + +Copyright (c) 2022 Ibraheem Ahmed + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. + +```` + +Used by: arboard 3.6.1 + +````text +MIT License + +Copyright (c) 2022 The Arboard contributors + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. + +```` + +Used by: muda 0.19.3 + +````text +MIT License + +Copyright (c) 2022-2022 Tauri Programme within The Commons Conservancy + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. + +```` + +Used by: safe_arch 1.2.0 + +````text +MIT License + +Copyright (c) 2023 Daniel "Lokathor" Gee. + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice (including the next paragraph) shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +```` + +Used by: tiny-xlib 0.2.5 + +````text +MIT License + +Copyright (c) 2023 John Nunley + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. + +```` + +Used by: visibility 0.1.1 + +````text +MIT License + +Copyright (c) 2024 Daniel Henry-Mantilla + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. + +```` + +Used by: libopus_sys 0.3.3 + +````text +MIT License + +Copyright (c) 2024 nemurubaka + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. +```` + +Used by: task-local 0.1.1 + +````text +MIT License + +Copyright (c) 2025 Bugen Zhao + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. + +```` + +Used by: convert_case 0.10.0 + +````text +MIT License + +Copyright (c) 2025 rutrum + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. +```` + +Standard text, used by: +- accesskit 0.24.1: The AccessKit contributors (https://github.com/AccessKit/accesskit) +- accesskit_atspi_common 0.19.1: The AccessKit contributors (https://github.com/AccessKit/accesskit) +- accesskit_consumer 0.38.0: The AccessKit contributors (https://github.com/AccessKit/accesskit) +- accesskit_unix 0.22.1: The AccessKit contributors (https://github.com/AccessKit/accesskit) +- accesskit_windows 0.34.0: The AccessKit contributors (https://github.com/AccessKit/accesskit) +- aws-lc-sys 0.45.0: AWS-LC (https://github.com/aws/aws-lc-rs) +- cookie-factory 0.3.3: Geoffroy Couprie , Pierre Chifflier (https://github.com/rust-bakery/cookie-factory) +- dasp_sample 0.11.0: mitchmindtree (https://github.com/rustaudio/sample.git) +- delegate 0.13.5: Godfrey Chan , Jakub Beránek (https://github.com/kobzol/rust-delegate) +- dpi 0.1.2 (https://github.com/rust-windowing/winit) +- is 0.11.0: Martin Algesten , Thomas Eizinger (https://github.com/algesten/str0m) +- jni-macros 0.22.4 (https://github.com/jni-rs/jni-rs) +- jni-sys-macros 0.4.1: Robert Bragg (https://github.com/jni-rs/jni-sys) +- jni 0.22.4: jni team (https://github.com/jni-rs/jni-rs) +- libm 0.2.16: Alex Crichton , Amanieu d'Antras , Jorge Aparicio , Trevor Gross (https://github.com/rust-lang/compiler-builtins) +- lyon_algorithms 1.0.21: Nicolas Silva (https://github.com/nical/lyon) +- lyon_extra 1.1.0: Nicolas Silva (https://github.com/nical/lyon) +- lyon_geom 1.0.19: Nicolas Silva (https://github.com/nical/lyon) +- lyon_path 1.0.19: Nicolas Silva (https://github.com/nical/lyon) +- md5 0.8.1: Daniel McKenna , Ivan Ukhov , Kamal Ahmad , Konstantin Stepanov , Lukas Kalbertodt , Nathan Musoke , Scott Mabin , Tony Arcieri , Wim de With , Yosef Dinerstein (https://github.com/stainless-steel/md5) +- ndk-context 0.1.1: The Rust Windowing contributors (https://github.com/rust-windowing/android-ndk-rs) +- ndk-sys 0.6.0+11769913: The Rust Windowing contributors (https://github.com/rust-mobile/ndk) +- ndk 0.9.0: The Rust Mobile contributors (https://github.com/rust-mobile/ndk) +- quicklz 0.3.1: Flakebi (https://github.com/ReSpeak/quicklz) +- rcgen 0.14.10 (https://github.com/rustls/rcgen) +- realfft 3.5.0: HEnquist (https://github.com/HEnquist/realfft) +- rustls-platform-verifier-android 0.2.0 (https://github.com/rustls/rustls-platform-verifier) +- skia-bindings 0.153.3: LongYinan , Armin Sander (https://github.com/rust-skia/rust-skia) +- skia-safe 0.153.3: Armin Sander (https://github.com/rust-skia/rust-skia) +- str0m-aws-lc-rs 0.6.0: Martin Algesten (https://github.com/algesten/str0m) +- str0m-proto 0.7.0: Martin Algesten (https://github.com/algesten/str0m) +- taffy 0.10.1: Alice Cecile , Johnathan Kelley , Nico Burns (https://github.com/DioxusLabs/taffy) +- tauri-winrt-notification 0.7.3: allenbenz, Tauri Programme within The Commons Conservancy (https://github.com/tauri-apps/winrt-notification) +- windows-collections 0.2.0 (https://github.com/microsoft/windows-rs) +- windows-collections 0.3.2 (https://github.com/microsoft/windows-rs) +- windows-core 0.61.2: Microsoft (https://github.com/microsoft/windows-rs) +- windows-core 0.62.2 (https://github.com/microsoft/windows-rs) +- windows-future 0.2.1 (https://github.com/microsoft/windows-rs) +- windows-future 0.3.2 (https://github.com/microsoft/windows-rs) +- windows-implement 0.60.2 (https://github.com/microsoft/windows-rs) +- windows-interface 0.59.3 (https://github.com/microsoft/windows-rs) +- windows-link 0.1.3: Microsoft (https://github.com/microsoft/windows-rs) +- windows-link 0.2.1 (https://github.com/microsoft/windows-rs) +- windows-numerics 0.2.0 (https://github.com/microsoft/windows-rs) +- windows-numerics 0.3.1 (https://github.com/microsoft/windows-rs) +- windows-registry 0.6.1 (https://github.com/microsoft/windows-rs) +- windows-result 0.3.4: Microsoft (https://github.com/microsoft/windows-rs) +- windows-result 0.4.1 (https://github.com/microsoft/windows-rs) +- windows-strings 0.4.2: Microsoft (https://github.com/microsoft/windows-rs) +- windows-strings 0.5.1 (https://github.com/microsoft/windows-rs) +- windows-sys 0.52.0: Microsoft (https://github.com/microsoft/windows-rs) +- windows-sys 0.61.2 (https://github.com/microsoft/windows-rs) +- windows-targets 0.52.6: Microsoft (https://github.com/microsoft/windows-rs) +- windows-threading 0.1.0: Microsoft (https://github.com/microsoft/windows-rs) +- windows-threading 0.2.1 (https://github.com/microsoft/windows-rs) +- windows-version 0.1.7 (https://github.com/microsoft/windows-rs) +- windows 0.61.3: Microsoft (https://github.com/microsoft/windows-rs) +- windows 0.62.2 (https://github.com/microsoft/windows-rs) +- windows_x86_64_gnu 0.52.6: Microsoft (https://github.com/microsoft/windows-rs) +- windows_x86_64_msvc 0.52.6: Microsoft (https://github.com/microsoft/windows-rs) + +````text +MIT License + +Copyright (c) + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and +associated documentation files (the "Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the +following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial +portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT +LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO +EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER +IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE +USE OR OTHER DEALINGS IN THE SOFTWARE. + +```` + +Used by: const-field-offset-macro 0.2.1, const-field-offset 0.2.1, vtable-macro 0.5.0, vtable 0.5.0 + +````text +MIT License + +Copyright (c) + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +```` + +Used by: tokio-stream 0.1.19, tokio-util 0.7.19, tokio 1.53.1 + +````text +MIT License + +Copyright (c) Tokio Contributors + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. + +```` + +Used by: simd-adler32 0.3.10 + +````text +MIT License + +Copyright (c) [2021] [Marvin Countryman] + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. + +```` + +Used by: zune-core 0.5.3, zune-jpeg 0.5.15 + +````text +MIT License + +Copyright (c) zune-image developers + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. + +```` + +Used by: miniz_oxide 0.8.9, miniz_oxide 0.9.1 + +````text +MIT License + +Copyright 2013-2014 RAD Game Tools and Valve Software +Copyright 2010-2014 Rich Geldreich and Tenacious Software LLC +Copyright (c) 2017 Frommi +Copyright (c) 2017-2024 oyvindln + + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. + +```` + +Used by: miniz_oxide 0.8.9, miniz_oxide 0.9.1 + +````text +MIT License + +Copyright 2013-2014 RAD Game Tools and Valve Software +Copyright 2010-2014 Rich Geldreich and Tenacious Software LLC +Copyright (c) 2017 Frommi +Copyright (c) 2017-2024 oyvindln + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. + +```` + +Used by: fdeflate 0.3.7, image-webp 0.2.4, image 0.25.10 + +````text +MIT License + +Permission is hereby granted, free of charge, to any +person obtaining a copy of this software and associated +documentation files (the "Software"), to deal in the +Software without restriction, including without +limitation the rights to use, copy, modify, merge, +publish, distribute, sublicense, and/or sell copies of +the Software, and to permit persons to whom the Software +is furnished to do so, subject to the following +conditions: + +The above copyright notice and this permission notice +shall be included in all copies or substantial portions +of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF +ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED +TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A +PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT +SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR +IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +DEALINGS IN THE SOFTWARE. + +```` + +Used by: simdutf8 0.1.5 + +````text +MIT License + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. +```` + +Used by: android-activity 0.6.1, linebender_resource_handle 0.1.1, widestring 1.2.1 + +````text +MIT License + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. + +```` + +Used by: unicode-script 0.5.8 + +````text +MIT License + +Copyright (c) 2019 Manish Goregaokar + +Permission is hereby granted, free of charge, to any +person obtaining a copy of this software and associated +documentation files (the "Software"), to deal in the +Software without restriction, including without +limitation the rights to use, copy, modify, merge, +publish, distribute, sublicense, and/or sell copies of +the Software, and to permit persons to whom the Software +is furnished to do so, subject to the following +conditions: + +The above copyright notice and this permission notice +shall be included in all copies or substantial portions +of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF +ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED +TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A +PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT +SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR +IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +DEALINGS IN THE SOFTWARE. + +```` + +Used by: windows-capture 2.0.1 + +````text +MIT License + +Copyright (c) 2023 NiiightmareXD + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. + +```` + +Used by: wayland-protocols-plasma 0.3.12 + +````text +MIT License Copyright (c) + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is furnished +to do so, subject to the following conditions: + +The above copyright notice and this permission notice (including the next +paragraph) shall be included in all copies or substantial portions of the +Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS +FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS +OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF +OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +```` + +Used by: async-recursion 1.1.1, glow 0.18.0, rsa 0.10.0-rc.18, rustc-hash 2.1.3 + +````text +Permission is hereby granted, free of charge, to any +person obtaining a copy of this software and associated +documentation files (the "Software"), to deal in the +Software without restriction, including without +limitation the rights to use, copy, modify, merge, +publish, distribute, sublicense, and/or sell copies of +the Software, and to permit persons to whom the Software +is furnished to do so, subject to the following +conditions: + +The above copyright notice and this permission notice +shall be included in all copies or substantial portions +of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF +ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED +TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A +PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT +SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR +IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +DEALINGS IN THE SOFTWARE. +```` + +Used by: adler2 2.0.1, anyhow 1.0.104, async-channel 2.5.0, async-executor 1.14.0, async-io 2.6.0, async-lock 3.4.2, async-process 2.5.0, async-signal 0.2.14, async-task 4.7.1, async-trait 0.1.92, atomic-waker 1.1.2, blocking 1.7.0, concurrent-queue 2.5.0, countme 3.0.1, curve25519-dalek-derive 0.1.1, displaydoc 0.2.7, endi 1.1.1, event-listener-strategy 0.5.4, event-listener 5.4.2, fastrand 2.5.0, futures-lite 2.6.1, group 0.13.0, group 0.14.0, itoa 1.0.18, linux-raw-sys 0.12.1, linux-raw-sys 0.4.15, num_enum 0.7.6, num_enum_derive 0.7.6, once_cell 1.21.4, ordered-stream 0.2.0, parking 2.2.1, pastey 0.2.3, pin-project-internal 1.1.13, pin-project-lite 0.2.17, pin-project 1.1.13, piper 0.2.5, polling 3.11.0, portable-atomic 1.15.0, proc-macro-crate 3.5.0, proc-macro2 1.0.107, quote 1.0.47, ref-cast-impl 1.0.27, ref-cast 1.0.27, rowan 0.17.0, rtrb 0.4.0, rustc-hash 1.1.0, rustix 0.38.44, rustix 1.1.5, rustversion 1.0.23, serde 1.0.229, serde_core 1.0.229, serde_derive 1.0.229, serde_json 1.0.151, serde_path_to_error 0.1.20, serde_repr 0.1.21, simd_cesu8 1.2.0, smol_str 0.2.2, smol_str 0.3.6, spin_on 0.1.1, syn 2.0.119, syn 3.0.6, thiserror-impl 1.0.69, thiserror-impl 2.0.21, thiserror 1.0.69, thiserror 2.0.21, unicode-ident 1.0.26, x11-dl 2.21.0, zbus-lockstep-macros 0.5.2, zbus-lockstep 0.5.2, zmij 1.0.23, zvariant_utils 4.2.0 + +````text +Permission is hereby granted, free of charge, to any +person obtaining a copy of this software and associated +documentation files (the "Software"), to deal in the +Software without restriction, including without +limitation the rights to use, copy, modify, merge, +publish, distribute, sublicense, and/or sell copies of +the Software, and to permit persons to whom the Software +is furnished to do so, subject to the following +conditions: + +The above copyright notice and this permission notice +shall be included in all copies or substantial portions +of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF +ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED +TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A +PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT +SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR +IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +DEALINGS IN THE SOFTWARE. + +```` + +Used by: allocator-api2 0.2.21, text-size 1.1.1 + +````text +Permission is hereby granted, free of charge, to any +person obtaining a copy of this software and associated +documentation files (the "Software"), to deal in the +Software without restriction, including without +limitation the rights to use, copy, modify, merge, +publish, distribute, sublicense, and/or sell copies of +the Software, and to permit persons to whom the Software +is furnished to do so, subject to the following +conditions: + +The above copyright notice and this permission notice +shall be included in all copies or substantial portions +of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF +ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED +TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A +PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT +SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR +IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +DEALINGS IN THE SOFTWARE. + +```` + +Used by: winnow 1.0.4 + +````text +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +```` + +Used by: siphasher 1.0.4 + +````text +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. + +```` + +Used by: ctor 0.10.1 + +````text +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +```` + +Used by: tinyvec 1.13.3 + +````text +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +```` + +Used by: pulldown-cmark 0.13.4 + +````text +The MIT License + +Copyright 2015 Google Inc. All rights reserved. + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. + +```` + +Used by: android_system_properties 0.1.6 + +````text +The MIT License (MIT) + +Copyright (c) 2013 Nicolas Silva + +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the "Software"), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of +the Software, and to permit persons to whom the Software is furnished to do so, +subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS +FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR +COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER +IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +```` + +Used by: tracing-core 0.1.36 + +````text +The MIT License (MIT) + +Copyright (c) 2014 Mathijs van de Nes + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. + +```` + +Used by: typenum 1.20.1 + +````text +The MIT License (MIT) + +Copyright (c) 2014 Paho Lurie-Gregg + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. + +```` + +Used by: chrono 0.4.45 + +````text +The MIT License (MIT) + +Copyright (c) 2014, Kang Seonghoon. + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. +```` + +Used by: phf 0.13.1, phf_generator 0.13.1, phf_macros 0.13.1, phf_shared 0.13.1 + +````text +The MIT License (MIT) + +Copyright (c) 2014-2022 Steven Fackler, Yuki Okushi + +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the "Software"), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of +the Software, and to permit persons to whom the Software is furnished to do so, +subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS +FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR +COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER +IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +```` + +Used by: base64 0.22.1 + +````text +The MIT License (MIT) + +Copyright (c) 2015 Alice Maz + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. + +```` + +Used by: aho-corasick 1.1.5, byteorder-lite 0.1.0, byteorder 1.5.0, csv-core 0.1.13, csv 1.4.0, memchr 2.8.3 + +````text +The MIT License (MIT) + +Copyright (c) 2015 Andrew Gallant + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. + +```` + +Used by: nix 0.31.3 + +````text +The MIT License (MIT) + +Copyright (c) 2015 Carl Lerche + nix-rust Authors + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. + +```` + +Used by: strsim 0.11.1 + +````text +The MIT License (MIT) + +Copyright (c) 2015 Danny Guo +Copyright (c) 2016 Titus Wormer +Copyright (c) 2018 Akash Kurdekar + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. + +```` + +Used by: combine 4.6.8 + +````text +The MIT License (MIT) + +Copyright (c) 2015 Markus Westerlind + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. + + +```` + +Used by: gif 0.14.2 + +````text +The MIT License (MIT) + +Copyright (c) 2015 nwin + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. + +```` + +Used by: data-encoding 2.11.1 + +````text +The MIT License (MIT) + +Copyright (c) 2015-2020 Julien Cretin +Copyright (c) 2017-2020 Google Inc. + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. + +```` + +Used by: webbrowser 1.2.4 + +````text +The MIT License (MIT) + +Copyright (c) 2015-2022 Amod Malviya + +Permission is hereby granted, free of charge, to any +person obtaining a copy of this software and associated +documentation files (the "Software"), to deal in the +Software without restriction, including without +limitation the rights to use, copy, modify, merge, +publish, distribute, sublicense, and/or sell copies of +the Software, and to permit persons to whom the Software +is furnished to do so, subject to the following +conditions: + +The above copyright notice and this permission notice +shall be included in all copies or substantial portions +of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF +ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED +TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A +PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT +SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR +IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +DEALINGS IN THE SOFTWARE. + +```` + +Used by: derive_more-impl 2.1.1, derive_more 2.1.1 + +````text +The MIT License (MIT) + +Copyright (c) 2016 Jelte Fennema + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. + +```` + +Used by: color_quant 1.1.0 + +````text +The MIT License (MIT) + +Copyright (c) 2016 PistonDevelopers + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. + +```` + +Used by: ff 0.13.1, ff 0.14.0 + +````text +The MIT License (MIT) + +Copyright (c) 2017 Sean Bowe + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. + +```` + +Used by: htmlparser 0.2.1, simplecss 0.2.2, unicode-vo 0.1.0 + +````text +The MIT License (MIT) + +Copyright (c) 2018 Reizner Evgeniy + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. + +```` + +Used by: roxmltree 0.21.1 + +````text +The MIT License (MIT) + +Copyright (c) 2018 Yevhenii Reizner + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. + +```` + +Used by: xmlwriter 0.1.0 + +````text +The MIT License (MIT) + +Copyright (c) 2019 Reizner Evgeniy + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. + +```` + +Used by: crossbeam-channel 0.5.17, crossbeam-deque 0.8.8, crossbeam-epoch 0.9.21, crossbeam-utils 0.8.23 + +````text +The MIT License (MIT) + +Copyright (c) 2019 The Crossbeam Project Developers + +Permission is hereby granted, free of charge, to any +person obtaining a copy of this software and associated +documentation files (the "Software"), to deal in the +Software without restriction, including without +limitation the rights to use, copy, modify, merge, +publish, distribute, sublicense, and/or sell copies of +the Software, and to permit persons to whom the Software +is furnished to do so, subject to the following +conditions: + +The above copyright notice and this permission notice +shall be included in all copies or substantial portions +of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF +ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED +TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A +PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT +SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR +IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +DEALINGS IN THE SOFTWARE. + +```` + +Used by: omnom 3.0.0 + +````text +The MIT License (MIT) + +Copyright (c) 2019 Yoshua Wuyts + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. + +```` + +Used by: fontdb 0.24.0 + +````text +The MIT License (MIT) + +Copyright (c) 2020 Yevhenii Reizner + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. + +```` + +Used by: async-broadcast 0.7.2 + +````text +The MIT License (MIT) + +Copyright (c) 2020 Yoshua Wuyts + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. + +```` + +Used by: xkbcommon-dl 0.4.2 + +````text +The MIT License (MIT) + +Copyright (c) 2023 Kirill Chibisov + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. + +```` + +Used by: base64 0.23.1 + +````text +The MIT License (MIT) + +Copyright (c) 2025 Alice Maz, Marshall Pierce + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. + +```` + +Used by: harfrust 0.12.0 + +````text +The MIT License (MIT) + +Copyright (c) HarfBuzz developers +Copyright (c) 2020 Yevhenii Reizner + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. + +```` + +Used by: weezl 0.1.12 + +````text +The MIT License (MIT) + +Copyright (c) HeroicKatora 2020 + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. + + +```` + +Used by: yeslogic-fontconfig-sys 6.0.1 + +````text +The MIT License (MIT) + +Copyright 2019 YesLogic Pty. Ltd. +Copyright 2016 Manuel Reinhardt +Copyright 2014 Austin Bonander +Copyright 2013 The Servo Project Developers. + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. + + +```` + +Used by: os_pipe 1.2.3 + +````text +The MIT License (MIT) + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. + +```` + +Used by: nu-ansi-term 0.50.3 + +````text +The MIT License (MIT) + +Copyright (c) 2014 Benjamin Sago +Copyright (c) 2021-2022 The Nushell Project Developers + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. + +```` + +Used by: generic-array 0.14.7, generic-array 1.4.5 + +````text +The MIT License (MIT) + +Copyright (c) 2015 Bartłomiej Kamiński + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. +```` + +Used by: quick-xml 0.41.0 + +````text +The MIT License (MIT) + +Copyright (c) 2016 Johann Tuffe + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. + +```` + +Used by: hashlink 0.12.2 + +````text +This work is derived in part from the `linked-hash-map` crate, Copyright (c) +2015 The Rust Project Developers + +Permission is hereby granted, free of charge, to any +person obtaining a copy of this software and associated +documentation files (the "Software"), to deal in the +Software without restriction, including without +limitation the rights to use, copy, modify, merge, +publish, distribute, sublicense, and/or sell copies of +the Software, and to permit persons to whom the Software +is furnished to do so, subject to the following +conditions: + +The above copyright notice and this permission notice +shall be included in all copies or substantial portions +of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF +ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED +TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A +PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT +SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR +IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +DEALINGS IN THE SOFTWARE. +```` + +### Mozilla Public License 2.0 + +Standard text, used by: +- libvpx-native-sys 5.0.17: Kornel Lesiński , Richard Diamond (https://github.com/kornelski/rust-vpx) +- option-ext 0.2.0: Simon Ochsenreither (https://github.com/soc/option-ext.git) + +````text +Mozilla Public License Version 2.0 +================================== + +1. Definitions +-------------- + +1.1. "Contributor" + means each individual or legal entity that creates, contributes to + the creation of, or owns Covered Software. + +1.2. "Contributor Version" + means the combination of the Contributions of others (if any) used + by a Contributor and that particular Contributor's Contribution. + +1.3. "Contribution" + means Covered Software of a particular Contributor. + +1.4. "Covered Software" + means Source Code Form to which the initial Contributor has attached + the notice in Exhibit A, the Executable Form of such Source Code + Form, and Modifications of such Source Code Form, in each case + including portions thereof. + +1.5. "Incompatible With Secondary Licenses" + means + + (a) that the initial Contributor has attached the notice described + in Exhibit B to the Covered Software; or + + (b) that the Covered Software was made available under the terms of + version 1.1 or earlier of the License, but not also under the + terms of a Secondary License. + +1.6. "Executable Form" + means any form of the work other than Source Code Form. + +1.7. "Larger Work" + means a work that combines Covered Software with other material, in + a separate file or files, that is not Covered Software. + +1.8. "License" + means this document. + +1.9. "Licensable" + means having the right to grant, to the maximum extent possible, + whether at the time of the initial grant or subsequently, any and + all of the rights conveyed by this License. + +1.10. "Modifications" + means any of the following: + + (a) any file in Source Code Form that results from an addition to, + deletion from, or modification of the contents of Covered + Software; or + + (b) any new file in Source Code Form that contains any Covered + Software. + +1.11. "Patent Claims" of a Contributor + means any patent claim(s), including without limitation, method, + process, and apparatus claims, in any patent Licensable by such + Contributor that would be infringed, but for the grant of the + License, by the making, using, selling, offering for sale, having + made, import, or transfer of either its Contributions or its + Contributor Version. + +1.12. "Secondary License" + means either the GNU General Public License, Version 2.0, the GNU + Lesser General Public License, Version 2.1, the GNU Affero General + Public License, Version 3.0, or any later versions of those + licenses. + +1.13. "Source Code Form" + means the form of the work preferred for making modifications. + +1.14. "You" (or "Your") + means an individual or a legal entity exercising rights under this + License. For legal entities, "You" includes any entity that + controls, is controlled by, or is under common control with You. For + purposes of this definition, "control" means (a) the power, direct + or indirect, to cause the direction or management of such entity, + whether by contract or otherwise, or (b) ownership of more than + fifty percent (50%) of the outstanding shares or beneficial + ownership of such entity. + +2. License Grants and Conditions +-------------------------------- + +2.1. Grants + +Each Contributor hereby grants You a world-wide, royalty-free, +non-exclusive license: + +(a) under intellectual property rights (other than patent or trademark) + Licensable by such Contributor to use, reproduce, make available, + modify, display, perform, distribute, and otherwise exploit its + Contributions, either on an unmodified basis, with Modifications, or + as part of a Larger Work; and + +(b) under Patent Claims of such Contributor to make, use, sell, offer + for sale, have made, import, and otherwise transfer either its + Contributions or its Contributor Version. + +2.2. Effective Date + +The licenses granted in Section 2.1 with respect to any Contribution +become effective for each Contribution on the date the Contributor first +distributes such Contribution. + +2.3. Limitations on Grant Scope + +The licenses granted in this Section 2 are the only rights granted under +this License. No additional rights or licenses will be implied from the +distribution or licensing of Covered Software under this License. +Notwithstanding Section 2.1(b) above, no patent license is granted by a +Contributor: + +(a) for any code that a Contributor has removed from Covered Software; + or + +(b) for infringements caused by: (i) Your and any other third party's + modifications of Covered Software, or (ii) the combination of its + Contributions with other software (except as part of its Contributor + Version); or + +(c) under Patent Claims infringed by Covered Software in the absence of + its Contributions. + +This License does not grant any rights in the trademarks, service marks, +or logos of any Contributor (except as may be necessary to comply with +the notice requirements in Section 3.4). + +2.4. Subsequent Licenses + +No Contributor makes additional grants as a result of Your choice to +distribute the Covered Software under a subsequent version of this +License (see Section 10.2) or under the terms of a Secondary License (if +permitted under the terms of Section 3.3). + +2.5. Representation + +Each Contributor represents that the Contributor believes its +Contributions are its original creation(s) or it has sufficient rights +to grant the rights to its Contributions conveyed by this License. + +2.6. Fair Use + +This License is not intended to limit any rights You have under +applicable copyright doctrines of fair use, fair dealing, or other +equivalents. + +2.7. Conditions + +Sections 3.1, 3.2, 3.3, and 3.4 are conditions of the licenses granted +in Section 2.1. + +3. Responsibilities +------------------- + +3.1. Distribution of Source Form + +All distribution of Covered Software in Source Code Form, including any +Modifications that You create or to which You contribute, must be under +the terms of this License. You must inform recipients that the Source +Code Form of the Covered Software is governed by the terms of this +License, and how they can obtain a copy of this License. You may not +attempt to alter or restrict the recipients' rights in the Source Code +Form. + +3.2. Distribution of Executable Form + +If You distribute Covered Software in Executable Form then: + +(a) such Covered Software must also be made available in Source Code + Form, as described in Section 3.1, and You must inform recipients of + the Executable Form how they can obtain a copy of such Source Code + Form by reasonable means in a timely manner, at a charge no more + than the cost of distribution to the recipient; and + +(b) You may distribute such Executable Form under the terms of this + License, or sublicense it under different terms, provided that the + license for the Executable Form does not attempt to limit or alter + the recipients' rights in the Source Code Form under this License. + +3.3. Distribution of a Larger Work + +You may create and distribute a Larger Work under terms of Your choice, +provided that You also comply with the requirements of this License for +the Covered Software. If the Larger Work is a combination of Covered +Software with a work governed by one or more Secondary Licenses, and the +Covered Software is not Incompatible With Secondary Licenses, this +License permits You to additionally distribute such Covered Software +under the terms of such Secondary License(s), so that the recipient of +the Larger Work may, at their option, further distribute the Covered +Software under the terms of either this License or such Secondary +License(s). + +3.4. Notices + +You may not remove or alter the substance of any license notices +(including copyright notices, patent notices, disclaimers of warranty, +or limitations of liability) contained within the Source Code Form of +the Covered Software, except that You may alter any license notices to +the extent required to remedy known factual inaccuracies. + +3.5. Application of Additional Terms + +You may choose to offer, and to charge a fee for, warranty, support, +indemnity or liability obligations to one or more recipients of Covered +Software. However, You may do so only on Your own behalf, and not on +behalf of any Contributor. You must make it absolutely clear that any +such warranty, support, indemnity, or liability obligation is offered by +You alone, and You hereby agree to indemnify every Contributor for any +liability incurred by such Contributor as a result of warranty, support, +indemnity or liability terms You offer. You may include additional +disclaimers of warranty and limitations of liability specific to any +jurisdiction. + +4. Inability to Comply Due to Statute or Regulation +--------------------------------------------------- + +If it is impossible for You to comply with any of the terms of this +License with respect to some or all of the Covered Software due to +statute, judicial order, or regulation then You must: (a) comply with +the terms of this License to the maximum extent possible; and (b) +describe the limitations and the code they affect. Such description must +be placed in a text file included with all distributions of the Covered +Software under this License. Except to the extent prohibited by statute +or regulation, such description must be sufficiently detailed for a +recipient of ordinary skill to be able to understand it. + +5. Termination +-------------- + +5.1. The rights granted under this License will terminate automatically +if You fail to comply with any of its terms. However, if You become +compliant, then the rights granted under this License from a particular +Contributor are reinstated (a) provisionally, unless and until such +Contributor explicitly and finally terminates Your grants, and (b) on an +ongoing basis, if such Contributor fails to notify You of the +non-compliance by some reasonable means prior to 60 days after You have +come back into compliance. Moreover, Your grants from a particular +Contributor are reinstated on an ongoing basis if such Contributor +notifies You of the non-compliance by some reasonable means, this is the +first time You have received notice of non-compliance with this License +from such Contributor, and You become compliant prior to 30 days after +Your receipt of the notice. + +5.2. If You initiate litigation against any entity by asserting a patent +infringement claim (excluding declaratory judgment actions, +counter-claims, and cross-claims) alleging that a Contributor Version +directly or indirectly infringes any patent, then the rights granted to +You by any and all Contributors for the Covered Software under Section +2.1 of this License shall terminate. + +5.3. In the event of termination under Sections 5.1 or 5.2 above, all +end user license agreements (excluding distributors and resellers) which +have been validly granted by You or Your distributors under this License +prior to termination shall survive termination. + +************************************************************************ +* * +* 6. Disclaimer of Warranty * +* ------------------------- * +* * +* Covered Software is provided under this License on an "as is" * +* basis, without warranty of any kind, either expressed, implied, or * +* statutory, including, without limitation, warranties that the * +* Covered Software is free of defects, merchantable, fit for a * +* particular purpose or non-infringing. The entire risk as to the * +* quality and performance of the Covered Software is with You. * +* Should any Covered Software prove defective in any respect, You * +* (not any Contributor) assume the cost of any necessary servicing, * +* repair, or correction. This disclaimer of warranty constitutes an * +* essential part of this License. No use of any Covered Software is * +* authorized under this License except under this disclaimer. * +* * +************************************************************************ + +************************************************************************ +* * +* 7. Limitation of Liability * +* -------------------------- * +* * +* Under no circumstances and under no legal theory, whether tort * +* (including negligence), contract, or otherwise, shall any * +* Contributor, or anyone who distributes Covered Software as * +* permitted above, be liable to You for any direct, indirect, * +* special, incidental, or consequential damages of any character * +* including, without limitation, damages for lost profits, loss of * +* goodwill, work stoppage, computer failure or malfunction, or any * +* and all other commercial damages or losses, even if such party * +* shall have been informed of the possibility of such damages. This * +* limitation of liability shall not apply to liability for death or * +* personal injury resulting from such party's negligence to the * +* extent applicable law prohibits such limitation. Some * +* jurisdictions do not allow the exclusion or limitation of * +* incidental or consequential damages, so this exclusion and * +* limitation may not apply to You. * +* * +************************************************************************ + +8. Litigation +------------- + +Any litigation relating to this License may be brought only in the +courts of a jurisdiction where the defendant maintains its principal +place of business and such litigation shall be governed by laws of that +jurisdiction, without reference to its conflict-of-law provisions. +Nothing in this Section shall prevent a party's ability to bring +cross-claims or counter-claims. + +9. Miscellaneous +---------------- + +This License represents the complete agreement concerning the subject +matter hereof. If any provision of this License is held to be +unenforceable, such provision shall be reformed only to the extent +necessary to make it enforceable. Any law or regulation which provides +that the language of a contract shall be construed against the drafter +shall not be used to construe this License against a Contributor. + +10. Versions of the License +--------------------------- + +10.1. New Versions + +Mozilla Foundation is the license steward. Except as provided in Section +10.3, no one other than the license steward has the right to modify or +publish new versions of this License. Each version will be given a +distinguishing version number. + +10.2. Effect of New Versions + +You may distribute the Covered Software under the terms of the version +of the License under which You originally received the Covered Software, +or under the terms of any subsequent version published by the license +steward. + +10.3. Modified Versions + +If you create software not governed by this License, and you want to +create a new license for such software, you may create and use a +modified version of this License if you rename the license and remove +any references to the name of the license steward (except to note that +such modified license differs from this License). + +10.4. Distributing Source Code Form that is Incompatible With Secondary +Licenses + +If You choose to distribute Source Code Form that is Incompatible With +Secondary Licenses under the terms of this version of the License, the +notice described in Exhibit B of this License must be attached. + +Exhibit A - Source Code Form License Notice +------------------------------------------- + + This Source Code Form is subject to the terms of the Mozilla Public + License, v. 2.0. If a copy of the MPL was not distributed with this + file, You can obtain one at https://mozilla.org/MPL/2.0/. + +If it is not possible or desirable to put the notice in a particular +file, then You may include the notice in a location (such as a LICENSE +file in a relevant directory) where a recipient would be likely to look +for such a notice. + +You may add additional accurate notices of copyright ownership. + +Exhibit B - "Incompatible With Secondary Licenses" Notice +--------------------------------------------------------- + + This Source Code Form is "Incompatible With Secondary Licenses", as + defined by the Mozilla Public License, v. 2.0. + +```` + +### Unicode License v3 + +Used by: unicode-ident 1.0.26 + +````text +UNICODE LICENSE V3 + +COPYRIGHT AND PERMISSION NOTICE + +Copyright © 1991-2023 Unicode, Inc. + +NOTICE TO USER: Carefully read the following legal agreement. BY +DOWNLOADING, INSTALLING, COPYING OR OTHERWISE USING DATA FILES, AND/OR +SOFTWARE, YOU UNEQUIVOCALLY ACCEPT, AND AGREE TO BE BOUND BY, ALL OF THE +TERMS AND CONDITIONS OF THIS AGREEMENT. IF YOU DO NOT AGREE, DO NOT +DOWNLOAD, INSTALL, COPY, DISTRIBUTE OR USE THE DATA FILES OR SOFTWARE. + +Permission is hereby granted, free of charge, to any person obtaining a +copy of data files and any associated documentation (the "Data Files") or +software and any associated documentation (the "Software") to deal in the +Data Files or Software without restriction, including without limitation +the rights to use, copy, modify, merge, publish, distribute, and/or sell +copies of the Data Files or Software, and to permit persons to whom the +Data Files or Software are furnished to do so, provided that either (a) +this copyright and permission notice appear with all copies of the Data +Files or Software, or (b) this copyright and permission notice appear in +associated Documentation. + +THE DATA FILES AND SOFTWARE ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY +KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF +THIRD PARTY RIGHTS. + +IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS INCLUDED IN THIS NOTICE +BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT OR CONSEQUENTIAL DAMAGES, +OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, +WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, +ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THE DATA +FILES OR SOFTWARE. + +Except as contained in this notice, the name of a copyright holder shall +not be used in advertising or otherwise to promote the sale, use or other +dealings in these Data Files or Software without prior written +authorization of the copyright holder. + +```` + +Used by: fixed_decimal 0.7.2, icu_collections 2.3.0, icu_decimal 2.3.0, icu_decimal_data 2.3.0, icu_locale_core 2.3.0, icu_locale_fallback 2.3.0, icu_locale_fallback_data 2.3.0, icu_normalizer 2.3.0, icu_normalizer_data 2.3.0, icu_properties 2.3.0, icu_properties_data 2.3.0, icu_provider 2.3.1, icu_segmenter 2.3.0, icu_segmenter_data 2.3.0, litemap 0.8.3, potential_utf 0.1.6, tinystr 0.8.4, writeable 0.6.4, yoke-derive 0.8.3, yoke 0.8.3, zerofrom-derive 0.1.8, zerofrom 0.1.8, zerotrie 0.2.5, zerovec-derive 0.11.6, zerovec 0.11.8 + +````text +UNICODE LICENSE V3 + +COPYRIGHT AND PERMISSION NOTICE + +Copyright © 2020-2024 Unicode, Inc. + +NOTICE TO USER: Carefully read the following legal agreement. BY +DOWNLOADING, INSTALLING, COPYING OR OTHERWISE USING DATA FILES, AND/OR +SOFTWARE, YOU UNEQUIVOCALLY ACCEPT, AND AGREE TO BE BOUND BY, ALL OF THE +TERMS AND CONDITIONS OF THIS AGREEMENT. IF YOU DO NOT AGREE, DO NOT +DOWNLOAD, INSTALL, COPY, DISTRIBUTE OR USE THE DATA FILES OR SOFTWARE. + +Permission is hereby granted, free of charge, to any person obtaining a +copy of data files and any associated documentation (the "Data Files") or +software and any associated documentation (the "Software") to deal in the +Data Files or Software without restriction, including without limitation +the rights to use, copy, modify, merge, publish, distribute, and/or sell +copies of the Data Files or Software, and to permit persons to whom the +Data Files or Software are furnished to do so, provided that either (a) +this copyright and permission notice appear with all copies of the Data +Files or Software, or (b) this copyright and permission notice appear in +associated Documentation. + +THE DATA FILES AND SOFTWARE ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY +KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF +THIRD PARTY RIGHTS. + +IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS INCLUDED IN THIS NOTICE +BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT OR CONSEQUENTIAL DAMAGES, +OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, +WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, +ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THE DATA +FILES OR SOFTWARE. + +Except as contained in this notice, the name of a copyright holder shall +not be used in advertising or otherwise to promote the sale, use or other +dealings in these Data Files or Software without prior written +authorization of the copyright holder. + +SPDX-License-Identifier: Unicode-3.0 + +— + +Portions of ICU4X may have been adapted from ICU4C and/or ICU4J. +ICU 1.8.1 to ICU 57.1 © 1995-2016 International Business Machines Corporation and others. + +```` + +### The Unlicense + +Used by: ksni 0.3.6 + +````text +This is free and unencumbered software released into the public domain. + +Anyone is free to copy, modify, publish, use, compile, sell, or +distribute this software, either in source code form or as a compiled +binary, for any purpose, commercial or non-commercial, and by any +means. + +In jurisdictions that recognize copyright laws, the author or authors +of this software dedicate any and all copyright interest in the +software to the public domain. We make this dedication for the benefit +of the public at large and to the detriment of our heirs and +successors. We intend this dedication to be an overt act of +relinquishment in perpetuity of all present and future rights to this +software under copyright law. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR +OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, +ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +OTHER DEALINGS IN THE SOFTWARE. + +For more information, please refer to + +```` + +### zlib License + +Used by: slotmap 1.1.1 + +````text +Copyright (c) 2021 Orson Peters + +This software is provided 'as-is', without any express or implied warranty. In +no event will the authors be held liable for any damages arising from the use of +this software. + +Permission is granted to anyone to use this software for any purpose, including +commercial applications, and to alter it and redistribute it freely, subject to +the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not claim + that you wrote the original software. If you use this software in a product, + an acknowledgment in the product documentation would be appreciated but is + not required. + + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + + 3. This notice may not be removed or altered from any source distribution. + +```` + +Used by: foldhash 0.1.5, foldhash 0.2.0 + +````text +Copyright (c) 2024 Orson Peters + +This software is provided 'as-is', without any express or implied warranty. In +no event will the authors be held liable for any damages arising from the use of +this software. + +Permission is granted to anyone to use this software for any purpose, including +commercial applications, and to alter it and redistribute it freely, subject to +the following restrictions: + +1. The origin of this software must not be misrepresented; you must not claim + that you wrote the original software. If you use this software in a product, + an acknowledgment in the product documentation would be appreciated but is + not required. + +2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + +3. This notice may not be removed or altered from any source distribution. +```` + +### bzip2 and libbzip2 License v1.0.6 + +Used by: libbz2-rs-sys 0.2.5 + +````text + +-------------------------------------------------------------------------- + +The original program, "bzip2", the associated library "libbzip2", and all +documentation, are + +Copyright (C) 1996-2021 Julian R Seward. +Copyright (C) 2019-2020 Federico Mena Quintero +Copyright (C) 2021 Micah Snyder + +This Rust translation, "libbzip2-rs" is a derived work based on "bzip2" and +"libbzip2", and is Copyright (C) 2024-2025 Trifecta Tech Foundation and contributors + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions +are met: + +1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + +2. The origin of this software must not be misrepresented; you must + not claim that you wrote the original software. If you use this + software in a product, an acknowledgment in the product + documentation would be appreciated but is not required. + +3. Altered source versions must be plainly marked as such, and must + not be misrepresented as being the original software. + +4. The name of the author may not be used to endorse or promote + products derived from this software without specific prior written + permission. + +THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS +OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY +DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE +GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, +WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +Julian Seward, jseward@acm.org +bzip2/libbzip2 version 1.1.0 of 6 September 2010 + +-------------------------------------------------------------------------- + +```` diff --git a/about.hbs b/about.hbs new file mode 100644 index 0000000..926f2e7 --- /dev/null +++ b/about.hbs @@ -0,0 +1,199 @@ +# Third-party notices + + + +This app is licensed under MIT OR Apache-2.0. It contains the third-party +software listed here, whose licenses require these notices. + +## Slint + +The user interface is built with Slint (https://slint.dev), used under the +Slint Royalty-free Desktop, Mobile, and Web Applications License 2.0 +(LicenseRef-Slint-Royalty-free-2.0, full text below). As that license requires, +the About page shows the AboutSlint widget. + +## OpenH264 + +OpenH264 Video Codec provided by Cisco Systems, Inc. + +The app does not include OpenH264. Only when you enable H.264 does it download +Cisco's prebuilt OpenH264 binary from ciscobinary.openh264.org, check it +against known checksums and load it at runtime; you can disable it again at +any time. Cisco distributes that binary under the BSD-2-Clause license +(Copyright (c) 2013, Cisco Systems; text below, used by openh264-sys2) and +covers the MPEG LA H.264 patent royalties for it. + +## tsclientlib + +The TeamSpeak protocol implementation is a fork of tsclientlib +(https://github.com/ReSpeak/tsclientlib), licensed under MIT OR Apache-2.0: + +````text +The MIT License (MIT) + +Copyright (c) 2017-2020 tsclientlib contributors + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. +```` + +## Native libraries + +- Opus (libopus), compiled into the app: BSD-3-Clause, Copyright 2001-2023 + Xiph.Org and contributors; text below, used by libopus_sys. +- AWS-LC (with code from BoringSSL and OpenSSL), compiled into the app: + notices and texts below under ISC, used by aws-lc-sys. +- libvpx (VP8 and VP9): the system library on Linux, compiled into the app on + Windows. Its license and patent grant: + +````text +Copyright (c) 2010, The WebM Project authors. All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are +met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + + * Neither the name of Google, nor the WebM Project, nor the names + of its contributors may be used to endorse or promote products + derived from this software without specific prior written + permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +Additional IP Rights Grant (Patents) +------------------------------------ + +"These implementations" means the copyrightable works that implement the WebM +codecs distributed by Google as part of the WebM Project. + +Google hereby grants to you a perpetual, worldwide, non-exclusive, no-charge, +royalty-free, irrevocable (except as stated in this section) patent license to +make, have made, use, offer to sell, sell, import, transfer, and otherwise +run, modify and propagate the contents of these implementations of WebM, where +such license applies only to those patent claims, both currently owned by +Google and acquired in the future, licensable by Google that are necessarily +infringed by these implementations of WebM. This grant does not include claims +that would be infringed only as a consequence of further modification of these +implementations. If you or your agent or exclusive licensee institute or order +or agree to the institution of patent litigation or any other patent +enforcement activity against any entity (including a cross-claim or +counterclaim in a lawsuit) alleging that any of these implementations of WebM +or any code incorporated within any of these implementations of WebM +constitute direct or contributory patent infringement, or inducement of +patent infringement, then any patent rights granted to you under this License +for these implementations of WebM shall terminate as of the date such +litigation is filed. +```` + +- Skia (Android app only: Slint draws with it there), compiled into the app + from rust-skia's prebuilt binaries (skia-bindings). Its license: + +````text +Copyright (c) 2011 Google Inc. All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are +met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + + * Neither the name of the copyright holder nor the names of its + contributors may be used to endorse or promote products derived + from this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +```` + + The Skia build includes further libraries under their own licenses: + FreeType (FreeType License: portions of this software are copyright © The + FreeType Project, www.freetype.org, all rights reserved), libpng (PNG + Reference Library License), libjpeg-turbo (IJG License, BSD-3-Clause and + zlib License: this software is based in part on the work of the Independent + JPEG Group), zlib (zlib License), Expat (MIT), Wuffs (Apache-2.0) and the + Vulkan Memory Allocator (MIT). + +Other system libraries the app uses at runtime (ALSA, PipeWire, fontconfig, +xkbcommon, the C and C++ runtimes) belong to the operating system and are not +distributed with it. + +## Rust crates + +Licenses of the Rust crates compiled into the apps, with the crates using +each text. Where a crate offers a choice of licenses, the one shown is the one +this app uses. Texts marked "standard text" were not included in the crate; +the crate's authors are listed as its copyright holders. + +| License | Crates | +|---|---| +{{#each overview}} +| {{{name}}} | {{count}} | +{{/each}} +{{#each licenses}} +{{#if first_of_kind}} + +### {{{name}}} +{{/if}} + +{{#if source_path}} +Used by: {{#each used_by}}{{#unless @first}}, {{/unless}}{{{crate.name}}} {{{crate.version}}}{{/each}} +{{else}} +Standard text, used by: +{{#each used_by}} +- {{{crate.name}}} {{{crate.version}}}{{#if crate.authors}}: {{#each crate.authors}}{{#unless @first}}, {{/unless}}{{{this}}}{{/each}}{{/if}}{{#if crate.repository}} ({{{crate.repository}}}){{/if}} +{{/each}} +{{/if}} + +````text +{{{text}}} +```` +{{/each}} diff --git a/about.toml b/about.toml new file mode 100644 index 0000000..896b84a --- /dev/null +++ b/about.toml @@ -0,0 +1,185 @@ +# cargo-about configuration for THIRD_PARTY_NOTICES.md: scripts/notices.sh +# renders about.hbs with it (see docs/release.md). Reference: +# https://embarkstudios.github.io/cargo-about/cli/generate/config.html +# +# The accepted licenses are deny.toml's `[licenses] allow` list; their order is +# the preference when a crate offers a choice ("MIT OR Apache-2.0" shows MIT). + +accepted = [ + "MIT", + "Apache-2.0", + "Apache-2.0 WITH LLVM-exception", + "BSD-2-Clause", + "BSD-3-Clause", + "ISC", + "Zlib", + "Unicode-3.0", + "CDLA-Permissive-2.0", + "MPL-2.0", + "BSL-1.0", + "Unlicense", + # Slint: GPL-3.0-only OR royalty-free OR commercial. We use the royalty-free + # license, which requires the AboutSlint widget in the About page. + "LicenseRef-Slint-Royalty-free-2.0", + # libbz2-rs-sys (unpacks Cisco's OpenH264 download in voelin-media). + "bzip2-1.0.6", +] + +# What the apps ship on: the desktop app on Linux (x86_64, and aarch64 for +# Flathub) and Windows, and the Android app. Crates used only on other +# platforms (macOS, iOS, wasm) are left out. +targets = [ + "x86_64-unknown-linux-gnu", + "aarch64-unknown-linux-gnu", + "x86_64-pc-windows-msvc", + "aarch64-linux-android", + "armv7-linux-androideabi", + "x86_64-linux-android", +] + +# Build tools (cc, cmake, bindgen, slint-build) and test-only crates are not +# part of any binary we distribute. +ignore-build-dependencies = true +ignore-dev-dependencies = true + +# Our own crates (publish = false). The vendored tsclientlib crates in +# crates/proto are credited in about.hbs instead. +private = { ignore = true } + +workarounds = ["chrono", "ring", "rustls"] + +# Crate specific configuration must come last. +# +# Clarifications replace the license files cargo-about would find; each file +# is pinned by its SHA-256, so a changed text fails generation and gets +# reviewed. After a dependency update: `sha256sum ` in the new crate +# version (~/.cargo/registry/src/*/-/). + +# libopus_sys compiles the bundled libopus (opus/, BSD-3-Clause) into the app. +# The crate itself is MIT; LICENSE-old is the ISC license of the code it was +# derived from (audiopus_sys). +[libopus_sys.clarify] +license = "MIT AND ISC AND BSD-3-Clause" +[[libopus_sys.clarify.files]] +path = "LICENSE" +license = "MIT" +checksum = "c5512e4899a9b06c3a286bf69444ebc5314d506e437c334bfd66a2eac7bca3ef" +[[libopus_sys.clarify.files]] +path = "LICENSE-old" +license = "ISC" +checksum = "a6c8bb45880edc99bb13feb04d69fb2f0f73b565dfe209affa60414d2aa4c1a7" +[[libopus_sys.clarify.files]] +path = "opus/COPYING" +license = "BSD-3-Clause" +checksum = "01e1167d54a096d123cf6dfbbeb19587278845c6481d2d66d545669846079551" + +# Only the bindings are compiled (voelin-media loads Cisco's binary at runtime), +# but without this every header of the vendored OpenH264 sources would be +# listed. upstream/LICENSE is also the license of Cisco's binary. +[openh264-sys2.clarify] +license = "BSD-2-Clause" +[[openh264-sys2.clarify.files]] +path = "upstream/LICENSE" +checksum = "dd5c1c9668512530fa5a96e4c29ac4033d70a7eeb0eed7a42fddb6dd794ebdbb" + +# AWS-LC (DTLS for WebRTC through str0m): LICENSE holds the attributions of +# BoringSSL, OpenSSL and the bundled third-party code plus all license texts. +# It is shown once, under ISC; the other licenses of the expression get their +# standard texts. +[aws-lc-sys.clarify] +license = "ISC AND (Apache-2.0 OR ISC) AND Apache-2.0 AND MIT AND BSD-3-Clause AND (Apache-2.0 OR ISC OR MIT) AND (Apache-2.0 OR ISC OR MIT-0)" +[[aws-lc-sys.clarify.files]] +path = "LICENSE" +license = "ISC" +checksum = "728536b4160e051f86d7c9c388f704866b3d512cd7df97ac3516c65279523c4e" + +# Slint keeps its license texts in LICENSES/, which cargo-about does not match +# to the LicenseRef without a clarification. cargo-about 0.9.2 skips clarified +# files whose `license` names the LicenseRef they are the text of (an inverted +# check in generate.rs), so the file is tagged with a distinct LicenseRef; the +# text is still shown under LicenseRef-Slint-Royalty-free-2.0. Revisit when +# updating cargo-about (scripts/notices.sh fails if the text goes missing). +[slint.clarify] +license = "GPL-3.0-only OR LicenseRef-Slint-Royalty-free-2.0 OR LicenseRef-Slint-Software-3.0" +[[slint.clarify.files]] +path = "LICENSES/LicenseRef-Slint-Royalty-free-2.0.md" +license = "LicenseRef-Slint-Royalty-free-2.0-text" +checksum = "5167f5056e850419106ab6265efbdca7cba4d99c849d1445ca0bbf6a1e2315fe" + +[slint-macros.clarify] +license = "GPL-3.0-only OR LicenseRef-Slint-Royalty-free-2.0 OR LicenseRef-Slint-Software-3.0" +[[slint-macros.clarify.files]] +path = "LICENSES/LicenseRef-Slint-Royalty-free-2.0.md" +license = "LicenseRef-Slint-Royalty-free-2.0-text" +checksum = "5167f5056e850419106ab6265efbdca7cba4d99c849d1445ca0bbf6a1e2315fe" + +[i-slint-common.clarify] +license = "GPL-3.0-only OR LicenseRef-Slint-Royalty-free-2.0 OR LicenseRef-Slint-Software-3.0" +[[i-slint-common.clarify.files]] +path = "LICENSES/LicenseRef-Slint-Royalty-free-2.0.md" +license = "LicenseRef-Slint-Royalty-free-2.0-text" +checksum = "5167f5056e850419106ab6265efbdca7cba4d99c849d1445ca0bbf6a1e2315fe" + +[i-slint-compiler.clarify] +license = "GPL-3.0-only OR LicenseRef-Slint-Royalty-free-2.0 OR LicenseRef-Slint-Software-3.0" +[[i-slint-compiler.clarify.files]] +path = "LICENSES/LicenseRef-Slint-Royalty-free-2.0.md" +license = "LicenseRef-Slint-Royalty-free-2.0-text" +checksum = "5167f5056e850419106ab6265efbdca7cba4d99c849d1445ca0bbf6a1e2315fe" + +[i-slint-core.clarify] +license = "GPL-3.0-only OR LicenseRef-Slint-Royalty-free-2.0 OR LicenseRef-Slint-Software-3.0" +[[i-slint-core.clarify.files]] +path = "LICENSES/LicenseRef-Slint-Royalty-free-2.0.md" +license = "LicenseRef-Slint-Royalty-free-2.0-text" +checksum = "5167f5056e850419106ab6265efbdca7cba4d99c849d1445ca0bbf6a1e2315fe" + +[i-slint-core-macros.clarify] +license = "GPL-3.0-only OR LicenseRef-Slint-Royalty-free-2.0 OR LicenseRef-Slint-Software-3.0" +[[i-slint-core-macros.clarify.files]] +path = "LICENSES/LicenseRef-Slint-Royalty-free-2.0.md" +license = "LicenseRef-Slint-Royalty-free-2.0-text" +checksum = "5167f5056e850419106ab6265efbdca7cba4d99c849d1445ca0bbf6a1e2315fe" + +[i-slint-backend-selector.clarify] +license = "GPL-3.0-only OR LicenseRef-Slint-Royalty-free-2.0 OR LicenseRef-Slint-Software-3.0" +[[i-slint-backend-selector.clarify.files]] +path = "LICENSES/LicenseRef-Slint-Royalty-free-2.0.md" +license = "LicenseRef-Slint-Royalty-free-2.0-text" +checksum = "5167f5056e850419106ab6265efbdca7cba4d99c849d1445ca0bbf6a1e2315fe" + +[i-slint-backend-winit.clarify] +license = "GPL-3.0-only OR LicenseRef-Slint-Royalty-free-2.0 OR LicenseRef-Slint-Software-3.0" +[[i-slint-backend-winit.clarify.files]] +path = "LICENSES/LicenseRef-Slint-Royalty-free-2.0.md" +license = "LicenseRef-Slint-Royalty-free-2.0-text" +checksum = "5167f5056e850419106ab6265efbdca7cba4d99c849d1445ca0bbf6a1e2315fe" + +# Android (voelin-android). +[i-slint-backend-android-activity.clarify] +license = "GPL-3.0-only OR LicenseRef-Slint-Royalty-free-2.0 OR LicenseRef-Slint-Software-3.0" +[[i-slint-backend-android-activity.clarify.files]] +path = "LICENSES/LicenseRef-Slint-Royalty-free-2.0.md" +license = "LicenseRef-Slint-Royalty-free-2.0-text" +checksum = "5167f5056e850419106ab6265efbdca7cba4d99c849d1445ca0bbf6a1e2315fe" + +[i-slint-renderer-software.clarify] +license = "GPL-3.0-only OR LicenseRef-Slint-Royalty-free-2.0 OR LicenseRef-Slint-Software-3.0" +[[i-slint-renderer-software.clarify.files]] +path = "LICENSES/LicenseRef-Slint-Royalty-free-2.0.md" +license = "LicenseRef-Slint-Royalty-free-2.0-text" +checksum = "5167f5056e850419106ab6265efbdca7cba4d99c849d1445ca0bbf6a1e2315fe" + +[i-slint-renderer-femtovg.clarify] +license = "GPL-3.0-only OR LicenseRef-Slint-Royalty-free-2.0 OR LicenseRef-Slint-Software-3.0" +[[i-slint-renderer-femtovg.clarify.files]] +path = "LICENSES/LicenseRef-Slint-Royalty-free-2.0.md" +license = "LicenseRef-Slint-Royalty-free-2.0-text" +checksum = "5167f5056e850419106ab6265efbdca7cba4d99c849d1445ca0bbf6a1e2315fe" + +[i-slint-renderer-skia.clarify] +license = "GPL-3.0-only OR LicenseRef-Slint-Royalty-free-2.0 OR LicenseRef-Slint-Software-3.0" +[[i-slint-renderer-skia.clarify.files]] +path = "LICENSES/LicenseRef-Slint-Royalty-free-2.0.md" +license = "LicenseRef-Slint-Royalty-free-2.0-text" +checksum = "5167f5056e850419106ab6265efbdca7cba4d99c849d1445ca0bbf6a1e2315fe" diff --git a/android/.gitignore b/android/.gitignore new file mode 100644 index 0000000..a3a3629 --- /dev/null +++ b/android/.gitignore @@ -0,0 +1,6 @@ +.gradle/ +.kotlin/ +build/ +local.properties +*.jks +*.keystore diff --git a/android/app/build.gradle.kts b/android/app/build.gradle.kts new file mode 100644 index 0000000..19f4bae --- /dev/null +++ b/android/app/build.gradle.kts @@ -0,0 +1,129 @@ +import org.jetbrains.kotlin.gradle.dsl.JvmTarget + +plugins { + id("com.android.application") + id("org.jetbrains.kotlin.android") +} + +/** The Cargo workspace the native library comes from. */ +val workspace: File = rootDir.parentFile + +/** `version` of crates/voelin-android, which is the app's version (docs/release.md). */ +val crateVersion: String = workspace.resolve("crates/voelin-android/Cargo.toml").readLines() + .first { it.startsWith("version = ") } + .substringAfter('"').substringBefore('"') + +/** The version of `crate` in Cargo.lock. */ +fun lockedVersion(crate: String): String { + val lines = workspace.resolve("Cargo.lock").readLines() + val at = lines.indexOfFirst { it == "name = \"$crate\"" } + require(at >= 0) { "$crate is not in Cargo.lock" } + return lines[at + 1].substringAfter('"').substringBefore('"') +} + +/** + * A release signing setting: a Gradle property (e.g. in + * ~/.gradle/gradle.properties) or an environment variable (CI secrets). + * Never stored in the repository. + */ +fun signing(property: String, env: String): String? = + providers.gradleProperty(property).orElse(providers.environmentVariable(env)).orNull + +val releaseStoreFile = signing("voelin.signing.storeFile", "VOELIN_SIGNING_STORE_FILE") + +android { + namespace = "io.github.faumaray.voelin" + compileSdk = 36 + ndkVersion = "27.3.13750724" + + defaultConfig { + // The desktop app id (packaging/README.md); it cannot change after + // the first upload to Google Play. + applicationId = "io.github.faumaray.Voelin" + minSdk = 29 + targetSdk = 36 + versionName = crateVersion + // major * 1000000 + minor * 1000 + patch (docs/release.md). + versionCode = crateVersion.split('.').map(String::toInt) + .let { (major, minor, patch) -> major * 1_000_000 + minor * 1_000 + patch } + } + + signingConfigs { + if (releaseStoreFile != null) { + create("release") { + storeFile = file(releaseStoreFile) + storePassword = signing("voelin.signing.storePassword", "VOELIN_SIGNING_STORE_PASSWORD") + keyAlias = signing("voelin.signing.keyAlias", "VOELIN_SIGNING_KEY_ALIAS") + keyPassword = signing("voelin.signing.keyPassword", "VOELIN_SIGNING_KEY_PASSWORD") + } + } + } + + buildTypes { + release { + isMinifyEnabled = true + proguardFiles(getDefaultProguardFile("proguard-android-optimize.txt"), "proguard-rules.pro") + // Unsigned without the signing settings. + signingConfig = signingConfigs.findByName("release") + } + } + + compileOptions { + sourceCompatibility = JavaVersion.VERSION_17 + targetCompatibility = JavaVersion.VERSION_17 + } + + packaging { + // Stored uncompressed and page-aligned, loaded straight from the APK. + jniLibs.useLegacyPackaging = false + } +} + +kotlin { + compilerOptions { + jvmTarget.set(JvmTarget.JVM_17) + } +} + +dependencies { + // Must be the version of the rustls-platform-verifier-android crate. + implementation("org.rustls:rustls-platform-verifier:${lockedVersion("rustls-platform-verifier-android")}") +} + +// libvoelin_android.so, built with cargo-ndk into build/rust/// +// before the JNI libraries are merged. -Pvoelin.skipCargo=true uses what is +// there (e.g. built by CI in an earlier step). +val abis = providers.gradleProperty("voelin.abis").getOrElse("arm64-v8a,x86_64") + .split(',').map(String::trim).filter(String::isNotEmpty) +val skipCargo = providers.gradleProperty("voelin.skipCargo").map(String::toBoolean).getOrElse(false) + +for ((buildType, release) in listOf("debug" to false, "release" to true)) { + val out = layout.buildDirectory.dir("rust/$buildType") + val name = buildType.replaceFirstChar(Char::uppercase) + val cargo = tasks.register("cargoBuild$name") { + group = "build" + description = "Builds the Rust library for $abis with cargo-ndk ($buildType)." + workingDir = workspace + val command = mutableListOf("cargo", "ndk", "--platform", "29", "-o", out.get().asFile.path) + abis.forEach { command += listOf("-t", it) } + command += listOf("build", "-p", "voelin-android") + if (release) command += "--release" + commandLine(command) + val ndk = android.ndkDirectory.path + environment("ANDROID_NDK_HOME", ndk) + // CMake (the bundled libopus) finds the NDK through this one. + environment("ANDROID_NDK_ROOT", ndk) + environment("ANDROID_HOME", android.sdkDirectory.path) + // Slint compiles its Java helper against this. + environment( + "ANDROID_JAR", + android.sdkDirectory.resolve("platforms/android-${android.compileSdk}/android.jar").path, + ) + } + android.sourceSets.getByName(buildType).jniLibs.srcDir(out) + if (!skipCargo) { + tasks.configureEach { + if (this.name == "merge${name}JniLibFolders") dependsOn(cargo) + } + } +} diff --git a/android/app/proguard-rules.pro b/android/app/proguard-rules.pro new file mode 100644 index 0000000..72a8f55 --- /dev/null +++ b/android/app/proguard-rules.pro @@ -0,0 +1,7 @@ +# Called from Rust through JNI by name. +-keep class io.github.faumaray.voelin.Bridge { *; } +-keep class io.github.faumaray.voelin.Native { *; } +-keep class io.github.faumaray.voelin.VoelinApp { *; } + +# rustls-platform-verifier's Kotlin component, also called from Rust. +-keep class org.rustls.platformverifier.** { *; } diff --git a/android/app/src/main/AndroidManifest.xml b/android/app/src/main/AndroidManifest.xml new file mode 100644 index 0000000..3004993 --- /dev/null +++ b/android/app/src/main/AndroidManifest.xml @@ -0,0 +1,62 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/android/app/src/main/java/io/github/faumaray/voelin/Bridge.kt b/android/app/src/main/java/io/github/faumaray/voelin/Bridge.kt new file mode 100644 index 0000000..145f25a --- /dev/null +++ b/android/app/src/main/java/io/github/faumaray/voelin/Bridge.kt @@ -0,0 +1,77 @@ +package io.github.faumaray.voelin + +import android.Manifest +import android.content.Context +import android.content.pm.PackageManager +import android.os.Build + +/** + * What the Rust library (crates/voelin-android/src/bridge.rs) calls, from any + * thread. Keep the names and signatures in step with it. + */ +object Bridge { + private val app: VoelinApp get() = VoelinApp.instance + + @JvmStatic + fun context(): Context = app + + /** Ask for the microphone (voice) and notification (services) permissions. */ + @JvmStatic + fun requestPermissions() { + val activity = MainActivity.current?.get() ?: return + val wanted = buildList { + add(Manifest.permission.RECORD_AUDIO) + if (Build.VERSION.SDK_INT >= 33) add(Manifest.permission.POST_NOTIFICATIONS) + }.filter { activity.checkSelfPermission(it) != PackageManager.PERMISSION_GRANTED } + if (wanted.isNotEmpty()) { + activity.runOnUiThread { activity.requestPermissions(wanted.toTypedArray(), 1) } + } + } + + /** + * Run the voice service with this notification text (`muted`: the action + * offers Unmute); null stops it. + */ + @JvmStatic + fun setVoiceNotification(text: String?, muted: Boolean) { + if (text == null) VoiceService.stop(app) else VoiceService.start(app, text, muted) + } + + /** Ask the user to share the screen; the answer goes to Native.onScreenCaptureResult. */ + @JvmStatic + fun requestScreenCapture(fps: Int, maxSize: Int) { + val activity = MainActivity.current?.get() + if (activity == null) { + Native.onScreenCaptureResult(false, "the app is not in the foreground") + return + } + activity.runOnUiThread { activity.requestScreenCapture(fps, maxSize) } + } + + @JvmStatic + fun stopScreenCapture() { + ScreenCaptureService.stop(app) + } + + /** Capture what the device plays; false without a running screen capture. */ + @JvmStatic + fun startSystemAudio(): Boolean = ScreenCaptureService.startAudio() + + @JvmStatic + fun stopSystemAudio() { + ScreenCaptureService.stopAudio() + } + + @JvmStatic + fun secretGet(key: String): String? = SecretStore.get(app, key) + + @JvmStatic + fun secretSet(key: String, value: String) { + SecretStore.set(app, key, value) + } + + @JvmStatic + fun secretDelete(key: String) { + SecretStore.delete(app, key) + } +} diff --git a/android/app/src/main/java/io/github/faumaray/voelin/MainActivity.kt b/android/app/src/main/java/io/github/faumaray/voelin/MainActivity.kt new file mode 100644 index 0000000..98c995c --- /dev/null +++ b/android/app/src/main/java/io/github/faumaray/voelin/MainActivity.kt @@ -0,0 +1,67 @@ +package io.github.faumaray.voelin + +import android.app.NativeActivity +import android.content.Intent +import android.media.projection.MediaProjectionManager +import android.os.Bundle +import java.lang.ref.WeakReference + +/** + * The window: a NativeActivity running `android_main` of libvoelin_android.so + * (the Slint UI). Kotlin only handles what needs an Activity: permission + * prompts and the screen-capture consent dialog. + */ +class MainActivity : NativeActivity() { + private var captureFps = 30 + private var captureMaxSize = 1920 + + override fun onCreate(savedInstanceState: Bundle?) { + current = WeakReference(this) + super.onCreate(savedInstanceState) + } + + override fun onDestroy() { + if (current?.get() === this) current = null + super.onDestroy() + } + + /** + * Back leaves the app like Home instead of finishing the activity, so the + * window (and its state) stays while voice goes on in the background. + */ + @Deprecated("Deprecated in Java") + override fun onBackPressed() { + moveTaskToBack(true) + } + + /** Show the system's "start recording or casting?" dialog. */ + fun requestScreenCapture(fps: Int, maxSize: Int) { + captureFps = fps + captureMaxSize = maxSize + val manager = getSystemService(MediaProjectionManager::class.java) + @Suppress("DEPRECATION") + startActivityForResult(manager.createScreenCaptureIntent(), REQUEST_SCREEN_CAPTURE) + } + + @Deprecated("Deprecated in Java") + override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) { + @Suppress("DEPRECATION") + super.onActivityResult(requestCode, resultCode, data) + if (requestCode != REQUEST_SCREEN_CAPTURE) return + if (resultCode == RESULT_OK && data != null) { + // The service reports the outcome to Native.onScreenCaptureResult. + ScreenCaptureService.start(this, resultCode, data, captureFps, captureMaxSize) + } else { + Native.onScreenCaptureResult(false, null) + } + } + + companion object { + private const val REQUEST_SCREEN_CAPTURE = 1001 + + /** The activity in front, if any. */ + @Volatile + var current: WeakReference? = null + private set + } +} diff --git a/android/app/src/main/java/io/github/faumaray/voelin/Native.kt b/android/app/src/main/java/io/github/faumaray/voelin/Native.kt new file mode 100644 index 0000000..5f91cea --- /dev/null +++ b/android/app/src/main/java/io/github/faumaray/voelin/Native.kt @@ -0,0 +1,45 @@ +package io.github.faumaray.voelin + +import java.nio.ByteBuffer + +/** Callbacks into the Rust library (crates/voelin-android/src/bridge.rs). */ +object Native { + init { + // Already loaded by the NativeActivity; this registers it for JNI + // lookups from this class loader. + System.loadLibrary("voelin_android") + } + + /** The user answered the screen-capture dialog (`error`: why it failed). */ + @JvmStatic + external fun onScreenCaptureResult(granted: Boolean, error: String?) + + /** An RGBA_8888 frame. Returns false when frames are no longer wanted. */ + @JvmStatic + external fun onScreenFrame( + pixels: ByteBuffer, + width: Int, + height: Int, + rowStride: Int, + timestampNs: Long, + ): Boolean + + /** The projection ended (by the app, the user or the system). */ + @JvmStatic + external fun onScreenCaptureStopped() + + /** + * `count` interleaved 48 kHz float samples of what the device plays. + * Returns false when audio is no longer wanted. + */ + @JvmStatic + external fun onSystemAudio(samples: FloatArray, count: Int, channels: Int, timestampNs: Long): Boolean + + /** "Disconnect" in the voice notification. */ + @JvmStatic + external fun onDisconnectVoice() + + /** "Mute" / "Unmute" in the voice notification. */ + @JvmStatic + external fun onToggleMute() +} diff --git a/android/app/src/main/java/io/github/faumaray/voelin/Notifications.kt b/android/app/src/main/java/io/github/faumaray/voelin/Notifications.kt new file mode 100644 index 0000000..f537eee --- /dev/null +++ b/android/app/src/main/java/io/github/faumaray/voelin/Notifications.kt @@ -0,0 +1,61 @@ +package io.github.faumaray.voelin + +import android.app.Notification +import android.app.NotificationChannel +import android.app.NotificationManager +import android.app.PendingIntent +import android.content.Context +import android.content.Intent + +/** Notification channels and the notifications of the foreground services. */ +object Notifications { + const val CHANNEL_VOICE = "voice" + const val CHANNEL_SCREEN = "screen" + + fun createChannels(context: Context) { + val manager = context.getSystemService(NotificationManager::class.java) + manager.createNotificationChannel( + NotificationChannel( + CHANNEL_VOICE, + context.getString(R.string.channel_voice), + NotificationManager.IMPORTANCE_LOW, + ), + ) + manager.createNotificationChannel( + NotificationChannel( + CHANNEL_SCREEN, + context.getString(R.string.channel_screen), + NotificationManager.IMPORTANCE_LOW, + ), + ) + } + + /** Tapping a notification brings the app back. */ + private fun openApp(context: Context): PendingIntent = PendingIntent.getActivity( + context, + 0, + Intent(context, MainActivity::class.java).addFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT), + PendingIntent.FLAG_IMMUTABLE, + ) + + /** An ongoing notification with `actions` (title, intent). */ + fun ongoing( + context: Context, + channel: String, + text: String, + vararg actions: Pair, + ): Notification { + val builder = Notification.Builder(context, channel) + .setSmallIcon(R.drawable.ic_notification) + .setContentTitle(context.getString(R.string.app_name)) + .setContentText(text) + .setContentIntent(openApp(context)) + .setOngoing(true) + .setOnlyAlertOnce(true) + .setCategory(Notification.CATEGORY_CALL) + for ((title, intent) in actions) { + builder.addAction(Notification.Action.Builder(null, title, intent).build()) + } + return builder.build() + } +} diff --git a/android/app/src/main/java/io/github/faumaray/voelin/ScreenCaptureService.kt b/android/app/src/main/java/io/github/faumaray/voelin/ScreenCaptureService.kt new file mode 100644 index 0000000..485f654 --- /dev/null +++ b/android/app/src/main/java/io/github/faumaray/voelin/ScreenCaptureService.kt @@ -0,0 +1,257 @@ +package io.github.faumaray.voelin + +import android.Manifest +import android.app.PendingIntent +import android.app.Service +import android.content.Context +import android.content.Intent +import android.content.pm.PackageManager +import android.content.pm.ServiceInfo +import android.graphics.PixelFormat +import android.hardware.display.DisplayManager +import android.hardware.display.VirtualDisplay +import android.media.AudioAttributes +import android.media.AudioFormat +import android.media.AudioPlaybackCaptureConfiguration +import android.media.AudioRecord +import android.media.ImageReader +import android.media.projection.MediaProjection +import android.media.projection.MediaProjectionManager +import android.os.Build +import android.os.Handler +import android.os.HandlerThread +import android.os.IBinder +import android.os.Looper +import android.util.Log +import android.view.Display +import android.view.Surface +import kotlin.concurrent.thread +import kotlin.math.max +import kotlin.math.roundToInt + +/** + * Screen sharing: holds the MediaProjection (a `mediaProjection` foreground + * service, as Android requires), mirrors the display into an ImageReader and + * hands each RGBA frame to Native.onScreenFrame; optionally captures what the + * device plays (AudioPlaybackCapture) for Native.onSystemAudio. + */ +class ScreenCaptureService : Service() { + private var projection: MediaProjection? = null + private var display: VirtualDisplay? = null + private var reader: ImageReader? = null + private var worker: HandlerThread? = null + + @Volatile + private var audioRunning = false + private var audioThread: Thread? = null + + private val main = Handler(Looper.getMainLooper()) + + override fun onBind(intent: Intent?): IBinder? = null + + override fun onStartCommand(intent: Intent?, flags: Int, startId: Int): Int { + if (intent == null || intent.action == ACTION_STOP) { + stopSelf() + return START_NOT_STICKY + } + if (projection != null) return START_NOT_STICKY + val stop = PendingIntent.getService( + this, + 0, + Intent(this, ScreenCaptureService::class.java).setAction(ACTION_STOP), + PendingIntent.FLAG_IMMUTABLE, + ) + val notification = Notifications.ongoing( + this, + Notifications.CHANNEL_SCREEN, + getString(R.string.screen_sharing), + getString(R.string.stop_sharing) to stop, + ) + try { + // Must be in the foreground before getMediaProjection (Android 14). + startForeground(ID, notification, ServiceInfo.FOREGROUND_SERVICE_TYPE_MEDIA_PROJECTION) + val data = if (Build.VERSION.SDK_INT >= 33) { + intent.getParcelableExtra(EXTRA_DATA, Intent::class.java) + } else { + @Suppress("DEPRECATION") + intent.getParcelableExtra(EXTRA_DATA) + } ?: throw IllegalStateException("no projection data") + val manager = getSystemService(MediaProjectionManager::class.java) + val projection = manager.getMediaProjection(intent.getIntExtra(EXTRA_RESULT, 0), data) + ?: throw IllegalStateException("the projection was refused") + this.projection = projection + instance = this + startVideo(projection, intent.getIntExtra(EXTRA_FPS, 30), intent.getIntExtra(EXTRA_MAX_SIZE, 1920)) + Native.onScreenCaptureResult(true, null) + } catch (e: Exception) { + Log.w(TAG, "screen capture failed", e) + Native.onScreenCaptureResult(false, e.message ?: e.toString()) + stopSelf() + } + return START_NOT_STICKY + } + + private fun startVideo(projection: MediaProjection, fps: Int, maxSize: Int) { + val worker = HandlerThread("voelin-screen").also { it.start() } + this.worker = worker + val handler = Handler(worker.looper) + // The user or the system can end the projection (status bar chip, + // screen lock); registered before the virtual display (Android 14). + projection.registerCallback(object : MediaProjection.Callback() { + override fun onStop() { + main.post { stopSelf() } + } + }, handler) + + val metrics = resources.displayMetrics + val screen = getSystemService(DisplayManager::class.java).getDisplay(Display.DEFAULT_DISPLAY) + val mode = screen.mode + // The mode is in the display's natural orientation; match the current + // one. (Rotating while sharing letterboxes the picture.) + val rotated = screen.rotation == Surface.ROTATION_90 || screen.rotation == Surface.ROTATION_270 + val (fullWidth, fullHeight) = if (rotated) { + mode.physicalHeight to mode.physicalWidth + } else { + mode.physicalWidth to mode.physicalHeight + } + val scale = minOf(1.0, maxSize.toDouble() / max(fullWidth, fullHeight)) + // Even sizes, as video encoders want. + val width = ((fullWidth * scale).roundToInt() / 2 * 2).coerceAtLeast(2) + val height = ((fullHeight * scale).roundToInt() / 2 * 2).coerceAtLeast(2) + + val reader = ImageReader.newInstance(width, height, PixelFormat.RGBA_8888, 3) + this.reader = reader + val interval = 1_000_000_000L / fps.coerceIn(1, 60) + var last = 0L + reader.setOnImageAvailableListener({ r -> + val image = r.acquireLatestImage() ?: return@setOnImageAvailableListener + try { + // The display renders at its own rate; pass on at most `fps`. + if (image.timestamp - last < interval) return@setOnImageAvailableListener + last = image.timestamp + val plane = image.planes[0] + val wanted = Native.onScreenFrame(plane.buffer, image.width, image.height, plane.rowStride, image.timestamp) + if (!wanted) main.post { stopSelf() } + } finally { + image.close() + } + }, handler) + display = projection.createVirtualDisplay( + "voelin-screen", + width, + height, + metrics.densityDpi, + DisplayManager.VIRTUAL_DISPLAY_FLAG_AUTO_MIRROR, + reader.surface, + null, + handler, + ) + } + + /** Capture media, game and unknown-usage playback as 48 kHz stereo float. */ + private fun startAudioCapture(): Boolean { + val projection = projection ?: return false + if (audioRunning) return true + if (checkSelfPermission(Manifest.permission.RECORD_AUDIO) != PackageManager.PERMISSION_GRANTED) { + return false + } + val config = AudioPlaybackCaptureConfiguration.Builder(projection) + .addMatchingUsage(AudioAttributes.USAGE_MEDIA) + .addMatchingUsage(AudioAttributes.USAGE_GAME) + .addMatchingUsage(AudioAttributes.USAGE_UNKNOWN) + .build() + val format = AudioFormat.Builder() + .setEncoding(AudioFormat.ENCODING_PCM_FLOAT) + .setSampleRate(SAMPLE_RATE) + .setChannelMask(AudioFormat.CHANNEL_IN_STEREO) + .build() + val minimum = AudioRecord.getMinBufferSize(SAMPLE_RATE, AudioFormat.CHANNEL_IN_STEREO, AudioFormat.ENCODING_PCM_FLOAT) + val record = try { + AudioRecord.Builder() + .setAudioFormat(format) + .setAudioPlaybackCaptureConfig(config) + // A tenth of a second. + .setBufferSizeInBytes(max(minimum, SAMPLE_RATE / 10 * 2 * 4)) + .build() + } catch (e: Exception) { + Log.w(TAG, "system audio capture unavailable", e) + return false + } + audioRunning = true + record.startRecording() + audioThread = thread(name = "voelin-system-audio") { + // 10 ms of stereo. + val buffer = FloatArray(SAMPLE_RATE / 100 * 2) + try { + while (audioRunning) { + val read = record.read(buffer, 0, buffer.size, AudioRecord.READ_BLOCKING) + if (read < 0) break + if (read > 0 && !Native.onSystemAudio(buffer, read, 2, System.nanoTime())) break + } + } finally { + audioRunning = false + record.stop() + record.release() + } + } + return true + } + + private fun stopAudioCapture() { + audioRunning = false + audioThread?.join(500) + audioThread = null + } + + override fun onDestroy() { + if (instance === this) instance = null + stopAudioCapture() + display?.release() + display = null + reader?.close() + reader = null + projection?.stop() + projection = null + worker?.quitSafely() + worker = null + Native.onScreenCaptureStopped() + super.onDestroy() + } + + companion object { + private const val TAG = "ScreenCaptureService" + private const val ID = 2 + private const val SAMPLE_RATE = 48_000 + private const val ACTION_STOP = "io.github.faumaray.voelin.STOP_SHARING" + private const val EXTRA_RESULT = "result" + private const val EXTRA_DATA = "data" + private const val EXTRA_FPS = "fps" + private const val EXTRA_MAX_SIZE = "max_size" + + @Volatile + private var instance: ScreenCaptureService? = null + + /** Start capturing with the consent the user just gave. */ + fun start(context: Context, resultCode: Int, data: Intent, fps: Int, maxSize: Int) { + val intent = Intent(context, ScreenCaptureService::class.java) + .putExtra(EXTRA_RESULT, resultCode) + .putExtra(EXTRA_DATA, data) + .putExtra(EXTRA_FPS, fps) + .putExtra(EXTRA_MAX_SIZE, maxSize) + context.startForegroundService(intent) + } + + fun stop(context: Context) { + context.stopService(Intent(context, ScreenCaptureService::class.java)) + } + + fun startAudio(): Boolean { + val service = instance ?: return false + return service.startAudioCapture() + } + + fun stopAudio() { + instance?.stopAudioCapture() + } + } +} diff --git a/android/app/src/main/java/io/github/faumaray/voelin/SecretStore.kt b/android/app/src/main/java/io/github/faumaray/voelin/SecretStore.kt new file mode 100644 index 0000000..d443a6c --- /dev/null +++ b/android/app/src/main/java/io/github/faumaray/voelin/SecretStore.kt @@ -0,0 +1,81 @@ +package io.github.faumaray.voelin + +import android.content.Context +import android.security.keystore.KeyGenParameterSpec +import android.security.keystore.KeyProperties +import android.util.Base64 +import android.util.Log +import java.security.KeyStore +import javax.crypto.Cipher +import javax.crypto.KeyGenerator +import javax.crypto.SecretKey +import javax.crypto.spec.GCMParameterSpec + +/** + * Saved passwords (server, query), for the Rust side's `Secrets`. + * + * Each value is encrypted with AES-256-GCM under a key that never leaves the + * Android Keystore (hardware-backed where available); the key name is the + * associated data, so a value cannot be moved to another key. Only the + * ciphertext is stored, in private preferences excluded from backups. + */ +object SecretStore { + private const val TAG = "SecretStore" + private const val KEYSTORE = "AndroidKeyStore" + private const val KEY_ALIAS = "voelin-secrets" + private const val PREFS = "secrets" + private const val TRANSFORMATION = "AES/GCM/NoPadding" + private const val IV_BYTES = 12 + private const val TAG_BITS = 128 + + private fun key(): SecretKey { + val keyStore = KeyStore.getInstance(KEYSTORE).apply { load(null) } + (keyStore.getKey(KEY_ALIAS, null) as? SecretKey)?.let { return it } + val generator = KeyGenerator.getInstance(KeyProperties.KEY_ALGORITHM_AES, KEYSTORE) + generator.init( + KeyGenParameterSpec.Builder( + KEY_ALIAS, + KeyProperties.PURPOSE_ENCRYPT or KeyProperties.PURPOSE_DECRYPT, + ) + .setBlockModes(KeyProperties.BLOCK_MODE_GCM) + .setEncryptionPaddings(KeyProperties.ENCRYPTION_PADDING_NONE) + .setKeySize(256) + .build(), + ) + return generator.generateKey() + } + + private fun prefs(context: Context) = context.getSharedPreferences(PREFS, Context.MODE_PRIVATE) + + /** The value, or null if none is saved or it cannot be decrypted. */ + @Synchronized + fun get(context: Context, name: String): String? { + val stored = prefs(context).getString(name, null) ?: return null + return try { + val bytes = Base64.decode(stored, Base64.NO_WRAP) + val cipher = Cipher.getInstance(TRANSFORMATION) + cipher.init(Cipher.DECRYPT_MODE, key(), GCMParameterSpec(TAG_BITS, bytes, 0, IV_BYTES)) + cipher.updateAAD(name.toByteArray()) + String(cipher.doFinal(bytes, IV_BYTES, bytes.size - IV_BYTES), Charsets.UTF_8) + } catch (e: Exception) { + // E.g. the key was lost (the device's lock screen was reset). + Log.w(TAG, "cannot decrypt $name", e) + null + } + } + + @Synchronized + fun set(context: Context, name: String, value: String) { + val cipher = Cipher.getInstance(TRANSFORMATION) + cipher.init(Cipher.ENCRYPT_MODE, key()) + cipher.updateAAD(name.toByteArray()) + val sealed = cipher.iv + cipher.doFinal(value.toByteArray(Charsets.UTF_8)) + check(cipher.iv.size == IV_BYTES) + prefs(context).edit().putString(name, Base64.encodeToString(sealed, Base64.NO_WRAP)).commit() + } + + @Synchronized + fun delete(context: Context, name: String) { + prefs(context).edit().remove(name).commit() + } +} diff --git a/android/app/src/main/java/io/github/faumaray/voelin/VoelinApp.kt b/android/app/src/main/java/io/github/faumaray/voelin/VoelinApp.kt new file mode 100644 index 0000000..848ad83 --- /dev/null +++ b/android/app/src/main/java/io/github/faumaray/voelin/VoelinApp.kt @@ -0,0 +1,17 @@ +package io.github.faumaray.voelin + +import android.app.Application + +/** The process's application object; the Rust side reaches Android through it. */ +class VoelinApp : Application() { + override fun onCreate() { + super.onCreate() + instance = this + Notifications.createChannels(this) + } + + companion object { + lateinit var instance: VoelinApp + private set + } +} diff --git a/android/app/src/main/java/io/github/faumaray/voelin/VoiceService.kt b/android/app/src/main/java/io/github/faumaray/voelin/VoiceService.kt new file mode 100644 index 0000000..b0e15d2 --- /dev/null +++ b/android/app/src/main/java/io/github/faumaray/voelin/VoiceService.kt @@ -0,0 +1,110 @@ +package io.github.faumaray.voelin + +import android.app.Notification +import android.app.NotificationManager +import android.app.PendingIntent +import android.app.Service +import android.content.Context +import android.content.Intent +import android.content.pm.ServiceInfo +import android.os.Build +import android.os.IBinder +import android.util.Log + +/** + * Foreground service while a voice connection exists: Android keeps the + * process, the network and (type microphone) the microphone of an app in + * the background only this way. The Rust side starts, updates and stops it. + */ +class VoiceService : Service() { + override fun onBind(intent: Intent?): IBinder? = null + + override fun onStartCommand(intent: Intent?, flags: Int, startId: Int): Int { + when (intent?.action) { + ACTION_DISCONNECT -> { + Native.onDisconnectVoice() + return START_NOT_STICKY + } + ACTION_TOGGLE_MUTE -> { + Native.onToggleMute() + return START_NOT_STICKY + } + } + val text = intent?.getStringExtra(EXTRA_TEXT) ?: getString(R.string.voice_connected) + val muted = intent?.getBooleanExtra(EXTRA_MUTED, false) ?: false + try { + if (Build.VERSION.SDK_INT >= 30) { + startForeground(ID, notification(this, text, muted), ServiceInfo.FOREGROUND_SERVICE_TYPE_MICROPHONE) + } else { + startForeground(ID, notification(this, text, muted)) + } + running = this + } catch (e: RuntimeException) { + // E.g. no microphone permission (Android 14 refuses the type): + // voice then works only while the app is in front. + Log.w(TAG, "voice service cannot run in the foreground", e) + stopSelf() + } + return START_NOT_STICKY + } + + override fun onDestroy() { + if (running === this) running = null + super.onDestroy() + } + + companion object { + private const val TAG = "VoiceService" + private const val ID = 1 + private const val EXTRA_TEXT = "text" + private const val EXTRA_MUTED = "muted" + private const val ACTION_DISCONNECT = "io.github.faumaray.voelin.DISCONNECT" + private const val ACTION_TOGGLE_MUTE = "io.github.faumaray.voelin.TOGGLE_MUTE" + + @Volatile + private var running: VoiceService? = null + + private fun action(context: Context, action: String, request: Int): PendingIntent = + PendingIntent.getService( + context, + request, + Intent(context, VoiceService::class.java).setAction(action), + PendingIntent.FLAG_IMMUTABLE, + ) + + private fun notification(context: Context, text: String, muted: Boolean): Notification = + Notifications.ongoing( + context, + Notifications.CHANNEL_VOICE, + text, + context.getString(if (muted) R.string.unmute else R.string.mute) to + action(context, ACTION_TOGGLE_MUTE, 1), + context.getString(R.string.disconnect) to action(context, ACTION_DISCONNECT, 0), + ) + + /** Start the service, or update its notification when it runs. */ + fun start(context: Context, text: String, muted: Boolean) { + val service = running + if (service != null) { + service.getSystemService(NotificationManager::class.java) + .notify(ID, notification(service, text, muted)) + return + } + try { + context.startForegroundService( + Intent(context, VoiceService::class.java) + .putExtra(EXTRA_TEXT, text) + .putExtra(EXTRA_MUTED, muted), + ) + } catch (e: RuntimeException) { + // Not allowed from the background (Android 12+). Voice is + // connected from the UI, so this should not happen. + Log.w(TAG, "cannot start the voice service", e) + } + } + + fun stop(context: Context) { + context.stopService(Intent(context, VoiceService::class.java)) + } + } +} diff --git a/android/app/src/main/res/drawable/ic_launcher_foreground.xml b/android/app/src/main/res/drawable/ic_launcher_foreground.xml new file mode 100644 index 0000000..7d974af --- /dev/null +++ b/android/app/src/main/res/drawable/ic_launcher_foreground.xml @@ -0,0 +1,26 @@ + + + + + + + + diff --git a/android/app/src/main/res/drawable/ic_notification.xml b/android/app/src/main/res/drawable/ic_notification.xml new file mode 100644 index 0000000..7810123 --- /dev/null +++ b/android/app/src/main/res/drawable/ic_notification.xml @@ -0,0 +1,12 @@ + + + + + diff --git a/android/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml b/android/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml new file mode 100644 index 0000000..2e4a27f --- /dev/null +++ b/android/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml @@ -0,0 +1,6 @@ + + + + + + diff --git a/android/app/src/main/res/values/colors.xml b/android/app/src/main/res/values/colors.xml new file mode 100644 index 0000000..1a3fe07 --- /dev/null +++ b/android/app/src/main/res/values/colors.xml @@ -0,0 +1,6 @@ + + + #FF1C1C1C + + #FF238636 + diff --git a/android/app/src/main/res/values/strings.xml b/android/app/src/main/res/values/strings.xml new file mode 100644 index 0000000..864bada --- /dev/null +++ b/android/app/src/main/res/values/strings.xml @@ -0,0 +1,12 @@ + + + Voelin + Voice connection + Screen sharing + Connected to voice + Disconnect + Mute + Unmute + Sharing your screen + Stop sharing + diff --git a/android/app/src/main/res/values/themes.xml b/android/app/src/main/res/values/themes.xml new file mode 100644 index 0000000..4820ca0 --- /dev/null +++ b/android/app/src/main/res/values/themes.xml @@ -0,0 +1,7 @@ + + + + + diff --git a/android/build.gradle.kts b/android/build.gradle.kts new file mode 100644 index 0000000..300289d --- /dev/null +++ b/android/build.gradle.kts @@ -0,0 +1,4 @@ +plugins { + id("com.android.application") version "8.13.2" apply false + id("org.jetbrains.kotlin.android") version "2.3.21" apply false +} diff --git a/android/gradle.properties b/android/gradle.properties new file mode 100644 index 0000000..eaa02fd --- /dev/null +++ b/android/gradle.properties @@ -0,0 +1,7 @@ +org.gradle.jvmargs=-Xmx2g -Dfile.encoding=UTF-8 +android.useAndroidX=false +android.nonTransitiveRClass=true +kotlin.code.style=official +# ABIs the Rust library is built for (cargo-ndk names), e.g. only +# -Pvoelin.abis=arm64-v8a for a phone. +voelin.abis=arm64-v8a,x86_64 diff --git a/android/gradle/wrapper/gradle-wrapper.jar b/android/gradle/wrapper/gradle-wrapper.jar new file mode 100644 index 0000000..1b33c55 Binary files /dev/null and b/android/gradle/wrapper/gradle-wrapper.jar differ diff --git a/android/gradle/wrapper/gradle-wrapper.properties b/android/gradle/wrapper/gradle-wrapper.properties new file mode 100644 index 0000000..6c458a2 --- /dev/null +++ b/android/gradle/wrapper/gradle-wrapper.properties @@ -0,0 +1,8 @@ +distributionBase=GRADLE_USER_HOME +distributionPath=wrapper/dists +distributionSha256Sum=bd71102213493060956ec229d946beee57158dbd89d0e62b91bca0fa2c5f3531 +distributionUrl=https\://services.gradle.org/distributions/gradle-8.14.3-bin.zip +networkTimeout=60000 +validateDistributionUrl=true +zipStoreBase=GRADLE_USER_HOME +zipStorePath=wrapper/dists diff --git a/android/gradlew b/android/gradlew new file mode 100755 index 0000000..23d15a9 --- /dev/null +++ b/android/gradlew @@ -0,0 +1,251 @@ +#!/bin/sh + +# +# Copyright © 2015-2021 the original authors. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# SPDX-License-Identifier: Apache-2.0 +# + +############################################################################## +# +# Gradle start up script for POSIX generated by Gradle. +# +# Important for running: +# +# (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is +# noncompliant, but you have some other compliant shell such as ksh or +# bash, then to run this script, type that shell name before the whole +# command line, like: +# +# ksh Gradle +# +# Busybox and similar reduced shells will NOT work, because this script +# requires all of these POSIX shell features: +# * functions; +# * expansions «$var», «${var}», «${var:-default}», «${var+SET}», +# «${var#prefix}», «${var%suffix}», and «$( cmd )»; +# * compound commands having a testable exit status, especially «case»; +# * various built-in commands including «command», «set», and «ulimit». +# +# Important for patching: +# +# (2) This script targets any POSIX shell, so it avoids extensions provided +# by Bash, Ksh, etc; in particular arrays are avoided. +# +# The "traditional" practice of packing multiple parameters into a +# space-separated string is a well documented source of bugs and security +# problems, so this is (mostly) avoided, by progressively accumulating +# options in "$@", and eventually passing that to Java. +# +# Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS, +# and GRADLE_OPTS) rely on word-splitting, this is performed explicitly; +# see the in-line comments for details. +# +# There are tweaks for specific operating systems such as AIX, CygWin, +# Darwin, MinGW, and NonStop. +# +# (3) This script is generated from the Groovy template +# https://github.com/gradle/gradle/blob/HEAD/platforms/jvm/plugins-application/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt +# within the Gradle project. +# +# You can find Gradle at https://github.com/gradle/gradle/. +# +############################################################################## + +# Attempt to set APP_HOME + +# Resolve links: $0 may be a link +app_path=$0 + +# Need this for daisy-chained symlinks. +while + APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path + [ -h "$app_path" ] +do + ls=$( ls -ld "$app_path" ) + link=${ls#*' -> '} + case $link in #( + /*) app_path=$link ;; #( + *) app_path=$APP_HOME$link ;; + esac +done + +# This is normally unused +# shellcheck disable=SC2034 +APP_BASE_NAME=${0##*/} +# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036) +APP_HOME=$( cd -P "${APP_HOME:-./}" > /dev/null && printf '%s\n' "$PWD" ) || exit + +# Use the maximum available, or set MAX_FD != -1 to use that value. +MAX_FD=maximum + +warn () { + echo "$*" +} >&2 + +die () { + echo + echo "$*" + echo + exit 1 +} >&2 + +# OS specific support (must be 'true' or 'false'). +cygwin=false +msys=false +darwin=false +nonstop=false +case "$( uname )" in #( + CYGWIN* ) cygwin=true ;; #( + Darwin* ) darwin=true ;; #( + MSYS* | MINGW* ) msys=true ;; #( + NONSTOP* ) nonstop=true ;; +esac + +CLASSPATH="\\\"\\\"" + + +# Determine the Java command to use to start the JVM. +if [ -n "$JAVA_HOME" ] ; then + if [ -x "$JAVA_HOME/jre/sh/java" ] ; then + # IBM's JDK on AIX uses strange locations for the executables + JAVACMD=$JAVA_HOME/jre/sh/java + else + JAVACMD=$JAVA_HOME/bin/java + fi + if [ ! -x "$JAVACMD" ] ; then + die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." + fi +else + JAVACMD=java + if ! command -v java >/dev/null 2>&1 + then + die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." + fi +fi + +# Increase the maximum file descriptors if we can. +if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then + case $MAX_FD in #( + max*) + # In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked. + # shellcheck disable=SC2039,SC3045 + MAX_FD=$( ulimit -H -n ) || + warn "Could not query maximum file descriptor limit" + esac + case $MAX_FD in #( + '' | soft) :;; #( + *) + # In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked. + # shellcheck disable=SC2039,SC3045 + ulimit -n "$MAX_FD" || + warn "Could not set maximum file descriptor limit to $MAX_FD" + esac +fi + +# Collect all arguments for the java command, stacking in reverse order: +# * args from the command line +# * the main class name +# * -classpath +# * -D...appname settings +# * --module-path (only if needed) +# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables. + +# For Cygwin or MSYS, switch paths to Windows format before running java +if "$cygwin" || "$msys" ; then + APP_HOME=$( cygpath --path --mixed "$APP_HOME" ) + CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" ) + + JAVACMD=$( cygpath --unix "$JAVACMD" ) + + # Now convert the arguments - kludge to limit ourselves to /bin/sh + for arg do + if + case $arg in #( + -*) false ;; # don't mess with options #( + /?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath + [ -e "$t" ] ;; #( + *) false ;; + esac + then + arg=$( cygpath --path --ignore --mixed "$arg" ) + fi + # Roll the args list around exactly as many times as the number of + # args, so each arg winds up back in the position where it started, but + # possibly modified. + # + # NB: a `for` loop captures its iteration list before it begins, so + # changing the positional parameters here affects neither the number of + # iterations, nor the values presented in `arg`. + shift # remove old arg + set -- "$@" "$arg" # push replacement arg + done +fi + + +# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' + +# Collect all arguments for the java command: +# * DEFAULT_JVM_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments, +# and any embedded shellness will be escaped. +# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be +# treated as '${Hostname}' itself on the command line. + +set -- \ + "-Dorg.gradle.appname=$APP_BASE_NAME" \ + -classpath "$CLASSPATH" \ + -jar "$APP_HOME/gradle/wrapper/gradle-wrapper.jar" \ + "$@" + +# Stop when "xargs" is not available. +if ! command -v xargs >/dev/null 2>&1 +then + die "xargs is not available" +fi + +# Use "xargs" to parse quoted args. +# +# With -n1 it outputs one arg per line, with the quotes and backslashes removed. +# +# In Bash we could simply go: +# +# readarray ARGS < <( xargs -n1 <<<"$var" ) && +# set -- "${ARGS[@]}" "$@" +# +# but POSIX shell has neither arrays nor command substitution, so instead we +# post-process each arg (as a line of input to sed) to backslash-escape any +# character that might be a shell metacharacter, then use eval to reverse +# that process (while maintaining the separation between arguments), and wrap +# the whole thing up as a single "set" statement. +# +# This will of course break if any of these variables contains a newline or +# an unmatched quote. +# + +eval "set -- $( + printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" | + xargs -n1 | + sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' | + tr '\n' ' ' + )" '"$@"' + +exec "$JAVACMD" "$@" diff --git a/android/gradlew.bat b/android/gradlew.bat new file mode 100644 index 0000000..5eed7ee --- /dev/null +++ b/android/gradlew.bat @@ -0,0 +1,94 @@ +@rem +@rem Copyright 2015 the original author or authors. +@rem +@rem Licensed under the Apache License, Version 2.0 (the "License"); +@rem you may not use this file except in compliance with the License. +@rem You may obtain a copy of the License at +@rem +@rem https://www.apache.org/licenses/LICENSE-2.0 +@rem +@rem Unless required by applicable law or agreed to in writing, software +@rem distributed under the License is distributed on an "AS IS" BASIS, +@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +@rem See the License for the specific language governing permissions and +@rem limitations under the License. +@rem +@rem SPDX-License-Identifier: Apache-2.0 +@rem + +@if "%DEBUG%"=="" @echo off +@rem ########################################################################## +@rem +@rem Gradle startup script for Windows +@rem +@rem ########################################################################## + +@rem Set local scope for the variables with windows NT shell +if "%OS%"=="Windows_NT" setlocal + +set DIRNAME=%~dp0 +if "%DIRNAME%"=="" set DIRNAME=. +@rem This is normally unused +set APP_BASE_NAME=%~n0 +set APP_HOME=%DIRNAME% + +@rem Resolve any "." and ".." in APP_HOME to make it shorter. +for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi + +@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" + +@rem Find java.exe +if defined JAVA_HOME goto findJavaFromJavaHome + +set JAVA_EXE=java.exe +%JAVA_EXE% -version >NUL 2>&1 +if %ERRORLEVEL% equ 0 goto execute + +echo. 1>&2 +echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2 +echo. 1>&2 +echo Please set the JAVA_HOME variable in your environment to match the 1>&2 +echo location of your Java installation. 1>&2 + +goto fail + +:findJavaFromJavaHome +set JAVA_HOME=%JAVA_HOME:"=% +set JAVA_EXE=%JAVA_HOME%/bin/java.exe + +if exist "%JAVA_EXE%" goto execute + +echo. 1>&2 +echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2 +echo. 1>&2 +echo Please set the JAVA_HOME variable in your environment to match the 1>&2 +echo location of your Java installation. 1>&2 + +goto fail + +:execute +@rem Setup the command line + +set CLASSPATH= + + +@rem Execute Gradle +"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" -jar "%APP_HOME%\gradle\wrapper\gradle-wrapper.jar" %* + +:end +@rem End local scope for the variables with windows NT shell +if %ERRORLEVEL% equ 0 goto mainEnd + +:fail +rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of +rem the _cmd.exe /c_ return code! +set EXIT_CODE=%ERRORLEVEL% +if %EXIT_CODE% equ 0 set EXIT_CODE=1 +if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE% +exit /b %EXIT_CODE% + +:mainEnd +if "%OS%"=="Windows_NT" endlocal + +:omega diff --git a/android/settings.gradle.kts b/android/settings.gradle.kts new file mode 100644 index 0000000..99ad4d6 --- /dev/null +++ b/android/settings.gradle.kts @@ -0,0 +1,24 @@ +pluginManagement { + repositories { + google() + mavenCentral() + gradlePluginPortal() + } +} + +dependencyResolutionManagement { + repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS) + repositories { + google() + mavenCentral() + // The Kotlin half of rustls-platform-verifier (the Rust code checks + // TLS certificates against the Android trust store through it). + maven { + url = uri("https://raw.githubusercontent.com/rustls/rustls-platform-verifier/maven-archive/android-release-support/maven/") + content { includeGroup("org.rustls") } + } + } +} + +rootProject.name = "voelin" +include(":app") diff --git a/crates/tsc-core/Cargo.toml b/crates/tsc-core/Cargo.toml deleted file mode 100644 index fa9195b..0000000 --- a/crates/tsc-core/Cargo.toml +++ /dev/null @@ -1,37 +0,0 @@ -[package] -name = "tsc-core" -version = "0.1.0" -description = "Client engine: server sessions merging voice, gateway and query sources; the API the UI drives." -edition.workspace = true -rust-version.workspace = true -license.workspace = true -repository.workspace = true -publish.workspace = true - -[features] -default = ["audio-device"] -# Capture and play audio through the system's devices. -audio-device = ["tsc-audio/device"] - -[dependencies] -anyhow = "1" -futures = "0.3" -serde_json = "1" -thiserror = "2" -tokio = { version = "1", features = ["macros", "rt-multi-thread", "sync", "time"] } -tokio-tungstenite = "0.30" -tracing = "0.1" -tsc-audio = { path = "../tsc-audio", default-features = false } -tsc-gateway-proto = { path = "../tsc-gateway-proto" } -tsc-model = { path = "../tsc-model" } -tsc-observer = { path = "../tsc-observer" } -tsc-query = { path = "../tsc-query" } -tsc-stream = { path = "../tsc-stream" } -tsclientlib = { path = "../proto/tsclientlib" } -tsproto-packets = { path = "../proto/tsproto-packets" } - -[dev-dependencies] -tokio = { version = "1", features = ["macros", "rt-multi-thread", "test-util"] } - -[lints] -workspace = true diff --git a/crates/tsc-ui/Cargo.toml b/crates/tsc-ui/Cargo.toml deleted file mode 100644 index d053477..0000000 --- a/crates/tsc-ui/Cargo.toml +++ /dev/null @@ -1,38 +0,0 @@ -[package] -name = "tsc-ui" -version = "0.1.0" -description = "Slint user interface and the desktop binary." -edition.workspace = true -rust-version.workspace = true -license.workspace = true -repository.workspace = true -publish.workspace = true - -[lib] -name = "tsc_ui" -path = "src/lib.rs" - -[[bin]] -name = "tsc-desktop" -path = "src/main.rs" - -[dependencies] -anyhow = "1.0.104" -chrono = { version = "0.4.45", default-features = false, features = ["clock"] } -dirs = "6" -png = "0.18" -slint = { version = "1.18", features = ["renderer-software"] } -tokio = { version = "1.53.1", features = ["rt-multi-thread", "macros", "time", "sync"] } -tracing = "0.1.44" -tracing-subscriber = { version = "0.3.23", features = ["env-filter"] } -tsc-core = { path = "../tsc-core" } -tsc-model = { path = "../tsc-model" } -tsc-query = { path = "../tsc-query" } -tsc-store = { path = "../tsc-store", features = ["keyring"] } -tsclientlib = { path = "../proto/tsclientlib" } - -[build-dependencies] -slint-build = "1.18" - -[lints] -workspace = true diff --git a/crates/tsc-ui/src/app.rs b/crates/tsc-ui/src/app.rs deleted file mode 100644 index 1a10ac8..0000000 --- a/crates/tsc-ui/src/app.rs +++ /dev/null @@ -1,780 +0,0 @@ -//! Application state on the UI thread, wired to the engine. - -use std::cell::RefCell; -use std::collections::{HashMap, HashSet}; -use std::rc::Rc; -use std::sync::Arc; - -use anyhow::{Context, Result}; -use slint::{ComponentHandle, ModelRc, SharedString, VecModel}; -use tokio::runtime::Runtime; -use tracing::warn; -use tsc_core::{ - Command, Engine, Event, ObserveState, SessionState, Source, VoiceOptions, VoiceState, -}; -use tsc_model::{ChannelId, ChatMessage, ChatTarget, Presence, TreeRow, tree_rows}; -use tsc_store::{Bookmark, MemorySecrets, QueryConfig, QueryTransport, Secrets, Store}; - -slint::include_modules!(); - -/// Secrets in the OS keyring, or in memory when there is none (headless -/// Linux without a Secret Service). -struct FallbackSecrets { - keyring: tsc_store::KeyringSecrets, - memory: MemorySecrets, -} - -impl Secrets for FallbackSecrets { - fn get(&self, key: &str) -> tsc_store::Result> { - match self.memory.get(key)? { - Some(v) => Ok(Some(v)), - None => Ok(self.keyring.get(key).unwrap_or(None)), - } - } - - fn set(&self, key: &str, value: &str) -> tsc_store::Result<()> { - if let Err(error) = self.keyring.set(key, value) { - warn!(%error, "keyring unavailable, keeping the secret for this session only"); - return self.memory.set(key, value); - } - Ok(()) - } - - fn delete(&self, key: &str) -> tsc_store::Result<()> { - let _ = self.keyring.delete(key); - self.memory.delete(key) - } -} - -struct Tab { - target: ChatTarget, - title: String, - lines: Vec, - unread: i32, -} - -/// What we know about one server session. -struct SessionView { - state: SessionState, - presence: Arc, - collapsed: HashSet, - talking: HashSet, - tabs: Vec, - current_tab: usize, - /// The own channel's tab was focused for this voice connection. - focused_own_channel: bool, -} - -impl Default for SessionView { - fn default() -> Self { - Self { - state: SessionState::default(), - presence: Arc::default(), - collapsed: HashSet::new(), - talking: HashSet::new(), - tabs: vec![Tab { - target: ChatTarget::Server, - title: "Server".into(), - lines: Vec::new(), - unread: 0, - }], - current_tab: 0, - focused_own_channel: false, - } - } -} - -struct App { - ui: slint::Weak, - store: Store, - secrets: Box, - engine: Engine, - identity: tsclientlib::Identity, - bookmarks: Vec, - current: Option, - sessions: HashMap, - status: String, -} - -thread_local! { - static APP: RefCell> = const { RefCell::new(None) }; -} - -fn with_app(f: impl FnOnce(&mut App) -> R) -> Option { - APP.with(|app| app.borrow_mut().as_mut().map(f)) -} - -/// Start options for [`run`]. -#[derive(Clone, Debug, Default)] -pub struct RunOptions { - /// Where the client database lives. Default: `TSC_DATA_DIR`, else - /// `/tsc`. Mobile platforms pass their app storage directory. - pub data_dir: Option, -} - -/// Run the app on the current thread until the window closes. The Slint -/// platform must be set up before (the default backend on desktop). -pub fn run(options: RunOptions) -> Result<()> { - let runtime = Runtime::new()?; - let engine = runtime.block_on(async { Engine::start() }); - - // Development switches: TSC_DATA_DIR isolates the database, - // TSC_AUTOCONNECT=voice|observe connects the first bookmark on start, - // TSC_SCREENSHOT= saves the window after TSC_SCREENSHOT_DELAY seconds and exits. - let dir = match (options.data_dir, std::env::var_os("TSC_DATA_DIR")) { - (Some(dir), _) => dir, - (None, Some(dir)) => dir.into(), - (None, None) => dirs::data_dir().unwrap_or_else(|| ".".into()).join("tsc"), - }; - let store = - Store::open(&dir.join("client.db")).context("failed to open the client database")?; - let identity = match store.identities()?.first() { - Some(entry) => store.identity(entry.id)?, - None => { - // Creating an identity takes a moment (security level 8). - let identity = tsclientlib::Identity::create(); - store.add_identity("Default", &identity)?; - identity - } - }; - - let ui = MainWindow::new()?; - let bookmarks = store.bookmarks()?; - let app = App { - ui: ui.as_weak(), - store, - secrets: Box::new(FallbackSecrets { - keyring: tsc_store::KeyringSecrets::new("tsc-client"), - memory: MemorySecrets::default(), - }), - engine: engine.clone(), - identity, - current: bookmarks.first().map(|b| b.id), - bookmarks, - sessions: HashMap::new(), - status: "Ready".into(), - }; - APP.with(|a| *a.borrow_mut() = Some(app)); - wire_callbacks(&ui); - with_app(|app| app.refresh_all()); - - // Engine events -> UI thread. - let mut events = engine.subscribe(); - runtime.spawn(async move { - loop { - match events.recv().await { - Ok(event) => { - let _ = slint::invoke_from_event_loop(move || { - with_app(|app| app.handle_event(event)); - }); - } - Err(tokio::sync::broadcast::error::RecvError::Lagged(_)) => continue, - Err(_) => break, - } - } - }); - - match std::env::var("TSC_AUTOCONNECT").as_deref() { - Ok("voice") => { - with_app(|app| app.connect_voice()); - } - Ok("observe") => { - with_app(|app| app.toggle_observe()); - } - _ => {} - } - let _screenshot_timer = std::env::var_os("TSC_SCREENSHOT").map(|path| { - let delay = - std::env::var("TSC_SCREENSHOT_DELAY").ok().and_then(|d| d.parse().ok()).unwrap_or(4); - let weak = ui.as_weak(); - let timer = slint::Timer::default(); - timer.start( - slint::TimerMode::SingleShot, - std::time::Duration::from_secs(delay), - move || { - if let Some(ui) = weak.upgrade() { - if let Err(e) = save_screenshot(&ui, std::path::Path::new(&path)) { - eprintln!("screenshot failed: {e}"); - } - let _ = ui.hide(); - } - }, - ); - timer - }); - - ui.run()?; - APP.with(|a| a.borrow_mut().take()); - runtime.shutdown_timeout(std::time::Duration::from_secs(2)); - Ok(()) -} - -fn wire_callbacks(ui: &MainWindow) { - let bridge = ui.global::(); - bridge.on_select_server(|id| { - with_app(|app| { - app.current = Some(id as i64); - app.refresh_all(); - }); - }); - bridge.on_connect_voice(|| { - with_app(|app| app.connect_voice()); - }); - bridge.on_disconnect_voice(|| { - with_app(|app| app.command(|session| Command::DisconnectVoice { session })); - }); - bridge.on_toggle_observe(|| { - with_app(|app| app.toggle_observe()); - }); - bridge.on_join_channel(|cid| { - with_app(|app| { - app.command(|session| Command::MoveToChannel { - session, - channel: cid as ChannelId, - password: None, - }) - }); - }); - bridge.on_open_channel_chat(|cid| { - with_app(|app| app.open_chat(ChatTarget::Channel(cid as ChannelId), true)); - }); - bridge.on_toggle_collapse(|cid| { - with_app(|app| { - if let Some(view) = app.view_mut() { - let cid = cid as ChannelId; - if !view.collapsed.remove(&cid) { - view.collapsed.insert(cid); - } - } - app.refresh_tree(); - }); - }); - bridge.on_select_tab(|i| { - with_app(|app| { - if let Some(view) = app.view_mut() { - view.current_tab = i as usize; - if let Some(tab) = view.tabs.get_mut(i as usize) { - tab.unread = 0; - } - } - app.refresh_chat(); - }); - }); - bridge.on_close_tab(|i| { - with_app(|app| app.close_tab(i as usize)); - }); - bridge.on_send_message(|text| { - with_app(|app| app.send_message(text.to_string())); - }); - bridge.on_set_input_muted(|muted| { - with_app(|app| app.command(|session| Command::SetInputMuted { session, muted })); - }); - bridge.on_set_output_muted(|muted| { - with_app(|app| app.command(|session| Command::SetOutputMuted { session, muted })); - }); - bridge.on_push_to_talk(|on| { - with_app(|app| app.command(|session| Command::SetTransmitting { session, on })); - }); - bridge.on_edit_bookmark(|id| with_app(|app| app.bookmark_form(id as i64)).unwrap_or_default()); - bridge.on_save_bookmark(|form| { - with_app(|app| app.save_bookmark(form)); - }); - bridge.on_delete_bookmark(|id| { - with_app(|app| app.delete_bookmark(id as i64)); - }); -} - -fn save_screenshot(ui: &MainWindow, path: &std::path::Path) -> Result<()> { - let image = ui.window().take_snapshot()?; - let file = std::io::BufWriter::new(std::fs::File::create(path)?); - let mut encoder = png::Encoder::new(file, image.width(), image.height()); - encoder.set_color(png::ColorType::Rgba); - encoder.set_depth(png::BitDepth::Eight); - encoder.write_header()?.write_image_data(image.as_bytes())?; - Ok(()) -} - -fn time_of(ts_ms: i64) -> String { - chrono::DateTime::from_timestamp_millis(ts_ms) - .map(|t| t.with_timezone(&chrono::Local).format("%H:%M").to_string()) - .unwrap_or_default() -} - -fn model(items: Vec) -> ModelRc { - ModelRc::from(Rc::new(VecModel::from(items))) -} - -impl App { - fn view_mut(&mut self) -> Option<&mut SessionView> { - let id = self.current?; - Some(self.sessions.entry(id).or_default()) - } - - fn bookmark(&self, id: i64) -> Option<&Bookmark> { - self.bookmarks.iter().find(|b| b.id == id) - } - - fn command(&self, f: impl FnOnce(u64) -> Command) { - if let Some(id) = self.current { - self.engine.send(f(id as u64)); - } - } - - fn set_status(&mut self, text: impl Into) { - self.status = text.into(); - if let Some(ui) = self.ui.upgrade() { - ui.global::().set_status_text(self.status.clone().into()); - } - } - - fn connect_voice(&mut self) { - let Some(b) = self.current.and_then(|id| self.bookmark(id)).cloned() else { return }; - let mut options = VoiceOptions::new(&b.address, &b.nickname); - options.identity = Some(self.identity.clone()); - options.server_password = self.secrets.get(&b.server_password_key()).ok().flatten(); - options.channel = b.default_channel.clone(); - options.audio = true; - self.engine - .send(Command::ConnectVoice { session: b.id as u64, options: Box::new(options) }); - self.set_status(format!("Connecting to {}…", b.address)); - } - - fn toggle_observe(&mut self) { - let Some(b) = self.current.and_then(|id| self.bookmark(id)).cloned() else { return }; - let session = b.id as u64; - let observing = - self.sessions.get(&b.id).is_some_and(|v| v.state.observe != ObserveState::Off); - if observing { - self.engine.send(Command::StopObserving { session }); - return; - } - if let Some(url) = &b.gateway_url { - self.engine.send(Command::ObserveGateway { - session, - url: url.clone(), - identity: Box::new(self.identity.clone()), - }); - } else if let Some(q) = &b.query { - let secret = self.secrets.get(&b.query_password_key()).ok().flatten(); - let transport = match q.transport { - QueryTransport::Raw => tsc_query::Transport::Raw, - QueryTransport::Ssh => tsc_query::Transport::Ssh, - QueryTransport::Http => tsc_query::Transport::Http, - }; - let connect = tsc_query::Connect { - transport, - addr: format!("{}:{}", q.host, q.port), - user: q.user.clone(), - secret, - server_port: q.server_port, - server_id: None, - line: Default::default(), - }; - self.engine.send(Command::ObserveQuery { session, connect: Box::new(connect) }); - } - self.set_status("Observing invisibly…"); - } - - fn open_chat(&mut self, target: ChatTarget, focus: bool) { - let Some(id) = self.current else { return }; - let title = match &target { - ChatTarget::Channel(cid) => { - let name = self - .sessions - .get(&id) - .and_then(|v| v.presence.channels.get(cid).map(|c| c.name.clone())); - format!("#{}", name.unwrap_or_else(|| cid.to_string())) - } - ChatTarget::Server => "Server".into(), - ChatTarget::Private(uid) => format!("@{uid}"), - }; - let view = self.sessions.entry(id).or_default(); - let index = match view.tabs.iter().position(|t| t.target == target) { - Some(i) => i, - None => { - view.tabs.push(Tab { target: target.clone(), title, lines: Vec::new(), unread: 0 }); - self.engine.send(Command::OpenChat { session: id as u64, target }); - view.tabs.len() - 1 - } - }; - if focus { - view.current_tab = index; - view.tabs[index].unread = 0; - } - self.refresh_chat(); - } - - fn close_tab(&mut self, index: usize) { - let Some(id) = self.current else { return }; - let view = self.sessions.entry(id).or_default(); - if index == 0 || index >= view.tabs.len() { - return; - } - let tab = view.tabs.remove(index); - view.current_tab = view.current_tab.min(view.tabs.len() - 1); - self.engine.send(Command::CloseChat { session: id as u64, target: tab.target }); - self.refresh_chat(); - } - - fn send_message(&mut self, text: String) { - let Some(id) = self.current else { return }; - let Some(view) = self.sessions.get(&id) else { return }; - let target = view.tabs[view.current_tab].target.clone(); - self.engine.send(Command::SendChat { session: id as u64, target, text }); - } - - fn bookmark_form(&self, id: i64) -> BookmarkForm { - let Some(b) = self.bookmark(id) else { - return BookmarkForm { - id: -1, - nickname: std::env::var("USER").unwrap_or_default().into(), - query_transport: "none".into(), - query_user: "serveradmin".into(), - ..Default::default() - }; - }; - let secret = |key: String| -> SharedString { - self.secrets.get(&key).ok().flatten().unwrap_or_default().into() - }; - let (transport, addr, user) = match &b.query { - Some(q) => ( - match q.transport { - QueryTransport::Raw => "raw", - QueryTransport::Ssh => "ssh", - QueryTransport::Http => "http", - }, - format!("{}:{}", q.host, q.port), - q.user.clone(), - ), - None => ("none", String::new(), "serveradmin".to_string()), - }; - BookmarkForm { - id: b.id as i32, - name: b.name.clone().into(), - address: b.address.clone().into(), - nickname: b.nickname.clone().into(), - server_password: secret(b.server_password_key()), - gateway_url: b.gateway_url.clone().unwrap_or_default().into(), - query_transport: transport.into(), - query_addr: addr.into(), - query_user: user.into(), - query_password: secret(b.query_password_key()), - } - } - - fn save_bookmark(&mut self, form: BookmarkForm) { - let query = match form.query_transport.as_str() { - "none" | "" => None, - t => { - let (host, port) = form - .query_addr - .rsplit_once(':') - .map_or((form.query_addr.to_string(), None), |(h, p)| { - (h.to_string(), p.parse().ok()) - }); - let transport = match t { - "raw" => QueryTransport::Raw, - "http" => QueryTransport::Http, - _ => QueryTransport::Ssh, - }; - let default_port = match transport { - QueryTransport::Raw => 10011, - QueryTransport::Ssh => 10022, - QueryTransport::Http => 10080, - }; - Some(QueryConfig { - transport, - host, - port: port.unwrap_or(default_port), - user: form.query_user.to_string(), - server_port: None, - }) - } - }; - let mut bookmark = Bookmark { - id: form.id as i64, - name: if form.name.is_empty() { - form.address.to_string() - } else { - form.name.to_string() - }, - address: form.address.to_string(), - nickname: form.nickname.to_string(), - identity: None, - default_channel: None, - gateway_url: Some(form.gateway_url.to_string()).filter(|u| !u.is_empty()), - query, - client_version: None, - }; - let result = if bookmark.id < 0 { - self.store.add_bookmark(&bookmark).map(|id| bookmark.id = id) - } else { - self.store.update_bookmark(&bookmark) - }; - if let Err(e) = result { - self.set_status(format!("Could not save: {e}")); - return; - } - for (key, value) in [ - (bookmark.server_password_key(), &form.server_password), - (bookmark.query_password_key(), &form.query_password), - ] { - let result = if value.is_empty() { - self.secrets.delete(&key) - } else { - self.secrets.set(&key, value) - }; - if let Err(e) = result { - warn!(%e, "could not store secret"); - } - } - self.current = Some(bookmark.id); - self.bookmarks = self.store.bookmarks().unwrap_or_default(); - self.refresh_all(); - } - - fn delete_bookmark(&mut self, id: i64) { - self.engine.send(Command::CloseSession { session: id as u64 }); - if let Some(b) = self.bookmark(id).cloned() { - let _ = self.secrets.delete(&b.server_password_key()); - let _ = self.secrets.delete(&b.query_password_key()); - } - let _ = self.store.delete_bookmark(id); - self.sessions.remove(&id); - self.bookmarks = self.store.bookmarks().unwrap_or_default(); - self.current = self.bookmarks.first().map(|b| b.id); - self.refresh_all(); - } - - fn handle_event(&mut self, event: Event) { - match event { - Event::State { session, state } => { - let id = session as i64; - let view = self.sessions.entry(id).or_default(); - let was_voice = view.state.voice; - view.state = state.clone(); - if state.voice != VoiceState::Connected { - view.focused_own_channel = false; - } - let focus = !view.focused_own_channel; - if state.voice == VoiceState::Connected && was_voice != VoiceState::Connected { - self.set_status("Connected"); - } - if self.current == Some(id) { - // The voice channel's chat is always at hand, and focused - // once per connection. - if let (Some(cid), VoiceState::Connected) = (state.own_channel, state.voice) { - self.open_chat(ChatTarget::Channel(cid), focus); - self.sessions.entry(id).or_default().focused_own_channel = true; - } - } - self.refresh_servers(); - self.refresh_toolbar(); - } - Event::ServerInfo { session, name, flavor, .. } => { - if self.current == Some(session as i64) { - let kind = match flavor { - tsc_model::ServerFlavor::Ts3(v) => format!("TeamSpeak 3 {v}"), - tsc_model::ServerFlavor::Ts6(v) => format!("TeamSpeak 6 {v}"), - tsc_model::ServerFlavor::Unknown(v) => v, - }; - self.set_status(format!("Connected to {name} ({kind})")); - } - } - Event::Presence { session, presence } => { - self.sessions.entry(session as i64).or_default().presence = presence; - if self.current == Some(session as i64) { - self.refresh_tree(); - self.refresh_chat(); - } - } - Event::Talking { session, client, talking } => { - let view = self.sessions.entry(session as i64).or_default(); - if talking { - view.talking.insert(client); - } else { - view.talking.remove(&client); - } - if self.current == Some(session as i64) { - self.refresh_tree(); - } - } - Event::Chat { session, message } => self.add_message(session as i64, message), - Event::Error { message, .. } => self.set_status(message), - // Stream events: the streams panel is not wired yet. - _ => {} - } - } - - fn add_message(&mut self, id: i64, message: ChatMessage) { - let current = self.current == Some(id); - let view = self.sessions.entry(id).or_default(); - let index = match view.tabs.iter().position(|t| t.target == message.target) { - Some(i) => i, - None => { - let title = match &message.target { - ChatTarget::Channel(cid) => format!( - "#{}", - view.presence - .channels - .get(cid) - .map(|c| c.name.clone()) - .unwrap_or_else(|| cid.to_string()) - ), - ChatTarget::Private(_) => format!("@{}", message.author_name), - ChatTarget::Server => "Server".into(), - }; - view.tabs.push(Tab { - target: message.target.clone(), - title, - lines: Vec::new(), - unread: 0, - }); - view.tabs.len() - 1 - } - }; - let tab = &mut view.tabs[index]; - tab.lines.push(ChatLine { - author: message.author_name.into(), - text: message.text.into(), - time: time_of(message.ts_ms).into(), - relayed: message.via_relay, - }); - if !(current && view.current_tab == index) { - tab.unread += 1; - } - if current { - self.refresh_chat(); - } - } - - fn refresh_all(&mut self) { - self.refresh_servers(); - self.refresh_toolbar(); - self.refresh_tree(); - self.refresh_chat(); - } - - fn refresh_servers(&self) { - let Some(ui) = self.ui.upgrade() else { return }; - let bridge = ui.global::(); - let items = self - .bookmarks - .iter() - .map(|b| { - let state = self.sessions.get(&b.id).map(|v| v.state.clone()).unwrap_or_default(); - let status = match (state.voice, state.observe) { - (VoiceState::Connected, _) => "connected", - (VoiceState::Connecting, _) | (_, ObserveState::Connecting) => "connecting", - (_, ObserveState::Observing) => "observing", - _ => "offline", - }; - ServerItem { - id: b.id as i32, - name: b.name.clone().into(), - address: b.address.clone().into(), - status: status.into(), - } - }) - .collect(); - bridge.set_servers(model(items)); - bridge.set_current_server(self.current.map_or(-1, |id| id as i32)); - } - - fn refresh_toolbar(&self) { - let Some(ui) = self.ui.upgrade() else { return }; - let bridge = ui.global::(); - let bookmark = self.current.and_then(|id| self.bookmark(id)); - let state = self - .current - .and_then(|id| self.sessions.get(&id)) - .map(|v| v.state.clone()) - .unwrap_or_default(); - bridge.set_server_title( - bookmark.map_or("No server selected".into(), |b| b.name.clone()).into(), - ); - bridge.set_voice_connected(state.voice == VoiceState::Connected); - bridge.set_voice_connecting(state.voice == VoiceState::Connecting); - bridge.set_observing(state.observe != ObserveState::Off); - bridge.set_can_observe( - bookmark.is_some_and(|b| b.gateway_url.is_some() || b.query.is_some()), - ); - bridge.set_input_muted(state.input_muted); - bridge.set_output_muted(state.output_muted); - bridge.set_transmitting(state.transmitting); - bridge.set_presence_source( - match state.presence_source { - Some(Source::Voice) => "live (voice)", - Some(Source::Gateway) => "invisible (gateway)", - Some(Source::Query) => "invisible (query)", - None => "", - } - .into(), - ); - bridge.set_status_text(self.status.clone().into()); - } - - fn refresh_tree(&self) { - let Some(ui) = self.ui.upgrade() else { return }; - let Some(view) = self.current.and_then(|id| self.sessions.get(&id)) else { - ui.global::().set_tree(model(Vec::new())); - return; - }; - let own_channel = view.state.own_channel; - let rows = tree_rows(&view.presence, &|cid| view.collapsed.contains(&cid)) - .into_iter() - .map(|row| match row { - TreeRow::Channel { depth, channel } => TreeItem { - is_channel: true, - depth: depth as i32, - id: channel.id as i32, - name: channel.name.clone().into(), - own: own_channel == Some(channel.id), - locked: channel.has_password, - collapsed: view.collapsed.contains(&channel.id), - ..Default::default() - }, - TreeRow::Client { depth, client } => TreeItem { - is_channel: false, - depth: depth as i32, - id: client.id as i32, - name: client.nickname.clone().into(), - own: false, - talking: view.talking.contains(&client.id) || client.talking == Some(true), - muted: client.input_muted, - sound_off: client.output_muted, - away: client.away.is_some(), - streaming: client.streaming == Some(true), - ..Default::default() - }, - }) - .collect(); - ui.global::().set_tree(model(rows)); - } - - fn refresh_chat(&self) { - let Some(ui) = self.ui.upgrade() else { return }; - let bridge = ui.global::(); - let Some(view) = self.current.and_then(|id| self.sessions.get(&id)) else { - bridge.set_tabs(model(vec![ChatTab { title: "Server".into(), ..Default::default() }])); - bridge.set_messages(model(Vec::new())); - return; - }; - let tabs = view - .tabs - .iter() - .map(|t| ChatTab { - title: t.title.clone().into(), - kind: matches!(t.target, ChatTarget::Channel(_)) as i32, - id: match t.target { - ChatTarget::Channel(cid) => cid as i32, - _ => 0, - }, - unread: t.unread, - }) - .collect(); - bridge.set_tabs(model(tabs)); - bridge.set_current_tab(view.current_tab as i32); - bridge.set_messages(model(view.tabs[view.current_tab].lines.clone())); - } -} diff --git a/crates/tsc-ui/src/lib.rs b/crates/tsc-ui/src/lib.rs deleted file mode 100644 index f65782f..0000000 --- a/crates/tsc-ui/src/lib.rs +++ /dev/null @@ -1,5 +0,0 @@ -//! Slint user interface shared by the desktop binary and the mobile apps. - -mod app; - -pub use app::{RunOptions, run}; diff --git a/crates/tsc-ui/ui/app.slint b/crates/tsc-ui/ui/app.slint deleted file mode 100644 index 4fd44a4..0000000 --- a/crates/tsc-ui/ui/app.slint +++ /dev/null @@ -1,537 +0,0 @@ -import { Button, LineEdit, ListView, ComboBox, AboutSlint, VerticalBox, HorizontalBox, ScrollView } from "std-widgets.slint"; - -export struct ServerItem { - id: int, - name: string, - address: string, - // "offline", "connecting", "observing" or "connected" - status: string, -} - -export struct TreeItem { - is-channel: bool, - depth: int, - id: int, - name: string, - own: bool, - talking: bool, - muted: bool, - sound-off: bool, - away: bool, - streaming: bool, - locked: bool, - collapsed: bool, -} - -export struct ChatTab { - title: string, - // 0 = server chat, 1 = channel chat - kind: int, - id: int, - unread: int, -} - -export struct ChatLine { - author: string, - text: string, - time: string, - relayed: bool, -} - -export struct BookmarkForm { - id: int, - name: string, - address: string, - nickname: string, - server-password: string, - gateway-url: string, - query-transport: string, - query-addr: string, - query-user: string, - query-password: string, -} - -export global Bridge { - in property <[ServerItem]> servers; - in-out property current-server: -1; - in property <[TreeItem]> tree; - in property <[ChatTab]> tabs; - in-out property current-tab: 0; - in property <[ChatLine]> messages; - in property status-text; - in property server-title: "No server selected"; - in property voice-connected; - in property voice-connecting; - in property observing; - in property can-observe; - in property input-muted; - in property output-muted; - in property transmitting; - in property presence-source; - - callback select-server(int); - callback connect-voice(); - callback disconnect-voice(); - callback toggle-observe(); - callback join-channel(int); - callback open-channel-chat(int); - callback toggle-collapse(int); - callback select-tab(int); - callback close-tab(int); - callback send-message(string); - callback set-input-muted(bool); - callback set-output-muted(bool); - callback push-to-talk(bool); - callback edit-bookmark(int) -> BookmarkForm; - callback save-bookmark(BookmarkForm); - callback delete-bookmark(int); -} - -component StatusDot inherits Rectangle { - in property status; - width: 10px; - height: 10px; - border-radius: 5px; - background: status == "connected" ? #3fb950 : status == "observing" ? #58a6ff : status == "connecting" ? #d29922 : #6e7681; -} - -component Field inherits HorizontalLayout { - in property label; - in-out property value; - in property placeholder; - in property input-type: InputType.text; - spacing: 8px; - Text { - text: label; - width: 130px; - vertical-alignment: center; - } - LineEdit { - text <=> value; - placeholder-text: placeholder; - input-type: input-type; - } -} - -component BookmarkEditor inherits Rectangle { - in-out property form; - callback done(); - background: #000000a0; - TouchArea { } - Rectangle { - width: min(parent.width - 32px, 520px); - height: min(parent.height - 32px, 520px); - background: #1f2328; - border-radius: 8px; - VerticalBox { - Text { - text: form.id < 0 ? "Add server" : "Edit server"; - font-size: 18px; - font-weight: 700; - } - ScrollView { - VerticalLayout { - spacing: 6px; - Field { label: "Name"; value <=> form.name; placeholder: "My server"; } - Field { label: "Address"; value <=> form.address; placeholder: "ts.example.org:9987"; } - Field { label: "Nickname"; value <=> form.nickname; } - Field { label: "Server password"; value <=> form.server-password; input-type: InputType.password; } - Text { - text: "Invisible presence and chat without joining (optional)"; - font-weight: 600; - } - Field { label: "Gateway URL"; value <=> form.gateway-url; placeholder: "wss://gw.example.org/v1"; } - HorizontalLayout { - spacing: 8px; - Text { - text: "Query transport"; - width: 130px; - vertical-alignment: center; - } - ComboBox { - model: ["none", "ssh", "raw", "http"]; - current-value <=> form.query-transport; - } - } - Field { label: "Query address"; value <=> form.query-addr; placeholder: "ts.example.org:10022"; } - Field { label: "Query login"; value <=> form.query-user; } - Field { label: "Query password"; value <=> form.query-password; input-type: InputType.password; } - } - } - HorizontalLayout { - alignment: end; - spacing: 8px; - if form.id >= 0: Button { - text: "Delete"; - clicked => { - Bridge.delete-bookmark(form.id); - done(); - } - } - Button { - text: "Cancel"; - clicked => { done(); } - } - Button { - text: "Save"; - primary: true; - enabled: form.address != "" && form.nickname != ""; - clicked => { - Bridge.save-bookmark(form); - done(); - } - } - } - } - } -} - -component ServerList inherits Rectangle { - callback add(); - callback edit(int); - background: #161b22; - VerticalBox { - HorizontalLayout { - Text { - text: "Servers"; - font-weight: 700; - vertical-alignment: center; - } - Button { - text: "+"; - width: 32px; - clicked => { add(); } - } - } - ListView { - for server[i] in Bridge.servers: Rectangle { - height: 48px; - border-radius: 6px; - background: Bridge.current-server == server.id ? #30363d : area.has-hover ? #21262d : transparent; - area := TouchArea { - clicked => { Bridge.select-server(server.id); } - double-clicked => { edit(server.id); } - } - HorizontalLayout { - padding: 6px; - spacing: 8px; - StatusDot { - status: server.status; - y: (parent.height - self.height) / 2; - } - VerticalLayout { - Text { - text: server.name; - font-weight: 600; - overflow: elide; - } - Text { - text: server.address; - font-size: 11px; - color: #8b949e; - overflow: elide; - } - } - } - } - } - } -} - -component ChannelTree inherits Rectangle { - background: #0d1117; - ListView { - for row in Bridge.tree: Rectangle { - height: 26px; - background: row-area.has-hover ? #161b22 : transparent; - row-area := TouchArea { - double-clicked => { - if (row.is-channel) { - Bridge.join-channel(row.id); - } - } - clicked => { - if (row.is-channel) { - Bridge.open-channel-chat(row.id); - } - } - } - HorizontalLayout { - padding-left: 8px + row.depth * 18px; - padding-right: 8px; - spacing: 6px; - if row.is-channel: Text { - text: row.collapsed ? "▸" : "▾"; - vertical-alignment: center; - TouchArea { - clicked => { Bridge.toggle-collapse(row.id); } - } - } - if !row.is-channel: Rectangle { - width: 10px; - height: 10px; - y: (parent.height - self.height) / 2; - border-radius: 5px; - background: row.talking ? #3fb950 : #30363d; - } - Text { - text: (row.is-channel ? "# " : "") + row.name; - horizontal-stretch: 1; - horizontal-alignment: left; - vertical-alignment: center; - font-weight: row.is-channel || row.own ? 600 : 400; - color: row.away ? #8b949e : row.own ? #58a6ff : #e6edf3; - overflow: elide; - } - if row.locked: Text { text: "password"; font-size: 10px; color: #d29922; vertical-alignment: center; } - if row.muted: Text { text: "mic off"; font-size: 10px; color: #f85149; vertical-alignment: center; } - if row.sound-off: Text { text: "sound off"; font-size: 10px; color: #f85149; vertical-alignment: center; } - if row.streaming: Text { text: "LIVE"; font-size: 10px; color: #a371f7; vertical-alignment: center; } - if row.away: Text { text: "away"; font-size: 10px; color: #8b949e; vertical-alignment: center; } - } - } - } -} - -component ChatPanel inherits Rectangle { - background: #0d1117; - VerticalLayout { - HorizontalLayout { - height: 34px; - spacing: 2px; - for tab[i] in Bridge.tabs: Rectangle { - width: tab-text.preferred-width + 28px; - background: Bridge.current-tab == i ? #30363d : tab-area.has-hover ? #21262d : #161b22; - tab-area := TouchArea { - clicked => { Bridge.select-tab(i); } - } - HorizontalLayout { - padding-left: 10px; - padding-right: 6px; - spacing: 4px; - tab-text := Text { - text: tab.title + (tab.unread > 0 ? " (" + tab.unread + ")" : ""); - vertical-alignment: center; - font-weight: tab.unread > 0 ? 700 : 400; - } - if tab.kind == 1: Text { - text: "×"; - vertical-alignment: center; - TouchArea { - clicked => { Bridge.close-tab(i); } - } - } - } - } - Rectangle { } - } - ListView { - for line in Bridge.messages: VerticalLayout { - padding: 6px; - HorizontalLayout { - spacing: 8px; - Text { - text: line.author; - font-weight: 700; - color: line.relayed ? #58a6ff : #e6edf3; - } - Text { - text: line.time + (line.relayed ? " via relay" : ""); - font-size: 11px; - color: #8b949e; - vertical-alignment: center; - } - } - Text { - text: line.text; - wrap: word-wrap; - } - } - } - HorizontalLayout { - padding: 6px; - spacing: 6px; - input := LineEdit { - placeholder-text: "Message"; - accepted(text) => { - if (text != "") { - Bridge.send-message(text); - self.text = ""; - } - } - } - Button { - text: "Send"; - clicked => { - if (input.text != "") { - Bridge.send-message(input.text); - input.text = ""; - } - } - } - } - } -} - -export component MainWindow inherits Window { - title: "TS Client"; - preferred-width: 1200px; - preferred-height: 760px; - min-width: 360px; - min-height: 480px; - background: #0d1117; - default-font-size: 13px; - - property editing: false; - property show-about: false; - property form; - // Phones and narrow windows show one pane at a time. Set from a change - // handler: a binding on `width` would loop through the layout. - property narrow: false; - changed width => { narrow = self.width < 800px; } - init => { narrow = self.width < 800px; } - property pane: 1; - - VerticalLayout { - // Toolbar - Rectangle { - height: 48px; - background: #161b22; - HorizontalLayout { - padding: 6px; - spacing: 6px; - if narrow: Button { - text: pane == 0 ? "Tree" : pane == 1 ? "Chat" : "Servers"; - clicked => { pane = mod(pane + 1, 3); } - } - Text { - text: Bridge.server-title; - font-size: 15px; - font-weight: 700; - vertical-alignment: center; - overflow: elide; - } - Rectangle { } - Button { - text: Bridge.voice-connected ? "Disconnect" : Bridge.voice-connecting ? "Connecting…" : "Connect"; - enabled: Bridge.current-server >= 0 && !Bridge.voice-connecting; - primary: !Bridge.voice-connected; - clicked => { - if (Bridge.voice-connected) { - Bridge.disconnect-voice(); - } else { - Bridge.connect-voice(); - } - } - } - Button { - text: Bridge.observing ? "Stop observing" : "Observe (invisible)"; - enabled: Bridge.can-observe; - clicked => { Bridge.toggle-observe(); } - } - Button { - text: Bridge.input-muted ? "Mic: off" : "Mic: on"; - enabled: Bridge.voice-connected; - clicked => { Bridge.set-input-muted(!Bridge.input-muted); } - } - Button { - text: Bridge.output-muted ? "Sound: off" : "Sound: on"; - enabled: Bridge.voice-connected; - clicked => { Bridge.set-output-muted(!Bridge.output-muted); } - } - ptt := Rectangle { - width: 110px; - border-radius: 4px; - background: Bridge.transmitting ? #238636 : ptt-area.has-hover ? #30363d : #21262d; - opacity: Bridge.voice-connected ? 1.0 : 0.4; - Text { - text: Bridge.transmitting ? "Talking…" : "Hold to talk"; - } - ptt-area := TouchArea { - enabled: Bridge.voice-connected; - pointer-event(e) => { - if (e.kind == PointerEventKind.down) { - Bridge.push-to-talk(true); - } else if (e.kind == PointerEventKind.up || e.kind == PointerEventKind.cancel) { - Bridge.push-to-talk(false); - } - } - } - } - Button { - text: "About"; - clicked => { show-about = true; } - } - } - } - HorizontalLayout { - if !narrow || pane == 2: ServerList { - // Fixed width beside the other panes, all the space alone. - min-width: narrow ? 0px : 230px; - max-width: narrow ? 100000px : 230px; - horizontal-stretch: narrow ? 1 : 0; - add => { - form = Bridge.edit-bookmark(-1); - editing = true; - } - edit(id) => { - form = Bridge.edit-bookmark(id); - editing = true; - } - } - if !narrow || pane == 0: ChannelTree { - min-width: narrow ? 0px : 360px; - max-width: narrow ? 100000px : 360px; - horizontal-stretch: narrow ? 1 : 0; - } - if !narrow || pane == 1: ChatPanel { } - } - // Status bar - Rectangle { - height: 26px; - background: #161b22; - HorizontalLayout { - padding-left: 8px; - padding-right: 8px; - Text { - text: Bridge.status-text; - color: #8b949e; - vertical-alignment: center; - overflow: elide; - } - Rectangle { } - Text { - text: Bridge.presence-source; - color: #58a6ff; - vertical-alignment: center; - } - } - } - } - - if editing: BookmarkEditor { - form <=> form; - done => { editing = false; } - } - - if show-about: Rectangle { - background: #000000c0; - TouchArea { - clicked => { show-about = false; } - } - VerticalBox { - alignment: center; - Text { - text: "Unofficial TeamSpeak 3/6 compatible client. Not affiliated with TeamSpeak Systems GmbH."; - horizontal-alignment: center; - wrap: word-wrap; - } - AboutSlint { } - Text { - text: "Third-party licenses: see THIRD_PARTY_NOTICES. Click to close."; - horizontal-alignment: center; - color: #8b949e; - } - } - } -} diff --git a/crates/voelin-android/Cargo.toml b/crates/voelin-android/Cargo.toml new file mode 100644 index 0000000..4bca1ef --- /dev/null +++ b/crates/voelin-android/Cargo.toml @@ -0,0 +1,37 @@ +[package] +name = "voelin-android" +version = "0.1.0" +description = "Android app library: native activity entry point, engine kept for the whole process, JNI bridge to the Kotlin services (voice, screen share), Android Keystore secrets." +edition.workspace = true +rust-version.workspace = true +license.workspace = true +repository.workspace = true +publish.workspace = true + +[lib] +name = "voelin_android" +# cdylib: libvoelin_android.so, loaded by the app's NativeActivity. rlib: tests +# and type checks on the host. +crate-type = ["cdylib", "rlib"] + +[dependencies] +tokio = { version = "1.53.1", features = ["rt-multi-thread", "macros", "sync", "time"] } +tracing = "0.1.44" +voelin-core = { path = "../voelin-core" } + +[target.'cfg(target_os = "android")'.dependencies] +anyhow = "1.0.104" +jni = "0.22.4" +rustls-platform-verifier = "0.7.1" +slint = { version = "1.18", default-features = false, features = ["std", "compat-1-2", "backend-android-activity-06"] } +tracing-subscriber = { version = "0.3.23", features = ["env-filter"] } +voelin-media = { path = "../voelin-media", default-features = false } +voelin-platform = { path = "../voelin-platform", default-features = false } +voelin-store = { path = "../voelin-store" } +voelin-ui = { path = "../voelin-ui" } + +[dev-dependencies] +voelin-model = { path = "../voelin-model" } + +[lints] +workspace = true diff --git a/crates/voelin-android/src/app.rs b/crates/voelin-android/src/app.rs new file mode 100644 index 0000000..c1a5b3d --- /dev/null +++ b/crates/voelin-android/src/app.rs @@ -0,0 +1,150 @@ +//! `android_main`: the activity's native thread. +//! +//! android-activity calls it on a new thread for every activity instance +//! (the process can outlive activities while voice runs in the service). +//! Process-wide setup happens once; the window is built per activity. + +use std::path::Path; +use std::sync::{Mutex, Once, OnceLock, PoisonError}; + +use anyhow::Context as _; +use slint::android::AndroidApp; +use tracing::{error, info, warn}; +use voelin_core::Command; + +use crate::foreground::Foreground; +use crate::host::EngineHost; +use crate::{bridge, capture, egl, secrets}; + +/// Store setting (`bool`): the user's opt-in to local crash reports. +pub const CRASH_REPORTS_SETTING: &str = "crash_reports"; + +static HOST: OnceLock = OnceLock::new(); +static FOREGROUND: Mutex> = Mutex::new(None); + +fn host() -> anyhow::Result<&'static EngineHost> { + if let Some(host) = HOST.get() { + return Ok(host); + } + let host = EngineHost::start().context("starting the engine runtime")?; + Ok(HOST.get_or_init(|| host)) +} + +fn with_foreground(f: impl FnOnce(&mut Foreground) -> R) -> R { + let mut guard = FOREGROUND.lock().unwrap_or_else(PoisonError::into_inner); + f(guard.get_or_insert_with(Foreground::default)) +} + +/// The entry point android-activity looks up in this library. +#[allow(unsafe_code)] // an exported symbol +#[unsafe(no_mangle)] +fn android_main(app: AndroidApp) { + init_logging(); + info!("android_main"); + if let Err(e) = run(app) { + error!("{e:#}"); + } + info!("android_main done"); +} + +fn init_logging() { + // android-activity forwards stderr to logcat (tag RustStdoutStderr). + let filter = tracing_subscriber::EnvFilter::try_from_default_env() + .unwrap_or_else(|_| tracing_subscriber::EnvFilter::new("info")); + let _ = tracing_subscriber::fmt() + .with_env_filter(filter) + .with_ansi(false) + .without_time() + .with_writer(std::io::stderr) + .try_init(); +} + +fn run(app: AndroidApp) -> anyhow::Result<()> { + let data_dir = app.internal_data_path().context("the app has no internal storage path")?; + install_crash_reports(&data_dir); + jni::JavaVM::singleton()?.attach_current_thread(|env| -> jni::errors::Result<()> { + bridge::init(env)?; + // reqwest (HTTPS queries, tsclientlib) verifies certificates with + // the system's trust store through rustls-platform-verifier. + let context = bridge::context(env)?; + rustls_platform_verifier::android::init_with_env(env, context)?; + Ok(()) + })?; + let host = host()?; + static PROCESS: Once = Once::new(); + PROCESS.call_once(|| { + // Before Slint creates the first window surface. + egl::reserve_skia_extension_slots(); + capture::register(); + watch_voice(host); + }); + if let Err(e) = bridge::request_permissions() { + warn!("requesting permissions: {e}"); + } + + slint::android::init(app).context("Slint Android backend")?; + let attached = host.attach(); + voelin_ui::run(voelin_ui::RunOptions { + data_dir: Some(data_dir), + secrets: Some(Box::new(secrets::KeystoreSecrets)), + engine: Some(voelin_ui::HostedEngine { + engine: attached.engine, + runtime: attached.runtime, + events: attached.events, + }), + }) +} + +/// Local crash reports in `/crash-reports`, recorded only if the +/// user opted in (off by default). +fn install_crash_reports(data_dir: &Path) { + voelin_platform::crash::set_app_version(env!("CARGO_PKG_VERSION")); + let enabled = voelin_store::Store::open(&data_dir.join("client.db")) + .ok() + .and_then(|store| store.setting::(CRASH_REPORTS_SETTING).ok().flatten()) + .unwrap_or(false); + voelin_platform::crash::install(data_dir.join(voelin_platform::crash::DIR_NAME), enabled); +} + +/// Keep the voice foreground service in step with the voice connections. +fn watch_voice(host: &'static EngineHost) { + let mut events = host.engine().subscribe(); + host.runtime().spawn(async move { + loop { + match events.recv().await { + Ok(event) => { + if let Some(notice) = with_foreground(|f| f.update(&event)) + && let Err(e) = bridge::set_voice_notification(notice.as_ref()) + { + warn!("voice service: {e}"); + } + } + Err(tokio::sync::broadcast::error::RecvError::Lagged(_)) => continue, + Err(tokio::sync::broadcast::error::RecvError::Closed) => break, + } + } + }); +} + +/// "Disconnect" in the voice notification. +pub fn disconnect_voice() { + let Some(host) = HOST.get() else { + return; + }; + for session in with_foreground(|f| f.voice_sessions()) { + host.engine().send(Command::DisconnectVoice { session }); + } +} + +/// "Mute" / "Unmute" in the voice notification: mute every voice session, +/// or unmute them all when all are muted. +pub fn toggle_mute() { + let Some(host) = HOST.get() else { + return; + }; + let (sessions, muted) = + with_foreground(|f| (f.voice_sessions(), f.notice().is_some_and(|n| n.muted))); + for session in sessions { + host.engine().send(Command::SetInputMuted { session, muted: !muted }); + } +} diff --git a/crates/voelin-android/src/bridge.rs b/crates/voelin-android/src/bridge.rs new file mode 100644 index 0000000..8b5d065 --- /dev/null +++ b/crates/voelin-android/src/bridge.rs @@ -0,0 +1,273 @@ +//! JNI glue with the app's Kotlin side (`android/app/src/main/java/...`). +//! +//! - Rust → Kotlin: static methods of `io.github.faumaray.voelin.Bridge`, called +//! from any thread (the class is looked up once on the `android_main` +//! thread, whose class loader sees the app's classes). +//! - Kotlin → Rust: the `external` methods of `io.github.faumaray.voelin.Native`, +//! exported below with `native_method!` (panics and errors become Java +//! exceptions instead of crossing the FFI boundary). + +use std::sync::OnceLock; + +use jni::errors::{Error, Result}; +use jni::objects::{JByteBuffer, JClass, JFloatArray, JObject, JString, JValue}; +use jni::refs::{Global, Reference as _}; +use jni::sys::{jboolean, jint, jlong}; +use jni::{Env, JavaVM, jni_sig, jni_str, native_method}; + +use crate::foreground::VoiceNotice; + +static BRIDGE: OnceLock>> = OnceLock::new(); + +/// Look up `Bridge` (on the `android_main` thread). +pub fn init(env: &mut Env) -> Result<()> { + if BRIDGE.get().is_none() { + let class = env.load_class(jni_str!("io.github.faumaray.voelin.Bridge"))?; + let _ = BRIDGE.set(env.new_global_ref(class)?); + } + Ok(()) +} + +/// Run `f` with an attached thread and the `Bridge` class. +fn with_bridge(f: impl FnOnce(&mut Env, &Global>) -> Result) -> Result { + let class = BRIDGE + .get() + .ok_or_else(|| Error::ClassNotFound { name: "io.github.faumaray.voelin.Bridge".into() })?; + JavaVM::singleton()?.attach_current_thread(|env| f(env, class)) +} + +/// The application `Context`, as a local reference of `env`'s frame. +pub fn context<'local>(env: &mut Env<'local>) -> Result> { + let class = BRIDGE + .get() + .ok_or_else(|| Error::ClassNotFound { name: "io.github.faumaray.voelin.Bridge".into() })?; + env.call_static_method( + class, + jni_str!("context"), + jni_sig!(() -> android.content.Context), + &[], + )? + .l() +} + +/// Ask for the microphone and notification permissions if not granted yet. +pub fn request_permissions() -> Result<()> { + with_bridge(|env, class| { + env.call_static_method(class, jni_str!("requestPermissions"), jni_sig!(() -> void), &[])?; + Ok(()) + }) +} + +/// Show or update the voice service's notification; `None` stops the service. +pub fn set_voice_notification(notice: Option<&VoiceNotice>) -> Result<()> { + with_bridge(|env, class| { + let (text, muted) = match notice { + Some(n) => (JObject::from(env.new_string(&n.text)?), n.muted), + None => (JObject::null(), false), + }; + env.call_static_method( + class, + jni_str!("setVoiceNotification"), + jni_sig!((text: java.lang.String, muted: jboolean) -> void), + &[JValue::Object(&text), JValue::Bool(muted)], + )?; + Ok(()) + }) +} + +/// Ask the user to share the screen. The answer comes back through +/// `Native.onScreenCaptureResult`. +pub fn request_screen_capture(fps: u32, max_size: u32) -> Result<()> { + with_bridge(|env, class| { + env.call_static_method( + class, + jni_str!("requestScreenCapture"), + jni_sig!((fps: jint, max_size: jint) -> void), + &[JValue::Int(fps as jint), JValue::Int(max_size as jint)], + )?; + Ok(()) + }) +} + +pub fn stop_screen_capture() -> Result<()> { + with_bridge(|env, class| { + env.call_static_method(class, jni_str!("stopScreenCapture"), jni_sig!(() -> void), &[])?; + Ok(()) + }) +} + +/// Capture what the device plays; `false` without a running screen capture. +pub fn start_system_audio() -> Result { + with_bridge(|env, class| { + env.call_static_method(class, jni_str!("startSystemAudio"), jni_sig!(() -> jboolean), &[])? + .z() + }) +} + +pub fn stop_system_audio() -> Result<()> { + with_bridge(|env, class| { + env.call_static_method(class, jni_str!("stopSystemAudio"), jni_sig!(() -> void), &[])?; + Ok(()) + }) +} + +pub fn secret_get(key: &str) -> Result> { + with_bridge(|env, class| { + let key = JObject::from(env.new_string(key)?); + let value = env + .call_static_method( + class, + jni_str!("secretGet"), + jni_sig!((key: java.lang.String) -> java.lang.String), + &[JValue::Object(&key)], + )? + .l()?; + if value.is_null() { + return Ok(None); + } + let value = env.cast_local::(value)?; + Ok(Some(value.try_to_string(env)?)) + }) +} + +pub fn secret_set(key: &str, value: &str) -> Result<()> { + with_bridge(|env, class| { + let key = JObject::from(env.new_string(key)?); + let value = JObject::from(env.new_string(value)?); + env.call_static_method( + class, + jni_str!("secretSet"), + jni_sig!((key: java.lang.String, value: java.lang.String) -> void), + &[JValue::Object(&key), JValue::Object(&value)], + )?; + Ok(()) + }) +} + +pub fn secret_delete(key: &str) -> Result<()> { + with_bridge(|env, class| { + let key = JObject::from(env.new_string(key)?); + env.call_static_method( + class, + jni_str!("secretDelete"), + jni_sig!((key: java.lang.String) -> void), + &[JValue::Object(&key)], + )?; + Ok(()) + }) +} + +// Native methods of `Native` (Kotlin `object` with `@JvmStatic external`). + +const _: jni::NativeMethod = native_method! { + java_type = "io.github.faumaray.voelin.Native", + static extern fn on_screen_capture_result(granted: jboolean, error: JString), +}; + +fn on_screen_capture_result<'local>( + env: &mut Env<'local>, + _class: JClass<'local>, + granted: jboolean, + error: JString<'local>, +) -> Result<()> { + let error = if error.is_null() { None } else { Some(error.try_to_string(env)?) }; + crate::capture::on_result(granted, error); + Ok(()) +} + +const _: jni::NativeMethod = native_method! { + java_type = "io.github.faumaray.voelin.Native", + static extern fn on_screen_frame( + pixels: JByteBuffer, + width: jint, + height: jint, + row_stride: jint, + timestamp_ns: jlong, + ) -> jboolean, +}; + +/// An RGBA frame from the `ImageReader`. Returns `false` when frames are no +/// longer wanted (the service then stops capturing). +fn on_screen_frame<'local>( + env: &mut Env<'local>, + _class: JClass<'local>, + pixels: JByteBuffer<'local>, + width: jint, + height: jint, + row_stride: jint, + timestamp_ns: jlong, +) -> Result { + if !crate::capture::wants_frames() { + return Ok(false); + } + let address = env.get_direct_buffer_address(&pixels)?; + let capacity = env.get_direct_buffer_capacity(&pixels)?; + if address.is_null() { + return Err(Error::NullPtr("screen frame buffer")); + } + // SAFETY: a direct buffer's memory is `capacity` bytes at `address`, and + // the `Image` it belongs to stays open until this call returns. + #[allow(unsafe_code)] + let bytes = unsafe { std::slice::from_raw_parts(address, capacity) }.to_vec(); + Ok(crate::capture::on_frame( + bytes, + width.max(0) as u32, + height.max(0) as u32, + row_stride.max(0) as usize, + timestamp_ns, + )) +} + +const _: jni::NativeMethod = native_method! { + java_type = "io.github.faumaray.voelin.Native", + static extern fn on_screen_capture_stopped(), +}; + +fn on_screen_capture_stopped<'local>(_env: &mut Env<'local>, _class: JClass<'local>) -> Result<()> { + crate::capture::on_stopped(); + Ok(()) +} + +const _: jni::NativeMethod = native_method! { + java_type = "io.github.faumaray.voelin.Native", + static extern fn on_system_audio(samples: jfloat[], count: jint, channels: jint, timestamp_ns: jlong) -> jboolean, +}; + +/// Interleaved 48 kHz float samples of what the device plays. +fn on_system_audio<'local>( + env: &mut Env<'local>, + _class: JClass<'local>, + samples: JFloatArray<'local>, + count: jint, + channels: jint, + timestamp_ns: jlong, +) -> Result { + if !crate::capture::wants_audio() { + return Ok(false); + } + let mut buffer = vec![0f32; count.max(0) as usize]; + samples.get_region(env, 0, &mut buffer)?; + Ok(crate::capture::on_audio(buffer, channels.clamp(1, 8) as u16, timestamp_ns)) +} + +const _: jni::NativeMethod = native_method! { + java_type = "io.github.faumaray.voelin.Native", + static extern fn on_disconnect_voice(), +}; + +/// "Disconnect" in the voice notification. +fn on_disconnect_voice<'local>(_env: &mut Env<'local>, _class: JClass<'local>) -> Result<()> { + crate::app::disconnect_voice(); + Ok(()) +} + +const _: jni::NativeMethod = native_method! { + java_type = "io.github.faumaray.voelin.Native", + static extern fn on_toggle_mute(), +}; + +/// "Mute" / "Unmute" in the voice notification. +fn on_toggle_mute<'local>(_env: &mut Env<'local>, _class: JClass<'local>) -> Result<()> { + crate::app::toggle_mute(); + Ok(()) +} diff --git a/crates/voelin-android/src/capture.rs b/crates/voelin-android/src/capture.rs new file mode 100644 index 0000000..9a2a298 --- /dev/null +++ b/crates/voelin-android/src/capture.rs @@ -0,0 +1,216 @@ +//! Screen and system-audio capture through MediaProjection. +//! +//! Registered as `voelin_media` capture providers, so stream code captures with +//! `voelin_media::capture::default_screen_capture()` as on desktop. Starting +//! asks the Kotlin side for the user's consent; on consent it runs +//! `ScreenCaptureService` (a `mediaProjection` foreground service) whose +//! `ImageReader` hands RGBA frames to [`on_frame`]. System audio +//! (`AudioPlaybackCapture`, 48 kHz float) needs that running projection. + +use std::sync::{Arc, Mutex, MutexGuard, PoisonError}; +use std::time::Duration; + +use tokio::sync::oneshot; +use tracing::warn; +use voelin_media::capture::external::{self, AudioProvider, ScreenProvider}; +use voelin_media::capture::{BoxFuture, CaptureOptions, CaptureSource, SourceId}; +use voelin_media::{AudioBuffer, Error, FrameSender, Result, VideoFrame}; + +use crate::bridge; + +const SCREEN: &str = "mediaprojection"; +const AUDIO: &str = "playbackcapture"; +/// Longest side of captured frames (the service scales the display down). +const MAX_SIZE: u32 = 1920; + +#[derive(Default)] +struct State { + frames: Option>, + /// Answer for the pending `start`. + pending: Option>>, + audio: Option>, + /// Clock origin of frame and audio timestamps (both `CLOCK_MONOTONIC` + /// nanoseconds: `Image.timestamp`, `System.nanoTime`), so they stay in sync. + origin_ns: Option, +} + +static STATE: Mutex> = Mutex::new(None); + +fn with_state(f: impl FnOnce(&mut State) -> R) -> R { + let mut guard: MutexGuard<'_, Option> = + STATE.lock().unwrap_or_else(PoisonError::into_inner); + f(guard.get_or_insert_with(State::default)) +} + +/// Make MediaProjection the default screen and audio capture. +pub fn register() { + external::set_screen_provider(Some(Arc::new(Projection))); + external::set_audio_provider(Some(Arc::new(PlaybackAudio))); +} + +fn since(first: &mut Option, now_ns: i64) -> Duration { + let first = *first.get_or_insert(now_ns); + Duration::from_nanos(u64::try_from(now_ns - first).unwrap_or(0)) +} + +struct Projection; + +impl ScreenProvider for Projection { + fn name(&self) -> &'static str { + SCREEN + } + + fn sources(&self) -> Vec { + vec![CaptureSource { + // The system dialog picks (whole screen, or one app on Android 14+). + id: SourceId::Portal, + name: "Screen".into(), + width: 0, + height: 0, + primary: true, + }] + } + + fn start( + &self, + _source: &SourceId, + options: &CaptureOptions, + frames: FrameSender, + ) -> BoxFuture<'static, Result<()>> { + let (tx, rx) = oneshot::channel(); + with_state(|s| { + if let Some(previous) = s.pending.replace(tx) { + let _ = previous.send(Err(Error::Cancelled)); + } + s.frames = Some(frames); + s.origin_ns = None; + }); + if let Err(e) = bridge::request_screen_capture(options.fps.clamp(1, 60), MAX_SIZE) { + with_state(|s| { + s.pending = None; + s.frames = None; + }); + let error = Error::CaptureUnavailable { backend: SCREEN, reason: e.to_string() }; + return Box::pin(async move { Err(error) }); + } + Box::pin(async move { rx.await.unwrap_or(Err(Error::Cancelled)) }) + } + + fn stop(&self) { + on_stopped(); + if let Err(e) = bridge::stop_screen_capture() { + warn!("stopping screen capture: {e}"); + } + } +} + +struct PlaybackAudio; + +impl AudioProvider for PlaybackAudio { + fn name(&self) -> &'static str { + AUDIO + } + + fn start(&self, buffers: FrameSender) -> Result<()> { + with_state(|s| { + s.audio = Some(buffers); + }); + let started = bridge::start_system_audio(); + match started { + Ok(true) => Ok(()), + Ok(false) | Err(_) => { + with_state(|s| s.audio = None); + let reason = match started { + Err(e) => e.to_string(), + _ => "needs a running screen capture (and the microphone permission)".into(), + }; + Err(Error::CaptureUnavailable { backend: AUDIO, reason }) + } + } + } + + fn stop(&self) { + with_state(|s| s.audio = None); + if let Err(e) = bridge::stop_system_audio() { + warn!("stopping system audio: {e}"); + } + } +} + +/// The user answered the consent dialog (or the service failed to start). +pub fn on_result(granted: bool, error: Option) { + with_state(|s| { + let result = match (granted, error) { + (true, _) => Ok(()), + (false, None) => Err(Error::Cancelled), + (false, Some(message)) => Err(Error::Capture { backend: SCREEN, message }), + }; + if result.is_err() { + s.frames = None; + } + if let Some(pending) = s.pending.take() { + let _ = pending.send(result); + } + }); +} + +pub fn wants_frames() -> bool { + with_state(|s| s.frames.as_ref().is_some_and(|f| !f.is_closed())) +} + +/// A captured RGBA frame. Returns `false` once nobody wants frames. +pub fn on_frame( + pixels: Vec, + width: u32, + height: u32, + stride: usize, + timestamp_ns: i64, +) -> bool { + with_state(|s| { + let timestamp = since(&mut s.origin_ns, timestamp_ns); + let Some(frames) = &s.frames else { + return false; + }; + match VideoFrame::from_rgba(width, height, stride, pixels) { + Ok(frame) => { + if !frames.send(frame.with_timestamp(timestamp)) { + s.frames = None; + return false; + } + } + Err(e) => warn!("dropping a screen frame: {e}"), + } + true + }) +} + +/// The projection ended (stopped by us, the user, or the system): the +/// consumers see their channels close. +pub fn on_stopped() { + with_state(|s| { + s.frames = None; + s.audio = None; + if let Some(pending) = s.pending.take() { + let _ = pending.send(Err(Error::Cancelled)); + } + }); +} + +pub fn wants_audio() -> bool { + with_state(|s| s.audio.as_ref().is_some_and(|a| !a.is_closed())) +} + +/// Captured playback audio. Returns `false` once nobody wants it. +pub fn on_audio(samples: Vec, channels: u16, timestamp_ns: i64) -> bool { + with_state(|s| { + let timestamp = since(&mut s.origin_ns, timestamp_ns); + let Some(audio) = &s.audio else { + return false; + }; + if !audio.send(AudioBuffer { samples, channels, timestamp }) { + s.audio = None; + return false; + } + true + }) +} diff --git a/crates/voelin-android/src/egl.rs b/crates/voelin-android/src/egl.rs new file mode 100644 index 0000000..9c34514 --- /dev/null +++ b/crates/voelin-android/src/egl.rs @@ -0,0 +1,135 @@ +//! Keep EGL extension slots for Skia (Mesa-based Android, e.g. Waydroid). +//! +//! Android's libEGL gives each GL function it has no built-in entry point for +//! one of a fixed number of "extension slots" (256) the first time +//! `eglGetProcAddress` looks it up. Slint's Skia OpenGL surface first loads +//! glow's whole function table, desktop GL included, and only then lets Skia +//! assemble its GLES interface. Vendor drivers return nothing for desktop-only +//! names, but Mesa returns an entry point for every name, so under Mesa glow +//! uses up all slots. Skia then gets nothing for the extension functions it +//! needs, e.g. `glTextureBarrierNV` when the driver advertises +//! `GL_NV_texture_barrier`, and the app cannot draw ("Could not create Skia +//! Direct Context from GL interface", with "no more slots for +//! eglGetProcAddress" before it in logcat). +//! +//! Looking Skia's extension functions up once, before Slint creates its +//! surface, gives them slots first; libEGL remembers them, and the lookups +//! that later fail are glow's desktop-only ones, which nothing here uses. + +use std::ffi::{CStr, c_char, c_void}; + +use tracing::info; + +#[link(name = "EGL")] +#[allow(unsafe_code)] // FFI declaration +unsafe extern "C" { + fn eglGetProcAddress(procname: *const c_char) -> *const c_void; +} + +/// Every extension function (name with a vendor suffix) that Skia's GLES +/// interface can look up: `GET_PROC_SUFFIX` in Skia m153's +/// `src/gpu/ganesh/gl/GrGLAssembleGLESInterfaceAutogen.cpp` (the version +/// skia-safe 0.153 builds). Core GLES functions have built-in entry points and +/// need no slot. Update the list when skia-safe moves to a new Skia milestone. +const SKIA_GLES_EXTENSION_FUNCTIONS: &[&CStr] = &[ + c"glBeginQueryEXT", + c"glBindFragDataLocationEXT", + c"glBindFragDataLocationIndexedEXT", + c"glBindUniformLocationCHROMIUM", + c"glBindVertexArrayOES", + c"glBlendBarrierKHR", + c"glBlendBarrierNV", + c"glBlitFramebufferANGLE", + c"glBlitFramebufferCHROMIUM", + c"glBlitFramebufferNV", + c"glClearTexImageEXT", + c"glClearTexSubImageEXT", + c"glClientWaitSyncAPPLE", + c"glCopyBufferSubDataNV", + c"glDebugMessageCallbackKHR", + c"glDebugMessageControlKHR", + c"glDebugMessageInsertKHR", + c"glDeleteFencesNV", + c"glDeleteQueriesEXT", + c"glDeleteSyncAPPLE", + c"glDeleteVertexArraysOES", + c"glDiscardFramebufferEXT", + c"glDrawArraysInstancedANGLE", + c"glDrawArraysInstancedBaseInstanceANGLE", + c"glDrawArraysInstancedBaseInstanceEXT", + c"glDrawArraysInstancedEXT", + c"glDrawElementsInstancedANGLE", + c"glDrawElementsInstancedBaseVertexBaseInstanceANGLE", + c"glDrawElementsInstancedBaseVertexBaseInstanceEXT", + c"glDrawElementsInstancedEXT", + c"glEndQueryEXT", + c"glEndTilingQCOM", + c"glFenceSyncAPPLE", + c"glFinishFenceNV", + c"glFlushMappedBufferRangeEXT", + c"glFramebufferTexture2DMultisampleEXT", + c"glFramebufferTexture2DMultisampleIMG", + c"glGenFencesNV", + c"glGenQueriesEXT", + c"glGenVertexArraysOES", + c"glGetDebugMessageLogKHR", + c"glGetProgramBinaryOES", + c"glGetQueryObjecti64vEXT", + c"glGetQueryObjectui64vEXT", + c"glGetQueryObjectuivEXT", + c"glGetQueryivEXT", + c"glInsertEventMarkerEXT", + c"glIsSyncAPPLE", + c"glMapBufferOES", + c"glMapBufferRangeEXT", + c"glMapBufferSubDataCHROMIUM", + c"glMapTexSubImage2DCHROMIUM", + c"glMultiDrawArraysIndirectEXT", + c"glMultiDrawArraysInstancedBaseInstanceANGLE", + c"glMultiDrawElementsIndirectEXT", + c"glMultiDrawElementsInstancedBaseVertexBaseInstanceANGLE", + c"glObjectLabelKHR", + c"glPatchParameteriOES", + c"glPopDebugGroupKHR", + c"glPopGroupMarkerEXT", + c"glProgramBinaryOES", + c"glPushDebugGroupKHR", + c"glPushGroupMarkerEXT", + c"glQueryCounterEXT", + c"glRenderbufferStorageMultisampleANGLE", + c"glRenderbufferStorageMultisampleCHROMIUM", + c"glResolveMultisampleFramebufferAPPLE", + c"glSetFenceNV", + c"glStartTilingQCOM", + c"glTestFenceNV", + c"glTexBufferEXT", + c"glTexBufferOES", + c"glTexBufferRangeEXT", + c"glTexBufferRangeOES", + c"glTexStorage2DEXT", + c"glTextureBarrierNV", + c"glUnmapBufferOES", + c"glUnmapBufferSubDataCHROMIUM", + c"glUnmapTexSubImage2DCHROMIUM", + c"glVertexAttribDivisorANGLE", + c"glVertexAttribDivisorEXT", + c"glWaitSyncAPPLE", + c"glWindowRectanglesEXT", +]; + +/// Look up [`SKIA_GLES_EXTENSION_FUNCTIONS`] so libEGL keeps their slots. +/// Call once per process, before the first window is shown. +pub fn reserve_skia_extension_slots() { + let found = SKIA_GLES_EXTENSION_FUNCTIONS.iter().filter(|name| resolves(name)).count(); + info!( + "EGL: {found} of {} Skia extension functions resolved ahead of Slint's surface", + SKIA_GLES_EXTENSION_FUNCTIONS.len() + ); +} + +#[allow(unsafe_code)] // the FFI call +fn resolves(name: &CStr) -> bool { + // SAFETY: `name` is NUL-terminated; eglGetProcAddress may be the first EGL + // call of the process and only returns an address, which is not used. + !unsafe { eglGetProcAddress(name.as_ptr()) }.is_null() +} diff --git a/crates/voelin-android/src/foreground.rs b/crates/voelin-android/src/foreground.rs new file mode 100644 index 0000000..bd6bc1f --- /dev/null +++ b/crates/voelin-android/src/foreground.rs @@ -0,0 +1,132 @@ +//! When the app needs its voice foreground service. +//! +//! Android keeps the microphone and the process of a backgrounded app only +//! while a foreground service with a visible notification runs. The service +//! runs while any session has a voice connection (connecting or connected); +//! its notification names the servers and offers Mute and Disconnect. + +use std::collections::BTreeMap; + +use voelin_core::{Event, SessionId, VoiceState}; + +/// What the voice notification shows. +#[derive(Clone, Debug, PartialEq, Eq)] +pub struct VoiceNotice { + pub text: String, + /// The microphone is muted in every voice session (the action unmutes). + pub muted: bool, +} + +#[derive(Default)] +pub struct Foreground { + sessions: BTreeMap, +} + +#[derive(Default)] +struct Session { + name: Option, + voice: VoiceState, + muted: bool, +} + +impl Foreground { + /// Apply `event`. Returns the new notification when it changed: + /// `Some(None)` means the service should stop. + pub fn update(&mut self, event: &Event) -> Option> { + let before = self.notice(); + match event { + Event::State { session, state } => { + let s = self.sessions.entry(*session).or_default(); + s.voice = state.voice; + s.muted = state.input_muted; + } + Event::ServerInfo { session, name, .. } => { + self.sessions.entry(*session).or_default().name = Some(name.clone()); + } + _ => return None, + } + let after = self.notice(); + (after != before).then_some(after) + } + + fn active(&self) -> impl Iterator { + self.sessions.iter().filter(|(_, s)| s.voice != VoiceState::Disconnected) + } + + /// Sessions with a voice connection (for the notification's actions). + pub fn voice_sessions(&self) -> Vec { + self.active().map(|(id, _)| *id).collect() + } + + /// The notification, `None` without voice. + pub fn notice(&self) -> Option { + let active: Vec<&Session> = self.active().map(|(_, s)| s).collect(); + if active.is_empty() { + return None; + } + let names: Vec<&str> = + active.iter().map(|s| s.name.as_deref().unwrap_or("a server")).collect(); + let names = names.join(", "); + let text = if active.iter().all(|s| s.voice == VoiceState::Connecting) { + format!("Connecting to {names}") + } else { + format!("In voice on {names}") + }; + Some(VoiceNotice { text, muted: active.iter().all(|s| s.muted) }) + } +} + +#[cfg(test)] +mod tests { + use voelin_core::SessionState; + use voelin_model::{Capabilities, ServerFlavor}; + + use super::*; + + fn voice(session: SessionId, voice: VoiceState, input_muted: bool) -> Event { + Event::State { + session, + state: SessionState { voice, input_muted, ..SessionState::default() }, + } + } + + fn notice(text: &str, muted: bool) -> Option> { + Some(Some(VoiceNotice { text: text.into(), muted })) + } + + #[test] + fn service_follows_voice_connections() { + let mut fg = Foreground::default(); + assert_eq!(fg.update(&voice(1, VoiceState::Disconnected, false)), None); + assert_eq!( + fg.update(&voice(1, VoiceState::Connecting, false)), + notice("Connecting to a server", false) + ); + let info = Event::ServerInfo { + session: 1, + name: "Home".into(), + flavor: ServerFlavor::Unknown(String::new()), + capabilities: Capabilities::default(), + }; + assert_eq!(fg.update(&info), notice("Connecting to Home", false)); + assert_eq!( + fg.update(&voice(1, VoiceState::Connected, false)), + notice("In voice on Home", false) + ); + assert_eq!(fg.update(&voice(1, VoiceState::Connected, false)), None, "no change"); + assert_eq!( + fg.update(&voice(1, VoiceState::Connected, true)), + notice("In voice on Home", true) + ); + // A second session that is not muted: the action mutes both. + assert_eq!( + fg.update(&voice(2, VoiceState::Connecting, false)), + notice("In voice on Home, a server", false) + ); + assert_eq!(fg.voice_sessions(), [1, 2]); + assert_eq!(fg.update(&Event::Error { session: 1, message: "x".into() }), None); + fg.update(&voice(2, VoiceState::Disconnected, false)); + assert_eq!(fg.update(&voice(1, VoiceState::Disconnected, true)), Some(None)); + assert!(fg.voice_sessions().is_empty()); + } +} diff --git a/crates/voelin-android/src/host.rs b/crates/voelin-android/src/host.rs new file mode 100644 index 0000000..d773d99 --- /dev/null +++ b/crates/voelin-android/src/host.rs @@ -0,0 +1,314 @@ +//! The engine for the whole process. +//! +//! Android destroys and recreates the activity (and so the window and its +//! thread) while a voice call goes on in a foreground service. The engine +//! therefore lives here, on its own runtime, for as long as the process; a +//! new window [attaches](EngineHost::attach) and first receives events that +//! rebuild the current state ([`Replay`]), then the live ones. + +use std::collections::{BTreeMap, VecDeque}; +use std::sync::{Arc, Mutex, MutexGuard, PoisonError}; + +use tokio::runtime::{Handle, Runtime}; +use tokio::sync::{broadcast, mpsc}; +use voelin_core::{Engine, Event, SessionId, StreamState, WatchState}; + +/// Chat messages per session a new window gets back. +pub const CHAT_BACKLOG: usize = 300; + +/// The latest state-bearing events per session. +#[derive(Default)] +pub struct Replay { + sessions: BTreeMap, +} + +#[derive(Default)] +struct SessionReplay { + server_info: Option, + state: Option, + presence: Option, + streams: Option, + own_stream: Option, + viewers: Option, + watching: BTreeMap, + chat: VecDeque, +} + +impl Replay { + /// Remember what `event` changes. + pub fn record(&mut self, event: &Event) { + let session = match event { + Event::State { session, .. } + | Event::ServerInfo { session, .. } + | Event::Presence { session, .. } + | Event::Chat { session, .. } + | Event::StreamsChanged { session, .. } + | Event::StreamState { session, .. } + | Event::StreamViewers { session, .. } + | Event::WatchState { session, .. } => *session, + // Transient: talking flags, errors, requests, keyframe requests. + _ => return, + }; + let s = self.sessions.entry(session).or_default(); + let slot = Some(event.clone()); + match event { + Event::State { .. } => s.state = slot, + Event::ServerInfo { .. } => s.server_info = slot, + Event::Presence { .. } => s.presence = slot, + Event::StreamsChanged { .. } => s.streams = slot, + Event::StreamViewers { .. } => s.viewers = slot, + Event::StreamState { state, .. } => { + if matches!(state, StreamState::Ended(_)) { + s.own_stream = None; + s.viewers = None; + } else { + s.own_stream = slot; + } + } + Event::WatchState { stream_id, state, .. } => { + if matches!(state, WatchState::Ended(_)) { + s.watching.remove(stream_id); + } else { + s.watching.insert(stream_id.clone(), event.clone()); + } + } + Event::Chat { .. } => { + if s.chat.len() == CHAT_BACKLOG { + s.chat.pop_front(); + } + s.chat.push_back(event.clone()); + } + _ => {} + } + } + + /// Events that rebuild the recorded state, per session: server info, + /// state, presence, chat, then streams. + pub fn events(&self) -> Vec { + let mut out = Vec::new(); + for s in self.sessions.values() { + out.extend(s.server_info.iter().cloned()); + out.extend(s.state.iter().cloned()); + out.extend(s.presence.iter().cloned()); + out.extend(s.chat.iter().cloned()); + out.extend(s.streams.iter().cloned()); + out.extend(s.own_stream.iter().cloned()); + out.extend(s.viewers.iter().cloned()); + out.extend(s.watching.values().cloned()); + } + out + } +} + +/// Events of one source, recorded and passed on to the attached window. +#[derive(Clone, Default)] +pub struct Fanout { + shared: Arc>, +} + +#[derive(Default)] +struct FanoutState { + replay: Replay, + window: Option>, +} + +impl Fanout { + fn lock(&self) -> MutexGuard<'_, FanoutState> { + self.shared.lock().unwrap_or_else(PoisonError::into_inner) + } + + /// Record `event` and pass it to the window, if one is attached. + pub fn publish(&self, event: Event) { + let mut state = self.lock(); + state.replay.record(&event); + if let Some(window) = &state.window + && window.send(event).is_err() + { + state.window = None; + } + } + + /// Receive events from now on, starting with the replay. A previously + /// attached window stops receiving (its channel closes). + pub fn attach(&self) -> mpsc::UnboundedReceiver { + let (tx, rx) = mpsc::unbounded_channel(); + let mut state = self.lock(); + for event in state.replay.events() { + let _ = tx.send(event); + } + state.window = Some(tx); + rx + } + + /// Forward `source` until it closes; then the window's channel closes. + pub async fn pump(self, mut source: broadcast::Receiver) { + loop { + match source.recv().await { + Ok(event) => self.publish(event), + Err(broadcast::error::RecvError::Lagged(n)) => { + tracing::warn!(missed = n, "engine events lagged"); + } + Err(broadcast::error::RecvError::Closed) => break, + } + } + self.lock().window = None; + } +} + +/// The process's engine, runtime and event fan-out. +pub struct EngineHost { + runtime: Runtime, + engine: Engine, + fanout: Fanout, +} + +/// What a window needs: see `voelin_ui::HostedEngine`. +pub struct Attached { + pub engine: Engine, + pub runtime: Handle, + pub events: mpsc::UnboundedReceiver, +} + +impl EngineHost { + pub fn start() -> std::io::Result { + let runtime = tokio::runtime::Builder::new_multi_thread() + .enable_all() + .thread_name("voelin-engine") + .build()?; + let engine = runtime.block_on(async { Engine::start() }); + let fanout = Fanout::default(); + runtime.spawn(fanout.clone().pump(engine.subscribe())); + Ok(Self { runtime, engine, fanout }) + } + + pub fn engine(&self) -> &Engine { + &self.engine + } + + pub fn runtime(&self) -> &Handle { + self.runtime.handle() + } + + /// Hand the engine to a new window. + pub fn attach(&self) -> Attached { + Attached { + engine: self.engine.clone(), + runtime: self.runtime.handle().clone(), + events: self.fanout.attach(), + } + } +} + +#[cfg(test)] +mod tests { + use std::sync::Arc as StdArc; + + use voelin_core::{SessionState, VoiceState}; + use voelin_model::{ChatMessage, ChatTarget, Presence}; + + use super::*; + + fn state(session: SessionId, voice: VoiceState) -> Event { + Event::State { session, state: SessionState { voice, ..SessionState::default() } } + } + + fn chat(session: SessionId, text: &str) -> Event { + Event::Chat { + session, + message: ChatMessage { + target: ChatTarget::Server, + author_name: "a".into(), + author_uid: None, + author_id: None, + text: text.into(), + ts_ms: 0, + via_relay: false, + }, + } + } + + fn describe(events: &[Event]) -> Vec { + events + .iter() + .map(|e| match e { + Event::State { session, state } => format!("{session} state {:?}", state.voice), + Event::Presence { session, .. } => format!("{session} presence"), + Event::Chat { session, message } => format!("{session} chat {}", message.text), + Event::WatchState { session, stream_id, .. } => { + format!("{session} watch {stream_id}") + } + other => format!("{other:?}"), + }) + .collect() + } + + #[test] + fn replay_keeps_the_latest_state_and_the_chat_backlog() { + let mut replay = Replay::default(); + replay.record(&state(2, VoiceState::Connecting)); + replay.record(&Event::Presence { session: 2, presence: StdArc::new(Presence::default()) }); + replay.record(&state(2, VoiceState::Connected)); + replay.record(&Event::Talking { session: 2, client: 5, talking: true }); + replay.record(&Event::Error { session: 2, message: "x".into() }); + for i in 0..CHAT_BACKLOG + 2 { + replay.record(&chat(1, &i.to_string())); + } + replay.record(&Event::WatchState { + session: 2, + stream_id: "s1".into(), + state: WatchState::Connected, + }); + replay.record(&Event::WatchState { + session: 2, + stream_id: "s2".into(), + state: WatchState::Requested, + }); + replay.record(&Event::WatchState { + session: 2, + stream_id: "s2".into(), + state: WatchState::Ended(voelin_core::stream::EndReason::Local), + }); + + let events = describe(&replay.events()); + assert_eq!(events.len(), CHAT_BACKLOG + 3); + assert_eq!(events[0], "1 chat 2", "the oldest messages are dropped"); + assert_eq!(events[CHAT_BACKLOG - 1], format!("1 chat {}", CHAT_BACKLOG + 1)); + assert_eq!( + events[CHAT_BACKLOG..], + ["2 state Connected", "2 presence", "2 watch s1"].map(String::from) + ); + } + + #[tokio::test] + async fn a_new_window_gets_the_replay_then_live_events() { + let (tx, rx) = broadcast::channel(16); + let fanout = Fanout::default(); + let pump = tokio::spawn(fanout.clone().pump(rx)); + + tx.send(state(1, VoiceState::Connected)).unwrap(); + tx.send(chat(1, "before")).unwrap(); + tokio::task::yield_now().await; + while fanout.lock().replay.events().len() < 2 { + tokio::task::yield_now().await; + } + + let mut first = fanout.attach(); + assert_eq!(describe(&[first.recv().await.unwrap()]), ["1 state Connected"]); + assert_eq!(describe(&[first.recv().await.unwrap()]), ["1 chat before"]); + tx.send(chat(1, "live")).unwrap(); + assert_eq!(describe(&[first.recv().await.unwrap()]), ["1 chat live"]); + + // The activity is recreated: the old window's channel ends. + let mut second = fanout.attach(); + assert!(first.recv().await.is_none()); + let mut replayed = Vec::new(); + for _ in 0..3 { + replayed.push(second.recv().await.unwrap()); + } + assert_eq!(describe(&replayed), ["1 state Connected", "1 chat before", "1 chat live"]); + + drop(tx); + pump.await.unwrap(); + assert!(second.recv().await.is_none(), "the source closed"); + } +} diff --git a/crates/voelin-android/src/lib.rs b/crates/voelin-android/src/lib.rs new file mode 100644 index 0000000..117ca35 --- /dev/null +++ b/crates/voelin-android/src/lib.rs @@ -0,0 +1,34 @@ +//! The Android app's native library (`libvoelin_android.so`). +//! +//! The APK (`android/`) starts a `NativeActivity` subclass that loads this +//! library; `android_main` then runs the shared Slint UI (`voelin_ui`) on +//! Slint's Android backend. The pieces around it: +//! +//! - [`host`]: one engine per process, so voice survives the activity being +//! destroyed and recreated; a new window gets the current state replayed +//! - [`foreground`]: when the voice foreground service must run (Android +//! only lets a service with a notification keep the microphone in the +//! background) +//! - `bridge` (Android): JNI calls into the Kotlin side (`Bridge`) and the +//! native methods it calls back (`Native`) +//! - `capture` (Android): screen and system-audio capture through +//! MediaProjection, registered as `voelin_media` capture providers +//! - `secrets` (Android): passwords encrypted with an Android Keystore key +//! - `egl` (Android): keeps EGL extension slots for Skia, without which the +//! UI cannot draw on Mesa-based Android (Waydroid) +//! +//! Only [`host`] and [`foreground`] build on other platforms, for tests. + +pub mod foreground; +pub mod host; + +#[cfg(target_os = "android")] +mod app; +#[cfg(target_os = "android")] +mod bridge; +#[cfg(target_os = "android")] +mod capture; +#[cfg(target_os = "android")] +mod egl; +#[cfg(target_os = "android")] +mod secrets; diff --git a/crates/voelin-android/src/secrets.rs b/crates/voelin-android/src/secrets.rs new file mode 100644 index 0000000..4b37b81 --- /dev/null +++ b/crates/voelin-android/src/secrets.rs @@ -0,0 +1,29 @@ +//! Passwords in the Android Keystore. +//! +//! The Kotlin `SecretStore` encrypts each value with an AES-GCM key that +//! lives in the Android Keystore (hardware-backed where the device has it) +//! and keeps the ciphertext in the app's private preferences. + +use voelin_store::{Error, Result, Secrets}; + +use crate::bridge; + +pub struct KeystoreSecrets; + +fn error(e: jni::errors::Error) -> Error { + Error::Secrets(format!("Android Keystore: {e}")) +} + +impl Secrets for KeystoreSecrets { + fn get(&self, key: &str) -> Result> { + bridge::secret_get(key).map_err(error) + } + + fn set(&self, key: &str, value: &str) -> Result<()> { + bridge::secret_set(key, value).map_err(error) + } + + fn delete(&self, key: &str) -> Result<()> { + bridge::secret_delete(key).map_err(error) + } +} diff --git a/crates/tsc-audio/Cargo.toml b/crates/voelin-audio/Cargo.toml similarity index 97% rename from crates/tsc-audio/Cargo.toml rename to crates/voelin-audio/Cargo.toml index 44bb56f..ddb22f0 100644 --- a/crates/tsc-audio/Cargo.toml +++ b/crates/voelin-audio/Cargo.toml @@ -1,5 +1,5 @@ [package] -name = "tsc-audio" +name = "voelin-audio" version = "0.1.0" description = "Voice pipeline: Opus encoding, framing, resampling, jitter buffer/mixer and audio devices." edition.workspace = true diff --git a/crates/tsc-audio/src/device.rs b/crates/voelin-audio/src/device.rs similarity index 100% rename from crates/tsc-audio/src/device.rs rename to crates/voelin-audio/src/device.rs diff --git a/crates/tsc-audio/src/encode.rs b/crates/voelin-audio/src/encode.rs similarity index 100% rename from crates/tsc-audio/src/encode.rs rename to crates/voelin-audio/src/encode.rs diff --git a/crates/tsc-audio/src/framer.rs b/crates/voelin-audio/src/framer.rs similarity index 100% rename from crates/tsc-audio/src/framer.rs rename to crates/voelin-audio/src/framer.rs diff --git a/crates/tsc-audio/src/lib.rs b/crates/voelin-audio/src/lib.rs similarity index 100% rename from crates/tsc-audio/src/lib.rs rename to crates/voelin-audio/src/lib.rs diff --git a/crates/tsc-audio/src/mixer.rs b/crates/voelin-audio/src/mixer.rs similarity index 100% rename from crates/tsc-audio/src/mixer.rs rename to crates/voelin-audio/src/mixer.rs diff --git a/crates/tsc-audio/src/pcm.rs b/crates/voelin-audio/src/pcm.rs similarity index 100% rename from crates/tsc-audio/src/pcm.rs rename to crates/voelin-audio/src/pcm.rs diff --git a/crates/tsc-audio/src/process.rs b/crates/voelin-audio/src/process.rs similarity index 100% rename from crates/tsc-audio/src/process.rs rename to crates/voelin-audio/src/process.rs diff --git a/crates/tsc-audio/src/resample.rs b/crates/voelin-audio/src/resample.rs similarity index 100% rename from crates/tsc-audio/src/resample.rs rename to crates/voelin-audio/src/resample.rs diff --git a/crates/tsc-audio/src/settings.rs b/crates/voelin-audio/src/settings.rs similarity index 96% rename from crates/tsc-audio/src/settings.rs rename to crates/voelin-audio/src/settings.rs index 450195a..3bf52c8 100644 --- a/crates/tsc-audio/src/settings.rs +++ b/crates/voelin-audio/src/settings.rs @@ -1,5 +1,5 @@ //! All user audio settings in one serde struct, e.g. for -//! `tsc_store::Store::set_setting("audio", &settings)`. Missing fields take +//! `voelin_store::Store::set_setting("audio", &settings)`. Missing fields take //! their defaults, so stored settings survive new options. use serde::{Deserialize, Serialize}; diff --git a/crates/tsc-audio/src/vad.rs b/crates/voelin-audio/src/vad.rs similarity index 100% rename from crates/tsc-audio/src/vad.rs rename to crates/voelin-audio/src/vad.rs diff --git a/crates/tsc-audio/src/wav.rs b/crates/voelin-audio/src/wav.rs similarity index 94% rename from crates/tsc-audio/src/wav.rs rename to crates/voelin-audio/src/wav.rs index 13cab33..f2bd435 100644 --- a/crates/tsc-audio/src/wav.rs +++ b/crates/voelin-audio/src/wav.rs @@ -52,7 +52,7 @@ mod tests { #[test] fn roundtrip() { - let path = std::env::temp_dir().join(format!("tsc-audio-{}.wav", std::process::id())); + let path = std::env::temp_dir().join(format!("voelin-audio-{}.wav", std::process::id())); let clip = Clip { samples: vec![0.0, 0.5, -0.5, 0.25], channels: 2, rate: 48_000 }; write(&path, &clip).unwrap(); let back = read(&path).unwrap(); diff --git a/crates/tsc-audio/tests/drift.rs b/crates/voelin-audio/tests/drift.rs similarity index 97% rename from crates/tsc-audio/tests/drift.rs rename to crates/voelin-audio/tests/drift.rs index 306c5d6..c2b51c6 100644 --- a/crates/tsc-audio/tests/drift.rs +++ b/crates/voelin-audio/tests/drift.rs @@ -7,10 +7,10 @@ //! loss. Every 30 s it sends a loud marker frame instead of the quiet one; //! the latency is the time from generating a marker to it leaving the mixer. -use tsc_audio::pcm::{FRAME_SAMPLES, SAMPLE_RATE, energy, sine, white_noise}; -use tsc_audio::{Mixer, VoiceCodec, VoiceEncoder}; use tsclientlib::ClientId; use tsproto_packets::packets::{AudioData, CodecType, Direction, InAudioBuf, OutAudio}; +use voelin_audio::pcm::{FRAME_SAMPLES, SAMPLE_RATE, energy, sine, white_noise}; +use voelin_audio::{Mixer, VoiceCodec, VoiceEncoder}; /// The receiver pulls 10 ms at a time, like a playback loop. const PULL: usize = SAMPLE_RATE as usize / 100; diff --git a/crates/voelin-core/Cargo.toml b/crates/voelin-core/Cargo.toml new file mode 100644 index 0000000..29d8ce3 --- /dev/null +++ b/crates/voelin-core/Cargo.toml @@ -0,0 +1,46 @@ +[package] +name = "voelin-core" +version = "0.1.0" +description = "Client engine: server sessions merging voice, gateway and query sources; the API the UI drives." +edition.workspace = true +rust-version.workspace = true +license.workspace = true +repository.workspace = true +publish.workspace = true + +[features] +default = ["audio-device"] +# Capture and play audio through the system's devices. +audio-device = ["voelin-audio/device"] +# The `media` module: capture and video codecs for streams, with whatever +# voelin-media backends are enabled (e.g. MediaCodec and a registered capture +# source on Android). +media = ["dep:voelin-media"] +# `media` with voelin-media's desktop backends: libvpx, OpenH264 loaded at +# runtime, X11 and PipeWire on Linux. Not for Android (libvpx does not +# cross-compile there). +media-desktop = ["media", "voelin-media/default"] + +[dependencies] +anyhow = "1" +futures = "0.3" +serde_json = "1" +thiserror = "2" +tokio = { version = "1", features = ["macros", "rt-multi-thread", "sync", "time"] } +tokio-tungstenite = "0.30" +tracing = "0.1" +voelin-audio = { path = "../voelin-audio", default-features = false } +voelin-gateway-proto = { path = "../voelin-gateway-proto" } +voelin-media = { path = "../voelin-media", default-features = false, features = ["str0m"], optional = true } +voelin-model = { path = "../voelin-model" } +voelin-observer = { path = "../voelin-observer" } +voelin-query = { path = "../voelin-query" } +voelin-stream = { path = "../voelin-stream" } +tsclientlib = { path = "../proto/tsclientlib" } +tsproto-packets = { path = "../proto/tsproto-packets" } + +[dev-dependencies] +tokio = { version = "1", features = ["macros", "rt-multi-thread", "test-util"] } + +[lints] +workspace = true diff --git a/crates/tsc-core/src/audio.rs b/crates/voelin-core/src/audio.rs similarity index 66% rename from crates/tsc-core/src/audio.rs rename to crates/voelin-core/src/audio.rs index cf97582..0bc55d2 100644 --- a/crates/tsc-core/src/audio.rs +++ b/crates/voelin-core/src/audio.rs @@ -8,18 +8,20 @@ //! independent part is [`Pipeline`]; the thread loop only moves samples //! between it and the devices, reopening devices that go away. -use std::collections::VecDeque; +use std::collections::{HashMap, VecDeque}; +use std::sync::Arc; use std::sync::mpsc as std_mpsc; use std::thread; use std::time::{Duration, Instant}; use tokio::sync::mpsc; use tracing::{debug, warn}; -use tsc_audio::pcm::{self, FRAME_SAMPLES}; -use tsc_audio::settings::TransmitMode; -use tsc_audio::{AudioSettings, Framer, Mixer, Processor, Vad, VoiceCodec, VoiceEncoder}; use tsclientlib::ClientId; -use tsproto_packets::packets::{AudioData, InAudioBuf, OutPacket}; +use tsproto_packets::packets::{AudioData, CodecType, Direction, InAudioBuf, OutAudio, OutPacket}; +use voelin_audio::pcm::{self, FRAME_SAMPLES}; +use voelin_audio::settings::TransmitMode; +use voelin_audio::vad::SILENCE_DB; +use voelin_audio::{AudioSettings, Framer, Mixer, Processor, Vad, VoiceCodec, VoiceEncoder}; pub(crate) enum AudioIn { Packet(InAudioBuf), @@ -27,24 +29,46 @@ pub(crate) enum AudioIn { InputMuted(bool), OutputMuted(bool), /// Devices, processing, voice activation and transmit mode. - #[allow(dead_code, reason = "sent once the session exposes audio settings")] Settings(Box), /// Playback volume of one client, linear (1 = unchanged, up to 4). - #[allow(dead_code, reason = "sent once the session exposes client volumes")] ClientVolume { client: ClientId, volume: f32, }, - #[allow(dead_code, reason = "sent once the session exposes client volumes")] ClientMuted { client: ClientId, muted: bool, }, /// The client left; client ids are reused, so forget its volume. - #[allow(dead_code, reason = "sent once the session exposes client volumes")] ClientLeft(ClientId), + /// An Opus frame (48 kHz) of a watched stream; `time` is its RTP time + /// on the 48 kHz clock. + StreamAudio { + stream: String, + time: u64, + data: Arc<[u8]>, + }, + /// Playback volume of a watched stream, linear like client volumes. + StreamVolume { + stream: String, + volume: f32, + }, + /// We stopped watching the stream: forget its queue and volume. + StreamEnded(String), } +/// What the audio thread reports. +#[derive(Clone, Debug, PartialEq)] +pub(crate) enum AudioEvent { + /// A problem, e.g. a missing device. + Error(String), + /// Loudest microphone level (dBFS, after processing) since the last + /// report, and whether voice is being sent. About every + /// [`LEVEL_INTERVAL`] while the microphone delivers audio. + Level { db: f32, sending: bool }, +} + +#[derive(Clone)] pub(crate) struct AudioHandle { tx: std_mpsc::Sender, } @@ -53,6 +77,13 @@ impl AudioHandle { pub fn send(&self, msg: AudioIn) { let _ = self.tx.send(msg); } + + /// A handle without a thread, to see what would reach it. + #[cfg(test)] + pub fn channel() -> (Self, std_mpsc::Receiver) { + let (tx, rx) = std_mpsc::channel(); + (Self { tx }, rx) + } } /// With voice activation, also send this many 20 ms frames from before the @@ -68,25 +99,33 @@ const PLAYBACK_CAPACITY_MS: u32 = 200; const DEVICE_LATENCY_MS: u32 = 20; /// How long the loop sleeps between rounds. const TICK: Duration = Duration::from_millis(5); +/// How often the microphone level is reported (for a meter). +pub(crate) const LEVEL_INTERVAL: Duration = Duration::from_millis(100); +/// Samples of one 20 ms Opus frame at 48 kHz: the unit of stream packet ids. +const OPUS_FRAME: u64 = 960; /// Start the audio thread. Encoded packets go to `outgoing`; problems (e.g. -/// no device) are reported through `errors`. +/// no device) and the microphone level are reported through `events`. pub(crate) fn spawn( outgoing: mpsc::UnboundedSender, - errors: mpsc::UnboundedSender, - voice_activation: bool, + events: mpsc::UnboundedSender, + settings: AudioSettings, ) -> AudioHandle { - let transmit = - if voice_activation { TransmitMode::VoiceActivation } else { TransmitMode::PushToTalk }; - let settings = AudioSettings { transmit, ..Default::default() }; let (tx, rx) = std_mpsc::channel(); thread::Builder::new() - .name("tsc-audio".into()) - .spawn(move || run(rx, outgoing, errors, settings)) + .name("voelin-audio".into()) + .spawn(move || run(rx, outgoing, events, settings)) .expect("spawn audio thread"); AudioHandle { tx } } +/// Audio of a watched stream in the mixer, under a made-up client id. +struct StreamAudio { + client: ClientId, + /// RTP time and packet id of the last packet. + last: Option<(u64, u64)>, +} + /// Everything between the devices and the connection. struct Pipeline { settings: AudioSettings, @@ -101,13 +140,18 @@ struct Pipeline { input_muted: bool, output_muted: bool, was_sending: bool, + /// Loudest level since the last report; `None` without microphone audio. + level_peak: Option, + /// Watched streams whose audio plays through the mixer. + streams: HashMap, + stream_volumes: HashMap, /// Processed microphone audio, for tests. #[cfg(test)] tap: Vec, } impl Pipeline { - fn new(settings: AudioSettings) -> tsc_audio::Result { + fn new(settings: AudioSettings) -> voelin_audio::Result { let settings = sanitize(settings); Ok(Self { encoder: VoiceEncoder::new(VoiceCodec::Voice)?, @@ -121,6 +165,9 @@ impl Pipeline { input_muted: false, output_muted: false, was_sending: false, + level_peak: None, + streams: HashMap::new(), + stream_volumes: HashMap::new(), settings, #[cfg(test)] tap: Vec::new(), @@ -154,9 +201,73 @@ impl Pipeline { AudioIn::ClientVolume { client, volume } => self.mixer.set_volume(client, volume), AudioIn::ClientMuted { client, muted } => self.mixer.set_muted(client, muted), AudioIn::ClientLeft(client) => self.mixer.forget(client), + AudioIn::StreamAudio { stream, time, data } => self.stream_packet(stream, time, &data), + AudioIn::StreamVolume { stream, volume } => { + if let Some(s) = self.streams.get(&stream) { + self.mixer.set_volume(s.client, volume); + } + self.stream_volumes.insert(stream, volume); + } + AudioIn::StreamEnded(stream) => { + if let Some(s) = self.streams.remove(&stream) { + self.mixer.forget(s.client); + } + self.stream_volumes.remove(&stream); + } } } + /// Queue an Opus frame of a stream in the mixer, as if a client with a + /// made-up id (counting down from `u16::MAX`, where real ids are rare) + /// talked. The jitter buffer orders packets by id: one id per 20 ms of + /// RTP time, at least one per packet (shorter frames). + fn stream_packet(&mut self, stream: String, time: u64, data: &[u8]) { + let client = match self.streams.get(&stream) { + Some(s) => s.client, + None => { + let used: Vec = self.streams.values().map(|s| s.client).collect(); + let Some(client) = (0..=u16::MAX).rev().map(ClientId).find(|c| !used.contains(c)) + else { + return; + }; + self.mixer.forget(client); + let volume = self.stream_volumes.get(&stream).copied().unwrap_or(1.0); + self.mixer.set_volume(client, volume); + self.streams.insert(stream.clone(), StreamAudio { client, last: None }); + client + } + }; + let entry = self.streams.get_mut(&stream).expect("inserted above"); + let id = match entry.last { + None => time / OPUS_FRAME, + // Duplicate or reordered: the depacketizer delivers in order. + Some((last_time, _)) if time <= last_time => return, + Some((last_time, last_id)) => { + last_id + ((time - last_time + OPUS_FRAME / 2) / OPUS_FRAME).max(1) + } + }; + entry.last = Some((time, id)); + let packet = OutAudio::new(&AudioData::S2C { + id: id as u16, + codec: CodecType::OpusMusic, + from: client.0, + data, + }); + match InAudioBuf::try_new(Direction::S2C, packet.into_vec()) { + Ok(packet) => { + if let Err(error) = self.mixer.handle_packet(client, packet) { + debug!(%error, "dropped stream audio packet"); + } + } + Err(error) => debug!(?error, "stream audio packet"), + } + } + + /// The loudest microphone level since the last call, if any audio came in. + fn take_level(&mut self) -> Option { + self.level_peak.take() + } + /// Microphone audio in (mono, 48 kHz, any length); voice packets out. /// `delay_ms` is the playback-to-capture delay hint for the echo canceller. fn capture(&mut self, samples: &[f32], delay_ms: u32, send: &mut impl FnMut(OutPacket)) { @@ -175,6 +286,8 @@ impl Pipeline { fn transmit(&mut self, frame: Vec, send: &mut impl FnMut(OutPacket)) { // Always analysed, so the detector's state is current when needed. let voice = self.vad.process(&frame); + let level = self.vad.level_db().max(SILENCE_DB); + self.level_peak = Some(self.level_peak.map_or(level, |peak| peak.max(level))); let wanted = match self.settings.transmit { TransmitMode::PushToTalk => self.ptt, TransmitMode::VoiceActivation => voice, @@ -232,18 +345,21 @@ fn sanitize(mut settings: AudioSettings) -> AudioSettings { fn run( rx: std_mpsc::Receiver, outgoing: mpsc::UnboundedSender, - errors: mpsc::UnboundedSender, + events: mpsc::UnboundedSender, settings: AudioSettings, ) { + let error = |message: String| { + let _ = events.send(AudioEvent::Error(message)); + }; #[cfg(feature = "audio-device")] let mut devices = devices::Devices::new(&settings); #[cfg(not(feature = "audio-device"))] - let _ = errors.send("built without audio device support".to_string()); + error("built without audio device support".to_string()); let mut pipeline = match Pipeline::new(settings) { Ok(p) => p, Err(e) => { - let _ = errors.send(e.to_string()); + error(e.to_string()); return; } }; @@ -253,6 +369,7 @@ fn run( // Without speakers the mixer is drained at real time, so queues do not // fill up and talkers still end. let mut idle_clock = Instant::now(); + let mut level_clock = Instant::now(); loop { // Control messages and incoming voice. @@ -271,7 +388,7 @@ fn run( } #[cfg(feature = "audio-device")] - let playing = devices.step(&mut pipeline, &mut send, &errors); + let playing = devices.step(&mut pipeline, &mut send, &error); #[cfg(not(feature = "audio-device"))] let playing = { // No microphone: nothing to process, but keep the path alive. @@ -289,19 +406,25 @@ fn run( } } + if level_clock.elapsed() >= LEVEL_INTERVAL { + level_clock = Instant::now(); + if let Some(db) = pipeline.take_level() { + let _ = events.send(AudioEvent::Level { db, sending: pipeline.was_sending }); + } + } + thread::sleep(TICK); } } #[cfg(feature = "audio-device")] mod devices { - use tokio::sync::mpsc; use tracing::debug; - use tsc_audio::AudioSettings; - use tsc_audio::device::{Capture, DeviceEvent, Managed, Playback}; - use tsc_audio::pcm::{self, FRAME_SAMPLES, SAMPLE_RATE}; - use tsc_audio::resample::Linear; use tsproto_packets::packets::OutPacket; + use voelin_audio::AudioSettings; + use voelin_audio::device::{Capture, DeviceEvent, Managed, Playback}; + use voelin_audio::pcm::{self, FRAME_SAMPLES, SAMPLE_RATE}; + use voelin_audio::resample::Linear; use super::{DEVICE_LATENCY_MS, PLAYBACK_CAPACITY_MS, Pipeline}; @@ -324,7 +447,7 @@ mod devices { &mut slot.as_mut().expect("just set").1 } - fn report(errors: &mpsc::UnboundedSender, what: &str, event: DeviceEvent) { + fn report(error: &impl Fn(String), what: &str, event: DeviceEvent) { let message = match event { DeviceEvent::Opened { name, fallback: false } => { debug!(%name, "{what} opened"); @@ -336,7 +459,7 @@ mod devices { DeviceEvent::Lost { name } => format!("{what} disconnected: {name}"), DeviceEvent::Unavailable(e) => format!("no {what}: {e}"), }; - let _ = errors.send(message); + error(message); } impl Devices { @@ -362,13 +485,13 @@ mod devices { &mut self, pipeline: &mut Pipeline, send: &mut impl FnMut(OutPacket), - errors: &mpsc::UnboundedSender, + error: &impl Fn(String), ) -> bool { if let Some(event) = self.playback.poll() { - report(errors, "speakers", event); + report(error, "speakers", event); } if let Some(event) = self.capture.poll() { - report(errors, "microphone", event); + report(error, "microphone", event); } // Mixer → speakers, keeping the configured amount queued. @@ -408,9 +531,8 @@ mod devices { #[cfg(test)] mod tests { - use tsc_audio::pcm::{SAMPLE_RATE, energy, sine, white_noise}; - use tsc_audio::{ProcessingSettings, VadSettings}; - use tsproto_packets::packets::{CodecType, Direction, OutAudio}; + use voelin_audio::pcm::{SAMPLE_RATE, energy, sine, white_noise}; + use voelin_audio::{ProcessingSettings, VadSettings}; use super::*; @@ -529,6 +651,52 @@ mod tests { assert!(attenuation >= 10.0, "echo attenuated by {attenuation:.1} dB"); } + /// Stream audio (stereo Opus with RTP times) plays through the mixer at + /// its own volume and is forgotten when the stream ends. + #[test] + fn stream_audio_with_volume() { + let mut p = pipeline(TransmitMode::PushToTalk); + let mut encoder = VoiceEncoder::new(VoiceCodec::Music).unwrap(); + let tone = pcm::from_mono(&sine(600.0, 1.0, 0.4), 2); + // A random RTP start, as WebRTC senders use. + let start = 7_777_000u64; + let mut play = |p: &mut Pipeline, stream: &str| -> f32 { + let mut out = Vec::new(); + for (i, frame) in tone.chunks_exact(FRAME_SAMPLES * 2).enumerate() { + let data: Arc<[u8]> = encoder.encode_to_bytes(frame).unwrap().into(); + let time = start + i as u64 * OPUS_FRAME; + p.handle(AudioIn::StreamAudio { stream: stream.into(), time, data: data.clone() }); + // A duplicate is ignored. + p.handle(AudioIn::StreamAudio { stream: stream.into(), time, data }); + out.extend(p.playback_frame()); + } + energy(&out[out.len() / 2..]) + }; + let full = play(&mut p, "a"); + assert!(full > 1e-3, "stream audio must be audible"); + p.handle(AudioIn::StreamVolume { stream: "b".into(), volume: 0.5 }); + let half = play(&mut p, "b"); + let ratio_db = 10.0 * (half / full).log10(); + assert!((ratio_db + 6.0).abs() < 1.0, "volume 0.5 gave {ratio_db} dB"); + let mut clients: Vec = p.streams.values().map(|s| s.client.0).collect(); + clients.sort_unstable(); + assert_eq!(clients, [u16::MAX - 1, u16::MAX]); + p.handle(AudioIn::StreamEnded("b".into())); + assert_eq!(p.streams.len(), 1); + assert!(!p.stream_volumes.contains_key("b")); + } + + #[test] + fn level_is_reported() { + let mut p = pipeline(TransmitMode::PushToTalk); + assert_eq!(p.take_level(), None, "no microphone audio yet"); + // A sine of amplitude 0.3 has an RMS level of about -13.5 dBFS. + capture(&mut p, &sine(440.0, 0.1, 0.3)); + let level = p.take_level().unwrap(); + assert!((level + 13.5).abs() < 1.0, "{level}"); + assert_eq!(p.take_level(), None); + } + #[test] fn settings_are_sanitized() { let mut p = pipeline(TransmitMode::PushToTalk); diff --git a/crates/tsc-core/src/gateway.rs b/crates/voelin-core/src/gateway.rs similarity index 88% rename from crates/tsc-core/src/gateway.rs rename to crates/voelin-core/src/gateway.rs index af822be..1b0b74d 100644 --- a/crates/tsc-core/src/gateway.rs +++ b/crates/voelin-core/src/gateway.rs @@ -5,8 +5,8 @@ use tokio::sync::mpsc; use tokio_tungstenite::tungstenite::Message; use tokio_tungstenite::tungstenite::client::IntoClientRequest; use tracing::info; -use tsc_gateway_proto::{ClientMsg, Envelope, ServerMsg, sign_challenge}; -use tsc_model::{ChatMessage, ChatTarget, Presence}; +use voelin_gateway_proto::{ClientMsg, Envelope, ServerMsg, sign_challenge}; +use voelin_model::{ChatMessage, ChatTarget, Presence}; pub(crate) enum GatewayCmd { OpenChat(ChatTarget), @@ -41,7 +41,9 @@ async fn run_inner( events: &mpsc::UnboundedSender, ) -> anyhow::Result<()> { let mut request = url.into_client_request()?; - request.headers_mut().insert("Sec-WebSocket-Protocol", tsc_gateway_proto::SUBPROTOCOL.parse()?); + request + .headers_mut() + .insert("Sec-WebSocket-Protocol", voelin_gateway_proto::SUBPROTOCOL.parse()?); let (mut ws, _) = tokio_tungstenite::connect_async(request).await?; let mut next_id = 1u64; let mut presence = Presence::default(); @@ -98,10 +100,10 @@ async fn run_inner( let _ = events.send(GatewayEvent::Error(format!("{code:?}: {message}"))); if matches!( code, - tsc_gateway_proto::ErrorCode::AuthFailed - | tsc_gateway_proto::ErrorCode::UnknownIdentity - | tsc_gateway_proto::ErrorCode::LevelTooLow - | tsc_gateway_proto::ErrorCode::Banned + voelin_gateway_proto::ErrorCode::AuthFailed + | voelin_gateway_proto::ErrorCode::UnknownIdentity + | voelin_gateway_proto::ErrorCode::LevelTooLow + | voelin_gateway_proto::ErrorCode::Banned ) { anyhow::bail!("gateway refused login: {message}"); } diff --git a/crates/tsc-core/src/lib.rs b/crates/voelin-core/src/lib.rs similarity index 65% rename from crates/tsc-core/src/lib.rs rename to crates/voelin-core/src/lib.rs index 4226b28..5c07021 100644 --- a/crates/tsc-core/src/lib.rs +++ b/crates/voelin-core/src/lib.rs @@ -13,10 +13,15 @@ //! //! On TeamSpeak 6 servers the voice connection also carries streams (screen //! sharing): see the `*Stream*` commands and events, and -//! [`Engine::subscribe_frames`] for the frames of watched streams. +//! [`Engine::subscribe_frames`] for the frames of watched streams. The audio +//! of watched streams plays through the session's speakers by itself +//! ([`Command::SetStreamVolume`]); capture, encoding and decoding of video +//! are in [`media`] (feature `media`). mod audio; mod gateway; +#[cfg(feature = "media")] +pub mod media; mod query; mod route; mod session; @@ -27,11 +32,14 @@ use std::collections::HashMap; use std::sync::Arc; use tokio::sync::{broadcast, mpsc}; -use tsc_model::{Capabilities, ChannelId, ChatMessage, ChatTarget, Presence, ServerFlavor}; +pub use voelin_audio::settings::TransmitMode; +pub use voelin_audio::{AudioSettings, ProcessingSettings, VadSettings}; +use voelin_model::{Capabilities, ChannelId, ChatMessage, ChatTarget, Presence, ServerFlavor}; +use crate::audio::{AudioEvent, AudioHandle, AudioIn}; pub use route::{ChatRoute, Dedup, route_chat}; pub use stream::{StreamFrame, StreamSink, StreamState, WatchState}; -use tsc_stream::{EncodedFrame, StreamInfo, StreamSetup, ViewerInfo}; +use voelin_stream::{EncodedFrame, StreamInfo, StreamSetup, ViewerInfo}; pub use voice::VoiceOptions; pub type SessionId = u64; @@ -55,7 +63,7 @@ pub enum Command { /// Invisible presence and relay chat with own ServerQuery credentials. ObserveQuery { session: SessionId, - connect: Box, + connect: Box, }, StopObserving { session: SessionId, @@ -86,11 +94,33 @@ pub enum Command { session: SessionId, muted: bool, }, - /// Push-to-talk state (or "always transmit" when voice activation is off). + /// Push-to-talk key or button held (only counts with + /// [`TransmitMode::PushToTalk`]). SetTransmitting { session: SessionId, on: bool, }, + /// Audio settings of all sessions (devices, processing, transmit mode), + /// also used by sessions started later. + SetAudioSettings(Box), + /// Playback volume of one client, linear (1 = unchanged, up to 4). + /// Local only; forgotten when the client leaves. + SetClientVolume { + session: SessionId, + client: u16, + volume: f32, + }, + /// Do not play one client (local only). + SetClientMuted { + session: SessionId, + client: u16, + muted: bool, + }, + /// Open the microphone without a session to show its level + /// ([`Event::InputLevel`] with `session: None`), e.g. in the settings. + TestMicrophone { + on: bool, + }, /// Start streaming in our channel (TeamSpeak 6 only). Progress comes as /// [`Event::StreamState`]; frames go in through the sink of /// [`StreamState::Live`] or [`Command::SendStreamFrame`]. @@ -134,6 +164,13 @@ pub enum Command { session: SessionId, stream_id: String, }, + /// Playback volume of a watched stream's audio, linear (1 = unchanged, + /// up to 4). + SetStreamVolume { + session: SessionId, + stream_id: String, + volume: f32, + }, /// Close everything of a session. CloseSession { session: SessionId, @@ -172,6 +209,8 @@ pub struct SessionState { pub presence_source: Option, /// Our own channel while voice-connected. pub own_channel: Option, + /// Our own client id while voice-connected. + pub own_client: Option, pub input_muted: bool, pub output_muted: bool, pub transmitting: bool, @@ -205,6 +244,20 @@ pub enum Event { client: u16, talking: bool, }, + /// Microphone level for a meter, about ten times a second while the + /// microphone is open: of a voice session, or of + /// [`Command::TestMicrophone`] (`session: None`). `level_db` is the + /// loudest 10 ms (dBFS, after processing) since the last report; + /// `sending` whether voice is transmitted. + InputLevel { + session: Option, + level_db: f32, + sending: bool, + }, + /// A problem with the microphone test (e.g. no device). + MicrophoneTestError { + message: String, + }, Error { session: SessionId, message: String, @@ -248,6 +301,7 @@ pub struct Engine { commands: mpsc::UnboundedSender, events: broadcast::Sender, frames: broadcast::Sender, + runtime: tokio::runtime::Handle, } impl Engine { @@ -258,7 +312,13 @@ impl Engine { // About a minute of one watched stream. let (frames, _) = broadcast::channel(4096); tokio::spawn(run(rx, events.clone(), frames.clone())); - Self { commands, events, frames } + Self { commands, events, frames, runtime: tokio::runtime::Handle::current() } + } + + /// The runtime the engine runs on, for helpers started from other + /// threads (e.g. `media::Viewer` from a UI thread). + pub fn runtime(&self) -> &tokio::runtime::Handle { + &self.runtime } pub fn send(&self, command: Command) { @@ -281,8 +341,26 @@ async fn run( frames: broadcast::Sender, ) { let mut sessions: HashMap = HashMap::new(); + let mut settings = AudioSettings::default(); + let mut mic_test: Option = None; while let Some(command) = commands.recv().await { - let id = command_session(&command); + let id = match command { + Command::SetAudioSettings(new) => { + settings = (*new).clone(); + for s in sessions.values() { + s.send(Command::SetAudioSettings(new.clone())); + } + if let Some(test) = &mic_test { + test.send(AudioIn::Settings(new)); + } + continue; + } + Command::TestMicrophone { on } => { + mic_test = on.then(|| test_microphone(&settings, &events)); + continue; + } + ref command => command_session(command), + }; if matches!(command, Command::CloseSession { .. }) { if let Some(s) = sessions.remove(&id) { s.send(command); @@ -291,11 +369,33 @@ async fn run( } sessions .entry(id) - .or_insert_with(|| session::SessionHandle::spawn(id, events.clone(), frames.clone())) + .or_insert_with(|| { + session::SessionHandle::spawn(id, events.clone(), frames.clone(), settings.clone()) + }) .send(command); } } +/// An audio thread whose packets go nowhere, for its level. +fn test_microphone(settings: &AudioSettings, events: &broadcast::Sender) -> AudioHandle { + let (packets, _) = mpsc::unbounded_channel(); + let (audio_tx, mut audio_rx) = mpsc::unbounded_channel(); + let handle = audio::spawn(packets, audio_tx, settings.clone()); + let events = events.clone(); + tokio::spawn(async move { + while let Some(event) = audio_rx.recv().await { + let _ = events.send(match event { + AudioEvent::Level { db, sending } => { + Event::InputLevel { session: None, level_db: db, sending } + } + AudioEvent::Error(message) => Event::MicrophoneTestError { message }, + }); + } + }); + handle +} + +/// The session a command is for (engine-wide commands are handled before). fn command_session(command: &Command) -> SessionId { match command { Command::ConnectVoice { session, .. } @@ -318,6 +418,12 @@ fn command_session(command: &Command) -> SessionId { | Command::WatchStream { session, .. } | Command::LeaveStream { session, .. } | Command::RequestStreamKeyframe { session, .. } + | Command::SetStreamVolume { session, .. } + | Command::SetClientVolume { session, .. } + | Command::SetClientMuted { session, .. } | Command::CloseSession { session } => *session, + Command::SetAudioSettings(_) | Command::TestMicrophone { .. } => { + unreachable!("engine-wide commands have no session") + } } } diff --git a/crates/voelin-core/src/media.rs b/crates/voelin-core/src/media.rs new file mode 100644 index 0000000..7bff8eb --- /dev/null +++ b/crates/voelin-core/src/media.rs @@ -0,0 +1,1108 @@ +//! Stream media (feature `media`): capture and encoding for our stream, +//! decoding for the streams we watch. +//! +//! - [`Streamer`] captures a screen or window (and optionally system audio), +//! encodes the video with the codec our offer carries ([`stream_codec`], +//! VP8 by default) at the bitrate of the stream setup, and the audio with +//! Opus (48 kHz stereo, 20 ms). It hands the frames to a [`MediaSink`]: +//! the [`StreamSink`] of a live stream, or an [`EncodedSource`] for code +//! that drives `voelin_stream::Streams` itself. Keyframe requests of viewers +//! are honoured. +//! - [`VideoPipeline`] decodes the video of a watched stream on its own +//! thread and hands every picture to a callback. After lost frames or +//! decoder errors it skips to the next keyframe and asks for one. +//! - [`Viewer`] is a [`VideoPipeline`] fed from [`Engine::subscribe_frames`]. +//! The stream's audio needs nothing here: the session plays it +//! ([`Command::SetStreamVolume`]). +//! - [`Latest`] hands the newest picture to a slower consumer such as a UI. +//! - [`LocalPreview`] runs capture → encoder → decoder without a server. +//! +//! [`voelin_media`] is re-exported for sources, codecs and pixel conversion. +//! Codecs are chosen through `voelin_media::Codecs`, so whatever backends the +//! build has are used (libvpx and OpenH264 with feature `media-desktop`, +//! MediaCodec on Android). + +use std::collections::VecDeque; +use std::sync::atomic::{AtomicBool, AtomicU64, Ordering}; +use std::sync::mpsc as std_mpsc; +use std::sync::{Arc, Condvar, Mutex, MutexGuard, PoisonError}; +use std::thread::JoinHandle; +use std::time::{Duration, Instant}; + +use tracing::{debug, warn}; +use voelin_audio::{VoiceCodec, VoiceEncoder}; +pub use voelin_media; +use voelin_media::capture::synthetic::{SineSource, SyntheticScreen}; +use voelin_media::capture::{ + self, AudioCapture, CaptureOptions, CaptureSource, ScreenCapture, SourceId, +}; +use voelin_media::{ + AudioBuffer, Codec, Codecs, ContentHint, EncoderConfig, FrameReceiver, VideoEncoder, VideoFrame, +}; +use voelin_stream::{ + EncodedFrame, FrameSource, Frequency, MediaFrame, MediaKind, MediaTime, PeerConfig, VideoCodec, +}; + +use crate::stream::StreamSink; +use crate::{Command, Engine, SessionId}; + +/// How long media threads wait for input before checking whether to stop. +const POLL: Duration = Duration::from_millis(100); +/// Samples per channel in one 20 ms Opus frame at 48 kHz. +const OPUS_FRAME: usize = 960; +/// Opus bitrate of stream audio (stereo, music). +const OPUS_BITRATE: i32 = 128_000; +/// Video frames the decoder may fall behind before the queue is dropped. +pub const MAX_QUEUED: usize = 30; +/// Keyframe requests while waiting for one are at least this far apart. +const KEYFRAME_RETRY: Duration = Duration::from_millis(500); + +#[derive(Debug, thiserror::Error)] +pub enum MediaError { + #[error(transparent)] + Media(#[from] voelin_media::Error), + #[error("Opus: {0}")] + Opus(#[from] voelin_audio::Error), +} + +fn lock(m: &Mutex) -> MutexGuard<'_, T> { + m.lock().unwrap_or_else(PoisonError::into_inner) +} + +fn spawn(name: &str, f: impl FnOnce() + Send + 'static) -> Result, MediaError> { + std::thread::Builder::new() + .name(name.to_owned()) + .spawn(f) + .map_err(|e| MediaError::Media(e.into())) +} + +/// The `voelin_media` codec of a negotiated video codec. +pub fn media_codec(codec: VideoCodec) -> Codec { + match codec { + VideoCodec::Vp8 => Codec::Vp8, + VideoCodec::Vp9 => Codec::Vp9, + VideoCodec::H264 => Codec::H264, + VideoCodec::Av1 => Codec::Av1, + } +} + +/// The negotiable video codec of a `voelin_media` codec. +pub fn video_codec(codec: Codec) -> VideoCodec { + match codec { + Codec::Vp8 => VideoCodec::Vp8, + Codec::Vp9 => VideoCodec::Vp9, + Codec::H264 => VideoCodec::H264, + Codec::Av1 => VideoCodec::Av1, + } +} + +/// The codec our stream is encoded with: the first codec of the offer +/// (`config.video_codecs`) that we can encode. +pub fn stream_codec(codecs: &Codecs, config: &PeerConfig) -> Option { + let encodable = codecs.encoder_codecs(); + config.video_codecs.iter().map(|c| media_codec(*c)).find(|c| encodable.contains(c)) +} + +/// `config` adjusted to what `codecs` can do: viewers accept only codecs we +/// decode, and a streamer offers only the codec it encodes (every viewer +/// gets the same frames, and a viewer picks from the offer). +pub fn peer_config(codecs: &Codecs, mut config: PeerConfig) -> PeerConfig { + config.accept_video_codecs = codecs.decoders().into_iter().map(video_codec).collect(); + if let Some(codec) = stream_codec(codecs, &config) { + config.video_codecs = vec![video_codec(codec)]; + } + config +} + +/// Monitors and windows of this session's capture backend. The portal (on +/// Wayland) lists a single entry: its own dialog picks. +pub fn screen_sources() -> Result, MediaError> { + Ok(capture::default_screen_capture()?.sources()?) +} + +/// The synthetic test pattern as a source. +pub fn test_pattern_source() -> CaptureSource { + let (width, height) = StreamerConfig::default().synthetic_size; + CaptureSource { + id: SourceId::Synthetic, + name: "Test pattern".into(), + width, + height, + primary: false, + } +} + +/// Where a [`Streamer`] puts encoded frames. +pub trait MediaSink: Send + Sync { + /// Send one frame; `false` once nobody takes frames any more. + fn send(&self, frame: EncodedFrame) -> bool; + + /// Whether a keyframe was asked for since the last call. + fn take_keyframe_request(&self) -> bool; +} + +impl MediaSink for StreamSink { + fn send(&self, frame: EncodedFrame) -> bool { + StreamSink::send(self, frame) + } + + fn take_keyframe_request(&self) -> bool { + StreamSink::take_keyframe_request(self) + } +} + +/// Which backend captures monitors and windows. +#[derive(Clone, Debug, Default, PartialEq, Eq)] +pub enum CaptureBackend { + /// The one for this desktop session (`capture::default_screen_capture`). + #[default] + Auto, + /// X11, also under Wayland through XWayland (Linux). + X11, +} + +/// What and how to stream. +#[derive(Clone, Debug, PartialEq, Eq)] +pub struct StreamerConfig { + pub source: SourceId, + /// For monitors and windows. + pub backend: CaptureBackend, + /// Frames per second (1 to 60). + pub fps: u32, + /// Video bitrate in kbit/s, as in `StreamSetup::bitrate`. + pub bitrate_kbps: u32, + /// The codec of our offer, see [`stream_codec`]. + pub codec: Codec, + /// Capture and send system audio (a sine tone with the test pattern). + pub audio: bool, + pub cursor: bool, + /// Size of the test pattern ([`SourceId::Synthetic`]). + pub synthetic_size: (u32, u32), + /// Portal restore token from an earlier share: the desktop may skip its + /// dialog. The new one is [`Streamer::restore_token`]. + pub restore_token: Option, +} + +impl Default for StreamerConfig { + fn default() -> Self { + Self { + source: SourceId::Monitor(0), + backend: CaptureBackend::Auto, + fps: 30, + bitrate_kbps: 4608, + codec: Codec::Vp8, + audio: true, + cursor: true, + synthetic_size: (1280, 720), + restore_token: None, + } + } +} + +/// What a [`Streamer`] has done so far. +#[derive(Clone, Debug, Default, PartialEq, Eq)] +pub struct StreamerStats { + /// Frames handed to the sink. + pub video_frames: u64, + pub audio_frames: u64, + /// Size of the last captured frame. + pub width: u32, + pub height: u32, + /// The capture stopped by itself (window closed, sharing ended in the + /// desktop's UI, ...). + pub capture_ended: bool, + /// The last encoder error. + pub error: Option, +} + +#[derive(Default)] +struct Shared { + sink: Mutex>>, + stop: AtomicBool, + video_frames: AtomicU64, + audio_frames: AtomicU64, + /// `width << 32 | height` of the last captured frame. + size: AtomicU64, + capture_ended: AtomicBool, + error: Mutex>, +} + +impl Shared { + fn sink(&self) -> Option> { + lock(&self.sink).clone() + } + + fn stopped(&self) -> bool { + self.stop.load(Ordering::Relaxed) + } +} + +/// Capture and encoding for our stream. Frames are captured from the start +/// (the portal asks the user then), but only encoded once a sink is +/// [attached](Streamer::attach). Stops when dropped. +pub struct Streamer { + shared: Arc, + screen: Option>, + audio: Option>, + threads: Vec>, + backend: &'static str, + restore_token: Option, + audio_error: Option, +} + +impl Streamer { + /// Start capturing. Must run on a Tokio runtime (the portal talks D-Bus + /// on it); may wait for the user in the portal's dialog. + pub async fn start(codecs: &Codecs, config: StreamerConfig) -> Result { + let fps = config.fps.clamp(1, 60); + let encoder = codecs.new_encoder( + config.codec, + EncoderConfig { + fps, + bitrate_bps: config.bitrate_kbps.clamp(100, 10_000) * 1000, + content: ContentHint::Screen, + ..EncoderConfig::default() + }, + )?; + let options = CaptureOptions { fps, cursor: config.cursor, ..CaptureOptions::default() }; + // The portal's token for this choice comes with the capture. + let (screen, frames, restore_token): (Box, _, _) = match &config.source { + SourceId::Synthetic => { + let (w, h) = config.synthetic_size; + let mut screen = SyntheticScreen::new(w, h); + let frames = screen.start(&SourceId::Synthetic, &options).await?; + (Box::new(screen), frames, None) + } + #[cfg(all(target_os = "linux", feature = "media-desktop"))] + SourceId::Portal => { + use voelin_media::capture::portal::PortalCapture; + let mut portal = PortalCapture::with_restore_token(config.restore_token.clone()); + let frames = portal.start(&SourceId::Portal, &options).await?; + let token = portal.restore_token().map(str::to_owned); + (Box::new(portal), frames, token) + } + source => { + let mut screen = match config.backend { + CaptureBackend::Auto => capture::default_screen_capture()?, + #[cfg(all(target_os = "linux", feature = "media-desktop"))] + CaptureBackend::X11 => Box::new(voelin_media::capture::x11::X11Capture::new()), + #[cfg(not(all(target_os = "linux", feature = "media-desktop")))] + CaptureBackend::X11 => { + return Err(voelin_media::Error::CaptureUnavailable { + backend: "x11", + reason: "X11 capture is only in Linux desktop builds".into(), + } + .into()); + } + }; + let frames = screen.start(source, &options).await?; + (screen, frames, None) + } + }; + let backend = screen.backend(); + + let shared = Arc::new(Shared::default()); + let mut streamer = Self { + shared: shared.clone(), + screen: Some(screen), + audio: None, + threads: Vec::new(), + backend, + restore_token, + audio_error: None, + }; + streamer.threads.push(spawn("voelin-stream-video", { + let shared = shared.clone(); + move || video_loop(&shared, frames, encoder) + })?); + if config.audio { + match start_audio(&config.source) { + Ok((capture, buffers, encoder)) => { + streamer.audio = Some(capture); + streamer.threads.push(spawn("voelin-stream-audio", move || { + audio_loop(&shared, buffers, encoder) + })?); + } + Err(e) => { + warn!("streaming without audio: {e}"); + streamer.audio_error = Some(e.to_string()); + } + } + } + Ok(streamer) + } + + /// Start encoding into `sink` (replacing an earlier one). + pub fn attach(&self, sink: Arc) { + *lock(&self.shared.sink) = Some(sink); + } + + /// Stop encoding; capture goes on. + pub fn detach(&self) { + *lock(&self.shared.sink) = None; + } + + /// The capture backend (`"x11"`, `"portal"`, `"synthetic"`, ...). + pub fn backend(&self) -> &'static str { + self.backend + } + + /// The portal's token for this choice of screen, to store for next time. + pub fn restore_token(&self) -> Option<&str> { + self.restore_token.as_deref() + } + + /// Why system audio is not captured, if it was asked for. + pub fn audio_error(&self) -> Option<&str> { + self.audio_error.as_deref() + } + + /// Whether system audio is captured. + pub fn has_audio(&self) -> bool { + self.audio.is_some() + } + + pub fn stats(&self) -> StreamerStats { + let size = self.shared.size.load(Ordering::Relaxed); + StreamerStats { + video_frames: self.shared.video_frames.load(Ordering::Relaxed), + audio_frames: self.shared.audio_frames.load(Ordering::Relaxed), + width: (size >> 32) as u32, + height: size as u32, + capture_ended: self.shared.capture_ended.load(Ordering::Relaxed), + error: lock(&self.shared.error).clone(), + } + } + + /// Stop capturing and encoding. + pub fn stop(&mut self) { + self.shared.stop.store(true, Ordering::Relaxed); + self.detach(); + if let Some(mut screen) = self.screen.take() { + screen.stop(); + } + if let Some(mut audio) = self.audio.take() { + audio.stop(); + } + for thread in self.threads.drain(..) { + let _ = thread.join(); + } + } +} + +impl Drop for Streamer { + fn drop(&mut self) { + self.stop(); + } +} + +type AudioStart = (Box, FrameReceiver, VoiceEncoder); + +fn start_audio(source: &SourceId) -> Result { + let mut encoder = VoiceEncoder::new(VoiceCodec::Music)?; + encoder.set_bitrate(OPUS_BITRATE)?; + let mut capture: Box = match source { + SourceId::Synthetic => Box::new(SineSource::new(440.0, 0.05)), + _ => capture::default_audio_capture()?, + }; + let buffers = capture.start()?; + Ok((capture, buffers, encoder)) +} + +fn video_loop( + shared: &Shared, + mut frames: FrameReceiver, + mut encoder: Box, +) { + // A requested keyframe the encoder has not produced yet (rate control + // may skip a frame). + let mut keyframe_due = false; + while !shared.stopped() { + let Some(frame) = frames.recv_timeout(POLL) else { + if frames.is_closed() { + debug!("screen capture ended"); + shared.capture_ended.store(true, Ordering::Relaxed); + break; + } + continue; + }; + let size = u64::from(frame.width) << 32 | u64::from(frame.height); + shared.size.store(size, Ordering::Relaxed); + let Some(sink) = shared.sink() else { continue }; + let keyframe = sink.take_keyframe_request() || keyframe_due; + match encoder.encode(&frame, keyframe) { + Ok(encoded) => { + keyframe_due = keyframe && !encoded.iter().any(|f| f.keyframe); + for f in encoded { + let frame = EncodedFrame { + kind: MediaKind::Video, + time: MediaTime::from_90khz(f.pts_90khz), + data: f.data.into(), + }; + if sink.send(frame) { + shared.video_frames.fetch_add(1, Ordering::Relaxed); + } + } + } + Err(e) => { + warn!("video encoding failed: {e}"); + keyframe_due = keyframe; + *lock(&shared.error) = Some(e.to_string()); + } + } + } +} + +/// Interleaved stereo from any channel count (extra channels are dropped). +fn append_stereo(buffer: &AudioBuffer, out: &mut Vec) { + match buffer.channels { + 0 => {} + 1 => out.extend(buffer.samples.iter().flat_map(|s| [*s, *s])), + 2 => out.extend_from_slice(&buffer.samples), + n => { + for frame in buffer.samples.chunks_exact(usize::from(n)) { + out.extend_from_slice(&frame[..2]); + } + } + } +} + +fn audio_loop(shared: &Shared, mut buffers: FrameReceiver, mut encoder: VoiceEncoder) { + // Interleaved stereo waiting for a whole Opus frame. + let mut pending: Vec = Vec::new(); + // Opus frames since the capture started: the RTP time in 20 ms steps. + let mut frames: u64 = 0; + while !shared.stopped() { + let Some(buffer) = buffers.recv_timeout(POLL) else { + if buffers.is_closed() { + debug!("system audio capture ended"); + break; + } + continue; + }; + // Follow the capture clock across gaps (nothing played, sink not + // attached yet), so audio stays in step with video. + let at = buffer.timestamp.as_micros() as u64 * 48 / 1000; + let position = frames * OPUS_FRAME as u64 + (pending.len() / 2) as u64; + if at > position + 10 * OPUS_FRAME as u64 { + pending.clear(); + frames = at / OPUS_FRAME as u64; + } + let Some(sink) = shared.sink() else { continue }; + append_stereo(&buffer, &mut pending); + while pending.len() >= OPUS_FRAME * 2 { + let data: Option> = match encoder.encode_to_bytes(&pending[..OPUS_FRAME * 2]) + { + Ok(data) => Some(data.into()), + Err(e) => { + warn!("audio encoding failed: {e}"); + None + } + }; + pending.drain(..OPUS_FRAME * 2); + if let Some(data) = data { + let time = MediaTime::new(frames * OPUS_FRAME as u64, Frequency::FORTY_EIGHT_KHZ); + if sink.send(EncodedFrame { kind: MediaKind::Audio, time, data }) { + shared.audio_frames.fetch_add(1, Ordering::Relaxed); + } + } + frames += 1; + } + } +} + +/// Collects a [`Streamer`]'s frames for [`EncodedSource`]. +struct ChannelSink { + tx: std_mpsc::Sender, + keyframe: AtomicBool, +} + +impl MediaSink for ChannelSink { + fn send(&self, frame: EncodedFrame) -> bool { + self.tx.send(frame).is_ok() + } + + fn take_keyframe_request(&self) -> bool { + self.keyframe.swap(false, Ordering::Relaxed) + } +} + +/// A [`Streamer`] as a [`FrameSource`], for code that runs +/// `voelin_stream::Streams` itself (e.g. voelinctl). +pub struct EncodedSource { + streamer: Streamer, + frames: std_mpsc::Receiver, + sink: Arc, +} + +impl EncodedSource { + pub fn new(streamer: Streamer) -> Self { + let (tx, frames) = std_mpsc::channel(); + let sink = Arc::new(ChannelSink { tx, keyframe: AtomicBool::new(true) }); + streamer.attach(sink.clone()); + Self { streamer, frames, sink } + } + + pub fn streamer(&self) -> &Streamer { + &self.streamer + } +} + +impl FrameSource for EncodedSource { + fn poll_frames(&mut self, _now: Instant, out: &mut Vec) { + out.extend(self.frames.try_iter()); + } + + fn request_keyframe(&mut self) { + self.sink.keyframe.store(true, Ordering::Relaxed); + } +} + +/// Whether `data` (one depacketized frame) starts a picture that decodes on +/// its own. Unknown formats count as keyframes, so the decoder gets to try. +pub fn is_keyframe(codec: Codec, data: &[u8]) -> bool { + match codec { + // Frame tag: bit 0 is 0 for key frames. + Codec::Vp8 => data.first().is_some_and(|b| b & 1 == 0), + Codec::Vp9 => vp9_is_keyframe(data), + Codec::H264 => h264_nal_types(data).any(|t| t == 5 || t == 7), + Codec::Av1 => av1_has_sequence_header(data).unwrap_or(true), + } +} + +/// VP9 uncompressed header: frame marker, profile, show_existing_frame, +/// frame_type (0 = key frame). +fn vp9_is_keyframe(data: &[u8]) -> bool { + let Some(&b) = data.first() else { return false }; + if b >> 6 != 2 { + return false; + } + let profile = ((b >> 5) & 1) | (((b >> 4) & 1) << 1); + // Profile 3 has a reserved bit after the profile. + let mut bit = if profile == 3 { 3 } else { 4 }; + let read = |bit: u32| (u32::from(b) >> (7 - bit)) & 1; + let show_existing = read(bit); + if show_existing == 1 { + return false; + } + bit += 1; + read(bit) == 0 +} + +/// NAL unit types of an Annex B H.264 frame. +fn h264_nal_types(data: &[u8]) -> impl Iterator + '_ { + data.windows(4).filter_map(|w| (w[..3] == [0, 0, 1]).then_some(w[3] & 0x1f)) +} + +/// Whether an AV1 temporal unit carries a sequence header OBU (sent with +/// key frames); `None` if the OBUs cannot be parsed. +fn av1_has_sequence_header(mut data: &[u8]) -> Option { + while let Some(&header) = data.first() { + let obu_type = (header >> 3) & 0x0f; + if obu_type == 1 { + return Some(true); + } + let extension = header & 0x04 != 0; + let has_size = header & 0x02 != 0; + let mut pos = 1 + usize::from(extension); + if !has_size { + return Some(false); + } + // LEB128 size. + let mut size = 0usize; + for i in 0..8 { + let byte = *data.get(pos)?; + pos += 1; + size |= usize::from(byte & 0x7f) << (7 * i); + if byte & 0x80 == 0 { + break; + } + } + data = data.get(pos + size..)?; + } + Some(false) +} + +/// Decoding statistics of a [`VideoPipeline`]. +#[derive(Clone, Debug, Default, PartialEq, Eq)] +pub struct DecodeStats { + /// Pictures handed to the callback. + pub decoded: u64, + /// Frames skipped while waiting for a keyframe. + pub skipped: u64, + pub keyframe_requests: u64, + pub codec: Option, + pub width: u32, + pub height: u32, + /// The last error (no decoder for the codec, decoding failed). + pub error: Option, +} + +#[derive(Default)] +struct QueueState { + frames: VecDeque, + /// Frames were dropped: wait for a keyframe. + lost: bool, + closed: bool, +} + +#[derive(Default)] +struct DecodeQueue { + state: Mutex, + cond: Condvar, + stats: Mutex, +} + +/// Feeds frames into a [`VideoPipeline`]; cheap to clone. +#[derive(Clone)] +pub struct FrameInput { + queue: Arc, +} + +impl FrameInput { + /// Queue a video frame (audio frames are ignored). When the decoder + /// falls more than [`MAX_QUEUED`] frames behind, the queue is dropped + /// and decoding resumes at the next keyframe. + pub fn push(&self, frame: MediaFrame) { + if frame.kind != MediaKind::Video { + return; + } + let mut state = lock(&self.queue.state); + if state.frames.len() >= MAX_QUEUED { + state.frames.clear(); + state.lost = true; + } + state.frames.push_back(frame); + drop(state); + self.queue.cond.notify_one(); + } + + /// Frames were lost before they reached us (e.g. a lagging receiver). + pub fn lost(&self) { + lock(&self.queue.state).lost = true; + } +} + +/// Decodes the video frames of one stream on its own thread. See the +/// [module docs](self). +pub struct VideoPipeline { + input: FrameInput, + thread: Option>, +} + +impl VideoPipeline { + /// `on_frame` gets every decoded picture on the decoding thread; + /// `request_keyframe` is called when the decoder needs one (at most + /// every half second). + pub fn new( + codecs: Arc, + on_frame: impl FnMut(VideoFrame) + Send + 'static, + request_keyframe: impl Fn() + Send + 'static, + ) -> Self { + let queue = Arc::new(DecodeQueue::default()); + let thread = std::thread::Builder::new() + .name("voelin-stream-decode".into()) + .spawn({ + let queue = queue.clone(); + move || decode_loop(&queue, &codecs, on_frame, request_keyframe) + }) + .map_err(|e| warn!("cannot start the video decoder: {e}")) + .ok(); + Self { input: FrameInput { queue }, thread } + } + + /// Where frames go in. + pub fn input(&self) -> FrameInput { + self.input.clone() + } + + pub fn push(&self, frame: MediaFrame) { + self.input.push(frame); + } + + pub fn stats(&self) -> DecodeStats { + lock(&self.input.queue.stats).clone() + } +} + +impl Drop for VideoPipeline { + fn drop(&mut self) { + lock(&self.input.queue.state).closed = true; + self.input.queue.cond.notify_all(); + if let Some(thread) = self.thread.take() { + let _ = thread.join(); + } + } +} + +fn decode_loop( + queue: &DecodeQueue, + codecs: &Codecs, + mut on_frame: impl FnMut(VideoFrame), + request_keyframe: impl Fn(), +) { + let mut decoder: Option<(Codec, Box)> = None; + // Start at a keyframe; the streamer sends one when a viewer connects. + let mut waiting = true; + let mut last_request: Option = None; + let mut request = |stats: &Mutex| { + if last_request.is_none_or(|t| t.elapsed() >= KEYFRAME_RETRY) { + last_request = Some(Instant::now()); + lock(stats).keyframe_requests += 1; + request_keyframe(); + } + }; + let set_error = |message: String| lock(&queue.stats).error = Some(message); + loop { + let (frame, lost) = { + let mut state = lock(&queue.state); + loop { + if state.closed { + return; + } + if let Some(frame) = state.frames.pop_front() { + break (frame, std::mem::take(&mut state.lost)); + } + state = + queue.cond.wait_timeout(state, POLL).unwrap_or_else(PoisonError::into_inner).0; + } + }; + let codec = match Codec::try_from(frame.codec) { + Ok(codec) => codec, + Err(e) => { + set_error(e.to_string()); + continue; + } + }; + if decoder.as_ref().is_none_or(|(c, _)| *c != codec) { + match codecs.new_decoder(codec) { + Ok(d) => { + decoder = Some((codec, d)); + waiting = true; + lock(&queue.stats).codec = Some(codec); + } + Err(e) => { + if decoder.is_some() || lock(&queue.stats).error.is_none() { + warn!("no decoder for the stream: {e}"); + } + decoder = None; + set_error(e.to_string()); + continue; + } + } + } + if lost || !frame.contiguous { + waiting = true; + } + if waiting { + if !is_keyframe(codec, &frame.data) { + lock(&queue.stats).skipped += 1; + request(&queue.stats); + continue; + } + waiting = false; + } + let Some((_, dec)) = &mut decoder else { continue }; + match dec.decode(&frame.data) { + Ok(Some(picture)) => { + { + let mut stats = lock(&queue.stats); + stats.decoded += 1; + (stats.width, stats.height) = (picture.width, picture.height); + } + on_frame(picture); + } + Ok(None) => {} + Err(e) => { + debug!("decoding failed: {e}"); + set_error(e.to_string()); + waiting = true; + request(&queue.stats); + } + } + } +} + +/// Decodes a stream watched through the engine: a [`VideoPipeline`] fed from +/// [`Engine::subscribe_frames`], asking the streamer for keyframes through +/// the engine. Stops when dropped. +pub struct Viewer { + pipeline: VideoPipeline, + forward: tokio::task::JoinHandle<()>, +} + +impl Viewer { + pub fn start( + engine: &Engine, + session: SessionId, + stream_id: &str, + codecs: Arc, + on_frame: impl FnMut(VideoFrame) + Send + 'static, + ) -> Self { + let request = { + let engine = engine.clone(); + let stream_id = stream_id.to_owned(); + move || { + let stream_id = stream_id.clone(); + engine.send(Command::RequestStreamKeyframe { session, stream_id }); + } + }; + let pipeline = VideoPipeline::new(codecs, on_frame, request); + let input = pipeline.input(); + let mut frames = engine.subscribe_frames(); + let stream_id = stream_id.to_owned(); + let forward = engine.runtime().spawn(async move { + use tokio::sync::broadcast::error::RecvError; + loop { + match frames.recv().await { + Ok(f) if f.session == session && f.stream_id == stream_id => { + input.push(f.frame) + } + Ok(_) => {} + Err(RecvError::Lagged(_)) => input.lost(), + Err(RecvError::Closed) => break, + } + } + }); + Self { pipeline, forward } + } + + pub fn stats(&self) -> DecodeStats { + self.pipeline.stats() + } +} + +impl Drop for Viewer { + fn drop(&mut self) { + self.forward.abort(); + } +} + +/// Hands the newest item from a producer thread to a consumer that may be +/// slower (e.g. a UI): an item that was not taken yet is replaced. +pub struct Latest { + slot: Mutex>, +} + +impl Default for Latest { + fn default() -> Self { + Self { slot: Mutex::new(None) } + } +} + +impl Latest { + pub fn new() -> Self { + Self::default() + } + + /// Store `item`. Returns `true` if the slot was empty, i.e. the consumer + /// needs a wake-up; otherwise a wake-up is already pending. + pub fn put(&self, item: T) -> bool { + lock(&self.slot).replace(item).is_none() + } + + pub fn take(&self) -> Option { + lock(&self.slot).take() + } +} + +/// Feeds a [`Streamer`]'s video straight into a [`VideoPipeline`]. +struct PipelineSink { + input: FrameInput, + codec: voelin_stream::Codec, + keyframe: Arc, +} + +impl MediaSink for PipelineSink { + fn send(&self, frame: EncodedFrame) -> bool { + self.input.push(MediaFrame { + kind: frame.kind, + codec: self.codec, + time: frame.time, + network_time: Instant::now(), + contiguous: true, + data: frame.data, + }); + true + } + + fn take_keyframe_request(&self) -> bool { + self.keyframe.swap(false, Ordering::Relaxed) + } +} + +/// Capture → encoder → decoder without a server, e.g. to preview a share or +/// to develop the viewer (`VOELIN_DEMO_STREAM` in the desktop app). +pub struct LocalPreview { + // Dropped first: no more frames into the pipeline. + streamer: Streamer, + pipeline: VideoPipeline, +} + +impl LocalPreview { + pub async fn start( + codecs: Arc, + mut config: StreamerConfig, + on_frame: impl FnMut(VideoFrame) + Send + 'static, + ) -> Result { + // The audio would go nowhere. + config.audio = false; + let codec = config.codec; + let streamer = Streamer::start(&codecs, config).await?; + let keyframe = Arc::new(AtomicBool::new(true)); + let pipeline = VideoPipeline::new(codecs, on_frame, { + let keyframe = keyframe.clone(); + move || keyframe.store(true, Ordering::Relaxed) + }); + let input = pipeline.input(); + streamer.attach(Arc::new(PipelineSink { input, codec: codec.into(), keyframe })); + Ok(Self { streamer, pipeline }) + } + + pub fn streamer(&self) -> &Streamer { + &self.streamer + } + + pub fn stats(&self) -> DecodeStats { + self.pipeline.stats() + } +} + +/// The first and last column of the rectangle in the middle row of a +/// decoded test pattern. Checks that pixels further than two columns from +/// its edges (which the codec blurs) have the colour of the rectangle or +/// the background. +#[cfg(all(test, feature = "media-desktop"))] +pub(crate) fn rectangle_span(picture: &VideoFrame) -> (u32, u32) { + use voelin_media::capture::synthetic::{BACKGROUND, RECT_COLOR}; + + let rgba = voelin_media::convert::to_rgba_vec(picture).unwrap(); + let y = picture.height / 2; + let pixel = |x: u32| { + let i = ((y * picture.width + x) * 4) as usize; + [rgba[i], rgba[i + 1], rgba[i + 2]] + }; + let close = |p: [u8; 3], c: [u8; 3]| p.iter().zip(c).all(|(a, b)| a.abs_diff(b) <= 24); + let inside: Vec = (0..picture.width).filter(|&x| close(pixel(x), RECT_COLOR)).collect(); + let (&a, &b) = inside.first().zip(inside.last()).expect("no rectangle in the middle row"); + for x in 0..picture.width { + if x + 2 < a || x > b + 2 { + assert!(close(pixel(x), BACKGROUND), "pixel {x},{y} is {:?}", pixel(x)); + } else if (a + 2..=b.saturating_sub(2)).contains(&x) { + assert!(close(pixel(x), RECT_COLOR), "pixel {x},{y} is {:?}", pixel(x)); + } + } + (a, b) +} + +#[cfg(test)] +mod tests { + use super::*; + + #[test] + fn keyframe_detection() { + // VP8: the 1x1 keyframe of voelin-stream's synthetic source. + assert!(is_keyframe(Codec::Vp8, &voelin_stream::source::VP8_KEYFRAME_1X1)); + assert!(!is_keyframe(Codec::Vp8, &[0x31, 0x00])); + // VP9 profile 0: marker 10, profile 00, show_existing 0, frame_type 0/1. + assert!(is_keyframe(Codec::Vp9, &[0b1000_0000])); + assert!(!is_keyframe(Codec::Vp9, &[0b1000_0100])); + assert!(!is_keyframe(Codec::Vp9, &[0b1000_1000]), "show existing frame"); + // H.264: SPS + IDR vs. a non-IDR slice. + assert!(is_keyframe(Codec::H264, &[0, 0, 0, 1, 0x67, 1, 0, 0, 1, 0x65, 2])); + assert!(!is_keyframe(Codec::H264, &[0, 0, 0, 1, 0x41, 1, 2])); + // AV1: temporal delimiter (type 2, size 0) then a sequence header. + assert!(is_keyframe(Codec::Av1, &[0x12, 0x00, 0x0a, 0x01, 0xff])); + assert!(!is_keyframe(Codec::Av1, &[0x12, 0x00, 0x32, 0x01, 0xff])); + assert!(is_keyframe(Codec::Av1, &[0x12, 0x05]), "truncated: let the decoder try"); + } + + #[test] + fn latest_keeps_the_newest() { + let latest = Latest::new(); + assert!(latest.put(1)); + assert!(!latest.put(2), "a wake-up is pending"); + assert_eq!(latest.take(), Some(2)); + assert_eq!(latest.take(), None); + assert!(latest.put(3)); + } + + #[cfg(feature = "media-desktop")] + #[test] + fn peer_config_follows_codecs() { + let codecs = Codecs::new(); + let config = peer_config(&codecs, PeerConfig::default()); + assert_eq!(config.video_codecs, [VideoCodec::Vp8]); + assert!(config.accept_video_codecs.contains(&VideoCodec::Vp8)); + assert!(!config.accept_video_codecs.contains(&VideoCodec::H264), "no OpenH264 loaded"); + assert_eq!(stream_codec(&codecs, &config), Some(Codec::Vp8)); + let h264_only = PeerConfig { video_codecs: vec![VideoCodec::H264], ..config }; + assert_eq!(stream_codec(&codecs, &h264_only), None); + } + + /// The test pattern through VP8 and back, without a network: pictures + /// show the moving rectangle. + #[cfg(feature = "media-desktop")] + #[tokio::test(flavor = "multi_thread")] + async fn local_preview_decodes_the_pattern() { + let codecs = Arc::new(Codecs::new()); + let config = StreamerConfig { + source: SourceId::Synthetic, + synthetic_size: (320, 240), + bitrate_kbps: 1500, + ..StreamerConfig::default() + }; + let (tx, rx) = std_mpsc::channel(); + let preview = LocalPreview::start(codecs, config, move |picture| { + let _ = tx.send(picture); + }) + .await + .unwrap(); + let mut spans = Vec::new(); + while spans.len() < 10 { + let picture = rx.recv_timeout(Duration::from_secs(5)).expect("no picture"); + assert_eq!((picture.width, picture.height), (320, 240)); + spans.push(rectangle_span(&picture)); + } + // 320 / 5 = 64 pixels wide, give or take the codec's blur. + for (a, b) in &spans { + assert!((60..=68).contains(&(b - a + 1)), "{spans:?}"); + } + assert_ne!(spans.first(), spans.last(), "the rectangle moves"); + let stats = preview.stats(); + assert!(stats.decoded >= 10 && stats.error.is_none(), "{stats:?}"); + assert_eq!(stats.codec, Some(Codec::Vp8)); + assert_eq!(preview.streamer().backend(), "synthetic"); + } + + /// Audio of the test pattern: 20 ms Opus frames on a 48 kHz clock. + #[cfg(feature = "media-desktop")] + #[tokio::test(flavor = "multi_thread")] + async fn streamer_sends_opus() { + let codecs = Codecs::new(); + let config = StreamerConfig { + source: SourceId::Synthetic, + synthetic_size: (64, 48), + ..StreamerConfig::default() + }; + let streamer = Streamer::start(&codecs, config).await.unwrap(); + assert!(streamer.has_audio(), "{:?}", streamer.audio_error()); + let mut source = EncodedSource::new(streamer); + let mut frames = Vec::new(); + let deadline = Instant::now() + Duration::from_secs(5); + while frames.iter().filter(|f: &&EncodedFrame| f.kind == MediaKind::Audio).count() < 10 { + assert!(Instant::now() < deadline, "no audio"); + tokio::time::sleep(Duration::from_millis(20)).await; + source.poll_frames(Instant::now(), &mut frames); + } + let times: Vec = frames + .iter() + .filter(|f| f.kind == MediaKind::Audio) + .map(|f| f.time.rebase(Frequency::FORTY_EIGHT_KHZ).numer()) + .collect(); + assert!(times.windows(2).all(|w| w[1] - w[0] == OPUS_FRAME as u64), "{times:?}"); + let video = frames.iter().find(|f| f.kind == MediaKind::Video).expect("video too"); + assert!(is_keyframe(Codec::Vp8, &video.data), "the first frame is a keyframe"); + assert!(source.streamer().stats().video_frames > 0); + } +} diff --git a/crates/tsc-core/src/query.rs b/crates/voelin-core/src/query.rs similarity index 89% rename from crates/tsc-core/src/query.rs rename to crates/voelin-core/src/query.rs index bee41e0..8b66d98 100644 --- a/crates/tsc-core/src/query.rs +++ b/crates/voelin-core/src/query.rs @@ -1,8 +1,10 @@ //! The query source: own ServerQuery credentials, in-process observer and relays. use tokio::sync::{broadcast, mpsc}; -use tsc_model::{ChatMessage, ChatTarget, Presence}; -use tsc_observer::{Observer, ObserverConfig, ObserverEvent, RelayConfig, RelayEvent, RelayPool}; +use voelin_model::{ChatMessage, ChatTarget, Presence}; +use voelin_observer::{ + Observer, ObserverConfig, ObserverEvent, RelayConfig, RelayEvent, RelayPool, +}; pub(crate) enum QueryCmd { OpenChat(ChatTarget), @@ -19,7 +21,7 @@ pub(crate) enum QueryEvent { } pub(crate) async fn run( - connect: tsc_query::Connect, + connect: voelin_query::Connect, mut commands: mpsc::UnboundedReceiver, events: mpsc::UnboundedSender, ) { @@ -74,7 +76,7 @@ pub(crate) async fn run( Some(QueryCmd::SendChat { target, nick, text }) => { let result = match &target { ChatTarget::Channel(cid) => relays.send(*cid, &nick, &text).await, - _ => Err(tsc_query::Error::Unsupported("only channel chat is relayed with own credentials")), + _ => Err(voelin_query::Error::Unsupported("only channel chat is relayed with own credentials")), }; if let Err(e) = result { let _ = events.send(QueryEvent::Error(e.to_string())); diff --git a/crates/tsc-core/src/route.rs b/crates/voelin-core/src/route.rs similarity index 98% rename from crates/tsc-core/src/route.rs rename to crates/voelin-core/src/route.rs index 9531204..27ae3aa 100644 --- a/crates/tsc-core/src/route.rs +++ b/crates/voelin-core/src/route.rs @@ -2,7 +2,7 @@ use std::collections::VecDeque; -use tsc_model::{ChannelId, ChatMessage, ChatTarget}; +use voelin_model::{ChannelId, ChatMessage, ChatTarget}; /// Which source carries a chat. #[derive(Clone, Debug, PartialEq, Eq)] diff --git a/crates/tsc-core/src/session.rs b/crates/voelin-core/src/session.rs similarity index 88% rename from crates/tsc-core/src/session.rs rename to crates/voelin-core/src/session.rs index 93b748a..69f5400 100644 --- a/crates/tsc-core/src/session.rs +++ b/crates/voelin-core/src/session.rs @@ -5,9 +5,11 @@ use std::sync::Arc; use tokio::sync::{broadcast, mpsc}; use tracing::debug; -use tsc_model::{ChatMessage, ChatTarget, Presence}; +use tsclientlib::ClientId; +use voelin_audio::AudioSettings; +use voelin_model::{ChatMessage, ChatTarget, Presence}; -use crate::audio::{self, AudioHandle, AudioIn}; +use crate::audio::{self, AudioEvent, AudioHandle, AudioIn}; use crate::gateway::{self, GatewayCmd, GatewayEvent}; use crate::query::{self, QueryCmd, QueryEvent}; use crate::route::{ChatRoute, Dedup, route_chat}; @@ -24,9 +26,10 @@ impl SessionHandle { id: SessionId, events: broadcast::Sender, frames: broadcast::Sender, + audio_settings: AudioSettings, ) -> Self { let (tx, rx) = mpsc::unbounded_channel(); - tokio::spawn(Session::new(id, events, frames).run(rx)); + tokio::spawn(Session::new(id, events, frames, audio_settings).run(rx)); Self { tx } } @@ -42,7 +45,7 @@ enum SourceEvent { Gateway(u64, GatewayEvent), Query(u64, QueryEvent), AudioOut(u64, tsproto_packets::packets::OutPacket), - AudioError(String), + Audio(u64, AudioEvent), } struct Session { @@ -58,6 +61,7 @@ struct Session { query: Option<(u64, mpsc::UnboundedSender)>, query_presence: Option, audio: Option, + audio_settings: AudioSettings, /// Streams of the voice connection (TeamSpeak 6 only). streams: Option, stream_peer: PeerConfig, @@ -75,6 +79,7 @@ impl Session { id: SessionId, events: broadcast::Sender, frames: broadcast::Sender, + audio_settings: AudioSettings, ) -> Self { let (sources_tx, sources_rx) = mpsc::unbounded_channel(); Self { @@ -90,6 +95,7 @@ impl Session { query: None, query_presence: None, audio: None, + audio_settings, streams: None, stream_peer: PeerConfig::default(), frames, @@ -160,12 +166,13 @@ impl Session { self.stream_peer = options.stream_peer.clone(); let (cmd_tx, cmd_rx) = mpsc::unbounded_channel(); let (ev_tx, ev_rx) = mpsc::unbounded_channel(); + self.audio = None; if options.audio { let (out_tx, out_rx) = mpsc::unbounded_channel(); - let (err_tx, err_rx) = mpsc::unbounded_channel(); - self.audio = Some(audio::spawn(out_tx, err_tx, false)); + let (audio_tx, audio_rx) = mpsc::unbounded_channel(); + self.audio = Some(audio::spawn(out_tx, audio_tx, self.audio_settings.clone())); self.forward(out_rx, move |p| SourceEvent::AudioOut(generation, p)); - self.forward(err_rx, SourceEvent::AudioError); + self.forward(audio_rx, move |e| SourceEvent::Audio(generation, e)); } tokio::spawn(voice::run(*options, cmd_rx, ev_tx)); self.forward(ev_rx, move |e| SourceEvent::Voice(generation, e)); @@ -264,6 +271,29 @@ impl Session { } self.emit_state(); } + Command::SetAudioSettings(settings) => { + self.audio_settings = (*settings).clone(); + if let Some(a) = &self.audio { + a.send(AudioIn::Settings(settings)); + } + } + // Without audio there is nothing to adjust; the UI sends volumes + // again after connecting. + Command::SetClientVolume { client, volume, .. } => { + if let Some(a) = &self.audio { + a.send(AudioIn::ClientVolume { client: ClientId(client), volume }); + } + } + Command::SetClientMuted { client, muted, .. } => { + if let Some(a) = &self.audio { + a.send(AudioIn::ClientMuted { client: ClientId(client), muted }); + } + } + Command::SetStreamVolume { stream_id, volume, .. } => { + if let Some(a) = &self.audio { + a.send(AudioIn::StreamVolume { stream: stream_id, volume }); + } + } Command::StartStream { setup, auto_accept, .. } => { self.stream_input(StreamInput::Start { setup, auto_accept }); } @@ -287,7 +317,7 @@ impl Session { Command::RequestStreamKeyframe { stream_id, .. } => { self.stream_input(StreamInput::RequestKeyframe { stream_id }); } - Command::CloseSession { .. } => {} + Command::CloseSession { .. } | Command::TestMicrophone { .. } => {} } } @@ -389,7 +419,12 @@ impl Session { let _ = tx.send(VoiceCmd::Audio(packet)); } } - SourceEvent::AudioError(message) => self.error(message), + SourceEvent::Audio(g, event) if self.is_current(Source::Voice, g) => match event { + AudioEvent::Error(message) => self.error(message), + AudioEvent::Level { db, sending } => { + self.emit(Event::InputLevel { session: Some(self.id), level_db: db, sending }) + } + }, _ => debug!("event from a replaced source ignored"), } } @@ -398,6 +433,7 @@ impl Session { match e { VoiceEvent::Connected { name, flavor, own_client } => { self.state.voice = VoiceState::Connected; + self.state.own_client = Some(own_client); self.emit_state(); let capabilities = flavor.capabilities(); if capabilities.streams @@ -410,12 +446,19 @@ impl Session { voice.clone(), self.events.clone(), self.frames.clone(), + self.audio.clone(), )); } self.emit(Event::ServerInfo { session: self.id, name, flavor, capabilities }); self.reopen_relayed_chats(); } VoiceEvent::Presence(p) => { + // Client ids are reused: forget the volumes of those who left. + if let (Some(a), Some(old)) = (&self.audio, &self.voice_presence) { + for id in old.clients.keys().filter(|id| !p.clients.contains_key(id)) { + a.send(AudioIn::ClientLeft(ClientId(*id))); + } + } if let Some(s) = &self.streams { let clients: BTreeMap<_, _> = p.clients.values().map(|c| (c.id, c.streaming)).collect(); @@ -459,6 +502,7 @@ impl Session { self.audio = None; self.state.voice = VoiceState::Disconnected; self.state.own_channel = None; + self.state.own_client = None; self.emit_state(); if let Some(reason) = reason { self.error(format!("voice: {reason}")); diff --git a/crates/tsc-core/src/stream.rs b/crates/voelin-core/src/stream.rs similarity index 76% rename from crates/tsc-core/src/stream.rs rename to crates/voelin-core/src/stream.rs index 80ed3a2..1612953 100644 --- a/crates/tsc-core/src/stream.rs +++ b/crates/voelin-core/src/stream.rs @@ -1,5 +1,5 @@ //! TeamSpeak 6 streams of a session: a task that runs the stream sessions -//! ([`tsc_stream::Streams`]) of the voice connection. +//! ([`voelin_stream::Streams`]) of the voice connection. //! //! The voice task forwards stream notifications here and sends the resulting //! commands. Only started for TeamSpeak 6 servers. @@ -11,17 +11,18 @@ use std::sync::atomic::{AtomicBool, Ordering}; use tokio::sync::{broadcast, mpsc}; use tracing::debug; -pub use tsc_stream::{ +use tsclientlib::ClientId; +pub use voelin_stream::{ Codec, EncodedFrame, EndReason, FrameSource, Frequency, LeaveReason, MediaFrame, MediaKind, MediaTime, PeerConfig, StreamInfo, StreamKind, StreamSetup, SyntheticSource, VideoCodec, ViewerInfo, ViewerState, }; -use tsc_stream::{ +use voelin_stream::{ Output, Request, StreamEvent, StreamNotification, StreamerEvent, StreamerOptions, Streams, WatchEvent, }; -use tsclientlib::ClientId; +use crate::audio::{AudioHandle, AudioIn}; use crate::voice::VoiceCmd; use crate::{Event, SessionId}; @@ -138,6 +139,7 @@ impl StreamHandle { voice: mpsc::UnboundedSender, events: broadcast::Sender, frames: broadcast::Sender, + audio: Option, ) -> Self { let (tx, rx) = mpsc::unbounded_channel(); let task = StreamTask { @@ -146,6 +148,7 @@ impl StreamHandle { voice, events, frames, + audio, tx: tx.clone(), sink: None, clients: BTreeMap::new(), @@ -165,6 +168,8 @@ struct StreamTask { voice: mpsc::UnboundedSender, events: broadcast::Sender, frames: broadcast::Sender, + /// Where the audio of watched streams plays, if the session has audio. + audio: Option, /// For the sinks handed out. tx: mpsc::UnboundedSender, /// The sink of our live stream. @@ -299,8 +304,20 @@ impl StreamTask { let state = match event { WatchEvent::Accepted => WatchState::Connecting, WatchEvent::Connected => WatchState::Connected, - WatchEvent::Ended(reason) => WatchState::Ended(reason), + WatchEvent::Ended(reason) => { + if let Some(audio) = &self.audio { + audio.send(AudioIn::StreamEnded(id.clone())); + } + WatchState::Ended(reason) + } WatchEvent::Frame(frame) => { + if let (MediaKind::Audio, Some(audio)) = (frame.kind, &self.audio) { + audio.send(AudioIn::StreamAudio { + stream: id.clone(), + time: frame.time.rebase(Frequency::FORTY_EIGHT_KHZ).numer(), + data: frame.data.clone(), + }); + } let _ = self.frames.send(StreamFrame { session, stream_id: id, frame }); return; } @@ -322,6 +339,9 @@ impl StreamTask { } for watched in self.streams.watching() { let stream_id = watched.id().to_owned(); + if let Some(audio) = &self.audio { + audio.send(AudioIn::StreamEnded(stream_id.clone())); + } self.emit(Event::WatchState { session, stream_id, state: WatchState::Ended(ended()) }); } if self.streams.directory().iter().next().is_some() { @@ -335,7 +355,7 @@ mod tests { use std::time::{Duration, Instant}; use tokio::time::timeout; - use tsc_stream::{FrameSource, SyntheticSource}; + use voelin_stream::{FrameSource, SyntheticSource}; use super::*; @@ -416,13 +436,18 @@ mod tests { .expect("timed out") } - /// Two stream tasks (sessions 1 and 2) whose commands go through a fake server. - #[tokio::test(flavor = "multi_thread")] - async fn stream_tasks_through_fake_server() { - let (events, mut rx) = broadcast::channel(4096); - let (frames, mut frames_rx) = broadcast::channel(4096); + type Handles = Arc>; + + /// Two stream tasks (sessions 1 and 2) whose commands go through a fake + /// server; `audio` is the viewer's audio thread. + fn pair( + audio: Option, + ) -> (Handles, broadcast::Receiver, broadcast::Receiver) { + let (events, rx) = broadcast::channel(4096); + let (frames, frames_rx) = broadcast::channel(4096); let mut voices = Vec::new(); let mut handles = Vec::new(); + let mut audio = audio; for (i, clid) in CLIENTS.into_iter().enumerate() { let (voice, voice_rx) = mpsc::unbounded_channel(); let config = PeerConfig::loopback(); @@ -434,6 +459,7 @@ mod tests { voice, events.clone(), frames.clone(), + if session == 2 { audio.take() } else { None }, )); voices.push(voice_rx); } @@ -452,12 +478,20 @@ mod tests { } }); } + (handles, rx, frames_rx) + } + /// Session 1 streams (auto-accepting), session 2 watches; returns the sink + /// once the viewer is connected. + async fn live_and_watching( + handles: &Handles, + rx: &mut broadcast::Receiver, + ) -> StreamSink { let setup = StreamSetup { name: "t".into(), ..Default::default() }; handles[0].send(StreamInput::Start { setup, auto_accept: true }); // Live for the streamer and listed for the viewer, in either order. let (mut sink, mut listed) = (None, false); - wait(&mut rx, |e| { + wait(rx, |e| { match e { Event::StreamState { session: 1, state: StreamState::Live { sink: s, .. } } => { sink = Some(s); @@ -468,13 +502,21 @@ mod tests { (sink.is_some() && listed).then_some(()) }) .await; - let sink = sink.unwrap(); handles[1].send(StreamInput::Watch { stream_id: "s-1".into() }); - wait(&mut rx, |e| match e { + wait(rx, |e| match e { Event::WatchState { session: 2, state: WatchState::Connected, .. } => Some(()), _ => None, }) .await; + sink.unwrap() + } + + #[tokio::test(flavor = "multi_thread")] + async fn stream_tasks_through_fake_server() { + // The viewer's audio thread. + let (audio, audio_rx) = AudioHandle::channel(); + let (handles, mut rx, mut frames_rx) = pair(Some(audio)); + let sink = live_and_watching(&handles, &mut rx).await; // Frames from the sink reach the viewer's frame bus. let feeder = tokio::spawn({ @@ -518,6 +560,20 @@ mod tests { assert!(!sink.is_live()); feeder.await.unwrap(); + // Stream audio went to the viewer's audio thread, in 20 ms steps, + // and the ended stream was forgotten there. + let received: Vec = audio_rx.try_iter().collect(); + let times: Vec = received + .iter() + .filter_map(|m| match m { + AudioIn::StreamAudio { stream, time, .. } if stream == "s-1" => Some(*time), + _ => None, + }) + .collect(); + assert!(times.len() >= 10, "{} audio frames", times.len()); + assert!(times.windows(2).all(|w| w[1] > w[0] && (w[1] - w[0]) % 960 == 0), "{times:?}"); + assert!(matches!(received.last(), Some(AudioIn::StreamEnded(id)) if id == "s-1")); + // Errors surface as events. handles[1].send(StreamInput::Leave { stream_id: "s-1".into() }); wait(&mut rx, |e| match e { @@ -527,4 +583,77 @@ mod tests { .await; handles[1].send(StreamInput::Shutdown("bye".into())); } + + /// The whole path: test pattern → VP8 → stream task → str0m peers on + /// loopback → the viewer's frame bus → decoder. The pictures show the + /// moving rectangle. + #[cfg(feature = "media-desktop")] + #[tokio::test(flavor = "multi_thread")] + async fn test_pattern_through_stream_tasks() { + use std::sync::mpsc as std_mpsc; + + use voelin_media::capture::SourceId; + use voelin_media::{Codec, Codecs}; + + use crate::media::{Streamer, StreamerConfig, VideoPipeline, rectangle_span}; + + let (handles, mut rx, mut frames_rx) = pair(None); + let sink = live_and_watching(&handles, &mut rx).await; + let codecs = Arc::new(Codecs::new()); + let config = StreamerConfig { + source: SourceId::Synthetic, + synthetic_size: (320, 240), + bitrate_kbps: 1500, + ..StreamerConfig::default() + }; + let streamer = Streamer::start(&codecs, config).await.unwrap(); + streamer.attach(Arc::new(sink.clone())); + + let (tx, pictures) = std_mpsc::channel(); + let pipeline = VideoPipeline::new( + codecs, + move |picture| { + let _ = tx.send(picture); + }, + { + let handles = handles.clone(); + move || handles[1].send(StreamInput::RequestKeyframe { stream_id: "s-1".into() }) + }, + ); + let input = pipeline.input(); + let forward = tokio::spawn(async move { + while let Ok(f) = frames_rx.recv().await { + input.push(f.frame); + } + }); + let spans = tokio::task::spawn_blocking(move || { + let mut spans = Vec::new(); + while spans.len() < 15 { + let picture = pictures.recv_timeout(Duration::from_secs(10)).expect("no picture"); + assert_eq!((picture.width, picture.height), (320, 240)); + spans.push(rectangle_span(&picture)); + } + spans + }) + .await + .unwrap(); + for (a, b) in &spans { + assert!((60..=68).contains(&(b - a + 1)), "{spans:?}"); + } + assert_ne!(spans.first(), spans.last(), "the rectangle moves"); + let stats = pipeline.stats(); + assert_eq!(stats.codec, Some(Codec::Vp8)); + assert!(stats.error.is_none(), "{stats:?}"); + let sent = streamer.stats(); + assert!(sent.video_frames >= 15 && sent.audio_frames > 0, "{sent:?}"); + + handles[0].send(StreamInput::Stop); + wait(&mut rx, |e| match e { + Event::WatchState { session: 2, state: WatchState::Ended(_), .. } => Some(()), + _ => None, + }) + .await; + forward.abort(); + drop(streamer); + } } diff --git a/crates/tsc-core/src/voice.rs b/crates/voelin-core/src/voice.rs similarity index 99% rename from crates/tsc-core/src/voice.rs rename to crates/voelin-core/src/voice.rs index c1c1723..c671236 100644 --- a/crates/tsc-core/src/voice.rs +++ b/crates/voelin-core/src/voice.rs @@ -7,10 +7,6 @@ use futures::prelude::*; use tokio::sync::mpsc; use tokio::time::{Instant, timeout}; use tracing::{info, warn}; -use tsc_model::{ - ChannelId, ChannelInfo, ChatMessage, ChatTarget, ClientInfo, Presence, ServerFlavor, -}; -use tsc_stream::{PeerConfig, Request, StreamNotification}; use tsclientlib::data; use tsclientlib::events::Event as BookEvent; use tsclientlib::prelude::*; @@ -19,6 +15,10 @@ use tsclientlib::{ StreamItem, Version, }; use tsproto_packets::packets::{AudioData, InAudioBuf, OutPacket}; +use voelin_model::{ + ChannelId, ChannelInfo, ChatMessage, ChatTarget, ClientInfo, Presence, ServerFlavor, +}; +use voelin_stream::{PeerConfig, Request, StreamNotification}; #[derive(Clone, Debug)] pub struct VoiceOptions { diff --git a/crates/tsc-core/tests/live.rs b/crates/voelin-core/tests/live.rs similarity index 80% rename from crates/tsc-core/tests/live.rs rename to crates/voelin-core/tests/live.rs index 73f715a..c4c5276 100644 --- a/crates/tsc-core/tests/live.rs +++ b/crates/voelin-core/tests/live.rs @@ -1,15 +1,15 @@ //! Engine against the development servers (dev/docker-compose.yml). -//! Runs only with `TSC_LIVE=1`; `scripts/it-smoke.sh` sets it. +//! Runs only with `VOELIN_LIVE=1`; `scripts/it-smoke.sh` sets it. use std::time::Duration; use tokio::sync::broadcast::Receiver; use tokio::time::{Instant, timeout_at}; -use tsc_core::{Command, Engine, Event, ObserveState, Source, VoiceOptions, VoiceState}; -use tsc_model::ChatTarget; +use voelin_core::{Command, Engine, Event, ObserveState, Source, VoiceOptions, VoiceState}; +use voelin_model::ChatTarget; fn live() -> bool { - std::env::var("TSC_LIVE").is_ok_and(|v| v == "1") + std::env::var("VOELIN_LIVE").is_ok_and(|v| v == "1") } /// Wait for an event matching `f`, failing after 20 s. @@ -29,7 +29,7 @@ async fn wait_for( } } -async fn engine_roundtrip(voice_addr: &str, query: tsc_query::Connect) { +async fn engine_roundtrip(voice_addr: &str, query: voelin_query::Connect) { let engine = Engine::start(); let mut events = engine.subscribe(); let nick = format!("engine-{}", std::process::id() % 10_000); @@ -93,15 +93,15 @@ async fn engine_roundtrip(voice_addr: &str, query: tsc_query::Connect) { tokio::time::sleep(Duration::from_millis(500)).await; } -fn query(transport: tsc_query::Transport, addr: &str) -> tsc_query::Connect { - tsc_query::Connect { +fn query(transport: voelin_query::Transport, addr: &str) -> voelin_query::Connect { + voelin_query::Connect { transport, addr: addr.into(), user: "serveradmin".into(), - secret: Some("tsc-dev-admin".into()), + secret: Some("voelin-dev-admin".into()), server_port: Some(9987), server_id: None, - line: tsc_query::LineOptions { rate_limit: None, ..Default::default() }, + line: voelin_query::LineOptions { rate_limit: None, ..Default::default() }, } } @@ -110,7 +110,8 @@ async fn ts6_engine() { if !live() { return; } - engine_roundtrip("127.0.0.1:9988", query(tsc_query::Transport::Ssh, "127.0.0.1:10022")).await; + engine_roundtrip("127.0.0.1:9988", query(voelin_query::Transport::Ssh, "127.0.0.1:10022")) + .await; } #[tokio::test(flavor = "multi_thread")] @@ -118,5 +119,6 @@ async fn ts3_engine() { if !live() { return; } - engine_roundtrip("127.0.0.1:9987", query(tsc_query::Transport::Raw, "127.0.0.1:10011")).await; + engine_roundtrip("127.0.0.1:9987", query(voelin_query::Transport::Raw, "127.0.0.1:10011")) + .await; } diff --git a/crates/voelin-core/tests/media_live.rs b/crates/voelin-core/tests/media_live.rs new file mode 100644 index 0000000..a4519db --- /dev/null +++ b/crates/voelin-core/tests/media_live.rs @@ -0,0 +1,175 @@ +//! The media pipeline through the engine and the TeamSpeak 6 development +//! server (dev/docker-compose.yml): one session streams the test pattern +//! (VP8 + Opus), another decodes it. Runs only with `VOELIN_LIVE=1`. + +#![cfg(feature = "media-desktop")] + +use std::sync::Arc; +use std::sync::mpsc as std_mpsc; +use std::time::Duration; + +use tokio::sync::broadcast::Receiver; +use tokio::time::timeout; +use voelin_core::media::voelin_media::capture::SourceId; +use voelin_core::media::voelin_media::capture::synthetic::RECT_COLOR; +use voelin_core::media::voelin_media::{Codec, Codecs, convert}; +use voelin_core::media::{Streamer, StreamerConfig, Viewer, peer_config, stream_codec}; +use voelin_core::stream::{PeerConfig, StreamSetup}; +use voelin_core::{Command, Engine, Event, StreamState, VoiceOptions, VoiceState, WatchState}; + +fn live() -> bool { + std::env::var("VOELIN_LIVE").is_ok_and(|v| v == "1") +} + +/// Wait for an event matching `f`, failing after 20 s. +async fn wait_for( + rx: &mut Receiver, + what: &str, + mut f: impl FnMut(&Event) -> Option, +) -> T { + timeout(Duration::from_secs(20), async { + loop { + match rx.recv().await { + Ok(e) => { + if let Some(t) = f(&e) { + return t; + } + if let Event::Error { session, message } = e { + eprintln!("engine error (session {session}): {message}"); + } + } + Err(tokio::sync::broadcast::error::RecvError::Lagged(_)) => {} + Err(e) => panic!("event bus closed: {e}"), + } + } + }) + .await + .unwrap_or_else(|_| panic!("timed out waiting for {what}")) +} + +async fn connect( + engine: &Engine, + events: &mut Receiver, + session: u64, + nick: &str, + peer: PeerConfig, +) { + let mut options = VoiceOptions::new("127.0.0.1:9988", nick); + options.stream_peer = peer; + engine.send(Command::ConnectVoice { session, options: Box::new(options) }); + wait_for(events, "voice connected", |e| match e { + Event::State { session: s, state } + if *s == session + && state.voice == VoiceState::Connected + && state.own_channel.is_some() => + { + Some(()) + } + _ => None, + }) + .await; +} + +#[tokio::test(flavor = "multi_thread")] +async fn ts6_test_pattern_decoded() { + if !live() { + eprintln!("skipped: set VOELIN_LIVE=1 with the dev servers running"); + return; + } + let engine = Engine::start(); + let mut events = engine.subscribe(); + let codecs = Arc::new(Codecs::new()); + let peer = peer_config(&codecs, PeerConfig::loopback()); + let codec = stream_codec(&codecs, &peer).expect("an encoder"); + assert_eq!(codec, Codec::Vp8); + let tag = std::process::id() % 10_000; + connect(&engine, &mut events, 1, &format!("m-streamer-{tag}"), peer.clone()).await; + connect(&engine, &mut events, 2, &format!("m-viewer-{tag}"), peer).await; + + // Capture first (as the app does: the portal may ask), then go live. + let config = StreamerConfig { + source: SourceId::Synthetic, + synthetic_size: (640, 360), + bitrate_kbps: 2000, + codec, + ..StreamerConfig::default() + }; + let streamer = Streamer::start(&codecs, config).await.unwrap(); + let setup = StreamSetup { name: format!("media {tag}"), ..Default::default() }; + engine.send(Command::StartStream { session: 1, setup, auto_accept: true }); + // The viewer's list may update before the streamer goes live. + let mut live = None; + let mut listed = Vec::new(); + let (id, sink) = wait_for(&mut events, "stream live and in the viewer's list", |e| { + match e { + Event::StreamState { session: 1, state: StreamState::Live { id, sink } } => { + live = Some((id.clone(), sink.clone())); + } + Event::StreamState { session: 1, state: StreamState::Ended(reason) } => { + panic!("stream ended: {reason:?}") + } + Event::StreamsChanged { session: 2, streams } => { + listed = streams.iter().map(|s| s.id.clone()).collect(); + } + _ => {} + } + live.clone().filter(|(id, _)| listed.contains(id)) + }) + .await; + streamer.attach(Arc::new(sink)); + + let (tx, pictures) = std_mpsc::channel(); + let viewer = Viewer::start(&engine, 2, &id, codecs, move |picture| { + let _ = tx.send(picture); + }); + engine.send(Command::WatchStream { session: 2, stream_id: id.clone() }); + wait_for(&mut events, "watching", |e| match e { + Event::WatchState { session: 2, stream_id, state: WatchState::Connected } + if *stream_id == id => + { + Some(()) + } + Event::WatchState { session: 2, state: WatchState::Ended(reason), .. } => { + panic!("watching ended: {reason:?}") + } + _ => None, + }) + .await; + + // 60 decoded pictures (two seconds), each with the rectangle in the + // middle row, about a fifth of the width. + let widths = tokio::task::spawn_blocking(move || { + let mut widths = Vec::new(); + while widths.len() < 60 { + let picture = pictures.recv_timeout(Duration::from_secs(10)).expect("no picture"); + assert_eq!((picture.width, picture.height), (640, 360)); + let rgba = convert::to_rgba_vec(&picture).unwrap(); + let row = &rgba[(picture.height / 2 * picture.width * 4) as usize..] + [..(picture.width * 4) as usize]; + let rect = row + .chunks_exact(4) + .filter(|p| p.iter().zip(RECT_COLOR).all(|(a, b)| a.abs_diff(b) <= 24)) + .count(); + widths.push(rect); + } + widths + }) + .await + .unwrap(); + assert!(widths.iter().all(|w| (120..=136).contains(w)), "{widths:?}"); + let stats = viewer.stats(); + assert!(stats.error.is_none(), "{stats:?}"); + eprintln!("decoded {stats:?}, sent {:?}", streamer.stats()); + + engine.send(Command::StopStream { session: 1 }); + wait_for(&mut events, "stream ended", |e| match e { + Event::StreamState { session: 1, state: StreamState::Ended(_) } => Some(()), + _ => None, + }) + .await; + drop(viewer); + drop(streamer); + engine.send(Command::CloseSession { session: 1 }); + engine.send(Command::CloseSession { session: 2 }); + tokio::time::sleep(Duration::from_millis(500)).await; +} diff --git a/crates/tsc-core/tests/stream_live.rs b/crates/voelin-core/tests/stream_live.rs similarity index 94% rename from crates/tsc-core/tests/stream_live.rs rename to crates/voelin-core/tests/stream_live.rs index 25e1824..486e876 100644 --- a/crates/tsc-core/tests/stream_live.rs +++ b/crates/voelin-core/tests/stream_live.rs @@ -1,19 +1,19 @@ //! Streams through the engine against the development servers //! (dev/docker-compose.yml): one session streams synthetic frames, another -//! watches. Runs only with `TSC_LIVE=1`. +//! watches. Runs only with `VOELIN_LIVE=1`. use std::time::{Duration, Instant}; use tokio::sync::broadcast::Receiver; use tokio::time::timeout; -use tsc_core::stream::{ +use voelin_core::stream::{ EndReason, FrameSource, LeaveReason, MediaKind, PeerConfig, StreamSetup, SyntheticSource, ViewerState, }; -use tsc_core::{Command, Engine, Event, StreamState, VoiceOptions, VoiceState, WatchState}; +use voelin_core::{Command, Engine, Event, StreamState, VoiceOptions, VoiceState, WatchState}; fn live() -> bool { - std::env::var("TSC_LIVE").is_ok_and(|v| v == "1") + std::env::var("VOELIN_LIVE").is_ok_and(|v| v == "1") } /// Wait for an event matching `f`, failing after 20 s. @@ -90,7 +90,7 @@ async fn connect( #[tokio::test(flavor = "multi_thread")] async fn ts6_stream_between_sessions() { if !live() { - eprintln!("skipped: set TSC_LIVE=1 with the dev servers running"); + eprintln!("skipped: set VOELIN_LIVE=1 with the dev servers running"); return; } let engine = Engine::start(); @@ -220,9 +220,9 @@ async fn ts6_stream_between_sessions() { }, ) .await; - assert!(!sink.send(tsc_core::stream::EncodedFrame { + assert!(!sink.send(voelin_core::stream::EncodedFrame { kind: MediaKind::Audio, - time: tsc_core::stream::MediaTime::from_90khz(0), + time: voelin_core::stream::MediaTime::from_90khz(0), data: vec![0].into(), })); feeder.await.unwrap(); diff --git a/crates/tsc-gateway-proto/Cargo.toml b/crates/voelin-gateway-proto/Cargo.toml similarity index 88% rename from crates/tsc-gateway-proto/Cargo.toml rename to crates/voelin-gateway-proto/Cargo.toml index 0bad230..32e96e7 100644 --- a/crates/tsc-gateway-proto/Cargo.toml +++ b/crates/voelin-gateway-proto/Cargo.toml @@ -1,5 +1,5 @@ [package] -name = "tsc-gateway-proto" +name = "voelin-gateway-proto" version = "0.1.0" description = "Wire protocol and identity-challenge authentication of the tsgw gateway." edition.workspace = true @@ -15,7 +15,7 @@ serde_json = "1" sha1 = { package = "sha-1", version = "0.10" } sha2 = "0.10" thiserror = "2" -tsc-model = { path = "../tsc-model" } +voelin-model = { path = "../voelin-model" } tsproto-types = { path = "../proto/tsproto-types" } [lints] diff --git a/crates/tsc-gateway-proto/src/auth.rs b/crates/voelin-gateway-proto/src/auth.rs similarity index 100% rename from crates/tsc-gateway-proto/src/auth.rs rename to crates/voelin-gateway-proto/src/auth.rs diff --git a/crates/tsc-gateway-proto/src/lib.rs b/crates/voelin-gateway-proto/src/lib.rs similarity index 100% rename from crates/tsc-gateway-proto/src/lib.rs rename to crates/voelin-gateway-proto/src/lib.rs diff --git a/crates/tsc-gateway-proto/src/messages.rs b/crates/voelin-gateway-proto/src/messages.rs similarity index 98% rename from crates/tsc-gateway-proto/src/messages.rs rename to crates/voelin-gateway-proto/src/messages.rs index 017e3bd..9b8c8f0 100644 --- a/crates/tsc-gateway-proto/src/messages.rs +++ b/crates/voelin-gateway-proto/src/messages.rs @@ -1,7 +1,7 @@ //! Messages in both directions. use serde::{Deserialize, Serialize}; -use tsc_model::{ChatMessage, ChatTarget, PresenceDelta, PresenceSnapshot}; +use voelin_model::{ChatMessage, ChatTarget, PresenceDelta, PresenceSnapshot}; /// Every frame: `{"v":1,"id":7,"type":"send_chat","data":{...}}`. /// diff --git a/crates/tsc-gateway/Cargo.toml b/crates/voelin-gateway/Cargo.toml similarity index 80% rename from crates/tsc-gateway/Cargo.toml rename to crates/voelin-gateway/Cargo.toml index 38f1160..0fe726c 100644 --- a/crates/tsc-gateway/Cargo.toml +++ b/crates/voelin-gateway/Cargo.toml @@ -1,5 +1,5 @@ [package] -name = "tsc-gateway" +name = "voelin-gateway" version = "0.1.0" description = "tsgw: companion gateway giving app users invisible presence and channel chat over ServerQuery." edition.workspace = true @@ -28,10 +28,10 @@ tokio = { version = "1.53.1", features = ["full"] } toml = "1.1.6" tracing = "0.1.44" tracing-subscriber = { version = "0.3.23", features = ["env-filter"] } -tsc-gateway-proto = { path = "../tsc-gateway-proto" } -tsc-model = { path = "../tsc-model" } -tsc-observer = { path = "../tsc-observer" } -tsc-query = { path = "../tsc-query" } +voelin-gateway-proto = { path = "../voelin-gateway-proto" } +voelin-model = { path = "../voelin-model" } +voelin-observer = { path = "../voelin-observer" } +voelin-query = { path = "../voelin-query" } [lints] workspace = true diff --git a/crates/tsc-gateway/Dockerfile b/crates/voelin-gateway/Dockerfile similarity index 74% rename from crates/tsc-gateway/Dockerfile rename to crates/voelin-gateway/Dockerfile index ce58ca0..1a997f4 100644 --- a/crates/tsc-gateway/Dockerfile +++ b/crates/voelin-gateway/Dockerfile @@ -1,10 +1,10 @@ -# Build: docker build -f crates/tsc-gateway/Dockerfile -t tsgw . +# Build: docker build -f crates/voelin-gateway/Dockerfile -t tsgw . # Run: docker run -v ./tsgw.toml:/etc/tsgw/tsgw.toml -p 7788:7788 tsgw FROM rust:1.94-bookworm AS build WORKDIR /src RUN apt-get update && apt-get install -y --no-install-recommends cmake libasound2-dev && rm -rf /var/lib/apt/lists/* COPY . . -RUN cargo build --release --locked -p tsc-gateway && cp target/release/tsgw /tsgw +RUN cargo build --release --locked -p voelin-gateway && cp target/release/tsgw /tsgw FROM gcr.io/distroless/cc-debian12:nonroot COPY --from=build /tsgw /usr/local/bin/tsgw diff --git a/crates/tsc-gateway/src/config.rs b/crates/voelin-gateway/src/config.rs similarity index 96% rename from crates/tsc-gateway/src/config.rs rename to crates/voelin-gateway/src/config.rs index 693e38b..739f98b 100644 --- a/crates/tsc-gateway/src/config.rs +++ b/crates/voelin-gateway/src/config.rs @@ -5,7 +5,7 @@ use std::path::{Path, PathBuf}; use anyhow::{Context, Result, bail}; use serde::Deserialize; -use tsc_query::Transport; +use voelin_query::Transport; #[derive(Clone, Debug, Deserialize)] #[serde(deny_unknown_fields)] @@ -199,19 +199,19 @@ impl Config { .unwrap_or_else(|| format!("tsgw@{}", self.query.addr)) } - pub fn query_connect(&self) -> tsc_query::Connect { - tsc_query::Connect { + pub fn query_connect(&self) -> voelin_query::Connect { + voelin_query::Connect { transport: self.query.transport, addr: self.query.addr.clone(), user: self.query.user.clone(), secret: self.query.password.clone(), server_port: Some(self.server.voice_port), server_id: None, - line: tsc_query::LineOptions { + line: voelin_query::LineOptions { rate_limit: if self.query.allowlisted { None } else { - tsc_query::LineOptions::default().rate_limit + voelin_query::LineOptions::default().rate_limit }, ..Default::default() }, diff --git a/crates/tsc-gateway/src/db.rs b/crates/voelin-gateway/src/db.rs similarity index 99% rename from crates/tsc-gateway/src/db.rs rename to crates/voelin-gateway/src/db.rs index b6530fc..4712273 100644 --- a/crates/tsc-gateway/src/db.rs +++ b/crates/voelin-gateway/src/db.rs @@ -4,7 +4,7 @@ use std::path::Path; use std::sync::Mutex; use rusqlite::{Connection, OptionalExtension, params}; -use tsc_model::{ChatMessage, ChatTarget}; +use voelin_model::{ChatMessage, ChatTarget}; pub struct Db(Mutex); diff --git a/crates/tsc-gateway/src/hub.rs b/crates/voelin-gateway/src/hub.rs similarity index 96% rename from crates/tsc-gateway/src/hub.rs rename to crates/voelin-gateway/src/hub.rs index 82cf9f5..5e14f7b 100644 --- a/crates/tsc-gateway/src/hub.rs +++ b/crates/voelin-gateway/src/hub.rs @@ -11,10 +11,12 @@ use rand::RngExt; use sha2::{Digest, Sha256}; use tokio::sync::broadcast; use tracing::{info, warn}; -use tsc_gateway_proto::{ErrorCode, UniqueIds, identity_level, verify_auth}; -use tsc_model::{ChannelId, ChatMessage, ChatTarget, Presence, ServerFlavor, relay_text}; -use tsc_observer::{Observer, ObserverConfig, ObserverEvent, RelayConfig, RelayEvent, RelayPool}; -use tsc_query::{Command, QueryClient}; +use voelin_gateway_proto::{ErrorCode, UniqueIds, identity_level, verify_auth}; +use voelin_model::{ChannelId, ChatMessage, ChatTarget, Presence, ServerFlavor, relay_text}; +use voelin_observer::{ + Observer, ObserverConfig, ObserverEvent, RelayConfig, RelayEvent, RelayPool, +}; +use voelin_query::{Command, QueryClient}; use crate::config::Config; use crate::db::{Db, TokenInfo}; @@ -53,8 +55,8 @@ impl Denied { } } -impl From for Denied { - fn from(e: tsc_query::Error) -> Self { +impl From for Denied { + fn from(e: voelin_query::Error) -> Self { Denied::new(ErrorCode::Unavailable, e.to_string()) } } @@ -414,7 +416,7 @@ impl Hub { return Err(Denied::new(ErrorCode::Forbidden, "no permission for server chat")); } let msg = relay_text(&self.config.relay.format, &user.nickname, text); - for part in tsc_model::split_message(&msg, 1024) { + for part in voelin_model::split_message(&msg, 1024) { self.lookup .send( &Command::new("sendtextmessage").arg("targetmode", 3).arg("msg", part), diff --git a/crates/tsc-gateway/src/main.rs b/crates/voelin-gateway/src/main.rs similarity index 92% rename from crates/tsc-gateway/src/main.rs rename to crates/voelin-gateway/src/main.rs index 053fc84..0cff9dd 100644 --- a/crates/tsc-gateway/src/main.rs +++ b/crates/voelin-gateway/src/main.rs @@ -2,7 +2,7 @@ //! //! Gives app users invisible presence (who is in which channel) and channel //! chat without joining voice, through ServerQuery. See -//! docs/gateway-admin.md and the protocol in `tsc-gateway-proto`. +//! docs/gateway-admin.md and the protocol in `voelin-gateway-proto`. mod config; mod db; @@ -55,7 +55,7 @@ async fn main() -> Result<()> { async fn ws(State(hub): State>, upgrade: WebSocketUpgrade) -> impl IntoResponse { upgrade - .protocols([tsc_gateway_proto::SUBPROTOCOL]) + .protocols([voelin_gateway_proto::SUBPROTOCOL]) .on_upgrade(move |socket| session::run(hub, socket)) } diff --git a/crates/tsc-gateway/src/perms.rs b/crates/voelin-gateway/src/perms.rs similarity index 95% rename from crates/tsc-gateway/src/perms.rs rename to crates/voelin-gateway/src/perms.rs index b529325..c7de711 100644 --- a/crates/tsc-gateway/src/perms.rs +++ b/crates/voelin-gateway/src/perms.rs @@ -9,7 +9,7 @@ use std::collections::HashMap; use std::sync::Mutex; use std::time::{Duration, Instant}; -use tsc_query::{Command, QueryClient, Row}; +use voelin_query::{Command, QueryClient, Row}; const CACHE_TTL: Duration = Duration::from_secs(60); @@ -81,7 +81,7 @@ pub struct PermIds { } impl PermIds { - pub async fn load(client: &QueryClient) -> tsc_query::Result { + pub async fn load(client: &QueryClient) -> voelin_query::Result { let names = [ "i_channel_join_power", "i_channel_needed_join_power", @@ -93,10 +93,9 @@ impl PermIds { let mut ids = [0u32; 6]; for (i, name) in names.iter().enumerate() { let rows = client.send(&Command::new("permidgetbyname").arg("permsid", name)).await?; - ids[i] = rows - .first() - .and_then(|r| r.parse("permid")) - .ok_or_else(|| tsc_query::Error::Protocol(format!("unknown permission {name}")))?; + ids[i] = rows.first().and_then(|r| r.parse("permid")).ok_or_else(|| { + voelin_query::Error::Protocol(format!("unknown permission {name}")) + })?; } Ok(Self { join_power: ids[0], @@ -148,7 +147,7 @@ impl PermResolver { client: &QueryClient, cldbid: u64, cid: u64, - ) -> tsc_query::Result> { + ) -> voelin_query::Result> { if let Some((at, entries)) = self.cache.lock().unwrap().get(&(cldbid, cid)) && at.elapsed() < CACHE_TTL { diff --git a/crates/tsc-gateway/src/session.rs b/crates/voelin-gateway/src/session.rs similarity index 96% rename from crates/tsc-gateway/src/session.rs rename to crates/voelin-gateway/src/session.rs index c21a1b3..861b832 100644 --- a/crates/tsc-gateway/src/session.rs +++ b/crates/voelin-gateway/src/session.rs @@ -9,9 +9,9 @@ use base64::prelude::*; use rand::RngExt; use tokio::sync::broadcast::error::RecvError; use tracing::{debug, info}; -use tsc_gateway_proto::{ClientMsg, Envelope, ErrorCode, HistoryEntry, ServerMsg}; -use tsc_model::{ChatTarget, Presence}; -use tsc_observer::ObserverEvent; +use voelin_gateway_proto::{ClientMsg, Envelope, ErrorCode, HistoryEntry, ServerMsg}; +use voelin_model::{ChatTarget, Presence}; +use voelin_observer::ObserverEvent; use crate::hub::{Denied, Hub, User}; @@ -97,7 +97,7 @@ pub async fn run(hub: Arc, mut socket: WebSocket) { } async fn send(socket: &mut WebSocket, id: Option, msg: ServerMsg) -> Result<(), axum::Error> { - let env = Envelope { v: tsc_gateway_proto::VERSION, id, msg }; + let env = Envelope { v: voelin_gateway_proto::VERSION, id, msg }; let text = serde_json::to_string(&env).expect("messages serialize"); socket.send(Message::Text(text.into())).await } diff --git a/crates/tsc-gateway/tsgw.example.toml b/crates/voelin-gateway/tsgw.example.toml similarity index 100% rename from crates/tsc-gateway/tsgw.example.toml rename to crates/voelin-gateway/tsgw.example.toml diff --git a/crates/tsc-media/Cargo.toml b/crates/voelin-media/Cargo.toml similarity index 93% rename from crates/tsc-media/Cargo.toml rename to crates/voelin-media/Cargo.toml index 2e9cb5e..103ffbb 100644 --- a/crates/tsc-media/Cargo.toml +++ b/crates/voelin-media/Cargo.toml @@ -1,5 +1,5 @@ [package] -name = "tsc-media" +name = "voelin-media" version = "0.1.0" description = "Video frames, pixel conversion, video codecs (VP8/VP9, H.264, AV1) and screen / system-audio capture for streams." edition.workspace = true @@ -47,6 +47,9 @@ pipewire = { version = "0.10.1", optional = true } rustix = { version = "1.1.5", features = ["fs"], optional = true } x11rb = { version = "0.13.2", features = ["randr", "shm", "xfixes"], optional = true } +[target.'cfg(target_os = "android")'.dependencies] +ndk = { version = "0.9.0", default-features = false, features = ["media", "api-level-29"] } + [target.'cfg(windows)'.dependencies] wasapi = "0.24.0" windows-capture = "2.0.1" diff --git a/crates/voelin-media/src/capture/external.rs b/crates/voelin-media/src/capture/external.rs new file mode 100644 index 0000000..be60731 --- /dev/null +++ b/crates/voelin-media/src/capture/external.rs @@ -0,0 +1,274 @@ +//! Capture driven by platform code outside this crate. +//! +//! On Android, screen and system-audio capture need a MediaProjection, which +//! only the app's Java/Kotlin side can obtain (it asks the user and runs a +//! foreground service). The app registers a [`ScreenProvider`] and an +//! [`AudioProvider`] at start; [`super::default_screen_capture`] and +//! [`super::default_audio_capture`] then hand out capture backends that +//! forward to them, so stream code needs no platform knowledge. +//! +//! A provider receives the [`FrameSender`] of the capture and pushes frames +//! into it from any thread; dropping the sender ends the capture for the +//! consumer (e.g. when the user stops sharing from the system UI). + +use std::sync::{Arc, Mutex, PoisonError}; + +use crate::Result; +use crate::capture::{ + AudioCapture, BoxFuture, CaptureOptions, CaptureSource, ScreenCapture, SourceId, +}; +use crate::frame::{AudioBuffer, VideoFrame}; +use crate::queue::{FrameReceiver, FrameSender, frame_channel}; + +/// Platform code that captures the screen. +pub trait ScreenProvider: Send + Sync { + /// Short name for logs (`"mediaprojection"`). + fn name(&self) -> &'static str; + + /// What can be captured (Android: the whole screen, as one + /// [`SourceId::Portal`] entry since the system dialog picks). + fn sources(&self) -> Vec; + + /// Start delivering frames into `frames`. Resolves once frames flow, or + /// with an error such as [`crate::Error::Cancelled`] when the user + /// declined. + fn start( + &self, + source: &SourceId, + options: &CaptureOptions, + frames: FrameSender, + ) -> BoxFuture<'static, Result<()>>; + + fn stop(&self); +} + +/// Platform code that captures what the device plays (48 kHz `f32`). +pub trait AudioProvider: Send + Sync { + fn name(&self) -> &'static str; + + /// Start delivering audio into `buffers`. + fn start(&self, buffers: FrameSender) -> Result<()>; + + fn stop(&self); +} + +type Slot = Mutex>>; + +static SCREEN: Slot = Mutex::new(None); +static AUDIO: Slot = Mutex::new(None); + +fn get(slot: &Slot) -> Option> { + slot.lock().unwrap_or_else(PoisonError::into_inner).clone() +} + +/// Make [`super::default_screen_capture`] use `provider` (`None` restores +/// the built-in backends). +pub fn set_screen_provider(provider: Option>) { + *SCREEN.lock().unwrap_or_else(PoisonError::into_inner) = provider; +} + +/// Make [`super::default_audio_capture`] use `provider`. +pub fn set_audio_provider(provider: Option>) { + *AUDIO.lock().unwrap_or_else(PoisonError::into_inner) = provider; +} + +pub fn screen_provider() -> Option> { + get(&SCREEN) +} + +pub fn audio_provider() -> Option> { + get(&AUDIO) +} + +/// A [`ScreenCapture`] backed by a [`ScreenProvider`]. +pub struct ExternalScreenCapture { + provider: Arc, + running: bool, +} + +impl ExternalScreenCapture { + pub fn new(provider: Arc) -> Self { + Self { provider, running: false } + } +} + +impl ScreenCapture for ExternalScreenCapture { + fn backend(&self) -> &'static str { + self.provider.name() + } + + fn sources(&mut self) -> Result> { + Ok(self.provider.sources()) + } + + fn start( + &mut self, + source: &SourceId, + options: &CaptureOptions, + ) -> BoxFuture<'_, Result>> { + self.stop(); + let (tx, rx) = frame_channel(options.queue); + let started = self.provider.start(source, options, tx); + self.running = true; + Box::pin(async move { + started.await?; + Ok(rx) + }) + } + + fn stop(&mut self) { + if std::mem::take(&mut self.running) { + self.provider.stop(); + } + } +} + +impl Drop for ExternalScreenCapture { + fn drop(&mut self) { + self.stop(); + } +} + +/// An [`AudioCapture`] backed by an [`AudioProvider`]. +pub struct ExternalAudioCapture { + provider: Arc, + running: bool, +} + +impl ExternalAudioCapture { + pub fn new(provider: Arc) -> Self { + Self { provider, running: false } + } +} + +impl AudioCapture for ExternalAudioCapture { + fn backend(&self) -> &'static str { + self.provider.name() + } + + fn start(&mut self) -> Result> { + self.stop(); + // About a second of 10 ms buffers. + let (tx, rx) = frame_channel(100); + self.provider.start(tx)?; + self.running = true; + Ok(rx) + } + + fn stop(&mut self) { + if std::mem::take(&mut self.running) { + self.provider.stop(); + } + } +} + +impl Drop for ExternalAudioCapture { + fn drop(&mut self) { + self.stop(); + } +} + +#[cfg(test)] +mod tests { + use std::sync::atomic::{AtomicUsize, Ordering}; + use std::time::Duration; + + use super::*; + use crate::Error; + + /// Sends one frame per start, or refuses. + #[derive(Default)] + struct Fake { + refuse: bool, + stops: AtomicUsize, + sender: Mutex>>, + } + + impl ScreenProvider for Fake { + fn name(&self) -> &'static str { + "fake" + } + + fn sources(&self) -> Vec { + vec![CaptureSource { + id: SourceId::Portal, + name: "Screen".into(), + width: 0, + height: 0, + primary: true, + }] + } + + fn start( + &self, + _: &SourceId, + _: &CaptureOptions, + frames: FrameSender, + ) -> BoxFuture<'static, Result<()>> { + if self.refuse { + return Box::pin(async { Err(Error::Cancelled) }); + } + frames.send(VideoFrame::black_i420(4, 4)); + *self.sender.lock().unwrap() = Some(frames); + Box::pin(async { Ok(()) }) + } + + fn stop(&self) { + self.stops.fetch_add(1, Ordering::Relaxed); + self.sender.lock().unwrap().take(); + } + } + + #[tokio::test] + async fn frames_flow_until_the_provider_drops_the_sender() { + let fake = Arc::new(Fake::default()); + let mut capture = ExternalScreenCapture::new(fake.clone()); + assert_eq!(capture.backend(), "fake"); + assert_eq!(capture.sources().unwrap().len(), 1); + let mut rx = capture.start(&SourceId::Portal, &CaptureOptions::default()).await.unwrap(); + assert_eq!(rx.recv().await.unwrap().width, 4); + // The system stopped the projection. + fake.sender.lock().unwrap().take(); + assert!(rx.recv_timeout(Duration::from_millis(10)).is_none()); + assert!(rx.is_closed()); + drop(capture); + assert_eq!(fake.stops.load(Ordering::Relaxed), 1); + } + + #[tokio::test] + async fn refusal_is_an_error_and_stop_is_not_repeated() { + let fake = Arc::new(Fake { refuse: true, ..Fake::default() }); + let mut capture = ExternalScreenCapture::new(fake.clone()); + let result = capture.start(&SourceId::Portal, &CaptureOptions::default()).await; + assert!(matches!(result, Err(Error::Cancelled))); + capture.stop(); + capture.stop(); + assert_eq!(fake.stops.load(Ordering::Relaxed), 1); + } + + #[test] + fn registered_provider_is_the_default() { + struct Silent; + impl AudioProvider for Silent { + fn name(&self) -> &'static str { + "silent" + } + fn start(&self, buffers: FrameSender) -> Result<()> { + buffers.send(AudioBuffer { + samples: vec![0.0; 960], + channels: 2, + timestamp: Duration::ZERO, + }); + Ok(()) + } + fn stop(&self) {} + } + set_audio_provider(Some(Arc::new(Silent))); + let mut capture = crate::capture::default_audio_capture().unwrap(); + assert_eq!(capture.backend(), "silent"); + let mut rx = capture.start().unwrap(); + assert_eq!(rx.try_recv().unwrap().frames(), 480); + set_audio_provider(None); + assert!(audio_provider().is_none()); + } +} diff --git a/crates/tsc-media/src/capture/mod.rs b/crates/voelin-media/src/capture/mod.rs similarity index 91% rename from crates/tsc-media/src/capture/mod.rs rename to crates/voelin-media/src/capture/mod.rs index 4264192..2717fb9 100644 --- a/crates/tsc-media/src/capture/mod.rs +++ b/crates/voelin-media/src/capture/mod.rs @@ -9,6 +9,7 @@ //! | `x11` (Linux, feature `x11`) | MIT-SHM / GetImage, XFixes cursor | | //! | `portal` / `pipewire_audio` (Linux, feature `pipewire`) | ScreenCast portal + PipeWire | default sink monitor | //! | `windows` | Windows Graphics Capture | WASAPI process loopback | +//! | [`external`] | platform code (Android MediaProjection) | same | use std::future::Future; use std::pin::Pin; @@ -21,6 +22,7 @@ use crate::frame::{AudioBuffer, VideoFrame}; use crate::queue::FrameReceiver; use crate::{Error, Result}; +pub mod external; #[cfg(all(target_os = "linux", feature = "pipewire"))] pub mod pipewire_audio; #[cfg(all(target_os = "linux", feature = "pipewire"))] @@ -106,9 +108,13 @@ pub trait AudioCapture: Send { fn stop(&mut self); } -/// The screen capture backend for this session: the ScreenCast portal on +/// The screen capture backend for this session: a registered +/// [`external::ScreenProvider`] (Android), else the ScreenCast portal on /// Wayland, X11 otherwise on Linux, Windows Graphics Capture on Windows. pub fn default_screen_capture() -> Result> { + if let Some(provider) = external::screen_provider() { + return Ok(Box::new(external::ExternalScreenCapture::new(provider))); + } #[cfg(target_os = "linux")] { let wayland = std::env::var_os("WAYLAND_DISPLAY").is_some() @@ -132,8 +138,12 @@ pub fn default_screen_capture() -> Result> { }) } -/// The system-audio backend: PipeWire on Linux, WASAPI loopback on Windows. +/// The system-audio backend: a registered [`external::AudioProvider`] +/// (Android), else PipeWire on Linux, WASAPI loopback on Windows. pub fn default_audio_capture() -> Result> { + if let Some(provider) = external::audio_provider() { + return Ok(Box::new(external::ExternalAudioCapture::new(provider))); + } #[cfg(all(target_os = "linux", feature = "pipewire"))] return Ok(Box::new(pipewire_audio::PipeWireAudioCapture::new())); #[cfg(windows)] diff --git a/crates/tsc-media/src/capture/pipewire_audio.rs b/crates/voelin-media/src/capture/pipewire_audio.rs similarity index 97% rename from crates/tsc-media/src/capture/pipewire_audio.rs rename to crates/voelin-media/src/capture/pipewire_audio.rs index a81f102..994f476 100644 --- a/crates/tsc-media/src/capture/pipewire_audio.rs +++ b/crates/voelin-media/src/capture/pipewire_audio.rs @@ -26,7 +26,7 @@ use crate::{Error, Result}; const BACKEND: &str = "pipewire"; /// Name of our capture node in PipeWire. -pub const NODE_NAME: &str = "tsc-system-audio"; +pub const NODE_NAME: &str = "voelin-system-audio"; /// Captures the default sink's monitor through PipeWire. #[derive(Default)] @@ -49,7 +49,7 @@ impl AudioCapture for PipeWireAudioCapture { self.stop(); // Half a second at PipeWire's usual 10-20 ms quantum. let (tx, rx) = frame_channel(50); - let thread = PwThread::spawn("tsc-pipewire-audio", None, move |core, mainloop| { + let thread = PwThread::spawn("voelin-pipewire-audio", None, move |core, mainloop| { audio_stream(core, mainloop, tx) }) .map_err(|reason| Error::CaptureUnavailable { backend: BACKEND, reason })?; diff --git a/crates/tsc-media/src/capture/portal.rs b/crates/voelin-media/src/capture/portal.rs similarity index 97% rename from crates/tsc-media/src/capture/portal.rs rename to crates/voelin-media/src/capture/portal.rs index 883a7cf..c4f19ba 100644 --- a/crates/tsc-media/src/capture/portal.rs +++ b/crates/voelin-media/src/capture/portal.rs @@ -159,10 +159,11 @@ impl ScreenCapture for PortalCapture { let (fd, node) = self.open(&options).await?; let (tx, rx) = frame_channel(options.queue); let fps = options.fps.max(1); - let thread = PwThread::spawn("tsc-portal-capture", Some(fd), move |core, mainloop| { - video_stream(core, mainloop, node, fps, tx) - }) - .map_err(|e| Error::Capture { backend: BACKEND, message: e })?; + let thread = + PwThread::spawn("voelin-portal-capture", Some(fd), move |core, mainloop| { + video_stream(core, mainloop, node, fps, tx) + }) + .map_err(|e| Error::Capture { backend: BACKEND, message: e })?; self.thread = Some(thread); Ok(rx) }) @@ -210,7 +211,7 @@ fn video_stream( *pw::keys::MEDIA_CATEGORY => "Capture", *pw::keys::MEDIA_ROLE => "Screen", }; - let stream = pw::stream::StreamRc::new(core.clone(), "tsc-screen-capture", props) + let stream = pw::stream::StreamRc::new(core.clone(), "voelin-screen-capture", props) .map_err(|e| format!("PipeWire stream: {e}"))?; let state = VideoState { tx, diff --git a/crates/tsc-media/src/capture/pw.rs b/crates/voelin-media/src/capture/pw.rs similarity index 100% rename from crates/tsc-media/src/capture/pw.rs rename to crates/voelin-media/src/capture/pw.rs diff --git a/crates/tsc-media/src/capture/synthetic.rs b/crates/voelin-media/src/capture/synthetic.rs similarity index 98% rename from crates/tsc-media/src/capture/synthetic.rs rename to crates/voelin-media/src/capture/synthetic.rs index e96e39f..63f8618 100644 --- a/crates/tsc-media/src/capture/synthetic.rs +++ b/crates/voelin-media/src/capture/synthetic.rs @@ -124,7 +124,7 @@ impl ScreenCapture for SyntheticScreen { let (tx, rx) = frame_channel(options.queue); let pattern = SyntheticScreen::new(self.width, self.height); let fps = options.fps; - self.worker = Some(Worker::spawn("tsc-synthetic-video", move |stop| { + self.worker = Some(Worker::spawn("voelin-synthetic-video", move |stop| { let mut ticker = Ticker::new(fps); let mut n = 0; while tx.send(pattern.frame(n, fps)) && ticker.wait(&stop) { @@ -179,7 +179,7 @@ impl AudioCapture for SineSource { // Half a second of audio before the oldest is dropped. let (tx, rx) = frame_channel(50); let tone = SineSource::new(self.frequency, self.amplitude); - self.worker = Some(Worker::spawn("tsc-synthetic-audio", move |stop| { + self.worker = Some(Worker::spawn("voelin-synthetic-audio", move |stop| { let mut ticker = Ticker::new(100); let mut n = 0; while tx.send(tone.buffer(n)) && ticker.wait(&stop) { diff --git a/crates/tsc-media/src/capture/windows.rs b/crates/voelin-media/src/capture/windows.rs similarity index 99% rename from crates/tsc-media/src/capture/windows.rs rename to crates/voelin-media/src/capture/windows.rs index d1f91a2..1940b34 100644 --- a/crates/tsc-media/src/capture/windows.rs +++ b/crates/voelin-media/src/capture/windows.rs @@ -207,7 +207,7 @@ impl AudioCapture for WasapiLoopback { self.stop(); let (tx, rx) = frame_channel(50); let (init_tx, init_rx) = std::sync::mpsc::channel(); - self.worker = Some(Worker::spawn("tsc-wasapi-loopback", move |stop| { + self.worker = Some(Worker::spawn("voelin-wasapi-loopback", move |stop| { if let Err(e) = loopback(&tx, &stop, &init_tx) { // After a successful start the receiver just sees the end. let _ = init_tx.send(Err(e.clone())); diff --git a/crates/tsc-media/src/capture/x11.rs b/crates/voelin-media/src/capture/x11.rs similarity index 99% rename from crates/tsc-media/src/capture/x11.rs rename to crates/voelin-media/src/capture/x11.rs index b72bbfa..66aea30 100644 --- a/crates/tsc-media/src/capture/x11.rs +++ b/crates/voelin-media/src/capture/x11.rs @@ -111,7 +111,7 @@ impl ScreenCapture for X11Capture { x.region(&source)?; let (tx, rx) = frame_channel(options.queue); let use_shm = self.use_shm; - self.worker = Some(Worker::spawn("tsc-x11-capture", move |stop| { + self.worker = Some(Worker::spawn("voelin-x11-capture", move |stop| { let mut grabber = Grabber::new(&x, use_shm); let cursor = options.cursor && x.xfixes; let started = Instant::now(); @@ -475,7 +475,7 @@ impl Grabber { } fn attach(x: &Display11, size: usize) -> Result { - let fd = rustix::fs::memfd_create("tsc-x11-capture", rustix::fs::MemfdFlags::CLOEXEC) + let fd = rustix::fs::memfd_create("voelin-x11-capture", rustix::fs::MemfdFlags::CLOEXEC) .map_err(|e| failed(format!("memfd_create: {e}")))?; let file = std::fs::File::from(fd); file.set_len(size as u64)?; diff --git a/crates/tsc-media/src/capture/x11/shm.rs b/crates/voelin-media/src/capture/x11/shm.rs similarity index 100% rename from crates/tsc-media/src/capture/x11/shm.rs rename to crates/voelin-media/src/capture/x11/shm.rs diff --git a/crates/tsc-media/src/codec/av1.rs b/crates/voelin-media/src/codec/av1.rs similarity index 100% rename from crates/tsc-media/src/codec/av1.rs rename to crates/voelin-media/src/codec/av1.rs diff --git a/crates/tsc-media/src/codec/h264.rs b/crates/voelin-media/src/codec/h264.rs similarity index 98% rename from crates/tsc-media/src/codec/h264.rs rename to crates/voelin-media/src/codec/h264.rs index 320e29d..d9fd168 100644 --- a/crates/tsc-media/src/codec/h264.rs +++ b/crates/voelin-media/src/codec/h264.rs @@ -386,13 +386,14 @@ mod tests { assert!(matches!(err, Error::CodecUnavailable { codec: Codec::H264, .. }), "{err}"); assert!(err.to_string().contains("not found"), "{err}"); - let dir = std::env::temp_dir().join(format!("tsc-media-h264-{}", std::process::id())); + let dir = std::env::temp_dir().join(format!("voelin-media-h264-{}", std::process::id())); assert!(OpenH264::find_in(&dir).is_err()); } #[test] fn unknown_file_is_rejected() { - let dir = std::env::temp_dir().join(format!("tsc-media-h264-bad-{}", std::process::id())); + let dir = + std::env::temp_dir().join(format!("voelin-media-h264-bad-{}", std::process::id())); std::fs::create_dir_all(&dir).unwrap(); let fake = dir.join(platform_library_name().unwrap_or("libopenh264.so")); std::fs::write(&fake, b"not a library").unwrap(); diff --git a/crates/tsc-media/src/codec/hw.rs b/crates/voelin-media/src/codec/hw.rs similarity index 93% rename from crates/tsc-media/src/codec/hw.rs rename to crates/voelin-media/src/codec/hw.rs index da24495..5d26b17 100644 --- a/crates/tsc-media/src/codec/hw.rs +++ b/crates/voelin-media/src/codec/hw.rs @@ -7,6 +7,7 @@ //! through `cros-libva`. TODO. //! - Windows: Media Foundation H.264 encoder MFT (NVENC / QuickSync / AMF //! behind it). TODO. +//! - Android: MediaCodec ([`super::mediacodec`]). use crate::Result; use crate::codec::{Codec, EncoderConfig, VideoEncoder}; @@ -33,6 +34,10 @@ pub fn probe() -> Vec> { if let Some(f) = media_foundation::probe() { found.push(Box::new(f)); } + #[cfg(target_os = "android")] + if let Some(f) = super::mediacodec::probe() { + found.push(Box::new(f)); + } found } diff --git a/crates/voelin-media/src/codec/image_layout.rs b/crates/voelin-media/src/codec/image_layout.rs new file mode 100644 index 0000000..e77e3c9 --- /dev/null +++ b/crates/voelin-media/src/codec/image_layout.rs @@ -0,0 +1,324 @@ +//! Where the Y, U and V samples of a 4:2:0 image sit in a codec's linear +//! buffer, and copies between such buffers and [`VideoFrame`]s. +//! +//! Android's MediaCodec describes its byte-buffer layout either by a color +//! format (19 = planar I420, 21 = semi-planar NV12) plus `stride` and +//! `slice-height`, or exactly by a `MediaImage2` struct in the format's +//! `image-data` entry. Both become an [`ImageLayout`] here; this module has +//! no Android dependency so it is tested on every platform. + +use crate::convert; +use crate::frame::{FrameData, Plane, VideoFrame, chroma_size}; +use crate::{Error, Result}; + +/// `COLOR_FormatYUV420Planar`. +pub const COLOR_FORMAT_I420: i32 = 19; +/// `COLOR_FormatYUV420SemiPlanar`. +pub const COLOR_FORMAT_NV12: i32 = 21; +/// `COLOR_FormatYUV420Flexible`: the real layout is in `image-data`. +pub const COLOR_FORMAT_FLEXIBLE: i32 = 0x7F42_0888; + +/// One plane: first sample at `offset`, next sample in the row `col_inc` +/// bytes further, next row `row_inc` bytes further. +#[derive(Clone, Copy, Debug, PartialEq, Eq)] +pub struct PlaneLayout { + pub offset: usize, + pub col_inc: usize, + pub row_inc: usize, +} + +/// An 8-bit YUV 4:2:0 image of `width` x `height` in a linear buffer. +#[derive(Clone, Copy, Debug, PartialEq, Eq)] +pub struct ImageLayout { + pub width: u32, + pub height: u32, + pub y: PlaneLayout, + pub u: PlaneLayout, + pub v: PlaneLayout, +} + +/// Size of `MediaImage2` (`media/hardware/VideoAPI.h`): six `u32` fields +/// and four planes of five 32-bit fields. +const MEDIA_IMAGE2_SIZE: usize = 6 * 4 + 4 * 5 * 4; +const MEDIA_IMAGE_TYPE_YUV: u32 = 1; + +impl ImageLayout { + /// Planar I420: Y rows of `stride` bytes, `slice_height` rows, then U and + /// V with half the stride and half the rows. + pub fn i420(width: u32, height: u32, stride: usize, slice_height: usize) -> Self { + let stride = stride.max(width as usize); + let slice_height = slice_height.max(height as usize); + let c_stride = stride.div_ceil(2); + let u = stride * slice_height; + let v = u + c_stride * slice_height.div_ceil(2); + Self { + width, + height, + y: PlaneLayout { offset: 0, col_inc: 1, row_inc: stride }, + u: PlaneLayout { offset: u, col_inc: 1, row_inc: c_stride }, + v: PlaneLayout { offset: v, col_inc: 1, row_inc: c_stride }, + } + } + + /// Semi-planar NV12: Y, then interleaved U/V rows of `stride` bytes. + pub fn nv12(width: u32, height: u32, stride: usize, slice_height: usize) -> Self { + let stride = stride.max(width as usize); + let slice_height = slice_height.max(height as usize); + let uv = stride * slice_height; + Self { + width, + height, + y: PlaneLayout { offset: 0, col_inc: 1, row_inc: stride }, + u: PlaneLayout { offset: uv, col_inc: 2, row_inc: stride }, + v: PlaneLayout { offset: uv + 1, col_inc: 2, row_inc: stride }, + } + } + + /// The layout of a color format with `stride` / `slice-height` (0 when + /// unknown). Flexible and vendor formats need `image-data` instead. + pub fn from_color_format( + color_format: i32, + width: u32, + height: u32, + stride: usize, + slice_height: usize, + ) -> Option { + match color_format { + COLOR_FORMAT_I420 => Some(Self::i420(width, height, stride, slice_height)), + COLOR_FORMAT_NV12 => Some(Self::nv12(width, height, stride, slice_height)), + _ => None, + } + } + + /// Parse a `MediaImage2` (little-endian, as on every Android ABI). + /// Only 8-bit YUV 4:2:0 with three planes is accepted. + pub fn from_media_image2(data: &[u8]) -> Option { + if data.len() < MEDIA_IMAGE2_SIZE { + return None; + } + let word = |i: usize| u32::from_le_bytes(data[i * 4..i * 4 + 4].try_into().unwrap()); + let (kind, planes, width, height, depth, allocated) = + (word(0), word(1), word(2), word(3), word(4), word(5)); + if kind != MEDIA_IMAGE_TYPE_YUV || planes != 3 || depth != 8 || allocated != 8 { + return None; + } + let plane = |p: usize, subsampling: u32| -> Option { + let base = 6 + p * 5; + let (offset, col_inc, row_inc) = + (word(base), word(base + 1) as i32, word(base + 2) as i32); + if word(base + 3) != subsampling || word(base + 4) != subsampling { + return None; + } + Some(PlaneLayout { + offset: offset as usize, + col_inc: usize::try_from(col_inc).ok().filter(|&c| c > 0)?, + row_inc: usize::try_from(row_inc).ok().filter(|&r| r > 0)?, + }) + }; + Some(Self { width, height, y: plane(0, 1)?, u: plane(1, 2)?, v: plane(2, 2)? }) + } + + /// The same buffer layout for a smaller visible area (a crop from the + /// top-left corner), e.g. a decoder's 1920x1088 buffer showing 1080 rows. + pub fn cropped(mut self, width: u32, height: u32) -> Self { + self.width = width.min(self.width); + self.height = height.min(self.height); + self + } + + /// Bytes a buffer needs to hold this image. + pub fn buffer_len(&self) -> usize { + let (cw, ch) = chroma_size(self.width, self.height); + let end = |p: &PlaneLayout, w: usize, h: usize| { + if w == 0 || h == 0 { + 0 + } else { + p.offset + (h - 1) * p.row_inc + (w - 1) * p.col_inc + 1 + } + }; + let (w, h) = (self.width as usize, self.height as usize); + end(&self.y, w, h).max(end(&self.u, cw, ch)).max(end(&self.v, cw, ch)) + } + + fn check(&self, len: usize) -> Result<()> { + if len < self.buffer_len() { + return Err(Error::InvalidFrame(format!( + "codec buffer has {len} bytes, the {}x{} image needs {}", + self.width, + self.height, + self.buffer_len() + ))); + } + Ok(()) + } + + /// Copy an image out of a codec buffer: NV12 when the layout is NV12, + /// I420 otherwise. + pub fn read(&self, buf: &[u8]) -> Result { + self.check(buf.len())?; + let (w, h) = (self.width as usize, self.height as usize); + let (cw, ch) = chroma_size(self.width, self.height); + let y = read_plane(buf, &self.y, w, h); + let data = if self.u.col_inc == 2 + && self.v.col_inc == 2 + && self.v.offset == self.u.offset + 1 + && self.u.row_inc == self.v.row_inc + { + let uv = PlaneLayout { col_inc: 1, ..self.u }; + FrameData::Nv12 { y, uv: read_plane(buf, &uv, cw * 2, ch) } + } else { + FrameData::I420 { + y, + u: read_plane(buf, &self.u, cw, ch), + v: read_plane(buf, &self.v, cw, ch), + } + }; + let frame = VideoFrame { + width: self.width, + height: self.height, + timestamp: std::time::Duration::ZERO, + data, + }; + frame.validate()?; + Ok(frame) + } + + /// Write `frame` (any pixel format, same size as the layout) into a codec + /// buffer. Returns the bytes used. + pub fn write(&self, frame: &VideoFrame, buf: &mut [u8]) -> Result { + if (frame.width, frame.height) != (self.width, self.height) { + return Err(Error::InvalidFrame(format!( + "{}x{} frame for a {}x{} codec buffer", + frame.width, frame.height, self.width, self.height + ))); + } + self.check(buf.len())?; + let i420 = convert::to_i420(frame)?; + let FrameData::I420 { y, u, v } = &i420.data else { + unreachable!("to_i420 returns I420"); + }; + let (w, h) = (self.width as usize, self.height as usize); + let (cw, ch) = chroma_size(self.width, self.height); + write_plane(buf, &self.y, y, w, h); + write_plane(buf, &self.u, u, cw, ch); + write_plane(buf, &self.v, v, cw, ch); + Ok(self.buffer_len()) + } +} + +fn read_plane(buf: &[u8], p: &PlaneLayout, width: usize, rows: usize) -> Plane { + let mut data = Vec::with_capacity(width * rows); + for row in 0..rows { + let start = p.offset + row * p.row_inc; + if p.col_inc == 1 { + data.extend_from_slice(&buf[start..start + width]); + } else { + data.extend((0..width).map(|x| buf[start + x * p.col_inc])); + } + } + Plane::new(data, width) +} + +fn write_plane(buf: &mut [u8], p: &PlaneLayout, src: &Plane, width: usize, rows: usize) { + for row in 0..rows { + let line = src.row(row, width); + let start = p.offset + row * p.row_inc; + if p.col_inc == 1 { + buf[start..start + width].copy_from_slice(line); + } else { + for (x, &sample) in line.iter().enumerate() { + buf[start + x * p.col_inc] = sample; + } + } + } +} + +#[cfg(test)] +mod tests { + use super::*; + + /// A 6x4 I420 frame with distinct samples per plane. + fn frame() -> VideoFrame { + let (w, h) = (6usize, 4usize); + let (cw, ch) = chroma_size(6, 4); + VideoFrame { + width: 6, + height: 4, + timestamp: std::time::Duration::ZERO, + data: FrameData::I420 { + y: Plane::new((0..w * h).map(|i| i as u8).collect(), w), + u: Plane::new((0..cw * ch).map(|i| 100 + i as u8).collect(), cw), + v: Plane::new((0..cw * ch).map(|i| 200 + i as u8).collect(), cw), + }, + } + } + + fn as_i420(frame: &VideoFrame) -> VideoFrame { + convert::to_i420(frame).unwrap().into_owned() + } + + #[test] + fn i420_and_nv12_round_trip_with_padding() { + let src = frame(); + for layout in [ImageLayout::i420(6, 4, 8, 6), ImageLayout::nv12(6, 4, 8, 6)] { + let mut buf = vec![0xEE; layout.buffer_len()]; + assert_eq!(layout.write(&src, &mut buf).unwrap(), buf.len()); + let back = layout.read(&buf).unwrap(); + assert_eq!(as_i420(&back).data, src.data, "{layout:?}"); + } + // NV12 reads back as NV12 without conversion. + let layout = ImageLayout::nv12(6, 4, 6, 4); + let mut buf = vec![0; layout.buffer_len()]; + layout.write(&src, &mut buf).unwrap(); + assert!(matches!(layout.read(&buf).unwrap().data, FrameData::Nv12 { .. })); + assert_eq!(&buf[24..30], &[100, 200, 101, 201, 102, 202]); + } + + #[test] + fn media_image2_describes_nv21() { + // 6x4, stride 8, 4 rows: V first in the interleaved plane (NV21). + let mut raw = Vec::new(); + for w in [1u32, 3, 6, 4, 8, 8] { + raw.extend(w.to_le_bytes()); + } + for (offset, col, row, sub) in [(0u32, 1i32, 8i32, 1u32), (33, 2, 8, 2), (32, 2, 8, 2)] { + raw.extend(offset.to_le_bytes()); + raw.extend(col.to_le_bytes()); + raw.extend(row.to_le_bytes()); + raw.extend(sub.to_le_bytes()); + raw.extend(sub.to_le_bytes()); + } + raw.extend([0; 20]); + let layout = ImageLayout::from_media_image2(&raw).unwrap(); + assert_eq!(layout.u, PlaneLayout { offset: 33, col_inc: 2, row_inc: 8 }); + let mut buf = vec![0; layout.buffer_len()]; + layout.write(&frame(), &mut buf).unwrap(); + assert_eq!(&buf[32..36], &[200, 100, 201, 101]); + let back = layout.read(&buf).unwrap(); + assert!(matches!(back.data, FrameData::I420 { .. })); + assert_eq!(back.data, frame().data); + + // Not YUV, too short, or a 10-bit image: rejected. + let mut rgb = raw.clone(); + rgb[0] = 3; + assert!(ImageLayout::from_media_image2(&rgb).is_none()); + assert!(ImageLayout::from_media_image2(&raw[..100]).is_none()); + let mut deep = raw.clone(); + deep[16] = 10; + assert!(ImageLayout::from_media_image2(&deep).is_none()); + } + + #[test] + fn crop_and_size_checks() { + // A decoder buffer of 8x6 (stride 8) showing 6x4. + let layout = + ImageLayout::from_color_format(COLOR_FORMAT_I420, 8, 6, 8, 6).unwrap().cropped(6, 4); + assert_eq!((layout.width, layout.height), (6, 4)); + assert_eq!(layout.u.offset, 48); + assert!(ImageLayout::from_color_format(COLOR_FORMAT_FLEXIBLE, 8, 6, 8, 6).is_none()); + let short = vec![0; 10]; + assert!(matches!(layout.read(&short), Err(Error::InvalidFrame(_)))); + let mut buf = vec![0; 100]; + assert!(layout.write(&VideoFrame::black_i420(4, 4), &mut buf).is_err()); + } +} diff --git a/crates/voelin-media/src/codec/mediacodec.rs b/crates/voelin-media/src/codec/mediacodec.rs new file mode 100644 index 0000000..f5f941b --- /dev/null +++ b/crates/voelin-media/src/codec/mediacodec.rs @@ -0,0 +1,566 @@ +//! Android MediaCodec (NDK `AMediaCodec`) encoders and decoders. +//! +//! Byte-buffer mode on both sides, so frames stay [`VideoFrame`]s like with +//! the software codecs: encoders take I420 / NV12 (whatever the codec asks +//! for, see [`ImageLayout`]), decoders return I420 or NV12. The device's +//! default codec for a MIME type is used; most phones have hardware H.264, +//! many hardware VP8 / VP9, and every Android has Google's software VP8, +//! VP9 and H.264 (`c2.android.*`). +//! +//! H.264 is encoded as High profile without B-frames (the Constrained High +//! stream TeamSpeak negotiates, see `voelin-stream`), SPS/PPS in front of every +//! keyframe. + +// AMediaCodec handles are used from one thread at a time (`&mut self`), which +// the NDK allows from any thread; the wrapper only asserts that. +#![allow(unsafe_code)] + +use std::sync::OnceLock; +use std::time::Duration; + +use ndk::media::media_codec::{ + DequeuedInputBufferResult, DequeuedOutputBufferInfoResult, MediaCodec, MediaCodecDirection, +}; +use ndk::media::media_format::MediaFormat; +use tracing::{debug, info}; + +use super::hw::HardwareEncoderFactory; +use super::image_layout::{ + COLOR_FORMAT_FLEXIBLE, COLOR_FORMAT_I420, COLOR_FORMAT_NV12, ImageLayout, +}; +use super::{Codec, EncodedFrame, EncoderBackend, EncoderConfig, VideoDecoder, VideoEncoder}; +use crate::frame::{FrameData, VideoFrame}; +use crate::{Error, Result, convert}; + +/// `BUFFER_FLAG_KEY_FRAME`. +const FLAG_KEY_FRAME: u32 = 1; +/// `BUFFER_FLAG_CODEC_CONFIG`: SPS/PPS (H.264), no picture. +const FLAG_CODEC_CONFIG: u32 = 2; +/// `AVCProfileHigh`, `AVCProfileConstrainedHigh`. +const AVC_PROFILE_HIGH: i32 = 0x08; +const AVC_PROFILE_CONSTRAINED_HIGH: i32 = 0x80000; +/// `BITRATE_MODE_VBR`. +const BITRATE_MODE_VBR: i32 = 1; +/// Keyframe interval for "only on request" (seconds; what WebRTC uses). +const NO_PERIODIC_KEYFRAMES: i32 = 3600; +/// How long `decode` / `encode` wait for a free input buffer. +const INPUT_WAIT: Duration = Duration::from_millis(20); +/// How long they wait for the first output of a call. +const OUTPUT_WAIT: Duration = Duration::from_millis(5); + +pub const NAME: &str = "mediacodec"; + +fn mime(codec: Codec) -> &'static str { + match codec { + Codec::Vp8 => "video/x-vnd.on2.vp8", + Codec::Vp9 => "video/x-vnd.on2.vp9", + Codec::H264 => "video/avc", + Codec::Av1 => "video/av01", + } +} + +/// Google's software codecs (as opposed to the vendor's hardware ones). +fn is_software(name: &str) -> bool { + name.starts_with("c2.android.") || name.starts_with("OMX.google.") || name.contains(".sw.") +} + +/// An `AMediaCodec` that may move between threads. +struct Handle(MediaCodec); + +// SAFETY: see the module attribute; `Handle` is only reached through +// `&mut self` of its owner, never shared. +unsafe impl Send for Handle {} + +impl Drop for Handle { + fn drop(&mut self) { + let _ = self.0.stop(); + } +} + +fn encoder_error(codec: Codec, context: &str, e: impl std::fmt::Display) -> Error { + Error::Encoder { codec, message: format!("{context}: {e}") } +} + +fn decoder_error(codec: Codec, context: &str, e: impl std::fmt::Display) -> Error { + Error::Decoder { codec, message: format!("{context}: {e}") } +} + +/// The default codec's name per MIME type and direction, probed once. +struct Available { + encoders: Vec<(Codec, String)>, + decoders: Vec<(Codec, String)>, +} + +fn available() -> &'static Available { + static AVAILABLE: OnceLock = OnceLock::new(); + AVAILABLE.get_or_init(|| { + let probe = |create: fn(&str) -> Option| { + Codec::ALL + .into_iter() + .filter_map(|codec| { + let handle = Handle(create(mime(codec))?); + let name = handle.0.name().unwrap_or_else(|_| "?".into()); + Some((codec, name)) + }) + .collect::>() + }; + let found = Available { + encoders: probe(MediaCodec::from_encoder_type), + decoders: probe(MediaCodec::from_decoder_type), + }; + info!(encoders = ?found.encoders, decoders = ?found.decoders, "MediaCodec"); + found + }) +} + +/// Whether the device decodes `codec`. +pub fn check_decoder(codec: Codec) -> Result<()> { + if available().decoders.iter().any(|(c, _)| *c == codec) { + Ok(()) + } else { + Err(Error::CodecUnavailable { codec, reason: "no MediaCodec decoder".into() }) + } +} + +/// Encoders of this device: hardware ones first (H.264, VP9, VP8), then +/// Google's software VP8 and H.264. Software VP9 and AV1 are too slow. +pub fn probe() -> Option { + let encoders = &available().encoders; + let name = |codec| encoders.iter().find(|(c, _)| *c == codec).map(|(_, n)| n.as_str()); + let mut codecs = Vec::new(); + for codec in [Codec::H264, Codec::Vp9, Codec::Vp8, Codec::Av1] { + if name(codec).is_some_and(|n| !is_software(n)) { + codecs.push(codec); + } + } + for codec in [Codec::Vp8, Codec::H264] { + if name(codec).is_some_and(is_software) { + codecs.push(codec); + } + } + (!codecs.is_empty()).then_some(MediaCodecFactory { codecs }) +} + +pub struct MediaCodecFactory { + codecs: Vec, +} + +impl HardwareEncoderFactory for MediaCodecFactory { + fn name(&self) -> &'static str { + NAME + } + + fn codecs(&self) -> Vec { + self.codecs.clone() + } + + fn create(&self, codec: Codec, config: &EncoderConfig) -> Result> { + if !self.codecs.contains(&codec) { + return Err(Error::CodecUnavailable { codec, reason: "no MediaCodec encoder".into() }); + } + Ok(Box::new(MediaCodecEncoder { codec, config: config.clone(), session: None })) + } +} + +/// A MediaCodec encoder. The codec is (re)created for the frame size. +pub struct MediaCodecEncoder { + codec: Codec, + config: EncoderConfig, + session: Option, +} + +struct EncoderSession { + handle: Handle, + layout: ImageLayout, + /// H.264 SPS/PPS, put in front of keyframes that lack them. + parameter_sets: Vec, + /// Staging buffer for the codec's input layout. + staging: Vec, + last_pts_us: Option, +} + +impl MediaCodecEncoder { + fn format( + &self, + width: u32, + height: u32, + color_format: i32, + profile: Option, + ) -> MediaFormat { + let mut format = MediaFormat::new(); + format.set_str("mime", mime(self.codec)); + format.set_i32("width", width as i32); + format.set_i32("height", height as i32); + format.set_i32("color-format", color_format); + format.set_i32("bitrate", self.config.bitrate_bps.min(i32::MAX as u32) as i32); + format.set_i32("bitrate-mode", BITRATE_MODE_VBR); + format.set_i32("frame-rate", self.config.fps.max(1) as i32); + let interval = match self.config.keyframe_interval { + Some(frames) => frames.div_ceil(self.config.fps.max(1)).max(1) as i32, + None => NO_PERIODIC_KEYFRAMES, + }; + format.set_i32("i-frame-interval", interval); + if self.codec == Codec::H264 { + format.set_i32("max-bframes", 0); + format.set_i32("prepend-sps-pps-to-idr-frames", 1); + if let Some(profile) = profile { + format.set_i32("profile", profile); + } + } + format + } + + /// Start a codec for `width` x `height`: NV12 input, else I420; for + /// H.264 Constrained High, else High, else the codec's default profile. + fn start(&self, width: u32, height: u32) -> Result { + let codec = self.codec; + let profiles: &[Option] = if codec == Codec::H264 { + &[Some(AVC_PROFILE_CONSTRAINED_HIGH), Some(AVC_PROFILE_HIGH), None] + } else { + &[None] + }; + let mut last_error = String::from("no configuration tried"); + for color_format in [COLOR_FORMAT_NV12, COLOR_FORMAT_I420] { + for &profile in profiles { + let handle = Handle( + MediaCodec::from_encoder_type(mime(codec)) + .ok_or_else(|| encoder_error(codec, "create", "no encoder"))?, + ); + let format = self.format(width, height, color_format, profile); + if let Err(e) = handle.0.configure(&format, None, MediaCodecDirection::Encoder) { + last_error = format!("configure {color_format}/{profile:?}: {e}"); + continue; + } + let layout = input_layout(&handle.0.input_format(), width, height, color_format); + handle.0.start().map_err(|e| encoder_error(codec, "start", e))?; + debug!(%codec, width, height, color_format, ?profile, ?layout, "MediaCodec encoder"); + return Ok(EncoderSession { + handle, + layout, + parameter_sets: Vec::new(), + staging: Vec::new(), + last_pts_us: None, + }); + } + } + Err(encoder_error(codec, "no working configuration", last_error)) + } +} + +/// Where the encoder wants its input: `image-data` if it says, else the +/// color format with its `stride` / `slice-height`. +fn input_layout(format: &MediaFormat, width: u32, height: u32, requested: i32) -> ImageLayout { + if let Some(layout) = format + .buffer("image-data") + .and_then(ImageLayout::from_media_image2) + .filter(|l| l.width >= width && l.height >= height) + { + return layout.cropped(width, height); + } + let stride = format.i32("stride").and_then(|s| usize::try_from(s).ok()).unwrap_or(0); + let slice = format.i32("slice-height").and_then(|s| usize::try_from(s).ok()).unwrap_or(0); + let color = match format.i32("color-format") { + Some(c @ (COLOR_FORMAT_I420 | COLOR_FORMAT_NV12)) => c, + // Flexible or unset: what we asked for. + _ => requested, + }; + ImageLayout::from_color_format(color, width, height, stride, slice) + .unwrap_or_else(|| ImageLayout::nv12(width, height, stride, slice)) +} + +/// The top-left `width` x `height` of an I420 frame (planes keep their +/// stride, so nothing is copied). +fn crop_i420(mut frame: VideoFrame, width: u32, height: u32) -> VideoFrame { + debug_assert!(matches!(frame.data, FrameData::I420 { .. })); + frame.width = width; + frame.height = height; + frame +} + +/// H.264 NAL unit type of the first NAL after a start code. +fn first_nal_type(data: &[u8]) -> Option { + let start = if data.starts_with(&[0, 0, 0, 1]) { + 4 + } else if data.starts_with(&[0, 0, 1]) { + 3 + } else { + return None; + }; + data.get(start).map(|b| b & 0x1f) +} + +impl VideoEncoder for MediaCodecEncoder { + fn codec(&self) -> Codec { + self.codec + } + + fn backend(&self) -> EncoderBackend { + EncoderBackend::Hardware(NAME) + } + + fn encode(&mut self, frame: &VideoFrame, force_keyframe: bool) -> Result> { + let codec = self.codec; + // Encoders want even sizes. + let (width, height) = (frame.width & !1, frame.height & !1); + if width == 0 || height == 0 { + return Err(Error::InvalidFrame(format!("{}x{} frame", frame.width, frame.height))); + } + let resized = self + .session + .as_ref() + .is_some_and(|s| (s.layout.width, s.layout.height) != (width, height)); + if resized || self.session.is_none() { + self.session = None; + self.session = Some(self.start(width, height)?); + } + let session = self.session.as_mut().expect("started above"); + let mut i420 = convert::to_i420(frame)?.into_owned(); + if (i420.width, i420.height) != (width, height) { + i420 = crop_i420(i420, width, height); + } + + // Strictly increasing presentation times. + let mut pts_us = i420.timestamp.as_micros() as u64; + if let Some(last) = session.last_pts_us + && pts_us <= last + { + pts_us = last + 1; + } + + if force_keyframe && !resized { + let mut params = MediaFormat::new(); + params.set_i32("request-sync", 0); + session + .handle + .0 + .set_parameters(params) + .map_err(|e| encoder_error(codec, "request keyframe", e))?; + } + + let len = session.layout.buffer_len(); + session.staging.resize(len, 0); + session.layout.write(&i420, &mut session.staging)?; + match session + .handle + .0 + .dequeue_input_buffer(INPUT_WAIT) + .map_err(|e| encoder_error(codec, "dequeue input", e))? + { + DequeuedInputBufferResult::Buffer(mut buffer) => { + let dst = buffer.buffer_mut(); + if dst.len() < len { + return Err(encoder_error( + codec, + "input buffer", + format!("{} bytes, need {len}", dst.len()), + )); + } + dst[..len].write_copy_of_slice(&session.staging); + session + .handle + .0 + .queue_input_buffer(buffer, 0, len, pts_us, 0) + .map_err(|e| encoder_error(codec, "queue input", e))?; + session.last_pts_us = Some(pts_us); + } + // The codec is still busy: skip this frame (rate control). + DequeuedInputBufferResult::TryAgainLater => {} + } + drain_encoder(codec, session) + } + + fn set_bitrate(&mut self, bps: u32) -> Result<()> { + self.config.bitrate_bps = bps; + if let Some(session) = &self.session { + let mut params = MediaFormat::new(); + params.set_i32("video-bitrate", bps.min(i32::MAX as u32) as i32); + session + .handle + .0 + .set_parameters(params) + .map_err(|e| encoder_error(self.codec, "set bitrate", e))?; + } + Ok(()) + } +} + +/// Collect what the encoder has finished. +fn drain_encoder(codec: Codec, session: &mut EncoderSession) -> Result> { + let mut out = Vec::new(); + let mut wait = OUTPUT_WAIT; + loop { + let result = session + .handle + .0 + .dequeue_output_buffer(wait) + .map_err(|e| encoder_error(codec, "dequeue output", e))?; + wait = Duration::ZERO; + match result { + DequeuedOutputBufferInfoResult::Buffer(buffer) => { + let info = *buffer.info(); + let offset = usize::try_from(info.offset()).unwrap_or(0); + let size = usize::try_from(info.size()).unwrap_or(0); + let data = buffer.buffer().get(offset..offset + size).map(<[u8]>::to_vec); + session + .handle + .0 + .release_output_buffer(buffer, false) + .map_err(|e| encoder_error(codec, "release output", e))?; + let Some(mut data) = data.filter(|d| !d.is_empty()) else { + continue; + }; + if info.flags() & FLAG_CODEC_CONFIG != 0 { + session.parameter_sets = data; + continue; + } + let keyframe = info.flags() & FLAG_KEY_FRAME != 0; + if keyframe + && codec == Codec::H264 + && !session.parameter_sets.is_empty() + && first_nal_type(&data) != Some(7) + { + let mut with_sps = session.parameter_sets.clone(); + with_sps.append(&mut data); + data = with_sps; + } + let pts_us = u64::try_from(info.presentation_time_us()).unwrap_or(0); + out.push(EncodedFrame { data, keyframe, pts_90khz: pts_us * 9 / 100 }); + } + DequeuedOutputBufferInfoResult::OutputFormatChanged + | DequeuedOutputBufferInfoResult::OutputBuffersChanged => {} + DequeuedOutputBufferInfoResult::TryAgainLater => return Ok(out), + } + } +} + +/// A MediaCodec decoder. +pub struct MediaCodecDecoder { + codec: Codec, + handle: Handle, + /// Output layout, known after the first format change. + layout: Option, + pts_us: u64, +} + +impl MediaCodecDecoder { + pub fn new(codec: Codec) -> Result { + check_decoder(codec)?; + let handle = Handle( + MediaCodec::from_decoder_type(mime(codec)) + .ok_or_else(|| decoder_error(codec, "create", "no decoder"))?, + ); + let mut format = MediaFormat::new(); + format.set_str("mime", mime(codec)); + // A hint; the stream's own size wins. + format.set_i32("width", 1920); + format.set_i32("height", 1080); + format.set_i32("color-format", COLOR_FORMAT_FLEXIBLE); + handle + .0 + .configure(&format, None, MediaCodecDirection::Decoder) + .map_err(|e| decoder_error(codec, "configure", e))?; + handle.0.start().map_err(|e| decoder_error(codec, "start", e))?; + Ok(Self { codec, handle, layout: None, pts_us: 0 }) + } + + fn update_layout(&mut self) { + let format = self.handle.0.output_format(); + let width = format.i32("width").unwrap_or(0).max(0) as u32; + let height = format.i32("height").unwrap_or(0).max(0) as u32; + let (visible_w, visible_h) = match format.rect("crop") { + Some((left, top, right, bottom)) if left == 0 && top == 0 => { + ((right + 1).max(0) as u32, (bottom + 1).max(0) as u32) + } + _ => (width, height), + }; + let stride = format.i32("stride").and_then(|s| usize::try_from(s).ok()).unwrap_or(0); + let slice = format.i32("slice-height").and_then(|s| usize::try_from(s).ok()).unwrap_or(0); + let layout = format + .buffer("image-data") + .and_then(ImageLayout::from_media_image2) + .or_else(|| { + ImageLayout::from_color_format( + format.i32("color-format").unwrap_or(0), + width, + height, + stride, + slice, + ) + }) + .map(|l| l.cropped(visible_w, visible_h)); + debug!(codec = %self.codec, ?layout, "MediaCodec decoder output"); + self.layout = layout; + } +} + +impl VideoDecoder for MediaCodecDecoder { + fn codec(&self) -> Codec { + self.codec + } + + fn decode(&mut self, data: &[u8]) -> Result> { + let codec = self.codec; + match self + .handle + .0 + .dequeue_input_buffer(INPUT_WAIT) + .map_err(|e| decoder_error(codec, "dequeue input", e))? + { + DequeuedInputBufferResult::Buffer(mut buffer) => { + let dst = buffer.buffer_mut(); + if dst.len() < data.len() { + return Err(decoder_error( + codec, + "input buffer", + format!("{} bytes for a {} byte frame", dst.len(), data.len()), + )); + } + dst[..data.len()].write_copy_of_slice(data); + // Only the order matters; the caller knows the RTP time. + self.pts_us += 33_333; + self.handle + .0 + .queue_input_buffer(buffer, 0, data.len(), self.pts_us, 0) + .map_err(|e| decoder_error(codec, "queue input", e))?; + } + DequeuedInputBufferResult::TryAgainLater => { + return Err(decoder_error(codec, "dequeue input", "the decoder is stalled")); + } + } + + // The newest finished picture; older ones are dropped. + let mut picture = None; + let mut wait = OUTPUT_WAIT; + loop { + let result = self + .handle + .0 + .dequeue_output_buffer(wait) + .map_err(|e| decoder_error(codec, "dequeue output", e))?; + wait = Duration::ZERO; + match result { + DequeuedOutputBufferInfoResult::Buffer(buffer) => { + let info = *buffer.info(); + let offset = usize::try_from(info.offset()).unwrap_or(0); + let size = usize::try_from(info.size()).unwrap_or(0); + let read = match (&self.layout, buffer.buffer().get(offset..offset + size)) { + (Some(layout), Some(bytes)) if size > 0 => Some(layout.read(bytes)), + _ => None, + }; + self.handle + .0 + .release_output_buffer(buffer, false) + .map_err(|e| decoder_error(codec, "release output", e))?; + match read { + Some(Ok(frame)) => picture = Some(frame), + Some(Err(e)) => return Err(decoder_error(codec, "output", e)), + None => {} + } + } + DequeuedOutputBufferInfoResult::OutputFormatChanged => self.update_layout(), + DequeuedOutputBufferInfoResult::OutputBuffersChanged => {} + DequeuedOutputBufferInfoResult::TryAgainLater => return Ok(picture), + } + } + } +} diff --git a/crates/tsc-media/src/codec/mod.rs b/crates/voelin-media/src/codec/mod.rs similarity index 96% rename from crates/tsc-media/src/codec/mod.rs rename to crates/voelin-media/src/codec/mod.rs index c666333..488c590 100644 --- a/crates/tsc-media/src/codec/mod.rs +++ b/crates/voelin-media/src/codec/mod.rs @@ -8,6 +8,8 @@ //! loaded at runtime //! - [`av1`] (feature `av1`): AV1 decoding with the system libdav1d //! - [`hw`]: hardware encoders (VA-API, Media Foundation); not implemented yet +//! - `mediacodec` (Android): the device's MediaCodec encoders and decoders +//! (hardware, or Google's software VP8 / VP9 / H.264) use std::fmt; use std::str::FromStr; @@ -20,6 +22,9 @@ pub mod av1; #[cfg(feature = "openh264")] pub mod h264; pub mod hw; +pub mod image_layout; +#[cfg(target_os = "android")] +pub mod mediacodec; #[cfg(feature = "vpx")] pub mod vpx; @@ -157,7 +162,7 @@ impl EncoderConfig { } } -/// One encoded frame, ready for `tsc_stream::Peer::write`. +/// One encoded frame, ready for `voelin_stream::Peer::write`. #[derive(Clone, Debug, PartialEq, Eq)] pub struct EncodedFrame { pub data: Vec, @@ -263,6 +268,10 @@ impl Codecs { /// Whether `codec` can be decoded, or why not. pub fn check_decoder(&self, codec: Codec) -> Result<()> { + #[cfg(target_os = "android")] + if mediacodec::check_decoder(codec).is_ok() { + return Ok(()); + } match codec { Codec::Vp8 | Codec::Vp9 => { #[cfg(feature = "vpx")] @@ -321,6 +330,10 @@ impl Codecs { } pub fn new_decoder(&self, codec: Codec) -> Result> { + #[cfg(target_os = "android")] + if mediacodec::check_decoder(codec).is_ok() { + return Ok(Box::new(mediacodec::MediaCodecDecoder::new(codec)?)); + } self.check_decoder(codec)?; match codec { #[cfg(feature = "vpx")] diff --git a/crates/tsc-media/src/codec/vpx.rs b/crates/voelin-media/src/codec/vpx.rs similarity index 100% rename from crates/tsc-media/src/codec/vpx.rs rename to crates/voelin-media/src/codec/vpx.rs diff --git a/crates/tsc-media/src/codec/vpx/raw.rs b/crates/voelin-media/src/codec/vpx/raw.rs similarity index 100% rename from crates/tsc-media/src/codec/vpx/raw.rs rename to crates/voelin-media/src/codec/vpx/raw.rs diff --git a/crates/tsc-media/src/convert.rs b/crates/voelin-media/src/convert.rs similarity index 100% rename from crates/tsc-media/src/convert.rs rename to crates/voelin-media/src/convert.rs diff --git a/crates/tsc-media/src/frame.rs b/crates/voelin-media/src/frame.rs similarity index 100% rename from crates/tsc-media/src/frame.rs rename to crates/voelin-media/src/frame.rs diff --git a/crates/tsc-media/src/lib.rs b/crates/voelin-media/src/lib.rs similarity index 97% rename from crates/tsc-media/src/lib.rs rename to crates/voelin-media/src/lib.rs index ef42629..9577a2e 100644 --- a/crates/tsc-media/src/lib.rs +++ b/crates/voelin-media/src/lib.rs @@ -15,7 +15,7 @@ //! plus WASAPI loopback on Windows //! - [`queue`]: the bounded, drop-oldest channel capture backends deliver on //! -//! Encoded frames go to `tsc_stream::Peer::write` with an RTP time of +//! Encoded frames go to `voelin_stream::Peer::write` with an RTP time of //! [`EncodedFrame::pts_90khz`] (90 kHz clock); received `MediaFrame`s go to //! [`VideoDecoder::decode`]. diff --git a/crates/tsc-media/src/queue.rs b/crates/voelin-media/src/queue.rs similarity index 100% rename from crates/tsc-media/src/queue.rs rename to crates/voelin-media/src/queue.rs diff --git a/crates/tsc-media/tests/codec_roundtrip.rs b/crates/voelin-media/tests/codec_roundtrip.rs similarity index 97% rename from crates/tsc-media/tests/codec_roundtrip.rs rename to crates/voelin-media/tests/codec_roundtrip.rs index 552b8ca..c92561d 100644 --- a/crates/tsc-media/tests/codec_roundtrip.rs +++ b/crates/voelin-media/tests/codec_roundtrip.rs @@ -3,8 +3,8 @@ use std::time::Duration; -use tsc_media::capture::synthetic::{BACKGROUND, RECT_COLOR, SyntheticScreen, TEXT_COLOR}; -use tsc_media::{ +use voelin_media::capture::synthetic::{BACKGROUND, RECT_COLOR, SyntheticScreen, TEXT_COLOR}; +use voelin_media::{ CaptureOptions, Codec, Codecs, EncoderBackend, EncoderConfig, ScreenCapture, SourceId, VideoFrame, convert, }; diff --git a/crates/tsc-media/tests/openh264.rs b/crates/voelin-media/tests/openh264.rs similarity index 84% rename from crates/tsc-media/tests/openh264.rs rename to crates/voelin-media/tests/openh264.rs index 8ca686b..d89cc0f 100644 --- a/crates/tsc-media/tests/openh264.rs +++ b/crates/voelin-media/tests/openh264.rs @@ -1,16 +1,16 @@ //! H.264 through Cisco's OpenH264, loaded at runtime. //! //! Without the library only the "unavailable" paths run. To test encoding -//! and decoding, point `TSC_OPENH264_LIB` at Cisco's library (for example the +//! and decoding, point `VOELIN_OPENH264_LIB` at Cisco's library (for example the //! file the ignored `download_and_roundtrip` test fetches: -//! `cargo test -p tsc-media --test openh264 -- --ignored`). +//! `cargo test -p voelin-media --test openh264 -- --ignored`). #![cfg(feature = "openh264")] use std::path::PathBuf; -use tsc_media::capture::synthetic::{RECT_COLOR, SyntheticScreen}; -use tsc_media::codec::h264::{H264Profile, OpenH264}; -use tsc_media::{ +use voelin_media::capture::synthetic::{RECT_COLOR, SyntheticScreen}; +use voelin_media::codec::h264::{H264Profile, OpenH264}; +use voelin_media::{ Codec, Codecs, EncoderBackend, EncoderConfig, Error, VideoEncoder, VideoFrame, convert, }; @@ -100,8 +100,8 @@ fn roundtrip(library: OpenH264) { #[test] fn roundtrip_with_library_from_env() { - let Some(path) = std::env::var_os("TSC_OPENH264_LIB") else { - eprintln!("skipped: TSC_OPENH264_LIB is not set"); + let Some(path) = std::env::var_os("VOELIN_OPENH264_LIB") else { + eprintln!("skipped: VOELIN_OPENH264_LIB is not set"); return; }; roundtrip(OpenH264::load(PathBuf::from(path)).unwrap()); @@ -112,14 +112,14 @@ fn roundtrip_with_library_from_env() { #[tokio::test] #[ignore = "downloads from ciscobinary.openh264.org"] async fn download_and_roundtrip() { - if tsc_media::codec::h264::platform_library_name().is_none() { + if voelin_media::codec::h264::platform_library_name().is_none() { return; } - let dir = std::env::temp_dir().join(format!("tsc-media-openh264-{}", std::process::id())); - let library = tsc_media::codec::h264::download_openh264(&dir).await.unwrap(); + let dir = std::env::temp_dir().join(format!("voelin-media-openh264-{}", std::process::id())); + let library = voelin_media::codec::h264::download_openh264(&dir).await.unwrap(); assert!(library.path().starts_with(&dir)); // A second call reuses the verified file. - let again = tsc_media::codec::h264::download_openh264(&dir).await.unwrap(); + let again = voelin_media::codec::h264::download_openh264(&dir).await.unwrap(); assert_eq!(again, library); tokio::task::spawn_blocking(move || roundtrip(library)).await.unwrap(); std::fs::remove_dir_all(&dir).unwrap(); diff --git a/crates/tsc-media/tests/x11_capture.rs b/crates/voelin-media/tests/x11_capture.rs similarity index 97% rename from crates/tsc-media/tests/x11_capture.rs rename to crates/voelin-media/tests/x11_capture.rs index d0898d1..fd01de2 100644 --- a/crates/tsc-media/tests/x11_capture.rs +++ b/crates/voelin-media/tests/x11_capture.rs @@ -3,13 +3,13 @@ //! VP8 and back. //! //! Needs `DISPLAY` (e.g. `Xvfb :101 -screen 0 1280x720x24 & DISPLAY=:101 -//! cargo test -p tsc-media --test x11_capture`); skipped without it. +//! cargo test -p voelin-media --test x11_capture`); skipped without it. #![cfg(all(target_os = "linux", feature = "x11", feature = "vpx"))] use std::time::Duration; -use tsc_media::capture::x11::X11Capture; -use tsc_media::{ +use voelin_media::capture::x11::X11Capture; +use voelin_media::{ CaptureOptions, Codec, Codecs, EncoderConfig, FrameReceiver, ScreenCapture, SourceId, VideoFrame, convert, }; @@ -20,7 +20,7 @@ use x11rb::protocol::xproto::{ use x11rb::rust_connection::RustConnection; use x11rb::wrapper::ConnectionExt as _; -const TITLE: &str = "tsc-media-x11-test"; +const TITLE: &str = "voelin-media-x11-test"; const BACKGROUND: u32 = 0x202020; const WINDOW: u32 = 0x3060c0; const INNER: u32 = 0xf08020; diff --git a/crates/tsc-model/Cargo.toml b/crates/voelin-model/Cargo.toml similarity index 94% rename from crates/tsc-model/Cargo.toml rename to crates/voelin-model/Cargo.toml index f4bda65..d78b175 100644 --- a/crates/tsc-model/Cargo.toml +++ b/crates/voelin-model/Cargo.toml @@ -1,5 +1,5 @@ [package] -name = "tsc-model" +name = "voelin-model" version = "0.1.0" description = "UI-facing domain model shared by the client engine, gateway and UI (no IO)." edition.workspace = true diff --git a/crates/tsc-model/src/chat.rs b/crates/voelin-model/src/chat.rs similarity index 100% rename from crates/tsc-model/src/chat.rs rename to crates/voelin-model/src/chat.rs diff --git a/crates/tsc-model/src/lib.rs b/crates/voelin-model/src/lib.rs similarity index 100% rename from crates/tsc-model/src/lib.rs rename to crates/voelin-model/src/lib.rs diff --git a/crates/tsc-model/src/presence.rs b/crates/voelin-model/src/presence.rs similarity index 100% rename from crates/tsc-model/src/presence.rs rename to crates/voelin-model/src/presence.rs diff --git a/crates/tsc-model/src/server.rs b/crates/voelin-model/src/server.rs similarity index 100% rename from crates/tsc-model/src/server.rs rename to crates/voelin-model/src/server.rs diff --git a/crates/tsc-model/src/tree.rs b/crates/voelin-model/src/tree.rs similarity index 100% rename from crates/tsc-model/src/tree.rs rename to crates/voelin-model/src/tree.rs diff --git a/crates/tsc-observer/Cargo.toml b/crates/voelin-observer/Cargo.toml similarity index 81% rename from crates/tsc-observer/Cargo.toml rename to crates/voelin-observer/Cargo.toml index f9a9f62..67bf4c5 100644 --- a/crates/tsc-observer/Cargo.toml +++ b/crates/voelin-observer/Cargo.toml @@ -1,5 +1,5 @@ [package] -name = "tsc-observer" +name = "voelin-observer" version = "0.1.0" description = "Invisible presence and channel-chat relays over ServerQuery." edition.workspace = true @@ -12,8 +12,8 @@ publish.workspace = true thiserror = "2" tokio = { version = "1", features = ["macros", "rt", "sync", "time"] } tracing = "0.1" -tsc-model = { path = "../tsc-model" } -tsc-query = { path = "../tsc-query" } +voelin-model = { path = "../voelin-model" } +voelin-query = { path = "../voelin-query" } [dev-dependencies] tokio = { version = "1", features = ["macros", "rt-multi-thread", "test-util"] } diff --git a/crates/tsc-observer/src/convert.rs b/crates/voelin-observer/src/convert.rs similarity index 96% rename from crates/tsc-observer/src/convert.rs rename to crates/voelin-observer/src/convert.rs index b74e3c6..d1cb412 100644 --- a/crates/tsc-observer/src/convert.rs +++ b/crates/voelin-observer/src/convert.rs @@ -1,7 +1,7 @@ //! Query rows and events to model types. -use tsc_model::{ChannelInfo, ChatMessage, ChatTarget, ClientInfo, PresenceDelta}; -use tsc_query::{Notification, Row}; +use voelin_model::{ChannelInfo, ChatMessage, ChatTarget, ClientInfo, PresenceDelta}; +use voelin_query::{Notification, Row}; /// From a `channellist -topic -flags -voice -limits` row, or the fields of /// `notifychannelcreated`. @@ -135,7 +135,7 @@ pub fn is_text_message(n: &Notification, now_ms: i64) -> Option { #[cfg(test)] mod tests { - use tsc_query::{Line, parse_line}; + use voelin_query::{Line, parse_line}; use super::*; @@ -149,7 +149,7 @@ mod tests { #[test] fn clientlist_row() { // Captured from TeamSpeak 6.0.0-beta13.1 (clientlist -uid -away -voice -groups -country). - let row = &tsc_query::parse_rows( + let row = &voelin_query::parse_rows( "clid=7 cid=1 client_database_id=4 client_nickname=sample client_type=0 client_away=0 \ client_away_message client_flag_talking=0 client_input_muted=1 client_output_muted=0 \ client_unique_identifier=hSC9DusMo3MJwDuA8MuvZBaHfb\\/h77N9WZtYskAFlG0= \ @@ -166,7 +166,7 @@ mod tests { #[test] fn channellist_row() { - let row = &tsc_query::parse_rows( + let row = &voelin_query::parse_rows( "cid=1 pid=0 channel_order=0 channel_name=Default\\sChannel channel_topic=t \ channel_flag_default=1 channel_flag_password=0 channel_maxclients=-1 \ channel_needed_subscribe_power=0 channel_needed_talk_power=5", diff --git a/crates/tsc-observer/src/lib.rs b/crates/voelin-observer/src/lib.rs similarity index 89% rename from crates/tsc-observer/src/lib.rs rename to crates/voelin-observer/src/lib.rs index 2cb1510..efe1e70 100644 --- a/crates/tsc-observer/src/lib.rs +++ b/crates/voelin-observer/src/lib.rs @@ -1,7 +1,7 @@ //! Invisible presence and channel-chat relays over ServerQuery. //! //! Query clients do not show up in normal clients' channel trees. The -//! [`Observer`] keeps a live [`Presence`](tsc_model::Presence) of a server +//! [`Observer`] keeps a live [`Presence`](voelin_model::Presence) of a server //! from one query session. A [`RelayPool`] puts one query session into each //! channel whose chat someone wants to read or write without joining it. //! diff --git a/crates/tsc-observer/src/observer.rs b/crates/voelin-observer/src/observer.rs similarity index 96% rename from crates/tsc-observer/src/observer.rs rename to crates/voelin-observer/src/observer.rs index 5b6f589..2dcb7c7 100644 --- a/crates/tsc-observer/src/observer.rs +++ b/crates/voelin-observer/src/observer.rs @@ -6,8 +6,8 @@ use std::time::Duration; use tokio::sync::{broadcast, watch}; use tokio::time::{Instant, sleep, sleep_until}; use tracing::{debug, info, warn}; -use tsc_model::{ChatMessage, Presence, PresenceDelta, PresenceSnapshot}; -use tsc_query::{Command, Connect, Notification, QueryClient}; +use voelin_model::{ChatMessage, Presence, PresenceDelta, PresenceSnapshot}; +use voelin_query::{Command, Connect, Notification, QueryClient}; use crate::convert::{ channel_from_row, client_from_row, delta_from_notification, is_text_message, update_channel, @@ -102,7 +102,7 @@ async fn run( } /// Read the full state. -async fn load(client: &QueryClient) -> tsc_query::Result { +async fn load(client: &QueryClient) -> voelin_query::Result { let info = client.send(&Command::new("serverinfo")).await?; let channels = client .send(&Command::new("channellist").flag("topic").flag("flags").flag("voice").flag("limits")) @@ -139,7 +139,7 @@ async fn session( config: &ObserverConfig, presence: &RwLock, events: &broadcast::Sender, -) -> tsc_query::Result<()> { +) -> voelin_query::Result<()> { let (client, mut notifications) = QueryClient::connect(&config.connect).await?; if notifications.is_some() { for event in ["server", "channel"] { diff --git a/crates/tsc-observer/src/relay.rs b/crates/voelin-observer/src/relay.rs similarity index 89% rename from crates/tsc-observer/src/relay.rs rename to crates/voelin-observer/src/relay.rs index edf23cc..c980869 100644 --- a/crates/tsc-observer/src/relay.rs +++ b/crates/voelin-observer/src/relay.rs @@ -11,8 +11,8 @@ use std::sync::Arc; use tokio::sync::{Mutex, broadcast, mpsc}; use tokio::task::JoinHandle; use tracing::{debug, info, warn}; -use tsc_model::{ChannelId, ChatMessage, ChatTarget, relay_text, split_message}; -use tsc_query::{Command, Connect, Notification, QueryClient}; +use voelin_model::{ChannelId, ChatMessage, ChatTarget, relay_text, split_message}; +use voelin_query::{Command, Connect, Notification, QueryClient}; use crate::convert::is_text_message; @@ -82,21 +82,21 @@ impl RelayPool { } /// Start relaying a channel (no-op if already open). - pub async fn open(&self, channel: ChannelId) -> tsc_query::Result<()> { + pub async fn open(&self, channel: ChannelId) -> voelin_query::Result<()> { let mut sessions = self.sessions.lock().await; if sessions.get(&channel).is_some_and(|s| !s.task.is_finished()) { return Ok(()); } let (client, notifications) = QueryClient::connect(&self.config.connect).await?; let Some(notifications) = notifications else { - return Err(tsc_query::Error::Unsupported("relays need a transport with events")); + return Err(voelin_query::Error::Unsupported("relays need a transport with events")); }; let own_id = client.own_client_id().await?; set_nickname(&client, &format!("{} {channel}", self.config.nickname)).await; match client.send(&Command::new("clientmove").arg("clid", own_id).arg("cid", channel)).await { // Query clients start in the default channel. - Err(tsc_query::Error::Query(e)) if e.id == ERR_ALREADY_MEMBER => {} + Err(voelin_query::Error::Query(e)) if e.id == ERR_ALREADY_MEMBER => {} other => { other?; } @@ -127,11 +127,16 @@ impl RelayPool { } /// Post `text` in `channel` on behalf of `nick`, opening a relay if needed. - pub async fn send(&self, channel: ChannelId, nick: &str, text: &str) -> tsc_query::Result<()> { + pub async fn send( + &self, + channel: ChannelId, + nick: &str, + text: &str, + ) -> voelin_query::Result<()> { self.open(channel).await?; let client = match self.sessions.lock().await.get(&channel) { Some(s) => s.client.clone(), - None => return Err(tsc_query::Error::Closed), + None => return Err(voelin_query::Error::Closed), }; let full = relay_text(&self.config.format, nick, text); for part in split_message(&full, MAX_MESSAGE_BYTES) { @@ -155,7 +160,7 @@ async fn set_nickname(client: &QueryClient, base: &str) { let nickname = if attempt == 1 { base.to_string() } else { format!("{base} ({attempt})") }; match client.send(&Command::new("clientupdate").arg("client_nickname", &nickname)).await { Ok(_) => return, - Err(tsc_query::Error::Query(e)) if e.id == ERR_NICKNAME_IN_USE => continue, + Err(voelin_query::Error::Query(e)) if e.id == ERR_NICKNAME_IN_USE => continue, Err(e) => { warn!(%e, %nickname, "could not set relay nickname"); return; diff --git a/crates/tsc-platform/Cargo.toml b/crates/voelin-platform/Cargo.toml similarity index 94% rename from crates/tsc-platform/Cargo.toml rename to crates/voelin-platform/Cargo.toml index 09091b9..d55c6cc 100644 --- a/crates/tsc-platform/Cargo.toml +++ b/crates/voelin-platform/Cargo.toml @@ -1,7 +1,7 @@ [package] -name = "tsc-platform" +name = "voelin-platform" version = "0.1.0" -description = "Desktop integration: global push-to-talk hotkeys, notifications and app directories." +description = "Desktop integration: global push-to-talk hotkeys, notifications, app directories, crash reports and third-party notices." edition.workspace = true rust-version.workspace = true license.workspace = true diff --git a/crates/voelin-platform/src/crash.rs b/crates/voelin-platform/src/crash.rs new file mode 100644 index 0000000..ac87c8b --- /dev/null +++ b/crates/voelin-platform/src/crash.rs @@ -0,0 +1,456 @@ +//! Local crash reports (opt-in). +//! +//! [`install`] sets a panic hook that, while reports are enabled, writes one +//! plain-text file per panic into the reports directory: time, app version, +//! OS, thread, panic message and location, and a backtrace. Only the newest +//! [`DEFAULT_KEEP`] reports are kept. Nothing is ever uploaded: the UI lists +//! [`pending_reports`] after a crash and offers to open the folder (so the +//! user can attach a report to an issue) or [`clear`] it. +//! +//! The hook chains to the previous one, so panics still print to stderr and +//! abort or unwind as before. Reports may contain what a panic message +//! includes (e.g. a server address); they stay on the device. +//! +//! ```no_run +//! let dir = voelin_platform::crash::default_dir(); +//! voelin_platform::crash::set_app_version(env!("CARGO_PKG_VERSION")); +//! voelin_platform::crash::install(&dir, true); // the user's opt-in setting +//! for report in voelin_platform::crash::pending_reports()? { +//! println!("{}: {}", report.path.display(), report.summary); +//! } +//! # Ok::<(), std::io::Error>(()) +//! ``` + +use std::backtrace::Backtrace; +use std::cell::Cell; +use std::fmt::Write as _; +use std::io; +use std::panic::PanicHookInfo; +use std::path::{Path, PathBuf}; +use std::sync::atomic::{AtomicBool, AtomicU32, Ordering}; +use std::sync::{Mutex, MutexGuard, Once, PoisonError}; +use std::time::{Duration, SystemTime, UNIX_EPOCH}; + +use crate::{APP_NAME, paths}; + +/// Directory name of the reports under the state directory. +pub const DIR_NAME: &str = "crash-reports"; +/// Reports kept by default; older ones are deleted when a new one is written. +pub const DEFAULT_KEEP: usize = 10; + +const PREFIX: &str = "crash-"; +const SUFFIX: &str = ".txt"; + +/// `/crash-reports` (`%LOCALAPPDATA%\voelin\crash-reports` on +/// Windows, `~/.local/state/voelin/crash-reports` on Linux). +pub fn default_dir() -> PathBuf { + paths::state_dir().join(DIR_NAME) +} + +struct Config { + dir: Option, + version: String, + keep: usize, + /// Collected at install time, so the hook does no more IO than needed. + system: String, +} + +static CONFIG: Mutex = Mutex::new(Config { + dir: None, + version: String::new(), + keep: DEFAULT_KEEP, + system: String::new(), +}); +static ENABLED: AtomicBool = AtomicBool::new(false); +static HOOK: Once = Once::new(); +/// Orders reports written by this process within the same millisecond. +static SEQUENCE: AtomicU32 = AtomicU32::new(0); + +thread_local! { + /// Set while this thread writes a report: a panic inside the hook must not + /// recurse. + static IN_HOOK: Cell = const { Cell::new(false) }; +} + +fn config() -> MutexGuard<'static, Config> { + CONFIG.lock().unwrap_or_else(PoisonError::into_inner) +} + +/// Set the panic hook (once per process) and where reports go. `enabled` is +/// the user's opt-in; while it is false panics are not recorded. Calling it +/// again changes the directory and the switch. Existing reports older than +/// the newest [`DEFAULT_KEEP`] (or [`set_keep`]) are deleted. +pub fn install(dir: impl Into, enabled: bool) { + let dir = dir.into(); + { + let mut config = config(); + if config.version.is_empty() { + config.version = env!("CARGO_PKG_VERSION").into(); + } + config.system = system_info(); + prune(&dir, config.keep); + config.dir = Some(dir); + } + ENABLED.store(enabled, Ordering::SeqCst); + HOOK.call_once(|| { + let previous = std::panic::take_hook(); + std::panic::set_hook(Box::new(move |info| { + hook(info); + previous(info); + })); + }); +} + +/// Panic if the `VOELIN_TEST_CRASH` environment variable is set, so testers can +/// check crash reports with a release build (docs/testing/manual-matrix.md). +/// Call right after [`install`]. +pub fn test_crash_if_requested() { + if std::env::var_os("VOELIN_TEST_CRASH").is_some_and(|v| !v.is_empty()) { + panic!("test crash requested with VOELIN_TEST_CRASH"); + } +} + +/// Turn recording on or off (the settings switch). No effect before +/// [`install`]. +pub fn set_enabled(enabled: bool) { + ENABLED.store(enabled, Ordering::SeqCst); +} + +pub fn is_enabled() -> bool { + ENABLED.load(Ordering::SeqCst) +} + +/// The app's version for reports; defaults to this crate's version. Call +/// with the binary's `env!("CARGO_PKG_VERSION")`. +pub fn set_app_version(version: impl Into) { + config().version = version.into(); +} + +/// How many reports to keep (at least one). +pub fn set_keep(keep: usize) { + config().keep = keep.max(1); +} + +/// The directory given to [`install`]. +pub fn dir() -> Option { + config().dir.clone() +} + +/// A report on disk. +#[derive(Clone, Debug, PartialEq, Eq)] +pub struct Report { + pub path: PathBuf, + /// When the panic happened, from the file name. + pub time: SystemTime, + /// The panic message's first line. + pub summary: String, +} + +/// Reports in the [`install`]ed directory, oldest first; empty before +/// [`install`] or when the directory does not exist. +pub fn pending_reports() -> io::Result> { + match dir() { + Some(dir) => reports_in(&dir), + None => Ok(Vec::new()), + } +} + +/// Delete all reports in the [`install`]ed directory; returns how many. +pub fn clear() -> io::Result { + match dir() { + Some(dir) => clear_in(&dir), + None => Ok(0), + } +} + +/// Reports in `dir`, oldest first. +pub fn reports_in(dir: &Path) -> io::Result> { + let mut reports = Vec::new(); + for path in report_files(dir)? { + let Some(time) = path.file_name().and_then(|n| n.to_str()).and_then(parse_file_time) else { + continue; + }; + let text = std::fs::read_to_string(&path).unwrap_or_default(); + let summary = text + .lines() + .find_map(|line| line.strip_prefix("Message:")) + .map(|m| m.trim().to_string()) + .unwrap_or_default(); + reports.push(Report { path, time, summary }); + } + Ok(reports) +} + +/// Delete all reports in `dir`; returns how many. +pub fn clear_in(dir: &Path) -> io::Result { + let files = report_files(dir)?; + for path in &files { + std::fs::remove_file(path)?; + } + Ok(files.len()) +} + +/// Report files in `dir`, sorted by name, which is by time. +fn report_files(dir: &Path) -> io::Result> { + let entries = match std::fs::read_dir(dir) { + Ok(entries) => entries, + Err(e) if e.kind() == io::ErrorKind::NotFound => return Ok(Vec::new()), + Err(e) => return Err(e), + }; + let mut files: Vec = entries + .filter_map(|e| e.ok()) + .map(|e| e.path()) + .filter(|p| { + p.file_name() + .and_then(|n| n.to_str()) + .is_some_and(|n| n.starts_with(PREFIX) && n.ends_with(SUFFIX)) + }) + .collect(); + files.sort(); + Ok(files) +} + +/// Keep the newest `keep` reports. +fn prune(dir: &Path, keep: usize) { + if let Ok(files) = report_files(dir) { + for path in files.iter().take(files.len().saturating_sub(keep)) { + let _ = std::fs::remove_file(path); + } + } +} + +fn hook(info: &PanicHookInfo<'_>) { + if !is_enabled() || IN_HOOK.with(|h| h.replace(true)) { + return; + } + match write_report(info) { + Ok(Some(path)) => eprintln!("crash report written to {}", path.display()), + Ok(None) => {} + Err(e) => eprintln!("could not write a crash report: {e}"), + } + IN_HOOK.with(|h| h.set(false)); +} + +fn write_report(info: &PanicHookInfo<'_>) -> io::Result> { + // Captured before taking the lock: other threads may panic meanwhile. + let backtrace = Backtrace::force_capture(); + let (dir, version, keep, system) = { + let config = config(); + let Some(dir) = config.dir.clone() else { return Ok(None) }; + (dir, config.version.clone(), config.keep, config.system.clone()) + }; + let now = SystemTime::now(); + let thread = std::thread::current(); + let report = format_report(&ReportFields { + time: now, + version: &version, + system: &system, + thread: thread.name().unwrap_or(""), + thread_id: &format!("{:?}", thread.id()), + location: &info.location().map(|l| l.to_string()).unwrap_or_default(), + message: info.payload_as_str().unwrap_or(""), + backtrace: &backtrace.to_string(), + }); + + std::fs::create_dir_all(&dir)?; + let name = file_name(now, SEQUENCE.fetch_add(1, Ordering::SeqCst), std::process::id()); + let path = dir.join(&name); + // Written under another name first, so a half-written file is never listed. + let partial = dir.join(format!("{name}.partial")); + std::fs::write(&partial, report)?; + std::fs::rename(&partial, &path)?; + prune(&dir, keep); + Ok(Some(path)) +} + +struct ReportFields<'a> { + time: SystemTime, + version: &'a str, + system: &'a str, + thread: &'a str, + thread_id: &'a str, + location: &'a str, + message: &'a str, + backtrace: &'a str, +} + +fn format_report(r: &ReportFields<'_>) -> String { + let mut out = String::new(); + let _ = writeln!(out, "{APP_NAME} crash report"); + let _ = writeln!(out); + let _ = writeln!(out, "Time: {}", rfc3339(r.time)); + let _ = writeln!(out, "Version: {}", r.version); + let _ = writeln!(out, "System: {}", r.system); + let _ = writeln!(out, "Thread: {} ({})", r.thread, r.thread_id); + let _ = writeln!(out, "Location: {}", r.location); + // The message may span lines; the first stays on the "Message:" line. + let mut lines = r.message.lines(); + let _ = writeln!(out, "Message: {}", lines.next().unwrap_or("")); + for line in lines { + let _ = writeln!(out, " {line}"); + } + let _ = writeln!(out); + let _ = writeln!(out, "Backtrace:"); + let _ = writeln!(out, "{}", r.backtrace); + out +} + +/// OS, architecture, distribution and session: what helps to reproduce. +fn system_info() -> String { + let mut info = format!("{} {}", std::env::consts::OS, std::env::consts::ARCH); + #[cfg(target_os = "linux")] + { + let os_release = std::fs::read_to_string("/etc/os-release") + .or_else(|_| std::fs::read_to_string("/usr/lib/os-release")) + .unwrap_or_default(); + if let Some(name) = os_release + .lines() + .find_map(|l| l.strip_prefix("PRETTY_NAME=")) + .map(|v| v.trim_matches('"')) + { + let _ = write!(info, ", {name}"); + } + if let Ok(kernel) = std::fs::read_to_string("/proc/sys/kernel/osrelease") { + let _ = write!(info, ", kernel {}", kernel.trim()); + } + } + let _ = write!(info, ", {:?}", paths::display_server()); + if paths::is_flatpak() { + info.push_str(", Flatpak"); + } + info +} + +/// `crash-20260926T101500.123Z-0001-4242.txt`: time, sequence, process id. +/// Sorting the names sorts the reports by time. +fn file_name(time: SystemTime, sequence: u32, pid: u32) -> String { + let (date, clock, millis) = civil(time); + let (y, mo, d) = date; + let (h, mi, s) = clock; + format!( + "{PREFIX}{y:04}{mo:02}{d:02}T{h:02}{mi:02}{s:02}.{millis:03}Z-{:04}-{pid}{SUFFIX}", + sequence % 10_000 + ) +} + +/// The time from a name made by [`file_name`]. +fn parse_file_time(name: &str) -> Option { + let stamp = name.strip_prefix(PREFIX)?.get(..19)?; + let num = |range: std::ops::Range| stamp.get(range)?.parse::().ok(); + let (y, mo, d) = (num(0..4)?, num(4..6)?, num(6..8)?); + let (h, mi, s, ms) = (num(9..11)?, num(11..13)?, num(13..15)?, num(16..19)?); + if stamp.as_bytes()[8] != b'T' || stamp.as_bytes()[15] != b'.' || !(1..=12).contains(&mo) { + return None; + } + let days = days_from_civil(y as i64, mo as u32, d as u32); + let secs = u64::try_from(days).ok()? * 86_400 + h * 3600 + mi * 60 + s; + Some(UNIX_EPOCH + Duration::from_secs(secs) + Duration::from_millis(ms)) +} + +/// UTC, `2026-09-26T10:15:00.123Z`. +fn rfc3339(time: SystemTime) -> String { + let ((y, mo, d), (h, mi, s), ms) = civil(time); + format!("{y:04}-{mo:02}-{d:02}T{h:02}:{mi:02}:{s:02}.{ms:03}Z") +} + +type Date = (i64, u32, u32); +type Clock = (u32, u32, u32); + +/// UTC calendar date, time of day and milliseconds (clamped to the epoch). +fn civil(time: SystemTime) -> (Date, Clock, u32) { + let since = time.duration_since(UNIX_EPOCH).unwrap_or_default(); + let secs = since.as_secs(); + let days = (secs / 86_400) as i64; + let rem = (secs % 86_400) as u32; + (civil_from_days(days), (rem / 3600, rem / 60 % 60, rem % 60), since.subsec_millis()) +} + +// Howard Hinnant's algorithms (http://howardhinnant.github.io/date_algorithms.html). +fn civil_from_days(days: i64) -> Date { + let z = days + 719_468; + let era = z.div_euclid(146_097); + let doe = z.rem_euclid(146_097); + let yoe = (doe - doe / 1460 + doe / 36_524 - doe / 146_096) / 365; + let doy = doe - (365 * yoe + yoe / 4 - yoe / 100); + let mp = (5 * doy + 2) / 153; + let d = (doy - (153 * mp + 2) / 5 + 1) as u32; + let m = if mp < 10 { mp + 3 } else { mp - 9 } as u32; + let y = yoe + era * 400 + i64::from(m <= 2); + (y, m, d) +} + +fn days_from_civil(y: i64, m: u32, d: u32) -> i64 { + let y = if m <= 2 { y - 1 } else { y }; + let era = y.div_euclid(400); + let yoe = y.rem_euclid(400); + let mp = i64::from(if m > 2 { m - 3 } else { m + 9 }); + let doy = (153 * mp + 2) / 5 + i64::from(d) - 1; + let doe = yoe * 365 + yoe / 4 - yoe / 100 + doy; + era * 146_097 + doe - 719_468 +} + +#[cfg(test)] +mod tests { + use super::*; + + fn at(secs: u64, millis: u64) -> SystemTime { + UNIX_EPOCH + Duration::from_secs(secs) + Duration::from_millis(millis) + } + + #[test] + fn dates() { + assert_eq!(rfc3339(UNIX_EPOCH), "1970-01-01T00:00:00.000Z"); + // 2026-09-26T10:15:00Z + assert_eq!(rfc3339(at(1_790_417_700, 123)), "2026-09-26T10:15:00.123Z"); + // Leap day. + assert_eq!(rfc3339(at(951_825_600, 0)), "2000-02-29T12:00:00.000Z"); + for days in [-1, 0, 59, 60, 365, 11_016, 20_722, 40_000] { + let (y, m, d) = civil_from_days(days); + assert_eq!(days_from_civil(y, m, d), days); + } + } + + #[test] + fn file_names_sort_and_parse() { + let time = at(1_790_417_700, 7); + let name = file_name(time, 3, 4242); + assert_eq!(name, "crash-20260926T101500.007Z-0003-4242.txt"); + assert_eq!(parse_file_time(&name), Some(time)); + assert!(file_name(time, 3, 1) < file_name(time, 4, 1)); + assert!(file_name(time, 9, 1) < file_name(at(1_790_417_700, 8), 0, 1)); + assert_eq!(parse_file_time("crash-garbage.txt"), None); + assert_eq!(parse_file_time("crash-20261326T101500.007Z-0-1.txt"), None); + } + + #[test] + fn report_format() { + let report = format_report(&ReportFields { + time: at(1_790_417_700, 0), + version: "1.2.3", + system: "linux x86_64", + thread: "audio", + thread_id: "ThreadId(7)", + location: "src/audio.rs:10:5", + message: "first\nsecond", + backtrace: " 0: frame", + }); + assert!(report.starts_with(&format!("{APP_NAME} crash report\n"))); + assert!(report.contains("Time: 2026-09-26T10:15:00.000Z\n")); + assert!(report.contains("Version: 1.2.3\n")); + assert!(report.contains("Thread: audio (ThreadId(7))\n")); + assert!(report.contains("Message: first\n second\n")); + assert!(report.contains("Backtrace:\n 0: frame\n")); + } + + #[test] + fn system_info_names_os() { + assert!(system_info().starts_with(std::env::consts::OS)); + } + + #[test] + fn missing_dir_has_no_reports() { + let dir = std::env::temp_dir().join(format!("voelin-crash-missing-{}", std::process::id())); + assert!(reports_in(&dir).unwrap().is_empty()); + assert_eq!(clear_in(&dir).unwrap(), 0); + } +} diff --git a/crates/tsc-platform/src/hotkey/key.rs b/crates/voelin-platform/src/hotkey/key.rs similarity index 100% rename from crates/tsc-platform/src/hotkey/key.rs rename to crates/voelin-platform/src/hotkey/key.rs diff --git a/crates/tsc-platform/src/hotkey/mod.rs b/crates/voelin-platform/src/hotkey/mod.rs similarity index 100% rename from crates/tsc-platform/src/hotkey/mod.rs rename to crates/voelin-platform/src/hotkey/mod.rs diff --git a/crates/tsc-platform/src/hotkey/portal.rs b/crates/voelin-platform/src/hotkey/portal.rs similarity index 100% rename from crates/tsc-platform/src/hotkey/portal.rs rename to crates/voelin-platform/src/hotkey/portal.rs diff --git a/crates/tsc-platform/src/hotkey/tracker.rs b/crates/voelin-platform/src/hotkey/tracker.rs similarity index 100% rename from crates/tsc-platform/src/hotkey/tracker.rs rename to crates/voelin-platform/src/hotkey/tracker.rs diff --git a/crates/tsc-platform/src/hotkey/windows.rs b/crates/voelin-platform/src/hotkey/windows.rs similarity index 99% rename from crates/tsc-platform/src/hotkey/windows.rs rename to crates/voelin-platform/src/hotkey/windows.rs index 4ec8591..1f41e5d 100644 --- a/crates/tsc-platform/src/hotkey/windows.rs +++ b/crates/voelin-platform/src/hotkey/windows.rs @@ -149,7 +149,7 @@ impl HookBackend { { let tracker = tracker.clone(); thread::Builder::new() - .name("tsc-hotkeys-hook".into()) + .name("voelin-hotkeys-hook".into()) .spawn(move || hook_thread(tracker, ready_tx)) .map_err(|e| Error::Backend(format!("keyboard hook: {e}")))?; } diff --git a/crates/tsc-platform/src/hotkey/x11.rs b/crates/voelin-platform/src/hotkey/x11.rs similarity index 99% rename from crates/tsc-platform/src/hotkey/x11.rs rename to crates/voelin-platform/src/hotkey/x11.rs index e587ae4..3f07da2 100644 --- a/crates/tsc-platform/src/hotkey/x11.rs +++ b/crates/voelin-platform/src/hotkey/x11.rs @@ -122,7 +122,7 @@ impl X11Backend { { let (conn, tracker, stop) = (conn.clone(), tracker.clone(), stop.clone()); thread::Builder::new() - .name("tsc-hotkeys-x11".into()) + .name("voelin-hotkeys-x11".into()) .spawn(move || event_loop(&conn, keymap, &tracker, &stop)) .map_err(|e| Error::Backend(format!("X11: {e}")))?; } diff --git a/crates/tsc-platform/src/lib.rs b/crates/voelin-platform/src/lib.rs similarity index 65% rename from crates/tsc-platform/src/lib.rs rename to crates/voelin-platform/src/lib.rs index 1edf2e4..aa406ff 100644 --- a/crates/tsc-platform/src/lib.rs +++ b/crates/voelin-platform/src/lib.rs @@ -5,19 +5,23 @@ //! Windows) //! - [`notify`]: desktop notifications //! - [`paths`]: data, config, cache and state directories +//! - [`crash`]: opt-in local crash reports (panic hook) +//! - [`notices`]: third-party notices for the About page +pub mod crash; pub mod hotkey; +pub mod notices; pub mod notify; pub mod paths; pub use hotkey::{BackendKind, Hotkey, HotkeyEvent, HotkeyEvents, HotkeyManager, Key, Modifiers}; pub use notify::{Notification, notify}; -/// Application id: desktop file, icon, portal registrations. A placeholder -/// until the product has a name. -pub const APP_ID: &str = "io.github.faumaray.TsClient"; -/// Name shown in notifications. A placeholder until the product has a name. -pub const APP_NAME: &str = "TS Client"; +/// Application id: desktop file, icon, portal registrations. It cannot change +/// once published on Flathub or Google Play. +pub const APP_ID: &str = "io.github.faumaray.Voelin"; +/// Name shown in notifications and window titles. +pub const APP_NAME: &str = "Voelin"; #[derive(Debug, thiserror::Error)] pub enum Error { diff --git a/crates/voelin-platform/src/notices.rs b/crates/voelin-platform/src/notices.rs new file mode 100644 index 0000000..b590c92 --- /dev/null +++ b/crates/voelin-platform/src/notices.rs @@ -0,0 +1,36 @@ +//! Third-party notices for the About page. +//! +//! `THIRD_PARTY_NOTICES.md` at the repository root is generated from +//! `Cargo.lock` by `scripts/notices.sh` (cargo-about) and embedded here; CI +//! fails when it is stale. It is Markdown: an introduction (Slint, OpenH264, +//! tsclientlib, native libraries), then each license text in a fenced block +//! with the crates that use it. About 500 KB, so show it in a scrolling view +//! (or write it to a file and open that), not in a single label. + +/// The full notices, Markdown. +pub fn text() -> &'static str { + include_str!("../../../THIRD_PARTY_NOTICES.md") +} + +/// Attribution the OpenH264 license asks for wherever H.264 can be enabled +/// (the same text as `voelin_media::codec::h264::OPENH264_ATTRIBUTION`). +pub const OPENH264_ATTRIBUTION: &str = "OpenH264 Video Codec provided by Cisco Systems, Inc."; + +#[cfg(test)] +mod tests { + use super::*; + + #[test] + fn notices_cover_required_attributions() { + let text = text(); + assert!(text.starts_with("# Third-party notices")); + // Slint's royalty-free license text, OpenH264 and the vendored + // protocol library must be credited. + assert!(text.contains("Slint Royalty-free Desktop, Mobile, and Web Applications License")); + assert!(text.contains(OPENH264_ATTRIBUTION)); + assert!(text.contains("tsclientlib contributors")); + // Bundled C libraries. + assert!(text.contains("Xiph.Org")); + assert!(text.contains("The WebM Project authors")); + } +} diff --git a/crates/tsc-platform/src/notify.rs b/crates/voelin-platform/src/notify.rs similarity index 100% rename from crates/tsc-platform/src/notify.rs rename to crates/voelin-platform/src/notify.rs diff --git a/crates/tsc-platform/src/paths.rs b/crates/voelin-platform/src/paths.rs similarity index 71% rename from crates/tsc-platform/src/paths.rs rename to crates/voelin-platform/src/paths.rs index 1ceac52..f24612e 100644 --- a/crates/tsc-platform/src/paths.rs +++ b/crates/voelin-platform/src/paths.rs @@ -1,6 +1,6 @@ //! Where the app keeps its files. //! -//! `/tsc` for the platform's data, config, cache and state bases (XDG +//! `/voelin` for the platform's data, config, cache and state bases (XDG //! on Linux, where Flatpak points them into `~/.var/app//`; Known //! Folders on Windows: `%APPDATA%` for data and config, `%LOCALAPPDATA%` for //! cache and state). Each can be overridden with an environment variable, @@ -9,8 +9,8 @@ use std::path::{Path, PathBuf}; /// Directory name under each base; the desktop app's store already lives in -/// `/tsc`. -pub const APP_DIR: &str = "tsc"; +/// `/voelin`. +pub const APP_DIR: &str = "voelin"; fn resolve(var: &str, base: Option) -> PathBuf { match std::env::var_os(var).filter(|v| !v.is_empty()) { @@ -19,24 +19,24 @@ fn resolve(var: &str, base: Option) -> PathBuf { } } -/// Identities, bookmarks, chat history. `TSC_DATA_DIR` overrides. +/// Identities, bookmarks, chat history. `VOELIN_DATA_DIR` overrides. pub fn data_dir() -> PathBuf { - resolve("TSC_DATA_DIR", dirs::data_dir()) + resolve("VOELIN_DATA_DIR", dirs::data_dir()) } -/// Settings files. `TSC_CONFIG_DIR` overrides. +/// Settings files. `VOELIN_CONFIG_DIR` overrides. pub fn config_dir() -> PathBuf { - resolve("TSC_CONFIG_DIR", dirs::config_dir()) + resolve("VOELIN_CONFIG_DIR", dirs::config_dir()) } -/// Disposable files (avatars, downloaded codecs). `TSC_CACHE_DIR` overrides. +/// Disposable files (avatars, downloaded codecs). `VOELIN_CACHE_DIR` overrides. pub fn cache_dir() -> PathBuf { - resolve("TSC_CACHE_DIR", dirs::cache_dir()) + resolve("VOELIN_CACHE_DIR", dirs::cache_dir()) } -/// Logs and crash reports. `TSC_STATE_DIR` overrides. +/// Logs and crash reports. `VOELIN_STATE_DIR` overrides. pub fn state_dir() -> PathBuf { - resolve("TSC_STATE_DIR", dirs::state_dir().or_else(dirs::data_local_dir)) + resolve("VOELIN_STATE_DIR", dirs::state_dir().or_else(dirs::data_local_dir)) } /// Create `dir` and its parents if needed. @@ -86,10 +86,10 @@ mod tests { assert!(dir.is_absolute() || dir.starts_with("."), "{}", dir.display()); } assert_eq!( - resolve("TSC_TEST_UNSET_VARIABLE", Some("/base".into())), - Path::new("/base/tsc") + resolve("VOELIN_TEST_UNSET_VARIABLE", Some("/base".into())), + Path::new("/base/voelin") ); - assert_eq!(resolve("TSC_TEST_UNSET_VARIABLE", None), Path::new("./tsc")); + assert_eq!(resolve("VOELIN_TEST_UNSET_VARIABLE", None), Path::new("./voelin")); // PATH is always set: stands in for an override. let path = std::env::var_os("PATH").unwrap(); assert_eq!(resolve("PATH", Some("/base".into())), PathBuf::from(path)); @@ -98,7 +98,7 @@ mod tests { #[test] fn ensure_creates() { let dir = - std::env::temp_dir().join(format!("tsc-platform-{}", std::process::id())).join("a"); + std::env::temp_dir().join(format!("voelin-platform-{}", std::process::id())).join("a"); assert_eq!(ensure(&dir).unwrap(), dir); assert!(dir.is_dir()); std::fs::remove_dir_all(dir.parent().unwrap()).unwrap(); diff --git a/crates/voelin-platform/tests/crash.rs b/crates/voelin-platform/tests/crash.rs new file mode 100644 index 0000000..67a26eb --- /dev/null +++ b/crates/voelin-platform/tests/crash.rs @@ -0,0 +1,117 @@ +//! The crash report panic hook, with real panics in threads and in a child +//! process. Its own test binary: the hook is process-wide. + +use std::path::PathBuf; +use std::thread; + +use voelin_platform::crash; + +fn temp_dir(name: &str) -> PathBuf { + let dir = std::env::temp_dir().join(format!("voelin-crash-{name}-{}", std::process::id())); + let _ = std::fs::remove_dir_all(&dir); + dir +} + +/// Panic in a named thread and wait for it. +fn panic_in_thread(name: &str, message: String) { + let result = + thread::Builder::new().name(name.into()).spawn(move || panic!("{message}")).unwrap().join(); + assert!(result.is_err(), "the thread should have panicked"); +} + +// The only test that installs the hook in this process: the hook and its +// settings are global. The child process test below only spawns. +#[test] +fn panic_hook_writes_reports() { + let dir = temp_dir("hook"); + crash::set_app_version("9.8.7-test"); + crash::install(&dir, false); + assert_eq!(crash::dir().as_deref(), Some(dir.as_path())); + + // Disabled: nothing is written. + panic_in_thread("quiet", "not recorded".into()); + assert!(crash::pending_reports().unwrap().is_empty()); + + // Enabled: one report with the details. + crash::set_enabled(true); + assert!(crash::is_enabled()); + panic_in_thread("crash-test", "boom 42\nsecond line".into()); + let reports = crash::pending_reports().unwrap(); + assert_eq!(reports.len(), 1, "{reports:?}"); + let report = &reports[0]; + assert_eq!(report.summary, "boom 42"); + let age = report.time.elapsed().unwrap_or_default(); + assert!(age.as_secs() < 60, "report time {:?} ago", age); + let text = std::fs::read_to_string(&report.path).unwrap(); + eprintln!("{text}"); + assert!(text.contains("Version: 9.8.7-test"), "{text}"); + assert!(text.contains("Thread: crash-test ("), "{text}"); + assert!(text.contains("Message: boom 42\n second line"), "{text}"); + assert!(text.contains(&format!("System: {}", std::env::consts::OS)), "{text}"); + // The path separator is the platform's. + let location = text.lines().find(|l| l.starts_with("Location: ")).unwrap_or_default(); + assert!(location.contains("tests") && location.contains("crash.rs:"), "{text}"); + assert!(text.contains("Backtrace:\n"), "{text}"); + // Symbols resolve on Linux (MSVC needs the PDB files next to the binary). + if cfg!(target_os = "linux") { + assert!(text.contains("panic_in_thread"), "{text}"); + } + // No partial files are left behind. + assert_eq!(std::fs::read_dir(&dir).unwrap().count(), 1); + + // Only the newest reports are kept. + crash::set_keep(3); + for i in 0..5 { + panic_in_thread("crash-test", format!("panic {i}")); + } + let summaries: Vec<_> = + crash::pending_reports().unwrap().into_iter().map(|r| r.summary).collect(); + assert_eq!(summaries, ["panic 2", "panic 3", "panic 4"]); + + // Reports survive a restart (a new install) and can be deleted. + crash::install(&dir, true); + assert_eq!(crash::pending_reports().unwrap().len(), 3); + assert_eq!(crash::clear().unwrap(), 3); + assert!(crash::pending_reports().unwrap().is_empty()); + + // A directory that does not exist yet is created on the first report. + let nested = dir.join("a").join("b"); + crash::install(&nested, true); + panic_in_thread("crash-test", "into a new directory".into()); + assert_eq!(crash::reports_in(&nested).unwrap().len(), 1); + + crash::set_enabled(false); + std::fs::remove_dir_all(&dir).unwrap(); +} + +/// Runs only as the child of `test_crash_in_child_process`: a start with +/// `VOELIN_TEST_CRASH` set, as a tester would do with the app. +#[test] +fn child_process_crash() { + let Some(dir) = std::env::var_os("VOELIN_CRASH_CHILD_DIR") else { return }; + crash::set_app_version("child"); + crash::install(PathBuf::from(dir), true); + crash::test_crash_if_requested(); + unreachable!("VOELIN_TEST_CRASH is set"); +} + +#[test] +fn test_crash_in_child_process() { + let dir = temp_dir("child"); + // Captured: the child's "FAILED" would look like a failure of this run. + let output = std::process::Command::new(std::env::current_exe().unwrap()) + .args(["--exact", "child_process_crash", "--test-threads=1"]) + .env("VOELIN_CRASH_CHILD_DIR", &dir) + .env("VOELIN_TEST_CRASH", "1") + .output() + .unwrap(); + let log = String::from_utf8_lossy(&output.stderr); + assert!(!output.status.success(), "the child should have panicked: {log}"); + // The next start finds the report. + let reports = crash::reports_in(&dir).unwrap(); + assert_eq!(reports.len(), 1, "{reports:?}"); + assert_eq!(reports[0].summary, "test crash requested with VOELIN_TEST_CRASH"); + let text = std::fs::read_to_string(&reports[0].path).unwrap(); + assert!(text.contains("Version: child"), "{text}"); + std::fs::remove_dir_all(&dir).unwrap(); +} diff --git a/crates/tsc-platform/tests/x11.rs b/crates/voelin-platform/tests/x11.rs similarity index 93% rename from crates/tsc-platform/tests/x11.rs rename to crates/voelin-platform/tests/x11.rs index 15d12d9..9a74d7d 100644 --- a/crates/tsc-platform/tests/x11.rs +++ b/crates/voelin-platform/tests/x11.rs @@ -1,6 +1,6 @@ //! Global hotkeys against a real X server, typing through XTEST. //! -//! Needs `TSC_X11_TEST_DISPLAY` naming a display to use (e.g. an Xvfb +//! Needs `VOELIN_X11_TEST_DISPLAY` naming a display to use (e.g. an Xvfb //! started for the test, as CI does); skipped otherwise. #![cfg(all(unix, not(target_os = "macos"), feature = "x11"))] @@ -8,7 +8,7 @@ use std::time::Duration; use tokio::time::timeout; -use tsc_platform::{HotkeyEvent, HotkeyEvents, HotkeyManager}; +use voelin_platform::{HotkeyEvent, HotkeyEvents, HotkeyManager}; use x11rb::connection::Connection; use x11rb::protocol::xproto::{ BUTTON_PRESS_EVENT, BUTTON_RELEASE_EVENT, ConnectionExt as _, KEY_PRESS_EVENT, @@ -68,8 +68,8 @@ const XK_A: u32 = 0x61; #[tokio::test] async fn xinput2_press_and_release() { - let Ok(display) = std::env::var("TSC_X11_TEST_DISPLAY") else { - eprintln!("TSC_X11_TEST_DISPLAY not set, skipping"); + let Ok(display) = std::env::var("VOELIN_X11_TEST_DISPLAY") else { + eprintln!("VOELIN_X11_TEST_DISPLAY not set, skipping"); return; }; let mut manager = HotkeyManager::x11(&display).unwrap(); diff --git a/crates/tsc-query/Cargo.toml b/crates/voelin-query/Cargo.toml similarity index 97% rename from crates/tsc-query/Cargo.toml rename to crates/voelin-query/Cargo.toml index 37dcdb3..ab03299 100644 --- a/crates/tsc-query/Cargo.toml +++ b/crates/voelin-query/Cargo.toml @@ -1,5 +1,5 @@ [package] -name = "tsc-query" +name = "voelin-query" version = "0.1.0" description = "TeamSpeak ServerQuery client: raw TCP, SSH and HTTP WebQuery transports." edition.workspace = true diff --git a/crates/tsc-query/src/client.rs b/crates/voelin-query/src/client.rs similarity index 100% rename from crates/tsc-query/src/client.rs rename to crates/voelin-query/src/client.rs diff --git a/crates/tsc-query/src/codec.rs b/crates/voelin-query/src/codec.rs similarity index 99% rename from crates/tsc-query/src/codec.rs rename to crates/voelin-query/src/codec.rs index ee25ba6..3f21244 100644 --- a/crates/tsc-query/src/codec.rs +++ b/crates/voelin-query/src/codec.rs @@ -185,7 +185,7 @@ pub fn parse_line(line: &str) -> Line { /// A command to send, built with escaping applied. /// /// ``` -/// use tsc_query::Command; +/// use voelin_query::Command; /// let cmd = Command::new("sendtextmessage").arg("targetmode", 3).arg("msg", "hi there"); /// assert_eq!(cmd.to_line(), "sendtextmessage targetmode=3 msg=hi\\sthere"); /// ``` diff --git a/crates/tsc-query/src/http.rs b/crates/voelin-query/src/http.rs similarity index 100% rename from crates/tsc-query/src/http.rs rename to crates/voelin-query/src/http.rs diff --git a/crates/tsc-query/src/lib.rs b/crates/voelin-query/src/lib.rs similarity index 100% rename from crates/tsc-query/src/lib.rs rename to crates/voelin-query/src/lib.rs diff --git a/crates/tsc-query/src/line.rs b/crates/voelin-query/src/line.rs similarity index 100% rename from crates/tsc-query/src/line.rs rename to crates/voelin-query/src/line.rs diff --git a/crates/tsc-query/src/ssh.rs b/crates/voelin-query/src/ssh.rs similarity index 100% rename from crates/tsc-query/src/ssh.rs rename to crates/voelin-query/src/ssh.rs diff --git a/crates/tsc-store/Cargo.toml b/crates/voelin-store/Cargo.toml similarity index 96% rename from crates/tsc-store/Cargo.toml rename to crates/voelin-store/Cargo.toml index 24fb376..94f9b2b 100644 --- a/crates/tsc-store/Cargo.toml +++ b/crates/voelin-store/Cargo.toml @@ -1,5 +1,5 @@ [package] -name = "tsc-store" +name = "voelin-store" version = "0.1.0" description = "Local persistence: identities, bookmarks, settings, chat cache and secrets." edition.workspace = true diff --git a/crates/tsc-store/src/lib.rs b/crates/voelin-store/src/lib.rs similarity index 100% rename from crates/tsc-store/src/lib.rs rename to crates/voelin-store/src/lib.rs diff --git a/crates/tsc-store/src/secrets.rs b/crates/voelin-store/src/secrets.rs similarity index 100% rename from crates/tsc-store/src/secrets.rs rename to crates/voelin-store/src/secrets.rs diff --git a/crates/tsc-store/src/store.rs b/crates/voelin-store/src/store.rs similarity index 98% rename from crates/tsc-store/src/store.rs rename to crates/voelin-store/src/store.rs index 8b43bc2..10a6c17 100644 --- a/crates/tsc-store/src/store.rs +++ b/crates/voelin-store/src/store.rs @@ -89,7 +89,7 @@ pub struct Bookmark { pub gateway_url: Option, /// Own ServerQuery credentials (the password is kept in [`crate::Secrets`]). pub query: Option, - /// Signed client version to present (`tsctl versions` spec), `None` for the default. + /// Signed client version to present (`voelinctl versions` spec), `None` for the default. pub client_version: Option, } @@ -432,7 +432,7 @@ mod tests { #[test] fn reopen_keeps_data_and_schema() { - let dir = std::env::temp_dir().join(format!("tsc-store-{}", std::process::id())); + let dir = std::env::temp_dir().join(format!("voelin-store-{}", std::process::id())); let path = dir.join("client.db"); { let store = Store::open(&path).unwrap(); diff --git a/crates/tsc-stream/Cargo.toml b/crates/voelin-stream/Cargo.toml similarity index 97% rename from crates/tsc-stream/Cargo.toml rename to crates/voelin-stream/Cargo.toml index 1464d8b..04b5e1d 100644 --- a/crates/tsc-stream/Cargo.toml +++ b/crates/voelin-stream/Cargo.toml @@ -1,5 +1,5 @@ [package] -name = "tsc-stream" +name = "voelin-stream" version = "0.1.0" description = "TeamSpeak 6 streams: signalling commands, JSON signal messages and WebRTC peers (str0m)." edition.workspace = true diff --git a/crates/tsc-stream/src/lib.rs b/crates/voelin-stream/src/lib.rs similarity index 100% rename from crates/tsc-stream/src/lib.rs rename to crates/voelin-stream/src/lib.rs diff --git a/crates/tsc-stream/src/peer.rs b/crates/voelin-stream/src/peer.rs similarity index 100% rename from crates/tsc-stream/src/peer.rs rename to crates/voelin-stream/src/peer.rs diff --git a/crates/tsc-stream/src/proto.rs b/crates/voelin-stream/src/proto.rs similarity index 100% rename from crates/tsc-stream/src/proto.rs rename to crates/voelin-stream/src/proto.rs diff --git a/crates/tsc-stream/src/session.rs b/crates/voelin-stream/src/session.rs similarity index 100% rename from crates/tsc-stream/src/session.rs rename to crates/voelin-stream/src/session.rs diff --git a/crates/tsc-stream/src/signal.rs b/crates/voelin-stream/src/signal.rs similarity index 100% rename from crates/tsc-stream/src/signal.rs rename to crates/voelin-stream/src/signal.rs diff --git a/crates/tsc-stream/src/source.rs b/crates/voelin-stream/src/source.rs similarity index 96% rename from crates/tsc-stream/src/source.rs rename to crates/voelin-stream/src/source.rs index 23bb948..69caa57 100644 --- a/crates/tsc-stream/src/source.rs +++ b/crates/voelin-stream/src/source.rs @@ -1,8 +1,8 @@ //! Where a streamer's encoded frames come from. //! -//! [`FrameSource`] is the seam between capture/encoding (`tsc-media`) and the +//! [`FrameSource`] is the seam between capture/encoding (`voelin-media`) and the //! stream sessions. [`SyntheticSource`] produces decodable placeholder media -//! without any encoder, for tests and `tsctl stream start --synthetic`. +//! without any encoder, for tests and `voelinctl stream start --synthetic`. use std::sync::Arc; use std::time::{Duration, Instant}; diff --git a/crates/tsc-stream/src/stun.rs b/crates/voelin-stream/src/stun.rs similarity index 100% rename from crates/tsc-stream/src/stun.rs rename to crates/voelin-stream/src/stun.rs diff --git a/crates/tsc-stream/tests/browser_interop.rs b/crates/voelin-stream/tests/browser_interop.rs similarity index 95% rename from crates/tsc-stream/tests/browser_interop.rs rename to crates/voelin-stream/tests/browser_interop.rs index 2d0cf13..43a58eb 100644 --- a/crates/tsc-stream/tests/browser_interop.rs +++ b/crates/voelin-stream/tests/browser_interop.rs @@ -2,7 +2,7 @@ //! other peer, driven by `tests/interop/browser-peer.cjs` over stdin/stdout. //! No TeamSpeak server is involved; SDP goes straight between the peers. //! -//! Runs only with `TSC_INTEROP=1` (see `tests/interop/README.md`). +//! Runs only with `VOELIN_INTEROP=1` (see `tests/interop/README.md`). use std::path::PathBuf; use std::process::Stdio; @@ -12,12 +12,12 @@ use serde_json::{Value, json}; use tokio::io::{AsyncBufReadExt, AsyncWriteExt, BufReader, Lines}; use tokio::process::{Child, ChildStdin, ChildStdout, Command}; use tokio::time::timeout; -use tsc_stream::{ +use voelin_stream::{ Codec, FrameSource, MediaKind, Peer, PeerConfig, PeerEvent, Signal, SyntheticSource, }; fn enabled() -> bool { - std::env::var("TSC_INTEROP").is_ok_and(|v| v == "1") + std::env::var("VOELIN_INTEROP").is_ok_and(|v| v == "1") } /// The Node.js side (headless Chromium). @@ -33,7 +33,7 @@ impl Browser { .join("../../tests/interop/browser-peer.cjs") .canonicalize() .expect("tests/interop/browser-peer.cjs"); - let node = std::env::var("TSC_NODE").unwrap_or_else(|_| "node".into()); + let node = std::env::var("VOELIN_NODE").unwrap_or_else(|_| "node".into()); let mut command = Command::new(node); command .arg(script) @@ -47,7 +47,7 @@ impl Browser { { command.env("NODE_PATH", String::from_utf8_lossy(&out.stdout).trim()); } - let mut child = command.spawn().expect("cannot start node (set TSC_NODE)"); + let mut child = command.spawn().expect("cannot start node (set VOELIN_NODE)"); let stdin = child.stdin.take().unwrap(); let stdout = BufReader::new(child.stdout.take().unwrap()).lines(); let mut browser = Self { _child: child, stdin, stdout }; @@ -99,7 +99,7 @@ async fn wait_connected(peer: &mut Peer) { #[tokio::test(flavor = "multi_thread")] async fn rust_streams_to_browser() { if !enabled() { - eprintln!("skipped: set TSC_INTEROP=1 (needs node, Playwright and Chromium)"); + eprintln!("skipped: set VOELIN_INTEROP=1 (needs node, Playwright and Chromium)"); return; } let _ = tracing_subscriber::fmt().with_env_filter("warn").with_test_writer().try_init(); @@ -173,7 +173,7 @@ async fn fake_stun_server() -> std::net::SocketAddr { #[tokio::test(flavor = "multi_thread")] async fn trickled_candidates_reach_browser() { if !enabled() { - eprintln!("skipped: set TSC_INTEROP=1 (needs node, Playwright and Chromium)"); + eprintln!("skipped: set VOELIN_INTEROP=1 (needs node, Playwright and Chromium)"); return; } let mut browser = Browser::start().await; @@ -270,7 +270,7 @@ async fn receive(peer: &mut Peer, limit: Duration, enough: usize) -> Received { #[tokio::test(flavor = "multi_thread")] async fn browser_streams_to_rust() { if !enabled() { - eprintln!("skipped: set TSC_INTEROP=1 (needs node, Playwright and Chromium)"); + eprintln!("skipped: set VOELIN_INTEROP=1 (needs node, Playwright and Chromium)"); return; } let _ = tracing_subscriber::fmt().with_env_filter("warn").with_test_writer().try_init(); diff --git a/crates/tsc-stream/tests/live_ts6.rs b/crates/voelin-stream/tests/live_ts6.rs similarity index 96% rename from crates/tsc-stream/tests/live_ts6.rs rename to crates/voelin-stream/tests/live_ts6.rs index f285632..a84ce81 100644 --- a/crates/tsc-stream/tests/live_ts6.rs +++ b/crates/voelin-stream/tests/live_ts6.rs @@ -1,27 +1,27 @@ //! A full stream between two clients through the TeamSpeak 6 dev server //! (dev/docker-compose.yml): `setupstream`, `joinstreamrequest`, //! `respondjoinstreamrequest` with our offer, `streamsignaling` with the answer, -//! then media over loopback. Runs only with `TSC_LIVE=1`. +//! then media over loopback. Runs only with `VOELIN_LIVE=1`. use std::time::Duration; use futures::prelude::*; use tokio::sync::{mpsc, oneshot}; use tokio::time::timeout; -use tsc_stream::{ - Frequency, LeaveReason, MediaKind, MediaTime, Peer, PeerConfig, PeerEvent, Signal, - StreamNotification, StreamSetup, proto, -}; use tsclientlib::prelude::*; use tsclientlib::{ClientId, Connection, DisconnectOptions, MessageHandle, StreamItem}; use tsproto_packets::packets::OutCommand; +use voelin_stream::{ + Frequency, LeaveReason, MediaKind, MediaTime, Peer, PeerConfig, PeerEvent, Signal, + StreamNotification, StreamSetup, proto, +}; fn live() -> bool { - std::env::var("TSC_LIVE").is_ok_and(|v| v == "1") + std::env::var("VOELIN_LIVE").is_ok_and(|v| v == "1") } fn ts6_addr() -> String { - std::env::var("TSC_TS6_ADDR").unwrap_or_else(|_| "127.0.0.1:9988".into()) + std::env::var("VOELIN_TS6_ADDR").unwrap_or_else(|_| "127.0.0.1:9988".into()) } type Reply = oneshot::Sender>; @@ -114,7 +114,7 @@ impl Client { #[tokio::test(flavor = "multi_thread")] async fn stream_through_ts6_server() { if !live() { - eprintln!("skipped: set TSC_LIVE=1 with the dev servers running"); + eprintln!("skipped: set VOELIN_LIVE=1 with the dev servers running"); return; } let _ = tracing_subscriber::fmt().with_env_filter("warn").with_test_writer().try_init(); diff --git a/crates/tsc-stream/tests/loopback.rs b/crates/voelin-stream/tests/loopback.rs similarity index 92% rename from crates/tsc-stream/tests/loopback.rs rename to crates/voelin-stream/tests/loopback.rs index f7dce8b..ab3aa3c 100644 --- a/crates/tsc-stream/tests/loopback.rs +++ b/crates/voelin-stream/tests/loopback.rs @@ -3,7 +3,7 @@ use std::time::Duration; use tokio::time::timeout; -use tsc_stream::{MediaKind, MediaTime, Peer, PeerConfig, PeerEvent}; +use voelin_stream::{MediaKind, MediaTime, Peer, PeerConfig, PeerEvent}; /// Bytes that look like a VP8 keyframe (frame tag + start code), then filler. pub fn fake_vp8_keyframe(seq: u8, len: usize) -> Vec { @@ -48,7 +48,7 @@ async fn media_flows_over_loopback() { let n = i * 2 + j; streamer.write( MediaKind::Audio, - MediaTime::new(n * 960, tsc_stream::Frequency::FORTY_EIGHT_KHZ), + MediaTime::new(n * 960, voelin_stream::Frequency::FORTY_EIGHT_KHZ), vec![0xfc, n as u8, 1, 2, 3], ); } @@ -63,7 +63,7 @@ async fn media_flows_over_loopback() { if let PeerEvent::Media(frame) = event { match frame.kind { MediaKind::Video => { - assert_eq!(frame.codec, tsc_stream::Codec::Vp8); + assert_eq!(frame.codec, voelin_stream::Codec::Vp8); assert_eq!(frame.data.len(), 3010, "whole frame reassembled"); video += 1; } diff --git a/crates/tsc-stream/tests/sessions.rs b/crates/voelin-stream/tests/sessions.rs similarity index 99% rename from crates/tsc-stream/tests/sessions.rs rename to crates/voelin-stream/tests/sessions.rs index acba1ab..c316695 100644 --- a/crates/tsc-stream/tests/sessions.rs +++ b/crates/voelin-stream/tests/sessions.rs @@ -6,12 +6,12 @@ use std::collections::HashMap; use std::time::{Duration, Instant}; use tokio::time::timeout; -use tsc_stream::{ +use tsclientlib::ClientId; +use voelin_stream::{ EndReason, FrameSource, LeaveReason, MediaKind, Output, PeerConfig, Request, StreamEvent, StreamInfo, StreamKind, StreamNotification, StreamSetup, StreamerEvent, StreamerOptions, Streams, SyntheticSource, ViewerState, WatchEvent, }; -use tsclientlib::ClientId; const STREAMER: usize = 0; const VIEWER: usize = 1; diff --git a/crates/voelin-ui/Cargo.toml b/crates/voelin-ui/Cargo.toml new file mode 100644 index 0000000..eae00d1 --- /dev/null +++ b/crates/voelin-ui/Cargo.toml @@ -0,0 +1,59 @@ +[package] +name = "voelin-ui" +version = "0.1.0" +description = "Slint user interface and the desktop binary." +edition.workspace = true +rust-version.workspace = true +license.workspace = true +repository.workspace = true +publish.workspace = true + +[lib] +name = "voelin_ui" +path = "src/lib.rs" + +[[bin]] +name = "voelin" +path = "src/main.rs" + +[dependencies] +anyhow = "1.0.104" +chrono = { version = "0.4.45", default-features = false, features = ["clock"] } +dirs = "6" +png = "0.18" +serde = { version = "1", features = ["derive"] } +tokio = { version = "1.53.1", features = ["rt-multi-thread", "macros", "time", "sync"] } +tracing = "0.1.44" +tracing-subscriber = { version = "0.3.23", features = ["env-filter"] } +voelin-audio = { path = "../voelin-audio" } +voelin-core = { path = "../voelin-core", default-features = false, features = ["audio-device"] } +voelin-model = { path = "../voelin-model" } +# Crash reports and notices everywhere; hotkey backends on desktop (below). +voelin-platform = { path = "../voelin-platform", default-features = false } +voelin-query = { path = "../voelin-query" } +voelin-store = { path = "../voelin-store" } +tsclientlib = { path = "../proto/tsclientlib" } + +# Desktop: the keyring for passwords, stream media with libvpx, OpenH264, X11 +# and PipeWire, global hotkeys through the portal and X11. +[target.'cfg(not(target_os = "android"))'.dependencies] +slint = { version = "1.18", features = ["renderer-software"] } +voelin-core = { path = "../voelin-core", default-features = false, features = ["media-desktop"] } +voelin-platform = { path = "../voelin-platform" } +voelin-store = { path = "../voelin-store", features = ["keyring"] } + +# Android (voelin-android): no keyring backend (the app passes Keystore-backed +# secrets), no winit/femtovg (the app picks Slint's Android backend), stream +# media through MediaCodec and the app's capture source. +[target.'cfg(target_os = "android")'.dependencies] +slint = { version = "1.18", default-features = false, features = ["std", "compat-1-2", "renderer-software"] } +voelin-core = { path = "../voelin-core", default-features = false, features = ["media"] } + +[dev-dependencies] +serde_json = "1" + +[build-dependencies] +slint-build = "1.18" + +[lints] +workspace = true diff --git a/crates/tsc-ui/build.rs b/crates/voelin-ui/build.rs similarity index 100% rename from crates/tsc-ui/build.rs rename to crates/voelin-ui/build.rs diff --git a/crates/voelin-ui/src/app.rs b/crates/voelin-ui/src/app.rs new file mode 100644 index 0000000..199cf54 --- /dev/null +++ b/crates/voelin-ui/src/app.rs @@ -0,0 +1,1425 @@ +//! Application state on the UI thread, wired to the engine. +//! +//! Streams (the streams panel, sharing, the viewer) are in `streams.rs`, +//! the settings page's data in `settings.rs`. + +use std::cell::RefCell; +use std::collections::{HashMap, HashSet}; +use std::path::{Path, PathBuf}; +use std::rc::Rc; +use std::sync::Arc; +use std::time::Duration; + +use anyhow::{Context, Result}; +use slint::{ComponentHandle, ModelRc, SharedString, VecModel}; +use tokio::runtime::Runtime; +use tracing::warn; +use voelin_core::stream::StreamInfo; +use voelin_core::{ + AudioSettings, Command, Engine, Event, ObserveState, SessionState, Source, VoiceOptions, + VoiceState, +}; +use voelin_model::{ + Capabilities, ChannelId, ChatMessage, ChatTarget, Presence, TreeRow, tree_rows, +}; +use voelin_platform::{crash, notices}; +use voelin_store::{Bookmark, MemorySecrets, QueryConfig, QueryTransport, Secrets, Store}; + +use crate::hotkey::GlobalPtt; +use crate::settings::{ + self, AUDIO_KEY, CLIENT_PLAYBACK_KEY, ClientPlayback, ClientPlaybackMap, DeviceChoices, UI_KEY, + UiSettings, +}; +use crate::streams::{Share, Watch}; +use crate::video::Video; + +slint::include_modules!(); + +/// Secrets in the OS keyring, or in memory when there is none (headless +/// Linux without a Secret Service). +#[cfg(not(target_os = "android"))] +struct FallbackSecrets { + keyring: voelin_store::KeyringSecrets, + memory: MemorySecrets, +} + +/// The secrets store when [`RunOptions::secrets`] is not given: the OS +/// keyring on desktop, memory elsewhere. +fn default_secrets() -> Box { + #[cfg(not(target_os = "android"))] + return Box::new(FallbackSecrets { + keyring: voelin_store::KeyringSecrets::new("voelin"), + memory: MemorySecrets::default(), + }); + #[cfg(target_os = "android")] + return Box::new(MemorySecrets::default()); +} + +#[cfg(not(target_os = "android"))] +impl Secrets for FallbackSecrets { + fn get(&self, key: &str) -> voelin_store::Result> { + match self.memory.get(key)? { + Some(v) => Ok(Some(v)), + None => Ok(self.keyring.get(key).unwrap_or(None)), + } + } + + fn set(&self, key: &str, value: &str) -> voelin_store::Result<()> { + if let Err(error) = self.keyring.set(key, value) { + warn!(%error, "keyring unavailable, keeping the secret for this session only"); + return self.memory.set(key, value); + } + Ok(()) + } + + fn delete(&self, key: &str) -> voelin_store::Result<()> { + let _ = self.keyring.delete(key); + self.memory.delete(key) + } +} + +struct Tab { + target: ChatTarget, + title: String, + lines: Vec, + unread: i32, +} + +/// What we know about one server session. +pub(crate) struct SessionView { + pub state: SessionState, + pub capabilities: Capabilities, + pub presence: Arc, + collapsed: HashSet, + talking: HashSet, + tabs: Vec, + current_tab: usize, + /// The own channel's tab was focused for this voice connection. + focused_own_channel: bool, + /// The streams in our channel (TeamSpeak 6). + pub streams: Vec, + /// Clients whose stored volume was sent for this voice connection. + applied_playback: HashSet, +} + +impl Default for SessionView { + fn default() -> Self { + Self { + state: SessionState::default(), + capabilities: Capabilities::default(), + presence: Arc::default(), + collapsed: HashSet::new(), + talking: HashSet::new(), + tabs: vec![Tab { + target: ChatTarget::Server, + title: "Server".into(), + lines: Vec::new(), + unread: 0, + }], + current_tab: 0, + focused_own_channel: false, + streams: Vec::new(), + applied_playback: HashSet::new(), + } + } +} + +impl SessionView { + /// Streams can be watched and shared: TeamSpeak 6, connected with voice. + pub fn streams_available(&self) -> bool { + self.capabilities.streams && self.state.voice == VoiceState::Connected + } + + /// A client's nickname, or its id. + pub fn nickname(&self, client: u16) -> String { + self.presence + .clients + .get(&client) + .map_or_else(|| format!("client {client}"), |c| c.nickname.clone()) + } +} + +pub(crate) struct App { + pub ui: slint::Weak, + store: Store, + secrets: Box, + pub engine: Engine, + identity: tsclientlib::Identity, + bookmarks: Vec, + pub current: Option, + pub sessions: HashMap, + status: String, + pub settings: UiSettings, + audio: AudioSettings, + /// Audio settings changed since they were last stored. + audio_dirty: bool, + inputs: DeviceChoices, + outputs: DeviceChoices, + playback: ClientPlaybackMap, + /// The client in the volume dialog: session, client id, unique id. + playback_dialog: Option<(i64, u16, Option)>, + mic_test: bool, + ptt: GlobalPtt, + pub video: Video, + /// Our stream. + pub share: Option, + /// The capture for a share is being started. + pub share_busy: bool, + pub share_error: String, + /// The stream in the viewer. + pub watch: Option, + /// Stream volume in percent, kept between streams. + pub stream_volume: f32, + /// `VOELIN_DEMO_STREAM`: the viewer shows a local test stream. + pub demo: bool, + /// `VOELIN_AUTOSHARE=test-pattern`: share the test pattern once streams work. + pub autoshare: bool, + /// `VOELIN_OPEN=client`: open the volume dialog of the first other client. + open_client_pending: bool, + /// The notices are in the About page's model. + notices_loaded: bool, +} + +thread_local! { + static APP: RefCell> = const { RefCell::new(None) }; +} + +pub(crate) fn with_app(f: impl FnOnce(&mut App) -> R) -> Option { + APP.with(|app| app.borrow_mut().as_mut().map(f)) +} + +/// Run `f` on the app from another thread, on the UI thread. +pub(crate) fn later(f: impl FnOnce(&mut App) + Send + 'static) { + let _ = slint::invoke_from_event_loop(move || { + with_app(f); + }); +} + +/// Start options for [`run`]. +#[derive(Default)] +pub struct RunOptions { + /// Where the client database lives. Default: `VOELIN_DATA_DIR`, else + /// `/voelin`. Mobile platforms pass their app storage directory. + pub data_dir: Option, + /// Where passwords are kept. Default: the OS keyring, in memory when it + /// is unavailable. + pub secrets: Option>, + /// An engine the caller keeps running across windows (Android: voice + /// goes on in a service while the activity is recreated). Default: an + /// engine that stops with the window. + pub engine: Option, +} + +impl std::fmt::Debug for RunOptions { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.debug_struct("RunOptions") + .field("data_dir", &self.data_dir) + .field("secrets", &self.secrets.is_some()) + .field("engine", &self.engine.is_some()) + .finish() + } +} + +/// An engine owned by the caller of [`run`]. +pub struct HostedEngine { + pub engine: Engine, + /// The runtime the engine runs on; the window's tasks run there too. + pub runtime: tokio::runtime::Handle, + /// The engine's events for this window: first events that rebuild the + /// current state of every session, then new ones. The window stops + /// reading when it closes. + pub events: tokio::sync::mpsc::UnboundedReceiver, +} + +impl HostedEngine { + /// A new engine on `runtime`, all of whose events go to the window. + fn start(runtime: &Runtime) -> Self { + let engine = runtime.block_on(async { Engine::start() }); + let (tx, events) = tokio::sync::mpsc::unbounded_channel(); + let mut rx = engine.subscribe(); + runtime.spawn(async move { + loop { + match rx.recv().await { + Ok(event) => { + if tx.send(event).is_err() { + break; + } + } + Err(tokio::sync::broadcast::error::RecvError::Lagged(_)) => continue, + Err(_) => break, + } + } + }); + Self { engine, runtime: runtime.handle().clone(), events } + } +} + +/// Run the app on the current thread until the window closes. The Slint +/// platform must be set up before (the default backend on desktop). +pub fn run(options: RunOptions) -> Result<()> { + // Crash reports: the hook first, recording once the setting is known. + crash::set_app_version(env!("CARGO_PKG_VERSION")); + crash::install(crash::default_dir(), false); + let (own_runtime, hosted) = match options.engine { + Some(hosted) => (None, hosted), + None => { + let runtime = Runtime::new()?; + let hosted = HostedEngine::start(&runtime); + (Some(runtime), hosted) + } + }; + let HostedEngine { engine, runtime, mut events } = hosted; + + // Development switches: VOELIN_DATA_DIR isolates the database, + // VOELIN_AUTOCONNECT=voice|observe connects the first bookmark on start, + // VOELIN_SCREENSHOT= saves the window after VOELIN_SCREENSHOT_DELAY seconds and exits, + // VOELIN_DEMO_STREAM=1 shows a local test stream in the viewer, + // VOELIN_OPEN=share|settings[:]|about|client opens that on start (client: the + // volume dialog of the first other client once connected), VOELIN_AUTOWATCH=1 + // watches the first stream that shows up, VOELIN_AUTOSHARE=test-pattern shares + // the test pattern (accepting everyone) once connected to a TeamSpeak 6 server. + let dir: PathBuf = match (options.data_dir, std::env::var_os("VOELIN_DATA_DIR")) { + (Some(dir), _) => dir, + (None, Some(dir)) => dir.into(), + (None, None) => dirs::data_dir().unwrap_or_else(|| ".".into()).join("voelin"), + }; + let store = + Store::open(&dir.join("client.db")).context("failed to open the client database")?; + let identity = match store.identities()?.first() { + Some(entry) => store.identity(entry.id)?, + None => { + // Creating an identity takes a moment (security level 8). + let identity = tsclientlib::Identity::create(); + store.add_identity("Default", &identity)?; + identity + } + }; + let settings: UiSettings = store.setting(UI_KEY).ok().flatten().unwrap_or_default(); + crash::set_enabled(settings.crash_reports); + crash::test_crash_if_requested(); + let audio: AudioSettings = store.setting(AUDIO_KEY).ok().flatten().unwrap_or_default(); + let playback: ClientPlaybackMap = + store.setting(CLIENT_PLAYBACK_KEY).ok().flatten().unwrap_or_default(); + engine.send(Command::SetAudioSettings(Box::new(audio.clone()))); + + let ui = MainWindow::new()?; + ui.global::().set_app_name(voelin_platform::APP_NAME.into()); + ui.global::().set_app_version(env!("CARGO_PKG_VERSION").into()); + // Wayland and X11 find the desktop file (and icon) by this id. + #[cfg(not(target_os = "android"))] + if let Err(e) = slint::set_xdg_app_id(voelin_platform::APP_ID) { + warn!("cannot set the app id: {e}"); + } + let bookmarks = store.bookmarks()?; + let ptt = GlobalPtt::start( + &runtime, + |status| later(move |app| app.set_ptt_status(status)), + |on| later(move |app| app.command(|session| Command::SetTransmitting { session, on })), + ); + if settings.global_ptt { + ptt.set(Some(settings.ptt_key.clone())); + } + let video = Video::new(&dir, settings.openh264); + let demo = std::env::var("VOELIN_DEMO_STREAM").is_ok_and(|v| v == "1"); + let app = App { + ui: ui.as_weak(), + store, + secrets: options.secrets.unwrap_or_else(default_secrets), + engine: engine.clone(), + identity, + current: bookmarks.first().map(|b| b.id), + bookmarks, + sessions: HashMap::new(), + status: "Ready".into(), + settings, + audio, + audio_dirty: false, + inputs: DeviceChoices::default(), + outputs: DeviceChoices::default(), + playback, + playback_dialog: None, + mic_test: false, + ptt, + video, + share: None, + share_busy: false, + share_error: String::new(), + watch: None, + stream_volume: 100.0, + demo, + autoshare: std::env::var("VOELIN_AUTOSHARE").is_ok_and(|v| v == "test-pattern"), + open_client_pending: std::env::var("VOELIN_OPEN").is_ok_and(|v| v == "client"), + notices_loaded: false, + }; + APP.with(|a| *a.borrow_mut() = Some(app)); + wire_callbacks(&ui); + with_app(|app| { + app.refresh_all(); + app.refresh_settings_flags(); + app.refresh_crash_notice(); + if app.demo { + app.start_demo(); + } + }); + + // Engine events -> UI thread, until the event loop is gone. + runtime.spawn(async move { + while let Some(event) = events.recv().await { + let posted = slint::invoke_from_event_loop(move || { + with_app(|app| app.handle_event(event)); + }); + if posted.is_err() { + break; + } + } + }); + // Once a second: stream statistics, stored settings. + let ticker = slint::Timer::default(); + ticker.start(slint::TimerMode::Repeated, Duration::from_secs(1), || { + with_app(|app| app.tick()); + }); + + match std::env::var("VOELIN_AUTOCONNECT").as_deref() { + Ok("voice") => { + with_app(|app| app.connect_voice()); + } + Ok("observe") => { + with_app(|app| app.toggle_observe()); + } + _ => {} + } + match std::env::var("VOELIN_OPEN").as_deref() { + Ok("share") => ui.invoke_open_share_dialog(), + Ok("about") => { + with_app(|app| app.load_notices()); + ui.set_show_about(true); + } + Ok(open) if open.starts_with("settings") => { + with_app(|app| app.open_settings()); + let tab = open.strip_prefix("settings:").and_then(|t| t.parse().ok()); + ui.set_settings_tab(tab.unwrap_or(0)); + ui.set_settings_open(true); + } + _ => {} + } + let _screenshot_timer = std::env::var_os("VOELIN_SCREENSHOT").map(|path| { + let delay = + std::env::var("VOELIN_SCREENSHOT_DELAY").ok().and_then(|d| d.parse().ok()).unwrap_or(4); + let weak = ui.as_weak(); + let timer = slint::Timer::default(); + timer.start(slint::TimerMode::SingleShot, Duration::from_secs(delay), move || { + if let Some(ui) = weak.upgrade() { + if let Err(e) = save_screenshot(&ui, std::path::Path::new(&path)) { + eprintln!("screenshot failed: {e}"); + } + let _ = ui.hide(); + } + }); + timer + }); + + ui.run()?; + // With our own engine, leave servers properly, so no ghost client stays + // behind until it times out. A hosted engine keeps its sessions. + let own = own_runtime.is_some(); + let open = with_app(|app| { + app.save_audio(); + app.watch = None; + app.share = None; + if own { + for id in app.sessions.keys() { + app.engine.send(Command::CloseSession { session: *id as u64 }); + } + } + own && !app.sessions.is_empty() + }); + APP.with(|a| a.borrow_mut().take()); + if let Some(runtime) = own_runtime { + if open == Some(true) { + runtime.block_on(async { tokio::time::sleep(Duration::from_millis(500)).await }); + } + runtime.shutdown_timeout(Duration::from_secs(2)); + } + Ok(()) +} + +fn wire_callbacks(ui: &MainWindow) { + let bridge = ui.global::(); + bridge.on_select_server(|id| { + with_app(|app| { + app.current = Some(id as i64); + app.refresh_all(); + }); + }); + bridge.on_connect_voice(|| { + with_app(|app| app.connect_voice()); + }); + bridge.on_disconnect_voice(|| { + with_app(|app| app.command(|session| Command::DisconnectVoice { session })); + }); + bridge.on_toggle_observe(|| { + with_app(|app| app.toggle_observe()); + }); + bridge.on_join_channel(|cid| { + with_app(|app| { + app.command(|session| Command::MoveToChannel { + session, + channel: cid as ChannelId, + password: None, + }) + }); + }); + bridge.on_open_channel_chat(|cid| { + with_app(|app| app.open_chat(ChatTarget::Channel(cid as ChannelId), true)); + }); + bridge.on_toggle_collapse(|cid| { + with_app(|app| { + if let Some(view) = app.view_mut() { + let cid = cid as ChannelId; + if !view.collapsed.remove(&cid) { + view.collapsed.insert(cid); + } + } + app.refresh_tree(); + }); + }); + bridge.on_select_tab(|i| { + with_app(|app| { + if let Some(view) = app.view_mut() { + view.current_tab = i as usize; + if let Some(tab) = view.tabs.get_mut(i as usize) { + tab.unread = 0; + } + } + app.refresh_chat(); + }); + }); + bridge.on_close_tab(|i| { + with_app(|app| app.close_tab(i as usize)); + }); + bridge.on_send_message(|text| { + with_app(|app| app.send_message(text.to_string())); + }); + bridge.on_set_input_muted(|muted| { + with_app(|app| app.command(|session| Command::SetInputMuted { session, muted })); + }); + bridge.on_set_output_muted(|muted| { + with_app(|app| app.command(|session| Command::SetOutputMuted { session, muted })); + }); + bridge.on_push_to_talk(|on| { + with_app(|app| app.command(|session| Command::SetTransmitting { session, on })); + }); + bridge.on_edit_bookmark(|id| with_app(|app| app.bookmark_form(id as i64)).unwrap_or_default()); + bridge.on_save_bookmark(|form| { + with_app(|app| app.save_bookmark(form)); + }); + bridge.on_delete_bookmark(|id| { + with_app(|app| app.delete_bookmark(id as i64)); + }); + + // Streams. + bridge.on_open_share(|| with_app(|app| app.open_share()).unwrap_or_default()); + bridge.on_start_share(|form| { + with_app(|app| app.start_share(form)); + }); + bridge.on_stop_share(|| { + with_app(|app| app.stop_share()); + }); + bridge.on_respond_viewer(|viewer, accept| { + with_app(|app| app.respond_viewer(viewer as u16, accept)); + }); + bridge.on_kick_viewer(|viewer| { + with_app(|app| app.kick_viewer(viewer as u16)); + }); + bridge.on_watch_stream(|id| { + with_app(|app| app.watch_stream(id.to_string())); + }); + bridge.on_show_viewer(|| { + with_app(|app| app.show_viewer(true)); + }); + bridge.on_hide_viewer(|| { + with_app(|app| app.show_viewer(false)); + }); + bridge.on_leave_stream(|| { + with_app(|app| app.leave_stream()); + }); + bridge.on_set_stream_volume(|volume| { + with_app(|app| app.set_stream_volume(volume)); + }); + bridge.on_toggle_fullscreen(|| { + with_app(|app| app.toggle_fullscreen()); + }); + + // Settings. + bridge.on_open_settings(|| { + with_app(|app| app.open_settings()); + }); + bridge.on_close_settings(|| { + with_app(|app| app.close_settings()); + }); + bridge.on_audio_changed(|form| { + with_app(|app| app.audio_changed(&form)); + }); + bridge.on_toggle_mic_test(|| { + with_app(|app| app.set_mic_test(!app.mic_test)); + }); + bridge.on_apply_ptt(|enabled, key| { + with_app(|app| app.apply_ptt(enabled, key.to_string())); + }); + bridge.on_set_h264(|enabled| { + with_app(|app| app.set_h264(enabled)); + }); + bridge.on_download_h264(|| { + with_app(|app| app.download_h264()); + }); + bridge.on_open_client(|id| with_app(|app| app.open_client(id as u16)).unwrap_or(false)); + bridge.on_client_audio_changed(|form| { + with_app(|app| app.client_playback_changed(&form)); + }); + + // Crash reports and notices. + bridge.on_set_crash_reports(|enabled| { + with_app(|app| app.set_crash_reports(enabled)); + }); + bridge.on_open_crash_folder(|| { + with_app(|app| { + let result = crash::dir().ok_or_else(|| "no crash report folder".to_owned()); + if let Err(e) = result.and_then(|dir| open_path(&dir).map_err(|e| e.to_string())) { + app.set_status(format!("Cannot open the crash report folder: {e}")); + } + }); + }); + bridge.on_delete_crash_reports(|| { + with_app(|app| { + match crash::clear() { + Ok(n) => app.set_status(format!("Deleted {n} crash reports")), + Err(e) => app.set_status(format!("Cannot delete the crash reports: {e}")), + } + app.refresh_crash_notice(); + }); + }); + bridge.on_dismiss_crash_notice(|| { + with_app(|app| { + if let Some(ui) = app.ui.upgrade() { + ui.global::().set_crash_notice(SharedString::new()); + } + }); + }); + bridge.on_open_about(|| { + with_app(|app| app.load_notices()); + }); +} + +/// Open a file or folder with the desktop's default application. +fn open_path(path: &Path) -> std::io::Result<()> { + #[cfg(windows)] + let mut command = std::process::Command::new("explorer"); + #[cfg(target_os = "macos")] + let mut command = std::process::Command::new("open"); + #[cfg(not(any(windows, target_os = "macos")))] + let mut command = std::process::Command::new("xdg-open"); + let mut child = command.arg(path).spawn()?; + // Reap it without blocking the UI. + std::thread::spawn(move || child.wait()); + Ok(()) +} + +fn save_screenshot(ui: &MainWindow, path: &std::path::Path) -> Result<()> { + let image = ui.window().take_snapshot()?; + let file = std::io::BufWriter::new(std::fs::File::create(path)?); + let mut encoder = png::Encoder::new(file, image.width(), image.height()); + encoder.set_color(png::ColorType::Rgba); + encoder.set_depth(png::BitDepth::Eight); + encoder.write_header()?.write_image_data(image.as_bytes())?; + Ok(()) +} + +fn time_of(ts_ms: i64) -> String { + chrono::DateTime::from_timestamp_millis(ts_ms) + .map(|t| t.with_timezone(&chrono::Local).format("%H:%M").to_string()) + .unwrap_or_default() +} + +pub(crate) fn model(items: Vec) -> ModelRc { + ModelRc::from(Rc::new(VecModel::from(items))) +} + +impl App { + fn view_mut(&mut self) -> Option<&mut SessionView> { + let id = self.current?; + Some(self.sessions.entry(id).or_default()) + } + + pub fn view(&self) -> Option<&SessionView> { + self.current.and_then(|id| self.sessions.get(&id)) + } + + pub fn bookmark(&self, id: i64) -> Option<&Bookmark> { + self.bookmarks.iter().find(|b| b.id == id) + } + + pub fn command(&self, f: impl FnOnce(u64) -> Command) { + if let Some(id) = self.current { + self.engine.send(f(id as u64)); + } + } + + pub fn set_status(&mut self, text: impl Into) { + self.status = text.into(); + if let Some(ui) = self.ui.upgrade() { + ui.global::().set_status_text(self.status.clone().into()); + } + } + + pub fn store_settings(&self) { + if let Err(e) = self.store.set_setting(UI_KEY, &self.settings) { + warn!(%e, "could not store settings"); + } + } + + fn connect_voice(&mut self) { + let Some(b) = self.current.and_then(|id| self.bookmark(id)).cloned() else { return }; + let mut options = VoiceOptions::new(&b.address, &b.nickname); + options.identity = Some(self.identity.clone()); + options.server_password = self.secrets.get(&b.server_password_key()).ok().flatten(); + options.channel = b.default_channel.clone(); + options.audio = true; + options.stream_peer = self.video.peer_config(options.stream_peer); + self.engine + .send(Command::ConnectVoice { session: b.id as u64, options: Box::new(options) }); + self.set_status(format!("Connecting to {}…", b.address)); + } + + fn toggle_observe(&mut self) { + let Some(b) = self.current.and_then(|id| self.bookmark(id)).cloned() else { return }; + let session = b.id as u64; + let observing = + self.sessions.get(&b.id).is_some_and(|v| v.state.observe != ObserveState::Off); + if observing { + self.engine.send(Command::StopObserving { session }); + return; + } + if let Some(url) = &b.gateway_url { + self.engine.send(Command::ObserveGateway { + session, + url: url.clone(), + identity: Box::new(self.identity.clone()), + }); + } else if let Some(q) = &b.query { + let secret = self.secrets.get(&b.query_password_key()).ok().flatten(); + let transport = match q.transport { + QueryTransport::Raw => voelin_query::Transport::Raw, + QueryTransport::Ssh => voelin_query::Transport::Ssh, + QueryTransport::Http => voelin_query::Transport::Http, + }; + let connect = voelin_query::Connect { + transport, + addr: format!("{}:{}", q.host, q.port), + user: q.user.clone(), + secret, + server_port: q.server_port, + server_id: None, + line: Default::default(), + }; + self.engine.send(Command::ObserveQuery { session, connect: Box::new(connect) }); + } + self.set_status("Observing invisibly…"); + } + + fn open_chat(&mut self, target: ChatTarget, focus: bool) { + let Some(id) = self.current else { return }; + let title = match &target { + ChatTarget::Channel(cid) => { + let name = self + .sessions + .get(&id) + .and_then(|v| v.presence.channels.get(cid).map(|c| c.name.clone())); + format!("#{}", name.unwrap_or_else(|| cid.to_string())) + } + ChatTarget::Server => "Server".into(), + ChatTarget::Private(uid) => format!("@{uid}"), + }; + let view = self.sessions.entry(id).or_default(); + let index = match view.tabs.iter().position(|t| t.target == target) { + Some(i) => i, + None => { + view.tabs.push(Tab { target: target.clone(), title, lines: Vec::new(), unread: 0 }); + self.engine.send(Command::OpenChat { session: id as u64, target }); + view.tabs.len() - 1 + } + }; + if focus { + view.current_tab = index; + view.tabs[index].unread = 0; + } + self.refresh_chat(); + } + + fn close_tab(&mut self, index: usize) { + let Some(id) = self.current else { return }; + let view = self.sessions.entry(id).or_default(); + if index == 0 || index >= view.tabs.len() { + return; + } + let tab = view.tabs.remove(index); + view.current_tab = view.current_tab.min(view.tabs.len() - 1); + self.engine.send(Command::CloseChat { session: id as u64, target: tab.target }); + self.refresh_chat(); + } + + fn send_message(&mut self, text: String) { + let Some(id) = self.current else { return }; + let Some(view) = self.sessions.get(&id) else { return }; + let target = view.tabs[view.current_tab].target.clone(); + self.engine.send(Command::SendChat { session: id as u64, target, text }); + } + + fn bookmark_form(&self, id: i64) -> BookmarkForm { + let Some(b) = self.bookmark(id) else { + return BookmarkForm { + id: -1, + nickname: std::env::var("USER").unwrap_or_default().into(), + query_transport: "none".into(), + query_user: "serveradmin".into(), + ..Default::default() + }; + }; + let secret = |key: String| -> SharedString { + self.secrets.get(&key).ok().flatten().unwrap_or_default().into() + }; + let (transport, addr, user) = match &b.query { + Some(q) => ( + match q.transport { + QueryTransport::Raw => "raw", + QueryTransport::Ssh => "ssh", + QueryTransport::Http => "http", + }, + format!("{}:{}", q.host, q.port), + q.user.clone(), + ), + None => ("none", String::new(), "serveradmin".to_string()), + }; + BookmarkForm { + id: b.id as i32, + name: b.name.clone().into(), + address: b.address.clone().into(), + nickname: b.nickname.clone().into(), + server_password: secret(b.server_password_key()), + gateway_url: b.gateway_url.clone().unwrap_or_default().into(), + query_transport: transport.into(), + query_addr: addr.into(), + query_user: user.into(), + query_password: secret(b.query_password_key()), + } + } + + fn save_bookmark(&mut self, form: BookmarkForm) { + let query = match form.query_transport.as_str() { + "none" | "" => None, + t => { + let (host, port) = form + .query_addr + .rsplit_once(':') + .map_or((form.query_addr.to_string(), None), |(h, p)| { + (h.to_string(), p.parse().ok()) + }); + let transport = match t { + "raw" => QueryTransport::Raw, + "http" => QueryTransport::Http, + _ => QueryTransport::Ssh, + }; + let default_port = match transport { + QueryTransport::Raw => 10011, + QueryTransport::Ssh => 10022, + QueryTransport::Http => 10080, + }; + Some(QueryConfig { + transport, + host, + port: port.unwrap_or(default_port), + user: form.query_user.to_string(), + server_port: None, + }) + } + }; + let mut bookmark = Bookmark { + id: form.id as i64, + name: if form.name.is_empty() { + form.address.to_string() + } else { + form.name.to_string() + }, + address: form.address.to_string(), + nickname: form.nickname.to_string(), + identity: None, + default_channel: None, + gateway_url: Some(form.gateway_url.to_string()).filter(|u| !u.is_empty()), + query, + client_version: None, + }; + let result = if bookmark.id < 0 { + self.store.add_bookmark(&bookmark).map(|id| bookmark.id = id) + } else { + self.store.update_bookmark(&bookmark) + }; + if let Err(e) = result { + self.set_status(format!("Could not save: {e}")); + return; + } + for (key, value) in [ + (bookmark.server_password_key(), &form.server_password), + (bookmark.query_password_key(), &form.query_password), + ] { + let result = if value.is_empty() { + self.secrets.delete(&key) + } else { + self.secrets.set(&key, value) + }; + if let Err(e) = result { + warn!(%e, "could not store secret"); + } + } + self.current = Some(bookmark.id); + self.bookmarks = self.store.bookmarks().unwrap_or_default(); + self.refresh_all(); + } + + fn delete_bookmark(&mut self, id: i64) { + self.engine.send(Command::CloseSession { session: id as u64 }); + if let Some(b) = self.bookmark(id).cloned() { + let _ = self.secrets.delete(&b.server_password_key()); + let _ = self.secrets.delete(&b.query_password_key()); + } + let _ = self.store.delete_bookmark(id); + self.sessions.remove(&id); + self.bookmarks = self.store.bookmarks().unwrap_or_default(); + self.current = self.bookmarks.first().map(|b| b.id); + self.refresh_all(); + } + + fn handle_event(&mut self, event: Event) { + match event { + Event::State { session, state } => { + let id = session as i64; + let view = self.sessions.entry(id).or_default(); + let was_voice = view.state.voice; + view.state = state.clone(); + if state.voice != VoiceState::Connected { + view.focused_own_channel = false; + } + if state.voice == VoiceState::Connected && was_voice != VoiceState::Connected { + // A new connection: volumes are sent again. + view.applied_playback.clear(); + } + let focus = !view.focused_own_channel; + if state.voice == VoiceState::Connected && was_voice != VoiceState::Connected { + self.set_status("Connected"); + } + if self.current == Some(id) { + // The voice channel's chat is always at hand, and focused + // once per connection. + if let (Some(cid), VoiceState::Connected) = (state.own_channel, state.voice) { + self.open_chat(ChatTarget::Channel(cid), focus); + self.sessions.entry(id).or_default().focused_own_channel = true; + } + } + self.refresh_servers(); + self.refresh_toolbar(); + self.refresh_streams(); + self.autoshare(); + } + Event::ServerInfo { session, name, flavor, capabilities } => { + self.sessions.entry(session as i64).or_default().capabilities = capabilities; + if self.current == Some(session as i64) { + let kind = match flavor { + voelin_model::ServerFlavor::Ts3(v) => format!("TeamSpeak 3 {v}"), + voelin_model::ServerFlavor::Ts6(v) => format!("TeamSpeak 6 {v}"), + voelin_model::ServerFlavor::Unknown(v) => v, + }; + self.set_status(format!("Connected to {name} ({kind})")); + } + self.refresh_streams(); + self.autoshare(); + } + Event::Presence { session, presence } => { + self.sessions.entry(session as i64).or_default().presence = presence; + self.apply_client_playback(session as i64); + if self.current == Some(session as i64) { + self.refresh_tree(); + self.refresh_chat(); + self.refresh_streams(); + if self.open_client_pending { + self.open_first_client(); + } + } + } + Event::Talking { session, client, talking } => { + let view = self.sessions.entry(session as i64).or_default(); + if talking { + view.talking.insert(client); + } else { + view.talking.remove(&client); + } + if self.current == Some(session as i64) { + self.refresh_tree(); + } + } + Event::InputLevel { session, level_db, sending } => { + let shown = match session { + Some(s) => self.current == Some(s as i64), + None => self.mic_test, + }; + if shown && let Some(ui) = self.ui.upgrade() { + let bridge = ui.global::(); + bridge.set_input_level(level_db); + bridge.set_input_sending(sending); + } + } + Event::MicrophoneTestError { message } => { + self.set_status(format!("Microphone test: {message}")) + } + Event::Chat { session, message } => self.add_message(session as i64, message), + Event::Error { message, .. } => self.set_status(message), + event => self.stream_event(event), + } + } + + fn add_message(&mut self, id: i64, message: ChatMessage) { + let current = self.current == Some(id); + let view = self.sessions.entry(id).or_default(); + let index = match view.tabs.iter().position(|t| t.target == message.target) { + Some(i) => i, + None => { + let title = match &message.target { + ChatTarget::Channel(cid) => format!( + "#{}", + view.presence + .channels + .get(cid) + .map(|c| c.name.clone()) + .unwrap_or_else(|| cid.to_string()) + ), + ChatTarget::Private(_) => format!("@{}", message.author_name), + ChatTarget::Server => "Server".into(), + }; + view.tabs.push(Tab { + target: message.target.clone(), + title, + lines: Vec::new(), + unread: 0, + }); + view.tabs.len() - 1 + } + }; + let tab = &mut view.tabs[index]; + tab.lines.push(ChatLine { + author: message.author_name.into(), + text: message.text.into(), + time: time_of(message.ts_ms).into(), + relayed: message.via_relay, + }); + if !(current && view.current_tab == index) { + tab.unread += 1; + } + if current { + self.refresh_chat(); + } + } + + /// Once a second. + fn tick(&mut self) { + self.tick_streams(); + if self.audio_dirty { + self.save_audio(); + } + } + + fn refresh_all(&mut self) { + self.refresh_servers(); + self.refresh_toolbar(); + self.refresh_tree(); + self.refresh_chat(); + self.refresh_streams(); + } + + fn refresh_servers(&self) { + let Some(ui) = self.ui.upgrade() else { return }; + let bridge = ui.global::(); + let items = self + .bookmarks + .iter() + .map(|b| { + let state = self.sessions.get(&b.id).map(|v| v.state.clone()).unwrap_or_default(); + let status = match (state.voice, state.observe) { + (VoiceState::Connected, _) => "connected", + (VoiceState::Connecting, _) | (_, ObserveState::Connecting) => "connecting", + (_, ObserveState::Observing) => "observing", + _ => "offline", + }; + ServerItem { + id: b.id as i32, + name: b.name.clone().into(), + address: b.address.clone().into(), + status: status.into(), + } + }) + .collect(); + bridge.set_servers(model(items)); + bridge.set_current_server(self.current.map_or(-1, |id| id as i32)); + } + + fn refresh_toolbar(&self) { + let Some(ui) = self.ui.upgrade() else { return }; + let bridge = ui.global::(); + let bookmark = self.current.and_then(|id| self.bookmark(id)); + let state = self.view().map(|v| v.state.clone()).unwrap_or_default(); + bridge.set_server_title( + bookmark.map_or("No server selected".into(), |b| b.name.clone()).into(), + ); + bridge.set_voice_connected(state.voice == VoiceState::Connected); + bridge.set_voice_connecting(state.voice == VoiceState::Connecting); + bridge.set_observing(state.observe != ObserveState::Off); + bridge.set_can_observe( + bookmark.is_some_and(|b| b.gateway_url.is_some() || b.query.is_some()), + ); + bridge.set_input_muted(state.input_muted); + bridge.set_output_muted(state.output_muted); + bridge.set_transmitting(state.transmitting); + bridge.set_presence_source( + match state.presence_source { + Some(Source::Voice) => "live (voice)", + Some(Source::Gateway) => "invisible (gateway)", + Some(Source::Query) => "invisible (query)", + None => "", + } + .into(), + ); + bridge.set_status_text(self.status.clone().into()); + if state.voice != VoiceState::Connected { + bridge.set_input_level(-100.0); + bridge.set_input_sending(false); + } + } + + fn refresh_tree(&self) { + let Some(ui) = self.ui.upgrade() else { return }; + let Some(view) = self.view() else { + ui.global::().set_tree(model(Vec::new())); + return; + }; + let own_channel = view.state.own_channel; + let rows = tree_rows(&view.presence, &|cid| view.collapsed.contains(&cid)) + .into_iter() + .map(|row| match row { + TreeRow::Channel { depth, channel } => TreeItem { + is_channel: true, + depth: depth as i32, + id: channel.id as i32, + name: channel.name.clone().into(), + own: own_channel == Some(channel.id), + locked: channel.has_password, + collapsed: view.collapsed.contains(&channel.id), + local_volume: 100, + ..Default::default() + }, + TreeRow::Client { depth, client } => { + let playback = client + .uid + .as_ref() + .and_then(|uid| self.playback.get(uid)) + .copied() + .unwrap_or_default(); + TreeItem { + is_channel: false, + depth: depth as i32, + id: client.id as i32, + name: client.nickname.clone().into(), + own: false, + talking: view.talking.contains(&client.id) || client.talking == Some(true), + muted: client.input_muted, + sound_off: client.output_muted, + away: client.away.is_some(), + streaming: client.streaming == Some(true), + local_muted: playback.muted, + local_volume: (playback.volume * 100.0).round() as i32, + myself: view.state.own_client == Some(client.id), + ..Default::default() + } + } + }) + .collect(); + ui.global::().set_tree(model(rows)); + } + + fn refresh_chat(&self) { + let Some(ui) = self.ui.upgrade() else { return }; + let bridge = ui.global::(); + let Some(view) = self.view() else { + bridge.set_tabs(model(vec![ChatTab { title: "Server".into(), ..Default::default() }])); + bridge.set_messages(model(Vec::new())); + return; + }; + let tabs = view + .tabs + .iter() + .map(|t| ChatTab { + title: t.title.clone().into(), + kind: matches!(t.target, ChatTarget::Channel(_)) as i32, + id: match t.target { + ChatTarget::Channel(cid) => cid as i32, + _ => 0, + }, + unread: t.unread, + }) + .collect(); + bridge.set_tabs(model(tabs)); + bridge.set_current_tab(view.current_tab as i32); + bridge.set_messages(model(view.tabs[view.current_tab].lines.clone())); + } + + // Settings page. + + fn open_settings(&mut self) { + let list = |devices: voelin_audio::Result>, + input: bool| { + let devices = devices.unwrap_or_else(|e| { + warn!("cannot list audio devices: {e}"); + Vec::new() + }); + devices + .into_iter() + .map(|d| { + let default = if input { d.default_input } else { d.default_output }; + (d.id, d.name, default) + }) + .collect::>() + }; + let inputs = list(voelin_audio::device::input_devices(), true); + let outputs = list(voelin_audio::device::output_devices(), false); + self.inputs = DeviceChoices::new(&inputs, self.audio.input_device.as_deref()); + self.outputs = DeviceChoices::new(&outputs, self.audio.output_device.as_deref()); + let Some(ui) = self.ui.upgrade() else { return }; + let bridge = ui.global::(); + let names = |c: &DeviceChoices| model(c.names.iter().map(SharedString::from).collect()); + bridge.set_input_devices(names(&self.inputs)); + bridge.set_output_devices(names(&self.outputs)); + bridge.set_audio(settings::audio_form(&self.audio, &self.inputs, &self.outputs)); + bridge.set_global_ptt(self.settings.global_ptt); + bridge.set_ptt_key(self.settings.ptt_key.clone().into()); + bridge.set_h264_enabled(self.settings.openh264); + self.refresh_h264(); + } + + fn close_settings(&mut self) { + self.set_mic_test(false); + self.save_audio(); + } + + fn audio_changed(&mut self, form: &AudioForm) { + let audio = settings::apply_audio_form(form, &self.audio, &self.inputs, &self.outputs); + if audio == self.audio { + return; + } + self.audio = audio; + self.audio_dirty = true; + self.engine.send(Command::SetAudioSettings(Box::new(self.audio.clone()))); + } + + fn save_audio(&mut self) { + if !self.audio_dirty { + return; + } + self.audio_dirty = false; + if let Err(e) = self.store.set_setting(AUDIO_KEY, &self.audio) { + warn!(%e, "could not store audio settings"); + } + } + + fn set_mic_test(&mut self, on: bool) { + if self.mic_test == on { + return; + } + self.mic_test = on; + self.engine.send(Command::TestMicrophone { on }); + if let Some(ui) = self.ui.upgrade() { + let bridge = ui.global::(); + bridge.set_mic_test(on); + if !on { + bridge.set_input_level(-100.0); + } + } + } + + fn apply_ptt(&mut self, enabled: bool, key: String) { + let key = key.trim().to_owned(); + self.settings.global_ptt = enabled; + if !key.is_empty() { + self.settings.ptt_key = key.clone(); + } + self.store_settings(); + self.ptt.set((enabled && !key.is_empty()).then_some(key)); + } + + fn set_ptt_status(&mut self, status: String) { + if let Some(ui) = self.ui.upgrade() { + ui.global::().set_ptt_status(status.into()); + } + } + + fn set_h264(&mut self, enabled: bool) { + self.settings.openh264 = enabled; + self.store_settings(); + self.video.set_h264(enabled); + self.refresh_h264(); + } + + fn download_h264(&mut self) { + let runtime = self.engine.runtime().clone(); + self.video.download_h264(&runtime, |download| { + later(move |app| { + app.video.downloaded(download, app.settings.openh264); + app.refresh_h264(); + }); + }); + self.refresh_h264(); + } + + fn refresh_h264(&self) { + let Some(ui) = self.ui.upgrade() else { return }; + let bridge = ui.global::(); + let (loaded, status) = self.video.h264_status(); + bridge.set_h264_loaded(loaded); + bridge.set_h264_busy(status.starts_with("Downloading")); + bridge.set_h264_status(status.into()); + } + + /// Switches the About page and the settings show. + fn refresh_settings_flags(&self) { + let Some(ui) = self.ui.upgrade() else { return }; + let bridge = ui.global::(); + bridge.set_h264_enabled(self.settings.openh264); + bridge.set_h264_attribution(notices::OPENH264_ATTRIBUTION.into()); + bridge.set_crash_reports(self.settings.crash_reports); + } + + fn set_crash_reports(&mut self, enabled: bool) { + self.settings.crash_reports = enabled; + self.store_settings(); + crash::set_enabled(enabled); + } + + /// A notice while crash reports are on disk. + fn refresh_crash_notice(&self) { + let Some(ui) = self.ui.upgrade() else { return }; + let text = match crash::pending_reports() { + Ok(reports) if !reports.is_empty() => { + let newest = &reports[reports.len() - 1]; + let saved = match reports.len() { + 1 => "1 crash report is saved".to_owned(), + n => format!("{n} crash reports are saved"), + }; + format!("The app crashed earlier ({}). {saved} on this device.", newest.summary) + } + _ => String::new(), + }; + ui.global::().set_crash_notice(text.into()); + } + + /// The third-party notices, one model entry per line. + fn load_notices(&mut self) { + if self.notices_loaded { + return; + } + let Some(ui) = self.ui.upgrade() else { return }; + let lines: Vec = notices::text().lines().map(SharedString::from).collect(); + ui.global::().set_notices(model(lines)); + self.notices_loaded = true; + } + + // Local volume and mute of clients. + + /// Fill the volume dialog for `client` of the current session. + fn open_client(&mut self, client: u16) -> bool { + let Some(id) = self.current else { return false }; + let Some(info) = self.view().and_then(|v| v.presence.clients.get(&client)).cloned() else { + return false; + }; + let playback = + info.uid.as_ref().and_then(|uid| self.playback.get(uid)).copied().unwrap_or_default(); + self.playback_dialog = Some((id, client, info.uid.clone())); + if let Some(ui) = self.ui.upgrade() { + ui.global::().set_client_audio(ClientAudio { + id: client as i32, + name: info.nickname.into(), + volume: playback.volume * 100.0, + muted: playback.muted, + }); + } + true + } + + fn client_playback_changed(&mut self, form: &ClientAudio) { + let Some((session, client, uid)) = self.playback_dialog.clone() else { return }; + let playback = + ClientPlayback { volume: (form.volume / 100.0).clamp(0.0, 4.0), muted: form.muted }; + let session = session as u64; + self.engine.send(Command::SetClientVolume { session, client, volume: playback.volume }); + self.engine.send(Command::SetClientMuted { session, client, muted: playback.muted }); + // Kept by unique id; clients without one only for this connection. + if let Some(uid) = uid { + if playback.is_default() { + self.playback.remove(&uid); + } else { + self.playback.insert(uid, playback); + } + if let Err(e) = self.store.set_setting(CLIENT_PLAYBACK_KEY, &self.playback) { + warn!(%e, "could not store client volumes"); + } + } + self.refresh_tree(); + } + + /// `VOELIN_OPEN=client`: the volume dialog of the first client that is not us. + fn open_first_client(&mut self) { + let Some(view) = self.view().filter(|v| v.state.own_client.is_some()) else { return }; + let own = view.state.own_client; + let mut others: Vec<_> = + view.presence.clients.values().filter(|c| Some(c.id) != own && !c.is_query).collect(); + others.sort_by_key(|c| c.id); + let Some(id) = others.first().map(|c| c.id) else { return }; + self.open_client_pending = false; + if self.open_client(id) + && let Some(ui) = self.ui.upgrade() + { + ui.set_client_open(true); + } + } + + /// Send the stored volumes of clients that appeared in a voice session. + fn apply_client_playback(&mut self, session: i64) { + let Some(view) = self.sessions.get_mut(&session) else { return }; + if view.state.voice != VoiceState::Connected + || view.state.presence_source != Some(Source::Voice) + { + return; + } + let presence = view.presence.clone(); + view.applied_playback.retain(|id| presence.clients.contains_key(id)); + for client in presence.clients.values() { + if !view.applied_playback.insert(client.id) { + continue; + } + let stored = client.uid.as_ref().and_then(|uid| self.playback.get(uid)); + let Some(playback) = stored else { continue }; + let (s, c) = (session as u64, client.id); + self.engine.send(Command::SetClientVolume { + session: s, + client: c, + volume: playback.volume, + }); + if playback.muted { + self.engine.send(Command::SetClientMuted { session: s, client: c, muted: true }); + } + } + } +} diff --git a/crates/voelin-ui/src/hotkey.rs b/crates/voelin-ui/src/hotkey.rs new file mode 100644 index 0000000..2f1a6d3 --- /dev/null +++ b/crates/voelin-ui/src/hotkey.rs @@ -0,0 +1,123 @@ +//! Global push-to-talk: a task owns the `voelin_platform::HotkeyManager` +//! (portal on Wayland, XInput2 on X11, a hook on Windows) and reports +//! presses and releases. + +use tokio::runtime::Handle; +use tokio::sync::mpsc; + +/// Id of the push-to-talk registration (the portal remembers it). +#[cfg(not(target_os = "android"))] +const PTT_ID: &str = "push-to-talk"; + +/// Handle to the hotkey task. +pub(crate) struct GlobalPtt { + tx: mpsc::UnboundedSender>, +} + +impl GlobalPtt { + /// Start the task. `status` gets a line for the settings page, + /// `transmit` the key's state; both are called on the runtime. + pub fn start( + runtime: &Handle, + status: impl Fn(String) + Send + 'static, + transmit: impl Fn(bool) + Send + 'static, + ) -> Self { + let (tx, rx) = mpsc::unbounded_channel(); + runtime.spawn(run(rx, status, transmit)); + Self { tx } + } + + /// Register `key` (e.g. `Ctrl+Shift+T`) instead of the current one, or + /// nothing. + pub fn set(&self, key: Option) { + let _ = self.tx.send(key); + } +} + +#[cfg(target_os = "android")] +async fn run( + mut rx: mpsc::UnboundedReceiver>, + status: impl Fn(String), + _transmit: impl Fn(bool), +) { + while let Some(key) = rx.recv().await { + if key.is_some() { + status("Global hotkeys are not available on this platform.".into()); + } + } +} + +#[cfg(not(target_os = "android"))] +async fn run( + mut rx: mpsc::UnboundedReceiver>, + status: impl Fn(String), + transmit: impl Fn(bool), +) { + use voelin_platform::{BackendKind, Hotkey, HotkeyEvent, HotkeyEvents, HotkeyManager}; + + async fn next(events: &mut Option) -> Option { + match events { + Some(events) => events.recv().await, + None => std::future::pending().await, + } + } + + let mut manager: Option = None; + let mut events: Option = None; + loop { + tokio::select! { + key = rx.recv() => { + let Some(key) = key else { break }; + events = None; + // Released: whatever was held no longer counts. + transmit(false); + if let Some(m) = &mut manager { + let _ = m.unregister(PTT_ID).await; + } + let Some(key) = key else { + status("Off.".into()); + continue; + }; + let hotkey: Hotkey = match key.parse() { + Ok(h) => h, + Err(e) => { + status(format!("{e}")); + continue; + } + }; + if manager.is_none() { + match HotkeyManager::new().await { + Ok(m) => manager = Some(m), + Err(e) => { + status(format!("Global hotkeys are not available: {e}")); + continue; + } + } + } + let Some(m) = &mut manager else { continue }; + match m.register(PTT_ID, "Push to talk", hotkey).await { + Ok(registered) => { + events = Some(registered); + status(match m.backend() { + BackendKind::Portal => format!( + "Registered with the desktop: {}", + m.trigger_description(PTT_ID).unwrap_or(key) + ), + BackendKind::X11 => format!("Active: {hotkey} (X11)"), + BackendKind::WindowsHook => format!("Active: {hotkey}"), + }); + } + Err(e) => status(format!("Could not register {key}: {e}")), + } + } + event = next(&mut events) => match event { + Some(HotkeyEvent::Pressed) => transmit(true), + Some(HotkeyEvent::Released) => transmit(false), + None => { + events = None; + status("The hotkey was removed by the desktop.".into()); + } + }, + } + } +} diff --git a/crates/voelin-ui/src/lib.rs b/crates/voelin-ui/src/lib.rs new file mode 100644 index 0000000..b9ad8f5 --- /dev/null +++ b/crates/voelin-ui/src/lib.rs @@ -0,0 +1,9 @@ +//! Slint user interface shared by the desktop binary and the mobile apps. + +mod app; +mod hotkey; +mod settings; +mod streams; +mod video; + +pub use app::{HostedEngine, RunOptions, run}; diff --git a/crates/tsc-ui/src/main.rs b/crates/voelin-ui/src/main.rs similarity index 52% rename from crates/tsc-ui/src/main.rs rename to crates/voelin-ui/src/main.rs index ededc93..d08419f 100644 --- a/crates/tsc-ui/src/main.rs +++ b/crates/voelin-ui/src/main.rs @@ -1,5 +1,9 @@ //! Desktop client. +// Release builds on Windows are GUI programs (no console window); debug +// builds keep the console for logs. +#![cfg_attr(not(debug_assertions), windows_subsystem = "windows")] + use anyhow::Result; use tracing_subscriber::EnvFilter; @@ -9,5 +13,5 @@ fn main() -> Result<()> { EnvFilter::try_from_default_env().unwrap_or_else(|_| EnvFilter::new("warn")), ) .init(); - tsc_ui::run(tsc_ui::RunOptions::default()) + voelin_ui::run(voelin_ui::RunOptions::default()) } diff --git a/crates/voelin-ui/src/settings.rs b/crates/voelin-ui/src/settings.rs new file mode 100644 index 0000000..7fb69af --- /dev/null +++ b/crates/voelin-ui/src/settings.rs @@ -0,0 +1,263 @@ +//! Settings kept in the store (besides bookmarks and identities), and their +//! conversion to and from the forms of the settings page. + +use std::collections::BTreeMap; + +use serde::{Deserialize, Serialize}; +use voelin_audio::process::NoiseLevel; +use voelin_core::{AudioSettings, TransmitMode}; + +use crate::app::AudioForm; + +/// Store keys. +pub const AUDIO_KEY: &str = "audio"; +pub const UI_KEY: &str = "ui"; +pub const CLIENT_PLAYBACK_KEY: &str = "client_playback"; + +/// Frame rates and bitrates (kbit/s) of the share dialog. +pub const FPS_CHOICES: [u32; 3] = [15, 30, 60]; +pub const BITRATE_CHOICES: [u32; 4] = [2500, 4608, 8000, 10_000]; + +#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)] +#[serde(default)] +pub struct UiSettings { + /// Global push-to-talk hotkey (besides the button in the window). + pub global_ptt: bool, + /// E.g. `Ctrl+Shift+T` (`voelin_platform::Hotkey` syntax). + pub ptt_key: String, + /// H.264 through Cisco's OpenH264, downloaded on request. + pub openh264: bool, + /// The ScreenCast portal's token for the last shared screen. + pub portal_restore_token: Option, + pub share: ShareDefaults, + /// Write crash reports to disk (opt-in; never uploaded). + pub crash_reports: bool, +} + +impl Default for UiSettings { + fn default() -> Self { + Self { + global_ptt: true, + ptt_key: "Ctrl+Shift+T".into(), + openh264: false, + portal_restore_token: None, + share: ShareDefaults::default(), + crash_reports: false, + } + } +} + +/// The last choices in the share dialog. +#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)] +#[serde(default)] +pub struct ShareDefaults { + pub fps_index: usize, + pub bitrate_index: usize, + pub audio: bool, + pub auto_accept: bool, +} + +impl Default for ShareDefaults { + fn default() -> Self { + Self { fps_index: 1, bitrate_index: 1, audio: true, auto_accept: false } + } +} + +/// Local playback of one client, kept by its unique id. +#[derive(Clone, Copy, Debug, PartialEq, Serialize, Deserialize)] +pub struct ClientPlayback { + /// Linear, 1 = unchanged. + pub volume: f32, + pub muted: bool, +} + +impl Default for ClientPlayback { + fn default() -> Self { + Self { volume: 1.0, muted: false } + } +} + +impl ClientPlayback { + pub fn is_default(&self) -> bool { + *self == Self::default() + } +} + +pub type ClientPlaybackMap = BTreeMap; + +/// Audio devices as listed in the settings: the system default first. +#[derive(Clone, Debug, Default, PartialEq, Eq)] +pub struct DeviceChoices { + pub names: Vec, + /// Device ids by index; `None` for the system default. + pub ids: Vec>, +} + +impl DeviceChoices { + /// `devices` as `(id, name, is_default)`. A selected device that is not + /// connected stays in the list, so the choice survives. + pub fn new(devices: &[(String, String, bool)], selected: Option<&str>) -> Self { + let default_name = devices.iter().find(|d| d.2).map(|d| d.1.as_str()); + let mut choices = Self { + names: vec![match default_name { + Some(name) => format!("System default ({name})"), + None => "System default".into(), + }], + ids: vec![None], + }; + for (id, name, _) in devices { + choices.names.push(name.clone()); + choices.ids.push(Some(id.clone())); + } + if let Some(id) = selected + && !choices.ids.iter().any(|i| i.as_deref() == Some(id)) + { + choices.names.push(format!("{id} (not connected)")); + choices.ids.push(Some(id.to_owned())); + } + choices + } + + pub fn index_of(&self, id: Option<&str>) -> usize { + self.ids.iter().position(|i| i.as_deref() == id).unwrap_or(0) + } + + pub fn id_at(&self, index: i32) -> Option { + usize::try_from(index).ok().and_then(|i| self.ids.get(i).cloned()).flatten() + } +} + +fn noise_index(level: NoiseLevel) -> i32 { + match level { + NoiseLevel::Low => 0, + NoiseLevel::Moderate => 1, + NoiseLevel::High => 2, + NoiseLevel::VeryHigh => 3, + } +} + +fn noise_level(index: i32) -> NoiseLevel { + match index { + 0 => NoiseLevel::Low, + 2 => NoiseLevel::High, + 3 => NoiseLevel::VeryHigh, + _ => NoiseLevel::Moderate, + } +} + +/// The settings page's form for `settings`. +pub fn audio_form( + settings: &AudioSettings, + inputs: &DeviceChoices, + outputs: &DeviceChoices, +) -> AudioForm { + let p = &settings.processing; + AudioForm { + input_index: inputs.index_of(settings.input_device.as_deref()) as i32, + output_index: outputs.index_of(settings.output_device.as_deref()) as i32, + transmit: match settings.transmit { + TransmitMode::PushToTalk => 0, + TransmitMode::VoiceActivation => 1, + TransmitMode::Continuous => 2, + }, + vad_threshold: settings.vad.threshold_db, + echo_cancellation: p.echo_cancellation, + noise_suppression: p.noise_suppression, + noise_level: noise_index(p.noise_level), + auto_gain: p.auto_gain, + input_gain: p.input_gain_db, + output_volume: settings.output_volume * 100.0, + playback_buffer: settings.playback_buffer_ms as f32, + } +} + +/// `settings` changed as the form says; what the form does not show stays. +pub fn apply_audio_form( + form: &AudioForm, + settings: &AudioSettings, + inputs: &DeviceChoices, + outputs: &DeviceChoices, +) -> AudioSettings { + let mut s = settings.clone(); + s.input_device = inputs.id_at(form.input_index); + s.output_device = outputs.id_at(form.output_index); + s.transmit = match form.transmit { + 1 => TransmitMode::VoiceActivation, + 2 => TransmitMode::Continuous, + _ => TransmitMode::PushToTalk, + }; + s.vad.threshold_db = form.vad_threshold; + s.processing.echo_cancellation = form.echo_cancellation; + s.processing.noise_suppression = form.noise_suppression; + s.processing.noise_level = noise_level(form.noise_level); + s.processing.auto_gain = form.auto_gain; + s.processing.input_gain_db = form.input_gain; + s.output_volume = (form.output_volume / 100.0).clamp(0.0, 4.0); + s.playback_buffer_ms = form.playback_buffer.round().clamp(20.0, 180.0) as u32; + s +} + +#[cfg(test)] +mod tests { + use super::*; + + fn devices() -> Vec<(String, String, bool)> { + vec![ + ("alsa:hw:0,0".into(), "Built-in".into(), true), + ("alsa:hw:1,0".into(), "Headset".into(), false), + ] + } + + #[test] + fn device_choices() { + let choices = DeviceChoices::new(&devices(), None); + assert_eq!(choices.names, ["System default (Built-in)", "Built-in", "Headset"]); + assert_eq!(choices.index_of(Some("alsa:hw:1,0")), 2); + assert_eq!(choices.id_at(0), None); + assert_eq!(choices.id_at(2).as_deref(), Some("alsa:hw:1,0")); + assert_eq!(choices.id_at(9), None); + // An unplugged device stays selectable. + let choices = DeviceChoices::new(&devices(), Some("usb:mic")); + assert_eq!(choices.names.last().unwrap(), "usb:mic (not connected)"); + assert_eq!(choices.index_of(Some("usb:mic")), 3); + } + + #[test] + fn audio_form_roundtrip() { + let inputs = DeviceChoices::new(&devices(), None); + let outputs = DeviceChoices::new(&devices(), None); + let mut settings = AudioSettings { + transmit: TransmitMode::VoiceActivation, + input_device: Some("alsa:hw:1,0".into()), + output_volume: 0.5, + playback_buffer_ms: 80, + ..Default::default() + }; + settings.vad.threshold_db = -35.0; + settings.processing.noise_level = NoiseLevel::High; + settings.processing.input_gain_db = 6.0; + let form = audio_form(&settings, &inputs, &outputs); + assert_eq!((form.input_index, form.output_index, form.transmit), (2, 0, 1)); + assert_eq!(form.output_volume, 50.0); + assert_eq!(apply_audio_form(&form, &settings, &inputs, &outputs), settings); + + let form = + AudioForm { transmit: 2, echo_cancellation: false, playback_buffer: 500.0, ..form }; + let changed = apply_audio_form(&form, &settings, &inputs, &outputs); + assert_eq!(changed.transmit, TransmitMode::Continuous); + assert!(!changed.processing.echo_cancellation); + assert_eq!(changed.playback_buffer_ms, 180); + } + + #[test] + fn ui_settings_defaults() { + let parsed: UiSettings = serde_json::from_str(r#"{"openh264":true}"#).unwrap(); + assert!(parsed.openh264); + assert!(!parsed.crash_reports, "crash reports are opt-in"); + assert_eq!(parsed.ptt_key, "Ctrl+Shift+T"); + assert_eq!(parsed.share, ShareDefaults::default()); + let map: ClientPlaybackMap = + serde_json::from_str(r#"{"uid=":{"volume":0.5,"muted":false}}"#).unwrap(); + assert_eq!(map["uid="].volume, 0.5); + } +} diff --git a/crates/voelin-ui/src/streams.rs b/crates/voelin-ui/src/streams.rs new file mode 100644 index 0000000..bfc8d1d --- /dev/null +++ b/crates/voelin-ui/src/streams.rs @@ -0,0 +1,609 @@ +//! Streams (TeamSpeak 6): the streams panel, sharing our screen and the +//! viewer. The engine runs the stream sessions; `video.rs` captures, +//! encodes and decodes. + +use slint::{ComponentHandle, Model}; +use voelin_core::stream::{EndReason, LeaveReason, StreamSetup, ViewerInfo, ViewerState}; +use voelin_core::{Command, Event, StreamState, WatchState}; + +use crate::app::{App, Bridge, ShareForm, SourceItem, StreamItem, ViewerItem, later, model}; +use crate::settings::{BITRATE_CHOICES, FPS_CHOICES, ShareDefaults}; +use crate::video::{self, Capture, CaptureRequest, Decoder}; + +/// Our stream. +pub(crate) struct Share { + pub session: i64, + /// Stops capturing when dropped. + capture: Capture, + /// The server confirmed the stream. + live: bool, + viewers: Vec, + /// The capture ended by itself and the stream is being stopped. + stopping: bool, +} + +/// The stream in the viewer. +pub(crate) struct Watch { + /// `None` for the local demo stream. + session: Option, + stream_id: String, + title: String, + streamer: String, + /// Shown over the picture; empty while it plays. + status: String, + connected: bool, + ended: bool, + has_frame: bool, + /// Shown instead of the chat. + shown: bool, + decoder: Option, +} + +fn end_text(reason: &EndReason, streamer: &str) -> String { + match reason { + EndReason::Local => "You left the stream.".into(), + EndReason::Denied => format!("{streamer} did not let you watch."), + EndReason::Stopped => "The stream has ended.".into(), + EndReason::Removed(Some(LeaveReason::Kicked | LeaveReason::Banned)) => { + format!("{streamer} removed you from the stream.") + } + EndReason::Removed(_) => "You were removed from the stream.".into(), + EndReason::Failed(e) => format!("The stream failed: {e}"), + } +} + +fn share_end_text(reason: &EndReason) -> String { + match reason { + EndReason::Failed(e) => format!("Sharing failed: {e}"), + _ => "Sharing ended.".into(), + } +} + +impl App { + pub(crate) fn stream_event(&mut self, event: Event) { + match event { + Event::StreamsChanged { session, streams } => { + let view = self.sessions.entry(session as i64).or_default(); + // Development switch: watch the first stream that shows up. + let autowatch = std::env::var("VOELIN_AUTOWATCH").is_ok_and(|v| v == "1") + && self.watch.is_none() + && self.current == Some(session as i64); + let first = streams + .iter() + .find(|s| view.state.own_client != Some(s.streamer.0)) + .map(|s| s.id.clone()); + view.streams = streams; + self.refresh_streams(); + if autowatch && let Some(id) = first { + self.watch_stream(id); + } + } + Event::StreamState { session, state } => self.share_state(session as i64, state), + Event::StreamViewerRequest { session, viewer, .. } => { + let name = self.sessions.entry(session as i64).or_default().nickname(viewer); + self.set_status(format!("{name} wants to watch your stream")); + } + Event::StreamViewers { session, viewers } => { + if let Some(share) = self.share.as_mut().filter(|s| s.session == session as i64) { + share.viewers = viewers; + self.refresh_streams(); + } + } + Event::WatchState { session, stream_id, state } => { + self.watch_state(session as i64, &stream_id, state); + } + // Also flagged on the sink, which the encoder reads. + Event::StreamKeyframeRequest { .. } => {} + _ => {} + } + } + + fn share_state(&mut self, session: i64, state: StreamState) { + let Some(share) = self.share.as_mut().filter(|s| s.session == session) else { return }; + match state { + StreamState::Starting => {} + StreamState::Live { sink, .. } => { + share.live = true; + share.capture.attach(sink); + self.set_status("You are sharing your screen"); + } + StreamState::Ended(reason) => { + let local = reason == EndReason::Local || share.stopping; + self.share = None; + self.share_error = if local { String::new() } else { share_end_text(&reason) }; + self.set_status(if local { + "You stopped sharing".into() + } else { + share_end_text(&reason) + }); + } + } + self.refresh_streams(); + } + + fn watch_state(&mut self, session: i64, stream_id: &str, state: WatchState) { + let Some(watch) = self + .watch + .as_mut() + .filter(|w| w.session == Some(session) && w.stream_id == stream_id && !w.ended) + else { + return; + }; + match state { + WatchState::Requested => { + watch.status = format!("Waiting for {} to let you watch…", watch.streamer); + } + WatchState::Connecting => { + watch.status = format!("Connecting to {}…", watch.streamer); + } + WatchState::Connected => { + watch.connected = true; + if !watch.has_frame { + watch.status = "Waiting for the picture…".into(); + } + } + WatchState::Ended(reason) => { + watch.ended = true; + watch.decoder = None; + watch.status = end_text(&reason, &watch.streamer); + } + } + self.refresh_viewer(); + self.refresh_streams(); + } + + /// The streams panel, the share dialog's live part and the toolbar. + pub(crate) fn refresh_streams(&self) { + let Some(ui) = self.ui.upgrade() else { return }; + let bridge = ui.global::(); + let view = self.view(); + let current = self.current; + let mut items: Vec = Vec::new(); + if let Some(view) = view.filter(|v| v.streams_available()) { + for s in &view.streams { + let watching = self + .watch + .as_ref() + .is_some_and(|w| w.session == current && w.stream_id == s.id && !w.ended); + items.push(StreamItem { + id: s.id.clone().into(), + name: s.name.clone().into(), + streamer: view.nickname(s.streamer.0).into(), + audio: s.audio, + watching, + own: view.state.own_client == Some(s.streamer.0), + }); + } + // Streams that started before we joined are only known by the + // streaming flag: the server does not tell their ids. + let channel = view.state.own_channel; + for c in view.presence.clients.values() { + let announced = view.streams.iter().any(|s| s.streamer.0 == c.id); + if c.streaming == Some(true) + && Some(c.channel) == channel + && !announced && view.state.own_client != Some(c.id) + { + items.push(StreamItem { + name: c.nickname.clone().into(), + streamer: c.nickname.clone().into(), + ..StreamItem::default() + }); + } + } + } + if self.demo { + items.push(StreamItem { + id: "demo".into(), + name: "Test pattern".into(), + streamer: "local preview".into(), + audio: false, + watching: self.watch.as_ref().is_some_and(|w| w.session.is_none() && !w.ended), + own: false, + }); + } + bridge.set_streams_available(self.demo || view.is_some_and(|v| v.streams_available())); + bridge.set_streams(model(items)); + bridge.set_can_share(video::AVAILABLE); + + let share = self.share.as_ref().filter(|s| Some(s.session) == current); + let state = match share { + Some(s) if s.live => "live", + Some(_) => "starting", + None if self.share_busy => "starting", + None => "", + }; + bridge.set_share_state(state.into()); + bridge.set_share_busy(self.share_busy); + bridge.set_share_error(self.share_error.clone().into()); + let viewers: Vec = share + .map(|s| { + s.viewers + .iter() + .map(|v| ViewerItem { + client: i32::from(v.client.0), + name: view + .map_or_else(String::new, |view| view.nickname(v.client.0)) + .into(), + state: match v.state { + ViewerState::Requested => "requested", + ViewerState::Connecting => "connecting", + ViewerState::Connected => "connected", + } + .into(), + message: v.message.clone().into(), + }) + .collect() + }) + .unwrap_or_default(); + let requests = viewers.iter().filter(|v| v.state == "requested").count(); + bridge.set_share_requests(requests as i32); + bridge.set_share_viewers(model(viewers)); + let status = match share { + Some(s) if s.live => s.capture.status(), + Some(s) => format!("Starting the stream of {}…", s.capture.source_name()), + None if self.share_busy => "Starting the capture…".into(), + None => String::new(), + }; + bridge.set_share_status(status.into()); + } + + fn refresh_viewer(&self) { + let Some(ui) = self.ui.upgrade() else { return }; + let bridge = ui.global::(); + let Some(watch) = &self.watch else { + bridge.set_viewer_open(false); + bridge.set_viewer_has_frame(false); + bridge.set_viewer_frame(slint::Image::default()); + return; + }; + bridge.set_viewer_open( + watch.shown && (watch.session.is_none() || watch.session == self.current), + ); + bridge.set_viewer_title(watch.title.clone().into()); + bridge.set_viewer_status(watch.status.clone().into()); + bridge.set_viewer_ended(watch.ended); + bridge.set_viewer_has_frame(watch.has_frame); + bridge.set_viewer_volume(self.stream_volume); + let info = watch.decoder.as_ref().map(Decoder::info).unwrap_or_default(); + let info = [format!("by {}", watch.streamer), info] + .into_iter() + .filter(|s| !s.is_empty()) + .collect::>() + .join(" · "); + bridge.set_viewer_info(info.into()); + } + + /// Once a second: statistics, a capture that ended, decoder problems. + pub(crate) fn tick_streams(&mut self) { + if let Some(share) = &mut self.share + && share.live + && !share.stopping + && share.capture.ended() + { + share.stopping = true; + self.engine.send(Command::StopStream { session: share.session as u64 }); + } + if let Some(watch) = &mut self.watch + && watch.connected + && !watch.has_frame + && let Some(error) = watch.decoder.as_ref().and_then(Decoder::error) + { + watch.status = if error.contains("H264") || error.contains("OpenH264") { + format!("{error}. Enable H.264 in Settings → Streaming to watch this stream.") + } else { + format!("Cannot show the picture: {error}") + }; + } + if self.share.is_some() { + self.refresh_streams(); + } + if self.watch.is_some() { + self.refresh_viewer(); + } + } + + // Sharing. + + /// Fill the share dialog: sources and the last choices. + pub(crate) fn open_share(&mut self) -> ShareForm { + let test_pattern = cfg!(debug_assertions) + || self.demo + || std::env::var("VOELIN_TEST_PATTERN").is_ok_and(|v| v == "1"); + let sources = match self.video.sources(test_pattern) { + Ok(sources) => { + if self.share.is_none() { + self.share_error.clear(); + } + sources + } + Err(e) => { + self.share_error = e; + Vec::new() + } + }; + if let Some(ui) = self.ui.upgrade() { + let items: Vec = sources + .into_iter() + .map(|(name, detail)| SourceItem { name: name.into(), detail: detail.into() }) + .collect(); + ui.global::().set_share_sources(model(items)); + } + self.refresh_streams(); + let defaults = &self.settings.share; + let nickname = self.current.and_then(|id| self.bookmark(id)).map(|b| b.nickname.clone()); + ShareForm { + source: 0, + name: match nickname { + Some(nick) if !nick.is_empty() => format!("{nick}'s screen").into(), + _ => "Screen".into(), + }, + fps_index: defaults.fps_index.min(FPS_CHOICES.len() - 1) as i32, + bitrate_index: defaults.bitrate_index.min(BITRATE_CHOICES.len() - 1) as i32, + audio: defaults.audio, + auto_accept: defaults.auto_accept, + } + } + + /// Development switch `VOELIN_AUTOSHARE`: share the test pattern once. + pub(crate) fn autoshare(&mut self) { + if !self.autoshare || !self.view().is_some_and(|v| v.streams_available()) { + return; + } + self.autoshare = false; + let mut form = self.open_share(); + let Some(ui) = self.ui.upgrade() else { return }; + let sources = ui.global::().get_share_sources(); + let pattern = (0..sources.row_count()) + .find(|&i| sources.row_data(i).is_some_and(|s| s.name == "Test pattern")); + let Some(index) = pattern else { return }; + form.source = index as i32; + form.auto_accept = true; + self.start_share(form); + } + + pub(crate) fn start_share(&mut self, form: ShareForm) { + let Some(session) = self.current else { return }; + if self.share_busy || self.share.is_some() { + return; + } + let index = |i: i32, len: usize| usize::try_from(i).unwrap_or(0).min(len - 1); + let defaults = ShareDefaults { + fps_index: index(form.fps_index, FPS_CHOICES.len()), + bitrate_index: index(form.bitrate_index, BITRATE_CHOICES.len()), + audio: form.audio, + auto_accept: form.auto_accept, + }; + let request = CaptureRequest { + fps: FPS_CHOICES[defaults.fps_index], + bitrate_kbps: BITRATE_CHOICES[defaults.bitrate_index], + audio: form.audio, + restore_token: self.settings.portal_restore_token.clone(), + }; + let bitrate = request.bitrate_kbps; + self.settings.share = defaults; + self.store_settings(); + self.share_busy = true; + self.share_error.clear(); + self.refresh_streams(); + let setup = StreamSetup { + name: form.name.trim().to_owned(), + bitrate, + audio: form.audio, + ..StreamSetup::default() + }; + let auto_accept = form.auto_accept; + let runtime = self.engine.runtime().clone(); + let source = usize::try_from(form.source).unwrap_or(0); + self.video.start_capture(&runtime, source, request, move |result| { + later(move |app| app.capture_ready(session, setup, auto_accept, result)); + }); + } + + /// The capture started (or not): go live. + fn capture_ready( + &mut self, + session: i64, + mut setup: StreamSetup, + auto_accept: bool, + result: Result, + ) { + self.share_busy = false; + match result { + Err(e) => { + self.share_error = format!("Could not start the capture: {e}"); + } + Ok(capture) => { + if let Some(token) = capture.restore_token() + && self.settings.portal_restore_token.as_ref() != Some(&token) + { + self.settings.portal_restore_token = Some(token); + self.store_settings(); + } + if setup.audio && !capture.has_audio() { + setup.audio = false; + let reason = capture.audio_error().unwrap_or_default(); + self.set_status(format!("Sharing without sound: {reason}")); + } + self.engine.send(Command::StartStream { + session: session as u64, + setup, + auto_accept, + }); + self.share = Some(Share { + session, + capture, + live: false, + viewers: Vec::new(), + stopping: false, + }); + } + } + self.refresh_streams(); + } + + pub(crate) fn stop_share(&mut self) { + if let Some(share) = &mut self.share { + share.stopping = true; + self.engine.send(Command::StopStream { session: share.session as u64 }); + } + } + + pub(crate) fn respond_viewer(&mut self, viewer: u16, accept: bool) { + if let Some(share) = &self.share { + let session = share.session as u64; + self.engine.send(Command::AcceptViewer { session, viewer, accept }); + } + } + + pub(crate) fn kick_viewer(&mut self, viewer: u16) { + if let Some(share) = &self.share { + self.engine.send(Command::KickViewer { session: share.session as u64, viewer }); + } + } + + // Watching. + + pub(crate) fn watch_stream(&mut self, stream_id: String) { + if stream_id == "demo" && self.demo { + self.start_demo(); + return; + } + let Some(session) = self.current else { return }; + let Some(view) = self.sessions.get(&session) else { return }; + let Some(info) = view.streams.iter().find(|s| s.id == stream_id) else { return }; + let streamer = view.nickname(info.streamer.0); + let title = + if info.name.is_empty() { format!("{streamer}'s stream") } else { info.name.clone() }; + self.leave_stream(); + self.engine + .send(Command::WatchStream { session: session as u64, stream_id: stream_id.clone() }); + if self.stream_volume != 100.0 { + self.engine.send(Command::SetStreamVolume { + session: session as u64, + stream_id: stream_id.clone(), + volume: self.stream_volume / 100.0, + }); + } + let wake = || later(|app| app.show_picture()); + let decoder = self.video.watch(&self.engine, session as u64, &stream_id, wake); + self.watch = Some(Watch { + session: Some(session), + stream_id, + title, + status: format!("Asking {streamer} to let you watch…"), + streamer, + connected: false, + ended: false, + has_frame: false, + shown: true, + decoder: Some(decoder), + }); + self.refresh_viewer(); + self.refresh_streams(); + } + + /// The local test stream in the viewer (`VOELIN_DEMO_STREAM`). + pub(crate) fn start_demo(&mut self) { + self.leave_stream(); + self.watch = Some(Watch { + session: None, + stream_id: "demo".into(), + title: "Test pattern".into(), + streamer: "local preview".into(), + status: "Starting the local preview…".into(), + connected: true, + ended: false, + has_frame: false, + shown: true, + decoder: None, + }); + let runtime = self.engine.runtime().clone(); + let wake = || later(|app| app.show_picture()); + self.video.demo(&runtime, wake, |result| { + later(move |app| { + let Some(watch) = app.watch.as_mut().filter(|w| w.session.is_none()) else { + return; + }; + match result { + Ok(decoder) => watch.decoder = Some(decoder), + Err(e) => watch.status = format!("The preview failed: {e}"), + } + app.refresh_viewer(); + }); + }); + self.refresh_viewer(); + self.refresh_streams(); + } + + /// A decoded picture is waiting. + fn show_picture(&mut self) { + let Some(watch) = &mut self.watch else { return }; + let Some(image) = watch.decoder.as_ref().and_then(Decoder::take_picture) else { return }; + let first = !watch.has_frame; + watch.has_frame = true; + if first { + watch.status.clear(); + } + if let Some(ui) = self.ui.upgrade() { + let bridge = ui.global::(); + bridge.set_viewer_frame(image); + if first { + self.refresh_viewer(); + } + } + } + + pub(crate) fn show_viewer(&mut self, shown: bool) { + if let Some(watch) = &mut self.watch { + watch.shown = shown; + } + if !shown { + self.set_fullscreen(false); + } + self.refresh_viewer(); + self.refresh_streams(); + } + + /// Stop watching and close the viewer. + pub(crate) fn leave_stream(&mut self) { + if let Some(watch) = self.watch.take() + && let Some(session) = watch.session + && !watch.ended + { + self.engine + .send(Command::LeaveStream { session: session as u64, stream_id: watch.stream_id }); + } + self.set_fullscreen(false); + self.refresh_viewer(); + self.refresh_streams(); + } + + pub(crate) fn set_stream_volume(&mut self, percent: f32) { + self.stream_volume = percent.round().clamp(0.0, 200.0); + if let Some(watch) = &self.watch + && let Some(session) = watch.session + { + self.engine.send(Command::SetStreamVolume { + session: session as u64, + stream_id: watch.stream_id.clone(), + volume: self.stream_volume / 100.0, + }); + } + } + + pub(crate) fn toggle_fullscreen(&mut self) { + let Some(ui) = self.ui.upgrade() else { return }; + let full = !ui.global::().get_viewer_fullscreen(); + self.set_fullscreen(full); + } + + fn set_fullscreen(&self, full: bool) { + let Some(ui) = self.ui.upgrade() else { return }; + let bridge = ui.global::(); + if bridge.get_viewer_fullscreen() == full { + return; + } + bridge.set_viewer_fullscreen(full); + ui.window().set_fullscreen(full); + } +} diff --git a/crates/voelin-ui/src/video.rs b/crates/voelin-ui/src/video.rs new file mode 100644 index 0000000..35632e1 --- /dev/null +++ b/crates/voelin-ui/src/video.rs @@ -0,0 +1,400 @@ +//! Video of streams for the UI: capture and encoding when we share, decoding +//! into Slint images when we watch, and the optional OpenH264 library +//! (desktop; Android decodes H.264 with the device's MediaCodec). + +use std::path::Path; +#[cfg(not(target_os = "android"))] +use std::path::PathBuf; +use std::sync::Arc; + +use slint::{Image, Rgba8Pixel, SharedPixelBuffer}; +use tokio::runtime::Handle; +use tracing::warn; +use voelin_core::media::voelin_media::capture::SourceId; +use voelin_core::media::voelin_media::{Codecs, VideoFrame, convert}; +use voelin_core::media::{ + self, Latest, LocalPreview, Streamer, StreamerConfig, Viewer, peer_config, stream_codec, +}; +use voelin_core::stream::PeerConfig; +use voelin_core::{Engine, StreamSink}; + +/// Whether this build can share and decode video. +pub const AVAILABLE: bool = true; + +type Picture = SharedPixelBuffer; + +/// Human-readable text for a picture size. +fn size_text(width: u32, height: u32) -> String { + if width == 0 || height == 0 { String::new() } else { format!("{width}×{height}") } +} + +/// Cisco's OpenH264, downloaded on the user's request. +#[cfg(not(target_os = "android"))] +mod openh264 { + pub use voelin_core::media::voelin_media::codec::h264::{ + OPENH264_VERSION, OpenH264, download_openh264, + }; + + pub enum State { + Off, + /// Enabled, but not downloaded yet (or the file is not a known build). + Missing(String), + Downloading, + Loaded(std::path::PathBuf), + } +} + +/// The result of [`Video::download_h264`]. +#[cfg(not(target_os = "android"))] +pub(crate) struct H264Download(Result); +#[cfg(target_os = "android")] +pub(crate) struct H264Download; + +pub(crate) struct Video { + codecs: Arc, + #[cfg(not(target_os = "android"))] + openh264_dir: PathBuf, + #[cfg(not(target_os = "android"))] + h264: openh264::State, + /// Sources of the share dialog, by index. + sources: Vec<(SourceId, String)>, +} + +impl Video { + pub fn new(data_dir: &Path, openh264: bool) -> Self { + #[cfg(target_os = "android")] + let _ = (data_dir, openh264); + #[allow(unused_mut, reason = "set_h264 does nothing on Android")] + let mut video = Self { + codecs: Arc::new(Codecs::new()), + #[cfg(not(target_os = "android"))] + openh264_dir: data_dir.join("openh264"), + #[cfg(not(target_os = "android"))] + h264: openh264::State::Off, + sources: Vec::new(), + }; + #[cfg(not(target_os = "android"))] + video.set_h264(openh264); + video + } + + /// `base` with the codecs this machine can encode and decode. + pub fn peer_config(&self, base: PeerConfig) -> PeerConfig { + peer_config(&self.codecs, base) + } + + /// Whether H.264 works, and a line for the settings page. + pub fn h264_status(&self) -> (bool, String) { + #[cfg(target_os = "android")] + return (true, "H.264 uses the device's codecs.".into()); + #[cfg(not(target_os = "android"))] + match &self.h264 { + openh264::State::Off => (false, String::new()), + openh264::State::Missing(reason) => (false, reason.clone()), + openh264::State::Downloading => (false, "Downloading OpenH264 from Cisco…".into()), + openh264::State::Loaded(path) => ( + true, + format!("OpenH264 {} is loaded ({}).", openh264::OPENH264_VERSION, path.display()), + ), + } + } + + /// Enable or disable H.264; enabling loads a library downloaded earlier. + /// Takes effect for new connections. + pub fn set_h264(&mut self, enabled: bool) { + #[cfg(target_os = "android")] + let _ = enabled; + #[cfg(not(target_os = "android"))] + { + use openh264::State; + if !enabled { + self.h264 = State::Off; + self.codecs = Arc::new(Codecs::new()); + return; + } + if matches!(self.h264, State::Loaded(_) | State::Downloading) { + return; + } + match openh264::OpenH264::find_in(&self.openh264_dir) { + Ok(library) => self.loaded(library), + Err(_) => self.h264 = State::Missing("OpenH264 is not downloaded yet.".into()), + } + } + } + + #[cfg(not(target_os = "android"))] + fn loaded(&mut self, library: openh264::OpenH264) { + self.h264 = openh264::State::Loaded(library.path().to_owned()); + self.codecs = Arc::new(Codecs::new().with_openh264(library)); + } + + /// Download Cisco's OpenH264 (only on the user's request). `done` runs + /// on the runtime; pass its argument to [`Video::downloaded`]. + pub fn download_h264( + &mut self, + runtime: &Handle, + done: impl FnOnce(H264Download) + Send + 'static, + ) { + #[cfg(target_os = "android")] + let _ = (runtime, done); + #[cfg(not(target_os = "android"))] + { + use openh264::State; + if matches!(self.h264, State::Downloading | State::Loaded(_)) { + return; + } + self.h264 = State::Downloading; + let dir = self.openh264_dir.clone(); + runtime.spawn(async move { + let result = openh264::download_openh264(&dir).await.map_err(|e| e.to_string()); + done(H264Download(result)); + }); + } + } + + pub fn downloaded(&mut self, download: H264Download, enabled: bool) { + #[cfg(target_os = "android")] + let _ = (download, enabled); + #[cfg(not(target_os = "android"))] + match download.0 { + Ok(library) if enabled => self.loaded(library), + Ok(_) => self.h264 = openh264::State::Off, + Err(e) => { + warn!("OpenH264 download failed: {e}"); + self.h264 = openh264::State::Missing(format!("Download failed: {e}")); + } + } + } + + /// Screens and windows to share, as (name, detail); the test pattern too + /// when asked for. + pub fn sources(&mut self, test_pattern: bool) -> Result, String> { + let mut error = None; + let mut sources = match media::screen_sources() { + Ok(list) => list, + Err(e) => { + error = Some(e.to_string()); + Vec::new() + } + }; + if test_pattern { + sources.push(media::test_pattern_source()); + } + if sources.is_empty() { + return Err(error.unwrap_or_else(|| "Nothing to share was found.".into())); + } + self.sources = sources.iter().map(|s| (s.id.clone(), s.name.clone())).collect(); + Ok(sources + .iter() + .map(|s| { + let name = match s.id { + SourceId::Portal => "Choose via system dialog".to_owned(), + _ => s.name.clone(), + }; + let detail = match (&s.id, s.primary) { + (SourceId::Monitor(_), true) => { + format!("{} · primary", size_text(s.width, s.height)) + } + (SourceId::Window(_), _) => { + format!("window {}", size_text(s.width, s.height)).trim().to_owned() + } + _ => size_text(s.width, s.height), + }; + (name, detail) + }) + .collect()) + } + + /// Start capturing source `index` of [`Video::sources`]; `done` runs on + /// the runtime (the portal may wait for the user first). + pub fn start_capture( + &self, + runtime: &Handle, + index: usize, + options: CaptureRequest, + done: impl FnOnce(Result) + Send + 'static, + ) { + let Some((source, name)) = self.sources.get(index).cloned() else { + done(Err("Pick something to share.".into())); + return; + }; + let peer = self.peer_config(PeerConfig::default()); + let Some(codec) = stream_codec(&self.codecs, &peer) else { + done(Err("No video encoder is available.".into())); + return; + }; + let codecs = self.codecs.clone(); + let config = StreamerConfig { + source, + fps: options.fps, + bitrate_kbps: options.bitrate_kbps, + codec, + audio: options.audio, + restore_token: options.restore_token, + ..StreamerConfig::default() + }; + runtime.spawn(async move { + let result = Streamer::start(&codecs, config).await; + done(result.map(|streamer| Capture { streamer, name }).map_err(|e| e.to_string())); + }); + } + + /// Decode stream `stream_id` of `session`; `wake` is called (on the + /// decoder thread) when a picture is ready and none is waiting. + pub fn watch( + &self, + engine: &Engine, + session: u64, + stream_id: &str, + wake: impl Fn() + Send + Sync + 'static, + ) -> Decoder { + let pictures = Arc::new(Latest::new()); + let on_frame = deliver(pictures.clone(), wake); + let viewer = Viewer::start(engine, session, stream_id, self.codecs.clone(), on_frame); + Decoder { source: Source::Viewer(viewer), pictures } + } + + /// The test pattern through the encoder and decoder, without a server + /// (`VOELIN_DEMO_STREAM`). + pub fn demo( + &self, + runtime: &Handle, + wake: impl Fn() + Send + Sync + 'static, + done: impl FnOnce(Result) + Send + 'static, + ) { + let pictures = Arc::new(Latest::new()); + let on_frame = deliver(pictures.clone(), wake); + let codecs = self.codecs.clone(); + let config = StreamerConfig { source: SourceId::Synthetic, ..StreamerConfig::default() }; + runtime.spawn(async move { + let result = LocalPreview::start(codecs, config, on_frame).await; + done( + result + .map(|preview| Decoder { source: Source::Preview(preview), pictures }) + .map_err(|e| e.to_string()), + ); + }); + } +} + +/// Converts decoded frames into Slint pixel buffers, keeping the newest. +fn deliver( + pictures: Arc>, + wake: impl Fn() + Send + Sync + 'static, +) -> impl FnMut(VideoFrame) + Send + 'static { + move |frame: VideoFrame| { + let mut buffer = Picture::new(frame.width, frame.height); + let stride = frame.width as usize * 4; + if let Err(e) = convert::to_rgba(&frame, buffer.make_mut_bytes(), stride) { + warn!("cannot show a picture: {e}"); + return; + } + if pictures.put(buffer) { + wake(); + } + } +} + +/// Share settings from the dialog. +pub(crate) struct CaptureRequest { + pub fps: u32, + pub bitrate_kbps: u32, + pub audio: bool, + pub restore_token: Option, +} + +/// A running capture for our stream. Stops when dropped. +pub(crate) struct Capture { + streamer: Streamer, + name: String, +} + +impl Capture { + /// Encode into the live stream. + pub fn attach(&self, sink: StreamSink) { + self.streamer.attach(Arc::new(sink)); + } + + pub fn source_name(&self) -> &str { + &self.name + } + + pub fn has_audio(&self) -> bool { + self.streamer.has_audio() + } + + pub fn audio_error(&self) -> Option { + self.streamer.audio_error().map(str::to_owned) + } + + /// The portal's token for this choice, to keep. + pub fn restore_token(&self) -> Option { + self.streamer.restore_token().map(str::to_owned) + } + + /// The capture stopped by itself (e.g. sharing ended in the desktop). + pub fn ended(&self) -> bool { + self.streamer.stats().capture_ended + } + + /// One line about what is sent. + pub fn status(&self) -> String { + let stats = self.streamer.stats(); + let mut text = format!("{} · {}", self.name, size_text(stats.width, stats.height)); + text.push_str(&format!(" · {} frames sent", stats.video_frames)); + if self.streamer.has_audio() { + text.push_str(" · with sound"); + } + if let Some(e) = stats.error { + text.push_str(&format!(" · encoder: {e}")); + } + text + } +} + +enum Source { + Viewer(Viewer), + Preview(LocalPreview), +} + +/// Decodes a watched stream into pictures. Stops when dropped. +pub(crate) struct Decoder { + source: Source, + pictures: Arc>, +} + +impl Decoder { + /// The newest picture since the last call. + pub fn take_picture(&self) -> Option { + self.pictures.take().map(Image::from_rgba8) + } + + fn stats(&self) -> media::DecodeStats { + match &self.source { + Source::Viewer(v) => v.stats(), + Source::Preview(p) => p.stats(), + } + } + + /// One line about the video: codec, size, problems. + pub fn info(&self) -> String { + let stats = self.stats(); + let mut parts = Vec::new(); + if let Some(codec) = stats.codec { + parts.push(codec.to_string()); + } + if stats.width > 0 { + parts.push(size_text(stats.width, stats.height)); + } + if let Some(e) = stats.error { + parts.push(e); + } + parts.join(" · ") + } + + /// Whether pictures could never come (no decoder for the codec). + pub fn error(&self) -> Option { + let stats = self.stats(); + stats.error.filter(|_| stats.decoded == 0) + } +} diff --git a/crates/voelin-ui/ui/app.slint b/crates/voelin-ui/ui/app.slint new file mode 100644 index 0000000..a3afb12 --- /dev/null +++ b/crates/voelin-ui/ui/app.slint @@ -0,0 +1,1704 @@ +import { Button, LineEdit, ListView, ComboBox, CheckBox, Slider, AboutSlint, VerticalBox, HorizontalBox, ScrollView, TabWidget } from "std-widgets.slint"; + +export struct ServerItem { + id: int, + name: string, + address: string, + // "offline", "connecting", "observing" or "connected" + status: string, +} + +export struct TreeItem { + is-channel: bool, + depth: int, + id: int, + name: string, + own: bool, + talking: bool, + muted: bool, + sound-off: bool, + away: bool, + streaming: bool, + locked: bool, + collapsed: bool, + // Local playback of this client: muted, or its volume in percent + // (100 = unchanged). + local-muted: bool, + local-volume: int, + // Our own client. + myself: bool, +} + +export struct ChatTab { + title: string, + // 0 = server chat, 1 = channel chat + kind: int, + id: int, + unread: int, +} + +export struct ChatLine { + author: string, + text: string, + time: string, + relayed: bool, +} + +export struct BookmarkForm { + id: int, + name: string, + address: string, + nickname: string, + server-password: string, + gateway-url: string, + query-transport: string, + query-addr: string, + query-user: string, + query-password: string, +} + +// A stream in our channel. An empty id: a client that streams, but the +// server did not announce the stream to us (it started before we joined). +export struct StreamItem { + id: string, + name: string, + streamer: string, + audio: bool, + // Shown in the viewer. + watching: bool, + // Our own stream. + own: bool, +} + +// A viewer of our stream. state: "requested", "connecting" or "connected". +export struct ViewerItem { + client: int, + name: string, + state: string, + message: string, +} + +// A capture source for the share dialog. +export struct SourceItem { + name: string, + detail: string, +} + +export struct ShareForm { + source: int, + name: string, + // Index into the frame rate choices (15, 30, 60). + fps-index: int, + // Index into the bitrate choices (2.5, 4.6, 8, 10 Mbit/s). + bitrate-index: int, + audio: bool, + auto-accept: bool, +} + +export struct AudioForm { + // 0 = system default, then the devices. + input-index: int, + output-index: int, + // 0 = push-to-talk, 1 = voice activation, 2 = continuous. + transmit: int, + // dBFS. + vad-threshold: float, + echo-cancellation: bool, + noise-suppression: bool, + // 0 = low ... 3 = very high. + noise-level: int, + auto-gain: bool, + // dB. + input-gain: float, + // Percent. + output-volume: float, + // Milliseconds. + playback-buffer: float, +} + +// Local playback settings of one client. volume in percent. +export struct ClientAudio { + id: int, + name: string, + volume: float, + muted: bool, +} + +export global Bridge { + in property <[ServerItem]> servers; + in-out property current-server: -1; + in property <[TreeItem]> tree; + in property <[ChatTab]> tabs; + in-out property current-tab: 0; + in property <[ChatLine]> messages; + in property status-text; + in property server-title: @tr("No server selected"); + in property voice-connected; + in property voice-connecting; + in property observing; + in property can-observe; + in property input-muted; + in property output-muted; + in property transmitting; + in property presence-source; + + // Streams (TeamSpeak 6 while connected with voice). + in property streams-available; + in property <[StreamItem]> streams; + // Our stream: "", "starting", "live" or "ended". + in property share-state; + in property share-status; + in property <[ViewerItem]> share-viewers; + in property share-requests; + in property <[SourceItem]> share-sources; + in property share-error; + in property share-busy; + // Whether capture and encoding are built in. + in property can-share: true; + + // The stream shown in the viewer. + in property viewer-open; + in property viewer-frame; + in property viewer-has-frame; + in property viewer-title; + // Shown instead of (or over) the picture: waiting, ended, errors. + in property viewer-status; + in property viewer-info; + in property viewer-ended; + in-out property viewer-volume: 100; + in property viewer-fullscreen; + + // Settings. + in property <[string]> input-devices; + in property <[string]> output-devices; + in-out property audio; + // Microphone level in dBFS and whether voice is sent. + in property input-level: -100; + in property input-sending; + in property mic-test; + in-out property global-ptt; + in-out property ptt-key; + in property ptt-status; + in-out property h264-enabled; + in property h264-loaded; + in property h264-busy; + in property h264-status; + in property h264-attribution; + // The product name (voelin_platform::APP_NAME, not translated) and version. + in property app-name: "Voelin"; + in property app-version; + in-out property client-audio; + // Opt-in local crash reports, and a notice about reports on disk. + in-out property crash-reports; + in property crash-notice; + // Third-party notices, one entry per line, for the About page. + in property <[string]> notices; + + callback select-server(int); + callback connect-voice(); + callback disconnect-voice(); + callback toggle-observe(); + callback join-channel(int); + callback open-channel-chat(int); + callback toggle-collapse(int); + callback select-tab(int); + callback close-tab(int); + callback send-message(string); + callback set-input-muted(bool); + callback set-output-muted(bool); + callback push-to-talk(bool); + callback edit-bookmark(int) -> BookmarkForm; + callback save-bookmark(BookmarkForm); + callback delete-bookmark(int); + + callback open-share() -> ShareForm; + callback start-share(ShareForm); + callback stop-share(); + callback respond-viewer(int, bool); + callback kick-viewer(int); + callback watch-stream(string); + callback show-viewer(); + callback hide-viewer(); + callback leave-stream(); + callback set-stream-volume(float); + callback toggle-fullscreen(); + + callback open-settings(); + callback close-settings(); + callback audio-changed(AudioForm); + callback toggle-mic-test(); + callback apply-ptt(bool, string); + callback set-h264(bool); + callback download-h264(); + callback open-client(int) -> bool; + callback client-audio-changed(ClientAudio); + callback set-crash-reports(bool); + callback open-crash-folder(); + callback delete-crash-reports(); + callback dismiss-crash-notice(); + callback open-about(); +} + +component StatusDot inherits Rectangle { + in property status; + width: 10px; + height: 10px; + border-radius: 5px; + background: status == "connected" ? #3fb950 : status == "observing" ? #58a6ff : status == "connecting" ? #d29922 : #6e7681; +} + +component Field inherits HorizontalLayout { + in property label; + in-out property value; + in property placeholder; + in property input-type: InputType.text; + spacing: 8px; + Text { + text: label; + width: 130px; + vertical-alignment: center; + } + LineEdit { + text <=> value; + placeholder-text: placeholder; + input-type: input-type; + accessible-label: label; + } +} + +// A label beside a control, for settings rows. +component Row inherits HorizontalLayout { + in property label; + spacing: 8px; + Text { + text: label; + width: 170px; + vertical-alignment: center; + wrap: word-wrap; + } + @children +} + +// Small text tag in a list row. +component Tag inherits Text { + font-size: 10px; + vertical-alignment: center; +} + +// A dimmed full-window backdrop with a centered card. +component Dialog inherits Rectangle { + in property card-width: 520px; + in property card-height: 520px; + callback dismissed(); + background: #000000a0; + TouchArea { + clicked => { dismissed(); } + } + Rectangle { + width: min(parent.width - 32px, card-width); + height: min(parent.height - 32px, card-height); + background: #1f2328; + border-radius: 8px; + border-width: 1px; + border-color: #30363d; + // Clicks inside the card do not dismiss it. + TouchArea { } + @children + } +} + +component BookmarkEditor inherits Dialog { + in-out property form; + callback done(); + dismissed => { done(); } + VerticalBox { + Text { + text: form.id < 0 ? @tr("Add server") : @tr("Edit server"); + font-size: 18px; + font-weight: 700; + } + ScrollView { + VerticalLayout { + spacing: 6px; + Field { label: @tr("Name"); value <=> form.name; placeholder: @tr("My server"); } + Field { label: @tr("Address"); value <=> form.address; placeholder: "ts.example.org:9987"; } + Field { label: @tr("Nickname"); value <=> form.nickname; } + Field { label: @tr("Server password"); value <=> form.server-password; input-type: InputType.password; } + Text { + text: @tr("Invisible presence and chat without joining (optional)"); + font-weight: 600; + } + Field { label: @tr("Gateway URL"); value <=> form.gateway-url; placeholder: "wss://gw.example.org/v1"; } + HorizontalLayout { + spacing: 8px; + Text { + text: @tr("Query transport"); + width: 130px; + vertical-alignment: center; + } + ComboBox { + model: ["none", "ssh", "raw", "http"]; + current-value <=> form.query-transport; + accessible-label: @tr("Query transport"); + } + } + Field { label: @tr("Query address"); value <=> form.query-addr; placeholder: "ts.example.org:10022"; } + Field { label: @tr("Query login"); value <=> form.query-user; } + Field { label: @tr("Query password"); value <=> form.query-password; input-type: InputType.password; } + } + } + HorizontalLayout { + alignment: end; + spacing: 8px; + if form.id >= 0: Button { + text: @tr("Delete"); + clicked => { + Bridge.delete-bookmark(form.id); + done(); + } + } + Button { + text: @tr("Cancel"); + clicked => { done(); } + } + Button { + text: @tr("Save"); + primary: true; + enabled: form.address != "" && form.nickname != ""; + clicked => { + Bridge.save-bookmark(form); + done(); + } + } + } + } +} + +component ServerList inherits Rectangle { + callback add(); + callback edit(int); + background: #161b22; + accessible-role: list; + accessible-label: @tr("Servers"); + VerticalBox { + HorizontalLayout { + Text { + text: @tr("Servers"); + font-weight: 700; + vertical-alignment: center; + } + Button { + text: "+"; + width: 32px; + accessible-label: @tr("Add server"); + clicked => { add(); } + } + } + ListView { + for server[i] in Bridge.servers: Rectangle { + height: 48px; + border-radius: 6px; + background: Bridge.current-server == server.id ? #30363d : area.has-hover ? #21262d : transparent; + accessible-role: list-item; + accessible-label: server.name; + accessible-description: server.address; + accessible-item-selectable: true; + accessible-item-selected: Bridge.current-server == server.id; + accessible-action-default => { Bridge.select-server(server.id); } + area := TouchArea { + clicked => { Bridge.select-server(server.id); } + double-clicked => { edit(server.id); } + } + HorizontalLayout { + padding: 6px; + spacing: 8px; + StatusDot { + status: server.status; + y: (parent.height - self.height) / 2; + } + VerticalLayout { + Text { + text: server.name; + font-weight: 600; + overflow: elide; + } + Text { + text: server.address; + font-size: 11px; + color: #8b949e; + overflow: elide; + } + } + } + } + } + } +} + +component ChannelTree inherits Rectangle { + // A client row was clicked: its local volume and mute. + callback client-clicked(int); + background: #0d1117; + accessible-role: list; + accessible-label: @tr("Channels and clients"); + ListView { + for row in Bridge.tree: Rectangle { + height: 26px; + background: row-area.has-hover ? #161b22 : transparent; + accessible-role: list-item; + accessible-label: row.is-channel ? @tr("Channel {}", row.name) : row.name; + accessible-description: (row.talking ? @tr("talking") + " " : "") + (row.streaming ? @tr("streaming") + " " : "") + (row.muted ? @tr("microphone off") + " " : "") + (row.local-muted ? @tr("muted for you") : ""); + accessible-action-default => { + if (row.is-channel) { + Bridge.open-channel-chat(row.id); + } else { + client-clicked(row.id); + } + } + row-area := TouchArea { + double-clicked => { + if (row.is-channel) { + Bridge.join-channel(row.id); + } + } + clicked => { + if (row.is-channel) { + Bridge.open-channel-chat(row.id); + } else if (!row.myself) { + client-clicked(row.id); + } + } + } + HorizontalLayout { + padding-left: 8px + row.depth * 18px; + padding-right: 8px; + spacing: 6px; + if row.is-channel: Text { + text: row.collapsed ? "▸" : "▾"; + vertical-alignment: center; + accessible-role: button; + accessible-label: row.collapsed ? @tr("Expand") : @tr("Collapse"); + accessible-action-default => { Bridge.toggle-collapse(row.id); } + TouchArea { + clicked => { Bridge.toggle-collapse(row.id); } + } + } + if !row.is-channel: Rectangle { + width: 10px; + height: 10px; + y: (parent.height - self.height) / 2; + border-radius: 5px; + background: row.talking ? #3fb950 : #30363d; + } + Text { + text: (row.is-channel ? "# " : "") + row.name; + horizontal-stretch: 1; + horizontal-alignment: left; + vertical-alignment: center; + font-weight: row.is-channel || row.own ? 600 : 400; + color: row.away ? #8b949e : row.own ? #58a6ff : #e6edf3; + overflow: elide; + } + if row.locked: Tag { text: @tr("password"); color: #d29922; } + if row.muted: Tag { text: @tr("mic off"); color: #f85149; } + if row.sound-off: Tag { text: @tr("sound off"); color: #f85149; } + if row.local-muted: Tag { text: @tr("muted for you"); color: #f0883e; } + if !row.local-muted && row.local-volume != 100 && !row.is-channel: Tag { + text: @tr("{}%", row.local-volume); + color: #8b949e; + } + if row.streaming: Tag { text: @tr("LIVE"); color: #a371f7; font-weight: 700; } + if row.away: Tag { text: @tr("away"); color: #8b949e; } + } + } + } +} + +// Streams in our channel, requests to watch ours. +component StreamsPanel inherits Rectangle { + callback manage-share(); + background: #0d1117; + border-width: 1px; + border-color: #21262d; + accessible-role: groupbox; + accessible-label: @tr("Streams"); + VerticalLayout { + padding: 8px; + spacing: 6px; + HorizontalLayout { + spacing: 6px; + Text { + text: @tr("Streams"); + font-weight: 700; + vertical-alignment: center; + } + if Bridge.share-state == "live": Text { + text: @tr("● You are live"); + color: #f85149; + font-size: 11px; + vertical-alignment: center; + } + Rectangle { } + if Bridge.share-state == "live" || Bridge.share-state == "starting": Button { + text: Bridge.share-requests > 0 ? @tr("Viewers ({})", Bridge.share-requests) : @tr("Manage"); + clicked => { manage-share(); } + } + } + if Bridge.streams.length == 0: Text { + text: @tr("No streams in your channel."); + color: #8b949e; + font-size: 12px; + } + for stream in Bridge.streams: HorizontalLayout { + spacing: 6px; + Rectangle { + width: 6px; + height: 6px; + y: (parent.height - self.height) / 2; + border-radius: 3px; + background: #a371f7; + } + VerticalLayout { + horizontal-stretch: 1; + Text { + text: stream.id == "" ? @tr("{} is streaming", stream.streamer) : stream.name == "" ? @tr("Untitled stream") : stream.name; + font-weight: 600; + overflow: elide; + } + Text { + text: stream.id == "" ? @tr("Started before you joined; the server did not announce it.") : stream.own ? @tr("your stream") : stream.audio ? @tr("by {} · with sound", stream.streamer) : @tr("by {}", stream.streamer); + font-size: 11px; + color: #8b949e; + overflow: elide; + } + } + if stream.id != "" && !stream.own && !stream.watching: Button { + text: @tr("Watch"); + accessible-label: @tr("Watch {}", stream.name); + clicked => { Bridge.watch-stream(stream.id); } + } + if stream.watching && !Bridge.viewer-open: Button { + text: @tr("Show"); + clicked => { Bridge.show-viewer(); } + } + if stream.watching: Button { + text: @tr("Leave"); + clicked => { Bridge.leave-stream(); } + } + } + for viewer in Bridge.share-viewers: HorizontalLayout { + spacing: 6px; + if viewer.state == "requested": Text { + text: @tr("{} wants to watch", viewer.name); + horizontal-stretch: 1; + vertical-alignment: center; + overflow: elide; + color: #d29922; + } + if viewer.state == "requested": Button { + text: @tr("Accept"); + primary: true; + clicked => { Bridge.respond-viewer(viewer.client, true); } + } + if viewer.state == "requested": Button { + text: @tr("Deny"); + clicked => { Bridge.respond-viewer(viewer.client, false); } + } + } + } +} + +component ChatPanel inherits Rectangle { + background: #0d1117; + VerticalLayout { + HorizontalLayout { + height: 34px; + spacing: 2px; + accessible-role: tab-list; + accessible-label: @tr("Chats"); + for tab[i] in Bridge.tabs: Rectangle { + width: tab-text.preferred-width + 28px; + background: Bridge.current-tab == i ? #30363d : tab-area.has-hover ? #21262d : #161b22; + accessible-role: AccessibleRole.tab; + accessible-label: tab.title; + accessible-description: tab.unread > 0 ? @tr("{} unread", tab.unread) : ""; + accessible-item-selectable: true; + accessible-item-selected: Bridge.current-tab == i; + accessible-action-default => { Bridge.select-tab(i); } + tab-area := TouchArea { + clicked => { Bridge.select-tab(i); } + } + HorizontalLayout { + padding-left: 10px; + padding-right: 6px; + spacing: 4px; + tab-text := Text { + text: tab.title + (tab.unread > 0 ? " (" + tab.unread + ")" : ""); + vertical-alignment: center; + font-weight: tab.unread > 0 ? 700 : 400; + } + if tab.kind == 1: Text { + text: "×"; + vertical-alignment: center; + accessible-role: button; + accessible-label: @tr("Close {}", tab.title); + accessible-action-default => { Bridge.close-tab(i); } + TouchArea { + clicked => { Bridge.close-tab(i); } + } + } + } + } + Rectangle { } + } + ListView { + accessible-label: @tr("Messages"); + for line in Bridge.messages: VerticalLayout { + padding: 6px; + HorizontalLayout { + spacing: 8px; + Text { + text: line.author; + font-weight: 700; + color: line.relayed ? #58a6ff : #e6edf3; + } + Text { + text: line.time + (line.relayed ? " " + @tr("via relay") : ""); + font-size: 11px; + color: #8b949e; + vertical-alignment: center; + } + } + Text { + text: line.text; + wrap: word-wrap; + } + } + } + HorizontalLayout { + padding: 6px; + spacing: 6px; + input := LineEdit { + placeholder-text: @tr("Message"); + accessible-label: @tr("Message"); + accepted(text) => { + if (text != "") { + Bridge.send-message(text); + self.text = ""; + } + } + } + Button { + text: @tr("Send"); + clicked => { + if (input.text != "") { + Bridge.send-message(input.text); + input.text = ""; + } + } + } + } + } +} + +// The stream we watch: title, picture, and player controls below it. +component StreamViewer inherits Rectangle { + background: #010409; + accessible-role: groupbox; + accessible-label: @tr("Stream viewer"); + VerticalLayout { + Rectangle { + height: 42px; + background: #161b22; + VerticalLayout { + padding-left: 10px; + padding-right: 10px; + alignment: center; + Text { + text: Bridge.viewer-title; + font-weight: 700; + overflow: elide; + } + Text { + text: Bridge.viewer-info; + font-size: 11px; + color: #8b949e; + overflow: elide; + } + } + } + Rectangle { + vertical-stretch: 1; + Image { + width: parent.width; + height: parent.height; + source: Bridge.viewer-frame; + image-fit: contain; + visible: Bridge.viewer-has-frame; + accessible-role: image; + accessible-label: @tr("Stream picture"); + } + if Bridge.viewer-status != "": Rectangle { + width: min(parent.width - 32px, status-text.preferred-width + 32px); + height: status-text.preferred-height + 20px; + border-radius: 6px; + background: #161b22e0; + status-text := Text { + width: min(root.width - 64px, self.preferred-width); + text: Bridge.viewer-status; + horizontal-alignment: center; + wrap: word-wrap; + accessible-live-region: polite; + } + } + } + Rectangle { + height: 44px; + background: #161b22; + HorizontalLayout { + padding: 6px; + padding-left: 10px; + spacing: 8px; + Text { + text: @tr("Volume"); + vertical-alignment: center; + color: #8b949e; + } + Slider { + width: 140px; + minimum: 0; + maximum: 200; + value <=> Bridge.viewer-volume; + enabled: !Bridge.viewer-ended; + accessible-label: @tr("Stream volume"); + changed(v) => { Bridge.set-stream-volume(v); } + } + Text { + text: @tr("{}%", round(Bridge.viewer-volume)); + width: 40px; + vertical-alignment: center; + color: #8b949e; + } + Rectangle { } + Button { + text: Bridge.viewer-fullscreen ? @tr("Exit full screen") : @tr("Full screen"); + clicked => { Bridge.toggle-fullscreen(); } + } + if !Bridge.viewer-fullscreen: Button { + text: @tr("Chat"); + accessible-label: @tr("Back to the chat"); + clicked => { Bridge.hide-viewer(); } + } + Button { + text: Bridge.viewer-ended ? @tr("Close") : @tr("Leave"); + clicked => { Bridge.leave-stream(); } + } + } + } + } +} + +component ShareDialog inherits Dialog { + in-out property form; + callback done(); + card-width: 560px; + card-height: 560px; + dismissed => { done(); } + VerticalBox { + Text { + text: Bridge.share-state == "live" ? @tr("You are sharing your screen") : Bridge.share-state == "starting" ? @tr("Starting…") : @tr("Share screen"); + font-size: 18px; + font-weight: 700; + } + if Bridge.share-state == "live" || Bridge.share-state == "starting": VerticalLayout { + spacing: 8px; + vertical-stretch: 1; + Text { + text: Bridge.share-status; + color: #8b949e; + wrap: word-wrap; + } + Text { + text: @tr("Viewers"); + font-weight: 600; + } + if Bridge.share-viewers.length == 0: Text { + text: @tr("Nobody is watching yet. Viewers in your channel can join from their streams list."); + color: #8b949e; + wrap: word-wrap; + } + ListView { + vertical-stretch: 1; + accessible-label: @tr("Viewers"); + for viewer in Bridge.share-viewers: HorizontalLayout { + padding-top: 4px; + padding-bottom: 4px; + spacing: 8px; + VerticalLayout { + horizontal-stretch: 1; + alignment: center; + Text { + text: viewer.name; + font-weight: 600; + overflow: elide; + } + Text { + text: viewer.state == "requested" ? (viewer.message == "" ? @tr("asks to watch") : @tr("asks to watch: {}", viewer.message)) : viewer.state == "connecting" ? @tr("connecting") : @tr("watching"); + font-size: 11px; + color: viewer.state == "requested" ? #d29922 : viewer.state == "connected" ? #3fb950 : #8b949e; + overflow: elide; + } + } + if viewer.state == "requested": Button { + text: @tr("Accept"); + primary: true; + clicked => { Bridge.respond-viewer(viewer.client, true); } + } + if viewer.state == "requested": Button { + text: @tr("Deny"); + clicked => { Bridge.respond-viewer(viewer.client, false); } + } + if viewer.state != "requested": Button { + text: @tr("Remove"); + accessible-label: @tr("Remove {}", viewer.name); + clicked => { Bridge.kick-viewer(viewer.client); } + } + } + } + HorizontalLayout { + alignment: end; + spacing: 8px; + Button { + text: @tr("Close"); + clicked => { done(); } + } + Button { + text: @tr("Stop sharing"); + primary: true; + clicked => { Bridge.stop-share(); } + } + } + } + if Bridge.share-state != "live" && Bridge.share-state != "starting": VerticalLayout { + spacing: 8px; + vertical-stretch: 1; + Text { + text: @tr("What to share"); + font-weight: 600; + } + ListView { + vertical-stretch: 1; + min-height: 120px; + accessible-label: @tr("What to share"); + for source[i] in Bridge.share-sources: Rectangle { + height: 40px; + border-radius: 6px; + background: form.source == i ? #1f6feb40 : source-area.has-hover ? #21262d : transparent; + border-width: form.source == i ? 1px : 0px; + border-color: #1f6feb; + accessible-role: list-item; + accessible-label: source.name; + accessible-description: source.detail; + accessible-item-selectable: true; + accessible-item-selected: form.source == i; + accessible-action-default => { form.source = i; } + source-area := TouchArea { + clicked => { form.source = i; } + } + HorizontalLayout { + padding-left: 10px; + padding-right: 10px; + spacing: 8px; + Text { + text: source.name; + vertical-alignment: center; + horizontal-stretch: 1; + overflow: elide; + } + Text { + text: source.detail; + vertical-alignment: center; + font-size: 11px; + color: #8b949e; + } + } + } + } + Field { label: @tr("Stream name"); value <=> form.name; } + HorizontalLayout { + spacing: 8px; + Text { + text: @tr("Frame rate"); + width: 130px; + vertical-alignment: center; + } + ComboBox { + model: [@tr("15 fps"), @tr("30 fps"), @tr("60 fps")]; + current-index <=> form.fps-index; + accessible-label: @tr("Frame rate"); + } + } + HorizontalLayout { + spacing: 8px; + Text { + text: @tr("Quality"); + width: 130px; + vertical-alignment: center; + } + ComboBox { + model: [@tr("Low (2.5 Mbit/s)"), @tr("Standard (4.6 Mbit/s)"), @tr("High (8 Mbit/s)"), @tr("Best (10 Mbit/s)")]; + current-index <=> form.bitrate-index; + accessible-label: @tr("Quality"); + } + } + CheckBox { + text: @tr("Share system audio"); + checked <=> form.audio; + } + CheckBox { + text: @tr("Let everyone in the channel watch without asking"); + checked <=> form.auto-accept; + } + if Bridge.share-error != "": Text { + text: Bridge.share-error; + color: #f85149; + wrap: word-wrap; + } + HorizontalLayout { + alignment: end; + spacing: 8px; + Button { + text: @tr("Cancel"); + clicked => { done(); } + } + Button { + text: Bridge.share-busy ? @tr("Starting…") : @tr("Start sharing"); + primary: true; + enabled: !Bridge.share-busy && Bridge.streams-available && Bridge.share-sources.length > 0; + clicked => { Bridge.start-share(form); } + } + } + } + } +} + +// Microphone level with the voice activation threshold. +component LevelMeter inherits Rectangle { + in property level: -100; + in property threshold: -40; + in property show-threshold: true; + // dBFS shown at the left edge. + property floor: -70; + height: 12px; + border-radius: 3px; + background: #0d1117; + border-width: 1px; + border-color: #30363d; + accessible-role: progress-indicator; + accessible-label: @tr("Microphone level"); + accessible-value: @tr("{} dB", round(level)); + accessible-value-minimum: floor; + accessible-value-maximum: 0; + Rectangle { + x: 0; + width: parent.width * clamp((level - floor) / (0 - floor), 0, 1); + border-radius: 3px; + background: level >= threshold ? #3fb950 : #58a6ff; + } + if show-threshold: Rectangle { + x: parent.width * clamp((threshold - floor) / (0 - floor), 0, 1) - 1px; + width: 2px; + background: #e6edf3; + } +} + +component SettingsDialog inherits Dialog { + in-out property tab; + callback done(); + card-width: 640px; + card-height: 660px; + dismissed => { done(); } + VerticalBox { + Text { + text: @tr("Settings"); + font-size: 18px; + font-weight: 700; + } + TabWidget { + vertical-stretch: 1; + current-index <=> tab; + Tab { + title: @tr("Audio"); + ScrollView { + VerticalLayout { + padding: 8px; + spacing: 8px; + Row { + label: @tr("Microphone"); + ComboBox { + model: Bridge.input-devices; + current-index: Bridge.audio.input-index; + accessible-label: @tr("Microphone"); + selected => { + Bridge.audio.input-index = self.current-index; + Bridge.audio-changed(Bridge.audio); + } + } + } + Row { + label: @tr("Speakers"); + ComboBox { + model: Bridge.output-devices; + current-index: Bridge.audio.output-index; + accessible-label: @tr("Speakers"); + selected => { + Bridge.audio.output-index = self.current-index; + Bridge.audio-changed(Bridge.audio); + } + } + } + Row { + label: @tr("Transmit"); + ComboBox { + model: [@tr("Push-to-talk"), @tr("Voice activation"), @tr("Continuously")]; + current-index: Bridge.audio.transmit; + accessible-label: @tr("Transmit"); + selected => { + Bridge.audio.transmit = self.current-index; + Bridge.audio-changed(Bridge.audio); + } + } + } + Row { + label: @tr("Voice activation level"); + Slider { + minimum: -70; + maximum: -10; + value: Bridge.audio.vad-threshold; + enabled: Bridge.audio.transmit == 1; + accessible-label: @tr("Voice activation level"); + changed(v) => { + Bridge.audio.vad-threshold = round(v); + Bridge.audio-changed(Bridge.audio); + } + } + Text { + text: @tr("{} dB", round(Bridge.audio.vad-threshold)); + width: 56px; + vertical-alignment: center; + horizontal-alignment: right; + } + } + Row { + label: @tr("Microphone level"); + VerticalLayout { + alignment: center; + LevelMeter { + level: Bridge.input-level; + threshold: Bridge.audio.vad-threshold; + show-threshold: Bridge.audio.transmit == 1; + } + } + Button { + text: Bridge.mic-test ? @tr("Stop test") : @tr("Test"); + enabled: !Bridge.voice-connected; + accessible-label: Bridge.mic-test ? @tr("Stop the microphone test") : @tr("Test the microphone"); + clicked => { Bridge.toggle-mic-test(); } + } + } + Text { + text: Bridge.voice-connected ? (Bridge.input-sending ? @tr("Sending voice") : @tr("Not sending")) : @tr("The meter shows the microphone while connected or during a test."); + font-size: 11px; + color: Bridge.input-sending ? #3fb950 : #8b949e; + wrap: word-wrap; + } + Text { + text: @tr("Processing"); + font-weight: 600; + } + CheckBox { + text: @tr("Echo cancellation"); + checked: Bridge.audio.echo-cancellation; + toggled => { + Bridge.audio.echo-cancellation = self.checked; + Bridge.audio-changed(Bridge.audio); + } + } + HorizontalLayout { + spacing: 8px; + CheckBox { + text: @tr("Noise suppression"); + checked: Bridge.audio.noise-suppression; + toggled => { + Bridge.audio.noise-suppression = self.checked; + Bridge.audio-changed(Bridge.audio); + } + } + ComboBox { + model: [@tr("Low"), @tr("Moderate"), @tr("High"), @tr("Very high")]; + current-index: Bridge.audio.noise-level; + enabled: Bridge.audio.noise-suppression; + accessible-label: @tr("Noise suppression level"); + selected => { + Bridge.audio.noise-level = self.current-index; + Bridge.audio-changed(Bridge.audio); + } + } + } + CheckBox { + text: @tr("Automatic gain control"); + checked: Bridge.audio.auto-gain; + toggled => { + Bridge.audio.auto-gain = self.checked; + Bridge.audio-changed(Bridge.audio); + } + } + Row { + label: @tr("Microphone gain"); + Slider { + minimum: -30; + maximum: 30; + value: Bridge.audio.input-gain; + accessible-label: @tr("Microphone gain"); + changed(v) => { + Bridge.audio.input-gain = round(v); + Bridge.audio-changed(Bridge.audio); + } + } + Text { + text: @tr("{} dB", round(Bridge.audio.input-gain)); + width: 56px; + vertical-alignment: center; + horizontal-alignment: right; + } + } + Text { + text: @tr("Playback"); + font-weight: 600; + } + Row { + label: @tr("Volume"); + Slider { + minimum: 0; + maximum: 200; + value: Bridge.audio.output-volume; + accessible-label: @tr("Playback volume"); + changed(v) => { + Bridge.audio.output-volume = round(v); + Bridge.audio-changed(Bridge.audio); + } + } + Text { + text: @tr("{}%", round(Bridge.audio.output-volume)); + width: 56px; + vertical-alignment: center; + horizontal-alignment: right; + } + } + Row { + label: @tr("Playback buffer"); + Slider { + minimum: 20; + maximum: 180; + value: Bridge.audio.playback-buffer; + accessible-label: @tr("Playback buffer"); + changed(v) => { + Bridge.audio.playback-buffer = round(v / 10) * 10; + Bridge.audio-changed(Bridge.audio); + } + } + Text { + text: @tr("{} ms", round(Bridge.audio.playback-buffer)); + width: 56px; + vertical-alignment: center; + horizontal-alignment: right; + } + } + } + } + } + Tab { + title: @tr("Push-to-talk"); + VerticalLayout { + padding: 8px; + spacing: 8px; + alignment: start; + CheckBox { + text: @tr("Global push-to-talk key (works while other windows have focus)"); + checked <=> Bridge.global-ptt; + toggled => { Bridge.apply-ptt(Bridge.global-ptt, Bridge.ptt-key); } + } + Row { + label: @tr("Key"); + key-edit := LineEdit { + text <=> Bridge.ptt-key; + placeholder-text: "Ctrl+Shift+T"; + enabled: Bridge.global-ptt; + accessible-label: @tr("Push-to-talk key"); + accepted => { Bridge.apply-ptt(Bridge.global-ptt, Bridge.ptt-key); } + } + Button { + text: @tr("Apply"); + enabled: Bridge.global-ptt; + clicked => { Bridge.apply-ptt(Bridge.global-ptt, Bridge.ptt-key); } + } + } + Text { + text: Bridge.ptt-status; + color: #8b949e; + wrap: word-wrap; + } + Text { + text: @tr("Keys are written like Ctrl+Shift+T, Alt+F1, CapsLock or MouseBack. On Wayland the desktop asks to confirm the key and may let you pick another one. The \"Hold to talk\" button in the window always works."); + font-size: 11px; + color: #8b949e; + wrap: word-wrap; + } + } + } + Tab { + title: @tr("Streaming"); + VerticalLayout { + padding: 8px; + spacing: 8px; + alignment: start; + CheckBox { + text: @tr("Enable H.264 (downloads OpenH264 from Cisco)"); + checked <=> Bridge.h264-enabled; + toggled => { Bridge.set-h264(Bridge.h264-enabled); } + } + Text { + text: Bridge.h264-attribution; + font-size: 11px; + color: #8b949e; + wrap: word-wrap; + } + if Bridge.h264-enabled: HorizontalLayout { + spacing: 8px; + Text { + text: Bridge.h264-status; + vertical-alignment: center; + horizontal-stretch: 1; + wrap: word-wrap; + } + if !Bridge.h264-loaded: Button { + text: Bridge.h264-busy ? @tr("Downloading…") : @tr("Download OpenH264"); + enabled: !Bridge.h264-busy; + clicked => { Bridge.download-h264(); } + } + } + Text { + text: @tr("VP8 and VP9 work without it. H.264 lets you watch streams that other clients send as H.264. The library is downloaded from Cisco only when you click Download, and Cisco's license covers its patent royalties."); + font-size: 11px; + color: #8b949e; + wrap: word-wrap; + } + } + } + Tab { + title: @tr("Privacy"); + VerticalLayout { + padding: 8px; + spacing: 8px; + alignment: start; + CheckBox { + text: @tr("Save crash reports on this device (never uploaded)"); + checked <=> Bridge.crash-reports; + toggled => { Bridge.set-crash-reports(Bridge.crash-reports); } + } + Text { + text: @tr("A report is a text file with the error and where it happened. It may contain a server address from the error message. You can attach it to a bug report yourself; the app never sends it anywhere."); + font-size: 11px; + color: #8b949e; + wrap: word-wrap; + } + } + } + } + HorizontalLayout { + alignment: end; + Button { + text: @tr("Close"); + clicked => { done(); } + } + } + } +} + +// Local volume and mute of one client. +component ClientAudioDialog inherits Dialog { + callback done(); + card-width: 380px; + card-height: content.preferred-height; + dismissed => { done(); } + content := VerticalBox { + alignment: start; + Text { + text: Bridge.client-audio.name; + font-size: 16px; + font-weight: 700; + overflow: elide; + } + Text { + text: @tr("Only changes what you hear."); + color: #8b949e; + font-size: 11px; + } + HorizontalLayout { + spacing: 8px; + Text { + text: @tr("Volume"); + vertical-alignment: center; + } + Slider { + minimum: 0; + maximum: 400; + value: Bridge.client-audio.volume; + enabled: !Bridge.client-audio.muted; + accessible-label: @tr("Volume of {}", Bridge.client-audio.name); + changed(v) => { + Bridge.client-audio.volume = round(v / 5) * 5; + Bridge.client-audio-changed(Bridge.client-audio); + } + } + Text { + text: @tr("{}%", round(Bridge.client-audio.volume)); + width: 48px; + vertical-alignment: center; + horizontal-alignment: right; + } + } + CheckBox { + text: @tr("Mute for me"); + checked: Bridge.client-audio.muted; + toggled => { + Bridge.client-audio.muted = self.checked; + Bridge.client-audio-changed(Bridge.client-audio); + } + } + HorizontalLayout { + alignment: end; + spacing: 8px; + Button { + text: @tr("Reset"); + clicked => { + Bridge.client-audio.volume = 100; + Bridge.client-audio.muted = false; + Bridge.client-audio-changed(Bridge.client-audio); + } + } + Button { + text: @tr("Close"); + primary: true; + clicked => { done(); } + } + } + } +} + +component AboutDialog inherits Dialog { + callback done(); + card-width: 720px; + card-height: 680px; + dismissed => { done(); } + VerticalBox { + Text { + text: Bridge.app-name + " " + Bridge.app-version; + font-size: 18px; + font-weight: 700; + } + Text { + text: @tr("Unofficial TeamSpeak 3/6 compatible client. Not affiliated with TeamSpeak Systems GmbH."); + wrap: word-wrap; + } + AboutSlint { + max-height: 150px; + } + if Bridge.h264-enabled: Text { + text: Bridge.h264-attribution; + wrap: word-wrap; + } + Text { + text: @tr("Third-party notices"); + font-weight: 600; + } + Rectangle { + vertical-stretch: 1; + background: #0d1117; + border-radius: 4px; + border-width: 1px; + border-color: #30363d; + ListView { + accessible-label: @tr("Third-party notices"); + for line in Bridge.notices: Text { + x: 8px; + width: parent.width - 16px; + text: line; + font-size: 11px; + color: #c9d1d9; + wrap: word-wrap; + } + } + } + HorizontalLayout { + alignment: end; + Button { + text: @tr("Close"); + clicked => { done(); } + } + } + } +} + +export component MainWindow inherits Window { + title: Bridge.app-name; + preferred-width: 1200px; + preferred-height: 760px; + min-width: 360px; + min-height: 480px; + background: #0d1117; + default-font-size: 13px; + + property editing: false; + in-out property show-about: false; + in-out property settings-tab: 0; + in-out property sharing-dialog: false; + in-out property settings-open: false; + in-out property client-open: false; + property form; + property share-form; + // Phones and narrow windows show one pane at a time. Set from a change + // handler: a binding on `width` would loop through the layout. + property narrow: false; + changed width => { narrow = self.width < 800px; } + init => { narrow = self.width < 800px; } + property pane: 1; + // Android: the space under the on-screen keyboard (the window is not + // resized for it). Zero on desktop. + property keyboard-inset: 0; + changed virtual-keyboard-size => { + keyboard-inset = self.virtual-keyboard-size.height > 0 ? self.height - self.virtual-keyboard-position.y : 0; + } + + // The viewer takes the whole window in full screen. + property chrome: !(Bridge.viewer-open && Bridge.viewer-fullscreen); + + public function open-share-dialog() { + share-form = Bridge.open-share(); + sharing-dialog = true; + } + + VerticalLayout { + // Android draws the window under the status and navigation bars. + padding-top: root.safe-area-insets.top; + padding-left: root.safe-area-insets.left; + padding-right: root.safe-area-insets.right; + padding-bottom: max(root.safe-area-insets.bottom, root.keyboard-inset); + // Toolbar + if chrome: Rectangle { + height: 48px; + background: #161b22; + accessible-role: banner; + HorizontalLayout { + padding: 6px; + spacing: 6px; + if narrow: Button { + text: pane == 0 ? @tr("Tree") : pane == 1 ? (Bridge.viewer-open ? @tr("Stream") : @tr("Chat")) : @tr("Servers"); + accessible-label: @tr("Switch pane"); + clicked => { pane = mod(pane + 1, 3); } + } + Text { + text: Bridge.server-title; + font-size: 15px; + font-weight: 700; + vertical-alignment: center; + overflow: elide; + } + Rectangle { } + Button { + text: Bridge.voice-connected ? @tr("Disconnect") : Bridge.voice-connecting ? @tr("Connecting…") : @tr("Connect"); + enabled: Bridge.current-server >= 0 && !Bridge.voice-connecting; + primary: !Bridge.voice-connected; + clicked => { + if (Bridge.voice-connected) { + Bridge.disconnect-voice(); + } else { + Bridge.connect-voice(); + } + } + } + Button { + text: Bridge.observing ? @tr("Stop observing") : @tr("Observe (invisible)"); + enabled: Bridge.can-observe; + clicked => { Bridge.toggle-observe(); } + } + Button { + text: Bridge.input-muted ? @tr("Mic: off") : @tr("Mic: on"); + enabled: Bridge.voice-connected; + clicked => { Bridge.set-input-muted(!Bridge.input-muted); } + } + Button { + text: Bridge.output-muted ? @tr("Sound: off") : @tr("Sound: on"); + enabled: Bridge.voice-connected; + clicked => { Bridge.set-output-muted(!Bridge.output-muted); } + } + ptt := Rectangle { + width: 110px; + border-radius: 4px; + background: Bridge.transmitting ? #238636 : ptt-area.has-hover ? #30363d : #21262d; + opacity: Bridge.voice-connected ? 1.0 : 0.4; + accessible-role: button; + accessible-label: @tr("Hold to talk"); + accessible-enabled: Bridge.voice-connected; + accessible-checkable: true; + accessible-checked: Bridge.transmitting; + accessible-action-default => { Bridge.push-to-talk(!Bridge.transmitting); } + Text { + text: Bridge.transmitting ? @tr("Talking…") : @tr("Hold to talk"); + } + ptt-area := TouchArea { + enabled: Bridge.voice-connected; + pointer-event(e) => { + if (e.kind == PointerEventKind.down) { + Bridge.push-to-talk(true); + } else if (e.kind == PointerEventKind.up || e.kind == PointerEventKind.cancel) { + Bridge.push-to-talk(false); + } + } + } + } + if Bridge.streams-available && Bridge.can-share: Button { + text: Bridge.share-state == "live" ? @tr("Sharing") : @tr("Share screen"); + primary: Bridge.share-state == "live"; + clicked => { open-share-dialog(); } + } + Button { + text: @tr("Settings"); + clicked => { + Bridge.open-settings(); + settings-open = true; + } + } + Button { + text: @tr("About"); + clicked => { + Bridge.open-about(); + show-about = true; + } + } + } + } + if chrome && Bridge.crash-notice != "": Rectangle { + background: #3d2a0a; + accessible-role: groupbox; + accessible-label: @tr("Crash reports"); + HorizontalLayout { + padding: 6px; + padding-left: 10px; + spacing: 8px; + Text { + text: Bridge.crash-notice; + vertical-alignment: center; + horizontal-stretch: 1; + overflow: elide; + } + Button { + text: @tr("Open folder"); + clicked => { Bridge.open-crash-folder(); } + } + Button { + text: @tr("Delete"); + clicked => { Bridge.delete-crash-reports(); } + } + Button { + text: "×"; + accessible-label: @tr("Dismiss"); + clicked => { Bridge.dismiss-crash-notice(); } + } + } + } + HorizontalLayout { + if chrome && (!narrow || pane == 2): ServerList { + // Fixed width beside the other panes, all the space alone. + min-width: narrow ? 0px : 230px; + max-width: narrow ? 100000px : 230px; + horizontal-stretch: narrow ? 1 : 0; + add => { + form = Bridge.edit-bookmark(-1); + editing = true; + } + edit(id) => { + form = Bridge.edit-bookmark(id); + editing = true; + } + } + if chrome && (!narrow || pane == 0): VerticalLayout { + min-width: narrow ? 0px : 360px; + max-width: narrow ? 100000px : 360px; + horizontal-stretch: narrow ? 1 : 0; + ChannelTree { + vertical-stretch: 1; + client-clicked(id) => { + if (Bridge.open-client(id)) { + client-open = true; + } + } + } + if Bridge.streams-available: StreamsPanel { + vertical-stretch: 0; + manage-share => { open-share-dialog(); } + } + } + if (!narrow || pane == 1) && Bridge.viewer-open: StreamViewer { } + if chrome && (!narrow || pane == 1) && !Bridge.viewer-open: ChatPanel { } + } + // Status bar + if chrome: Rectangle { + height: 26px; + background: #161b22; + accessible-role: content-info; + HorizontalLayout { + padding-left: 8px; + padding-right: 8px; + Text { + text: Bridge.status-text; + color: #8b949e; + vertical-alignment: center; + overflow: elide; + } + Rectangle { } + Text { + text: Bridge.presence-source; + color: #58a6ff; + vertical-alignment: center; + } + } + } + } + + if editing: BookmarkEditor { + form <=> form; + done => { editing = false; } + } + + if sharing-dialog: ShareDialog { + form <=> share-form; + done => { sharing-dialog = false; } + } + + if settings-open: SettingsDialog { + tab <=> settings-tab; + done => { + settings-open = false; + Bridge.close-settings(); + } + } + + if client-open: ClientAudioDialog { + done => { client-open = false; } + } + + if show-about: AboutDialog { + done => { show-about = false; } + } +} diff --git a/deny.toml b/deny.toml index 415b1c6..b121807 100644 --- a/deny.toml +++ b/deny.toml @@ -35,7 +35,7 @@ allow = [ # app's About page and the README. "LicenseRef-Slint-Royalty-free-2.0", # Permissive BSD-style license of bzip2, kept by its pure Rust port - # (libbz2-rs-sys), which tsc-media uses to unpack Cisco's OpenH264 download. + # (libbz2-rs-sys), which voelin-media uses to unpack Cisco's OpenH264 download. "bzip2-1.0.6", ] confidence-threshold = 0.9 diff --git a/dev/docker-compose.yml b/dev/docker-compose.yml index 40554cf..514d88b 100644 --- a/dev/docker-compose.yml +++ b/dev/docker-compose.yml @@ -7,7 +7,7 @@ # start; the smoke test reads it from there. `down -v` resets the servers. # # ServerQuery: every interface is enabled with the fixed development password -# `tsc-dev-admin` for the `serveradmin` login (TS3: raw 10011, SSH 10023, +# `voelin-dev-admin` for the `serveradmin` login (TS3: raw 10011, SSH 10023, # HTTP 10081; TS6: SSH 10022, HTTP 10080). Never use these settings in production. # # query_ip_allowlist.txt allowlists private ranges: clients reach the servers @@ -16,7 +16,7 @@ # # Images are pinned by digest; bump by pulling the new tag and copying its digest. # If Docker Hub rate-limits you, use its mirror: REGISTRY=mirror.gcr.io -name: tsc-dev +name: voelin-dev services: ts3: @@ -25,7 +25,7 @@ services: environment: TS3SERVER_LICENSE: accept TS3SERVER_IP_ALLOWLIST: /etc/ts3server/query_ip_allowlist.txt - TS3SERVER_SERVERADMIN_PASSWORD: tsc-dev-admin + TS3SERVER_SERVERADMIN_PASSWORD: voelin-dev-admin TS3SERVER_QUERY_PROTOCOLS: raw,ssh,http ports: - "9987:9987/udp" # voice @@ -42,7 +42,7 @@ services: image: ${REGISTRY:-docker.io}/teamspeaksystems/teamspeak6-server@sha256:d845f803aecf842c2df034c959c23ff2462357bacafb3807500885c5ec170fa1 environment: TSSERVER_LICENSE_ACCEPTED: accept - TSSERVER_QUERY_ADMIN_PASSWORD: tsc-dev-admin + TSSERVER_QUERY_ADMIN_PASSWORD: voelin-dev-admin TSSERVER_QUERY_SSH_ENABLED: 1 TSSERVER_QUERY_HTTP_ENABLED: 1 TSSERVER_QUERY_ALLOW_LIST: /etc/tsserver/query_ip_allowlist.txt diff --git a/dev/tsgw-ts3.toml b/dev/tsgw-ts3.toml index a54999f..68495eb 100644 --- a/dev/tsgw-ts3.toml +++ b/dev/tsgw-ts3.toml @@ -1,5 +1,5 @@ # Gateway for the ts3 development server (dev/docker-compose.yml). -# cargo run -p tsc-gateway -- --config dev/tsgw-ts3.toml +# cargo run -p voelin-gateway -- --config dev/tsgw-ts3.toml [server] # Inside the container the voice port is always 9987. @@ -9,7 +9,7 @@ voice_port = 9987 transport = "raw" addr = "127.0.0.1:10011" user = "serveradmin" -password = "tsc-dev-admin" +password = "voelin-dev-admin" allowlisted = true [listen] diff --git a/dev/tsgw-ts6.toml b/dev/tsgw-ts6.toml index a2816e3..e33d2d7 100644 --- a/dev/tsgw-ts6.toml +++ b/dev/tsgw-ts6.toml @@ -1,5 +1,5 @@ # Gateway for the ts6 development server (dev/docker-compose.yml). -# cargo run -p tsc-gateway -- --config dev/tsgw-ts6.toml +# cargo run -p voelin-gateway -- --config dev/tsgw-ts6.toml [server] # Inside the container the voice port is always 9987. @@ -9,7 +9,7 @@ voice_port = 9987 transport = "ssh" addr = "127.0.0.1:10022" user = "serveradmin" -password = "tsc-dev-admin" +password = "voelin-dev-admin" allowlisted = true [listen] diff --git a/docker/android.Dockerfile b/docker/android.Dockerfile new file mode 100644 index 0000000..2ac9985 --- /dev/null +++ b/docker/android.Dockerfile @@ -0,0 +1,101 @@ +# syntax=docker/dockerfile:1 +# +# Android APKs (docs/building.md, docs/android.md): a debug APK, installable +# as is, for arm64-v8a and x86_64 (emulators). +# +# docker build -f docker/android.Dockerfile -o dist/android . +# docker build -f docker/android.Dockerfile --build-arg ABIS=arm64-v8a -o dist/android . +# +# or scripts/docker-build.sh android. A signed release APK needs your keystore +# (docs/release.md), passed as build secrets: +# +# docker build -f docker/android.Dockerfile --build-arg APK=release \ +# --secret id=keystore,src=release.jks --secret id=signing,src=signing.env \ +# -o dist/android . +# +# signing.env holds VOELIN_SIGNING_STORE_PASSWORD, VOELIN_SIGNING_KEY_ALIAS and +# VOELIN_SIGNING_KEY_PASSWORD lines (NAME=value). Without them a release APK is +# unsigned. + +FROM ubuntu:24.04 AS toolchain +ARG DEBIAN_FRONTEND=noninteractive +# JDK 17 (Gradle, the Android Gradle plugin), CMake + Ninja (the bundled libopus). +RUN apt-get update && apt-get install -y --no-install-recommends \ + build-essential ca-certificates cmake curl ninja-build openjdk-17-jdk-headless \ + pkg-config python3 unzip \ + && rm -rf /var/lib/apt/lists/* + +# Extra CA certificates (PEM, one or more), for building behind a +# TLS-inspecting proxy; scripts/docker-build.sh passes $BUILD_CA_CERT as this +# secret. One file per certificate, so the Java truststore gets each one too. +RUN --mount=type=secret,id=ca,required=false \ + if [ -s /run/secrets/ca ]; then \ + awk '/-----BEGIN CERTIFICATE-----/ { n++ } n { print > ("/usr/local/share/ca-certificates/build-ca-" n ".crt") }' \ + /run/secrets/ca \ + && update-ca-certificates; \ + fi +# Java tools do not read HTTPS_PROXY: turn it into JVM properties for +# sdkmanager and Gradle when it is set (GRADLE_OPTS for the wrapper's JVM, +# -D arguments for the build JVM). +COPY <<-'EOF' /usr/local/bin/java-proxy-opts + #!/bin/sh + p=${HTTPS_PROXY:-${https_proxy:-}} + [ -n "$p" ] || exit 0 + hp=${p#*://}; hp=${hp%%/*}; hp=${hp##*@} + echo "-Dhttps.proxyHost=${hp%:*} -Dhttps.proxyPort=${hp##*:} -Dhttp.proxyHost=${hp%:*} -Dhttp.proxyPort=${hp##*:}" +EOF +RUN chmod +x /usr/local/bin/java-proxy-opts + +# The SDK packages the release workflow installs (.github/workflows/release.yml, +# package-android job). +ENV ANDROID_HOME=/opt/android-sdk +ARG CMDLINE_TOOLS=commandlinetools-linux-16111833_latest.zip +ARG CMDLINE_TOOLS_SHA1=e025545c62a8e64c7559119566a569fb1dec5f60 +ARG NDK_VERSION=27.3.13750724 +RUN curl -sSfL -o /tmp/tools.zip "https://dl.google.com/android/repository/$CMDLINE_TOOLS" \ + && echo "$CMDLINE_TOOLS_SHA1 /tmp/tools.zip" | sha1sum -c - \ + && mkdir -p "$ANDROID_HOME/cmdline-tools" \ + && unzip -q /tmp/tools.zip -d "$ANDROID_HOME/cmdline-tools" \ + && mv "$ANDROID_HOME/cmdline-tools/cmdline-tools" "$ANDROID_HOME/cmdline-tools/latest" \ + && rm /tmp/tools.zip \ + && export JAVA_OPTS="$(java-proxy-opts)" \ + && yes | "$ANDROID_HOME/cmdline-tools/latest/bin/sdkmanager" --licenses >/dev/null \ + && "$ANDROID_HOME/cmdline-tools/latest/bin/sdkmanager" \ + "ndk;$NDK_VERSION" "platforms;android-36" "build-tools;36.0.0" >/dev/null +ENV ANDROID_NDK_HOME=$ANDROID_HOME/ndk/$NDK_VERSION ANDROID_NDK_ROOT=$ANDROID_HOME/ndk/$NDK_VERSION + +ENV RUSTUP_HOME=/usr/local/rustup CARGO_HOME=/usr/local/cargo PATH=/usr/local/cargo/bin:$PATH +COPY rust-toolchain.toml /tmp/toolchain/ +RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs \ + | sh -s -- -y --no-modify-path --profile minimal --default-toolchain none \ + && cd /tmp/toolchain && rustup toolchain install \ + && rustup target add --toolchain "$(sed -n 's/^channel = "\(.*\)"/\1/p' rust-toolchain.toml)" \ + aarch64-linux-android x86_64-linux-android armv7-linux-androideabi \ + && cargo install --locked cargo-ndk --version 4.1.2 \ + && rm -rf "$CARGO_HOME/registry" + +FROM toolchain AS build +# Comma-separated Android ABIs: arm64-v8a, x86_64, armeabi-v7a. +ARG ABIS=arm64-v8a,x86_64 +# debug (installable as is) or release (signed with the build secrets). +ARG APK=debug +WORKDIR /src +COPY . . +RUN --mount=type=cache,id=voelin-cargo-registry,target=/usr/local/cargo/registry \ + --mount=type=cache,id=voelin-target-android,target=/src/target \ + --mount=type=cache,id=voelin-gradle,target=/root/.gradle \ + --mount=type=secret,id=keystore,required=false \ + --mount=type=secret,id=signing,required=false \ + set -e; \ + if [ "$APK" = release ] && [ -f /run/secrets/keystore ]; then \ + export VOELIN_SIGNING_STORE_FILE=/run/secrets/keystore; \ + set -a; . /run/secrets/signing; set +a; \ + fi; \ + proxy="$(java-proxy-opts)"; \ + export GRADLE_OPTS="$proxy"; \ + task="assemble$(echo "$APK" | sed 's/./\U&/')"; \ + (cd android && ./gradlew --no-daemon $proxy "$task" -Pvoelin.abis="$ABIS") \ + && scripts/package.sh android /out + +FROM scratch AS artifacts +COPY --from=build /out / diff --git a/docker/linux.Dockerfile b/docker/linux.Dockerfile new file mode 100644 index 0000000..efb3e92 --- /dev/null +++ b/docker/linux.Dockerfile @@ -0,0 +1,47 @@ +# syntax=docker/dockerfile:1 +# +# Linux packages (docs/building.md), for Ubuntu 24.04 and newer: the app as +# voelin--linux-x86_64.tar.gz and voelin__amd64.deb, the +# gateway (servers) as tsgw--linux-x86_64.tar.gz and +# tsgw__amd64.deb. +# +# docker build -f docker/linux.Dockerfile -o dist/linux . +# +# or scripts/docker-build.sh linux. The cargo registry and target directory +# live in cache mounts, so rebuilds are incremental. + +FROM ubuntu:24.04 AS toolchain +ARG DEBIAN_FRONTEND=noninteractive +# The same libraries as CI (.github/actions/system-deps), plus dpkg-dev for +# the .deb's dependencies. +RUN apt-get update && apt-get install -y --no-install-recommends \ + build-essential ca-certificates cmake curl dpkg-dev pkg-config \ + libasound2-dev libfontconfig1-dev libxkbcommon-dev \ + libvpx-dev libdav1d-dev libpipewire-0.3-dev libspa-0.2-dev libclang-dev \ + && rm -rf /var/lib/apt/lists/* +# Extra CA certificates (PEM, one or more), for building behind a +# TLS-inspecting proxy; scripts/docker-build.sh passes $BUILD_CA_CERT as this +# secret. One file per certificate, so the Java truststore gets each one too. +RUN --mount=type=secret,id=ca,required=false \ + if [ -s /run/secrets/ca ]; then \ + awk '/-----BEGIN CERTIFICATE-----/ { n++ } n { print > ("/usr/local/share/ca-certificates/build-ca-" n ".crt") }' \ + /run/secrets/ca \ + && update-ca-certificates; \ + fi +ENV RUSTUP_HOME=/usr/local/rustup CARGO_HOME=/usr/local/cargo PATH=/usr/local/cargo/bin:$PATH +# The toolchain rust-toolchain.toml asks for. +COPY rust-toolchain.toml /tmp/toolchain/ +RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs \ + | sh -s -- -y --no-modify-path --profile minimal --default-toolchain none \ + && cd /tmp/toolchain && rustup toolchain install + +FROM toolchain AS build +WORKDIR /src +COPY . . +RUN --mount=type=cache,id=voelin-cargo-registry,target=/usr/local/cargo/registry \ + --mount=type=cache,id=voelin-target-linux,target=/src/target \ + cargo build --release --locked -p voelin-ui -p voelin-gateway \ + && scripts/package.sh linux /out + +FROM scratch AS artifacts +COPY --from=build /out / diff --git a/docker/windows.Dockerfile b/docker/windows.Dockerfile new file mode 100644 index 0000000..3233179 --- /dev/null +++ b/docker/windows.Dockerfile @@ -0,0 +1,68 @@ +# syntax=docker/dockerfile:1 +# +# Windows packages, cross-compiled on Linux (docs/building.md): +# voelin--windows-x86_64.zip with voelin.exe, and the NSIS installer +# voelin--setup.exe. +# +# docker build -f docker/windows.Dockerfile -o dist/windows . +# +# or scripts/docker-build.sh windows. This builds for x86_64-pc-windows-gnu +# with mingw-w64; CI's Windows jobs build the MSVC target on Windows. Both run +# on Windows 10 and 11. Unsigned, like CI's (signing: docs/release.md). + +FROM ubuntu:24.04 AS toolchain +ARG DEBIAN_FRONTEND=noninteractive +# mingw-w64 (C compiler and linker), NASM (aws-lc and libvpx assembly), CMake +# (the bundled libopus, aws-lc), NSIS (the installer), zip. +RUN apt-get update && apt-get install -y --no-install-recommends \ + build-essential ca-certificates cmake curl git mingw-w64 nasm nsis perl pkg-config zip \ + && rm -rf /var/lib/apt/lists/* \ + && update-alternatives --set x86_64-w64-mingw32-gcc /usr/bin/x86_64-w64-mingw32-gcc-posix \ + && update-alternatives --set x86_64-w64-mingw32-g++ /usr/bin/x86_64-w64-mingw32-g++-posix +# Extra CA certificates (PEM, one or more), for building behind a +# TLS-inspecting proxy; scripts/docker-build.sh passes $BUILD_CA_CERT as this +# secret. One file per certificate, so the Java truststore gets each one too. +RUN --mount=type=secret,id=ca,required=false \ + if [ -s /run/secrets/ca ]; then \ + awk '/-----BEGIN CERTIFICATE-----/ { n++ } n { print > ("/usr/local/share/ca-certificates/build-ca-" n ".crt") }' \ + /run/secrets/ca \ + && update-ca-certificates; \ + fi +ENV RUSTUP_HOME=/usr/local/rustup CARGO_HOME=/usr/local/cargo PATH=/usr/local/cargo/bin:$PATH +COPY rust-toolchain.toml /tmp/toolchain/ +RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs \ + | sh -s -- -y --no-modify-path --profile minimal --default-toolchain none \ + && cd /tmp/toolchain && rustup toolchain install \ + && rustup target add --toolchain "$(sed -n 's/^channel = "\(.*\)"/\1/p' rust-toolchain.toml)" \ + x86_64-pc-windows-gnu + +# libvpx as a static mingw library (CI's Windows jobs take it from vcpkg), +# from upstream's git at a pinned commit. +FROM toolchain AS libvpx +ARG LIBVPX_VERSION=1.15.2 +ARG LIBVPX_COMMIT=d168454ecd099805c675d4a98c66f4891373302a +RUN git clone --quiet --depth 1 --branch "v$LIBVPX_VERSION" \ + https://chromium.googlesource.com/webm/libvpx /tmp/libvpx \ + && test "$(git -C /tmp/libvpx rev-parse HEAD)" = "$LIBVPX_COMMIT" \ + && cd /tmp/libvpx \ + && CROSS=x86_64-w64-mingw32- ./configure --target=x86_64-win64-gcc --prefix=/opt/libvpx \ + --as=nasm --enable-static --disable-shared --enable-pic \ + --disable-examples --disable-tools --disable-docs --disable-unit-tests \ + && make -j"$(nproc)" && make install \ + && rm -rf /tmp/libvpx + +FROM toolchain AS build +COPY --from=libvpx /opt/libvpx /opt/libvpx +ARG LIBVPX_VERSION=1.15.2 +# libvpx-native-sys: the library above, linked statically. +ENV VPX_LIB_DIR=/opt/libvpx/lib VPX_INCLUDE_DIR=/opt/libvpx/include \ + VPX_VERSION=$LIBVPX_VERSION VPX_STATIC=1 +WORKDIR /src +COPY . . +RUN --mount=type=cache,id=voelin-cargo-registry,target=/usr/local/cargo/registry \ + --mount=type=cache,id=voelin-target-windows,target=/src/target \ + cargo build --release --locked --target x86_64-pc-windows-gnu -p voelin-ui \ + && WINDOWS_TARGET=x86_64-pc-windows-gnu scripts/package.sh windows /out + +FROM scratch AS artifacts +COPY --from=build /out / diff --git a/docs/android.md b/docs/android.md new file mode 100644 index 0000000..3743379 --- /dev/null +++ b/docs/android.md @@ -0,0 +1,156 @@ +# Android app + +The Android app is the desktop UI (`voelin-ui`, Slint) running in a +`NativeActivity`, plus a thin Kotlin layer for what only Java APIs can do: +foreground services, the screen-capture consent, the Keystore. + +``` +android/ Gradle project (AGP 8.13, Kotlin 2.3, Gradle 8.14.3 wrapper) + app/src/main/java/.../voelin/ MainActivity (NativeActivity), Bridge, Native, + VoiceService, ScreenCaptureService, SecretStore +crates/voelin-android/ libvoelin_android.so: android_main, engine host, + JNI glue, capture providers, Keystore secrets +``` + +## Building + +Requirements: + +- Android SDK with `platforms;android-36` and `build-tools;36.0.0` + (`ANDROID_HOME`, or `sdk.dir` in `android/local.properties`), NDK + `27.3.13750724` (`ndk;27.3.13750724`; the version is pinned in + `app/build.gradle.kts`) +- JDK 17 or newer +- Rust targets: `rustup target add aarch64-linux-android x86_64-linux-android` +- `cargo install cargo-ndk --locked` (4.x) +- CMake and make (or `CMAKE_GENERATOR=Ninja` with ninja): libopus is built + from source + +```sh +cd android +./gradlew assembleDebug # arm64-v8a + x86_64 (emulator) +./gradlew assembleDebug -Pvoelin.abis=arm64-v8a # phones only, half the build +adb install -r app/build/outputs/apk/debug/app-debug.apk +adb logcat -s RustStdoutStderr ScreenCaptureService VoiceService SecretStore +``` + +`assemble` runs `cargo ndk ... build -p voelin-android` (with +`--release` for release) into `app/build/rust///` before the +native libraries are merged; `-Pvoelin.skipCargo=true` packages what is there +(for CI steps that built the library already). The app's `versionName` is the +version of `crates/voelin-android`, and `versionCode` is derived from it +(docs/release.md). The Kotlin half of `rustls-platform-verifier` comes from +its Maven archive in the version `Cargo.lock` pins. + +Release builds are minified (R8) and signed only when the signing settings +are given as Gradle properties (e.g. `~/.gradle/gradle.properties`) or +environment variables; nothing of it lives in the repository: + +| Gradle property | Environment variable | +|---|---| +| `voelin.signing.storeFile` | `VOELIN_SIGNING_STORE_FILE` | +| `voelin.signing.storePassword` | `VOELIN_SIGNING_STORE_PASSWORD` | +| `voelin.signing.keyAlias` | `VOELIN_SIGNING_KEY_ALIAS` | +| `voelin.signing.keyPassword` | `VOELIN_SIGNING_KEY_PASSWORD` | + +```sh +VOELIN_SIGNING_STORE_FILE=~/keys/voelin-release.jks VOELIN_SIGNING_STORE_PASSWORD=... \ +VOELIN_SIGNING_KEY_ALIAS=voelin VOELIN_SIGNING_KEY_PASSWORD=... ./gradlew assembleRelease bundleRelease +``` + +minSdk is 29 (Android 10: MediaProjection foreground service type, playback +capture, NDK MediaCodec format queries); targetSdk and compileSdk 36. + +## How it fits together + +- **Entry**: the activity loads `libvoelin_android.so` (`android.app.lib_name`); + android-activity calls `android_main` on a new thread for every activity + instance. It installs crash reports (opt-in, `crash_reports` setting, + `/crash-reports`), looks up the Kotlin `Bridge` class, initialises + `rustls-platform-verifier` (HTTPS certificate checks against the system + trust store), asks for the microphone and notification permissions, sets + Slint's Android backend and runs `voelin_ui::run` with the app's files + directory, Keystore secrets and the process's engine. +- **Engine for the process** (`host.rs`): one tokio runtime and `Engine` + per process. The activity may be destroyed while voice goes on; a new + window attaches and first receives events that rebuild the current state + (server info, state, presence, the last 300 chat messages per session, + streams), then live events (`voelin_ui::HostedEngine`). Back moves the task + to the background instead of finishing the activity; configuration changes + do not recreate it. +- **Voice in the background**: while any session has a voice connection, + `VoiceService` runs as a foreground service of type `microphone` with a + notification ("In voice on …", Mute or Unmute, Disconnect). Rust drives it + from engine events (`foreground.rs`, `Bridge.setVoiceNotification`). Audio + itself is cpal on AAudio, as on desktop. +- **Sharing the screen**: `voelin_media::capture::default_screen_capture()` + returns the MediaProjection provider (`capture.rs`) registered at start. + Starting shows the system consent dialog; on consent `ScreenCaptureService` + (type `mediaProjection`) mirrors the display into an `ImageReader` at the + requested frame rate, longest side at most 1920 px, and hands RGBA frames to + `Native.onScreenFrame`. System audio (`default_audio_capture()`) is + `AudioPlaybackCapture` of media, game and unknown usages, 48 kHz stereo + float, only while the projection runs. Ending the projection from the + status bar or the notification closes the capture channels. +- **Watching and encoding**: `voelin_media::Codecs` uses the device's + MediaCodec encoders (hardware first) and decoders on Android + ([media.md](media.md)). +- **Secrets**: `SecretStore` encrypts each password with AES-256-GCM under a + non-exportable Android Keystore key and keeps the ciphertext in private + preferences. The app disables Android backups (the database holds the + identity's private key). +- **JNI**: Rust calls static methods of `Bridge` (class looked up once on the + `android_main` thread, usable from any thread); Kotlin calls the + `external` methods of `Native`, exported by `native_method!` (panics and + errors become Java exceptions). Keep `bridge.rs`, `Bridge.kt` and + `Native.kt` in step. + +Permissions: `INTERNET`, `ACCESS_NETWORK_STATE`, `RECORD_AUDIO`, +`MODIFY_AUDIO_SETTINGS`, `FOREGROUND_SERVICE` with `_MICROPHONE` and +`_MEDIA_PROJECTION`, `POST_NOTIFICATIONS`. + +## Status + +| What | How | Status | +|---|---|---| +| `libvoelin_android.so` for `aarch64-linux-android` (Slint Android backend with Skia, AAudio, AWS-LC, SQLite, libopus) | `cargo ndk -t arm64-v8a build -p voelin-android` | builds; exports `android_main` and the `Native` methods | +| Debug APK | `./gradlew assembleDebug -Pvoelin.abis=arm64-v8a` | builds | +| Engine host replay, voice service policy | unit tests (`cargo test -p voelin-android`) | tested | +| External capture providers, MediaCodec buffer layouts | `voelin-media` unit tests | tested | +| The app on a device: UI, voice in the background, screen sharing, watching, Keystore | manual matrix row IN3 and the Android rows | not run yet (no device or emulator in this environment) | +| Waydroid (Mesa GL) | the debug APK, `waydroid logcat` | works with the EGL workaround (below); before it, the app ended at start because Skia could not create its GL context | + +Known gaps: + +- The streams panel of the UI and the stream media pipeline of `voelin-core` + must build without the desktop media backends on Android (libvpx, X11, + PipeWire): `voelin-media` with `default-features = false` there, so that + `Codecs` uses MediaCodec. +- Rotating the device while sharing letterboxes the picture (the virtual + display keeps its size). +- The safe area (status and navigation bars) and the on-screen keyboard pad + the main window; dialogs drawn over it do not account for them yet. +- Only `arm64-v8a` and `x86_64` are built; 32-bit devices are not supported. +- No audio focus handling yet: a phone call does not pause our audio + (matrix row AN4). After a network change (Wi-Fi to mobile data) only + tsclientlib's own reconnect applies; untested on a phone. + +### Mesa-based Android (Waydroid) + +Slint draws with Skia over OpenGL ES. Before Skia looks up its functions, +Slint's surface loads glow's whole GL function table through +`eglGetProcAddress`. Android's libEGL gives every function it has no built-in +entry point for one of 256 "extension slots", and Mesa answers every name, +desktop GL included, so the slots run out; Skia then gets nothing for an +extension function it needs (`glTextureBarrierNV`) and the app ends right +after start: + +``` +E libEGL : no more slots for eglGetProcAddress("glTextureBarrierNV") +I RustStdoutStderr: … Could not create Skia Direct Context from GL interface +``` + +`crates/voelin-android/src/egl.rs` looks up Skia's extension functions once +at start, before Slint's surface, so they get slots first (logcat: +`EGL: N of 83 Skia extension functions resolved`). Vendor GPU drivers on +phones return nothing for desktop-only names and are not affected. diff --git a/docs/architecture.md b/docs/architecture.md index 57ed344..5b0b1c3 100644 --- a/docs/architecture.md +++ b/docs/architecture.md @@ -16,9 +16,9 @@ facts constrain it, how the code is organised, and the milestone order. `respondjoinstreamrequest`, `streamsignaling`, `notifystream*`, ...). See [protocol-notes/ts6-streaming.md](protocol-notes/ts6-streaming.md). - `clientinit` must carry a `client_version_sign` signed by TeamSpeak, so the - client reuses known version/signature pairs (`tsctl versions`). + client reuses known version/signature pairs (`voelinctl versions`). - TeamSpeak 6 servers still accept the TeamSpeak 3 client protocol; verified with - `tsctl` against 6.0.0-beta13.1. + `voelinctl` against 6.0.0-beta13.1. ### What "invisible" means for query clients (verified on 3.13.8 and 6.0.0-beta13.1) @@ -41,18 +41,18 @@ the admin grants them to the guest query group. | Feature | Mechanism | |---|---| | Server chat | Voice connection: `targetmode=3`. Without one: gateway or own query session (`servernotifyregister event=textserver`) | -| Channel chat without joining | Relay pool (`tsc-observer`): invisible query sessions sit in channels and relay both ways; posts appear as `[Nick] text` | +| Channel chat without joining | Relay pool (`voelin-observer`): invisible query sessions sit in channels and relay both ways; posts appear as `[Nick] text` | | Voice | tsproto UDP transport, Opus (`opus2`), echo cancellation / noise suppression (sonora), own jitter buffer, cpal / AAudio | | Invisible presence | Gateway presence stream (snapshot + deltas from query events) or direct query; `channelsubscribeall` when voice-connected | -| Screen share with sound | TS6 stream signalling (`tsc-stream`), str0m WebRTC, per-platform capture and codecs (`tsc-media`) | +| Screen share with sound | TS6 stream signalling (`voelin-stream`), str0m WebRTC, per-platform capture and codecs (`voelin-media`) | ## Workspace layout ``` crates/proto/ vendored tsclientlib (tsproto, tsproto-packets, tsproto-types, tsproto-structs + declarations, ts-bookkeeping, tsclientlib) -crates/ our crates (table below) -tools/tsctl headless CLI +crates/ our crates (table below) +tools/voelinctl headless CLI dev/ docker-compose TS3 + TS6 servers, gateway configs scripts/ it-smoke.sh, own-crates.sh fuzz/ cargo-fuzz targets @@ -60,18 +60,18 @@ fuzz/ cargo-fuzz targets | Crate | Responsibility | State | |---|---|---| -| `tsc-model` | UI-facing domain model (servers, channels, clients, chat, capabilities), no IO | done | -| `tsc-query` | ServerQuery codec and transports: raw TCP, SSH (russh), HTTP WebQuery | done | -| `tsc-observer` | Presence tracker + chat relay pool over `tsc-query` | done | -| `tsc-gateway-proto`, `tsc-gateway` (`tsgw`) | Companion service for server admins: identity-challenge auth, permission-mirroring authorization, presence stream, chat relay, SQLite history, WebSocket + JSON (`tsgw.v1+json`) | done | -| `tsc-store` | Identities, bookmarks, settings, chat cache, secrets (keyring / Android Keystore) | done | -| `tsc-audio` | Capture/playback, Opus, echo cancellation, resampling, jitter buffer, mixer, VAD/push-to-talk | v0 (no AEC yet) | -| `tsc-stream` | TS6 stream commands, JSON signalling, str0m peer connections, host/STUN candidates, streamer/viewer sessions, frame-source seam | sessions + transport | -| `tsc-core` | Engine: runtime, per-server sessions, merge of voice/gateway/query sources, event bus, command API, streams on TS6 | done (streams with synthetic frames) | -| `tsc-ui` | Slint UI and the desktop binary | done (no streams yet) | -| `tsc-media` | Screen and system-audio capture backends (PipeWire portal, X11, Windows Graphics Capture, Android MediaProjection), video codecs | planned | -| `tsc-platform` | Global hotkeys, notifications, paths | planned | -| `tsc-android` + `android/` | Android library + Gradle/Kotlin app (foreground services for voice and screen capture) | planned | +| `voelin-model` | UI-facing domain model (servers, channels, clients, chat, capabilities), no IO | done | +| `voelin-query` | ServerQuery codec and transports: raw TCP, SSH (russh), HTTP WebQuery | done | +| `voelin-observer` | Presence tracker + chat relay pool over `voelin-query` | done | +| `voelin-gateway-proto`, `voelin-gateway` (`tsgw`) | Companion service for server admins: identity-challenge auth, permission-mirroring authorization, presence stream, chat relay, SQLite history, WebSocket + JSON (`tsgw.v1+json`) | done | +| `voelin-store` | Identities, bookmarks, settings, chat cache, secrets (keyring / Android Keystore) | done | +| `voelin-audio` | Capture/playback, Opus, echo cancellation, resampling, jitter buffer, mixer, VAD/push-to-talk | v0 (no AEC yet) | +| `voelin-stream` | TS6 stream commands, JSON signalling, str0m peer connections, host/STUN candidates, streamer/viewer sessions, frame-source seam | sessions + transport | +| `voelin-core` | Engine: runtime, per-server sessions, merge of voice/gateway/query sources, event bus, command API, audio settings and volumes, streams on TS6; `media` module (capture → encoder → stream, stream → decoder) | done | +| `voelin-ui` | Slint UI and the desktop binary: streams panel, viewer, share dialog, audio / hotkey / codec settings | done (desktop) | +| `voelin-media` | Screen and system-audio capture backends (PipeWire portal, X11, Windows Graphics Capture, Android MediaProjection), video codecs | done (desktop hardware encoders planned; MediaCodec not run on a device yet) | +| `voelin-platform` | Global hotkeys, notifications, paths, crash reports, notices | done | +| `voelin-android` + `android/` | Android library + Gradle/Kotlin app (foreground services for voice and screen capture); see [android.md](android.md) | builds, not yet run on a device | ## Merging sources @@ -84,7 +84,7 @@ gateway, otherwise a local query relay. UI states: `Offline`, ## Streams -`tsc-stream::Streams` holds the stream state of one TS6 connection without +`voelin-stream::Streams` holds the stream state of one TS6 connection without doing connection IO: it is fed stream notifications (and failed commands) and the app's decisions, owns the str0m peers, and queues requests to send plus events. Inside it, `StreamerSession` runs our stream (one peer per viewer, our @@ -92,23 +92,34 @@ offer in `respondjoinstreamrequest`), `ViewerSession` one watched stream (answer through `streamsignaling`), and `StreamDirectory` the streams of our channel. Its tests drive two instances through a fake relay server. -In `tsc-core` a stream task per voice connection runs `Streams`; the voice task +In `voelin-core` a stream task per voice connection runs `Streams`; the voice task forwards `MessageEvent`s and sends the requests. Encoders push frames through the `StreamSink` of `StreamState::Live`; received frames of watched streams go -to `Engine::subscribe_frames`, not the event bus. `tsc-stream::FrameSource` is -the seam for capture and encoders (`tsc-media`); `SyntheticSource` stands in -for tests and `tsctl stream start --synthetic`. +to `Engine::subscribe_frames`, not the event bus. The audio of watched streams +goes straight to the session's audio thread, which mixes it like a talker +with its own volume (`Command::SetStreamVolume`). + +`voelin-core::media` (feature `media`) connects this to `voelin-media`: +`Streamer` captures (screen, window, portal or the test pattern, plus system +audio), encodes with the codec of our offer (VP8 by default; the offer carries +only the codec we encode, since every viewer gets the same frames) and Opus, +and feeds the `StreamSink`, honouring keyframe requests. `Viewer` decodes a +watched stream on its own thread (skipping to the next keyframe after losses +and asking for one) and hands pictures to the UI, which keeps only the newest +(`Latest`). `EncodedSource` wraps a `Streamer` as a `voelin-stream::FrameSource` +for `voelinctl stream start`; `SyntheticSource` (fake VP8 bytes) remains for +voelin-stream's own tests. ## Milestones | | Scope | Exit criteria | |---|---|---| -| **M0** | Vendoring, workspace, `tsctl`, dev servers, CI | Builds on Linux + Windows; smoke test passes on TS3 and TS6 | +| **M0** | Vendoring, workspace, `voelinctl`, dev servers, CI | Builds on Linux + Windows; smoke test passes on TS3 and TS6 | | M1 | Protocol modernisation: edition 2024, dependency updates, puzzle rewrite (off-thread, progress, cancel), TS6 declarations (`client_is_streaming`, stream commands), fuzzing | Tests green on both servers, clippy clean | -| M2 | Identities/bookmarks store, audio v0 (Opus, jitter buffer), `tsctl voice` | Tone round-trips between two clients on both servers | -| M3 | `tsc-query` (raw/SSH/HTTP) + observer | Invisible presence and relay chat verified | +| M2 | Identities/bookmarks store, audio v0 (Opus, jitter buffer), `voelinctl voice` | Tone round-trips between two clients on both servers | +| M3 | `voelin-query` (raw/SSH/HTTP) + observer | Invisible presence and relay chat verified | | M4 | Gateway v1 | Presence + channel chat without appearing in the client list, permission denials tested | -| M5 | `tsc-core` + Slint desktop UI (Linux) | Daily use on GNOME, KDE, X11 | +| M5 | `voelin-core` + Slint desktop UI (Linux) | Daily use on GNOME, KDE, X11 | | M6 | Audio quality, global push-to-talk, Windows parity and packaging | One-hour call without drift or echo | | M7 | TS6 stream viewer | Watch an official TS6 client's stream | | M8 | Streamer: capture, system audio, encoders | Official TS6 client watches our 1080p30 stream with sound | diff --git a/docs/audio.md b/docs/audio.md index b66c796..5af6f5e 100644 --- a/docs/audio.md +++ b/docs/audio.md @@ -9,8 +9,8 @@ voice connection ─ Mixer (jitter buffer, Opus decode, per-client volume/mute) └─ Processor::render (echo canceller reference) ``` -The audio thread lives in `tsc-core/src/audio.rs`; the building blocks are in -`tsc-audio`. All user settings are one serde struct, `tsc_audio::AudioSettings`. +The audio thread lives in `voelin-core/src/audio.rs`; the building blocks are in +`voelin-audio`. All user settings are one serde struct, `voelin_audio::AudioSettings`. ## Echo cancellation, noise suppression, gain control @@ -57,7 +57,7 @@ frame, and the talker is dropped after three in a row), and when the smallest queue length over the last 255 packets exceeds its spread, it drops every 100th sample (1 % faster) until the surplus is gone; queues above 0.5 s are truncated. -`crates/tsc-audio/tests/drift.rs` simulates one hour of continuous speech with +`crates/voelin-audio/tests/drift.rs` simulates one hour of continuous speech with 20–60 ms network jitter, reordering and 0.5 % loss, with the sender clock at +200 and -200 ppm (720 ms of disagreement per hour). Marker frames every 30 s measure the end-to-end latency: @@ -67,6 +67,30 @@ measure the end-to-end latency: | +200 ppm | 73 / 131 ms | 112 ms | 125 ms | | -200 ppm | 67 / 95 ms | 82 ms | 84 ms | +## Settings, levels and volumes + +The engine keeps one `AudioSettings` for all sessions (`Command::SetAudioSettings`; +each new audio thread starts with it) and applies changes live. The desktop app +stores them under the setting `audio` and shows them on its settings page: +devices, transmit mode (push-to-talk, voice activation, continuous), the voice +activation threshold, echo cancellation, noise suppression and its level, +automatic gain, microphone gain, output volume and the playback buffer. + +The audio thread reports the loudest 10 ms level since the last report about +ten times a second (`Event::InputLevel`, with whether voice is sent), which the +settings page shows as a meter with the threshold. Without a voice connection, +`Command::TestMicrophone` opens the microphone for the meter alone. + +Per-client volume and mute are local (`SetClientVolume`, `SetClientMuted`); the +app keeps them by unique id and sends them again when the client shows up. Client +ids are reused, so the session forgets the settings of clients that left. +Watched streams play through the same mixer under made-up client ids (counting +down from 65535) with their own volume (`SetStreamVolume`). + +Push-to-talk works with the button in the window and a global hotkey +(`voelin_platform::HotkeyManager`: the portal on Wayland, XInput2 on X11, a hook on +Windows), configurable as e.g. `Ctrl+Shift+T`. + ## Devices Devices are selected by cpal's stable id (`host:device`, e.g. `alsa:hw:1,0`); diff --git a/docs/building.md b/docs/building.md new file mode 100644 index 0000000..82a4c7b --- /dev/null +++ b/docs/building.md @@ -0,0 +1,111 @@ +# Packages: from releases and built locally + +Every platform has installable packages. The release workflow builds them, +and the Dockerfiles in `docker/` build the same kinds of packages on any +machine with Docker. Both use `scripts/package.sh`, so file names and +contents match. Regular CI (`ci.yml`, every push and PR) only runs the fast +checks and builds no packages. + +The packages hold the app, Voelin. The gateway `tsgw` runs on servers and is +packaged for Linux only, separately. `voelinctl` is a development tool and is +in no package (`cargo run -p voelinctl`). + +| Platform | Files | Install | +|---|---|---| +| Linux x86_64 | `voelin--linux-x86_64.tar.gz` | unpack; `bin/voelin` plus desktop file and icon (prefix layout: `tar -xzf … --strip-components=1 -C ~/.local`) | +| | `voelin__amd64.deb` | `sudo apt install ./voelin__amd64.deb` (Ubuntu 24.04+, Debian 13+) | +| | `voelin.flatpak` (release workflow only) | `flatpak install --user voelin.flatpak` | +| Linux server | `tsgw__amd64.deb` | `sudo apt install ./tsgw__amd64.deb`, then configure and start it ([gateway-admin.md](gateway-admin.md#install)) | +| | `tsgw--linux-x86_64.tar.gz` | unpack; `bin/tsgw`, the systemd unit and the example config | +| | `tsgw-image.tar.gz` (release workflow only) | `docker load -i tsgw-image.tar.gz` | +| Windows x86_64 | `voelin--windows-x86_64.zip` | unpack; `voelin.exe` | +| | `voelin--setup.exe` | run it (per-machine install, uninstaller in Settings → Apps) | +| Android | `voelin--android-debug.apk` | `adb install …` or open it on the phone (arm64-v8a and x86_64) | +| | `voelin--android-release.apk` | only with signing configured ([release.md](release.md#android-apk-signing)) | + +Each package run also writes `SHA256SUMS-`. Nothing is code-signed +yet: Windows SmartScreen warns about the installer, and the debug APK is +signed with a debug key (fine for testing, not for the Play Store). + +The gateway's image can also be built directly: +`docker build -f crates/voelin-gateway/Dockerfile -t tsgw .`. + +## From releases + +`.github/workflows/release.yml` builds every package: + +- **A version tag** `v*` (`git tag -s v0.2.0 && git push origin v0.2.0`): the + packages and a `SHA256SUMS` are attached to a **draft** GitHub release once + all checks pass (the same checks as CI, plus the Windows tests); review and + publish it by hand ([release.md](release.md#checklist)). +- **By hand**, for a build to test without a release: Actions → Release → Run + workflow (or `gh workflow run release.yml --ref `). The packages are + uploaded as artifacts, kept for 90 days: `voelin-linux-x86_64` (the app's and + the gateway's Linux packages), `voelin-windows-x86_64`, + `voelin-flatpak-x86_64`, `voelin-android` and `tsgw-image`. + +```sh +gh workflow run release.yml --ref main +gh run list --workflow release.yml --limit 3 +gh run download --dir dist +``` + +The Windows packages use the MSVC toolchain and libvpx from vcpkg. The +Android job builds a signed release APK only when the repository has the +signing secrets (`ANDROID_KEYSTORE_BASE64`, `VOELIN_SIGNING_STORE_PASSWORD`, +`VOELIN_SIGNING_KEY_ALIAS`, `VOELIN_SIGNING_KEY_PASSWORD`). + +`.github/workflows/docker.yml` builds the Docker files below for every +release tag and by hand (Actions → Docker builds → Run workflow), and uploads +their output as `docker-linux`, `docker-windows` and `docker-android`. + +## Locally with Docker + +Needs Docker 23+ (BuildKit) or Docker Desktop, and about 15 GB of free disk +per platform (toolchains plus the build cache). From the repository root: + +```sh +scripts/docker-build.sh linux # → dist/linux/ +scripts/docker-build.sh windows # → dist/windows/ +scripts/docker-build.sh android # → dist/android/ +scripts/docker-build.sh # all three +``` + +The same with plain Docker, e.g. `docker build -f docker/linux.Dockerfile -o dist/linux .` +Rebuilds are incremental: the cargo registry, `target/` and Gradle live in +BuildKit cache mounts (`docker builder prune` frees them). + +| Dockerfile | Builds | Notes | +|---|---|---| +| `docker/linux.Dockerfile` | the app's and the gateway's `.tar.gz` and `.deb` on Ubuntu 24.04 | the binaries need glibc 2.39+ and the libraries the `.deb` lists | +| `docker/windows.Dockerfile` | `.zip` and the NSIS installer | cross-compiled for `x86_64-pc-windows-gnu` with mingw-w64 and a static libvpx; works on Windows 10 and 11 | +| `docker/android.Dockerfile` | debug APK | SDK, NDK and cargo-ndk as in CI; `--build-arg ABIS=arm64-v8a,x86_64,armeabi-v7a` picks the ABIs | + +Options go after the platform, straight to `docker build`: + +```sh +scripts/docker-build.sh android --build-arg ABIS=arm64-v8a +scripts/docker-build.sh android --build-arg APK=release \ + --secret id=keystore,src=release.jks --secret id=signing,src=signing.env +``` + +For the signed release APK, `signing.env` holds `VOELIN_SIGNING_STORE_PASSWORD=…`, +`VOELIN_SIGNING_KEY_ALIAS=…` and `VOELIN_SIGNING_KEY_PASSWORD=…`. Secrets are not +stored in the image or the build cache. + +**Behind a proxy:** `scripts/docker-build.sh` passes `HTTPS_PROXY`, +`HTTP_PROXY` and `NO_PROXY` on to the build and uses host networking when +the proxy is on localhost. If the proxy inspects TLS, set +`BUILD_CA_CERT=/path/to/proxy-ca.pem` so the builds trust it. + +## Locally without Docker + +- **Linux:** the packages from the table above need + `sudo apt install libasound2-dev libfontconfig1-dev libxkbcommon-dev libvpx-dev libdav1d-dev libpipewire-0.3-dev libspa-0.2-dev libclang-dev cmake dpkg-dev`, + then `cargo build --release --locked -p voelin-ui -p voelin-gateway` + and `scripts/package.sh linux`. +- **Windows:** [packaging/windows/README.md](../packaging/windows/README.md) + (MSVC, vcpkg libvpx, NSIS), then `bash scripts/package.sh windows` from Git Bash. +- **Android:** [android.md](android.md) (SDK, NDK, cargo-ndk), then + `cd android && ./gradlew assembleDebug` and `scripts/package.sh android`. +- **Flatpak:** [packaging/README.md](../packaging/README.md#flatpak). diff --git a/docs/gateway-admin.md b/docs/gateway-admin.md index 2d51139..9672a08 100644 --- a/docs/gateway-admin.md +++ b/docs/gateway-admin.md @@ -1,9 +1,9 @@ # Running the tsgw gateway -`tsgw` lets users of this client see who is in which channel and read and +`tsgw` lets users of Voelin see who is in which channel and read and write channel chat **without joining voice**, on a server you administer. It holds ServerQuery sessions (invisible to normal users of the official clients) -and serves users over a WebSocket (`tsgw.v1+json`, see `crates/tsc-gateway-proto`). +and serves users over a WebSocket (`tsgw.v1+json`, see `crates/voelin-gateway-proto`). ## What users get @@ -56,17 +56,53 @@ is written to the audit table. `relay.max_channel_relays` below the server's per-IP connection limit. Relays count toward a channel's max clients unless their group has `b_channel_join_ignore_maxclients`. -5. Copy `crates/tsc-gateway/tsgw.example.toml` to `tsgw.toml`, set the query - address and credentials (`TSGW_QUERY_PASSWORD` or `password_file`). +5. Install tsgw ([below](#install)), copy the example config to + `/etc/tsgw/tsgw.toml` and set the query address and credentials + (`TSGW_QUERY_PASSWORD` or `password_file`). 6. Run it behind TLS (Caddy, nginx) and give users the `wss://…/v1` URL. +## Install + +tsgw is packaged for Linux servers, separately from the app +([building.md](building.md)): the release workflow attaches the packages and +the image (`tsgw-image.tar.gz`) to each release and uploads them as artifacts +when run by hand, and +`scripts/docker-build.sh linux` builds them locally. + +**Debian/Ubuntu** (`tsgw__amd64.deb`, Ubuntu 24.04+ / Debian 13+). +It installs `/usr/bin/tsgw` and a systemd unit that is not started until +there is a config: + ```sh -cargo run --release -p tsc-gateway -- --config tsgw.toml -# or -docker build -f crates/tsc-gateway/Dockerfile -t tsgw . -docker run -v $PWD/tsgw.toml:/etc/tsgw/tsgw.toml -p 7788:7788 tsgw +sudo apt install ./tsgw__amd64.deb +sudo install -d -m 755 /etc/tsgw +sudo cp /usr/share/doc/tsgw/examples/tsgw.example.toml /etc/tsgw/tsgw.toml +sudoedit /etc/tsgw/tsgw.toml +# The query password, readable by root only (systemd reads it before +# starting tsgw as an unprivileged dynamic user). +echo 'TSGW_QUERY_PASSWORD=…' | sudo install -m 600 /dev/stdin /etc/tsgw/tsgw.env +sudo systemctl enable --now tsgw +journalctl -u tsgw -f ``` +The audit database (`path = "tsgw.db"`) ends up in `/var/lib/tsgw`. The unit +(`packaging/linux/tsgw.service`) runs tsgw sandboxed: no write access outside +that directory, network only. + +**Other distributions** (`tsgw--linux-x86_64.tar.gz`): `bin/tsgw`, +the same unit in `lib/systemd/system/` and the example config in +`share/doc/tsgw/`. Copy the binary to `/usr/bin` (or change `ExecStart`) and +the unit to `/etc/systemd/system/`. + +**Container** (`tsgw-image.tar.gz`, or build it): + +```sh +docker load -i tsgw-image.tar.gz # or: docker build -f crates/voelin-gateway/Dockerfile -t tsgw . +docker run -v $PWD/tsgw.toml:/etc/tsgw/tsgw.toml -e TSGW_QUERY_PASSWORD=… -p 7788:7788 tsgw +``` + +**From source:** `cargo run --release -p voelin-gateway -- --config tsgw.toml`. + ## Visibility Query clients are not hidden by the server; official clients hide them from diff --git a/docs/i18n.md b/docs/i18n.md new file mode 100644 index 0000000..5eb0161 --- /dev/null +++ b/docs/i18n.md @@ -0,0 +1,135 @@ +# Translations + +The UI is translated with Slint's gettext-based translations: strings in +`.slint` files are marked with `@tr(...)`, extracted into a `.pot` template, +translated in `.po` files, and **compiled into the binary** (Slint's bundled +translations). Nothing is loaded at runtime, so there is no dependency on +GNU gettext (LGPL) and it works the same on Linux, Windows and Android. + +## Marking strings + +In `.slint` files every user-visible string goes through `@tr`: + +```slint +Button { text: @tr("Connect"); } +Text { text: @tr("Connected to {}", server-name); } // arguments: {} or {0} {1} +Text { text: @tr("{n} user online" | "{n} users online" % count); } // plurals +Text { text: @tr("menu" => "Quit"); } // explicit context +``` + +- Whole sentences with placeholders, never concatenated fragments: word + order differs between languages. Use `{0}`, `{1}` when there are several + arguments, so translators can reorder them. +- Plurals always with the `|` / `%` form, even if English only needs two + forms; other languages have more. +- Not translated: nicknames, channel and server names, chat text, protocol + identifiers, the product name, log messages. +- By default the context of a string is the name of the component it is in, + so the same English word can be translated differently in different + places. Renaming a component therefore invalidates its translations until + they are merged again (`msgmerge` keeps them as fuzzy). + +Strings produced in Rust (error messages, notification texts, status lines) +cannot use `@tr`. Keep the wording in Slint: an exported global with pure +functions that the Rust code calls, e.g. + +```slint +export global Strings { + pure public function connection-lost(reason: string) -> string { + return @tr("Connection lost: {}", reason); + } +} +``` + +```rust +let text = window.global::().invoke_connection_lost(reason.into()); +``` + +Errors from lower layers (protocol, IO) are shown as details after a +translated sentence; they stay in English. + +## Files + +``` +crates/voelin-ui/lang/ + voelin-ui.pot template, generated + de/LC_MESSAGES/voelin-ui.po one directory per language (gettext locale name) + pt_BR/LC_MESSAGES/voelin-ui.po +``` + +The file name is the translation domain, which is the crate name +(`voelin-ui`); Slint's build looks for `lang//LC_MESSAGES/.po`. + +## Workflow + +Tools (developer machines only): `cargo install slint-tr-extractor`, and +GNU gettext for `msgmerge` / `msginit` (`gettext` package; on Windows from +MSYS2 or Git for Windows' bundled tools). + +```sh +# 1. Extract the template after changing strings +slint-tr-extractor --package-name voelin-ui crates/voelin-ui/ui/*.slint -o crates/voelin-ui/lang/voelin-ui.pot + +# 2. Update every translation (new strings empty, changed ones fuzzy) +for po in crates/voelin-ui/lang/*/LC_MESSAGES/voelin-ui.po; do + msgmerge --update --backup=none "$po" crates/voelin-ui/lang/voelin-ui.pot +done + +# 3. Start a new language +mkdir -p crates/voelin-ui/lang/de/LC_MESSAGES +msginit --no-translator --locale=de --input=crates/voelin-ui/lang/voelin-ui.pot \ + --output-file=crates/voelin-ui/lang/de/LC_MESSAGES/voelin-ui.po +``` + +Translators edit the `.po` files (Poedit, Lokalize, or a hosted service +such as Weblate pointed at `crates/voelin-ui/lang`). Fuzzy and untranslated +entries fall back to English. Run the extraction when strings change and +before each release (string freeze, see [release.md](release.md)). The +template carries a creation date and source line numbers, so CI does not +compare it exactly; a stale template only means new strings are not +translatable yet. + +## Bundling and language selection + +`crates/voelin-ui/build.rs` compiles the translations into the binary: + +```rust +slint_build::compile_with_config( + "ui/app.slint", + slint_build::CompilerConfiguration::new() + .with_style("fluent-dark".into()) + .with_bundled_translations("lang"), +) +``` + +slint-build tracks the `.po` files, so edits rebuild. It fails ("No +translations found") while `lang/` has no `.po` file yet, so enable it +together with the first language. + +At startup Slint picks the translation matching the system locale (exact +match such as `pt_BR` first, then the language `pt`), English otherwise. A +language setting in the app (stored in the settings, "System" by default) +calls `slint::select_bundled_translation("de")` after the window has been +created; `""` or `"en"` selects English. Changing it takes effect +immediately for all `@tr` strings. + +The desktop app (voelin-ui) and the Android app share the `.slint` files and +therefore the translations. Texts outside Slint need their own mechanism: + +- Android system texts (foreground service notification, permission + rationale): Android string resources in `android/app/src/main/res/values-/`. +- Desktop file and AppStream metainfo: translated with `itstool` / `msgfmt + --desktop` / `msgfmt --xml` from `.po` files when there are translations + for the app itself. + +## Checks + +- A pseudo-translation catches unmarked strings and truncation: create a + test language (e.g. `lang/eo/`) with `msgen` from the template, replace + the texts with longer accented versions, and select it with the language + setting (or `LANG=eo.UTF-8` on Linux). +- Test at least one language with longer words (German) and one with a + different script (Russian) on every screen before a release (manual + matrix row GE7). +- Dates and numbers are formatted in Rust; use unambiguous formats + (ISO dates, 24-hour times) until there is locale-aware formatting. diff --git a/docs/media.md b/docs/media.md index 4469277..0142556 100644 --- a/docs/media.md +++ b/docs/media.md @@ -1,8 +1,8 @@ -# Media: frames, codecs and capture (`tsc-media`) +# Media: frames, codecs and capture (`voelin-media`) -`crates/tsc-media` turns screens and system audio into frames, encodes and +`crates/voelin-media` turns screens and system audio into frames, encodes and decodes video, and converts pixels for rendering. It does no networking: -`tsc-stream` carries the encoded frames (`Peer::write(MediaKind::Video, +`voelin-stream` carries the encoded frames (`Peer::write(MediaKind::Video, MediaTime::new(frame.pts_90khz, Frequency::NINETY_KHZ), data)`), and received `MediaFrame`s go to `VideoDecoder::decode`. @@ -27,7 +27,7 @@ MediaTime::new(frame.pts_90khz, Frequency::NINETY_KHZ), data)`), and received ```rust let codecs = Codecs::new().with_openh264(OpenH264::find_in(&data_dir)?); // H.264 optional -let mut capture = tsc_media::capture::default_screen_capture()?; +let mut capture = voelin_media::capture::default_screen_capture()?; let mut frames = capture.start(&SourceId::Monitor(0), &CaptureOptions::default()).await?; let codec = codecs.pick_encoder(&viewer_codecs).unwrap(); let mut encoder = codecs.new_encoder(codec, EncoderConfig::default())?; @@ -38,6 +38,46 @@ while let Some(frame) = frames.recv().await { } ``` +## The pipeline in `voelin-core` (`media` module) + +Feature `media` of voelin-core builds the module with whatever voelin-media backends +are enabled (on Android: MediaCodec and the app's capture source); +`media-desktop` adds voelin-media's default backends (libvpx, OpenH264, X11, +PipeWire). The desktop app and voelinctl use `media-desktop`, the Android app +`media`. Codecs are always chosen through `Codecs`, so each build uses its own. + +``` +streamer: ScreenCapture ─ VideoEncoder (codec of our offer) ─┐ + AudioCapture ─ 20 ms stereo Opus (128 kbit/s) ─────┴─ MediaSink: StreamSink / EncodedSource +viewer: Engine::subscribe_frames ─ VideoPipeline (thread) ─ VideoDecoder ─ picture callback ─ Latest + stream audio ─ session audio thread (mixer, own volume) ─ speakers +``` + +- `Streamer::start(&codecs, StreamerConfig)` starts capturing right away (the + portal asks the user then), so a cancelled dialog never starts a stream; + frames are encoded only after `attach(sink)`, i.e. once the stream is live. + The encoder runs at the setup's bitrate; a viewer's keyframe request (on + the sink) forces a keyframe, and is kept until the encoder produced one. + Audio follows the capture clock across gaps. With the test pattern + (`SourceId::Synthetic`) the audio is a quiet sine tone. The portal's restore + token is available afterwards (`restore_token()`) to store. +- `peer_config(&codecs, config)` makes a viewer accept only what we decode + and a streamer offer only the codec it encodes (VP8 unless changed): all + viewers get the same frames, and a viewer picks from the offer. +- `VideoPipeline` decodes on its own thread. It starts at a keyframe, and + after a lost frame (`contiguous == false`, a lagging frame bus, a queue + longer than 30 frames) or a decoder error it skips to the next keyframe, + asking for one at most every 500 ms. Keyframes are recognised from the + bitstream (VP8 frame tag, VP9 header, H.264 IDR/SPS NAL units, AV1 + sequence header OBU). +- `Viewer` feeds a `VideoPipeline` from the engine and sends + `RequestStreamKeyframe`; `LocalPreview` runs capture → encoder → decoder + without a server (the desktop app's `VOELIN_DEMO_STREAM`). +- The audio of watched streams does not go through this module: the session + hands the Opus frames to its audio thread, which plays them through the + jitter buffer and mixer under a made-up client id, with its own volume. + Playback is mono like the rest of the audio path. + ## Codecs Preference: a viewer accepts VP9 > VP8 > AV1 > H.264; a streamer encodes with @@ -50,6 +90,17 @@ software). `Codecs` filters both lists by what is compiled in and loaded. | OpenH264 | `openh264` (default) | H.264 Constrained High / Baseline | H.264 | Cisco's prebuilt binary, loaded at runtime | | dav1d | `av1` | – | AV1 | system libdav1d >= 1.3 (1.4.1 tested) | | hardware | – | not yet | – | `codec::hw::HardwareEncoderFactory`; VA-API and Media Foundation stubs report nothing (TODO) | +| MediaCodec (Android) | – | H.264, VP8, VP9 | VP8, VP9, H.264, AV1 | the device's default codec per type through the NDK (`ndk` crate); a hardware encoder factory named `mediacodec` | + +On Android, `codec::mediacodec` uses byte-buffer mode on both sides, so it +takes and returns `VideoFrame`s like the software codecs. Encoders get NV12 +(else I420) in the layout the codec reports (`image-data` / `stride` / +`slice-height`, parsed by `codec::image_layout`, which is tested on every +platform); H.264 is High (preferably Constrained High) without B-frames, SPS/PPS +in front of every keyframe, keyframes on request (`request-sync`), bitrate +changes at runtime (`video-bitrate`). Encoder order: the device's hardware +encoders (H.264, VP9, VP8), then Google's software VP8 and H.264. Decoders +return the newest finished picture per `decode` call (NV12 or I420). libvpx settings follow libwebrtc's realtime setup: one pass CBR, no lag, `VPX_DL_REALTIME`, error resilient, `cpu-used` 8 (VP8: fixed speed −8), keyframes @@ -57,7 +108,8 @@ only at start and on request unless `keyframe_interval` is set, screen content tuning (`VP8E_SET_SCREEN_CONTENT_MODE`, `VP9E_SET_TUNE_CONTENT`, static threshold), VP9 row-mt, tiles and cyclic-refresh AQ. `set_bitrate` reconfigures the running encoder (`vpx_codec_enc_config_set`). The C API is wrapped in -`codec/vpx/raw.rs`, one of the two modules with `unsafe` code; existing safe +`codec/vpx/raw.rs`, one of three modules with `unsafe` code (with the X11 SHM +mapping and the `Send` wrapper in `codec/mediacodec.rs`); existing safe wrappers either encode only or cannot change the bitrate at runtime. The OpenH264 encoder has no safe runtime bitrate change in the `openh264` @@ -98,9 +150,13 @@ found at ..."). | Linux X11 (`x11`, default) | `X11Capture`: MIT-SHM 1.2 (memfd passed to the server) or GetImage; RandR 1.5 monitors; windows from `_NET_CLIENT_LIST` (root children without a WM); XFixes cursor blended in | | | Linux Wayland (`pipewire`, default) | `PortalCapture`: xdg-desktop-portal ScreenCast via `ashpd`, frames from a PipeWire video stream | `PipeWireAudioCapture`: default sink monitor (`stream.capture.sink = true`) | | Windows | `WindowsCapture`: Windows Graphics Capture (`windows-capture`), monitors and windows | `WasapiLoopback`: process loopback excluding our own process tree, falling back to plain loopback | +| Android | `ExternalScreenCapture` fed by the app (MediaProjection → `ImageReader`, RGBA; see [android.md](android.md)) | `ExternalAudioCapture` fed by the app (`AudioPlaybackCapture`, 48 kHz float) | -`default_screen_capture()` picks the portal when `WAYLAND_DISPLAY` is set (or -`XDG_SESSION_TYPE=wayland`), X11 when `DISPLAY` is set, WGC on Windows. +`default_screen_capture()` picks a registered external provider first +(`capture::external::set_screen_provider`, which the Android app calls at +start), then the portal when `WAYLAND_DISPLAY` is set (or +`XDG_SESSION_TYPE=wayland`), X11 when `DISPLAY` is set, WGC on Windows; +`default_audio_capture()` likewise. Notes: @@ -111,7 +167,7 @@ Notes: our memfd (`capture/x11/shm.rs`). - Portal: `start` needs a tokio runtime (zbus runs on it) and may show the desktop's picker. Choices persist with `PersistMode::ExplicitlyRevoked`: store - `PortalCapture::restore_token()` (e.g. in `tsc-store` settings) and pass it to + `PortalCapture::restore_token()` (e.g. in `voelin-store` settings) and pass it to `PortalCapture::with_restore_token` next time. The cursor is embedded when the portal supports it. Only shared-memory buffers (BGRx/BGRA/RGBx/RGBA) are negotiated; DMA-BUF import is a TODO. Without a session bus or portal, @@ -132,12 +188,12 @@ Linux (Debian/Ubuntu packages): `libvpx-dev` (feature `vpx`), PipeWire bindings run bindgen), `pkg-config`, and `libdav1d-dev` for `--features av1`. X11 capture is pure Rust (x11rb) and needs no packages. Tests of X11 capture need an X server: `xvfb`, run with `xvfb-run -a cargo -test -p tsc-media` (skipped without `DISPLAY`). +test -p voelin-media` (skipped without `DISPLAY`). Windows: libvpx is not found through pkg-config there. Install it (e.g. `vcpkg install libvpx:x64-windows`) and set `VPX_LIB_DIR`, `VPX_INCLUDE_DIR` and `VPX_VERSION`, or build without the `vpx` feature. The Windows capture -code is type-checked on Linux (`cargo clippy -p tsc-media --target +code is type-checked on Linux (`cargo clippy -p voelin-media --target x86_64-pc-windows-gnu --no-default-features --features openh264`) but has not run on Windows yet. @@ -162,7 +218,7 @@ run on Windows yet. |---|---|---| | Frame validation, YUV ↔ RGB (values, NV12, odd sizes, strides) | unit tests | tested | | VP8 / VP9 encode → decode (PSNR > 30 dB, rectangle colour, forced keyframes, bitrate change, resolution change) | unit tests, `tests/codec_roundtrip.rs` | tested | -| H.264 with Cisco's 2.6.0 library (PSNR, Constrained High `profile_idc` 100, Baseline 66) | `tests/openh264.rs` with `TSC_OPENH264_LIB` | tested locally, skipped without the library | +| H.264 with Cisco's 2.6.0 library (PSNR, Constrained High `profile_idc` 100, Baseline 66) | `tests/openh264.rs` with `VOELIN_OPENH264_LIB` | tested locally, skipped without the library | | OpenH264 download, SHA-256 check, reuse | `tests/openh264.rs -- --ignored` | tested locally (network) | | H.264 library missing / unknown file | unit + integration tests | tested | | AV1 decoder construction, garbage input | unit test (`--features av1`) | tested; no AV1 stream decoded (no encoder available) | @@ -171,3 +227,12 @@ run on Windows yet. | Portal capture, PipeWire video and audio streams | – | compiles only (no portal or PipeWire daemon here) | | Windows Graphics Capture, WASAPI | – | type-checked for `x86_64-pc-windows-gnu` only | | Hardware encoders | – | stubs | +| Test pattern → VP8 → decoder, rectangle position and colour | `voelin-core` `media::tests::local_preview_decodes_the_pattern` | tested | +| Test pattern → two engine stream tasks → str0m peers on loopback → decoder | `voelin-core` `stream::tests::test_pattern_through_stream_tasks` | tested | +| Stream audio (RTP time → jitter buffer ids, volume, end) | `voelin-core` `audio::tests::stream_audio_with_volume`, stream task test | tested | +| The same through the TeamSpeak 6 server | `voelin-core/tests/media_live.rs` (`VOELIN_LIVE=1`), `voelinctl stream start --synthetic` / `watch --expect-frames` | tested against 6.0.0-beta13.1 | +| X11 monitor capture → VP8 → server → decoder | `voelinctl stream start --source x11` under Xvfb | tested manually (debug build: about 8 fps at 1400×900) | +| Desktop app watching and sharing | Xvfb, `VOELIN_AUTOWATCH` / `VOELIN_AUTOSHARE` against voelinctl, screenshots | tested manually | +| External capture providers (start, refusal, end of capture, default selection) | unit tests | tested | +| MediaCodec buffer layouts (I420, NV12 with padding, `MediaImage2` NV21, crop) | unit tests (`codec::image_layout`) | tested | +| MediaCodec encoders and decoders | – | compiles for `aarch64-linux-android` only (no device or emulator here) | diff --git a/docs/protocol-notes/ts6-streaming.md b/docs/protocol-notes/ts6-streaming.md index 55c11c2..8a253a6 100644 --- a/docs/protocol-notes/ts6-streaming.md +++ b/docs/protocol-notes/ts6-streaming.md @@ -7,7 +7,7 @@ capture teaches something new. ## Legacy protocol on TS6 servers -- **Confirmed** (tsctl, 6.0.0-beta13.1, 2026-09-25): the TS3 client protocol +- **Confirmed** (voelinctl, 6.0.0-beta13.1, 2026-09-25): the TS3 client protocol connects (`initivexpand2` license chain with the TS5-server block type), channel tree, server chat and channel chat work. Client version: the vendored default `Windows_3_X_X__1`. @@ -19,7 +19,7 @@ capture teaches something new. (28 characters), TeamSpeak 6 uses `base64(SHA256(omega))` (44 characters), where omega is the base64 public key string. The same identity therefore has a different `client_unique_identifier` on each server generation - (`tsc-gateway-proto::UniqueIds`). + (`voelin-gateway-proto::UniqueIds`). - **Confirmed**: TS6 has no raw ServerQuery port; SSH query on 10022 and HTTP WebQuery on 10080 (HTTPS 10443). - **Reported**: beta13 made the Init1 puzzle difficulty adaptive to the server's @@ -64,7 +64,7 @@ candidates come back through `streamsignaling` / `notifystreamsignaling`. ### Probe results (confirmed, 6.0.0-beta13.1, default permissions, 2026-09-25) -Sent with `tsctl connect 127.0.0.1:9988 raw ''` as a plain guest: +Sent with `voelinctl connect 127.0.0.1:9988 raw ''` as a plain guest: | Command | Result | |---|---| @@ -104,7 +104,7 @@ server binary against a live stream (`is_remove` matches the ### End-to-end stream (confirmed, 6.0.0-beta13.1, 2026-09-25) -`crates/tsc-stream/tests/live_ts6.rs` runs a whole stream between two of our +`crates/voelin-stream/tests/live_ts6.rs` runs a whole stream between two of our clients through the server, with str0m on both ends: ``` @@ -173,18 +173,22 @@ cannot discover the ids of unknown streams), `updatestream` (`stream_id`, `stream_name`, `max_width`, `max_height`, `max_framerate`, `properties`), `notifystreamupdated`, `notifystreamattendees` (`return_code`, `client_id`). -### Streams that started before we joined (open) +### Streams that started before we joined (confirmed, 6.0.0-beta13.1, 2026-09-26) `initserver` and `notifycliententerview` carry `client_is_streaming`, but no -stream id. Whether the server sends `notifystreamstarted` for running streams -to a client that connects or enters the channel later is not confirmed yet. -`tsctl stream list` shows such streamers as "id not announced"; `tsctl stream -watch --id ` can still join when the streamer is known (`--streamer-nick`, -or the only other client streaming). The smoke test starts the viewer first. +stream id, and the server does not send `notifystreamstarted` for running +streams to a client that connects later: a `voelinctl stream list` started while +the desktop app streamed printed only "id not announced", while one connected +before the stream started got the id. Entering the channel later was not +probed separately. `voelinctl stream list` shows such streamers as "id not +announced"; `voelinctl stream watch --id ` can still join when the streamer +is known (`--streamer-nick`, or the only other client streaming). The desktop +app lists them as streaming but not watchable. The smoke test starts the +viewer first. How the official client learns these ids is open. ### WebRTC interop with Chromium (confirmed, Chromium 141, 2026-09-26) -`crates/tsc-stream/tests/browser_interop.rs` (`TSC_INTEROP=1`, see +`crates/voelin-stream/tests/browser_interop.rs` (`VOELIN_INTEROP=1`, see `tests/interop/README.md`) runs our str0m peers against headless Chromium's libwebrtc, the stack the official client is built on: @@ -213,7 +217,8 @@ libwebrtc, the stack the official client is built on: - [ ] Which permission gates `setupstream` (error 2568). - [x] Contents of `notifystreamstarted` (see probe results). - [ ] Contents of `notifystreaminfo` (`requeststreaminfo id=`). -- [ ] Whether a client that joins later is told about running streams (see above). +- [x] Whether a client that connects later is told about running streams: no (see above). +- [ ] How the official client finds running streams after connecting. - [ ] Interop with the official TS6 client (its offer/answer details, codecs it actually picks, whether it trickles candidates, mDNS host candidates). Chromium's WebRTC stack interoperates (see above). diff --git a/docs/release.md b/docs/release.md new file mode 100644 index 0000000..1f97a04 --- /dev/null +++ b/docs/release.md @@ -0,0 +1,190 @@ +# Releasing + +How a release is versioned, built, signed and checked. The app id +`io.github.faumaray.Voelin` ([packaging/README.md](../packaging/README.md)) +cannot change after the first release on Flathub or Google Play. + +## Versioning + +- One version for the apps: `version` of `crates/voelin-ui` (desktop; the + installer and the About page read it), `crates/voelin-android` and the + Android app's `versionName`. Semantic versioning; before 1.0 a minor bump + may break settings or the gateway protocol, and the changelog says so. +- Android `versionCode` must grow with every upload: + `major * 1000000 + minor * 1000 + patch` (0.2.3 is 2003). +- The gateway `tsgw` (`crates/voelin-gateway`) is versioned on its own, since + server admins update it separately. Its wire protocol is versioned in the + WebSocket subprotocol (`tsgw.v1+json`); a breaking change needs `v2` and a + period in which the gateway serves both. +- Library crates are not published (`publish = false`) and keep their + versions. +- Tags: `v` for the apps (`v0.2.0`), `tsgw-v` for the + gateway. Tags are annotated and signed (`git tag -s`). + +## Changelog + +`CHANGELOG.md` follows [Keep a Changelog](https://keepachangelog.com/). Every +change a user or server admin notices adds a line under `Unreleased` +(Added / Changed / Fixed / Removed / Security). At release the section gets +the version and date, and its highlights also go into the `` entry +of `packaging/linux/io.github.faumaray.Voelin.metainfo.xml` (shown by +software centers and Flathub). Release notes also state the TeamSpeak server +versions the release was tested against (TS3 and TS6 from +`dev/docker-compose.yml`). + +## Third-party notices + +`THIRD_PARTY_NOTICES.md` lists the licenses of everything compiled into the +apps. It is shown in the About page (`voelin_platform::notices::text()`) and +shipped in every package. It is generated, never edited: + +```sh +cargo install cargo-about --locked --version 0.9.2 --features cli +scripts/notices.sh # regenerate +scripts/notices.sh --check # what CI runs +``` + +- `about.toml`: accepted licenses (the same list as `deny.toml`), the + targets we ship (Linux, Windows, Android), no build or dev dependencies, + and clarifications for crates whose license files cargo-about does not + find (Slint, the bundled libopus, AWS-LC, OpenH264). Clarifications pin + file checksums; after a dependency update that changes such a file the + script fails and the new text has to be checked and its checksum updated. +- `about.hbs`: the Markdown template, with the notices that do not come from + crates: the Slint attribution, OpenH264 (downloaded at runtime, not + shipped), the vendored tsclientlib and libvpx. +- The output does not depend on the host, so CI (`notices` job in + `.github/workflows/ci.yml`) compares the committed file exactly and fails + when `Cargo.lock` changed without a regeneration. The cargo-about version + is pinned in the script and the job: a newer version may format + differently, so update both together. + +A new license has to be allowed in `deny.toml` (cargo-deny fails first) and +in `about.toml`, and must be compatible with distributing the apps under +MIT OR Apache-2.0 (no GPL/AGPL/LGPL code linked in; LGPL only as a +dynamically loaded system library, after review). + +## Signing + +Signing keys and certificates never go into the repository. In CI they live +in the secrets of a GitHub environment `release` that requires approval, +are written to `$RUNNER_TEMP` in the job and deleted at its end. + +### Windows (Authenticode) + +Unsigned executables trigger SmartScreen warnings; signed ones build +reputation with the publisher's certificate. Sign `voelin.exe` first, +then build the installer with `/DSIGN=...`, which signs the installer and the +uninstaller it writes (see [packaging/windows/README.md](../packaging/windows/README.md)). +Always timestamp (`/tr ... /td SHA256`), so signatures stay valid after the +certificate expires. + +Options for the certificate: + +- **Azure Trusted Signing**: Microsoft-managed certificates, no hardware + token, billed monthly; needs an Azure subscription and identity + validation of the publisher (check the current eligibility rules). Sign + with `signtool` and the Trusted Signing dlib (NuGet package + `Microsoft.Trusted.Signing.Client`): + + ```powershell + # metadata.json: {"Endpoint": "https://.codesigning.azure.net", + # "CodeSigningAccountName": "", "CertificateProfileName": ""} + signtool sign /v /fd SHA256 /tr http://timestamp.acs.microsoft.com /td SHA256 ` + /dlib Azure.CodeSigning.Dlib.dll /dmdf metadata.json target\release\voelin.exe + ``` + + In GitHub Actions, `azure/trusted-signing-action` does the same with a + service principal (client id, tenant id, secret as environment secrets). +- An OV or EV code-signing certificate (on a hardware token or in a cloud + HSM, as CAs require since 2023) with `signtool /f` or the HSM's CSP. +- SignPath's free plan for open-source projects (signing happens in their + service from a CI artifact). + +Check the result with `signtool verify /pa /v ` for the executable, +the installer and `uninstall.exe` after installing. + +### Linux + +- **Flathub** builds and signs the Flatpak itself (with Flathub's key) from + a manifest in the `flathub/` repository. For the first submission + open a pull request against `flathub/flathub` with the manifest, where the + source is this repository at the release tag and commit (not `type: dir`) + plus the generated `cargo-sources.json`. Before submitting: run + `flatpak run --command=flatpak-builder-lint org.flatpak.Builder manifest` + and `... repo`, `appstreamcli validate` on the metainfo, add screenshots + and the release entry to the metainfo. Flathub reviews names and branding: + the app must not look like an official TeamSpeak product. +- For our own releases (GitHub): a tarball of `voelin` with the desktop + file, metainfo, icon and notices, and optionally a Flatpak bundle + (`flatpak build-bundle --gpg-sign= ...`). Publish `SHA256SUMS` and + sign it (`gpg --detach-sign` or minisign) with a key whose fingerprint is + in the README. + +### Android + +APKs and app bundles are signed with a keystore kept outside the +repository; losing it means existing installs can no longer be updated. + +- Create it once: + `keytool -genkeypair -v -keystore voelin-release.jks -alias voelin -keyalg RSA -keysize 4096 -validity 10000`, + and back it up (two offline copies, password in a password manager). +- The Gradle build reads the keystore path, alias and passwords from Gradle + properties or environment variables (`~/.gradle/gradle.properties`, CI + secrets), never from files in the repository: `voelin.signing.storeFile`, + `voelin.signing.storePassword`, `voelin.signing.keyAlias`, + `voelin.signing.keyPassword`, or `VOELIN_SIGNING_STORE_FILE`, + `VOELIN_SIGNING_STORE_PASSWORD`, `VOELIN_SIGNING_KEY_ALIAS`, + `VOELIN_SIGNING_KEY_PASSWORD` ([android.md](android.md)). Without them it + builds unsigned or debug-signed artifacts only. +- CI: the `android` job signs a release APK when the repository has the + secrets `ANDROID_KEYSTORE_BASE64` (`base64 -w0 voelin-release.jks`), + `VOELIN_SIGNING_STORE_PASSWORD`, `VOELIN_SIGNING_KEY_ALIAS` and + `VOELIN_SIGNING_KEY_PASSWORD`; the keystore is decoded to `$RUNNER_TEMP` and + removed afterwards. Check with `apksigner verify --print-certs app-release.apk`. +- Google Play: use Play App Signing; our keystore is then the upload key + (it can be reset through Play support if lost). F-Droid builds and signs + itself unless reproducible builds are set up. + +## Checklist + +Before tagging: + +1. `main` is green in CI, including the smoke job (TS3 + TS6) and the + browser interop job. +2. `cargo deny --workspace check` is clean; the ignores in `deny.toml` are + still needed and still justified. +3. `scripts/notices.sh` has been run after the last dependency change (CI + `notices` job green); new licenses in the diff were reviewed. The About + page shows the AboutSlint widget (required by Slint's royalty-free + license), the OpenH264 attribution and the notices. +4. The [manual test matrix](testing/manual-matrix.md) has been run for this + version, results committed; failures are fixed or listed as known issues. +5. Translations: `.pot` regenerated and `.po` files merged + ([i18n.md](i18n.md)); string freeze announced a week before. +6. Versions bumped (`crates/voelin-ui`, `crates/voelin-android`, Android + `versionName` / `versionCode`, `voelin-gateway` if it changed), + `Cargo.lock` updated, changelog and metainfo `` written. + +Release: + +7. Tag `v` (signed) on the release commit and push it. +8. The tag's release workflow (`release.yml`, [building.md](building.md)) + runs the checks and the Windows tests and builds every package: the app's + Linux tarball and `.deb`, Flatpak bundle, Windows zip and installer and + Android APKs (signed when the secrets are set), and the gateway's Linux + tarball, `.deb` and image; its `release` job attaches them with a + `SHA256SUMS` to a draft GitHub release. Sign the + Windows executable and installer, and an AAB for Google Play, by hand + until CI has the certificates. +9. Verify: signatures (`signtool verify`, `apksigner verify`), the installer + and the Flatpak on a clean machine (matrix rows IN1-IN3), the version in + the About page. +10. Sign `SHA256SUMS`; write the changelog section, known issues and the + tested server versions into the draft release; publish it. +11. Update the Flathub manifest (tag, commit, `cargo-sources.json`), Google + Play / F-Droid. + +After: + +12. Add an empty `Unreleased` section to the changelog. diff --git a/docs/screenshots/desktop-audio-settings.png b/docs/screenshots/desktop-audio-settings.png new file mode 100644 index 0000000..b6edd10 Binary files /dev/null and b/docs/screenshots/desktop-audio-settings.png differ diff --git a/docs/screenshots/desktop-share-dialog.png b/docs/screenshots/desktop-share-dialog.png new file mode 100644 index 0000000..9e020d8 Binary files /dev/null and b/docs/screenshots/desktop-share-dialog.png differ diff --git a/docs/screenshots/desktop-share-live.png b/docs/screenshots/desktop-share-live.png new file mode 100644 index 0000000..75a915c Binary files /dev/null and b/docs/screenshots/desktop-share-live.png differ diff --git a/docs/screenshots/desktop-stream-viewer.png b/docs/screenshots/desktop-stream-viewer.png new file mode 100644 index 0000000..d1a8cd8 Binary files /dev/null and b/docs/screenshots/desktop-stream-viewer.png differ diff --git a/docs/testing/manual-matrix.md b/docs/testing/manual-matrix.md new file mode 100644 index 0000000..005e20b --- /dev/null +++ b/docs/testing/manual-matrix.md @@ -0,0 +1,215 @@ +# Manual test matrix + +What CI cannot check: other clients' WebRTC stacks, real desktops and +portals, real audio hardware, Android power management and the installers. +Run this matrix before every release (see [release.md](../release.md)) and +after changes to the area in question. + +## How to record results + +- Fill in **Result**, **Date** (YYYY-MM-DD) and **Version** (from the About + page; the commit hash for unreleased builds) in the tables below and + commit the update with the release. +- Result: `pass`, `fail` with a link to the issue, `partial` with a note, or + `n/a` when the platform does not support the feature. Empty means not run. +- Keep only the latest run per row; earlier runs are in the git history. +- Note the desktop and OS versions in **Notes** the first time a row is run + on a new release of them (e.g. "GNOME 48.2, Fedora 42"). + +Platforms: + +| Name | Session | +|---|---| +| GNOME | GNOME Shell 48 or newer, Wayland (older GNOME has no GlobalShortcuts portal) | +| KDE | KDE Plasma 6, Wayland | +| X11 | Any X11 session (e.g. Xfce, or GNOME/KDE on Xorg) | +| Win10 | Windows 10 22H2 | +| Win11 | Windows 11 24H2 or newer | +| Android | A phone with Android 12 or newer; note the model | + +Servers: TeamSpeak 6 (streams need it; use the version pinned in +`dev/docker-compose.yml` or newer) and TeamSpeak 3.13 for voice checks. The +official client is the current TeamSpeak 6 client for the same OS unless +noted. + +## Streams with the official TeamSpeak 6 client + +- **ST1** The official client watches our stream: we share a monitor at + 1080p30 with sound in our channel; the official client joins it. Pass: + picture within 5 s, smooth motion (move a window around), sound in sync + (play a video with speech), no freeze over 10 minutes, stop from either + side ends it cleanly. +- **ST2** We watch the official client's stream (screen with sound). Same + pass criteria. Note the codec it sent (debug log or stats). +- **ST3** Screen share with sound: system audio reaches viewers; voices of + the call are not sent back to them (known gap on Linux PipeWire, see + [media.md](../media.md): note what viewers hear). +- **ST4** Portal restore token (Wayland): share, stop, share again. Pass: the + second share starts without the picker; after revoking the permission in + the desktop's settings the picker shows again. +- **ST5** H.264: enable OpenH264 (download on first use, attribution text + shown next to the switch), stream to the official client and watch its + H.264 stream. Disable it again: H.264 is no longer offered. + +| ID | Platform | Result | Date | Version | Notes | +|---|---|---|---|---|---| +| ST1 | GNOME | | | | | +| ST1 | KDE | | | | | +| ST1 | X11 | | | | | +| ST1 | Win10 | | | | | +| ST1 | Win11 | | | | | +| ST2 | GNOME | | | | | +| ST2 | KDE | | | | | +| ST2 | X11 | | | | | +| ST2 | Win10 | | | | | +| ST2 | Win11 | | | | | +| ST3 | GNOME | | | | | +| ST3 | KDE | | | | | +| ST3 | X11 | | | | | +| ST3 | Win10 | | | | | +| ST3 | Win11 | | | | | +| ST4 | GNOME | | | | | +| ST4 | KDE | | | | | +| ST5 | GNOME or KDE | | | | | +| ST5 | Win11 | | | | | + +## Global push-to-talk + +- **PT1** Bind push-to-talk (Wayland: the desktop's dialog appears; accept + or change the key), focus another application (a browser, a game in + fullscreen), hold the key: the talking indicator lights and others hear + us; release: it stops within 100 ms. Repeat 20 times quickly: no stuck + transmission. Hold the key and Alt+Tab away: release still ends it. +- **PT2** Change the binding and restart the app: the new binding works; on + Wayland the desktop keeps the binding without asking again. +- **PT3** Windows: with an elevated window (e.g. Task Manager) focused, note + whether push-to-talk works (a hook of a non-elevated app does not see + those keys; document, do not fail). + +| ID | Platform | Result | Date | Version | Notes | +|---|---|---|---|---|---| +| PT1 | GNOME | | | | | +| PT1 | KDE | | | | | +| PT1 | X11 | | | | | +| PT1 | Win10 | | | | | +| PT1 | Win11 | | | | | +| PT1 | Flatpak on GNOME or KDE | | | | | +| PT2 | GNOME | | | | | +| PT2 | KDE | | | | | +| PT2 | X11 | | | | | +| PT2 | Win11 | | | | | +| PT3 | Win11 | | | | | + +## Audio + +- **AU1** Echo cancellation in a real one-hour call: laptop or desk + speakers (no headset) on our side, a second person on another client. + Pass: the other side hears no echo of their own voice (also while both + talk), our voice is not cut off, and the delay at the end of the hour is + the same as at the start (clap test at 0, 30 and 60 minutes). Note CPU + usage. +- **AU2** Device hotplug during a call: unplug the USB headset in use: audio + moves to the default device within a few seconds and an error or notice + is shown; plug it back in: it moves back within 5 s. Repeat with a + Bluetooth headset (connect, disconnect, switch between headset and + high-quality profiles). +- **AU3** Change the system default output and input while connected with + "default" selected: the app follows. + +| ID | Platform | Result | Date | Version | Notes | +|---|---|---|---|---|---| +| AU1 | GNOME or KDE | | | | | +| AU1 | Win11 | | | | | +| AU1 | Android | | | | | +| AU2 | GNOME | | | | | +| AU2 | KDE | | | | | +| AU2 | X11 | | | | | +| AU2 | Win10 | | | | | +| AU2 | Win11 | | | | | +| AU2 | Android | | | | | +| AU3 | GNOME or KDE | | | | | +| AU3 | Win11 | | | | | + +## Android + +- **AN1** Background voice: connect, lock the phone, 30 minutes with the + screen off (unplugged, not on a charger). Pass: still connected, both + directions audible the whole time, the foreground notification is shown + and its mute / disconnect actions work. Note the battery used. +- **AN2** Watch a stream: the official desktop client's and ours. +- **AN3** Share the screen (MediaProjection) with sound to the official + client and to our desktop app; stop from the notification. +- **AN4** A phone call during a voice session: our audio pauses, the session + resumes afterwards. Switch between Wi-Fi and mobile data: it reconnects. + +| ID | Platform | Result | Date | Version | Notes | +|---|---|---|---|---|---| +| AN1 | Android | | | | | +| AN2 | Android | | | | | +| AN3 | Android | | | | | +| AN4 | Android | | | | | + +## Install and uninstall + +- **IN1** Flatpak (bundle or Flathub): install, first run (microphone + permission, portals, notifications, keyring), update over the previous + version (data kept), `flatpak uninstall` (data kept) and + `flatpak uninstall --delete-data` (`~/.var/app/` removed). +- **IN2** Windows installer on a clean VM (no Visual C++ redistributable, + no Rust toolchain): SmartScreen and UAC show the publisher of the + signature, the app starts from the Start menu, an update over the + previous version keeps the settings, uninstall from Settings > Apps + removes the files, shortcut and registry key and keeps `%APPDATA%\voelin`; + `uninstall.exe /S` works too. +- **IN3** Android APK: install, update over the previous version (same + signature, data kept), uninstall. + +| ID | Platform | Result | Date | Version | Notes | +|---|---|---|---|---|---| +| IN1 | GNOME | | | | | +| IN1 | KDE | | | | | +| IN2 | Win10 | | | | | +| IN2 | Win11 | | | | | +| IN3 | Android | | | | | + +## General + +- **GE1** About page: the AboutSlint widget, the OpenH264 attribution and + the full third-party notices (scrollable) are shown. +- **GE2** Crash reports: with reports enabled, start the app with + `VOELIN_TEST_CRASH=1`: it exits with a panic and, on the next start, offers + the report (open folder, delete). With reports disabled nothing is + written. Reports are in `~/.local/state/voelin/crash-reports` (Flatpak: + `~/.var/app//.local/state/voelin/crash-reports`) or + `%LOCALAPPDATA%\voelin\crash-reports`. +- **GE3** Saved passwords survive a restart (GNOME Keyring, KWallet, Windows + Credential Manager, Android Keystore); without a keyring the app warns + and keeps them for the session only. +- **GE4** Notifications for pokes and private messages; clicking one brings + the window up. +- **GE5** Suspend and resume the machine while connected: the app + reconnects. +- **GE6** HiDPI and fractional scaling (150 %), two monitors with different + scales: text is sharp, windows open on the right monitor. +- **GE7** Another UI language (once translations exist): switch, restart, + no untranslated or truncated strings on the main screens. + +| ID | Platform | Result | Date | Version | Notes | +|---|---|---|---|---|---| +| GE1 | any desktop | | | | | +| GE1 | Android | | | | | +| GE2 | Linux | | | | | +| GE2 | Win11 | | | | | +| GE3 | GNOME | | | | | +| GE3 | KDE | | | | | +| GE3 | Win11 | | | | | +| GE3 | Android | | | | | +| GE4 | GNOME | | | | | +| GE4 | KDE | | | | | +| GE4 | Win11 | | | | | +| GE5 | Linux | | | | | +| GE5 | Win11 | | | | | +| GE6 | GNOME | | | | | +| GE6 | KDE | | | | | +| GE6 | Win11 | | | | | +| GE7 | any desktop | | | | | diff --git a/fuzz/Cargo.lock b/fuzz/Cargo.lock index 226c4d9..4f628ab 100644 --- a/fuzz/Cargo.lock +++ b/fuzz/Cargo.lock @@ -1268,16 +1268,6 @@ dependencies = [ "tsproto-types", ] -[[package]] -name = "tsc-fuzz" -version = "0.0.0" -dependencies = [ - "libfuzzer-sys", - "ts-bookkeeping", - "tsproto", - "tsproto-packets", -] - [[package]] name = "tsproto" version = "0.2.0" @@ -1377,6 +1367,16 @@ version = "0.9.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0b928f33d975fc6ad9f86c8f283853ad26bdd5b10b7f1542aa2fa15e2289105a" +[[package]] +name = "voelin-fuzz" +version = "0.0.0" +dependencies = [ + "libfuzzer-sys", + "ts-bookkeeping", + "tsproto", + "tsproto-packets", +] + [[package]] name = "wasi" version = "0.11.1+wasi-snapshot-preview1" diff --git a/fuzz/Cargo.toml b/fuzz/Cargo.toml index ed88ccc..b137d41 100644 --- a/fuzz/Cargo.toml +++ b/fuzz/Cargo.toml @@ -1,5 +1,5 @@ [package] -name = "tsc-fuzz" +name = "voelin-fuzz" version = "0.0.0" publish = false edition = "2024" diff --git a/packaging/README.md b/packaging/README.md index b74a7b5..693fa86 100644 --- a/packaging/README.md +++ b/packaging/README.md @@ -1,15 +1,25 @@ # Packaging -The product name is not decided yet: `TS Client` and the app id -`io.github.faumaray.TsClient` are placeholders (also in -`tsc_platform::{APP_NAME, APP_ID}`); rename them everywhere together. +The product is **Voelin**, with the app id `io.github.faumaray.Voelin` (also in +`voelin_platform::{APP_NAME, APP_ID}`). The app id names the desktop file, +metainfo, icon, Flatpak and Android app, and cannot change once published. | Path | What | |---|---| -| `linux/` | Desktop file, AppStream metainfo and a placeholder icon, named by app id | -| `flatpak/io.github.faumaray.TsClient.yml` | Flatpak manifest | +| `linux/` | Desktop file, AppStream metainfo and icon, named by app id; `tsgw.service`, the gateway's systemd unit ([gateway-admin.md](../docs/gateway-admin.md#install)) | +| `flatpak/io.github.faumaray.Voelin.yml` | Flatpak manifest | | `windows/` | NSIS installer and how to build and sign on Windows ([README](windows/README.md)) | +`scripts/package.sh` builds the packages from these ([docs/building.md](../docs/building.md)): +the app for Linux, Windows and Android, and the gateway `tsgw` for Linux servers +only, as its own package. + +Every package also carries `THIRD_PARTY_NOTICES.md` (generated by +`scripts/notices.sh`, see [docs/release.md](../docs/release.md)): Flatpak in +`/app/share/licenses//`, the Windows installer next to the executable, +the `.deb` files in `/usr/share/doc//`, the archives in `share/doc/`. +The app shows the same text in its About page. + ## Flatpak flatpak-builder builds offline, so the crates from `Cargo.lock` are listed as @@ -21,15 +31,17 @@ curl -LO https://raw.githubusercontent.com/flatpak/flatpak-builder-tools/master/ python3 flatpak-cargo-generator.py Cargo.lock -o packaging/flatpak/cargo-sources.json flatpak install flathub org.freedesktop.Platform//25.08 org.freedesktop.Sdk//25.08 \ - org.freedesktop.Sdk.Extension.rust-stable//25.08 -flatpak-builder --user --install --force-clean build-flatpak packaging/flatpak/io.github.faumaray.TsClient.yml -flatpak run io.github.faumaray.TsClient + org.freedesktop.Sdk.Extension.rust-stable//25.08 org.freedesktop.Sdk.Extension.llvm20//25.08 +flatpak-builder --user --install --force-clean build-flatpak packaging/flatpak/io.github.faumaray.Voelin.yml +flatpak run io.github.faumaray.Voelin ``` Regenerate `cargo-sources.json` whenever `Cargo.lock` changes. Inside the build `rust-toolchain.toml` does not apply: the `rust-stable` extension must provide at -least the workspace's `rust-version`. The SDK has everything else the build needs -(CMake for libopus, ALSA, fontconfig, xkbcommon, libvpx, PipeWire, clang). +least the workspace's `rust-version`. The `llvm20` extension provides libclang for +bindgen (PipeWire bindings); the SDK has everything else the build needs (CMake for +libopus, ALSA, fontconfig, xkbcommon, libvpx, PipeWire). CI builds the bundle in the +`package-flatpak` job of the release workflow ([docs/building.md](../docs/building.md)). Permissions (`finish-args`): network, Wayland with X11 fallback, DRI, PulseAudio (microphone and speakers), the PipeWire socket (application audio when streaming), @@ -37,5 +49,6 @@ notifications and the Secret Service. Push-to-talk (GlobalShortcuts) and screen capture (ScreenCast) go through portals and need no permission. Desktops match windows to the desktop file (taskbar icon, portal permissions) by -X11 `WM_CLASS`, which is the binary name `tsc-desktop` (hence `StartupWMClass`), -and on Wayland by the window's app id, which the app should set to the app id. +the window's app id on Wayland and its X11 `WM_CLASS` class. The app sets both +to the app id (`slint::set_xdg_app_id`), which is the desktop file's name and +its `StartupWMClass`. diff --git a/packaging/flatpak/io.github.faumaray.TsClient.yml b/packaging/flatpak/io.github.faumaray.Voelin.yml similarity index 57% rename from packaging/flatpak/io.github.faumaray.TsClient.yml rename to packaging/flatpak/io.github.faumaray.Voelin.yml index cbe7679..f2e7b31 100644 --- a/packaging/flatpak/io.github.faumaray.TsClient.yml +++ b/packaging/flatpak/io.github.faumaray.Voelin.yml @@ -1,12 +1,14 @@ # Flatpak manifest for the desktop app. See packaging/README.md for how to -# build it. The app id is a placeholder until the product has a name. -id: io.github.faumaray.TsClient +# build it. +id: io.github.faumaray.Voelin runtime: org.freedesktop.Platform runtime-version: "25.08" sdk: org.freedesktop.Sdk sdk-extensions: - org.freedesktop.Sdk.Extension.rust-stable -command: tsc-desktop + # libclang for bindgen (the PipeWire bindings); the SDK has none. + - org.freedesktop.Sdk.Extension.llvm20 +command: voelin finish-args: - --share=network @@ -30,20 +32,24 @@ finish-args: # no permission. build-options: - append-path: /usr/lib/sdk/rust-stable/bin + append-path: /usr/lib/sdk/rust-stable/bin:/usr/lib/sdk/llvm20/bin + prepend-ld-library-path: /usr/lib/sdk/llvm20/lib env: - CARGO_HOME: /run/build/tsc/cargo + CARGO_HOME: /run/build/voelin/cargo CARGO_NET_OFFLINE: "true" + LIBCLANG_PATH: /usr/lib/sdk/llvm20/lib modules: - - name: tsc + - name: voelin buildsystem: simple build-commands: - - cargo --offline build --release --locked -p tsc-ui - - install -Dm755 target/release/tsc-desktop -t /app/bin/ - - install -Dm644 packaging/linux/io.github.faumaray.TsClient.desktop -t /app/share/applications/ - - install -Dm644 packaging/linux/io.github.faumaray.TsClient.metainfo.xml -t /app/share/metainfo/ - - install -Dm644 packaging/linux/io.github.faumaray.TsClient.svg -t /app/share/icons/hicolor/scalable/apps/ + - cargo --offline build --release --locked -p voelin-ui + - install -Dm755 target/release/voelin -t /app/bin/ + - install -Dm644 packaging/linux/io.github.faumaray.Voelin.desktop -t /app/share/applications/ + - install -Dm644 packaging/linux/io.github.faumaray.Voelin.metainfo.xml -t /app/share/metainfo/ + - install -Dm644 packaging/linux/io.github.faumaray.Voelin.svg -t /app/share/icons/hicolor/scalable/apps/ + # Also shown in the app's About page. + - install -Dm644 THIRD_PARTY_NOTICES.md -t /app/share/licenses/io.github.faumaray.Voelin/ sources: - type: dir path: ../.. diff --git a/packaging/linux/io.github.faumaray.TsClient.desktop b/packaging/linux/io.github.faumaray.Voelin.desktop similarity index 68% rename from packaging/linux/io.github.faumaray.TsClient.desktop rename to packaging/linux/io.github.faumaray.Voelin.desktop index 37c44ae..77ced54 100644 --- a/packaging/linux/io.github.faumaray.TsClient.desktop +++ b/packaging/linux/io.github.faumaray.Voelin.desktop @@ -1,11 +1,11 @@ [Desktop Entry] Type=Application -Name=TS Client +Name=Voelin Comment=Voice chat, text chat and screen sharing -Exec=tsc-desktop -Icon=io.github.faumaray.TsClient +Exec=voelin +Icon=io.github.faumaray.Voelin Terminal=false Categories=Network;Chat;InstantMessaging;AudioVideo; Keywords=voice;chat;voip;push-to-talk; StartupNotify=true -StartupWMClass=tsc-desktop +StartupWMClass=io.github.faumaray.Voelin diff --git a/packaging/linux/io.github.faumaray.TsClient.metainfo.xml b/packaging/linux/io.github.faumaray.Voelin.metainfo.xml similarity index 74% rename from packaging/linux/io.github.faumaray.TsClient.metainfo.xml rename to packaging/linux/io.github.faumaray.Voelin.metainfo.xml index 0a08f0b..7ebc0d1 100644 --- a/packaging/linux/io.github.faumaray.TsClient.metainfo.xml +++ b/packaging/linux/io.github.faumaray.Voelin.metainfo.xml @@ -1,11 +1,10 @@ - + - io.github.faumaray.TsClient + io.github.faumaray.Voelin CC0-1.0 MIT OR Apache-2.0 - TS Client + Voelin Voice chat, text chat and screen sharing

@@ -19,12 +18,12 @@

  • Per-user volume
  • - io.github.faumaray.TsClient.desktop + io.github.faumaray.Voelin.desktop - tsc-desktop + voelin - https://github.com/Faumaray/teamspeak_client_rs - https://github.com/Faumaray/teamspeak_client_rs/issues + https://github.com/Faumaray/Voelin + https://github.com/Faumaray/Voelin/issues Faumaray diff --git a/packaging/linux/io.github.faumaray.TsClient.svg b/packaging/linux/io.github.faumaray.Voelin.svg similarity index 100% rename from packaging/linux/io.github.faumaray.TsClient.svg rename to packaging/linux/io.github.faumaray.Voelin.svg diff --git a/packaging/linux/tsgw.service b/packaging/linux/tsgw.service new file mode 100644 index 0000000..00eded6 --- /dev/null +++ b/packaging/linux/tsgw.service @@ -0,0 +1,45 @@ +# systemd unit for tsgw, the Voelin gateway (docs/gateway-admin.md). +# +# Write /etc/tsgw/tsgw.toml (example in /usr/share/doc/tsgw/examples), put the +# query password in /etc/tsgw/tsgw.env as TSGW_QUERY_PASSWORD=… (mode 600), +# then: systemctl enable --now tsgw. State (tsgw.db) is kept in /var/lib/tsgw. +[Unit] +Description=tsgw, the Voelin gateway for TeamSpeak servers +Documentation=https://github.com/Faumaray/Voelin/blob/main/docs/gateway-admin.md +After=network-online.target +Wants=network-online.target +ConditionPathExists=/etc/tsgw/tsgw.toml + +[Service] +ExecStart=/usr/bin/tsgw --config /etc/tsgw/tsgw.toml +# Read by systemd before dropping privileges, so it can stay root-only. +EnvironmentFile=-/etc/tsgw/tsgw.env +DynamicUser=yes +StateDirectory=tsgw +WorkingDirectory=/var/lib/tsgw +Restart=on-failure +RestartSec=5 + +NoNewPrivileges=yes +ProtectSystem=strict +ProtectHome=yes +PrivateTmp=yes +PrivateDevices=yes +ProtectKernelTunables=yes +ProtectKernelModules=yes +ProtectKernelLogs=yes +ProtectControlGroups=yes +ProtectClock=yes +ProtectHostname=yes +RestrictAddressFamilies=AF_INET AF_INET6 AF_UNIX +RestrictNamespaces=yes +RestrictRealtime=yes +LockPersonality=yes +MemoryDenyWriteExecute=yes +SystemCallArchitectures=native +SystemCallFilter=@system-service +CapabilityBoundingSet= +UMask=0077 + +[Install] +WantedBy=multi-user.target diff --git a/packaging/windows/README.md b/packaging/windows/README.md index f3a3113..2782f44 100644 --- a/packaging/windows/README.md +++ b/packaging/windows/README.md @@ -1,13 +1,17 @@ # Windows build and installer -CI (`release-build` in `.github/workflows/ci.yml`) builds `tsc-desktop.exe` on -`windows-2025` and uploads it as an artifact, with the installer when NSIS is on -the runner. Nothing is signed there. +The release workflow (`package-windows` in `.github/workflows/release.yml`) +builds `voelin.exe` on `windows-2025` and attaches the zip and the installer to +the release (artifact `voelin-windows-x86_64` when run by hand). Nothing is +signed there. Regular CI only runs clippy on Windows. The gateway `tsgw` +is for servers and packaged for Linux only. +`docker/windows.Dockerfile` cross-compiles the same packages on Linux +([docs/building.md](../../docs/building.md)). ## Build Needs the MSVC build tools, CMake (bundled libopus), NASM (assembly of -`aws-lc-sys`, used by the WebRTC stack) and libvpx (video, `tsc-media`): +`aws-lc-sys`, used by the WebRTC stack) and libvpx (video, `voelin-media`): ```powershell winget install NASM.NASM Kitware.CMake NSIS.NSIS @@ -19,14 +23,14 @@ $env:VPX_INCLUDE_DIR = "$vpx\include" $env:VPX_VERSION = "1.15.2" # what `vcpkg list libvpx` shows $env:VPX_STATIC = "1" -cargo build --release --locked -p tsc-ui +cargo build --release --locked -p voelin-ui makensis /DVERSION=0.1.0 packaging\windows\installer.nsi ``` -This gives `target\release\tsc-desktop.exe` and -`packaging\windows\tsc-desktop-0.1.0-setup.exe`. The installer puts the app in -`Program Files\TS Client`, adds a Start menu shortcut and an uninstaller; user -data stays in `%APPDATA%\tsc`. +This gives `target\release\voelin.exe` and +`packaging\windows\voelin-0.1.0-setup.exe`. The installer puts the app in +`Program Files\Voelin`, adds a Start menu shortcut and an uninstaller; user +data stays in `%APPDATA%\voelin`. The executable uses the dynamic MSVC runtime (`VCRUNTIME140.dll`, present on most systems). To drop that dependency build with @@ -40,7 +44,7 @@ it, then the installer and the uninstaller it writes (NSIS 3.08+ runs the `SIGN` command on both): ```powershell -signtool sign /fd SHA256 /tr http://timestamp.digicert.com /td SHA256 /f cert.pfx /p $env:CERT_PASSWORD target\release\tsc-desktop.exe +signtool sign /fd SHA256 /tr http://timestamp.digicert.com /td SHA256 /f cert.pfx /p $env:CERT_PASSWORD target\release\voelin.exe makensis /DVERSION=0.1.0 "/DSIGN=signtool sign /fd SHA256 /tr http://timestamp.digicert.com /td SHA256 /f cert.pfx /p $env:CERT_PASSWORD %1" packaging\windows\installer.nsi ``` diff --git a/packaging/windows/installer.nsi b/packaging/windows/installer.nsi index 1e1680e..d3f89e0 100644 --- a/packaging/windows/installer.nsi +++ b/packaging/windows/installer.nsi @@ -1,14 +1,13 @@ -; NSIS installer for the desktop app (tsc-desktop.exe). See README.md. +; NSIS installer for the desktop app (voelin.exe). See README.md. ; ; makensis /DVERSION=0.1.0 packaging\windows\installer.nsi ; ; Paths are relative to this file. Optional defines: -; BINARY the executable (default ..\..\target\release\tsc-desktop.exe) +; BINARY the executable (default ..\..\target\release\voelin.exe) ; OUTDIR where the installer goes (default: next to this file) ; SIGN a signing command; "%1" is replaced by the file to sign, e.g. ; /DSIGN="signtool sign /fd SHA256 /tr http://timestamp.digicert.com /td SHA256 /a %1" ; -; The product name and app id are placeholders until the product has a name. Unicode true SetCompressor /SOLID lzma @@ -17,16 +16,16 @@ SetCompressor /SOLID lzma !define VERSION "0.1.0" !endif !ifndef BINARY - !define BINARY "..\..\target\release\tsc-desktop.exe" + !define BINARY "..\..\target\release\voelin.exe" !endif !ifndef OUTDIR !define OUTDIR "." !endif -!define APP_NAME "TS Client" -!define APP_ID "io.github.faumaray.TsClient" +!define APP_NAME "Voelin" +!define APP_ID "io.github.faumaray.Voelin" !define PUBLISHER "Faumaray" -!define EXE "tsc-desktop.exe" +!define EXE "voelin.exe" !define UNINSTALL_KEY "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APP_ID}" !ifdef SIGN @@ -36,7 +35,7 @@ SetCompressor /SOLID lzma !endif Name "${APP_NAME}" -OutFile "${OUTDIR}\tsc-desktop-${VERSION}-setup.exe" +OutFile "${OUTDIR}\voelin-${VERSION}-setup.exe" InstallDir "$PROGRAMFILES64\${APP_NAME}" InstallDirRegKey HKLM "${UNINSTALL_KEY}" "InstallLocation" RequestExecutionLevel admin @@ -61,6 +60,8 @@ VIAddVersionKey "LegalCopyright" "MIT OR Apache-2.0" Section "Install" SetOutPath "$INSTDIR" File "/oname=${EXE}" "${BINARY}" + ; Also shown in the app's About page. + File "/oname=THIRD_PARTY_NOTICES.md" "..\..\THIRD_PARTY_NOTICES.md" WriteUninstaller "$INSTDIR\uninstall.exe" CreateShortcut "$SMPROGRAMS\${APP_NAME}.lnk" "$INSTDIR\${EXE}" @@ -77,8 +78,9 @@ Section "Install" SectionEnd Section "Uninstall" - ; User data in %APPDATA%\tsc (identities, bookmarks, history) is kept. + ; User data in %APPDATA%\voelin (identities, bookmarks, history) is kept. Delete "$INSTDIR\${EXE}" + Delete "$INSTDIR\THIRD_PARTY_NOTICES.md" Delete "$INSTDIR\uninstall.exe" RMDir "$INSTDIR" Delete "$SMPROGRAMS\${APP_NAME}.lnk" diff --git a/scripts/docker-build.sh b/scripts/docker-build.sh new file mode 100755 index 0000000..c1dc76b --- /dev/null +++ b/scripts/docker-build.sh @@ -0,0 +1,44 @@ +#!/usr/bin/env bash +# Build the packages in Docker, the same ones CI uploads (docs/building.md). +# +# scripts/docker-build.sh [linux|windows|android|all] [docker build args…] +# +# Output goes to dist//. Needs Docker with BuildKit (Docker 23+, or +# docker buildx). Extra arguments go to `docker build`, e.g. +# scripts/docker-build.sh android --build-arg ABIS=arm64-v8a +# +# Behind an HTTPS proxy, HTTPS_PROXY/HTTP_PROXY/NO_PROXY are passed on to the +# build; a proxy on this machine's loopback is reached with host networking. +# If the proxy inspects TLS, point BUILD_CA_CERT at its CA certificate (PEM): +# the builds then trust it. +set -euo pipefail + +cd "$(dirname "$0")/.." + +platform=${1:-all} +shift || true +case "$platform" in + linux | windows | android) platforms=("$platform") ;; + all) platforms=(linux windows android) ;; + *) echo "usage: $0 [linux|windows|android|all] [docker build args…]" >&2; exit 2 ;; +esac + +args=() +for var in HTTPS_PROXY https_proxy HTTP_PROXY http_proxy NO_PROXY no_proxy; do + if [[ -n ${!var:-} ]]; then + args+=(--build-arg "$var=${!var}") + case "${!var}" in + *://127.* | *://localhost*) args+=(--network host) ;; + esac + fi +done + +if [[ -n ${BUILD_CA_CERT:-} ]]; then + args+=(--secret "id=ca,src=$BUILD_CA_CERT") +fi + +for p in "${platforms[@]}"; do + echo "== $p → dist/$p" + DOCKER_BUILDKIT=1 docker build -f "docker/$p.Dockerfile" -o "dist/$p" "${args[@]}" "$@" . + ls -l "dist/$p" +done diff --git a/scripts/it-smoke.sh b/scripts/it-smoke.sh index 6bb2d43..1971110 100755 --- a/scripts/it-smoke.sh +++ b/scripts/it-smoke.sh @@ -1,5 +1,5 @@ #!/usr/bin/env bash -# Integration smoke test: tsctl against the TS3 and TS6 servers from +# Integration smoke test: voelinctl against the TS3 and TS6 servers from # dev/docker-compose.yml. # # For each server it checks: @@ -14,7 +14,7 @@ # 8. stream (TeamSpeak 6 only): a viewer watches a synthetic VP8 + Opus stream # # Usage: scripts/it-smoke.sh [ts3|ts6]... (default: both) -# Env: TSCTL=path/to/tsctl (default: builds target/debug/tsctl) +# Env: VOELINCTL=path/to/voelinctl (default: builds target/debug/voelinctl) # COMPOSE_FILE=dev/docker-compose.yml set -euo pipefail @@ -27,9 +27,9 @@ mkdir -p "$STATE_DIR" # Never leave background clients behind. trap 'kill $(jobs -p) 2>/dev/null || true' EXIT -if [[ -z "${TSCTL:-}" ]]; then - cargo build --quiet -p tsctl -p tsc-gateway - TSCTL=target/debug/tsctl +if [[ -z "${VOELINCTL:-}" ]]; then + cargo build --quiet -p voelinctl -p voelin-gateway + VOELINCTL=target/debug/voelinctl fi TSGW="${TSGW:-target/debug/tsgw}" @@ -37,7 +37,7 @@ declare -A PORTS=([ts3]=9987 [ts6]=9988) # ServerQuery transport and address per server (dev/docker-compose.yml). declare -A QUERY=([ts3]="raw 127.0.0.1:10011" [ts6]="ssh 127.0.0.1:10022") declare -A GATEWAY=([ts3]=7787 [ts6]=7788) -QUERY_SECRET=tsc-dev-admin +QUERY_SECRET=voelin-dev-admin SERVERS=("$@") [[ ${#SERVERS[@]} -eq 0 ]] && SERVERS=(ts3 ts6) @@ -63,15 +63,15 @@ privilege_key() { admin_args() { local svc=$1 addr=$2 id="$STATE_DIR/$svc-admin.json" if [[ ! -f "$id" ]]; then - "$TSCTL" identity new --out "$id.tmp" --force >/dev/null - if ! "$TSCTL" connect "$addr" --identity "$id.tmp" --nick admin \ + "$VOELINCTL" identity new --out "$id.tmp" --force >/dev/null + if ! "$VOELINCTL" connect "$addr" --identity "$id.tmp" --nick admin \ --privilege-key "$(privilege_key "$svc")" tree >/dev/null; then fail "could not redeem the $svc privilege key (already used?). Reset the servers: docker compose -f $COMPOSE_FILE down -v && docker compose -f $COMPOSE_FILE up -d && rm -rf $STATE_DIR" fi mv "$id.tmp" "$id" # The rapid test connections would trip the per-IP anti-flood ban. - "$TSCTL" connect "$addr" --identity "$id" --nick admin raw \ + "$VOELINCTL" connect "$addr" --identity "$id" --nick admin raw \ "serveredit virtualserver_antiflood_points_needed_ip_block=100000 virtualserver_antiflood_points_needed_command_block=100000" >/dev/null fi echo "--identity $id" @@ -81,12 +81,12 @@ admin_args() { chat_roundtrip() { local addr=$1 kind=$2 sender_args=$3 local token="smoke-$kind-$RANDOM$RANDOM" out="$STATE_DIR/listen.log" - "$TSCTL" connect "$addr" --nick listener listen --expect "$token" --timeout 20 >"$out" 2>&1 & + "$VOELINCTL" connect "$addr" --nick listener listen --expect "$token" --timeout 20 >"$out" 2>&1 & local listener=$! # Give the listener time to connect before sending. for _ in $(seq 1 40); do grep -q "listener" "$out" 2>/dev/null && break; sleep 0.25; done # shellcheck disable=SC2086 - "$TSCTL" connect "$addr" --nick sender $sender_args chat "$kind" "$token" + "$VOELINCTL" connect "$addr" --nick sender $sender_args chat "$kind" "$token" if ! wait "$listener"; then cat "$out" fail "$kind chat message not received" @@ -97,11 +97,11 @@ chat_roundtrip() { # One client records while another sends a tone; Goertzel checks the result. voice_roundtrip() { local addr=$1 out="$STATE_DIR/voice.log" - "$TSCTL" connect "$addr" --nick recorder voice record "$STATE_DIR/voice.wav" \ + "$VOELINCTL" connect "$addr" --nick recorder voice record "$STATE_DIR/voice.wav" \ --seconds 6 --expect-tone 1000 >"$out" 2>&1 & local recorder=$! sleep 2 - "$TSCTL" connect "$addr" --nick talker voice send --tone 1000 --seconds 2 >/dev/null + "$VOELINCTL" connect "$addr" --nick talker voice send --tone 1000 --seconds 2 >/dev/null if ! wait "$recorder"; then cat "$out" fail "voice tone not received" @@ -114,11 +114,11 @@ stream_check() { local addr=$1 out="$STATE_DIR/stream-watch.log" streamer_out="$STATE_DIR/stream-start.log" # Unique nicknames: other clients may stream on the same server. local streamer="streamer-$$-$RANDOM" - "$TSCTL" connect "$addr" --nick "viewer-$$" stream --loopback watch --streamer-nick "$streamer" \ + "$VOELINCTL" connect "$addr" --nick "viewer-$$" stream --loopback watch --streamer-nick "$streamer" \ --expect-frames 60 --timeout 30 >"$out" 2>&1 & local viewer=$! sleep 2 - if ! "$TSCTL" connect "$addr" --nick "$streamer" stream --loopback start --synthetic \ + if ! "$VOELINCTL" connect "$addr" --nick "$streamer" stream --loopback start --synthetic \ --auto-accept --seconds 10 >"$streamer_out" 2>&1; then cat "$streamer_out" "$out" fail "streamer failed" @@ -134,11 +134,11 @@ stream_check() { presence_check() { local addr=$1 query=$2 out="$STATE_DIR/observe.log" # shellcheck disable=SC2086 - "$TSCTL" observe $query --secret "$QUERY_SECRET" --allowlisted --poll 2 \ + "$VOELINCTL" observe $query --secret "$QUERY_SECRET" --allowlisted --poll 2 \ --seconds 20 --expect-client presence-probe >"$out" 2>&1 & local observer=$! sleep 2 - "$TSCTL" connect "$addr" --nick presence-probe listen --timeout 4 >/dev/null 2>&1 || true + "$VOELINCTL" connect "$addr" --nick presence-probe listen --timeout 4 >/dev/null 2>&1 || true if ! wait "$observer"; then cat "$out" fail "observer did not see the voice client" @@ -151,16 +151,16 @@ relay_check() { local addr=$1 query=$2 out="$STATE_DIR/relay.log" heard="$STATE_DIR/relay-heard.log" local token="relay-$RANDOM$RANDOM" # shellcheck disable=SC2086 - "$TSCTL" relay $query --secret "$QUERY_SECRET" --allowlisted --channel 1 \ + "$VOELINCTL" relay $query --secret "$QUERY_SECRET" --allowlisted --channel 1 \ --expect "to-relay-$token" --seconds 20 >"$out" 2>&1 & local relay=$! - "$TSCTL" connect "$addr" --nick relay-listener listen --expect "from-relay-$token" \ + "$VOELINCTL" connect "$addr" --nick relay-listener listen --expect "from-relay-$token" \ --timeout 20 >"$heard" 2>&1 & local listener=$! sleep 4 - "$TSCTL" connect "$addr" --nick relay-talker chat channel "to-relay-$token" + "$VOELINCTL" connect "$addr" --nick relay-talker chat channel "to-relay-$token" # shellcheck disable=SC2086 - "$TSCTL" relay $query --secret "$QUERY_SECRET" --allowlisted --channel 1 --nick Alice \ + "$VOELINCTL" relay $query --secret "$QUERY_SECRET" --allowlisted --channel 1 --nick Alice \ --send "from-relay-$token" --seconds 1 >/dev/null if ! wait "$relay"; then cat "$out" @@ -187,22 +187,22 @@ gateway_check() { # The gateway only knows identities that connected with voice once. local user="$STATE_DIR/$svc-gateway-user.json" stranger="$STATE_DIR/stranger.json" - [[ -f "$user" ]] || "$TSCTL" identity new --out "$user" >/dev/null - "$TSCTL" connect "$addr" --identity "$user" --nick gateway-user tree >/dev/null - "$TSCTL" identity new --out "$stranger" --force >/dev/null - if "$TSCTL" gateway "$url" --identity "$stranger" --seconds 3 >/dev/null 2>&1; then + [[ -f "$user" ]] || "$VOELINCTL" identity new --out "$user" >/dev/null + "$VOELINCTL" connect "$addr" --identity "$user" --nick gateway-user tree >/dev/null + "$VOELINCTL" identity new --out "$stranger" --force >/dev/null + if "$VOELINCTL" gateway "$url" --identity "$stranger" --seconds 3 >/dev/null 2>&1; then fail "gateway accepted an identity the server does not know" fi - "$TSCTL" gateway "$url" --identity "$user" --presence --open channel:1 \ + "$VOELINCTL" gateway "$url" --identity "$user" --presence --open channel:1 \ --expect "to-gateway-$token" --seconds 20 >"$out" 2>&1 & local reader=$! - "$TSCTL" connect "$addr" --nick gateway-listener listen --expect "from-gateway-$token" \ + "$VOELINCTL" connect "$addr" --nick gateway-listener listen --expect "from-gateway-$token" \ --timeout 20 >"$STATE_DIR/gateway-heard.log" 2>&1 & local listener=$! sleep 4 - "$TSCTL" connect "$addr" --nick gateway-talker chat channel "to-gateway-$token" - "$TSCTL" gateway "$url" --identity "$user" --send "channel:1=from-gateway-$token" --seconds 3 >/dev/null + "$VOELINCTL" connect "$addr" --nick gateway-talker chat channel "to-gateway-$token" + "$VOELINCTL" gateway "$url" --identity "$user" --send "channel:1=from-gateway-$token" --seconds 3 >/dev/null if ! wait "$reader"; then cat "$out" "$STATE_DIR/tsgw-$svc.log" fail "gateway user did not receive the channel message" @@ -224,7 +224,7 @@ for svc in "${SERVERS[@]}"; do admin=$(admin_args "$svc" "$addr") - tree=$("$TSCTL" connect "$addr" --nick tree-check tree) + tree=$("$VOELINCTL" connect "$addr" --nick tree-check tree) echo "$tree" grep -q "tree-check" <<<"$tree" || fail "own client missing from tree" @@ -240,10 +240,10 @@ for svc in "${SERVERS[@]}"; do fi done -log "engine (tsc-core) against both servers" -TSC_LIVE=1 cargo test --quiet -p tsc-core --test live --test stream_live 2>&1 | grep -E "test result|panicked|timed out" || fail "engine tests failed" +log "engine (voelin-core) against both servers, media pipeline through TS6" +VOELIN_LIVE=1 cargo test --quiet -p voelin-core --features media-desktop --test live --test stream_live --test media_live 2>&1 | grep -E "test result|panicked|timed out" || fail "engine tests failed" -log "stream (tsc-stream) through the TeamSpeak 6 server" -TSC_LIVE=1 cargo test --quiet -p tsc-stream --test live_ts6 2>&1 | grep -E "test result|panicked|timed out" || fail "stream test failed" +log "stream (voelin-stream) through the TeamSpeak 6 server" +VOELIN_LIVE=1 cargo test --quiet -p voelin-stream --test live_ts6 2>&1 | grep -E "test result|panicked|timed out" || fail "stream test failed" log "all smoke tests passed" diff --git a/scripts/notices.sh b/scripts/notices.sh new file mode 100755 index 0000000..945755d --- /dev/null +++ b/scripts/notices.sh @@ -0,0 +1,58 @@ +#!/usr/bin/env bash +# Regenerate THIRD_PARTY_NOTICES.md from Cargo.lock with cargo-about +# (about.toml, about.hbs). The app shows the file in its About page +# (voelin_platform::notices::text()), so it is committed; run this after changing +# dependencies. +# +# Usage: scripts/notices.sh regenerate THIRD_PARTY_NOTICES.md +# scripts/notices.sh --check fail if the committed file is stale (CI) +# +# Needs cargo-about $ABOUT_VERSION; the output depends on its version: +# cargo install cargo-about --locked --version 0.9.2 --features cli +# Fails on any warning, e.g. a license whose text was not found. +set -euo pipefail + +ABOUT_VERSION=0.9.2 +OUT=THIRD_PARTY_NOTICES.md + +cd "$(dirname "$0")/.." + +check=false +case "${1:-}" in + --check) check=true ;; + "") ;; + *) echo "usage: $0 [--check]" >&2; exit 2 ;; +esac + +version=$(cargo about --version 2>/dev/null | awk '{print $2}' || true) +if [[ "$version" != "$ABOUT_VERSION" ]]; then + echo "cargo-about $ABOUT_VERSION is required (found: ${version:-none}):" >&2 + echo " cargo install cargo-about --locked --version $ABOUT_VERSION --features cli" >&2 + exit 1 +fi + +tmp=$(mktemp -d) +trap 'rm -rf "$tmp"' EXIT + +# Workspace members with default features, filtered by the targets in +# about.toml, so the result does not depend on the host. +if ! cargo about generate --workspace --locked --fail about.hbs -o "$tmp/$OUT" 2>"$tmp/log"; then + cat "$tmp/log" >&2 + exit 1 +fi +if grep -E "WARN|ERROR" "$tmp/log" >&2; then + echo "cargo-about reported problems (above); fix about.toml" >&2 + exit 1 +fi + +if $check; then + if ! diff -u "$OUT" "$tmp/$OUT" >"$tmp/diff"; then + head -n 100 "$tmp/diff" + echo "$OUT is stale: run scripts/notices.sh and commit the result" >&2 + exit 1 + fi + echo "$OUT is up to date" +else + mv "$tmp/$OUT" "$OUT" + echo "wrote $OUT ($(wc -c <"$OUT") bytes)" +fi diff --git a/scripts/own-crates.sh b/scripts/own-crates.sh index c66d8ce..9e770db 100755 --- a/scripts/own-crates.sh +++ b/scripts/own-crates.sh @@ -1,9 +1,10 @@ #!/usr/bin/env bash -# Print `-p ` for every workspace crate outside the vendored crates/proto, +# Print `-p ` for every workspace crate outside the vendored crates/proto +# (manifest paths with / or \ separators, for Windows), # for commands that apply strict checks to our own code only: # cargo clippy $(scripts/own-crates.sh) --all-targets --no-deps -- -D warnings set -euo pipefail cd "$(dirname "$0")/.." cargo metadata --no-deps --format-version 1 | - jq -r '.packages[] | select(.manifest_path | contains("/crates/proto/") | not) | "-p \(.name)"' | + jq -r '.packages[] | select(.manifest_path | gsub("\\\\"; "/") | contains("/crates/proto/") | not) | "-p \(.name)"' | tr '\n' ' ' diff --git a/scripts/package.sh b/scripts/package.sh new file mode 100755 index 0000000..a77269b --- /dev/null +++ b/scripts/package.sh @@ -0,0 +1,193 @@ +#!/usr/bin/env bash +# Package release builds into the files CI uploads and the Docker builds +# produce (docs/building.md). Build first, then: +# +# scripts/package.sh linux [out-dir] from target/release: +# voelin--linux-.tar.gz, +# voelin__.deb (the app), +# tsgw--linux-.tar.gz, +# tsgw__.deb (the gateway, +# for servers) +# scripts/package.sh windows [out-dir] voelin--windows-x86_64.zip and +# voelin--setup.exe (NSIS) +# scripts/package.sh android [out-dir] the APKs Gradle built, renamed +# +# out-dir defaults to dist/. Each run also writes SHA256SUMS- there. +# voelinctl (a development tool) is in no package. +# +# Environment: +# CARGO_TARGET_DIR cargo's target directory (default: target) +# WINDOWS_TARGET the target triple the .exe files were built for, e.g. +# x86_64-pc-windows-gnu (default: none, target/release) +# MAKENSIS the NSIS compiler (default: makensis on PATH, then the +# default install location on Windows) +set -euo pipefail + +cd "$(dirname "$0")/.." + +kind=${1:-} +case "$kind" in + linux | windows | android) ;; + *) echo "usage: $0 linux|windows|android [out-dir]" >&2; exit 2 ;; +esac +mkdir -p "${2:-dist}" +out=$(cd "${2:-dist}" && pwd) +target_dir=${CARGO_TARGET_DIR:-target} + +# The version of a crate, from its manifest. +crate_version() { + local v + v=$(sed -n 's/^version = "\(.*\)"$/\1/p' "$1/Cargo.toml" | head -n 1) + [[ -n $v ]] || { echo "no version in $1/Cargo.toml" >&2; exit 1; } + printf '%s\n' "$v" +} +version=$(crate_version crates/voelin-ui) + +app_id=io.github.faumaray.Voelin +homepage=https://github.com/Faumaray/Voelin +tmp=$(mktemp -d) +trap 'rm -rf "$tmp"' EXIT +files=() + +# make_deb : builds +# __.deb from the tree in $tmp/debian/, with +# Depends from its /usr/bin binaries (dpkg-shlibdeps) plus . +# Extra control fields can be passed in $deb_extra. +make_deb() { + local pkg=$1 ver=$2 extra_depends=$3 root=$tmp/debian/$1 deb_arch depends bins + shift 3 + deb_arch=$(dpkg --print-architecture) + mkdir -p "$tmp/debian" + printf 'Source: %s\n\nPackage: %s\nArchitecture: any\n' "$pkg" "$pkg" >"$tmp/debian/control" + bins=("$root"/usr/bin/*) + depends=$(cd "$tmp" && dpkg-shlibdeps -O "${bins[@]#"$tmp/"}" | sed -n 's/^shlibs:Depends=//p') + depends=${depends:+$depends${extra_depends:+, }}$extra_depends + cat >"$root/usr/share/doc/$pkg/copyright" <<-EOF + Upstream: $homepage + License: MIT OR Apache-2.0 + Third-party licenses: /usr/share/doc/$pkg/THIRD_PARTY_NOTICES.md + EOF + mkdir -p "$root/DEBIAN" + { + printf 'Package: %s\nVersion: %s\nArchitecture: %s\n' "$pkg" "$ver" "$deb_arch" + printf 'Maintainer: Faumaray <23194470+Faumaray@users.noreply.github.com>\n' + printf 'Section: net\nPriority: optional\nHomepage: %s\n' "$homepage" + printf 'Depends: %s\n' "$depends" + [[ -z ${deb_extra:-} ]] || printf '%s\n' "$deb_extra" + printf 'Description: %s\n' "$1" + shift + printf ' %s\n' "$@" + } >"$root/DEBIAN/control" + dpkg-deb --root-owner-group --build "$root" "$out/${pkg}_${ver}_$deb_arch.deb" >/dev/null + files+=("${pkg}_${ver}_$deb_arch.deb") +} + +package_linux() { + local bin=$target_dir/release arch name stage root gw_version + arch=$(uname -m) + gw_version=$(crate_version crates/voelin-gateway) + + # The app. Archives use a prefix layout, e.g. + # `tar -xzf … --strip-components=1 -C ~/.local`. + name=voelin-$version-linux-$arch + stage=$tmp/$name + install -Dm755 "$bin/voelin" -t "$stage/bin" + install -Dm644 packaging/linux/$app_id.desktop -t "$stage/share/applications" + install -Dm644 packaging/linux/$app_id.metainfo.xml -t "$stage/share/metainfo" + install -Dm644 packaging/linux/$app_id.svg -t "$stage/share/icons/hicolor/scalable/apps" + install -Dm644 THIRD_PARTY_NOTICES.md -t "$stage/share/doc/voelin" + tar -C "$tmp" -czf "$out/$name.tar.gz" "$name" + files+=("$name.tar.gz") + + # The gateway, for servers: nothing of the app, no GUI libraries. + name=tsgw-$gw_version-linux-$arch + stage=$tmp/$name + install -Dm755 "$bin/tsgw" -t "$stage/bin" + install -Dm644 packaging/linux/tsgw.service -t "$stage/lib/systemd/system" + install -Dm644 THIRD_PARTY_NOTICES.md crates/voelin-gateway/tsgw.example.toml -t "$stage/share/doc/tsgw" + tar -C "$tmp" -czf "$out/$name.tar.gz" "$name" + files+=("$name.tar.gz") + + command -v dpkg-deb >/dev/null || { echo "dpkg-deb not found: skipping the .deb files" >&2; return; } + + root=$tmp/debian/voelin + install -Dm755 "$bin/voelin" -t "$root/usr/bin" + install -Dm644 packaging/linux/$app_id.desktop -t "$root/usr/share/applications" + install -Dm644 packaging/linux/$app_id.metainfo.xml -t "$root/usr/share/metainfo" + install -Dm644 packaging/linux/$app_id.svg -t "$root/usr/share/icons/hicolor/scalable/apps" + install -Dm644 THIRD_PARTY_NOTICES.md -t "$root/usr/share/doc/voelin" + # libxkbcommon, Wayland/X11 and EGL are loaded at run time (dlopen), so + # dpkg-shlibdeps cannot see them. + deb_extra="Recommends: libwayland-client0, libwayland-cursor0, libxkbcommon-x11-0, libx11-xcb1, libxcursor1, libxi6, libxrandr2, libegl1" \ + make_deb voelin "$version" libxkbcommon0 \ + "Voelin, a TeamSpeak 3 and 6 client" \ + "Desktop client for TeamSpeak 3 and TeamSpeak 6 servers: voice, chat," \ + "screen sharing and invisible presence through a tsgw gateway." + + root=$tmp/debian/tsgw + install -Dm755 "$bin/tsgw" -t "$root/usr/bin" + install -Dm644 packaging/linux/tsgw.service -t "$root/usr/lib/systemd/system" + install -Dm644 THIRD_PARTY_NOTICES.md -t "$root/usr/share/doc/tsgw" + install -Dm644 crates/voelin-gateway/tsgw.example.toml -t "$root/usr/share/doc/tsgw/examples" + make_deb tsgw "$gw_version" "" \ + "Voelin gateway for TeamSpeak servers" \ + "Runs next to a TeamSpeak 3 or 6 server and gives Voelin users invisible" \ + "presence and channel chat over ServerQuery. Configure /etc/tsgw/tsgw.toml" \ + "(example in /usr/share/doc/tsgw/examples), then systemctl enable --now tsgw." +} + +# A path Windows programs understand when running on Windows (Git Bash): +# backslashes, since makensis's File finds nothing through "D:/a/…" paths. +native_path() { + if command -v cygpath >/dev/null; then cygpath -w "$1"; else printf '%s\n' "$1"; fi +} + +package_windows() { + local bin=$target_dir/${WINDOWS_TARGET:+$WINDOWS_TARGET/}release name stage makensis + name=voelin-$version-windows-x86_64 + stage=$tmp/$name + mkdir -p "$stage" + cp "$bin/voelin.exe" THIRD_PARTY_NOTICES.md "$stage/" + if command -v zip >/dev/null; then + (cd "$tmp" && zip -qr "$out/$name.zip" "$name") + elif command -v 7z >/dev/null; then + (cd "$tmp" && 7z a -tzip -bso0 "$(native_path "$out/$name.zip")" "$name") + else + powershell -NoProfile -Command \ + "Compress-Archive -Path '$(native_path "$stage")' -DestinationPath '$(native_path "$out/$name.zip")'" + fi + files+=("$name.zip") + + makensis=${MAKENSIS:-$(command -v makensis || true)} + if [[ -z $makensis && -x "/c/Program Files (x86)/NSIS/makensis.exe" ]]; then + makensis="/c/Program Files (x86)/NSIS/makensis.exe" + fi + if [[ -z $makensis ]]; then + echo "makensis not found: skipping the installer" >&2 + return + fi + # Absolute paths: makensis changes into the script's directory. + "$makensis" -V2 -DVERSION="$version" -DOUTDIR="$(native_path "$out")" \ + -DBINARY="$(native_path "$(cd "$bin" && pwd)/voelin.exe")" packaging/windows/installer.nsi + files+=("voelin-$version-setup.exe") +} + +package_android() { + local apk android_version variant found=0 + android_version=$(crate_version crates/voelin-android) + for apk in android/app/build/outputs/apk/*/*.apk; do + [[ -e $apk ]] || continue + # app-debug.apk, app-release.apk, app-release-unsigned.apk + variant=$(basename "$apk" .apk) + variant=${variant#app-} + cp "$apk" "$out/voelin-$android_version-android-$variant.apk" + files+=("voelin-$android_version-android-$variant.apk") + found=1 + done + ((found)) || { echo "no APKs in android/app/build/outputs/apk: build with Gradle first" >&2; exit 1; } +} + +"package_$kind" + +(cd "$out" && sha256sum "${files[@]}" >"SHA256SUMS-$kind") +printf '%s\n' "${files[@]/#/$out/}" diff --git a/tests/interop/README.md b/tests/interop/README.md index 4f7a0a2..06647e0 100644 --- a/tests/interop/README.md +++ b/tests/interop/README.md @@ -1,6 +1,6 @@ # Browser interop test -`crates/tsc-stream/tests/browser_interop.rs` checks our str0m peers against +`crates/voelin-stream/tests/browser_interop.rs` checks our str0m peers against the WebRTC stack of Chromium (libwebrtc, the same stack as the official TeamSpeak 6 client). `browser-peer.cjs` runs headless Chromium through Playwright and exchanges SDP and candidates with the Rust test as JSON lines @@ -19,11 +19,11 @@ chromium` on a new machine; `PLAYWRIGHT_BROWSERS_PATH` if the browsers live elsewhere). ```sh -TSC_INTEROP=1 cargo test -p tsc-stream --test browser_interop -- --nocapture +VOELIN_INTEROP=1 cargo test -p voelin-stream --test browser_interop -- --nocapture ``` -Without `TSC_INTEROP=1` the tests return immediately, so `cargo test` passes on -machines without a browser. `TSC_NODE` selects the node binary; `NODE_PATH` +Without `VOELIN_INTEROP=1` the tests return immediately, so `cargo test` passes on +machines without a browser. `VOELIN_NODE` selects the node binary; `NODE_PATH` defaults to `npm root -g` so a global Playwright is found. Chromium is started with `--disable-features=WebRtcHideLocalIpsWithMdns`: diff --git a/tests/interop/browser-peer.cjs b/tests/interop/browser-peer.cjs index 1dd052e..7808301 100644 --- a/tests/interop/browser-peer.cjs +++ b/tests/interop/browser-peer.cjs @@ -1,5 +1,5 @@ // Headless Chromium as the remote WebRTC peer for -// crates/tsc-stream/tests/browser_interop.rs (see README.md here). +// crates/voelin-stream/tests/browser_interop.rs (see README.md here). // // Reads one JSON command per line on stdin and writes one JSON reply per line // on stdout; logs go to stderr. Commands (`op`): diff --git a/tools/tsctl/Cargo.toml b/tools/voelinctl/Cargo.toml similarity index 57% rename from tools/tsctl/Cargo.toml rename to tools/voelinctl/Cargo.toml index b4f6701..5edf9c1 100644 --- a/tools/tsctl/Cargo.toml +++ b/tools/voelinctl/Cargo.toml @@ -1,5 +1,5 @@ [package] -name = "tsctl" +name = "voelinctl" version = "0.1.0" description = "Headless command-line client for TeamSpeak 3/6 servers, used for development and integration tests." edition.workspace = true @@ -14,20 +14,23 @@ base64 = "0.22" clap = { version = "4", features = ["derive", "env"] } dirs = "6" futures = "0.3" +png = "0.18" serde_json = "1" tokio = { version = "1", features = ["io-std", "io-util", "macros", "rt-multi-thread", "signal", "time"] } tracing = "0.1" tracing-subscriber = { version = "0.3", features = ["env-filter"] } tsclientlib = { path = "../../crates/proto/tsclientlib" } tsproto-packets = { path = "../../crates/proto/tsproto-packets" } -tsc-model = { path = "../../crates/tsc-model" } -tsc-query = { path = "../../crates/tsc-query" } -tsc-observer = { path = "../../crates/tsc-observer" } -tsc-audio = { path = "../../crates/tsc-audio", default-features = false } -tsc-stream = { path = "../../crates/tsc-stream" } +voelin-model = { path = "../../crates/voelin-model" } +voelin-query = { path = "../../crates/voelin-query" } +voelin-observer = { path = "../../crates/voelin-observer" } +voelin-audio = { path = "../../crates/voelin-audio", default-features = false } +# The stream media pipeline (capture, VP8, decoding), without audio devices. +voelin-core = { path = "../../crates/voelin-core", default-features = false, features = ["media-desktop"] } +voelin-stream = { path = "../../crates/voelin-stream" } tokio-tungstenite = "0.30" futures-util = "0.3.34" -tsc-gateway-proto = { path = "../../crates/tsc-gateway-proto" } +voelin-gateway-proto = { path = "../../crates/voelin-gateway-proto" } [lints] workspace = true diff --git a/tools/tsctl/src/gateway.rs b/tools/voelinctl/src/gateway.rs similarity index 94% rename from tools/tsctl/src/gateway.rs rename to tools/voelinctl/src/gateway.rs index decfcba..c23bf6d 100644 --- a/tools/tsctl/src/gateway.rs +++ b/tools/voelinctl/src/gateway.rs @@ -1,4 +1,4 @@ -//! `tsctl gateway`: talk to a tsgw gateway as a user. +//! `voelinctl gateway`: talk to a tsgw gateway as a user. use std::path::PathBuf; use std::time::Duration; @@ -9,15 +9,15 @@ use futures_util::{SinkExt, StreamExt}; use tokio::time::{Instant, timeout_at}; use tokio_tungstenite::tungstenite::Message; use tokio_tungstenite::tungstenite::client::IntoClientRequest; -use tsc_gateway_proto::{ClientMsg, Envelope, ServerMsg, sign_challenge}; -use tsc_model::{ChatTarget, Presence}; +use voelin_gateway_proto::{ClientMsg, Envelope, ServerMsg, sign_challenge}; +use voelin_model::{ChatTarget, Presence}; #[derive(Args, Debug, Clone)] pub struct GatewayArgs { /// Gateway URL, e.g. ws://127.0.0.1:7788/v1. pub url: String, /// Identity file (must have connected to the server with voice once). - #[arg(long, env = "TSCTL_IDENTITY")] + #[arg(long, env = "VOELINCTL_IDENTITY")] pub identity: PathBuf, /// Receive presence and print the tree. #[arg(long)] @@ -53,7 +53,9 @@ fn parse_target(s: &str) -> Result { pub async fn run(args: GatewayArgs) -> Result<()> { let identity = crate::identity::load(&args.identity)?; let mut request = args.url.as_str().into_client_request()?; - request.headers_mut().insert("Sec-WebSocket-Protocol", tsc_gateway_proto::SUBPROTOCOL.parse()?); + request + .headers_mut() + .insert("Sec-WebSocket-Protocol", voelin_gateway_proto::SUBPROTOCOL.parse()?); let (mut ws, _) = tokio_tungstenite::connect_async(request) .await .with_context(|| format!("failed to connect to {}", args.url))?; diff --git a/tools/tsctl/src/identity.rs b/tools/voelinctl/src/identity.rs similarity index 92% rename from tools/tsctl/src/identity.rs rename to tools/voelinctl/src/identity.rs index a4fb091..cceea17 100644 --- a/tools/tsctl/src/identity.rs +++ b/tools/voelinctl/src/identity.rs @@ -7,7 +7,7 @@ use anyhow::{Context, Result}; use tsclientlib::Identity; pub fn default_path() -> PathBuf { - dirs::config_dir().unwrap_or_else(|| PathBuf::from(".")).join("tsctl").join("identity.json") + dirs::config_dir().unwrap_or_else(|| PathBuf::from(".")).join("voelinctl").join("identity.json") } pub fn load(path: &Path) -> Result { @@ -45,7 +45,7 @@ mod tests { #[test] fn roundtrip() { - let dir = std::env::temp_dir().join(format!("tsctl-id-test-{}", std::process::id())); + let dir = std::env::temp_dir().join(format!("voelinctl-id-test-{}", std::process::id())); let path = dir.join("id.json"); let identity = create(8); assert!(identity.level() >= 8); diff --git a/tools/tsctl/src/main.rs b/tools/voelinctl/src/main.rs similarity index 94% rename from tools/tsctl/src/main.rs rename to tools/voelinctl/src/main.rs index 2381af6..b23cef5 100644 --- a/tools/tsctl/src/main.rs +++ b/tools/voelinctl/src/main.rs @@ -1,4 +1,4 @@ -//! `tsctl`: headless TeamSpeak 3/6 client for development and integration tests. +//! `voelinctl`: headless TeamSpeak 3/6 client for development and integration tests. mod gateway; mod identity; @@ -55,7 +55,7 @@ enum IdentityCommand { /// Minimum security level (hash cash). Servers commonly require 8. #[arg(long, default_value_t = 8)] level: u8, - /// Where to store the identity [default: /tsctl/identity.json]. + /// Where to store the identity [default: /voelinctl/identity.json]. #[arg(long)] out: Option, /// Overwrite an existing file. @@ -74,19 +74,19 @@ pub struct ConnectArgs { /// Server address: host, host:port, or a TeamSpeak server nickname. address: String, /// Nickname to use. - #[arg(long, default_value = "tsctl")] + #[arg(long, default_value = "voelinctl")] nick: String, /// Identity file. Without it a temporary identity is generated. - #[arg(long, env = "TSCTL_IDENTITY")] + #[arg(long, env = "VOELINCTL_IDENTITY")] identity: Option, - /// Signed client version: `default`, an index or `@` from `tsctl versions`. + /// Signed client version: `default`, an index or `@` from `voelinctl versions`. #[arg(long, default_value = "default")] client_version: String, /// Server password. - #[arg(long, env = "TSCTL_SERVER_PASSWORD")] + #[arg(long, env = "VOELINCTL_SERVER_PASSWORD")] server_password: Option, /// Privilege key (token) to redeem after connecting, e.g. the ServerAdmin key a new server prints. - #[arg(long, env = "TSCTL_PRIVILEGE_KEY")] + #[arg(long, env = "VOELINCTL_PRIVILEGE_KEY")] privilege_key: Option, /// Channel to join, as a path like `Lobby/Sub`. #[arg(long)] diff --git a/tools/tsctl/src/observe.rs b/tools/voelinctl/src/observe.rs similarity index 95% rename from tools/tsctl/src/observe.rs rename to tools/voelinctl/src/observe.rs index 22e407f..4d054a2 100644 --- a/tools/tsctl/src/observe.rs +++ b/tools/voelinctl/src/observe.rs @@ -1,4 +1,4 @@ -//! `tsctl observe` and `tsctl relay`: invisible presence and channel chat. +//! `voelinctl observe` and `voelinctl relay`: invisible presence and channel chat. use std::time::Duration; @@ -6,8 +6,10 @@ use anyhow::{Result, bail}; use clap::Args; use tokio::sync::broadcast::error::RecvError; use tokio::time::{Instant, timeout_at}; -use tsc_model::{ChatMessage, ChatTarget, Presence, PresenceDelta}; -use tsc_observer::{Observer, ObserverConfig, ObserverEvent, RelayConfig, RelayEvent, RelayPool}; +use voelin_model::{ChatMessage, ChatTarget, Presence, PresenceDelta}; +use voelin_observer::{ + Observer, ObserverConfig, ObserverEvent, RelayConfig, RelayEvent, RelayPool, +}; use crate::query::QueryConnArgs; @@ -40,7 +42,7 @@ pub struct RelayArgs { #[arg(long)] pub send: Option, /// Name shown in relayed posts. - #[arg(long, default_value = "tsctl")] + #[arg(long, default_value = "voelinctl")] pub nick: String, /// Stop after this many seconds (default: until Ctrl-C). #[arg(long)] diff --git a/tools/tsctl/src/query.rs b/tools/voelinctl/src/query.rs similarity index 93% rename from tools/tsctl/src/query.rs rename to tools/voelinctl/src/query.rs index d5c5516..5e7dec8 100644 --- a/tools/tsctl/src/query.rs +++ b/tools/voelinctl/src/query.rs @@ -1,11 +1,11 @@ -//! `tsctl query`: ServerQuery commands and events. +//! `voelinctl query`: ServerQuery commands and events. use std::time::Duration; use anyhow::{Context, Result, bail}; use clap::Args; use tokio::io::{AsyncBufReadExt, BufReader}; -use tsc_query::{Command, Connect, LineOptions, QueryClient, Row, Transport}; +use voelin_query::{Command, Connect, LineOptions, QueryClient, Row, Transport}; /// How to reach and log into a ServerQuery interface. #[derive(Args, Debug, Clone)] @@ -19,7 +19,7 @@ pub struct QueryConnArgs { #[arg(long, default_value = "serveradmin")] pub user: String, /// Password (raw/SSH) or API key (HTTP). Without it, HTTP runs as guest. - #[arg(long, env = "TSCTL_QUERY_SECRET", hide_env_values = true)] + #[arg(long, env = "VOELINCTL_QUERY_SECRET", hide_env_values = true)] pub secret: Option, /// Select the virtual server by its voice port instead of id 1. #[arg(long)] diff --git a/tools/tsctl/src/session.rs b/tools/voelinctl/src/session.rs similarity index 100% rename from tools/tsctl/src/session.rs rename to tools/voelinctl/src/session.rs diff --git a/tools/tsctl/src/stream.rs b/tools/voelinctl/src/stream.rs similarity index 67% rename from tools/tsctl/src/stream.rs rename to tools/voelinctl/src/stream.rs index 7dfae58..6f4ad04 100644 --- a/tools/tsctl/src/stream.rs +++ b/tools/voelinctl/src/stream.rs @@ -1,22 +1,30 @@ -//! `tsctl connect ... stream start|list|watch`: TeamSpeak 6 streams. +//! `voelinctl connect ... stream start|list|watch`: TeamSpeak 6 streams. use std::collections::HashMap; +use std::path::{Path, PathBuf}; +use std::sync::Arc; +use std::sync::atomic::{AtomicBool, Ordering}; use std::time::Duration; -use anyhow::{Result, bail}; +use anyhow::{Context, Result, bail}; use clap::{Args, Subcommand}; use futures::prelude::*; use tokio::io::{AsyncBufReadExt, BufReader, Lines, Stdin}; use tokio::time::{Instant, Interval, sleep_until}; -use tsc_model::ServerFlavor; -use tsc_stream::{ - EndReason, FrameSource, MediaKind, Output, PeerConfig, Request, StreamEvent, StreamInfo, - StreamNotification, StreamSetup, StreamerEvent, StreamerOptions, Streams, SyntheticSource, - WatchEvent, -}; use tsclientlib::events::{Event, PropertyId}; use tsclientlib::prelude::*; use tsclientlib::{ClientId, Connection, MessageHandle, StreamItem}; +use voelin_core::media::voelin_media::capture::SourceId; +use voelin_core::media::voelin_media::{Codecs, VideoFrame, convert}; +use voelin_core::media::{ + CaptureBackend, EncodedSource, Latest, Streamer, StreamerConfig, VideoPipeline, peer_config, + stream_codec, +}; +use voelin_model::ServerFlavor; +use voelin_stream::{ + EndReason, FrameSource, MediaKind, Output, PeerConfig, Request, StreamEvent, StreamInfo, + StreamNotification, StreamSetup, StreamerEvent, StreamerOptions, Streams, WatchEvent, +}; #[derive(Args, Debug, Clone)] pub struct StreamArgs { @@ -35,28 +43,36 @@ pub struct StreamArgs { #[derive(Subcommand, Debug, Clone)] pub enum StreamCommand { - /// Stream in our channel. Without `--auto-accept`, answer join requests on - /// stdin: `accept `, `deny `, `kick `, `stop`. + /// Stream in our channel: the screen (VP8) and system audio (Opus). + /// Without `--auto-accept`, answer join requests on stdin: `accept + /// `, `deny `, `kick `, `stop`. Start { /// Stream name. - #[arg(long, default_value = "tsctl")] + #[arg(long, default_value = "voelinctl")] name: String, - /// Send synthetic frames (tiny VP8 keyframes and silent Opus); needed - /// until capture and encoders exist. - #[arg(long)] + /// What to capture: `synthetic` (a moving test pattern and a tone), + /// `x11[:]`, `screen[:]` (this session's backend), + /// `window:` or `portal` (the desktop's dialog). + #[arg(long, default_value = "screen")] + source: String, + /// Same as `--source synthetic`. + #[arg(long, conflicts_with = "source")] synthetic: bool, + /// Size of the test pattern. + #[arg(long, default_value = "1280x720")] + size: String, /// Accept every viewer. #[arg(long)] auto_accept: bool, /// Stop after this many seconds [default: until Ctrl-C]. #[arg(long)] seconds: Option, - /// Synthetic video frames per second. + /// Video frames per second. #[arg(long, default_value_t = 30)] fps: u32, - /// Size of each synthetic video frame in bytes. - #[arg(long, default_value_t = 4000)] - frame_size: usize, + /// Video bitrate in kbit/s (announced in `setupstream` too). + #[arg(long, default_value_t = 4608)] + bitrate: u32, /// No audio track. #[arg(long)] no_audio: bool, @@ -76,12 +92,15 @@ pub enum StreamCommand { /// Nickname of the streamer. #[arg(long)] streamer_nick: Option, - /// Exit successfully once this many video frames arrived. + /// Exit successfully once this many video frames were decoded. #[arg(long)] expect_frames: Option, /// Give up after this many seconds; fails if `--expect-frames` was not reached. #[arg(long)] timeout: Option, + /// Save the last decoded picture as PNG. + #[arg(long)] + save_frame: Option, }, } @@ -99,47 +118,90 @@ pub async fn run(con: &mut Connection, args: &StreamArgs) -> Result<()> { } else if args.no_stun { config.stun_servers.clear(); } + // Offer the codec we encode, accept what we decode. + let codecs = Arc::new(Codecs::new()); + let config = peer_config(&codecs, config); + let codec = stream_codec(&codecs, &config); let mut driver = Driver { streams: Streams::new(own, config), pending: HashMap::new() }; let result = match &args.command { StreamCommand::Start { name, + source, synthetic, + size, auto_accept, seconds, fps, - frame_size, + bitrate, no_audio, } => { - let source = frame_source(*synthetic, *fps, *frame_size, !no_audio)?; - let setup = StreamSetup { name: name.clone(), audio: !no_audio, ..Default::default() }; + let source = if *synthetic { "synthetic" } else { source.as_str() }; + let (source, backend) = parse_source(source)?; + let Some(codec) = codec else { bail!("no video encoder in this build") }; + let config = StreamerConfig { + source, + backend, + fps: *fps, + bitrate_kbps: *bitrate, + codec, + audio: !no_audio, + synthetic_size: parse_size(size)?, + ..StreamerConfig::default() + }; + let streamer = Streamer::start(&codecs, config).await.context("capture")?; + println!("capturing with {} ({codec})", streamer.backend()); + if let Some(e) = streamer.audio_error() { + println!("no system audio: {e}"); + } + let setup = StreamSetup { + name: name.clone(), + bitrate: *bitrate, + audio: streamer.has_audio(), + ..Default::default() + }; let options = StreamerOptions { setup, auto_accept: *auto_accept }; + let source = EncodedSource::new(streamer); start(con, &mut driver, options, source, seconds.map(Duration::from_secs)).await } StreamCommand::List { settle_ms } => { list(con, &mut driver, Duration::from_millis(*settle_ms)).await } - StreamCommand::Watch { id, streamer_nick, expect_frames, timeout } => { + StreamCommand::Watch { id, streamer_nick, expect_frames, timeout, save_frame } => { let target = Target { id: id.clone(), streamer_nick: streamer_nick.clone() }; let timeout = timeout.map(Duration::from_secs); - watch(con, &mut driver, &target, *expect_frames, timeout).await + let expect = *expect_frames; + let save = save_frame.as_deref(); + watch(con, &mut driver, codecs, &target, expect, timeout, save).await } }; driver.finish(con).await; result } -/// Where a streamer's frames come from. Capture and encoders (`tsc-media`) -/// plug in here. -fn frame_source( - synthetic: bool, - fps: u32, - frame_size: usize, - audio: bool, -) -> Result> { - if !synthetic { - bail!("only synthetic frames are available yet: pass --synthetic"); - } - Ok(Box::new(SyntheticSource::new(fps, frame_size, audio))) +/// `synthetic`, `x11[:]`, `screen[:]`, `window:`, `portal`. +fn parse_source(spec: &str) -> Result<(SourceId, CaptureBackend)> { + let (kind, arg) = spec.split_once(':').map_or((spec, None), |(k, a)| (k, Some(a))); + let number = |default: u64| -> Result { + arg.map_or(Ok(default), |a| { + let a = a.trim_start_matches("0x"); + let radix = if a.len() < arg.unwrap_or_default().len() { 16 } else { 10 }; + u64::from_str_radix(a, radix).with_context(|| format!("bad number in {spec:?}")) + }) + }; + Ok(match kind { + "synthetic" => (SourceId::Synthetic, CaptureBackend::Auto), + "portal" => (SourceId::Portal, CaptureBackend::Auto), + "x11" => (SourceId::Monitor(number(0)? as u32), CaptureBackend::X11), + "screen" | "monitor" => (SourceId::Monitor(number(0)? as u32), CaptureBackend::Auto), + "window" if arg.is_some() => (SourceId::Window(number(0)?), CaptureBackend::Auto), + _ => bail!("unknown source {spec:?}: synthetic, x11[:N], screen[:N], window:, portal"), + }) +} + +/// `x`. +fn parse_size(size: &str) -> Result<(u32, u32)> { + let parsed = size.split_once('x').and_then(|(w, h)| Some((w.parse().ok()?, h.parse().ok()?))); + parsed.with_context(|| format!("bad size {size:?}, expected e.g. 1280x720")) } /// What woke the driver. @@ -290,7 +352,7 @@ async fn start( con: &mut Connection, driver: &mut Driver, options: StreamerOptions, - mut source: Box, + mut source: EncodedSource, length: Option, ) -> Result<()> { let auto_accept = options.auto_accept; @@ -357,6 +419,10 @@ async fn start( StreamerEvent::KeyframeRequest => source.request_keyframe(), StreamerEvent::Ended(reason) => { println!("sent {video} video / {audio} audio frames to connected viewers"); + let stats = source.streamer().stats(); + if let Some(e) = &stats.error { + println!("last encoder error: {e}"); + } return match reason { EndReason::Local => Ok(()), other => bail!("stream ended: {}", end_text(&other)), @@ -458,19 +524,86 @@ impl Target { } } +/// Save a picture as an RGBA PNG. +fn save_png(picture: &VideoFrame, path: &Path) -> Result<()> { + let rgba = convert::to_rgba_vec(picture)?; + let file = std::io::BufWriter::new(std::fs::File::create(path)?); + let mut encoder = png::Encoder::new(file, picture.width, picture.height); + encoder.set_color(png::ColorType::Rgba); + encoder.set_depth(png::BitDepth::Eight); + encoder.write_header()?.write_image_data(&rgba)?; + Ok(()) +} + async fn watch( con: &mut Connection, driver: &mut Driver, + codecs: Arc, target: &Target, expect: Option, timeout: Option, + save: Option<&Path>, ) -> Result<()> { let deadline = timeout.map(|t| Instant::now() + t); let mut watching: Option = None; let (mut video, mut audio) = (0u64, 0u64); let mut codec = None; let mut waiting_told = false; + // Decoding runs on its own thread; the loop checks its progress. + let latest = Arc::new(Latest::new()); + let keyframe_wanted = Arc::new(AtomicBool::new(false)); + let decoder = VideoPipeline::new( + codecs, + { + let latest = latest.clone(); + move |picture| { + latest.put(picture); + } + }, + { + let wanted = keyframe_wanted.clone(); + move || wanted.store(true, Ordering::Relaxed) + }, + ); + let mut tick = tokio::time::interval(Duration::from_millis(100)); + let mut first_picture = true; + let mut last_picture: Option = None; + let summary = |video: u64, audio: u64, decoder: &VideoPipeline| { + let stats = decoder.stats(); + println!( + "received {video} video / {audio} audio frames, decoded {} pictures{}", + stats.decoded, + stats.error.map(|e| format!(" (last error: {e})")).unwrap_or_default() + ); + }; + let save_last = |last: &Option| -> Result<()> { + match (save, last) { + (Some(path), Some(picture)) => { + save_png(picture, path)?; + println!("saved {}", path.display()); + Ok(()) + } + (Some(_), None) => bail!("no picture to save"), + (None, _) => Ok(()), + } + }; loop { + if let Some(picture) = latest.take() { + if first_picture { + println!("first picture decoded ({}x{})", picture.width, picture.height); + first_picture = false; + } + last_picture = Some(picture); + } + if let Some(id) = &watching + && keyframe_wanted.swap(false, Ordering::Relaxed) + { + driver.streams.request_keyframe(id); + } + if expect.is_some_and(|n| decoder.stats().decoded >= n) { + summary(video, audio, &decoder); + return save_last(&last_picture); + } if watching.is_none() { if let Some((id, streamer)) = target.find(con, &driver.streams) { println!("watching {id} of {} (clid {})", nick(con, streamer), streamer.0); @@ -497,29 +630,26 @@ async fn watch( if f.kind == MediaKind::Video && codec.replace(f.codec).is_none() { println!("first video frame ({:?}, {} bytes)", f.codec, f.data.len()); } - if expect.is_some_and(|n| video >= n) { - println!("received {video} video / {audio} audio frames"); - return Ok(()); - } + decoder.push(f); } WatchEvent::Ended(reason) => { - println!("received {video} video / {audio} audio frames"); + summary(video, audio, &decoder); match expect { - Some(n) => bail!("{} before {n} video frames arrived", end_text(&reason)), + Some(n) => bail!("{} before {n} pictures were decoded", end_text(&reason)), None => { println!("{}", end_text(&reason)); - return Ok(()); + return save_last(&last_picture.or_else(|| latest.take())); } } } } } - match driver.next(con, deadline, None, None).await? { + match driver.next(con, deadline, Some(&mut tick), None).await? { Wake::Deadline | Wake::Interrupted => { - println!("received {video} video / {audio} audio frames"); + summary(video, audio, &decoder); return match expect { - Some(n) => bail!("timed out waiting for {n} video frames"), - None => Ok(()), + Some(n) => bail!("timed out waiting for {n} decoded pictures"), + None => save_last(&last_picture.or_else(|| latest.take())), }; } _ => {} diff --git a/tools/tsctl/src/tree.rs b/tools/voelinctl/src/tree.rs similarity index 99% rename from tools/tsctl/src/tree.rs rename to tools/voelinctl/src/tree.rs index e29b0b1..ce0df3f 100644 --- a/tools/tsctl/src/tree.rs +++ b/tools/voelinctl/src/tree.rs @@ -3,9 +3,9 @@ use std::collections::HashMap; use std::fmt::Write; -use tsc_model::ServerFlavor; use tsclientlib::data; use tsclientlib::{ChannelId, ClientType}; +use voelin_model::ServerFlavor; /// Minimal channel view, so the ordering logic can be tested without a connection. #[derive(Clone, Debug)] diff --git a/tools/tsctl/src/versions.rs b/tools/voelinctl/src/versions.rs similarity index 94% rename from tools/tsctl/src/versions.rs rename to tools/voelinctl/src/versions.rs index 4590f11..698f628 100644 --- a/tools/tsctl/src/versions.rs +++ b/tools/voelinctl/src/versions.rs @@ -51,7 +51,7 @@ pub fn known_versions() -> Vec { /// Resolve a `--client-version` argument. /// /// Accepts `default` (the library default), an index into [`known_versions`], -/// or `@` with the exact strings from `tsctl versions`. +/// or `@` with the exact strings from `voelinctl versions`. pub fn resolve(spec: &str) -> Result> { if spec == "default" { return Ok(None); @@ -68,7 +68,7 @@ pub fn resolve(spec: &str) -> Result> { }; match versions.iter().find(|v| v.platform == platform && v.version == version) { Some(v) => v.to_version().map(Some), - None => bail!("unknown client version {spec:?}, see `tsctl versions`"), + None => bail!("unknown client version {spec:?}, see `voelinctl versions`"), } } diff --git a/tools/tsctl/src/voice.rs b/tools/voelinctl/src/voice.rs similarity index 95% rename from tools/tsctl/src/voice.rs rename to tools/voelinctl/src/voice.rs index aaa9521..bffb48c 100644 --- a/tools/tsctl/src/voice.rs +++ b/tools/voelinctl/src/voice.rs @@ -1,13 +1,13 @@ -//! `tsctl connect ... voice send|record`. +//! `voelinctl connect ... voice send|record`. use std::time::Duration; use anyhow::{Context, Result, bail}; use tokio::time::Instant; -use tsc_audio::pcm::{self, FRAME_SAMPLES, SAMPLE_RATE}; -use tsc_audio::{Framer, Mixer, VoiceCodec, VoiceEncoder, resample, wav}; use tsclientlib::{ClientId, Connection, StreamItem}; use tsproto_packets::packets::AudioData; +use voelin_audio::pcm::{self, FRAME_SAMPLES, SAMPLE_RATE}; +use voelin_audio::{Framer, Mixer, VoiceCodec, VoiceEncoder, resample, wav}; use crate::VoiceCommand; use crate::session::{Flow, PumpEnd, pump};