Rename the project to Voelin; packages hold only the app, tsgw is a Linux server package
The product is Voelin (app id io.github.faumaray.Voelin), everywhere: - crates tsc-* -> voelin-* (and voelin-fuzz), the desktop binary tsc-desktop -> voelin, the development CLI tsctl -> voelinctl; - the Android app: applicationId, Kotlin package io.github.faumaray.voelin, VoelinApp, libvoelin_android.so (JNI class names follow); - TSC_* environment variables -> VOELIN_*, Gradle properties tsc.* -> voelin.*, signing secrets VOELIN_SIGNING_*; - the data/config/cache/state folder tsc -> voelin, the keyring service, thread names, the dev compose project; - desktop file, metainfo, icon, Flatpak manifest, NSIS installer, docs. The gateway keeps its name: bin tsgw (crate voelin-gateway), TSGW_* env vars, the tsgw.v1+json protocol, the tsgw image. The window title and the About page show "Voelin <version>" from voelin_platform::APP_NAME. Packages (scripts/package.sh): the app only (voelin, voelin.exe, APKs, Flatpak). voelinctl is a development tool and in no package. tsgw is for servers and now its own Linux package, tsgw_<v>_amd64.deb and tsgw-<v>-linux-x86_64.tar.gz, with a sandboxed systemd unit (packaging/linux/tsgw.service; /etc/tsgw config, /var/lib/tsgw state) and dependencies of its own (no GUI libraries). docs/gateway-admin.md has an Install section. Fixes: - package-windows: makensis on Windows found no file through "D:/a/..." paths; pass Windows paths (cygpath -w). - StartupWMClass is the app id, which the app sets as its X11 WM_CLASS (it was the binary name, so desktops could not match the window). - Gradle wrapper download timeout 10 s -> 60 s (slow proxies). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01NJvYyRmTjKcb9i8eyYXK5G
This commit is contained in:
197 files changed
+1357
-1210
No files matched your search
@@ -1,5 +1,5 @@
|
||||
[package]
|
||||
name = "tsc-android"
|
||||
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
|
||||
@@ -9,15 +9,15 @@ repository.workspace = true
|
||||
publish.workspace = true
|
||||
|
||||
[lib]
|
||||
name = "tsc_android"
|
||||
# cdylib: libtsc_android.so, loaded by the app's NativeActivity. rlib: tests
|
||||
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"
|
||||
tsc-core = { path = "../tsc-core" }
|
||||
voelin-core = { path = "../voelin-core" }
|
||||
|
||||
[target.'cfg(target_os = "android")'.dependencies]
|
||||
anyhow = "1.0.104"
|
||||
@@ -25,13 +25,13 @@ 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"] }
|
||||
tsc-media = { path = "../tsc-media", default-features = false }
|
||||
tsc-platform = { path = "../tsc-platform", default-features = false }
|
||||
tsc-store = { path = "../tsc-store" }
|
||||
tsc-ui = { path = "../tsc-ui" }
|
||||
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]
|
||||
tsc-model = { path = "../tsc-model" }
|
||||
voelin-model = { path = "../voelin-model" }
|
||||
|
||||
[lints]
|
||||
workspace = true
|
||||
@@ -10,7 +10,7 @@ use std::sync::{Mutex, Once, OnceLock, PoisonError};
|
||||
use anyhow::Context as _;
|
||||
use slint::android::AndroidApp;
|
||||
use tracing::{error, info, warn};
|
||||
use tsc_core::Command;
|
||||
use voelin_core::Command;
|
||||
|
||||
use crate::foreground::Foreground;
|
||||
use crate::host::EngineHost;
|
||||
@@ -82,10 +82,10 @@ fn run(app: AndroidApp) -> anyhow::Result<()> {
|
||||
|
||||
slint::android::init(app).context("Slint Android backend")?;
|
||||
let attached = host.attach();
|
||||
tsc_ui::run(tsc_ui::RunOptions {
|
||||
voelin_ui::run(voelin_ui::RunOptions {
|
||||
data_dir: Some(data_dir),
|
||||
secrets: Some(Box::new(secrets::KeystoreSecrets)),
|
||||
engine: Some(tsc_ui::HostedEngine {
|
||||
engine: Some(voelin_ui::HostedEngine {
|
||||
engine: attached.engine,
|
||||
runtime: attached.runtime,
|
||||
events: attached.events,
|
||||
@@ -96,12 +96,12 @@ fn run(app: AndroidApp) -> anyhow::Result<()> {
|
||||
/// Local crash reports in `<files dir>/crash-reports`, recorded only if the
|
||||
/// user opted in (off by default).
|
||||
fn install_crash_reports(data_dir: &Path) {
|
||||
tsc_platform::crash::set_app_version(env!("CARGO_PKG_VERSION"));
|
||||
let enabled = tsc_store::Store::open(&data_dir.join("client.db"))
|
||||
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::<bool>(CRASH_REPORTS_SETTING).ok().flatten())
|
||||
.unwrap_or(false);
|
||||
tsc_platform::crash::install(data_dir.join(tsc_platform::crash::DIR_NAME), enabled);
|
||||
voelin_platform::crash::install(data_dir.join(voelin_platform::crash::DIR_NAME), enabled);
|
||||
}
|
||||
|
||||
/// Keep the voice foreground service in step with the voice connections.
|
||||
@@ -1,9 +1,9 @@
|
||||
//! JNI glue with the app's Kotlin side (`android/app/src/main/java/...`).
|
||||
//!
|
||||
//! - Rust → Kotlin: static methods of `io.github.faumaray.tsc.Bridge`, called
|
||||
//! - 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.tsc.Native`,
|
||||
//! - 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).
|
||||
|
||||
@@ -22,7 +22,7 @@ static BRIDGE: OnceLock<Global<JClass<'static>>> = 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.tsc.Bridge"))?;
|
||||
let class = env.load_class(jni_str!("io.github.faumaray.voelin.Bridge"))?;
|
||||
let _ = BRIDGE.set(env.new_global_ref(class)?);
|
||||
}
|
||||
Ok(())
|
||||
@@ -32,7 +32,7 @@ pub fn init(env: &mut Env) -> Result<()> {
|
||||
fn with_bridge<T>(f: impl FnOnce(&mut Env, &Global<JClass<'static>>) -> Result<T>) -> Result<T> {
|
||||
let class = BRIDGE
|
||||
.get()
|
||||
.ok_or_else(|| Error::ClassNotFound { name: "io.github.faumaray.tsc.Bridge".into() })?;
|
||||
.ok_or_else(|| Error::ClassNotFound { name: "io.github.faumaray.voelin.Bridge".into() })?;
|
||||
JavaVM::singleton()?.attach_current_thread(|env| f(env, class))
|
||||
}
|
||||
|
||||
@@ -40,7 +40,7 @@ fn with_bridge<T>(f: impl FnOnce(&mut Env, &Global<JClass<'static>>) -> Result<T
|
||||
pub fn context<'local>(env: &mut Env<'local>) -> Result<JObject<'local>> {
|
||||
let class = BRIDGE
|
||||
.get()
|
||||
.ok_or_else(|| Error::ClassNotFound { name: "io.github.faumaray.tsc.Bridge".into() })?;
|
||||
.ok_or_else(|| Error::ClassNotFound { name: "io.github.faumaray.voelin.Bridge".into() })?;
|
||||
env.call_static_method(
|
||||
class,
|
||||
jni_str!("context"),
|
||||
@@ -160,7 +160,7 @@ pub fn secret_delete(key: &str) -> Result<()> {
|
||||
// Native methods of `Native` (Kotlin `object` with `@JvmStatic external`).
|
||||
|
||||
const _: jni::NativeMethod = native_method! {
|
||||
java_type = "io.github.faumaray.tsc.Native",
|
||||
java_type = "io.github.faumaray.voelin.Native",
|
||||
static extern fn on_screen_capture_result(granted: jboolean, error: JString),
|
||||
};
|
||||
|
||||
@@ -176,7 +176,7 @@ fn on_screen_capture_result<'local>(
|
||||
}
|
||||
|
||||
const _: jni::NativeMethod = native_method! {
|
||||
java_type = "io.github.faumaray.tsc.Native",
|
||||
java_type = "io.github.faumaray.voelin.Native",
|
||||
static extern fn on_screen_frame(
|
||||
pixels: JByteBuffer,
|
||||
width: jint,
|
||||
@@ -219,7 +219,7 @@ fn on_screen_frame<'local>(
|
||||
}
|
||||
|
||||
const _: jni::NativeMethod = native_method! {
|
||||
java_type = "io.github.faumaray.tsc.Native",
|
||||
java_type = "io.github.faumaray.voelin.Native",
|
||||
static extern fn on_screen_capture_stopped(),
|
||||
};
|
||||
|
||||
@@ -229,7 +229,7 @@ fn on_screen_capture_stopped<'local>(_env: &mut Env<'local>, _class: JClass<'loc
|
||||
}
|
||||
|
||||
const _: jni::NativeMethod = native_method! {
|
||||
java_type = "io.github.faumaray.tsc.Native",
|
||||
java_type = "io.github.faumaray.voelin.Native",
|
||||
static extern fn on_system_audio(samples: jfloat[], count: jint, channels: jint, timestamp_ns: jlong) -> jboolean,
|
||||
};
|
||||
|
||||
@@ -251,7 +251,7 @@ fn on_system_audio<'local>(
|
||||
}
|
||||
|
||||
const _: jni::NativeMethod = native_method! {
|
||||
java_type = "io.github.faumaray.tsc.Native",
|
||||
java_type = "io.github.faumaray.voelin.Native",
|
||||
static extern fn on_disconnect_voice(),
|
||||
};
|
||||
|
||||
@@ -262,7 +262,7 @@ fn on_disconnect_voice<'local>(_env: &mut Env<'local>, _class: JClass<'local>) -
|
||||
}
|
||||
|
||||
const _: jni::NativeMethod = native_method! {
|
||||
java_type = "io.github.faumaray.tsc.Native",
|
||||
java_type = "io.github.faumaray.voelin.Native",
|
||||
static extern fn on_toggle_mute(),
|
||||
};
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
//! Screen and system-audio capture through MediaProjection.
|
||||
//!
|
||||
//! Registered as `tsc_media` capture providers, so stream code captures with
|
||||
//! `tsc_media::capture::default_screen_capture()` as on desktop. Starting
|
||||
//! 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
|
||||
@@ -12,9 +12,9 @@ use std::time::Duration;
|
||||
|
||||
use tokio::sync::oneshot;
|
||||
use tracing::warn;
|
||||
use tsc_media::capture::external::{self, AudioProvider, ScreenProvider};
|
||||
use tsc_media::capture::{BoxFuture, CaptureOptions, CaptureSource, SourceId};
|
||||
use tsc_media::{AudioBuffer, Error, FrameSender, Result, VideoFrame};
|
||||
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;
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
|
||||
use std::collections::BTreeMap;
|
||||
|
||||
use tsc_core::{Event, SessionId, VoiceState};
|
||||
use voelin_core::{Event, SessionId, VoiceState};
|
||||
|
||||
/// What the voice notification shows.
|
||||
#[derive(Clone, Debug, PartialEq, Eq)]
|
||||
@@ -78,8 +78,8 @@ impl Foreground {
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use tsc_core::SessionState;
|
||||
use tsc_model::{Capabilities, ServerFlavor};
|
||||
use voelin_core::SessionState;
|
||||
use voelin_model::{Capabilities, ServerFlavor};
|
||||
|
||||
use super::*;
|
||||
|
||||
@@ -11,7 +11,7 @@ use std::sync::{Arc, Mutex, MutexGuard, PoisonError};
|
||||
|
||||
use tokio::runtime::{Handle, Runtime};
|
||||
use tokio::sync::{broadcast, mpsc};
|
||||
use tsc_core::{Engine, Event, SessionId, StreamState, WatchState};
|
||||
use voelin_core::{Engine, Event, SessionId, StreamState, WatchState};
|
||||
|
||||
/// Chat messages per session a new window gets back.
|
||||
pub const CHAT_BACKLOG: usize = 300;
|
||||
@@ -162,7 +162,7 @@ pub struct EngineHost {
|
||||
fanout: Fanout,
|
||||
}
|
||||
|
||||
/// What a window needs: see `tsc_ui::HostedEngine`.
|
||||
/// What a window needs: see `voelin_ui::HostedEngine`.
|
||||
pub struct Attached {
|
||||
pub engine: Engine,
|
||||
pub runtime: Handle,
|
||||
@@ -173,7 +173,7 @@ impl EngineHost {
|
||||
pub fn start() -> std::io::Result<Self> {
|
||||
let runtime = tokio::runtime::Builder::new_multi_thread()
|
||||
.enable_all()
|
||||
.thread_name("tsc-engine")
|
||||
.thread_name("voelin-engine")
|
||||
.build()?;
|
||||
let engine = runtime.block_on(async { Engine::start() });
|
||||
let fanout = Fanout::default();
|
||||
@@ -203,8 +203,8 @@ impl EngineHost {
|
||||
mod tests {
|
||||
use std::sync::Arc as StdArc;
|
||||
|
||||
use tsc_core::{SessionState, VoiceState};
|
||||
use tsc_model::{ChatMessage, ChatTarget, Presence};
|
||||
use voelin_core::{SessionState, VoiceState};
|
||||
use voelin_model::{ChatMessage, ChatTarget, Presence};
|
||||
|
||||
use super::*;
|
||||
|
||||
@@ -266,7 +266,7 @@ mod tests {
|
||||
replay.record(&Event::WatchState {
|
||||
session: 2,
|
||||
stream_id: "s2".into(),
|
||||
state: WatchState::Ended(tsc_core::stream::EndReason::Local),
|
||||
state: WatchState::Ended(voelin_core::stream::EndReason::Local),
|
||||
});
|
||||
|
||||
let events = describe(&replay.events());
|
||||
@@ -1,7 +1,7 @@
|
||||
//! The Android app's native library (`libtsc_android.so`).
|
||||
//! 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 (`tsc_ui`) on
|
||||
//! 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
|
||||
@@ -12,7 +12,7 @@
|
||||
//! - `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 `tsc_media` capture providers
|
||||
//! MediaProjection, registered as `voelin_media` capture providers
|
||||
//! - `secrets` (Android): passwords encrypted with an Android Keystore key
|
||||
//!
|
||||
//! Only [`host`] and [`foreground`] build on other platforms, for tests.
|
||||
@@ -4,7 +4,7 @@
|
||||
//! lives in the Android Keystore (hardware-backed where the device has it)
|
||||
//! and keeps the ciphertext in the app's private preferences.
|
||||
|
||||
use tsc_store::{Error, Result, Secrets};
|
||||
use voelin_store::{Error, Result, Secrets};
|
||||
|
||||
use crate::bridge;
|
||||
|
||||
@@ -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
|
||||
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
@@ -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};
|
||||
File renamed without changes.
@@ -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();
|
||||
@@ -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;
|
||||
@@ -1,5 +1,5 @@
|
||||
[package]
|
||||
name = "tsc-core"
|
||||
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
|
||||
@@ -11,15 +11,15 @@ publish.workspace = true
|
||||
[features]
|
||||
default = ["audio-device"]
|
||||
# Capture and play audio through the system's devices.
|
||||
audio-device = ["tsc-audio/device"]
|
||||
audio-device = ["voelin-audio/device"]
|
||||
# The `media` module: capture and video codecs for streams, with whatever
|
||||
# tsc-media backends are enabled (e.g. MediaCodec and a registered capture
|
||||
# voelin-media backends are enabled (e.g. MediaCodec and a registered capture
|
||||
# source on Android).
|
||||
media = ["dep:tsc-media"]
|
||||
# `media` with tsc-media's desktop backends: libvpx, OpenH264 loaded at
|
||||
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", "tsc-media/default"]
|
||||
media-desktop = ["media", "voelin-media/default"]
|
||||
|
||||
[dependencies]
|
||||
anyhow = "1"
|
||||
@@ -29,13 +29,13 @@ 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-media = { path = "../tsc-media", default-features = false, features = ["str0m"], optional = true }
|
||||
tsc-model = { path = "../tsc-model" }
|
||||
tsc-observer = { path = "../tsc-observer" }
|
||||
tsc-query = { path = "../tsc-query" }
|
||||
tsc-stream = { path = "../tsc-stream" }
|
||||
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" }
|
||||
|
||||
@@ -16,12 +16,12 @@ 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::vad::SILENCE_DB;
|
||||
use tsc_audio::{AudioSettings, Framer, Mixer, Processor, Vad, VoiceCodec, VoiceEncoder};
|
||||
use tsclientlib::ClientId;
|
||||
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),
|
||||
@@ -113,7 +113,7 @@ pub(crate) fn spawn(
|
||||
) -> AudioHandle {
|
||||
let (tx, rx) = std_mpsc::channel();
|
||||
thread::Builder::new()
|
||||
.name("tsc-audio".into())
|
||||
.name("voelin-audio".into())
|
||||
.spawn(move || run(rx, outgoing, events, settings))
|
||||
.expect("spawn audio thread");
|
||||
AudioHandle { tx }
|
||||
@@ -151,7 +151,7 @@ struct Pipeline {
|
||||
}
|
||||
|
||||
impl Pipeline {
|
||||
fn new(settings: AudioSettings) -> tsc_audio::Result<Self> {
|
||||
fn new(settings: AudioSettings) -> voelin_audio::Result<Self> {
|
||||
let settings = sanitize(settings);
|
||||
Ok(Self {
|
||||
encoder: VoiceEncoder::new(VoiceCodec::Voice)?,
|
||||
@@ -420,11 +420,11 @@ fn run(
|
||||
#[cfg(feature = "audio-device")]
|
||||
mod devices {
|
||||
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};
|
||||
|
||||
@@ -531,8 +531,8 @@ mod devices {
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use tsc_audio::pcm::{SAMPLE_RATE, energy, sine, white_noise};
|
||||
use tsc_audio::{ProcessingSettings, VadSettings};
|
||||
use voelin_audio::pcm::{SAMPLE_RATE, energy, sine, white_noise};
|
||||
use voelin_audio::{ProcessingSettings, VadSettings};
|
||||
|
||||
use super::*;
|
||||
|
||||
@@ -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<GatewayEvent>,
|
||||
) -> 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}");
|
||||
}
|
||||
@@ -32,14 +32,14 @@ use std::collections::HashMap;
|
||||
use std::sync::Arc;
|
||||
|
||||
use tokio::sync::{broadcast, mpsc};
|
||||
pub use tsc_audio::settings::TransmitMode;
|
||||
pub use tsc_audio::{AudioSettings, ProcessingSettings, VadSettings};
|
||||
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;
|
||||
@@ -63,7 +63,7 @@ pub enum Command {
|
||||
/// Invisible presence and relay chat with own ServerQuery credentials.
|
||||
ObserveQuery {
|
||||
session: SessionId,
|
||||
connect: Box<tsc_query::Connect>,
|
||||
connect: Box<voelin_query::Connect>,
|
||||
},
|
||||
StopObserving {
|
||||
session: SessionId,
|
||||
@@ -6,7 +6,7 @@
|
||||
//! 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 `tsc_stream::Streams` itself. Keyframe requests of viewers
|
||||
//! 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
|
||||
@@ -17,8 +17,8 @@
|
||||
//! - [`Latest`] hands the newest picture to a slower consumer such as a UI.
|
||||
//! - [`LocalPreview`] runs capture → encoder → decoder without a server.
|
||||
//!
|
||||
//! [`tsc_media`] is re-exported for sources, codecs and pixel conversion.
|
||||
//! Codecs are chosen through `tsc_media::Codecs`, so whatever backends the
|
||||
//! [`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).
|
||||
|
||||
@@ -30,16 +30,16 @@ use std::thread::JoinHandle;
|
||||
use std::time::{Duration, Instant};
|
||||
|
||||
use tracing::{debug, warn};
|
||||
use tsc_audio::{VoiceCodec, VoiceEncoder};
|
||||
pub use tsc_media;
|
||||
use tsc_media::capture::synthetic::{SineSource, SyntheticScreen};
|
||||
use tsc_media::capture::{
|
||||
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 tsc_media::{
|
||||
use voelin_media::{
|
||||
AudioBuffer, Codec, Codecs, ContentHint, EncoderConfig, FrameReceiver, VideoEncoder, VideoFrame,
|
||||
};
|
||||
use tsc_stream::{
|
||||
use voelin_stream::{
|
||||
EncodedFrame, FrameSource, Frequency, MediaFrame, MediaKind, MediaTime, PeerConfig, VideoCodec,
|
||||
};
|
||||
|
||||
@@ -60,9 +60,9 @@ const KEYFRAME_RETRY: Duration = Duration::from_millis(500);
|
||||
#[derive(Debug, thiserror::Error)]
|
||||
pub enum MediaError {
|
||||
#[error(transparent)]
|
||||
Media(#[from] tsc_media::Error),
|
||||
Media(#[from] voelin_media::Error),
|
||||
#[error("Opus: {0}")]
|
||||
Opus(#[from] tsc_audio::Error),
|
||||
Opus(#[from] voelin_audio::Error),
|
||||
}
|
||||
|
||||
fn lock<T>(m: &Mutex<T>) -> MutexGuard<'_, T> {
|
||||
@@ -76,7 +76,7 @@ fn spawn(name: &str, f: impl FnOnce() + Send + 'static) -> Result<JoinHandle<()>
|
||||
.map_err(|e| MediaError::Media(e.into()))
|
||||
}
|
||||
|
||||
/// The `tsc_media` codec of a negotiated video codec.
|
||||
/// The `voelin_media` codec of a negotiated video codec.
|
||||
pub fn media_codec(codec: VideoCodec) -> Codec {
|
||||
match codec {
|
||||
VideoCodec::Vp8 => Codec::Vp8,
|
||||
@@ -86,7 +86,7 @@ pub fn media_codec(codec: VideoCodec) -> Codec {
|
||||
}
|
||||
}
|
||||
|
||||
/// The negotiable video codec of a `tsc_media` codec.
|
||||
/// The negotiable video codec of a `voelin_media` codec.
|
||||
pub fn video_codec(codec: Codec) -> VideoCodec {
|
||||
match codec {
|
||||
Codec::Vp8 => VideoCodec::Vp8,
|
||||
@@ -275,7 +275,7 @@ impl Streamer {
|
||||
}
|
||||
#[cfg(all(target_os = "linux", feature = "media-desktop"))]
|
||||
SourceId::Portal => {
|
||||
use tsc_media::capture::portal::PortalCapture;
|
||||
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);
|
||||
@@ -285,10 +285,10 @@ impl Streamer {
|
||||
let mut screen = match config.backend {
|
||||
CaptureBackend::Auto => capture::default_screen_capture()?,
|
||||
#[cfg(all(target_os = "linux", feature = "media-desktop"))]
|
||||
CaptureBackend::X11 => Box::new(tsc_media::capture::x11::X11Capture::new()),
|
||||
CaptureBackend::X11 => Box::new(voelin_media::capture::x11::X11Capture::new()),
|
||||
#[cfg(not(all(target_os = "linux", feature = "media-desktop")))]
|
||||
CaptureBackend::X11 => {
|
||||
return Err(tsc_media::Error::CaptureUnavailable {
|
||||
return Err(voelin_media::Error::CaptureUnavailable {
|
||||
backend: "x11",
|
||||
reason: "X11 capture is only in Linux desktop builds".into(),
|
||||
}
|
||||
@@ -311,7 +311,7 @@ impl Streamer {
|
||||
restore_token,
|
||||
audio_error: None,
|
||||
};
|
||||
streamer.threads.push(spawn("tsc-stream-video", {
|
||||
streamer.threads.push(spawn("voelin-stream-video", {
|
||||
let shared = shared.clone();
|
||||
move || video_loop(&shared, frames, encoder)
|
||||
})?);
|
||||
@@ -319,7 +319,7 @@ impl Streamer {
|
||||
match start_audio(&config.source) {
|
||||
Ok((capture, buffers, encoder)) => {
|
||||
streamer.audio = Some(capture);
|
||||
streamer.threads.push(spawn("tsc-stream-audio", move || {
|
||||
streamer.threads.push(spawn("voelin-stream-audio", move || {
|
||||
audio_loop(&shared, buffers, encoder)
|
||||
})?);
|
||||
}
|
||||
@@ -528,7 +528,7 @@ impl MediaSink for ChannelSink {
|
||||
}
|
||||
|
||||
/// A [`Streamer`] as a [`FrameSource`], for code that runs
|
||||
/// `tsc_stream::Streams` itself (e.g. tsctl).
|
||||
/// `voelin_stream::Streams` itself (e.g. voelinctl).
|
||||
pub struct EncodedSource {
|
||||
streamer: Streamer,
|
||||
frames: std_mpsc::Receiver<EncodedFrame>,
|
||||
@@ -701,7 +701,7 @@ impl VideoPipeline {
|
||||
) -> Self {
|
||||
let queue = Arc::new(DecodeQueue::default());
|
||||
let thread = std::thread::Builder::new()
|
||||
.name("tsc-stream-decode".into())
|
||||
.name("voelin-stream-decode".into())
|
||||
.spawn({
|
||||
let queue = queue.clone();
|
||||
move || decode_loop(&queue, &codecs, on_frame, request_keyframe)
|
||||
@@ -741,7 +741,7 @@ fn decode_loop(
|
||||
mut on_frame: impl FnMut(VideoFrame),
|
||||
request_keyframe: impl Fn(),
|
||||
) {
|
||||
let mut decoder: Option<(Codec, Box<dyn tsc_media::VideoDecoder>)> = None;
|
||||
let mut decoder: Option<(Codec, Box<dyn voelin_media::VideoDecoder>)> = None;
|
||||
// Start at a keyframe; the streamer sends one when a viewer connects.
|
||||
let mut waiting = true;
|
||||
let mut last_request: Option<Instant> = None;
|
||||
@@ -909,7 +909,7 @@ impl<T> Latest<T> {
|
||||
/// Feeds a [`Streamer`]'s video straight into a [`VideoPipeline`].
|
||||
struct PipelineSink {
|
||||
input: FrameInput,
|
||||
codec: tsc_stream::Codec,
|
||||
codec: voelin_stream::Codec,
|
||||
keyframe: Arc<AtomicBool>,
|
||||
}
|
||||
|
||||
@@ -932,7 +932,7 @@ impl MediaSink for PipelineSink {
|
||||
}
|
||||
|
||||
/// Capture → encoder → decoder without a server, e.g. to preview a share or
|
||||
/// to develop the viewer (`TSC_DEMO_STREAM` in the desktop app).
|
||||
/// to develop the viewer (`VOELIN_DEMO_STREAM` in the desktop app).
|
||||
pub struct LocalPreview {
|
||||
// Dropped first: no more frames into the pipeline.
|
||||
streamer: Streamer,
|
||||
@@ -974,9 +974,9 @@ impl LocalPreview {
|
||||
/// the background.
|
||||
#[cfg(all(test, feature = "media-desktop"))]
|
||||
pub(crate) fn rectangle_span(picture: &VideoFrame) -> (u32, u32) {
|
||||
use tsc_media::capture::synthetic::{BACKGROUND, RECT_COLOR};
|
||||
use voelin_media::capture::synthetic::{BACKGROUND, RECT_COLOR};
|
||||
|
||||
let rgba = tsc_media::convert::to_rgba_vec(picture).unwrap();
|
||||
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;
|
||||
@@ -1001,8 +1001,8 @@ mod tests {
|
||||
|
||||
#[test]
|
||||
fn keyframe_detection() {
|
||||
// VP8: the 1x1 keyframe of tsc-stream's synthetic source.
|
||||
assert!(is_keyframe(Codec::Vp8, &tsc_stream::source::VP8_KEYFRAME_1X1));
|
||||
// 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]));
|
||||
@@ -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<QueryCmd>,
|
||||
events: mpsc::UnboundedSender<QueryEvent>,
|
||||
) {
|
||||
@@ -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()));
|
||||
@@ -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)]
|
||||
@@ -5,9 +5,9 @@ use std::sync::Arc;
|
||||
|
||||
use tokio::sync::{broadcast, mpsc};
|
||||
use tracing::debug;
|
||||
use tsc_audio::AudioSettings;
|
||||
use tsc_model::{ChatMessage, ChatTarget, Presence};
|
||||
use tsclientlib::ClientId;
|
||||
use voelin_audio::AudioSettings;
|
||||
use voelin_model::{ChatMessage, ChatTarget, Presence};
|
||||
|
||||
use crate::audio::{self, AudioEvent, AudioHandle, AudioIn};
|
||||
use crate::gateway::{self, GatewayCmd, GatewayEvent};
|
||||
@@ -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,16 +11,16 @@ 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;
|
||||
@@ -355,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::*;
|
||||
|
||||
@@ -592,8 +592,8 @@ mod tests {
|
||||
async fn test_pattern_through_stream_tasks() {
|
||||
use std::sync::mpsc as std_mpsc;
|
||||
|
||||
use tsc_media::capture::SourceId;
|
||||
use tsc_media::{Codec, Codecs};
|
||||
use voelin_media::capture::SourceId;
|
||||
use voelin_media::{Codec, Codecs};
|
||||
|
||||
use crate::media::{Streamer, StreamerConfig, VideoPipeline, rectangle_span};
|
||||
|
||||
@@ -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 {
|
||||
@@ -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;
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
//! 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 `TSC_LIVE=1`.
|
||||
//! (VP8 + Opus), another decodes it. Runs only with `VOELIN_LIVE=1`.
|
||||
|
||||
#![cfg(feature = "media-desktop")]
|
||||
|
||||
@@ -10,15 +10,15 @@ use std::time::Duration;
|
||||
|
||||
use tokio::sync::broadcast::Receiver;
|
||||
use tokio::time::timeout;
|
||||
use tsc_core::media::tsc_media::capture::SourceId;
|
||||
use tsc_core::media::tsc_media::capture::synthetic::RECT_COLOR;
|
||||
use tsc_core::media::tsc_media::{Codec, Codecs, convert};
|
||||
use tsc_core::media::{Streamer, StreamerConfig, Viewer, peer_config, stream_codec};
|
||||
use tsc_core::stream::{PeerConfig, StreamSetup};
|
||||
use tsc_core::{Command, Engine, Event, StreamState, VoiceOptions, VoiceState, WatchState};
|
||||
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("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.
|
||||
@@ -73,7 +73,7 @@ async fn connect(
|
||||
#[tokio::test(flavor = "multi_thread")]
|
||||
async fn ts6_test_pattern_decoded() {
|
||||
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();
|
||||
@@ -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();
|
||||
@@ -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]
|
||||
File renamed without changes.
File renamed without changes.
+1
-1
@@ -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":{...}}`.
|
||||
///
|
||||
@@ -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
|
||||
@@ -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
|
||||
@@ -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()
|
||||
},
|
||||
@@ -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<Connection>);
|
||||
|
||||
@@ -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<tsc_query::Error> for Denied {
|
||||
fn from(e: tsc_query::Error) -> Self {
|
||||
impl From<voelin_query::Error> 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),
|
||||
@@ -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<Arc<Hub>>, upgrade: WebSocketUpgrade) -> impl IntoResponse {
|
||||
upgrade
|
||||
.protocols([tsc_gateway_proto::SUBPROTOCOL])
|
||||
.protocols([voelin_gateway_proto::SUBPROTOCOL])
|
||||
.on_upgrade(move |socket| session::run(hub, socket))
|
||||
}
|
||||
|
||||
@@ -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<Self> {
|
||||
pub async fn load(client: &QueryClient) -> voelin_query::Result<Self> {
|
||||
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<Vec<Entry>> {
|
||||
) -> voelin_query::Result<Vec<Entry>> {
|
||||
if let Some((at, entries)) = self.cache.lock().unwrap().get(&(cldbid, cid))
|
||||
&& at.elapsed() < CACHE_TTL
|
||||
{
|
||||
@@ -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<Hub>, mut socket: WebSocket) {
|
||||
}
|
||||
|
||||
async fn send(socket: &mut WebSocket, id: Option<u64>, 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
|
||||
}
|
||||
File renamed without changes.
@@ -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
|
||||
File renamed without changes.
File renamed without changes.
+2
-2
@@ -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 })?;
|
||||
@@ -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,
|
||||
File renamed without changes.
+2
-2
@@ -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) {
|
||||
+1
-1
@@ -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()));
|
||||
@@ -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<Segment> {
|
||||
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)?;
|
||||
File renamed without changes.
File renamed without changes.
@@ -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();
|
||||
File renamed without changes.
File renamed without changes.
+1
-1
@@ -8,7 +8,7 @@
|
||||
//! VP9 and H.264 (`c2.android.*`).
|
||||
//!
|
||||
//! H.264 is encoded as High profile without B-frames (the Constrained High
|
||||
//! stream TeamSpeak negotiates, see `tsc-stream`), SPS/PPS in front of every
|
||||
//! 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
|
||||
@@ -162,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<u8>,
|
||||
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
@@ -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`].
|
||||
|
||||
File renamed without changes.
+2
-2
@@ -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,
|
||||
};
|
||||
@@ -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();
|
||||
@@ -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;
|
||||
@@ -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
|
||||
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
@@ -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"] }
|
||||
@@ -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<ChatMessage> {
|
||||
|
||||
#[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",
|
||||
@@ -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.
|
||||
//!
|
||||
@@ -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<Presence> {
|
||||
async fn load(client: &QueryClient) -> voelin_query::Result<Presence> {
|
||||
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<Presence>,
|
||||
events: &broadcast::Sender<ObserverEvent>,
|
||||
) -> tsc_query::Result<()> {
|
||||
) -> voelin_query::Result<()> {
|
||||
let (client, mut notifications) = QueryClient::connect(&config.connect).await?;
|
||||
if notifications.is_some() {
|
||||
for event in ["server", "channel"] {
|
||||
@@ -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;
|
||||
@@ -1,5 +1,5 @@
|
||||
[package]
|
||||
name = "tsc-platform"
|
||||
name = "voelin-platform"
|
||||
version = "0.1.0"
|
||||
description = "Desktop integration: global push-to-talk hotkeys, notifications, app directories, crash reports and third-party notices."
|
||||
edition.workspace = true
|
||||
@@ -12,10 +12,10 @@
|
||||
//! includes (e.g. a server address); they stay on the device.
|
||||
//!
|
||||
//! ```no_run
|
||||
//! let dir = tsc_platform::crash::default_dir();
|
||||
//! tsc_platform::crash::set_app_version(env!("CARGO_PKG_VERSION"));
|
||||
//! tsc_platform::crash::install(&dir, true); // the user's opt-in setting
|
||||
//! for report in tsc_platform::crash::pending_reports()? {
|
||||
//! 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>(())
|
||||
@@ -41,8 +41,8 @@ pub const DEFAULT_KEEP: usize = 10;
|
||||
const PREFIX: &str = "crash-";
|
||||
const SUFFIX: &str = ".txt";
|
||||
|
||||
/// `<state dir>/crash-reports` (`%LOCALAPPDATA%\tsc\crash-reports` on
|
||||
/// Windows, `~/.local/state/tsc/crash-reports` on Linux).
|
||||
/// `<state dir>/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)
|
||||
}
|
||||
@@ -101,12 +101,12 @@ pub fn install(dir: impl Into<PathBuf>, enabled: bool) {
|
||||
});
|
||||
}
|
||||
|
||||
/// Panic if the `TSC_TEST_CRASH` environment variable is set, so testers can
|
||||
/// 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("TSC_TEST_CRASH").is_some_and(|v| !v.is_empty()) {
|
||||
panic!("test crash requested with TSC_TEST_CRASH");
|
||||
if std::env::var_os("VOELIN_TEST_CRASH").is_some_and(|v| !v.is_empty()) {
|
||||
panic!("test crash requested with VOELIN_TEST_CRASH");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -449,7 +449,7 @@ mod tests {
|
||||
|
||||
#[test]
|
||||
fn missing_dir_has_no_reports() {
|
||||
let dir = std::env::temp_dir().join(format!("tsc-crash-missing-{}", std::process::id()));
|
||||
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);
|
||||
}
|
||||
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
+1
-1
@@ -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}")))?;
|
||||
}
|
||||
@@ -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}")))?;
|
||||
}
|
||||
@@ -17,11 +17,11 @@ 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 {
|
||||
@@ -13,7 +13,7 @@ pub fn text() -> &'static str {
|
||||
}
|
||||
|
||||
/// Attribution the OpenH264 license asks for wherever H.264 can be enabled
|
||||
/// (the same text as `tsc_media::codec::h264::OPENH264_ATTRIBUTION`).
|
||||
/// (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)]
|
||||
File renamed without changes.
@@ -1,6 +1,6 @@
|
||||
//! Where the app keeps its files.
|
||||
//!
|
||||
//! `<base>/tsc` for the platform's data, config, cache and state bases (XDG
|
||||
//! `<base>/voelin` for the platform's data, config, cache and state bases (XDG
|
||||
//! on Linux, where Flatpak points them into `~/.var/app/<app id>/`; 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
|
||||
/// `<data>/tsc`.
|
||||
pub const APP_DIR: &str = "tsc";
|
||||
/// `<data>/voelin`.
|
||||
pub const APP_DIR: &str = "voelin";
|
||||
|
||||
fn resolve(var: &str, base: Option<PathBuf>) -> PathBuf {
|
||||
match std::env::var_os(var).filter(|v| !v.is_empty()) {
|
||||
@@ -19,24 +19,24 @@ fn resolve(var: &str, base: Option<PathBuf>) -> 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();
|
||||
@@ -4,10 +4,10 @@
|
||||
use std::path::PathBuf;
|
||||
use std::thread;
|
||||
|
||||
use tsc_platform::crash;
|
||||
use voelin_platform::crash;
|
||||
|
||||
fn temp_dir(name: &str) -> PathBuf {
|
||||
let dir = std::env::temp_dir().join(format!("tsc-crash-{name}-{}", std::process::id()));
|
||||
let dir = std::env::temp_dir().join(format!("voelin-crash-{name}-{}", std::process::id()));
|
||||
let _ = std::fs::remove_dir_all(&dir);
|
||||
dir
|
||||
}
|
||||
@@ -85,14 +85,14 @@ fn panic_hook_writes_reports() {
|
||||
}
|
||||
|
||||
/// Runs only as the child of `test_crash_in_child_process`: a start with
|
||||
/// `TSC_TEST_CRASH` set, as a tester would do with the app.
|
||||
/// `VOELIN_TEST_CRASH` set, as a tester would do with the app.
|
||||
#[test]
|
||||
fn child_process_crash() {
|
||||
let Some(dir) = std::env::var_os("TSC_CRASH_CHILD_DIR") else { return };
|
||||
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!("TSC_TEST_CRASH is set");
|
||||
unreachable!("VOELIN_TEST_CRASH is set");
|
||||
}
|
||||
|
||||
#[test]
|
||||
@@ -101,8 +101,8 @@ fn test_crash_in_child_process() {
|
||||
// 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("TSC_CRASH_CHILD_DIR", &dir)
|
||||
.env("TSC_TEST_CRASH", "1")
|
||||
.env("VOELIN_CRASH_CHILD_DIR", &dir)
|
||||
.env("VOELIN_TEST_CRASH", "1")
|
||||
.output()
|
||||
.unwrap();
|
||||
let log = String::from_utf8_lossy(&output.stderr);
|
||||
@@ -110,7 +110,7 @@ fn test_crash_in_child_process() {
|
||||
// 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 TSC_TEST_CRASH");
|
||||
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();
|
||||
@@ -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();
|
||||
@@ -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
|
||||
File renamed without changes.
@@ -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");
|
||||
/// ```
|
||||
Loaded 100 of 197 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user