pipewire_native/types.rs
1// SPDX-License-Identifier: MIT
2// SPDX-FileCopyrightText: Copyright (c) 2025 Asymptotic Inc.
3// SPDX-FileCopyrightText: Copyright (c) 2025 Arun Raghavan
4
5/// An type description of a PipeWire interface.
6pub type ObjectType = &'static str;
7
8/// Names of PipeWire interfaces.
9pub mod interface {
10 /// The Client interface.
11 pub const CLIENT: &str = "PipeWire:Interface:Client";
12 /// The Core interface
13 pub const CORE: &str = "PipeWire:Interface:Core";
14 /// The Device interface
15 pub const DEVICE: &str = "PipeWire:Interface:Device";
16 /// The Factory interface
17 pub const FACTORY: &str = "PipeWire:Interface:Factory";
18 /// The Link interface
19 pub const LINK: &str = "PipeWire:Interface:Link";
20 /// The Metadata interface
21 pub const METADATA: &str = "PipeWire:Interface:Metadata";
22 /// The Module interface
23 pub const MODULE: &str = "PipeWire:Interface:Module";
24 /// The Node interface
25 pub const NODE: &str = "PipeWire:Interface:Node";
26 /// The Port interface
27 pub const PORT: &str = "PipeWire:Interface:Port";
28 /// The Profiler interface
29 pub const PROFILER: &str = "PipeWire:Interface:Profiler";
30 /// The Registry interface
31 pub const REGISTRY: &str = "PipeWire:Interface:Registry";
32}
33
34/// Types to deal with param objects
35pub mod params {
36 use pipewire_native_spa as spa;
37
38 /// Because param objects are generic and depend on the context in which they are being used,
39 /// we provide a construct a param object. The provided object and param types are used while
40 /// creating the message sent to the server, and the `builder` callback is then called to let
41 /// the caller set the required fields (which can be as complex as required).
42 pub struct ParamBuilder {
43 /// The object type for the param being built.
44 pub object_type: spa::pod::types::ObjectType,
45 /// The id of the param being built.
46 pub param_id: spa::param::ParamType,
47 /// A free form Pod builder for the individual object fields.
48 pub builder:
49 Box<dyn FnOnce(spa::pod::builder::ObjectBuilder) -> spa::pod::builder::ObjectBuilder>,
50 }
51}