Audio 49: fluxer-capture audio target listing, property rules, one PipeWire initialiser #339

Closed
opened 2026-11-12 18:34:14 +00:00 by charles · 0 comments
Owner

Plan: docs/superpowers/plans/2026-11-12-textchat.md, section "Task 49" (Audio devices and PipeWire, added 2026-11-12). Design: docs/superpowers/specs/2026-11-12-fluxer-native-audio-devices-design.md. Closes the gaps of #220 and #233 (and #225 item 7).

Task 49: fluxer-capture audio target listing, property rules, one PipeWire initialiser

Issue: (to be created)

Files:

  • Modify: crates/fluxer-capture/src/{audio.rs,lib.rs,fake.rs}, crates/fluxer-capture/src/pipewire_audio/{mod.rs,routing.rs}, crates/fluxer-capture/src/desktop/{rtc.rs,mod.rs}, crates/fluxer-capture/src/wasapi/*.rs (match the new variant only), README
  • Test: crates/fluxer-capture/src/pipewire_audio/routing.rs (unit), crates/fluxer-capture/tests/fake.rs, crates/fluxer-capture/tests/pipewire_real.rs

Interfaces:

  • Produces: audio::AudioTarget { pub props: BTreeMap<String, String> }; audio::AUDIO_TARGET_FIELDS: [&str; 14] (the 14 keys of desk/src/main/LinuxAudioCapture.ts:43-58, same order); StreamAudioCapturer::list_targets(&mut self) -> Result<Vec<AudioTarget>, CaptureError> with a default body returning CaptureError::Unsupported("no audio source listing") (so Unsupported and WASAPI need nothing); AppMatch::Props(BTreeMap<String, String>); AudioRule.exclude: Vec<BTreeMap<String, String>> (Default = empty); routing::Graph::targets(&self, identity: &SelfIdentity, own_sink: Option<&str>) -> Vec<AudioTarget> (every routable node of enriched_nodes, minus identity.matches and minus the node named own_sink or starting fluxer-native-stream-audio-, projected to AUDIO_TARGET_FIELDS, sorted by object.serial then node.name); PipeWireAudioCapturer::list_targets (snapshot thread + Graph::targets, ≤ READY_TIMEOUT); FakeCaptureControl::set_audio_targets(Vec<AudioTarget>), the fake's list_targets returning them (default: two playback streams "Firefox" pid 4242 and "mpv" pid 4343, one Audio/Sink "Speakers"); #[cfg(target_os = "linux")] pub fn initialize_pipewire() -> bool in desktop/rtc.rs, re-exported as fluxer_capture::initialize_pipewire — the only declaration of _ZN6webrtc18InitializePipeWireEv (#225.7); pipewire_audio::init_pipewire calls it.

  • Routing (RoutingRule::from_audio_rule): AppMatch::Props(p) → include_when gets p minus keys starting fluxer.display. (empty after that → ignored); rule.exclude entries → never_when with the same stripping; fluxer.target.objects keeps working through matches_pattern.

  • #225.6: snapshot_graph arms a PipeWire loop timer for READY_TIMEOUT that quits the main loop, so the fluxer-pipewire-list thread always ends; list_applications keeps its signature (implemented over the same snapshot).

  • Step 1: Write failing tests: props_match_is_an_include_pattern_without_display_keys, display_only_props_match_is_ignored, exclude_patterns_become_never_when, target_objects_pattern_routes_streams_to_that_sink, targets_are_routable_nodes_minus_self_and_own_sink, targets_are_projected_to_the_fourteen_fields, default_list_targets_is_unsupported (on Unsupported), fake_lists_its_targets_and_records_props_rules (tests/fake.rs), audio_rule_default_has_no_exclude; real (FLUXER_CAPTURE_TESTS=1, tests/pipewire_real.rs): list_targets_sees_a_playing_tone_and_not_itself, list_targets_thread_ends_within_timeout.

  • Step 2–5: FAIL → implement → PASS → commit feat(capture): list PipeWire audio targets, property rules, one PipeWire initialiser.

🤖 Generated with Claude Code

Plan: `docs/superpowers/plans/2026-11-12-textchat.md`, section "Task 49" (Audio devices and PipeWire, added 2026-11-12). Design: `docs/superpowers/specs/2026-11-12-fluxer-native-audio-devices-design.md`. Closes the gaps of #220 and #233 (and #225 item 7). ### Task 49: `fluxer-capture` audio target listing, property rules, one PipeWire initialiser **Issue:** (to be created) **Files:** - Modify: `crates/fluxer-capture/src/{audio.rs,lib.rs,fake.rs}`, `crates/fluxer-capture/src/pipewire_audio/{mod.rs,routing.rs}`, `crates/fluxer-capture/src/desktop/{rtc.rs,mod.rs}`, `crates/fluxer-capture/src/wasapi/*.rs` (match the new variant only), README - Test: `crates/fluxer-capture/src/pipewire_audio/routing.rs` (unit), `crates/fluxer-capture/tests/fake.rs`, `crates/fluxer-capture/tests/pipewire_real.rs` **Interfaces:** - Produces: `audio::AudioTarget { pub props: BTreeMap<String, String> }`; `audio::AUDIO_TARGET_FIELDS: [&str; 14]` (the 14 keys of `desk/src/main/LinuxAudioCapture.ts:43-58`, same order); `StreamAudioCapturer::list_targets(&mut self) -> Result<Vec<AudioTarget>, CaptureError>` with a default body returning `CaptureError::Unsupported("no audio source listing")` (so `Unsupported` and WASAPI need nothing); `AppMatch::Props(BTreeMap<String, String>)`; `AudioRule.exclude: Vec<BTreeMap<String, String>>` (`Default` = empty); `routing::Graph::targets(&self, identity: &SelfIdentity, own_sink: Option<&str>) -> Vec<AudioTarget>` (every routable node of `enriched_nodes`, minus `identity.matches` and minus the node named `own_sink` or starting `fluxer-native-stream-audio-`, projected to `AUDIO_TARGET_FIELDS`, sorted by `object.serial` then `node.name`); `PipeWireAudioCapturer::list_targets` (snapshot thread + `Graph::targets`, ≤ `READY_TIMEOUT`); `FakeCaptureControl::set_audio_targets(Vec<AudioTarget>)`, the fake's `list_targets` returning them (default: two playback streams "Firefox" pid 4242 and "mpv" pid 4343, one `Audio/Sink` "Speakers"); `#[cfg(target_os = "linux")] pub fn initialize_pipewire() -> bool` in `desktop/rtc.rs`, re-exported as `fluxer_capture::initialize_pipewire` — the only declaration of `_ZN6webrtc18InitializePipeWireEv` (#225.7); `pipewire_audio::init_pipewire` calls it. - Routing (`RoutingRule::from_audio_rule`): `AppMatch::Props(p)` → `include_when` gets `p` minus keys starting `fluxer.display.` (empty after that → ignored); `rule.exclude` entries → `never_when` with the same stripping; `fluxer.target.objects` keeps working through `matches_pattern`. - #225.6: `snapshot_graph` arms a PipeWire loop timer for `READY_TIMEOUT` that quits the main loop, so the `fluxer-pipewire-list` thread always ends; `list_applications` keeps its signature (implemented over the same snapshot). - [ ] **Step 1: Write failing tests**: `props_match_is_an_include_pattern_without_display_keys`, `display_only_props_match_is_ignored`, `exclude_patterns_become_never_when`, `target_objects_pattern_routes_streams_to_that_sink`, `targets_are_routable_nodes_minus_self_and_own_sink`, `targets_are_projected_to_the_fourteen_fields`, `default_list_targets_is_unsupported` (on `Unsupported`), `fake_lists_its_targets_and_records_props_rules` (`tests/fake.rs`), `audio_rule_default_has_no_exclude`; real (`FLUXER_CAPTURE_TESTS=1`, `tests/pipewire_real.rs`): `list_targets_sees_a_playing_tone_and_not_itself`, `list_targets_thread_ends_within_timeout`. - [ ] **Step 2–5:** FAIL → implement → PASS → commit `feat(capture): list PipeWire audio targets, property rules, one PipeWire initialiser`. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
charles added this to the Text chat milestone 2026-11-12 18:34:14 +00:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
charles/fluxer-native#339
No description provided.