Python API — Targets & Discovery Classes
All classes below are @final immutable (frozen) native PyO3 types safe to share across threads on free-threaded Python 3.14t/3.15t (-Xgil=0).
CaptureTarget
Section titled “CaptureTarget”Immutable target descriptor (DefaultOutput, Device, Application, Process, DefaultInput, InputDevice).
| Property | Type |
|---|---|
active_audio |
bool | None |
app_id |
str | None |
available_backends |
list[BackendId] |
backend |
BackendId | None |
default_device_mode |
DefaultDeviceMode |
device_id |
str | None |
executable_path |
str | None |
gain |
float |
id |
str |
kind |
TargetKind |
logical_id |
str |
name |
str | None |
on_root_exit |
RootExitPolicy |
pid |
int | None |
process_start_time |
int | None |
scope |
ProcessScope |
wait_timeout_ms |
int | None |
def diagnostic_summary(include_identity: bool=False) -> strdef lower_to_process() -> CaptureTargetdef with_backend(backend: BackendId | str | None=None) -> CaptureTargetdef with_gain(gain: SupportsFloat | SupportsIndex) -> CaptureTargetBackends
Section titled “Backends”Per-OS ordered backend allowlists (windows, linux, macos) controlling selection priority and fallback.
class Backends(windows: SupportsGetItem[int, BackendId | str] | None=None, linux: SupportsGetItem[int, BackendId | str] | None=None, macos: SupportsGetItem[int, BackendId | str] | None=None) -> Backends| Property | Type |
|---|---|
linux |
list[BackendId] |
macos |
list[BackendId] |
windows |
list[BackendId] |
DiscoveryQuery
Section titled “DiscoveryQuery”Structured filter, deduplication (BY_LOGICAL_TARGET vs PER_BACKEND), and ordering configuration for target discovery.
class DiscoveryQuery(backends: Backends | None=None, dedupe: DiscoveryDedupe | str=..., order: DiscoveryOrder | str=..., active_only: bool=False, include_non_audio: bool=False, include_applications: bool=True, include_processes: bool=True, include_output_devices: bool=True, include_inputs: bool=True, os: PlatformOs | str | None=None) -> DiscoveryQuery| Property | Type |
|---|---|
active_only |
bool |
backends |
Backends |
dedupe |
DiscoveryDedupe |
include_applications |
bool |
include_inputs |
bool |
include_non_audio |
bool |
include_output_devices |
bool |
include_processes |
bool |
order |
DiscoveryOrder |
os |
PlatformOs |
DiscoveryService
Section titled “DiscoveryService”Stateful discovery engine supporting snapshots, find_app, and bounded event subscriptions.
class DiscoveryService(os: PlatformOs | str | None=None) -> DiscoveryService| Property | Type |
|---|---|
active_subscriber_count |
int |
current_revision |
int |
default_input_device_id |
str | None |
default_output_device_id |
str | None |
os |
PlatformOs |
def applications(active_only: bool=False, include_non_audio: bool=False) -> list[CaptureTarget]def discover(backends: Backends | None=None, dedupe: DiscoveryDedupe | str=..., order: DiscoveryOrder | str=..., active_only: bool=False, include_non_audio: bool=False, include_inputs: bool=True) -> TargetCatalogdef discover_query(query: DiscoveryQuery) -> TargetCatalogdef find_app(query: str, scope: ProcessScope | str=..., on_root_exit: RootExitPolicy | str=..., wait_timeout_ms: SupportsIndex=5000, backend: BackendId | str | None=None, gain: SupportsFloat | SupportsIndex=1.0) -> CaptureTargetdef input_devices() -> list[CaptureTarget]def output_devices() -> list[CaptureTarget]def processes(active_only: bool=False, include_non_audio: bool=False) -> list[CaptureTarget]def publish_default_input_changed(device_id: str) -> intdef publish_synthetic_events(count: SupportsIndex) -> intdef publish_visibility_changed(visibility: Visibility | str) -> intdef publish_watcher_failed(reason: str) -> intdef seed_demo_inventory() -> intdef subscribe(backends: Backends | None=None, dedupe: DiscoveryDedupe | str=..., order: DiscoveryOrder | str=..., active_only: bool=False, include_non_audio: bool=False, include_inputs: bool=True, max_discovery_queue: SupportsIndex=256) -> DiscoverySubscriptiondef subscribe_query(query: DiscoveryQuery, max_discovery_queue: SupportsIndex=256) -> DiscoverySubscriptionTargetCatalog
Section titled “TargetCatalog”Categorized discovery snapshot containing applications, processes, output_devices, input_devices, and default IDs.
| Property | Type |
|---|---|
applications |
list[CaptureTarget] |
default_input_device_id |
str | None |
default_output_device_id |
str | None |
input_devices |
list[CaptureTarget] |
output_devices |
list[CaptureTarget] |
processes |
list[CaptureTarget] |
revision |
int |
targets |
list[CaptureTarget] |
TargetSnapshot
Section titled “TargetSnapshot”Flat revision-stamped target list returned by DiscoverySubscription.resnapshot().
| Property | Type |
|---|---|
revision |
int |
targets |
list[CaptureTarget] |
DiscoveryEvent
Section titled “DiscoveryEvent”Incremental topology or liveness transition emitted by DiscoverySubscription.
| Property | Type |
|---|---|
device_id |
str | None |
failure_reason |
str | None |
kind |
DiscoveryEventKind |
minimum_revision |
int | None |
revision |
int |
target |
CaptureTarget | None |
target_id |
str | None |
visibility |
Visibility | None |
DiscoverySubscription
Section titled “DiscoverySubscription”Bounded cursor-tracked event stream with overflow detection (is_overflowed) and resnapshot() recovery.
| Property | Type |
|---|---|
id |
int |
is_overflowed |
bool |
pending_len |
int |
def __enter__() -> DiscoverySubscriptiondef close() -> Nonedef poll_event() -> DiscoveryEvent | Nonedef poll_events() -> list[DiscoveryEvent]def resnapshot() -> TargetSnapshot