### Create and Register a Local Listener Source: https://pipewire.pages.freedesktop.org/pipewire-rs/pipewire/registry/struct.ListenerLocalBuilder.html Use `Registry::add_listener_local` to create a builder, configure callbacks, and then call `register` to get a `registry::Listener`. This example shows how to set up callbacks for both global object addition and removal. ```rust let registry_listener = registry.add_listener_local() .global(|global| println!("New global: {global:?}")) .global_remove(|id| println!("Global with id {id} was removed")) .register(); ``` -------------------------------- ### Get Slice from Option (Inverse Example) Source: https://pipewire.pages.freedesktop.org/pipewire-rs/pipewire_sys/type.pw_global_bind_func_t.html Provides an example illustrating the inverse relationship between as_slice() and the first() method on slices, showing how to retrieve the first element of a slice obtained from an Option. ```rust for i in [Some(1234_u16), None] { assert_eq!(i.as_ref(), i.as_slice().first()); } ``` -------------------------------- ### Example: Creating a new link Source: https://pipewire.pages.freedesktop.org/pipewire-rs/pipewire/core/struct.Core.html Demonstrates how to create a new link object on the PipeWire server using the `create_object` method. This example uses turbofish syntax to specify the desired object type. ```rust use pipewire as pw; pw::init(); let mainloop = pw::MainLoop::new().expect("Failed to create Pipewire Mainloop"); let context = pw::Context::new(&mainloop).expect("Failed to create Pipewire Context"); let core = context .connect(None) .expect("Failed to connect to Pipewire Core"); // This call uses turbofish syntax to specify that we want a link. let link = core.create_object::( // The actual name for a link factory might be different for your system, // you should probably obtain a factory from the registry. "link-factory", &pw::properties! { "link.output.port" => "1", "link.input.port" => "2", "link.output.node" => "3", "link.input.node" => "4" }, ) .expect("Failed to create object"); ``` -------------------------------- ### MainLoopRc::run Source: https://pipewire.pages.freedesktop.org/pipewire-rs/pipewire/main_loop/struct.MainLoopRc.html Starts the PipeWire main loop. ```APIDOC ## pub fn run(&self) ### Description Starts the PipeWire main loop. This method will block until the loop is quit. ``` -------------------------------- ### ThreadLoopRc::start Source: https://pipewire.pages.freedesktop.org/pipewire-rs/pipewire/thread_loop/struct.ThreadLoopRc.html Starts the ThreadLoop. ```APIDOC ## ThreadLoopRc::start ### Description Start the ThreadLoop. ### Signature `pub fn start(&self)` ``` -------------------------------- ### MetadataListener Usage Example Source: https://pipewire.pages.freedesktop.org/pipewire-rs/pipewire/metadata/struct.MetadataListener.html This example demonstrates how to create and use a MetadataListener to receive property updates. The listener is registered with a callback function that prints details about the metadata change. ```APIDOC ## MetadataListener Usage Example ### Description This example demonstrates how to create and use a MetadataListener to receive property updates. The listener is registered with a callback function that prints details about the metadata change. ### Method This is an example of how to use the `add_listener_local` method to create a listener. ### Endpoint N/A (SDK method) ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example ```rust let metadata_listener = metadata.add_listener_local() .property(|subject, key, type_, value| { println!("Metadata property update: subject {subject}, key {key:?}, type {type_:?}, value {value:?}"); 0 }) .register(); ``` ### Response #### Success Response (0) Indicates successful registration or callback execution. #### Response Example ```json 0 ``` ``` -------------------------------- ### Install Marshal Function on Proxy Source: https://pipewire.pages.freedesktop.org/pipewire-rs/pipewire_sys/fn.pw_proxy_install_marshal.html Use this function to install a marshal function on a given proxy. The `implementor` flag determines if it's for an implementor or a client. ```rust pub unsafe extern "C" fn pw_proxy_install_marshal( proxy: *mut pw_proxy, implementor: bool, ) -> c_int ``` -------------------------------- ### pw_proxy_install_marshal Source: https://pipewire.pages.freedesktop.org/pipewire-rs/pipewire_sys/index.html Install a marshal function on a proxy. ```APIDOC ## pw_proxy_install_marshal ### Description Install a marshal function on a proxy. ### Method Not specified (likely a C function call) ### Endpoint Not applicable ``` -------------------------------- ### Install Marshal Function on Resource Source: https://pipewire.pages.freedesktop.org/pipewire-rs/pipewire_sys/fn.pw_resource_install_marshal.html Use this function to install a marshal function on a PipeWire resource. This is an unsafe operation and requires a valid `pw_resource` pointer. ```rust pub unsafe extern "C" fn pw_resource_install_marshal( resource: *mut pw_resource, implementor: bool, ) -> c_int ``` -------------------------------- ### Starting the ThreadLoop Source: https://pipewire.pages.freedesktop.org/pipewire-rs/pipewire/thread_loop/struct.ThreadLoop.html Starts the ThreadLoop, initiating the execution of the wrapped loop in a new thread. ```rust pub fn start(&self) ``` -------------------------------- ### pw_protocol_get_implementation Source: https://pipewire.pages.freedesktop.org/pipewire-rs/pipewire_sys/index.html Get the implementation of a protocol. ```APIDOC ## pw_protocol_get_implementation ### Description Get the implementation of a protocol. ### Method Not specified (likely a C function call) ### Endpoint Not applicable ``` -------------------------------- ### pw_resource_install_marshal Source: https://pipewire.pages.freedesktop.org/pipewire-rs/pipewire_sys/fn.pw_resource_install_marshal.html Installs a marshal function on a resource. This is an unsafe C function. ```APIDOC ## pw_resource_install_marshal ### Description Installs a marshal function on a resource. ### Signature ``` pub unsafe extern "C" fn pw_resource_install_marshal( resource: *mut pw_resource, implementor: bool, ) -> c_int ``` ### Parameters * **resource** (*mut pw_resource) - A pointer to the resource. * **implementor** (bool) - A boolean indicating if the resource is an implementor. ### Returns * (c_int) - An integer indicating success or failure. ``` -------------------------------- ### MainLoopBox::new Source: https://pipewire.pages.freedesktop.org/pipewire-rs/pipewire/main_loop/struct.MainLoopBox.html Initializes PipeWire and creates a new `MainLoopBox` with optional properties. ```APIDOC ## MainLoopBox::new ### Description Initializes Pipewire and create a new `MainLoopBox`. ### Signature `pub fn new(properties: Option<&DictRef>) -> Result` ### Parameters * `properties` (Option<&DictRef>) - Optional dictionary of properties for initialization. ``` -------------------------------- ### Create and Register a Device Listener Source: https://pipewire.pages.freedesktop.org/pipewire-rs/pipewire/device/struct.DeviceListenerLocalBuilder.html Use `Device::add_listener_local` to create a builder, set callbacks for device info and parameters, and then register the listener. ```rust let device_listener = device.add_listener_local() .info(|info| println!("New device info: {info:?}")) .param(|seq, param_type, index, next, param| { println!("New device param: seq {seq}, param type {param_type:?}, index {index}, next {next}, param {:?}", param.map(Pod::as_bytes)); }) .register(); ``` -------------------------------- ### Get Client Permissions Source: https://pipewire.pages.freedesktop.org/pipewire-rs/pipewire_sys/struct.pw_client_methods.html The `get_permissions` method retrieves the permissions for a client, starting from a specified index. A permissions event will be emitted with the results. This requires W and X permissions on the client. ```rust pub get_permissions: Option c_int> ``` -------------------------------- ### Registering the listener Source: https://pipewire.pages.freedesktop.org/pipewire-rs/pipewire/core/struct.ListenerLocalBuilder.html Finalizes the listener setup by subscribing to events and registering all provided callbacks. ```APIDOC ## pub fn register(self) -> Listener Subscribe to events and register any provided callbacks. ``` -------------------------------- ### Raw Get Bit Range from __BindgenBitfieldUnit Source: https://pipewire.pages.freedesktop.org/pipewire-rs/pipewire_sys/struct.__BindgenBitfieldUnit.html An unsafe function to retrieve a sequence of bits starting from `bit_offset` with a width of `bit_width`. Use with caution, ensuring the pointer, offset, and width are valid. ```rust pub unsafe fn raw_get( this: *const Self, bit_offset: usize, bit_width: u8, ) -> u64 ``` -------------------------------- ### Get Bit Range from __BindgenBitfieldUnit Source: https://pipewire.pages.freedesktop.org/pipewire-rs/pipewire_sys/struct.__BindgenBitfieldUnit.html Safely retrieves a sequence of bits starting from `bit_offset` with a width of `bit_width`. Returns the value as a `u64`. Requires the Storage type to implement `AsRef<[u8]>` and `AsMut<[u8]>`. ```rust pub fn get(&self, bit_offset: usize, bit_width: u8) -> u64 ``` -------------------------------- ### Start Conversation with Server (hello) Source: https://pipewire.pages.freedesktop.org/pipewire-rs/pipewire_sys/struct.pw_core_methods.html Initiates a conversation with the PipeWire server, sending core information and potentially resetting client resources. Requires 'X' permissions on the core. ```rust pub hello: Option c_int>, ``` -------------------------------- ### MainLoopRc::new Source: https://pipewire.pages.freedesktop.org/pipewire-rs/pipewire/main_loop/struct.MainLoopRc.html Initializes PipeWire and creates a new MainLoopRc with optional properties. ```APIDOC ## pub fn new(properties: Option<&DictRef>) -> Result ### Description Initialize Pipewire and create a new `MainLoopRc` ### Parameters #### Query Parameters - **properties** (Option<&DictRef>) - Optional - Configuration properties for the main loop. ``` -------------------------------- ### Get Filter Properties - Rust Source: https://pipewire.pages.freedesktop.org/pipewire-rs/pipewire_sys/fn.pw_filter_get_properties.html Retrieves the properties of a PipeWire filter. Pass NULL for port_data to get global properties. ```rust pub unsafe extern "C" fn pw_filter_get_properties( filter: *mut pw_filter, port_data: *mut c_void, ) -> *const pw_properties ``` -------------------------------- ### Connect to PipeWire Instance - C Source: https://pipewire.pages.freedesktop.org/pipewire-rs/pipewire_sys/fn.pw_context_connect.html Use this function to connect to a PipeWire instance. It takes an optional properties argument and returns a pw_core object. Ensure proper error handling as it returns NULL on failure. ```c pub unsafe extern "C" fn pw_context_connect( context: *mut pw_context, properties: *mut pw_properties, user_data_size: usize, ) -> *mut pw_core ``` -------------------------------- ### Get Control Parent Port - Rust Source: https://pipewire.pages.freedesktop.org/pipewire-rs/pipewire_sys/fn.pw_control_get_port.html Use this function to get the control parent port. Returns NULL if not set. ```rust pub unsafe extern "C" fn pw_control_get_port( control: *mut pw_control, ) -> *mut pw_impl_port ``` -------------------------------- ### Creating Empty and All Flags Source: https://pipewire.pages.freedesktop.org/pipewire-rs/pipewire/client/struct.ClientChangeMask.html Use `empty()` to get a flags value with no bits set, and `all()` to get a flags value with all known bits set. ```rust pub const fn empty() -> Self ``` ```rust pub const fn all() -> Self ``` -------------------------------- ### Create and Register a Link Listener Source: https://pipewire.pages.freedesktop.org/pipewire-rs/pipewire/link/struct.LinkListenerLocalBuilder.html Use `add_listener_local` to create a builder for link event callbacks. Then, chain methods like `info` to set specific event handlers. Finally, call `register` to subscribe to events and obtain a `LinkListener`. ```rust let link_listener = link.add_listener_local() .info(|info| println!("New link info: {info:?}")) .register(); ``` -------------------------------- ### Get Filter State - Rust Source: https://pipewire.pages.freedesktop.org/pipewire-rs/pipewire_sys/fn.pw_filter_get_state.html Use this function to get the current state of a filter. Since version 1.4, it also sets errno on PW_FILTER_STATE_ERROR. ```rust pub unsafe extern "C" fn pw_filter_get_state( filter: *mut pw_filter, error: *mut *const c_char, ) -> pw_filter_state ``` -------------------------------- ### ContextBox::new Source: https://pipewire.pages.freedesktop.org/pipewire-rs/pipewire/context/struct.ContextBox.html Creates a new ContextBox with optional properties, managing a PipeWire context. ```APIDOC ## ContextBox::new ### Description Creates a new `ContextBox` with optional properties, managing a PipeWire context. ### Signature ```rust pub fn new( loop_: &'l Loop, properties: Option, ) -> Result, Error> ``` ### Parameters * `loop_`: A reference to the `Loop` to associate with the context. * `properties`: Optional `PropertiesBox` for initial context properties. ``` -------------------------------- ### Create and Access PropertiesBox Source: https://pipewire.pages.freedesktop.org/pipewire-rs/pipewire/properties/struct.PropertiesBox.html Demonstrates how to create a PropertiesBox using the properties! macro and access its stored values by key. ```rust use pipewire::{properties::{properties, PropertiesBox}}; let props = properties!{ "Key" => "Value", "OtherKey" => "OtherValue" }; assert_eq!(Some("Value"), props.get("Key")); assert_eq!(Some("OtherValue"), props.get("OtherKey")); ``` -------------------------------- ### ProxyListener Source: https://pipewire.pages.freedesktop.org/pipewire-rs/pipewire/proxy/struct.ProxyListener.html An owned listener for proxy events. This is created by `ProxyListenerLocalBuilder` and will receive events as long as it is alive. When this gets dropped, the listener gets unregistered and no events will be received by it. ```APIDOC ## Struct ProxyListener ### Description An owned listener for proxy events. This is created by `ProxyListenerLocalBuilder` and will receive events as long as it is alive. When this gets dropped, the listener gets unregistered and no events will be received by it. ### Source ```rust pub struct ProxyListener { /* private fields */ } ``` ``` -------------------------------- ### Create Basic PipeWire Objects with Box Source: https://pipewire.pages.freedesktop.org/pipewire-rs/pipewire/index.html Demonstrates the creation of essential PipeWire objects using Box smart pointers. Ensure dependencies outlive the objects they are used with. ```rust use pipewire::{main_loop::MainLoopBox, context::ContextBox}; fn main() -> Result<(), Box> { let mainloop = MainLoopBox::new(None)?; let context = ContextBox::new(&mainloop.loop_(), None)?; let core = context.connect(None)?; let registry = core.get_registry()?; Ok(()) } ``` -------------------------------- ### Create PipeWire Client - pw_context_create_client Source: https://pipewire.pages.freedesktop.org/pipewire-rs/pipewire_sys/fn.pw_context_create_client.html This function creates a new client. It is primarily intended for use by protocols. Ensure that the core, protocol, and properties pointers are valid. ```c pub unsafe extern "C" fn pw_context_create_client( core: *mut pw_impl_core, protocol: *mut pw_protocol, properties: *mut pw_properties, user_data_size: usize, ) -> *mut pw_impl_client ``` -------------------------------- ### FactoryListener Source: https://pipewire.pages.freedesktop.org/pipewire-rs/pipewire/factory/struct.FactoryListener.html An owned listener for factory events. This is created by `FactoryListenerLocalBuilder` and will receive events as long as it is alive. When this gets dropped, the listener gets unregistered and no events will be received by it. ```APIDOC ## Struct FactoryListener ### Description An owned listener for factory events. This is created by `FactoryListenerLocalBuilder` and will receive events as long as it is alive. When this gets dropped, the listener gets unregistered and no events will be received by it. ### Fields ```rust pub struct FactoryListener { /* private fields */ } ``` ``` -------------------------------- ### Core Initialization and Logging Source: https://pipewire.pages.freedesktop.org/pipewire-rs/pipewire_sys/all.html Functions for initializing PipeWire and managing logging. ```APIDOC ## Core Initialization and Logging ### pw_init Initializes the PipeWire core. ### pw_log_get Gets the current log level. ### pw_log_log Logs a message. ### pw_log_logt Logs a message with a topic. ### pw_log_logtv Logs a formatted message with a topic and arguments. ### pw_log_logv Logs a formatted message with arguments. ### pw_log_set Sets the log level. ### pw_log_set_level Sets the log level. ### pw_log_set_level_string Sets the log level from a string. ### pw_log_topic_register Registers a log topic. ### pw_log_topic_unregister Unregisters a log topic. ``` -------------------------------- ### ClientListener Source: https://pipewire.pages.freedesktop.org/pipewire-rs/pipewire/client/struct.ClientListener.html An owned listener for client events. This is created by `ClientListenerLocalBuilder` and will receive events as long as it is alive. When this gets dropped, the listener gets unregistered and no events will be received by it. ```APIDOC ```rust pub struct ClientListener { /* private fields */ } ``` ``` -------------------------------- ### pw_init Source: https://pipewire.pages.freedesktop.org/pipewire-rs/pipewire_sys/fn.pw_init.html Initializes the PipeWire library. This function must be called before any other PipeWire functions. ```APIDOC ## pw_init ### Description Initializes the PipeWire library. This function must be called before any other PipeWire functions. ### Signature ``` pub unsafe extern "C" fn pw_init( argc: *mut c_int, argv: *mut *mut *mut c_char, ) ``` ### Parameters * **argc** (*mut c_int*) - A pointer to the number of arguments. * **argv** (*mut *mut *mut c_char*) - A pointer to the argument vector. ``` -------------------------------- ### Option::or Example Source: https://pipewire.pages.freedesktop.org/pipewire-rs/pipewire_sys/type.pw_global_bind_func_t.html Demonstrates `or` which returns the first Option if it is `Some`, otherwise returns the second Option. Arguments are eagerly evaluated. ```rust let x = Some(2); let y = None; assert_eq!(x.or(y), Some(2)); ``` ```rust let x = None; let y = Some(100); assert_eq!(x.or(y), Some(100)); ``` ```rust let x = Some(2); let y = Some(100); assert_eq!(x.or(y), Some(2)); ``` ```rust let x: Option = None; let y = None; assert_eq!(x.or(y), None); ``` -------------------------------- ### Create and Register Core Event Listener Source: https://pipewire.pages.freedesktop.org/pipewire-rs/pipewire/core/struct.ListenerLocalBuilder.html Use `Core::add_listener_local` to create a builder, chain callbacks, and then call `register` to obtain a `core::Listener`. This example shows how to register info, done, and error callbacks. ```rust let core_listener = core.add_listener_local() .info(|info| println!("New core info: {info:?}")) .done(|id, seq| println!("Object {id} received done with seq {seq:?}")) .error(|id, seq, res, message| { println!("Object {id} received error with seq {seq:?}, error code {res} and message {message}") }) .register(); ``` -------------------------------- ### type_id Source: https://pipewire.pages.freedesktop.org/pipewire-rs/pipewire/permissions/struct.PermissionFlags.html Gets the `TypeId` of the PermissionFlags. ```APIDOC ## fn type_id(&self) -> TypeId Gets the `TypeId` of `self`. ``` -------------------------------- ### Initialize PipeWire Source: https://pipewire.pages.freedesktop.org/pipewire-rs/pipewire/fn.init.html Initializes the PipeWire system. Debugging can be enabled via the `PIPEWIRE_DEBUG` environment variable. ```APIDOC ## init() ### Description Initialize the PipeWire system and set up debugging through the environment variable `PIPEWIRE_DEBUG`. ### Signature ```rust pub fn init() ``` ``` -------------------------------- ### pw_resource_get_permissions Source: https://pipewire.pages.freedesktop.org/pipewire-rs/pipewire_sys/index.html Get the permissions of this resource. ```APIDOC ## pw_resource_get_permissions ### Description Get the permissions of this resource. ### Method Not specified (likely a C function call) ### Endpoint Not applicable ``` -------------------------------- ### DeviceChangeMask Initialization Source: https://pipewire.pages.freedesktop.org/pipewire-rs/pipewire/device/struct.DeviceChangeMask.html Methods for creating and initializing DeviceChangeMask instances. ```APIDOC ## DeviceChangeMask Initialization ### `empty()` `pub const fn empty() -> Self` Get a flags value with all bits unset. ### `all()` `pub const fn all() -> Self` Get a flags value with all known bits set. ### `from_bits(bits: u64) -> Option` `pub const fn from_bits(bits: u64) -> Option` Convert from a bits value. This method will return `None` if any unknown bits are set. ### `from_bits_truncate(bits: u64) -> Self` `pub const fn from_bits_truncate(bits: u64) -> Self` Convert from a bits value, unsetting any unknown bits. ### `from_bits_retain(bits: u64) -> Self` `pub const fn from_bits_retain(bits: u64) -> Self` Convert from a bits value exactly. ### `from_name(name: &str) -> Option` `pub fn from_name(name: &str) -> Option` Get a flags value with the bits of a flag with the given name set. This method will return `None` if `name` is empty or doesn’t correspond to any named flag. ``` -------------------------------- ### pw_proxy_get_object_listeners Source: https://pipewire.pages.freedesktop.org/pipewire-rs/pipewire_sys/index.html Get the listeners of a proxy. ```APIDOC ## pw_proxy_get_object_listeners ### Description Get the listeners of a proxy. ### Method Not specified (likely a C function call) ### Endpoint Not applicable ``` -------------------------------- ### Initialize PipeWire System Source: https://pipewire.pages.freedesktop.org/pipewire-rs/pipewire/fn.init.html Call this function to initialize the PipeWire system. Debugging can be enabled by setting the `PIPEWIRE_DEBUG` environment variable. ```rust pub fn init() ``` -------------------------------- ### Create ClientInfo from Raw Pointer Source: https://pipewire.pages.freedesktop.org/pipewire-rs/pipewire/client/struct.ClientInfo.html Constructs a ClientInfo instance from a raw pointer to a pw_client_info structure. Ensure the pointer is valid. ```rust pub fn from_raw(raw: *mut pw_client_info) -> Self ``` -------------------------------- ### pw_protocol_get_extension Source: https://pipewire.pages.freedesktop.org/pipewire-rs/pipewire_sys/index.html Get an extension from a protocol. ```APIDOC ## pw_protocol_get_extension ### Description Get an extension from a protocol. ### Method Not specified (likely a C function call) ### Endpoint Not applicable ``` -------------------------------- ### pw_core_get_properties Source: https://pipewire.pages.freedesktop.org/pipewire-rs/pipewire_sys/index.html Gets properties from the core. ```APIDOC ## pw_core_get_properties ### Description Get properties from the core ### Method N/A (Function Call) ### Endpoint N/A ### Parameters N/A ### Request Example N/A ### Response N/A ``` -------------------------------- ### Creating and Registering a Client Listener Source: https://pipewire.pages.freedesktop.org/pipewire-rs/pipewire/client/struct.ClientListenerLocalBuilder.html Use `Client::add_listener_local` to create a builder for registering client event callbacks. Callbacks can be set for info and permissions, and then registered using `.register()`. ```rust let client_listener = client.add_listener_local() .info(|info| println!("New client info: {info:?}")) .permissions(|index, permissions| { println!("New client permissions: index {index}, permissions {permissions:?}"); }) .register(); ``` -------------------------------- ### pw_context_get_properties Source: https://pipewire.pages.freedesktop.org/pipewire-rs/pipewire_sys/index.html Gets the context properties. ```APIDOC ## pw_context_get_properties ### Description Get the context properties ### Method N/A (Function Call) ### Endpoint N/A ### Parameters N/A ### Request Example N/A ### Response N/A ``` -------------------------------- ### Option::insert Example Source: https://pipewire.pages.freedesktop.org/pipewire-rs/pipewire_sys/type.pw_global_bind_func_t.html Demonstrates `insert` which places a value into the Option, replacing any existing value and returning a mutable reference to the new value. ```rust let mut opt = None; let val = opt.insert(1); assert_eq!(*val, 1); assert_eq!(opt.unwrap(), 1); let val = opt.insert(2); assert_eq!(*val, 2); *val = 3; assert_eq!(opt.unwrap(), 3); ``` -------------------------------- ### pw_context_get_object Source: https://pipewire.pages.freedesktop.org/pipewire-rs/pipewire_sys/index.html Gets an object from the context. ```APIDOC ## pw_context_get_object ### Description get an object from the context ### Method N/A (Function Call) ### Endpoint N/A ### Parameters N/A ### Request Example N/A ### Response N/A ``` -------------------------------- ### enter Source: https://pipewire.pages.freedesktop.org/pipewire-rs/pipewire/loop_/struct.Loop.html Enters the loop, preparing it for an iteration. This should be paired with a call to `leave`. ```APIDOC pub unsafe fn enter(&self) ``` -------------------------------- ### T::type_id Source: https://pipewire.pages.freedesktop.org/pipewire-rs/pipewire_sys/struct.pw_context.html Gets the `TypeId` of the type. ```APIDOC ## fn type_id(&self) -> TypeId ### Description Gets the `TypeId` of `self`. ### Method type_id ``` -------------------------------- ### Implement Clone for pw_client_info Source: https://pipewire.pages.freedesktop.org/pipewire-rs/pipewire_sys/bindings/struct.pw_client_info.html Provides methods for cloning and copying pw_client_info instances. This allows for creating duplicates of client information. ```rust impl Clone for pw_client_info { fn clone(&self) -> pw_client_info { // ... implementation details ... } fn clone_from(&mut self, source: &Self) { // ... implementation details ... } } ``` -------------------------------- ### DeviceInfo Constructors and Raw Pointer Conversions Source: https://pipewire.pages.freedesktop.org/pipewire-rs/pipewire/device/struct.DeviceInfo.html Provides methods for creating a DeviceInfo instance from a raw pointer and converting it back to a raw pointer. ```APIDOC ## DeviceInfo ### Constructors and Raw Pointer Conversions #### `pub fn new(ptr: NonNull) -> Self` Creates a new `DeviceInfo` instance from a non-null raw pointer. #### `pub fn from_raw(raw: *mut pw_device_info) -> Self` Creates a new `DeviceInfo` instance from a raw pointer. #### `pub fn into_raw(self) -> *mut pw_device_info` Consumes the `DeviceInfo` instance and returns its raw pointer. ``` -------------------------------- ### pw_impl_module_get_global Source: https://pipewire.pages.freedesktop.org/pipewire-rs/pipewire_sys/fn.pw_impl_module_get_global.html Get the global of a module. ```APIDOC ## pw_impl_module_get_global ### Description Get the global of a module. ### Signature ``` pub unsafe extern "C" fn pw_impl_module_get_global( module: *mut pw_impl_module, ) -> *mut pw_global ``` ### Parameters #### Path Parameters - **module** (*mut pw_impl_module) - Description of the module parameter. ``` -------------------------------- ### ClientInfo Creation and Conversion Source: https://pipewire.pages.freedesktop.org/pipewire-rs/pipewire/client/struct.ClientInfo.html Methods for creating a ClientInfo instance from a raw pointer and converting it back. ```APIDOC ## ClientInfo ### Description Represents information about a client. ### Methods #### `new(ptr: NonNull) -> Self` Creates a new `ClientInfo` from a non-null raw pointer. #### `from_raw(raw: *mut pw_client_info) -> Self` Creates a new `ClientInfo` from a raw pointer. #### `into_raw(self) -> *mut pw_client_info` Consumes the `ClientInfo` and returns its raw pointer. ``` -------------------------------- ### pw_impl_core_get_info Source: https://pipewire.pages.freedesktop.org/pipewire-rs/pipewire_sys/fn.pw_impl_core_get_info.html Get the core information. ```APIDOC ## Function pw_impl_core_get_info ### Description Get the core information. ### Signature ``` pub unsafe extern "C" fn pw_impl_core_get_info( core: *mut pw_impl_core, ) -> *const pw_core_info ``` ``` -------------------------------- ### pw_impl_client_get_info Source: https://pipewire.pages.freedesktop.org/pipewire-rs/pipewire_sys/fn.pw_impl_client_get_info.html Get the client information. ```APIDOC ## pw_impl_client_get_info ### Description Get the client information. ### Signature ``` pub unsafe extern "C" fn pw_impl_client_get_info( client: *mut pw_impl_client, ) -> *const pw_client_info ``` ``` -------------------------------- ### LinkChangeMask Initialization Source: https://pipewire.pages.freedesktop.org/pipewire-rs/pipewire/link/struct.LinkChangeMask.html Methods for creating new LinkChangeMask instances. ```APIDOC ## LinkChangeMask Initialization ### `empty()` `pub const fn empty() -> Self` Get a flags value with all bits unset. ### `all()` `pub const fn all() -> Self` Get a flags value with all known bits set. ### `from_bits(bits: u64)` `pub const fn from_bits(bits: u64) -> Option` Convert from a bits value. This method will return `None` if any unknown bits are set. ### `from_bits_truncate(bits: u64)` `pub const fn from_bits_truncate(bits: u64) -> Self` Convert from a bits value, unsetting any unknown bits. ### `from_bits_retain(bits: u64)` `pub const fn from_bits_retain(bits: u64) -> Self` Convert from a bits value exactly. ### `from_name(name: &str)` `pub fn from_name(name: &str) -> Option` Get a flags value with the bits of a flag with the given name set. This method will return `None` if `name` is empty or doesn’t correspond to any named flag. ``` -------------------------------- ### StreamRc::properties Source: https://pipewire.pages.freedesktop.org/pipewire-rs/pipewire/stream/struct.StreamRc.html Gets the properties of the stream. ```APIDOC ## StreamRc::properties ### Description Get the properties of the stream. ### Method pub fn properties(&self) -> &Properties ### Response #### Success Response (&Properties) - **&Properties** - A reference to the stream's properties. ``` -------------------------------- ### StreamRc::name Source: https://pipewire.pages.freedesktop.org/pipewire-rs/pipewire/stream/struct.StreamRc.html Gets the name of the stream. ```APIDOC ## StreamRc::name ### Description Get the name of the stream. ### Method pub fn name(&self) -> String ### Response #### Success Response (String) - **String** - The name of the stream. ``` -------------------------------- ### Create Basic PipeWire Objects with Rc Source: https://pipewire.pages.freedesktop.org/pipewire-rs/pipewire/index.html Shows how to create PipeWire objects using Rc smart pointers for reference counting. This approach automatically manages object dependencies. ```rust use pipewire::{main_loop::MainLoopRc, context::ContextRc}; fn main() -> Result<(), Box> { let mainloop = MainLoopRc::new(None)?; let context = ContextRc::new(&mainloop, None)?; let core = context.connect_rc(None)?; let registry = core.get_registry_rc()?; Ok(()) } ``` -------------------------------- ### Any::type_id Source: https://pipewire.pages.freedesktop.org/pipewire-rs/pipewire/loop_/struct.Signal.html Gets the `TypeId` of the Signal instance. ```APIDOC #### fn type_id(&self) -> TypeId ### Description Gets the `TypeId` of `self`. ### Method `type_id` ``` -------------------------------- ### PortChangeMask Initialization Methods Source: https://pipewire.pages.freedesktop.org/pipewire-rs/pipewire/port/struct.PortChangeMask.html Provides methods to create new PortChangeMask instances, including empty, all bits set, and from raw bits or names. ```rust pub const fn empty() -> Self ``` ```rust pub const fn all() -> Self ``` ```rust pub const fn from_bits(bits: u64) -> Option ``` ```rust pub const fn from_bits_truncate(bits: u64) -> Self ``` ```rust pub const fn from_bits_retain(bits: u64) -> Self ``` ```rust pub fn from_name(name: &str) -> Option ``` -------------------------------- ### ContextBox::from_raw Source: https://pipewire.pages.freedesktop.org/pipewire-rs/pipewire/context/struct.ContextBox.html Creates a ContextBox by taking ownership of a raw PipeWire context pointer. ```APIDOC ## ContextBox::from_raw ### Description Creates a `ContextBox` by taking ownership of a raw `pw_context`. ### Signature ```rust pub unsafe fn from_raw(raw: NonNull) -> ContextBox<'l> ``` ### Safety The provided pointer must point to a valid, well aligned `pw_context`. The raw context must not be manually destroyed or moved, as the new `ContextBox` takes ownership of it. The lifetime of the returned box is unbounded. The caller is responsible to make sure that the loop used with this context outlives the context. ``` -------------------------------- ### pw_resource_get_user_data Source: https://pipewire.pages.freedesktop.org/pipewire-rs/pipewire_sys/index.html Get the user data for the resource. ```APIDOC ## pw_resource_get_user_data ### Description Get the user data for the resource, the size was given in pw_resource_new. ### Method Not specified (likely a C function call) ### Endpoint Not applicable ``` -------------------------------- ### register Source: https://pipewire.pages.freedesktop.org/pipewire-rs/pipewire/device/struct.DeviceListenerLocalBuilder.html Subscribe to events and register any provided callbacks, returning a `DeviceListener`. ```APIDOC ## pub fn register(self) -> DeviceListener Subscribe to events and register any provided callbacks. ``` -------------------------------- ### pw_resource_get_client Source: https://pipewire.pages.freedesktop.org/pipewire-rs/pipewire_sys/index.html Get the client owning this resource. ```APIDOC ## pw_resource_get_client ### Description Get the client owning this resource. ### Method Not specified (likely a C function call) ### Endpoint Not applicable ``` -------------------------------- ### pw_proxy_new Source: https://pipewire.pages.freedesktop.org/pipewire-rs/pipewire_sys/index.html Create a new proxy. ```APIDOC ## pw_proxy_new ### Description Create a new proxy. ### Method Not specified (likely a C function call) ### Endpoint Not applicable ``` -------------------------------- ### pw_proxy_get_user_data Source: https://pipewire.pages.freedesktop.org/pipewire-rs/pipewire_sys/index.html Get the user data for the proxy. ```APIDOC ## pw_proxy_get_user_data ### Description Get the user data for the proxy. The size was given in pw_proxy_new. ### Method Not specified (likely a C function call) ### Endpoint Not applicable ``` -------------------------------- ### pw_proxy_get_marshal Source: https://pipewire.pages.freedesktop.org/pipewire-rs/pipewire_sys/index.html Get the marshal functions for the proxy. ```APIDOC ## pw_proxy_get_marshal ### Description Get the marshal functions for the proxy. ### Method Not specified (likely a C function call) ### Endpoint Not applicable ``` -------------------------------- ### pw_protocol_get_user_data Source: https://pipewire.pages.freedesktop.org/pipewire-rs/pipewire_sys/index.html Get the user data for a protocol. ```APIDOC ## pw_protocol_get_user_data ### Description Get the user data for a protocol. ### Method Not specified (likely a C function call) ### Endpoint Not applicable ``` -------------------------------- ### pw_context_get_user_data Source: https://pipewire.pages.freedesktop.org/pipewire-rs/pipewire_sys/index.html Gets the context user data. ```APIDOC ## pw_context_get_user_data ### Description Get the context user data ### Method N/A (Function Call) ### Endpoint N/A ### Parameters N/A ### Request Example N/A ### Response N/A ``` -------------------------------- ### pw_context_get_support Source: https://pipewire.pages.freedesktop.org/pipewire-rs/pipewire_sys/index.html Gets the context support objects. ```APIDOC ## pw_context_get_support ### Description Get the context support objects ### Method N/A (Function Call) ### Endpoint N/A ### Parameters N/A ### Request Example N/A ### Response N/A ``` -------------------------------- ### Create New ContextBox Source: https://pipewire.pages.freedesktop.org/pipewire-rs/pipewire/context/struct.ContextBox.html Creates a new ContextBox, taking ownership of a PipeWire context. Requires a Loop and optional PropertiesBox. ```rust pub fn new( loop_: &'l Loop, properties: Option, ) -> Result, Error> ``` -------------------------------- ### pw_resource_get_protocol Source: https://pipewire.pages.freedesktop.org/pipewire-rs/pipewire_sys/fn.pw_resource_get_protocol.html Get the protocol used for this resource. ```APIDOC ## pw_resource_get_protocol ### Description Get the protocol used for this resource. ### Signature ``` pub unsafe extern "C" fn pw_resource_get_protocol( resource: *mut pw_resource, ) -> *mut pw_protocol ``` ``` -------------------------------- ### pw_conf_load_conf_for_context Source: https://pipewire.pages.freedesktop.org/pipewire-rs/pipewire_sys/fn.pw_conf_load_conf_for_context.html Loads configuration from `conf` into `props` for the current context. ```APIDOC ## pw_conf_load_conf_for_context ### Description Loads configuration properties from a `pw_properties` structure into another `pw_properties` structure, typically associated with a PipeWire context. This function is part of the low-level configuration API. ### Signature ```c pub unsafe extern "C" fn pw_conf_load_conf_for_context( props: *mut pw_properties, conf: *mut pw_properties, ) -> c_int ``` ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Parameters - **props** (*mut pw_properties) - A pointer to the properties structure to load configuration into. - **conf** (*mut pw_properties) - A pointer to the properties structure containing the configuration to load. ### Return Value - **c_int** - Returns 0 on success, or a negative error code on failure. ``` -------------------------------- ### pw_resource_get_marshal Source: https://pipewire.pages.freedesktop.org/pipewire-rs/pipewire_sys/fn.pw_resource_get_marshal.html Get the marshal functions for the resource. ```APIDOC ## pw_resource_get_marshal ### Description Get the marshal functions for the resource. ### Signature ```c pub unsafe extern "C" fn pw_resource_get_marshal( resource: *mut pw_resource, ) -> *const pw_protocol_marshal ``` ``` -------------------------------- ### pw_main_loop_new Source: https://pipewire.pages.freedesktop.org/pipewire-rs/pipewire_sys/fn.pw_main_loop_new.html Creates a new main loop with optional properties. ```APIDOC ## pw_main_loop_new ### Description Creates a new main loop. ### Signature ``` pub unsafe extern "C" fn pw_main_loop_new( props: *const spa_dict, ) -> *mut pw_main_loop ``` ### Parameters #### Path Parameters - **props** (*const spa_dict*) - Description: Optional properties for the main loop. ``` -------------------------------- ### pw_resource_get_id Source: https://pipewire.pages.freedesktop.org/pipewire-rs/pipewire_sys/fn.pw_resource_get_id.html Get the unique id of this resource. ```APIDOC ## pw_resource_get_id ### Description Get the unique id of this resource. ### Signature ``` pub unsafe extern "C" fn pw_resource_get_id( resource: *mut pw_resource, ) -> u32 ``` ### Parameters #### Path Parameters - **resource** (*mut pw_resource) - Description: A pointer to the pw_resource. ### Return Value - **u32** - The unique ID of the resource. ``` -------------------------------- ### LoopBox::new Source: https://pipewire.pages.freedesktop.org/pipewire-rs/pipewire/loop_/struct.LoopBox.html Creates a new LoopBox with optional properties. ```APIDOC ## LoopBox::new ### Description Create a new `LoopBox`. ### Signature `pub fn new(properties: Option<&DictRef>) -> Result` ### Parameters * `properties`: An optional reference to a `DictRef` containing properties for the new loop. ``` -------------------------------- ### Clone Implementation for pw_protocol_native_ext Source: https://pipewire.pages.freedesktop.org/pipewire-rs/pipewire_sys/struct.pw_protocol_native_ext.html Provides methods for cloning `pw_protocol_native_ext` instances. ```APIDOC ### impl Clone for pw_protocol_native_ext #### fn clone(&self) -> pw_protocol_native_ext Returns a duplicate of the value. #### fn clone_from(&mut self, source: &Self) Performs copy-assignment from `source`. ``` -------------------------------- ### pw_proxy_get_type Source: https://pipewire.pages.freedesktop.org/pipewire-rs/pipewire_sys/fn.pw_proxy_get_type.html Get the type and version of the proxy. ```APIDOC ## pw_proxy_get_type ### Description Get the type and version of the proxy. ### Signature ```rust pub unsafe extern "C" fn pw_proxy_get_type( proxy: *mut pw_proxy, version: *mut u32, ) -> *const c_char ``` ### Parameters * **proxy** (*mut pw_proxy) - A mutable pointer to a pw_proxy structure. * **version** (*mut u32) - A mutable pointer to a u32 where the version will be stored. ### Returns * (*const c_char) - A constant character pointer representing the type of the proxy. Returns NULL on error. ``` -------------------------------- ### MainLoopBox::from_raw Source: https://pipewire.pages.freedesktop.org/pipewire-rs/pipewire/main_loop/struct.MainLoopBox.html Creates a `MainLoopBox` from a raw `pw_main_loop` pointer, taking ownership. ```APIDOC ## MainLoopBox::from_raw ### Description Create a new main loop from a raw `pw_main_loop`, taking ownership of it. ### Signature `pub unsafe fn from_raw(ptr: NonNull) -> Self` ### Safety The provided pointer must point to a valid, well aligned `pw_main_loop`. The raw loop should not be manually destroyed or moved, as the new `MainLoopBox` takes ownership of it. ``` -------------------------------- ### pw_proxy_get_protocol Source: https://pipewire.pages.freedesktop.org/pipewire-rs/pipewire_sys/fn.pw_proxy_get_protocol.html Get the protocol used for the proxy. ```APIDOC ## pw_proxy_get_protocol ### Description Get the protocol used for the proxy. ### Signature ``` pub unsafe extern "C" fn pw_proxy_get_protocol( proxy: *mut pw_proxy, ) -> *mut pw_protocol ``` ``` -------------------------------- ### pw_proxy_get_id Source: https://pipewire.pages.freedesktop.org/pipewire-rs/pipewire_sys/fn.pw_proxy_get_id.html Get the local id of the proxy. ```APIDOC ## pw_proxy_get_id ### Description Get the local id of the proxy. ### Signature ``` pub unsafe extern "C" fn pw_proxy_get_id(proxy: *mut pw_proxy) -> u32 ``` ### Parameters #### Path Parameters - **proxy** (*mut pw_proxy) - Description: A pointer to the `pw_proxy` structure. ### Return Value - **u32** - The local id of the proxy. ``` -------------------------------- ### Module Init Function Signature Source: https://pipewire.pages.freedesktop.org/pipewire-rs/pipewire_sys/type.pw_impl_module_init_func_t.html This describes the expected signature for a module's initialization function. It should return 0 on success or a negative error code on failure. ```text Module init function signature \param module A \ref pw_impl_module \param args Arguments to the module \return 0 on success, < 0 otherwise with an errno style error ``` -------------------------------- ### pw_impl_link_get_input Source: https://pipewire.pages.freedesktop.org/pipewire-rs/pipewire_sys/fn.pw_impl_link_get_input.html Get the input port of the link. ```APIDOC ## pw_impl_link_get_input ### Description Get the input port of the link. ### Signature ``` pub unsafe extern "C" fn pw_impl_link_get_input( link: *mut pw_impl_link, ) -> *mut pw_impl_port ``` ### Parameters #### Path Parameters - **link** (*mut pw_impl_link*) - Description: A pointer to the `pw_impl_link` structure. ### Returns - **(*mut pw_impl_port*)** - A pointer to the input `pw_impl_port` of the link. ``` -------------------------------- ### Connect to PipeWire Context Source: https://pipewire.pages.freedesktop.org/pipewire-rs/pipewire/context/struct.Context.html Establishes a connection to the PipeWire context with optional properties. Returns a CoreBox representing the connected core, or an Error if the connection fails. ```rust pub fn connect( &self, properties: Option, ) -> Result, Error> ``` -------------------------------- ### pw_impl_link_get_output Source: https://pipewire.pages.freedesktop.org/pipewire-rs/pipewire_sys/fn.pw_impl_link_get_output.html Get the output port of the link. ```APIDOC ## pw_impl_link_get_output ### Description Get the output port of the link. ### Signature ``` pub unsafe extern "C" fn pw_impl_link_get_output( link: *mut pw_impl_link, ) -> *mut pw_impl_port ``` ### Parameters #### Path Parameters - **link** (*mut pw_impl_link) - Description: A pointer to the `pw_impl_link` structure. ### Returns - **(*mut pw_impl_port)** - A pointer to the output `pw_impl_port`. ``` -------------------------------- ### Copy Implementation for pw_protocol_native_ext Source: https://pipewire.pages.freedesktop.org/pipewire-rs/pipewire_sys/struct.pw_protocol_native_ext.html Indicates that `pw_protocol_native_ext` can be copied. ```APIDOC ### impl Copy for pw_protocol_native_ext ``` -------------------------------- ### pw_impl_client_find_resource Source: https://pipewire.pages.freedesktop.org/pipewire-rs/pipewire_sys/fn.pw_impl_client_find_resource.html Get a resource with the given id. ```APIDOC ## pw_impl_client_find_resource ### Description Get a resource with the given id. ### Signature ``` pub unsafe extern "C" fn pw_impl_client_find_resource( client: *mut pw_impl_client, id: u32, ) -> *mut pw_resource ``` ### Parameters #### Path Parameters - **client** (*mut pw_impl_client) - Description not available. - **id** (u32) - The ID of the resource to find. ### Returns - **(*mut pw_resource)** - A pointer to the found resource, or null if not found. ``` -------------------------------- ### ThreadLoopBox Initialization Source: https://pipewire.pages.freedesktop.org/pipewire-rs/pipewire/thread_loop/struct.ThreadLoopBox.html Methods for creating a new ThreadLoopBox instance. ```APIDOC ## `ThreadLoopBox::new` ### Description Initializes PipeWire and creates a new `ThreadLoopBox` with the given name and optional properties. ### Signature ```rust pub unsafe fn new(name: Option<&str>, properties: Option<&DictRef>) -> Result ``` ### Safety TODO ## `ThreadLoopBox::new_cstr` ### Description Initializes PipeWire and creates a new `ThreadLoopBox` with the given name as a C string, and optional properties. ### Signature ```rust pub unsafe fn new_cstr(name: Option<&CStr>, properties: Option<&DictRef>) -> Result ``` ### Safety TODO ## `ThreadLoopBox::from_raw` ### Description Creates a new thread loop from a raw `pw_thread_loop`, taking ownership of it. ### Signature ```rust pub unsafe fn from_raw(ptr: NonNull) -> Self ``` ### Safety The provided pointer must point to a valid, well aligned `pw_thread_loop`. The raw loop should not be manually destroyed or moved, as the new `ThreadLoopBox` takes ownership of it. ``` -------------------------------- ### pw_impl_client_get_core_resource Source: https://pipewire.pages.freedesktop.org/pipewire-rs/pipewire_sys/fn.pw_impl_client_get_core_resource.html Get the client core resource. ```APIDOC ## pw_impl_client_get_core_resource ### Description Get the client core resource. ### Signature ``` pub unsafe extern "C" fn pw_impl_client_get_core_resource( client: *mut pw_impl_client, ) -> *mut pw_resource ``` ### Parameters #### Path Parameters - **client** (*mut pw_impl_client) - Description of the client parameter ``` -------------------------------- ### pw_context_create_client Source: https://pipewire.pages.freedesktop.org/pipewire-rs/pipewire_sys/fn.pw_context_create_client.html Creates a new client. This is mainly used by protocols. ```APIDOC ## Function pw_context_create_client ### Description Create a new client. This is mainly used by protocols. ### Signature ``` pub unsafe extern "C" fn pw_context_create_client( core: *mut pw_impl_core, protocol: *mut pw_protocol, properties: *mut pw_properties, user_data_size: usize, ) -> *mut pw_impl_client ``` ### Parameters * **core** (*mut pw_impl_core) - A pointer to the core implementation. * **protocol** (*mut pw_protocol) - A pointer to the protocol. * **properties** (*mut pw_properties) - A pointer to the properties. * **user_data_size** (usize) - The size of user data. ### Returns * (*mut pw_impl_client) - A pointer to the newly created client implementation. ``` -------------------------------- ### pw_global_get_version Source: https://pipewire.pages.freedesktop.org/pipewire-rs/pipewire_sys/fn.pw_global_get_version.html Get the global version of PipeWire. ```APIDOC ## pw_global_get_version ### Description Get the global version. ### Signature ``` pub unsafe extern "C" fn pw_global_get_version( global: *mut pw_global, ) -> u32 ``` ### Parameters #### Path Parameters - **global** (*mut pw_global) - Description of the global object. ``` -------------------------------- ### ContextBox::connect Source: https://pipewire.pages.freedesktop.org/pipewire-rs/pipewire/context/struct.ContextBox.html Connects to a PipeWire core with optional properties. ```APIDOC ## ContextBox::connect ### Description Connects to a PipeWire core with optional properties. ### Signature ```rust pub fn connect( &self, properties: Option, ) -> Result, Error> ``` ### Parameters * `properties`: Optional `PropertiesBox` for connection properties. ``` -------------------------------- ### Create a New Node - pw_context_create_node Source: https://pipewire.pages.freedesktop.org/pipewire-rs/pipewire_sys/fn.pw_context_create_node.html Use this function to create a new node in the PipeWire context. It requires a pointer to the context, properties for the new node, and the size of any user data to be associated. ```rust pub unsafe extern "C" fn pw_context_create_node( context: *mut pw_context, properties: *mut pw_properties, user_data_size: usize, ) -> *mut pw_impl_node ``` -------------------------------- ### ProxyListenerLocalBuilder Usage Source: https://pipewire.pages.freedesktop.org/pipewire-rs/pipewire/proxy/struct.ProxyListenerLocalBuilder.html Demonstrates how to create a ProxyListenerLocalBuilder and register various event callbacks. ```APIDOC ## ProxyListenerLocalBuilder A builder for registering proxy event callbacks. Use `Proxy::add_listener_local` to create this and register callbacks that will be called when events of interest occur. After adding callbacks, use `register` to get back a `ProxyListener`. ### Example Usage ```rust let proxy_listener = proxy.add_listener_local() .destroy(|| println!("Proxy has been destroyed")) .bound(|id| println!("Proxy has been bound to global {id}")) .removed(|| println!("Proxy has been removed")) .done(|seq| println!("Proxy received done with seq {seq}")) .error(|seq, res, message| println!("Proxy error: seq {seq}, error code {res}, message {message}")) .register(); ``` ``` -------------------------------- ### Create and Register Node Listener Source: https://pipewire.pages.freedesktop.org/pipewire-rs/pipewire/node/struct.NodeListenerLocalBuilder.html Use `Node::add_listener_local` to create a builder and register callbacks for node events. Call `register` to finalize the listener. ```rust let node_listener = node.add_listener_local() .info(|info| println!("New node info: {info:?}")) .param(|seq, param_type, index, next, param| { println!("New node param: seq {seq}, param type {param_type:?}, index {index}, next {next}, param {:?}", param.map(Pod::as_bytes)); }) .register(); ``` -------------------------------- ### pw_data_loop_start Source: https://pipewire.pages.freedesktop.org/pipewire-rs/pipewire_sys/fn.pw_data_loop_start.html Starts the processing thread for a data loop. ```APIDOC ## pw_data_loop_start ### Description Starts the processing thread. ### Signature ```rust pub unsafe extern "C" fn pw_data_loop_start( loop_: *mut pw_data_loop, ) -> c_int ``` ### Parameters #### Path Parameters - **loop_** (*mut pw_data_loop*) - Description: A pointer to the pw_data_loop to start. ``` -------------------------------- ### ThreadLoopRc::get_time Source: https://pipewire.pages.freedesktop.org/pipewire-rs/pipewire/thread_loop/struct.ThreadLoopRc.html Gets a `Timespec` suitable for `timed_wait_full()`. ```APIDOC ## ThreadLoopRc::get_time ### Description Get a timespec suitable for `timed_wait_full()`. ### Signature `pub fn get_time(&self, timeout: i64) -> Timespec` ```