From ea180fdc3997c501e9f473aeb97949b66f9bed0b Mon Sep 17 00:00:00 2001 From: BlueJayLouche Date: Thu, 26 Nov 2026 09:08:20 +1100 Subject: [PATCH 1/6] =?UTF-8?q?feat(ndi):=20grafton-ndi=203.0=20=E2=80=94?= =?UTF-8?q?=20runtime=20loaded=20at=20run=20time,=20no=20SDK=20to=20build?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit grafton-ndi 3 dlopens the NDI 6 runtime instead of linking the SDK at build time. It searches next to the executable, then NDI_RUNTIME_DIR_V6, then the platform loader path (@rpath on macOS, which our build scripts already point at the SDK). Release bundles already put the library in those places, so packaging is unchanged. - Receiver: find_source_by_name in 500 ms steps (stop stays responsive); rows() replaces our stride-guessing strip_stride, which is deleted. allow_video_fields(false) keeps 0.11's whole-frame default. - Sender: BorrowedVideoFrame sends straight from our buffer; the persistent NDI frame and its per-frame copy are gone. - list_ndi_sources: find_sources keeps everything seen in the window. - New loopback test: our sender to our receiver through the real runtime, asserting tight rows at a width macOS pads. Skips without a runtime. - CI now clippies --features ndi (no SDK needed any more). - Docs: ndi is opt-in (README/guide said "default on"); runtime, not SDK. Co-Authored-By: Claude Opus 5.5 --- .github/workflows/ci.yml | 6 +- Cargo.lock | 111 +++++++++-- README.md | 2 +- crates/rustjay-core/Cargo.toml | 2 +- crates/rustjay-engine/Cargo.toml | 2 +- crates/rustjay-io/Cargo.toml | 4 +- crates/rustjay-io/src/input/ndi.rs | 206 +++++---------------- crates/rustjay-io/src/output/ndi_output.rs | 107 ++++++----- guide/src/installation.md | 11 +- guide/src/reference.md | 2 +- guide/src/video-io.md | 2 +- 11 files changed, 212 insertions(+), 243 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 15b9d33c..c7cb8bf2 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -29,8 +29,7 @@ jobs: CFLAGS: -std=gnu17 steps: - uses: actions/checkout@v6 - # NDI is intentionally opt-in (it needs a proprietary SDK), so CI builds the - # default feature set (webcam, no ndi). These deps cover alsa (cpal) and the + # These deps cover alsa (cpal) and the # v4l/udev webcam path (nokhwa). mesa-vulkan-drivers gives wgpu a software # (lavapipe) adapter so rustjay-projection's GPU tests run on the headless runner. - name: Install system dependencies @@ -45,6 +44,9 @@ jobs: # The Linux-only GLES2/EGL path (Raspberry Pi) is off by default, so the # workspace run never compiles it; it once shipped a syntax error unnoticed. - run: cargo clippy -p rustjay-engine --lib --features gles2 -- -D warnings + # NDI is opt-in too. grafton-ndi 3 loads the runtime at run time, so it + # builds without the SDK (its tests skip when no runtime is installed). + - run: cargo clippy -p rustjay-engine --all-targets --features ndi -- -D warnings - run: cargo test --workspace # The kittest UI suites hide behind off-by-default features, so the # workspace run above never executes them: rustjay-gui's tests need `egui`. diff --git a/Cargo.lock b/Cargo.lock index 4a1266f4..507e82a9 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2421,16 +2421,15 @@ dependencies = [ [[package]] name = "grafton-ndi" -version = "0.11.0" +version = "3.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "83fc4d5740ce73851ed15845aba8e26088bfc70f51c62ad00b883c20c09cc773" +checksum = "64d39f75651c04f7e9610b4a6780505287f2153860ca1d172e6b0f741955d295" dependencies = [ - "bindgen 0.72.1", - "lodepng", - "num_enum", - "once_cell", - "png", + "libc", + "libloading 0.9.1", + "parking_lot", "thiserror 2.0.21", + "windows-sys 0.60.2", ] [[package]] @@ -3274,6 +3273,16 @@ dependencies = [ "windows-link", ] +[[package]] +name = "libloading" +version = "0.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a1832accd5a4ca2795ace4d05d15c4039be15b62d3b950eff99746a990e3cc10" +dependencies = [ + "cfg-if 1.0.5", + "windows-link", +] + [[package]] name = "libm" version = "0.2.16" @@ -3358,18 +3367,6 @@ dependencies = [ "scopeguard", ] -[[package]] -name = "lodepng" -version = "3.12.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fe7982db11054edc023a1b424dddcc65be18f71fa46ec6bde2efcfc1fb6b22da" -dependencies = [ - "crc32fast", - "flate2", - "libc", - "rgb", -] - [[package]] name = "log" version = "0.4.35" @@ -7414,6 +7411,15 @@ dependencies = [ "windows-targets 0.52.6", ] +[[package]] +name = "windows-sys" +version = "0.60.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f2f500e4d28234f72040990ec9d39e3a6b950f9f22d3dba18416c35882612bcb" +dependencies = [ + "windows-targets 0.53.5", +] + [[package]] name = "windows-sys" version = "0.61.2" @@ -7447,13 +7453,30 @@ dependencies = [ "windows_aarch64_gnullvm 0.52.6", "windows_aarch64_msvc 0.52.6", "windows_i686_gnu 0.52.6", - "windows_i686_gnullvm", + "windows_i686_gnullvm 0.52.6", "windows_i686_msvc 0.52.6", "windows_x86_64_gnu 0.52.6", "windows_x86_64_gnullvm 0.52.6", "windows_x86_64_msvc 0.52.6", ] +[[package]] +name = "windows-targets" +version = "0.53.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4945f9f551b88e0d65f3db0bc25c33b8acea4d9e41163edf90dcd0b19f9069f3" +dependencies = [ + "windows-link", + "windows_aarch64_gnullvm 0.53.1", + "windows_aarch64_msvc 0.53.1", + "windows_i686_gnu 0.53.1", + "windows_i686_gnullvm 0.53.1", + "windows_i686_msvc 0.53.1", + "windows_x86_64_gnu 0.53.1", + "windows_x86_64_gnullvm 0.53.1", + "windows_x86_64_msvc 0.53.1", +] + [[package]] name = "windows-threading" version = "0.2.1" @@ -7475,6 +7498,12 @@ version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "32a4622180e7a0ec044bb555404c800bc9fd9ec262ec147edd5989ccd0c02cd3" +[[package]] +name = "windows_aarch64_gnullvm" +version = "0.53.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a9d8416fa8b42f5c947f8482c43e7d89e73a173cead56d044f6a56104a6d1b53" + [[package]] name = "windows_aarch64_msvc" version = "0.42.2" @@ -7487,6 +7516,12 @@ version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "09ec2a7bb152e2252b53fa7803150007879548bc709c039df7627cabbd05d469" +[[package]] +name = "windows_aarch64_msvc" +version = "0.53.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b9d782e804c2f632e395708e99a94275910eb9100b2114651e04744e9b125006" + [[package]] name = "windows_i686_gnu" version = "0.42.2" @@ -7499,12 +7534,24 @@ version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8e9b5ad5ab802e97eb8e295ac6720e509ee4c243f69d781394014ebfe8bbfa0b" +[[package]] +name = "windows_i686_gnu" +version = "0.53.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "960e6da069d81e09becb0ca57a65220ddff016ff2d6af6a223cf372a506593a3" + [[package]] name = "windows_i686_gnullvm" version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0eee52d38c090b3caa76c563b86c3a4bd71ef1a819287c19d586d7334ae8ed66" +[[package]] +name = "windows_i686_gnullvm" +version = "0.53.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fa7359d10048f68ab8b09fa71c3daccfb0e9b559aed648a8f95469c27057180c" + [[package]] name = "windows_i686_msvc" version = "0.42.2" @@ -7517,6 +7564,12 @@ version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "240948bc05c5e7c6dabba28bf89d89ffce3e303022809e73deaefe4f6ec56c66" +[[package]] +name = "windows_i686_msvc" +version = "0.53.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e7ac75179f18232fe9c285163565a57ef8d3c89254a30685b57d83a38d326c2" + [[package]] name = "windows_x86_64_gnu" version = "0.42.2" @@ -7529,6 +7582,12 @@ version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "147a5c80aabfbf0c7d901cb5895d1de30ef2907eb21fbbab29ca94c5b08b1a78" +[[package]] +name = "windows_x86_64_gnu" +version = "0.53.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9c3842cdd74a865a8066ab39c8a7a473c0778a3f29370b5fd6b4b9aa7df4a499" + [[package]] name = "windows_x86_64_gnullvm" version = "0.42.2" @@ -7541,6 +7600,12 @@ version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "24d5b23dc417412679681396f2b49f3de8c1473deb516bd34410872eff51ed0d" +[[package]] +name = "windows_x86_64_gnullvm" +version = "0.53.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0ffa179e2d07eee8ad8f57493436566c7cc30ac536a3379fdf008f47f6bb7ae1" + [[package]] name = "windows_x86_64_msvc" version = "0.42.2" @@ -7553,6 +7618,12 @@ version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec" +[[package]] +name = "windows_x86_64_msvc" +version = "0.53.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d6bbff5f0aada427a1e5a6da5f1f98158182f26556f345ac9e04d36d0ebed650" + [[package]] name = "winit" version = "0.30.13" diff --git a/README.md b/README.md index 6681ebeb..f37eb5de 100644 --- a/README.md +++ b/README.md @@ -159,7 +159,7 @@ cargo run -p ledmap-studio | Windows | Vulkan, DX12 fallback (force with `WGPU_BACKEND=dx12`). Spout I/O via DirectX interop. | | Linux | Vulkan. V4L2 loopback output. | -NDI requires the [NDI SDK](https://ndi.video/download-ndi-sdk/) installed and the `ndi` feature enabled (default on). +NDI needs the `ndi` feature (off by default) and, at run time, the NDI 6 runtime — from [NDI Tools](https://ndi.video/tools/) or the [NDI SDK](https://ndi.video/download-ndi-sdk/). Building needs nothing NDI-specific; without the runtime, NDI sources simply don't appear. > [!WARNING] > **AMD on Windows: turn off Radeon Enhanced Sync.** With it on, the AMD driver diff --git a/crates/rustjay-core/Cargo.toml b/crates/rustjay-core/Cargo.toml index f3905f92..8b92546a 100644 --- a/crates/rustjay-core/Cargo.toml +++ b/crates/rustjay-core/Cargo.toml @@ -17,7 +17,7 @@ bytemuck = { workspace = true } uuid = { workspace = true } [features] -# NDI output command variants; requires the proprietary NDI SDK. +# NDI output command variants. default = [] ndi = [] link = [] diff --git a/crates/rustjay-engine/Cargo.toml b/crates/rustjay-engine/Cargo.toml index 4806bc64..30b20858 100644 --- a/crates/rustjay-engine/Cargo.toml +++ b/crates/rustjay-engine/Cargo.toml @@ -49,7 +49,7 @@ drm = { version = "0.15", optional = true } libc = { version = "0.2", optional = true } [features] -# NDI needs a proprietary SDK to build, so it is opt-in (enable with `--features ndi`). +# NDI loads the proprietary NDI 6 runtime at run time, so it is opt-in (`--features ndi`). # Webcam stays on by default. The Pi/GLES2 builds select features explicitly. default = ["webcam", "imgui-renderer"] ndi = ["rustjay-io/ndi", "rustjay-gui/ndi", "rustjay-core/ndi"] diff --git a/crates/rustjay-io/Cargo.toml b/crates/rustjay-io/Cargo.toml index ec8caf05..ddbea5c1 100644 --- a/crates/rustjay-io/Cargo.toml +++ b/crates/rustjay-io/Cargo.toml @@ -22,7 +22,7 @@ serde = { workspace = true } serde_json = { workspace = true } # NDI (optional) -grafton-ndi = { version = "0.11", optional = true } +grafton-ndi = { version = "3.0", optional = true } # HAP encoding (optional) hap-qt = { version = "0.3.0", optional = true } @@ -76,7 +76,7 @@ image = { workspace = true } v4l = "0.14" [features] -# NDI needs a proprietary SDK to build, so it is opt-in (enable with `--features ndi`). +# NDI loads the proprietary NDI 6 runtime at run time, so it is opt-in (`--features ndi`). default = ["webcam"] webcam = ["nokhwa"] ndi = ["grafton-ndi", "rustjay-core/ndi"] diff --git a/crates/rustjay-io/src/input/ndi.rs b/crates/rustjay-io/src/input/ndi.rs index 2de61bb4..3ad8b34c 100644 --- a/crates/rustjay-io/src/input/ndi.rs +++ b/crates/rustjay-io/src/input/ndi.rs @@ -8,7 +8,8 @@ use crossbeam::channel::{self, Receiver as CrossbeamReceiver, Sender}; use grafton_ndi::{ - Finder, FinderOptions, Receiver, ReceiverBandwidth, ReceiverColorFormat, ReceiverOptions, NDI, + Finder, FinderOptions, Ndi, PixelFormat, Receiver, ReceiverBandwidth, ReceiverColorFormat, + ReceiverOptions, }; use std::sync::{ atomic::{AtomicBool, Ordering}, @@ -199,7 +200,7 @@ impl NdiReceiver { return Err(anyhow::anyhow!("NDI receiver already started")); } - let ndi = NDI::new().map_err(|e| anyhow::anyhow!("Failed to initialize NDI: {:?}", e))?; + let ndi = Ndi::new().map_err(|e| anyhow::anyhow!("Failed to initialize NDI: {e}"))?; let source_name = self.source_name.clone(); let frame_tx = self.frame_tx.clone(); @@ -213,9 +214,7 @@ impl NdiReceiver { let thread_handle = thread::spawn(move || { // Find the source - let options = FinderOptions::builder().show_local_sources(true).build(); - - let finder = match Finder::new(&ndi, &options) { + let finder = match Finder::new(&ndi, &FinderOptions::new().show_local_sources(true)) { Ok(f) => f, Err(e) => { log::error!("[NDI] Failed to create finder: {:?}", e); @@ -223,11 +222,7 @@ impl NdiReceiver { } }; - // Wait for the specific source. - // Strategy: call wait_for_sources() (which blocks until the source - // list *changes*), then snapshot with current_sources(). This avoids - // the race in sources(timeout) where the change event is consumed by - // wait_for_sources but the subsequent get returns stale data. + // Short waits, so a stop() during the search is noticed. let mut found_source = None; let search_start = Instant::now(); const SEARCH_TIMEOUT_SECS: u64 = 30; @@ -242,33 +237,14 @@ impl NdiReceiver { while running.load(Ordering::SeqCst) && search_start.elapsed().as_secs() < SEARCH_TIMEOUT_SECS { - // Block up to 500 ms for any change in the source list. - let _ = finder.wait_for_sources(Duration::from_millis(500)); - - match finder.current_sources() { - Ok(sources) => { - if !sources.is_empty() { - log::debug!( - "[NDI] Visible sources: {}", - sources.iter().map(|s| s.name.as_str()).collect::>().join(", ") - ); - } - for source in sources { - if source.name == source_name { - found_source = Some(source); - break; - } - } + match finder.find_source_by_name(&source_name, Duration::from_millis(500)) { + Ok(Some(source)) => { + found_source = Some(source); + break; } - Err(e) => { - log::debug!("[NDI] Error listing sources: {:?}", e); - } - } - - if found_source.is_some() { - break; + Ok(None) => {} + Err(e) => log::debug!("[NDI] Error listing sources: {e}"), } - } let source = match found_source { @@ -289,14 +265,15 @@ impl NdiReceiver { // contention — 25x more time yielding than converting. The unpack is // a shader's job. let proxy = low_bandwidth(); - let options = ReceiverOptions::builder(source) - .color(ReceiverColorFormat::UYVY_BGRA) + let options = ReceiverOptions::new(source) + .color_format(ReceiverColorFormat::UyvyBgra) .bandwidth(if proxy { ReceiverBandwidth::Lowest } else { ReceiverBandwidth::Highest }) - .build(); + // Interlaced sources arrive as whole frames, as before 3.0. + .allow_video_fields(false); let receiver = match Receiver::new(&ndi, &options) { Ok(r) => r, @@ -322,11 +299,16 @@ impl NdiReceiver { match receiver.capture_video_ref(Duration::from_millis(100)) { Ok(Some(video_frame)) => { consecutive_errors = 0; - let width = video_frame.width() as u32; - let height = video_frame.height() as u32; - let frame_data = video_frame.data(); + let width = video_frame.width(); + let height = video_frame.height(); + // Both formats we ask for are one plane. Its rows + // exclude the sender's padding (e.g. IOSurface stride + // alignment on macOS), so they upload as they are. + let Some(plane) = video_frame.plane(0) else { + continue; + }; let layout = match video_frame.pixel_format() { - grafton_ndi::PixelFormat::UYVY => NdiPixelLayout::Uyvy, + PixelFormat::Uyvy => NdiPixelLayout::Uyvy, _ => NdiPixelLayout::Bgra, }; @@ -353,15 +335,15 @@ impl NdiReceiver { }) .and_then(|buffer| { match buffer.get_mapped_range_mut(..) { + // Rows land `bytes_per_row` apart, the copy + // alignment wgpu requires. Writes only: the + // memory is typically write-combined, where + // reading is glacial. Ok(mut view) => { - strip_stride_into_mapped( - &mut view, - frame_data, - width, - height, - layout, - bytes_per_row, - ); + for (y, row) in plane.rows().enumerate() { + let dst = y * bytes_per_row as usize; + view.slice(dst..dst + row.len()).copy_from_slice(row); + } } Err(e) => { log::warn!("[NDI] staging buffer not mapped: {e}"); @@ -375,12 +357,13 @@ impl NdiReceiver { }) }); - // Otherwise strip NDI's row padding into a recycled - // Vec, for the consumer to upload itself. + // Otherwise copy the rows into a recycled Vec, for the + // consumer to upload itself. let mut data = Vec::new(); if staged.is_none() { data = spare_rx.try_recv().unwrap_or_default(); - strip_stride(&mut data, frame_data, width, height, layout); + data.clear(); + plane.rows().for_each(|row| data.extend_from_slice(row)); fallbacks += 1; if on_gpu_path || fallbacks == 120 { on_gpu_path = false; @@ -577,108 +560,22 @@ impl Drop for NdiReceiver { /// Strip NDI row stride/padding from raw frame data. /// -/// NDI frames may have row-aligned padding (e.g. IOSurface stride alignment on macOS). -/// This produces tightly-packed rows ready to upload. BGRA needs no channel -/// swap — it already matches `Bgra8Unorm` — and UYVY is uploaded as-is for the -/// shader to unpack. -/// -/// Fills `out` in place, reusing its allocation (see [`NdiReceiver::recycle`]). -fn strip_stride(out: &mut Vec, data: &[u8], width: u32, height: u32, layout: NdiPixelLayout) { - let row_bytes = layout.row_bytes(width); - let rows = height as usize; - let actual_stride = if rows > 0 { data.len() / rows } else { row_bytes }; - out.clear(); - - // Unpadded — most senders: one copy. - if actual_stride == row_bytes { - out.extend_from_slice(&data[..row_bytes * rows]); - return; - } - - out.reserve(row_bytes * rows); - for y in 0..rows { - let src = y * actual_stride; - match data.get(src..src + row_bytes) { - Some(row) => out.extend_from_slice(row), - // A short frame keeps its size; the missing rows are black. - None => out.resize(out.len() + row_bytes, 0), - } - } -} - -/// [`strip_stride`], writing into mapped GPU memory instead of a `Vec`. -/// -/// Rows land `bytes_per_row` apart, the copy alignment wgpu requires, which is -/// usually wider than the frame's own rows. Writes only, never reads: the -/// memory is typically write-combined, where reading is glacial. -fn strip_stride_into_mapped( - out: &mut wgpu::BufferViewMut, - data: &[u8], - width: u32, - height: u32, - layout: NdiPixelLayout, - bytes_per_row: u32, -) { - let row_bytes = layout.row_bytes(width); - let rows = height as usize; - let stride = if rows > 0 { data.len() / rows } else { row_bytes }; - for y in 0..rows { - let Some(row) = data.get(y * stride..y * stride + row_bytes) else { - // A short frame leaves the rest of the buffer as it was. - break; - }; - let dst = y * bytes_per_row as usize; - out.slice(dst..dst + row_bytes).copy_from_slice(row); - } -} - -#[cfg(test)] -mod strip_stride_tests { - use super::{strip_stride, NdiPixelLayout}; - - fn stripped(data: &[u8], w: u32, h: u32, layout: NdiPixelLayout, reuse: &mut Vec) -> Vec { - strip_stride(reuse, data, w, h, layout); - reuse.clone() - } - - #[test] - fn strips_padding_and_passes_tight_frames_through() { - // One buffer across all three, as the receive thread reuses it; a - // leftover byte from an earlier, bigger frame must not survive. - let mut buf = vec![0xAA; 64]; - - // 2×2 BGRA: 8-byte rows padded to 12. - let padded: Vec = (0..24).collect(); - let expected: Vec = (0..8).chain(12..20).collect(); - assert_eq!(stripped(&padded, 2, 2, NdiPixelLayout::Bgra, &mut buf), expected); - - let tight: Vec = (0..16).collect(); - assert_eq!(stripped(&tight, 2, 2, NdiPixelLayout::Bgra, &mut buf), tight); - - // UYVY rows are width * 2. - let uyvy: Vec = (0..8).collect(); - assert_eq!(stripped(&uyvy, 2, 2, NdiPixelLayout::Uyvy, &mut buf), uyvy); - } -} - /// Global NDI availability check pub fn is_ndi_available() -> bool { - NDI::new().is_ok() + Ndi::new().is_ok() } /// Quick function to list available NDI sources pub fn list_ndi_sources(timeout_ms: u32) -> Vec { - let ndi = match NDI::new() { + let ndi = match Ndi::new() { Ok(ndi) => ndi, Err(e) => { - log::error!("Failed to initialize NDI: {:?}", e); + log::error!("Failed to initialize NDI: {e}"); return Vec::new(); } }; - let options = FinderOptions::builder().show_local_sources(true).build(); - - let finder = match Finder::new(&ndi, &options) { + let finder = match Finder::new(&ndi, &FinderOptions::new().show_local_sources(true)) { Ok(f) => f, Err(e) => { log::error!("Failed to create NDI finder: {:?}", e); @@ -686,28 +583,13 @@ pub fn list_ndi_sources(timeout_ms: u32) -> Vec { } }; - // Poll using wait_for_sources() + current_sources() in a loop. - // A single sources(timeout_ms) call only returns after one change event; - // if sources are already known or no new sources arrive, it may time out - // without returning everything the SDK has discovered. The loop below - // keeps draining change events until the deadline, then returns a final - // snapshot so we don't miss sources announced just before the deadline. - let deadline = std::time::Instant::now() + Duration::from_millis(timeout_ms as u64); - loop { - let remaining = deadline.saturating_duration_since(std::time::Instant::now()); - if remaining.is_zero() { - break; - } - let wait = remaining.min(Duration::from_millis(500)); - let _ = finder.wait_for_sources(wait); - } - - match finder.current_sources() { + // Everything seen during the whole window, not just the last snapshot. + match finder.find_sources(Duration::from_millis(u64::from(timeout_ms))) { Ok(sources) => { for s in &sources { - log::info!("[NDI] Discovered source: \"{}\"", s.name); + log::info!("[NDI] Discovered source: \"{}\"", s.name()); } - sources.into_iter().map(|s| s.name).collect() + sources.into_iter().map(|s| s.name().to_owned()).collect() } Err(e) => { log::error!("Failed to get NDI sources: {:?}", e); diff --git a/crates/rustjay-io/src/output/ndi_output.rs b/crates/rustjay-io/src/output/ndi_output.rs index 7fdf0460..a624d7f1 100644 --- a/crates/rustjay-io/src/output/ndi_output.rs +++ b/crates/rustjay-io/src/output/ndi_output.rs @@ -7,7 +7,7 @@ #![allow(dead_code)] use crossbeam::channel::{self, Receiver, Sender as ChannelSender}; -use grafton_ndi::{PixelFormat, Sender, SenderOptions, VideoFrame, VideoFrameBuilder, NDI}; +use grafton_ndi::{BorrowedVideoFrame, Ndi, PixelFormat, Sender, SenderOptions}; use std::sync::{ atomic::{AtomicBool, Ordering}, Arc, @@ -60,7 +60,7 @@ impl NdiOutputSender { return Err(anyhow::anyhow!("Invalid dimensions: {}x{}", width, height)); } - let ndi = NDI::new().map_err(|e| anyhow::anyhow!("Failed to initialize NDI: {:?}", e))?; + let ndi = Ndi::new().map_err(|e| anyhow::anyhow!("Failed to initialize NDI: {e}"))?; let (frame_tx, frame_rx) = channel::bounded(2); let (return_tx, return_rx) = channel::bounded(2); @@ -102,7 +102,7 @@ impl NdiOutputSender { /// Send thread that owns the NDI sender and processes frames fn send_thread( - ndi: NDI, + ndi: Ndi, name: String, include_alpha: bool, frame_rx: Receiver, @@ -110,10 +110,7 @@ impl NdiOutputSender { has_connections: Arc, running: Arc, ) { - let options = SenderOptions::builder(&name) - .clock_video(true) - .clock_audio(false) - .build(); + let options = SenderOptions::new(&name).clock_video(true).clock_audio(false); let sender = match Sender::new(&ndi, &options) { Ok(s) => s, @@ -125,14 +122,11 @@ impl NdiOutputSender { }; let pixel_format = if include_alpha { - PixelFormat::BGRA + PixelFormat::Bgra } else { - PixelFormat::BGRX + PixelFormat::Bgrx }; - // Persistent NDI frame: rebuilt only on resolution change, so we - // don't alloc+memset a full-size buffer every frame. - let mut video_frame: Option = None; let mut frame_count = 0u64; let mut last_log = Instant::now(); // Check on the first loop iteration. @@ -140,9 +134,9 @@ impl NdiOutputSender { while running.load(Ordering::SeqCst) { if last_conn_check.elapsed() >= CONNECTION_CHECK_INTERVAL { - // Zero timeout = last known count, never blocks. On SDK error + // An immediate getter, never blocks. On SDK error // assume connected (keep streaming) rather than go dark. - let count = sender.connection_count(Duration::ZERO).unwrap_or(1); + let count = sender.connection_count().unwrap_or(1); let connected = count > 0; if has_connections.swap(connected, Ordering::SeqCst) != connected { log::info!( @@ -165,44 +159,24 @@ impl NdiOutputSender { frame_count += 1; - let buffer_size = - pixel_format.buffer_size(frame_data.width as i32, frame_data.height as i32); - - if frame_data.data.len() < buffer_size { - log::warn!("[NDI OUTPUT] Frame {} data too small", frame_count); - let _ = return_tx.try_send(frame_data.data); - continue; - } - - let rebuild = match &video_frame { - Some(f) => { - f.width != frame_data.width as i32 - || f.height != frame_data.height as i32 - } - None => true, - }; - if rebuild { - video_frame = match VideoFrameBuilder::new() - .resolution(frame_data.width as i32, frame_data.height as i32) - .pixel_format(pixel_format) - .frame_rate(60, 1) - .aspect_ratio(frame_data.width as f32 / frame_data.height as f32) - .build() - { - Ok(f) => Some(f), - Err(e) => { - log::error!("[NDI OUTPUT] Failed to build video frame: {:?}", e); - let _ = return_tx.try_send(frame_data.data); - continue; + // Sent straight from our buffer: no copy into an NDI-owned + // frame. Defaults are 60 fps and square pixels, as before. + match BorrowedVideoFrame::builder( + &frame_data.data, + frame_data.width, + frame_data.height, + pixel_format, + ) + .build() + { + Ok(frame) => { + if let Err(e) = sender.send_video(&frame) { + log::warn!("[NDI OUTPUT] Frame {frame_count} not sent: {e}"); } - }; + } + Err(e) => log::warn!("[NDI OUTPUT] Frame {frame_count} rejected: {e}"), } - let frame = video_frame.as_mut().expect("video frame just built"); - let copy_len = buffer_size.min(frame.data.len()); - frame.data[..copy_len].copy_from_slice(&frame_data.data[..copy_len]); - sender.send_video(frame); - let _ = return_tx.try_send(frame_data.data); if last_log.elapsed().as_secs() >= 30 { @@ -335,7 +309,7 @@ impl Drop for NdiOutputSender { /// Check if NDI output is available pub fn is_ndi_output_available() -> bool { - NDI::new().is_ok() + Ndi::new().is_ok() } #[cfg(test)] @@ -372,4 +346,37 @@ mod tests { // Post-gate submit must still succeed (early return) and never block. sender.submit_frame(&frame, 64, 64).unwrap(); } + + /// Our sender to our receiver through the real runtime. 100 px rows are + /// 400 bytes, which macOS pads to its IOSurface alignment, so this also + /// checks the receiver hands over tight rows. + /// Skips when the NDI runtime is unavailable. + #[test] + fn loopback_frame_arrives_tight() { + if !is_ndi_output_available() { + eprintln!("NDI runtime unavailable — skipping"); + return; + } + let (w, h) = (100, 50); + let mut sender = NdiOutputSender::new("rustjay-ndi-loopback", w, h, true).unwrap(); + let frame = vec![0x80u8; (w * h * 4) as usize]; + let source = crate::input::list_ndi_sources(3000) + .into_iter() + .find(|s| s.ends_with("(rustjay-ndi-loopback)")) + .expect("our sender is not visible on the network"); + let mut receiver = crate::input::NdiReceiver::new(source); + receiver.start().unwrap(); + + let deadline = Instant::now() + Duration::from_secs(10); + let got = loop { + sender.submit_frame(&frame, w, h).unwrap(); + if let Some(f) = receiver.get_latest_frame() { + break f; + } + assert!(Instant::now() < deadline, "no frame within 10 s"); + std::thread::sleep(Duration::from_millis(20)); + }; + assert_eq!((got.width, got.height), (w, h)); + assert_eq!(got.data.len(), got.layout.row_bytes(w) * h as usize); + } } diff --git a/guide/src/installation.md b/guide/src/installation.md index 4d85c51d..60522364 100644 --- a/guide/src/installation.md +++ b/guide/src/installation.md @@ -69,13 +69,20 @@ sudo modprobe v4l2loopback ## NDI (optional) -NDI video-over-IP requires the [NDI SDK](https://ndi.video/download-ndi-sdk/) to be installed. The `ndi` feature is enabled by default — if you don't have the SDK installed and see linker errors, disable it: +NDI video-over-IP is behind the `ndi` feature, which is off by default: ```toml [dependencies] -rustjay-engine = { git = "...", default-features = false } +rustjay-engine = { version = "0.2", features = ["ndi"] } ``` +Building needs nothing NDI-specific. At run time the app loads the NDI 6 runtime +(from [NDI Tools](https://ndi.video/tools/) or the [NDI SDK](https://ndi.video/download-ndi-sdk/)), +looking next to the executable first, then in `NDI_RUNTIME_DIR_V6`, then on the +platform's library search path. To ship it, put `libndi.dylib` (macOS, in +`Contents/Frameworks`), `libndi.so.6` (Linux) or `Processing.NDI.Lib.x64.dll` +(Windows) beside the binary. Without a runtime, NDI sources simply don't appear. + ## Ableton Link (optional) The `link` feature builds Ableton Link's native C++ via CMake, which this repo diff --git a/guide/src/reference.md b/guide/src/reference.md index bd04f6f0..4b5ee5a9 100644 --- a/guide/src/reference.md +++ b/guide/src/reference.md @@ -33,7 +33,7 @@ rustjay-engine = { | Feature | Description | Extra dependency | |---|---|---| | `webcam` | Webcam capture input | None | -| `ndi` | NDI video input and output | NDI SDK installed system-wide | +| `ndi` | NDI video input and output | NDI 6 runtime at run time (nothing to build) | | `link` | Ableton Link tempo sync | CMake ≥ 3.14; makes binary GPL-2.0+ | | `prodj` | Pioneer ProDJ Link tempo sync | None (binds UDP 50000/50002) | | `mtc` | MIDI Timecode receive | None (uses existing `midir` dep) | diff --git a/guide/src/video-io.md b/guide/src/video-io.md index aa18414f..70a2fd5c 100644 --- a/guide/src/video-io.md +++ b/guide/src/video-io.md @@ -16,7 +16,7 @@ No feature flag needed. Network Device Interface — receive video from any NDI source on the LAN (OBS, Resolume, another rustjay-engine instance). -Requires the [NDI SDK](https://ndi.video/download-ndi-sdk/) and the `ndi` feature (on by default). +Requires the `ndi` feature (off by default) and the NDI 6 runtime at run time — see [Installation](installation.md#ndi-optional). The Input tab scans the LAN and shows available sources. Low latency, high resolution, suitable for multi-machine setups. From c6cb0a15d9199793381901db971ec7cfe05fcd1b Mon Sep 17 00:00:00 2001 From: BlueJayLouche Date: Thu, 26 Nov 2026 09:10:27 +1100 Subject: [PATCH 2/6] fix(gles2): the Wayland window path now calls the effect's hooks The DRM kiosk loop already forwarded web input commands and reported the effect's input state; the winit/Wayland path called none of the three hooks, and never resized its EGL window, so the picture stayed at its startup size. - Resized: wl_egl_window_resize, then Gles2Effect::on_resize. DRM's mode is fixed, so Gles2State::resize declines there. - Web input commands go to the effect, as in the DRM loop. - The input-state broadcast uses the effect's state when it reports one. Drops the dead_code allow and its ponytail note on Gles2EffectDyn. Co-Authored-By: Claude Opus 5.5 --- crates/rustjay-engine/src/app/commands.rs | 12 +++++++++++ crates/rustjay-engine/src/app/events.rs | 9 ++++++++ crates/rustjay-engine/src/app/update.rs | 14 ++++++++++-- crates/rustjay-engine/src/gles2.rs | 26 +++++++++++++++++++---- 4 files changed, 55 insertions(+), 6 deletions(-) diff --git a/crates/rustjay-engine/src/app/commands.rs b/crates/rustjay-engine/src/app/commands.rs index c63308b5..9fa18fdd 100644 --- a/crates/rustjay-engine/src/app/commands.rs +++ b/crates/rustjay-engine/src/app/commands.rs @@ -873,6 +873,18 @@ impl App

{ } } } + // A GLES2 effect owns its input, as in the DRM loop. + #[cfg(feature = "gles2")] + WebServerCommand::Input(input_cmd) + if self.gles2_effect.is_some() && self.gles2_state.is_some() => + { + if let (Some(effect), Some(gles2)) = + (self.gles2_effect.as_mut(), self.gles2_state.as_ref()) + { + effect.handle_input_command(&gles2.gl, input_cmd); + } + server.input_dirty = true; + } WebServerCommand::Input(input_cmd) => match input_cmd { rustjay_control::InputWebCommand::SelectDevice { index, diff --git a/crates/rustjay-engine/src/app/events.rs b/crates/rustjay-engine/src/app/events.rs index b3433ee0..bbd73540 100644 --- a/crates/rustjay-engine/src/app/events.rs +++ b/crates/rustjay-engine/src/app/events.rs @@ -703,6 +703,15 @@ impl ApplicationHandler for App

{ if let Some(ref mut engine) = self.output_engine { engine.resize(size.width, size.height); } + #[cfg(feature = "gles2")] + if size.width > 0 + && size.height > 0 + && let (Some(effect), Some(gles2)) = + (self.gles2_effect.as_mut(), self.gles2_state.as_mut()) + && gles2.resize(size.width, size.height) + { + effect.on_resize(&gles2.gl, size.width, size.height); + } } _ => {} } diff --git a/crates/rustjay-engine/src/app/update.rs b/crates/rustjay-engine/src/app/update.rs index 63429251..23ff5de6 100644 --- a/crates/rustjay-engine/src/app/update.rs +++ b/crates/rustjay-engine/src/app/update.rs @@ -596,14 +596,24 @@ impl App

{ } if server.input_dirty { - server.send_input_state(&rustjay_control::InputStateJson { + let engine_input = rustjay_control::InputStateJson { devices: state.input.available_devices.clone(), active_index: state.input.device_index, active_name: state.input.source_name.clone(), width: state.input.width, height: state.input.height, fps: state.input.fps, - }); + }; + // A GLES2 effect that owns its input reports it, as in the DRM loop. + #[cfg(feature = "gles2")] + let engine_input = match self.gles2_effect.as_ref().and_then(|e| e.get_input_state()) { + Some(effect_input) => rustjay_control::InputStateJson { + devices: engine_input.devices, + ..effect_input + }, + None => engine_input, + }; + server.send_input_state(&engine_input); server.input_dirty = false; } if server.control_dirty { diff --git a/crates/rustjay-engine/src/gles2.rs b/crates/rustjay-engine/src/gles2.rs index 28b4e067..4032a795 100644 --- a/crates/rustjay-engine/src/gles2.rs +++ b/crates/rustjay-engine/src/gles2.rs @@ -31,10 +31,6 @@ pub trait Gles2Effect: Send + 'static { } } -// ponytail: on_resize / handle_input_command / get_input_state are part of the -// public Gles2Effect hooks but the GLES2 run loop never calls them yet, so effects -// miss resizes and web input commands. Wire them into app/events.rs when needed. -#[allow(dead_code)] pub(crate) trait Gles2EffectDyn: Send + 'static { fn init_gl(&mut self, gl: &glow::Context, w: u32, h: u32, s: &EngineState) -> Result<()>; fn render_frame(&mut self, gl: &glow::Context, s: &EngineState) -> Result; @@ -172,6 +168,28 @@ impl Drop for Gles2State { } impl Gles2State { + /// Follow the window to a new size. Returns false in DRM mode, whose + /// display mode is fixed: a window resize there is not the effect's. + pub(crate) fn resize(&mut self, width: u32, height: u32) -> bool { + if self.wl_egl_win.is_null() { + return false; + } + unsafe { + wayland_sys::ffi_dispatch!( + wayland_sys::egl::wayland_egl_handle(), + wl_egl_window_resize, + self.wl_egl_win, + width as i32, + height as i32, + 0, + 0 + ); + } + self.width = width; + self.height = height; + true + } + /// Present the current frame. Wayland calls eglSwapBuffers; DRM additionally /// does a KMS page flip and waits for vblank. pub(crate) fn present(&mut self) -> Result<()> { From cfe4489bdad038945edd1b2f5ece9910e529e434 Mon Sep 17 00:00:00 2001 From: BlueJayLouche Date: Thu, 26 Nov 2026 09:10:51 +1100 Subject: [PATCH 3/6] chore(vp404): hap-wgpu 0.3.2, unpinned Co-Authored-By: Claude Opus 5.5 --- Cargo.lock | 63 +++++++++++++++++++++++++++++---------- examples/vp404/Cargo.toml | 5 ++-- 2 files changed, 49 insertions(+), 19 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 507e82a9..f575f361 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -333,7 +333,7 @@ dependencies = [ "objc2-core-foundation", "objc2-core-graphics", "objc2-foundation 0.3.2", - "parking_lot", + "parking_lot 0.12.5", "percent-encoding", "windows-sys 0.61.2", "wl-clipboard-rs", @@ -1591,7 +1591,7 @@ dependencies = [ "objc2 0.6.5", "objc2-app-kit 0.3.2", "objc2-foundation 0.3.2", - "parking_lot", + "parking_lot 0.12.5", "percent-encoding", "pollster", "profiling", @@ -1824,7 +1824,7 @@ dependencies = [ "harfrust 0.12.0", "log", "nohash-hasher", - "parking_lot", + "parking_lot 0.12.5", "profiling", "self_cell", "skrifa 0.44.0", @@ -2427,7 +2427,7 @@ checksum = "64d39f75651c04f7e9610b4a6780505287f2153860ca1d172e6b0f741955d295" dependencies = [ "libc", "libloading 0.9.1", - "parking_lot", + "parking_lot 0.12.5", "thiserror 2.0.21", "windows-sys 0.60.2", ] @@ -2479,15 +2479,15 @@ dependencies = [ [[package]] name = "hap-wgpu" -version = "0.3.0" +version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e1bc85d3aa4466a2827e12b60e9a4c1d408ce591f15f7cac0656b032ef0886c7" +checksum = "6b8acb92083ad2d7f0473bbfee47b65d30337add48dbff0bbfa1b0acc3545d40" dependencies = [ "bytemuck", "hap-parser", "hap-qt", "image", - "parking_lot", + "parking_lot 0.13.0", "thiserror 2.0.21", "wgpu", ] @@ -2842,7 +2842,7 @@ dependencies = [ "cfg-if 1.0.5", "imgui-sys", "mint", - "parking_lot", + "parking_lot 0.12.5", ] [[package]] @@ -3367,6 +3367,15 @@ dependencies = [ "scopeguard", ] +[[package]] +name = "lock_api" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "65d91b22da179613dcf4d6ec8349563f52a363f6849e03b00dd0a185ec4a59af" +dependencies = [ + "scopeguard", +] + [[package]] name = "log" version = "0.4.35" @@ -3452,7 +3461,7 @@ dependencies = [ "libc", "log", "ndk-context", - "parking_lot", + "parking_lot 0.12.5", "wasm-bindgen", "web-sys", "windows", @@ -4430,8 +4439,18 @@ version = "0.12.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "93857453250e3077bd71ff98b6a65ea6621a19bb0f559a85248955ac12c45a1a" dependencies = [ - "lock_api", - "parking_lot_core", + "lock_api 0.4.14", + "parking_lot_core 0.9.12", +] + +[[package]] +name = "parking_lot" +version = "0.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a9cf937ca4e1d0b7578784559063422fc39ae7c5a00f02471f2614d5486fd226" +dependencies = [ + "lock_api 0.5.0", + "parking_lot_core 0.10.0", ] [[package]] @@ -4447,6 +4466,18 @@ dependencies = [ "windows-link", ] +[[package]] +name = "parking_lot_core" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9cfff060068cc18aa7815010fcaf80c68c7fb9e85fc7f5c0f9bf142c21d19826" +dependencies = [ + "libc", + "redox_syscall 0.9.5", + "smallvec", + "windows-link", +] + [[package]] name = "parlance" version = "0.1.1" @@ -5417,7 +5448,7 @@ dependencies = [ "if-addrs 0.13.4", "libc", "log", - "parking_lot", + "parking_lot 0.12.5", "socket2 0.5.10", ] @@ -5893,7 +5924,7 @@ version = "0.9.9" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3763264f6b73151db08c50ff20d7d8a0b8796e021cdea7ceedad07b80155fa0e" dependencies = [ - "lock_api", + "lock_api 0.4.14", ] [[package]] @@ -7065,7 +7096,7 @@ dependencies = [ "js-sys", "log", "naga", - "parking_lot", + "parking_lot 0.12.5", "portable-atomic", "profiling", "raw-window-handle", @@ -7098,7 +7129,7 @@ dependencies = [ "naga", "naga-types", "once_cell", - "parking_lot", + "parking_lot 0.12.5", "portable-atomic", "profiling", "raw-window-handle", @@ -7183,7 +7214,7 @@ dependencies = [ "objc2-quartz-core 0.3.2", "once_cell", "ordered-float", - "parking_lot", + "parking_lot 0.12.5", "portable-atomic", "portable-atomic-util", "profiling", diff --git a/examples/vp404/Cargo.toml b/examples/vp404/Cargo.toml index 88ab10cd..6e369a9d 100644 --- a/examples/vp404/Cargo.toml +++ b/examples/vp404/Cargo.toml @@ -29,9 +29,8 @@ rustjay-core = { workspace = true } rustjay-io = { workspace = true, default-features = false, features = ["hap-encode"] } wgpu = { workspace = true } egui = { workspace = true } -# ponytail: pinned. 0.3.1's prefetch thread measured worse on a live set (CPU -# 89.7% -> 107.4%); revisit when hap-rs reworks its prefetch policy. -hap-wgpu = "=0.3.0" +# 0.3.2 or later: 0.3.1's read-ahead decoded frames nobody showed (hap-rs#4). +hap-wgpu = "0.3.2" anyhow = { workspace = true } log = { workspace = true } serde = { workspace = true } From 0826356ee49ee50d28da608c4387242a269ca65d Mon Sep 17 00:00:00 2001 From: BlueJayLouche Date: Thu, 26 Nov 2026 09:12:48 +1100 Subject: [PATCH 4/6] chore(release): 0.2.0 Breaking since 0.1.0: egui 0.37 in rustjay-gui's public API, the `mixer` feature removed from rustjay-engine, rustjay_gui::egui_theme::font_definitions added, and glam 0.34 / cpal 0.18 / rand 0.10 in public signatures. All crates that depend on rustjay-core move together. rustjay-lighting, rustjay-ledmap and rustjay-imgui-wgpu are unchanged and stay where they are. Co-Authored-By: Claude Opus 5.5 --- Cargo.lock | 30 ++++++++++---------- Cargo.toml | 24 ++++++++-------- README.md | 2 +- crates/ledmap-studio/Cargo.toml | 2 +- crates/rustjay-api/Cargo.toml | 2 +- crates/rustjay-audio/Cargo.toml | 2 +- crates/rustjay-control/Cargo.toml | 2 +- crates/rustjay-core/Cargo.toml | 2 +- crates/rustjay-engine/Cargo.toml | 4 +-- crates/rustjay-engine/GUIDE.md | 6 ++-- crates/rustjay-gui/Cargo.toml | 2 +- crates/rustjay-io/Cargo.toml | 2 +- crates/rustjay-isf/Cargo.toml | 2 +- crates/rustjay-isf/examples/isf_dump_wgsl.rs | 18 ++++++++++++ crates/rustjay-laser/Cargo.toml | 2 +- crates/rustjay-mixer/Cargo.toml | 2 +- crates/rustjay-presets/Cargo.toml | 2 +- crates/rustjay-projection/Cargo.toml | 2 +- crates/rustjay-render/Cargo.toml | 2 +- crates/rustjay-sync/Cargo.toml | 4 +-- crates/rustjay-sync/README.md | 2 +- guide/src/installation.md | 2 +- 22 files changed, 68 insertions(+), 50 deletions(-) create mode 100644 crates/rustjay-isf/examples/isf_dump_wgsl.rs diff --git a/Cargo.lock b/Cargo.lock index f575f361..463f7201 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3236,7 +3236,7 @@ dependencies = [ [[package]] name = "ledmap-studio" -version = "0.1.0" +version = "0.2.0" dependencies = [ "anyhow", "eframe", @@ -5192,7 +5192,7 @@ dependencies = [ [[package]] name = "rustjay-api" -version = "0.1.0" +version = "0.2.0" dependencies = [ "anyhow", "axum", @@ -5212,7 +5212,7 @@ dependencies = [ [[package]] name = "rustjay-audio" -version = "0.1.0" +version = "0.2.0" dependencies = [ "anyhow", "cpal", @@ -5225,7 +5225,7 @@ dependencies = [ [[package]] name = "rustjay-control" -version = "0.1.0" +version = "0.2.0" dependencies = [ "anyhow", "axum", @@ -5242,7 +5242,7 @@ dependencies = [ [[package]] name = "rustjay-core" -version = "0.1.0" +version = "0.2.0" dependencies = [ "bytemuck", "log", @@ -5254,7 +5254,7 @@ dependencies = [ [[package]] name = "rustjay-engine" -version = "0.1.0" +version = "0.2.0" dependencies = [ "anyhow", "bytemuck", @@ -5291,7 +5291,7 @@ dependencies = [ [[package]] name = "rustjay-gui" -version = "0.1.0" +version = "0.2.0" dependencies = [ "anyhow", "bytemuck", @@ -5327,7 +5327,7 @@ dependencies = [ [[package]] name = "rustjay-io" -version = "0.1.0" +version = "0.2.0" dependencies = [ "anyhow", "bytemuck", @@ -5359,7 +5359,7 @@ dependencies = [ [[package]] name = "rustjay-isf" -version = "0.1.0" +version = "0.2.0" dependencies = [ "anyhow", "bytemuck", @@ -5377,7 +5377,7 @@ dependencies = [ [[package]] name = "rustjay-laser" -version = "0.1.0" +version = "0.2.0" dependencies = [ "anyhow", "laser-dac", @@ -5412,7 +5412,7 @@ dependencies = [ [[package]] name = "rustjay-mixer" -version = "0.1.0" +version = "0.2.0" dependencies = [ "bytemuck", "log", @@ -5429,7 +5429,7 @@ dependencies = [ [[package]] name = "rustjay-presets" -version = "0.1.0" +version = "0.2.0" dependencies = [ "anyhow", "dirs", @@ -5454,7 +5454,7 @@ dependencies = [ [[package]] name = "rustjay-projection" -version = "0.1.0" +version = "0.2.0" dependencies = [ "anyhow", "apriltag", @@ -5476,7 +5476,7 @@ dependencies = [ [[package]] name = "rustjay-render" -version = "0.1.0" +version = "0.2.0" dependencies = [ "anyhow", "bytemuck", @@ -5494,7 +5494,7 @@ dependencies = [ [[package]] name = "rustjay-sync" -version = "0.1.0" +version = "0.2.0" dependencies = [ "log", "rustjay-core", diff --git a/Cargo.toml b/Cargo.toml index 1e94d1f6..11b18ca5 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -89,18 +89,18 @@ qrcode = "0.15" uuid = { version = "1", features = ["v4"] } # Workspace-internal crates -rustjay-core = { path = "crates/rustjay-core", version = "0.1.0" } -rustjay-audio = { path = "crates/rustjay-audio", version = "0.1.0" } -rustjay-io = { path = "crates/rustjay-io", version = "0.1.0", default-features = false } -rustjay-control = { path = "crates/rustjay-control", version = "0.1.0" } -rustjay-presets = { path = "crates/rustjay-presets", version = "0.1.0" } -rustjay-gui = { path = "crates/rustjay-gui", version = "0.1.0" } -rustjay-render = { path = "crates/rustjay-render", version = "0.1.0" } -rustjay-mixer = { path = "crates/rustjay-mixer", version = "0.1.0" } -rustjay-engine = { path = "crates/rustjay-engine", version = "0.1.0", default-features = false } -rustjay-isf = { path = "crates/rustjay-isf", version = "0.1.0" } -rustjay-api = { path = "crates/rustjay-api", version = "0.1.0" } -rustjay-projection = { path = "crates/rustjay-projection", version = "0.1.0" } +rustjay-core = { path = "crates/rustjay-core", version = "0.2.0" } +rustjay-audio = { path = "crates/rustjay-audio", version = "0.2.0" } +rustjay-io = { path = "crates/rustjay-io", version = "0.2.0", default-features = false } +rustjay-control = { path = "crates/rustjay-control", version = "0.2.0" } +rustjay-presets = { path = "crates/rustjay-presets", version = "0.2.0" } +rustjay-gui = { path = "crates/rustjay-gui", version = "0.2.0" } +rustjay-render = { path = "crates/rustjay-render", version = "0.2.0" } +rustjay-mixer = { path = "crates/rustjay-mixer", version = "0.2.0" } +rustjay-engine = { path = "crates/rustjay-engine", version = "0.2.0", default-features = false } +rustjay-isf = { path = "crates/rustjay-isf", version = "0.2.0" } +rustjay-api = { path = "crates/rustjay-api", version = "0.2.0" } +rustjay-projection = { path = "crates/rustjay-projection", version = "0.2.0" } rustjay-lighting = { path = "crates/rustjay-lighting", version = "0.1.0" } rustjay-ledmap = { path = "crates/rustjay-ledmap", version = "0.1.0" } syphon-core = "0.4.1" diff --git a/README.md b/README.md index f37eb5de..22ae8279 100644 --- a/README.md +++ b/README.md @@ -71,7 +71,7 @@ rustjay-engine/ ```toml # Cargo.toml [dependencies] -rustjay-engine = "0.1" +rustjay-engine = "0.2" bytemuck = { version = "1.21", features = ["derive"] } serde = { version = "1.0", features = ["derive"] } anyhow = "1.0" diff --git a/crates/ledmap-studio/Cargo.toml b/crates/ledmap-studio/Cargo.toml index 1ddc54fb..0ca84b4f 100644 --- a/crates/ledmap-studio/Cargo.toml +++ b/crates/ledmap-studio/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "ledmap-studio" -version = "0.1.0" +version = "0.2.0" edition = "2024" description = "Standalone CV LED-mapping tool: calibrate addressable strips over sACN and export ledmap.json" license = "MIT" diff --git a/crates/rustjay-api/Cargo.toml b/crates/rustjay-api/Cargo.toml index 80f9d282..dcdc5097 100644 --- a/crates/rustjay-api/Cargo.toml +++ b/crates/rustjay-api/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "rustjay-api" -version = "0.1.0" +version = "0.2.0" edition = "2024" description = "Optional REST/OpenAPI layer for rustjay-engine" license = "MIT" diff --git a/crates/rustjay-audio/Cargo.toml b/crates/rustjay-audio/Cargo.toml index abd8b19b..786bf0bc 100644 --- a/crates/rustjay-audio/Cargo.toml +++ b/crates/rustjay-audio/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "rustjay-audio" -version = "0.1.0" +version = "0.2.0" edition = "2024" description = "Real-time audio analysis for rustjay-engine" license = "MIT" diff --git a/crates/rustjay-control/Cargo.toml b/crates/rustjay-control/Cargo.toml index 44d4a537..90acd471 100644 --- a/crates/rustjay-control/Cargo.toml +++ b/crates/rustjay-control/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "rustjay-control" -version = "0.1.0" +version = "0.2.0" edition = "2024" description = "MIDI, OSC, and web remote control for rustjay-engine" license = "MIT" diff --git a/crates/rustjay-core/Cargo.toml b/crates/rustjay-core/Cargo.toml index 8b92546a..06194172 100644 --- a/crates/rustjay-core/Cargo.toml +++ b/crates/rustjay-core/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "rustjay-core" -version = "0.1.0" +version = "0.2.0" edition = "2024" description = "Shared types, traits, and state for rustjay-engine" license = "MIT" diff --git a/crates/rustjay-engine/Cargo.toml b/crates/rustjay-engine/Cargo.toml index 30b20858..aca68cac 100644 --- a/crates/rustjay-engine/Cargo.toml +++ b/crates/rustjay-engine/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "rustjay-engine" -version = "0.1.0" +version = "0.2.0" edition = "2024" description = "High-performance cross-platform VJ engine" license = "MIT" @@ -16,7 +16,7 @@ rustjay-control = { workspace = true } rustjay-presets = { workspace = true } rustjay-gui = { workspace = true } rustjay-render = { workspace = true } -rustjay-sync = { path = "../rustjay-sync", version = "0.1.0", optional = true } +rustjay-sync = { path = "../rustjay-sync", version = "0.2.0", optional = true } rustjay-api = { workspace = true, optional = true } rustjay-projection = { workspace = true, optional = true } log = { workspace = true } diff --git a/crates/rustjay-engine/GUIDE.md b/crates/rustjay-engine/GUIDE.md index 8b930e53..25f72ac2 100644 --- a/crates/rustjay-engine/GUIDE.md +++ b/crates/rustjay-engine/GUIDE.md @@ -19,7 +19,7 @@ Add the engine to `Cargo.toml`: ```toml [dependencies] -rustjay-engine = "0.1" +rustjay-engine = "0.2" bytemuck = { version = "1.21", features = ["derive"] } serde = { version = "1.0", features = ["derive"] } anyhow = "1.0" @@ -293,7 +293,7 @@ Presets are handled automatically by the engine. The built-in Presets tab lets u - Enable feature flags in `Cargo.toml` for optional I/O protocols: ```toml [dependencies] - rustjay-engine = { version = "0.1", features = ["ndi", "webcam"] } + rustjay-engine = { version = "0.2", features = ["ndi", "webcam"] } ``` ### Tempo sync (Ableton Link + ProDJ Link) @@ -302,7 +302,7 @@ The engine can lock to external tempo sources. Enable the features you need: ```toml [dependencies] -rustjay-engine = { version = "0.1", features = ["link", "prodj"] } +rustjay-engine = { version = "0.2", features = ["link", "prodj"] } ``` In your shader code, use [`EngineState::effective_bpm`] and [`EngineState::effective_beat_phase`] diff --git a/crates/rustjay-gui/Cargo.toml b/crates/rustjay-gui/Cargo.toml index b1579385..afc30143 100644 --- a/crates/rustjay-gui/Cargo.toml +++ b/crates/rustjay-gui/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "rustjay-gui" -version = "0.1.0" +version = "0.2.0" edition = "2024" description = "ImGui control interface for rustjay-engine" license = "MIT" diff --git a/crates/rustjay-io/Cargo.toml b/crates/rustjay-io/Cargo.toml index ddbea5c1..b8a76ea3 100644 --- a/crates/rustjay-io/Cargo.toml +++ b/crates/rustjay-io/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "rustjay-io" -version = "0.1.0" +version = "0.2.0" edition = "2024" description = "Video input and output for rustjay-engine" license = "MIT" diff --git a/crates/rustjay-isf/Cargo.toml b/crates/rustjay-isf/Cargo.toml index 7ab3badc..b3bb0b52 100644 --- a/crates/rustjay-isf/Cargo.toml +++ b/crates/rustjay-isf/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "rustjay-isf" -version = "0.1.0" +version = "0.2.0" edition = "2024" description = "ISF (Interactive Shader Format) support for rustjay-engine — GLSL→WGSL transpiler and EffectPlugin adapter" license = "MIT" diff --git a/crates/rustjay-isf/examples/isf_dump_wgsl.rs b/crates/rustjay-isf/examples/isf_dump_wgsl.rs new file mode 100644 index 00000000..5d43e8d9 --- /dev/null +++ b/crates/rustjay-isf/examples/isf_dump_wgsl.rs @@ -0,0 +1,18 @@ +//! Prints the WGSL the ISF pipeline hands to wgpu, for one shader. +//! +//! The backend-specific half of the pipeline lives past this point (naga +//! spv-out for Vulkan, hlsl-out for DX12, msl-out for Metal), so when a shader +//! renders on one backend and not another, this is the common input to diff +//! against — feed it to the `naga` CLI to see what each backend is given. +//! +//! Run: cargo run --release -p rustjay-isf --example isf_dump_wgsl -- + +fn main() -> Result<(), String> { + let path = std::env::args().nth(1).ok_or("usage: isf_dump_wgsl ")?; + // header::parse, not isf::parse — the corpus has headers the upstream + // crate rejects (empty IMPORTED arrays), and the runtime uses this one. + let src = std::fs::read_to_string(&path).map_err(|e| format!("{path}: {e}"))?; + let isf = rustjay_isf::header::parse(&src).map_err(|e| format!("{path}: {e}"))?; + print!("{}", rustjay_isf::generate_wgsl(&isf, &src)?.wgsl); + Ok(()) +} diff --git a/crates/rustjay-laser/Cargo.toml b/crates/rustjay-laser/Cargo.toml index f23d80ef..772857c9 100644 --- a/crates/rustjay-laser/Cargo.toml +++ b/crates/rustjay-laser/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "rustjay-laser" -version = "0.1.0" +version = "0.2.0" edition = "2024" description = "Render MadMapper laser materials to 2D paths and stream them to a laser DAC" license = "MIT" diff --git a/crates/rustjay-mixer/Cargo.toml b/crates/rustjay-mixer/Cargo.toml index e9f85902..b21e66d5 100644 --- a/crates/rustjay-mixer/Cargo.toml +++ b/crates/rustjay-mixer/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "rustjay-mixer" -version = "0.1.0" +version = "0.2.0" edition = "2024" description = "Multi-channel compositing mixer for rustjay-engine (Phase B3)" license = "MIT" diff --git a/crates/rustjay-presets/Cargo.toml b/crates/rustjay-presets/Cargo.toml index c1cb47fa..f456a6f2 100644 --- a/crates/rustjay-presets/Cargo.toml +++ b/crates/rustjay-presets/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "rustjay-presets" -version = "0.1.0" +version = "0.2.0" edition = "2024" description = "Preset save/load for rustjay-engine" license = "MIT" diff --git a/crates/rustjay-projection/Cargo.toml b/crates/rustjay-projection/Cargo.toml index 10fc2176..0bb0c97b 100644 --- a/crates/rustjay-projection/Cargo.toml +++ b/crates/rustjay-projection/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "rustjay-projection" -version = "0.1.0" +version = "0.2.0" edition = "2024" description = "Output post-processor for projection mapping — dome, warp, edge-blend, slicer" license = "MIT" diff --git a/crates/rustjay-render/Cargo.toml b/crates/rustjay-render/Cargo.toml index 76efeee4..8d7836c5 100644 --- a/crates/rustjay-render/Cargo.toml +++ b/crates/rustjay-render/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "rustjay-render" -version = "0.1.0" +version = "0.2.0" edition = "2024" description = "wgpu rendering pipeline for rustjay-engine" license = "MIT" diff --git a/crates/rustjay-sync/Cargo.toml b/crates/rustjay-sync/Cargo.toml index 3a46fc68..23c2de1c 100644 --- a/crates/rustjay-sync/Cargo.toml +++ b/crates/rustjay-sync/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "rustjay-sync" -version = "0.1.0" +version = "0.2.0" edition = "2024" description = "Sync & timing: Ableton Link, ProDJ Link, MTC" license = "MIT" @@ -13,7 +13,7 @@ prodj = ["dep:prodjlink-rs"] mtc = [] [dependencies] -rustjay-core = { path = "../rustjay-core", version = "0.1.0" } +rustjay-core = { path = "../rustjay-core", version = "0.2.0" } log = { workspace = true } diff --git a/crates/rustjay-sync/README.md b/crates/rustjay-sync/README.md index 1ae534c0..d1c91466 100644 --- a/crates/rustjay-sync/README.md +++ b/crates/rustjay-sync/README.md @@ -29,7 +29,7 @@ Enable the features you need in your app's `Cargo.toml`: ```toml [dependencies] -rustjay-engine = { version = "0.1", features = ["link", "prodj"] } +rustjay-engine = { version = "0.2", features = ["link", "prodj"] } ``` Both sync sources feed into the engine's LFO and modulation system automatically. diff --git a/guide/src/installation.md b/guide/src/installation.md index 60522364..d4c377c8 100644 --- a/guide/src/installation.md +++ b/guide/src/installation.md @@ -124,7 +124,7 @@ Add rustjay-engine to `Cargo.toml`: ```toml [dependencies] -rustjay-engine = "0.1" +rustjay-engine = "0.2" bytemuck = { version = "1.21", features = ["derive"] } serde = { version = "1.0", features = ["derive"] } anyhow = "1.0" From 2c5cb2e104178f4986b180fd4e9f14b8cac4701e Mon Sep 17 00:00:00 2001 From: BlueJayLouche Date: Thu, 26 Nov 2026 09:13:09 +1100 Subject: [PATCH 5/6] chore: untrack isf_dump_wgsl.rs (local work file, swept in by mistake) Co-Authored-By: Claude Opus 5.5 --- crates/rustjay-isf/examples/isf_dump_wgsl.rs | 18 ------------------ 1 file changed, 18 deletions(-) delete mode 100644 crates/rustjay-isf/examples/isf_dump_wgsl.rs diff --git a/crates/rustjay-isf/examples/isf_dump_wgsl.rs b/crates/rustjay-isf/examples/isf_dump_wgsl.rs deleted file mode 100644 index 5d43e8d9..00000000 --- a/crates/rustjay-isf/examples/isf_dump_wgsl.rs +++ /dev/null @@ -1,18 +0,0 @@ -//! Prints the WGSL the ISF pipeline hands to wgpu, for one shader. -//! -//! The backend-specific half of the pipeline lives past this point (naga -//! spv-out for Vulkan, hlsl-out for DX12, msl-out for Metal), so when a shader -//! renders on one backend and not another, this is the common input to diff -//! against — feed it to the `naga` CLI to see what each backend is given. -//! -//! Run: cargo run --release -p rustjay-isf --example isf_dump_wgsl -- - -fn main() -> Result<(), String> { - let path = std::env::args().nth(1).ok_or("usage: isf_dump_wgsl ")?; - // header::parse, not isf::parse — the corpus has headers the upstream - // crate rejects (empty IMPORTED arrays), and the runtime uses this one. - let src = std::fs::read_to_string(&path).map_err(|e| format!("{path}: {e}"))?; - let isf = rustjay_isf::header::parse(&src).map_err(|e| format!("{path}: {e}"))?; - print!("{}", rustjay_isf::generate_wgsl(&isf, &src)?.wgsl); - Ok(()) -} From c3f688fcb0298b5354e40bbb76e84d76e31ed0b6 Mon Sep 17 00:00:00 2001 From: BlueJayLouche Date: Thu, 26 Nov 2026 09:21:36 +1100 Subject: [PATCH 6/6] fix(gui): syphon_name is unused off macOS (found by the new ndi CI step) Co-Authored-By: Claude Opus 5.5 --- crates/rustjay-gui/src/control_gui.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/crates/rustjay-gui/src/control_gui.rs b/crates/rustjay-gui/src/control_gui.rs index b01cb64f..3eeef35c 100644 --- a/crates/rustjay-gui/src/control_gui.rs +++ b/crates/rustjay-gui/src/control_gui.rs @@ -96,8 +96,8 @@ pub struct ControlGui { impl ControlGui { pub fn new(shared_state: Arc>) -> anyhow::Result { - // `ndi_name` is only read by the `ndi`-gated UI below. - #[cfg_attr(not(feature = "ndi"), allow(unused_variables))] + // `ndi_name` is only read by the `ndi`-gated UI below, `syphon_name` only on macOS. + #[cfg_attr(any(not(feature = "ndi"), not(target_os = "macos")), allow(unused_variables))] let (ndi_name, syphon_name) = { let state = shared_state.lock().unwrap_or_else(|e| e.into_inner()); #[cfg(target_os = "macos")]