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 Registry interface
29 pub const REGISTRY: &str = "PipeWire:Interface:Registry";
30}
31
32/// Types to deal with param objects
33pub mod params {
34 use pipewire_native_spa as spa;
35
36 /// Because param objects are generic and depend on the context in which they are being used,
37 /// we provide a construct a param object. The provided object and param types are used while
38 /// creating the message sent to the server, and the `builder` callback is then called to let
39 /// the caller set the required fields (which can be as complex as required).
40 pub struct ParamBuilder {
41 /// The object type for the param being built.
42 pub object_type: spa::pod::types::ObjectType,
43 /// The id of the param being built.
44 pub param_id: spa::param::ParamType,
45 /// A free form Pod builder for the individual object fields.
46 pub builder:
47 Box<dyn FnOnce(spa::pod::builder::ObjectBuilder) -> spa::pod::builder::ObjectBuilder>,
48 }
49}