From a5e5128740a8839476d43856fd9ea5596292e463 Mon Sep 17 00:00:00 2001 From: Vasiliy Doylov Date: Mon, 17 Mar 2025 21:50:10 +0300 Subject: [PATCH] WIP stuff Signed-off-by: Vasiliy Doylov --- data/io.gitlab.nekocwd.pipetap.gschema.xml | 2 + src/Wp-0.5.gir | 19473 +++++++++++++++++++ src/Wp-0.5.metadata | 6 + src/application.vala | 19 +- src/gui/exposure_slider.vala | 0 src/gui/main_bar.blp | 6 +- src/gui/main_bar.vala | 19 +- src/gui/slider_overlay.blp | 46 + src/gui/slider_overlay.vala | 55 + src/gui/window.blp | 6 +- src/gui/window.vala | 3 +- src/logic/ctrl.vala | 31 + src/logic/wireplumber.vala | 170 + src/main.vala | 3 + src/meson.build | 16 + src/pipetap.gresource.xml | 1 + src/style.css | 15 + 17 files changed, 19858 insertions(+), 13 deletions(-) create mode 100644 src/Wp-0.5.gir create mode 100644 src/Wp-0.5.metadata create mode 100644 src/gui/exposure_slider.vala create mode 100644 src/gui/slider_overlay.blp create mode 100644 src/gui/slider_overlay.vala create mode 100644 src/logic/ctrl.vala create mode 100644 src/logic/wireplumber.vala diff --git a/data/io.gitlab.nekocwd.pipetap.gschema.xml b/data/io.gitlab.nekocwd.pipetap.gschema.xml index 9876709..d6a0618 100644 --- a/data/io.gitlab.nekocwd.pipetap.gschema.xml +++ b/data/io.gitlab.nekocwd.pipetap.gschema.xml @@ -19,5 +19,7 @@ + + \ No newline at end of file diff --git a/src/Wp-0.5.gir b/src/Wp-0.5.gir new file mode 100644 index 0000000..eb5e596 --- /dev/null +++ b/src/Wp-0.5.gir @@ -0,0 +1,19473 @@ + + + + + + + + + + + + + + + + + + + + + + + An event hook that runs a WpTransition, implemented with closures. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + The WpClient class allows accessing the properties and methods of a PipeWire client object (struct pw_client). A WpClient is constructed internally when a new client connects to PipeWire and it is made available through the WpObjectManager API. + + + + Send an error to the client. + + + + + + + the client + + + + the global id to report the error on + + + + an errno style error code + + + + the error message string + + + + + + Update client's permissions on a list of objects. + + +An object id of -1 can be used to set the default object permissions for this client + + + + + + + the client + + + + the number of permissions specified in the variable arguments + + + + @n_perm pairs of guint32 numbers; the first number is the object id and the second is the permissions that this client should have on this object + + + + + + Update client's permissions on a list of objects. + + +An object id of -1 can be used to set the default object permissions for this client + + + + + + + the client + + + + the number of permissions specified in the @permissions array + + + + an array of permissions per object id + + + + + + + + Updates the properties of @self. + + +This requires W and X permissions on the client. + + + + + + + the client + + + + updates to apply to the properties of @self; this does not need to include properties that have not changed + + + + + + + + + + + + + An interface that provides the ability to load components. +Components can be: + - WirePlumber modules (libraries that provide WpPlugin and WpSiFactory objects) + - Scripts (ex. lua scripts) + +The WirePlumber library provides built-in support for loading WirePlumber modules, without a component loader. For other kinds of components, a component loader is meant to be provided in by some WirePlumber module. For Lua scripts specifically, a component loader is provided by the lua scripting module. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + WpConf allows accessing the different sections of the wireplumber configuration. + + + Creates a new WpConf object. + + +This does not open the files, it only creates the object. For most use cases, you should use wp_conf_new_open() instead. + + + a new WpConf object + + + + + the name of the configuration file + + + + a WpProperties with keys specifying how to load the WpConf object + + + + + + Creates a new WpConf object and opens the configuration file and its fragments, keeping them mapped in memory for further access. + + + a new WpConf object, or NULL if an error occurred + + + + + the name of the configuration file + + + + a WpProperties with keys specifying how to load the WpConf object + + + + + + Closes the configuration file and its fragments. + + + + + + + the configuration + + + + + + Gets the name of the configuration file. + + + the name of the configuration file + + + + + the configuration + + + + + + This method will get the JSON value of a specific section from the configuration. If the same section is defined in multiple locations, the sections with the same name will be either merged in case of arrays and objects, or overridden in case of boolean, int, double and strings. + + + the JSON value of the section or NULL if the section does not exist + + + + + the configuration + + + + the section name + + + + + + Tests if the configuration files are open. + + + TRUE if the configuration files are open, FALSE otherwise + + + + + the configuration + + + + + + Opens the configuration file and its fragments and keeps them mapped in memory for further access. + + + TRUE on success, FALSE on error + + + + + the configuration + + + + + + Parses standard pw_context sections from @conf. + + + + + + + the configuration + + + + the associated pw_context + + + + + + Updates the given properties with the values of a specific section from the configuration. + + + the number of properties updated + + + + + the configuration + + + + the section name + + + + the properties to update + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + The core is the central object around which everything operates. It is essential to create a WpCore before using any other WirePlumber API. +The core object has the following responsibilities: + - it initializes the PipeWire library + - it creates a pw_context and allows connecting to the PipeWire server, creating a local pw_core + - it glues the PipeWire library's event loop system with GMainLoop + - it maintains a list of registered objects, which other classes use to keep objects loaded permanently into memory + - it watches the PipeWire registry and keeps track of remote and local objects that appear in the registry, making them accessible through the WpObjectManager API. + +The core is also responsible for loading components, which are defined in the main configuration file. Components are loaded when WP_CORE_FEATURE_COMPONENTS is activated. +The main configuration file needs to be created and opened before the core is created, using the WpConf API. It is then passed to the core as an argument in the constructor. +If a configuration file is not provided, the core will let the underlying pw_context load its own configuration, based on the rules that apply to all pipewire clients (e.g. it respects the PIPEWIRE_CONFIG_NAME environment variable and loads "client.conf" as a last resort). +If a configuration file is provided, the core does not let the underlying pw_context load any configuration and instead uses the provided WpConf object. + + + Creates a new core object. + + + a new WpCore + + + + + the GMainContext to use for events + + + + the main configuration file + + + + additional properties, which are also passed to pw_context_new() and pw_context_connect() + + + + + + Clones a core with the same context as @self. + + + the clone WpCore + + + + + the core + + + + + + Connects this core to the PipeWire server. + + +When connection succeeds, the WpCore "connected" signal is emitted. + + + TRUE if the core is effectively connected or FALSE if connection failed + + + + + the core + + + + + + Connects this core to the PipeWire server on the given socket. + + +When connection succeeds, the WpCore "connected" signal is emitted. + + + TRUE if the core is effectively connected or FALSE if connection failed + + + + + the core + + + + the connected socket to use, the socket will be closed automatically on disconnect or error + + + + + + Disconnects this core from the PipeWire server. + + +This also effectively destroys all WpCore objects that were created through the registry, destroys the pw_core and finally emits the WpCore "disconnected" signal. + + + + + + + the core + + + + + + Finds a registered object. + + + the registered object or NULL if not found + + + + + the core + + + + a function that takes the object being searched as the first argument and @data as the second. it should return TRUE if the object is found or FALSE otherwise + + + + the second argument to @func + + + + + + Gets the main configuration file of the core. + + + the main configuration file + + + + + the core + + + + + + Returns the special WpCore that is used to maintain a secondary connection to PipeWire, for exporting objects. + + +The export core is enabled by loading the built-in "export-core" component. + + + the export WpCore + + + + + the core + + + + + + Gets the GMainContext of the core. + + + the GMainContext that is in use by this core for events + + + + + the core + + + + + + Gets the bound id of the client object that is created as a result of this core being connected to the PipeWire daemon. + + + the bound id of this client + + + + + the core + + + + + + Gets the properties of the core. + + + the properties of @self + + + + + the core + + + + + + Gets the internal PipeWire context of the core. + + + the internal pw_context object + + + + + the core + + + + + + Gets the internal PipeWire core of the core. + + + the internal pw_core object, or NULL if the core is not connected to PipeWire + + + + + the core + + + + + + Gets the cookie of the core's connected PipeWire instance. + + + The cookie of the PipeWire instance that @self is connected to. The cookie is a unique random number for identifying an instance of PipeWire + + + + + the core + + + + + + Gets the host name of the core's connected PipeWire instance. + + + The name of the host where the PipeWire instance that @self is connected to is running on + + + + + the core + + + + + + Gets the name of the core's connected PipeWire instance. + + + The name of the PipeWire instance that @self is connected to + + + + + the core + + + + + + Gets the properties of the core's connected PipeWire instance. + + + the properties of the PipeWire instance that @self is connected to + + + + + the core + + + + + + Gets the user name of the core's connected PipeWire instance. + + + The name of the user that started the PipeWire instance that @self is connected to + + + + + the core + + + + + + Gets the version of the core's connected PipeWire instance. + + + The version of the PipeWire instance that @self is connected to + + + + + the core + + + + + + Gets the virtual machine type of the core. + + + a comma separated string with all the virtual machine types that this core matches, or NULL if the core is not running in a virtual machine. + + + + + the core + + + + + + Adds an idle callback to be called in the same GMainContext as the one used by this core. + + +This is essentially the same as g_idle_add_full(), but it adds the created GSource on the GMainContext used by this core instead of the default context. + + + + + + + the core + + + + the source + + + + the function to call + + + + data to pass to @function + + + + a function to destroy @data + + + + + + Adds an idle callback to be called in the same GMainContext as the one used by this core. + + +This is the same as wp_core_idle_add(), but it allows you to specify a GClosure instead of a C callback. + + + + + + + the core + + + + the source + + + + the closure to invoke + + + + + + Installs the object manager on this core, activating its internal management engine. + + +This will immediately emit signals about objects added on @om if objects that the @om is interested in were in existence already. + + + + + + + the core + + + + a WpObjectManager + + + + + + Checks if the core is connected to PipeWire. + + + TRUE if the core is connected to PipeWire, FALSE otherwise + + + + + the core + + + + + + Loads the specified @component on @self. + + +The @type will determine which component loader to use. The following types are built-in and will always work without a component loader: + - "module" - Loads a WirePlumber module + - "array" - Loads multiple components interpreting the @args as a JSON array with component definitions, as they would appear in the configuration file. When this type is used, @component is ignored and can be NULL + + + + + + + the core + + + + the module name or file name + + + + the type of the component + + + + additional arguments for the component, expected to be a JSON object + + + + the name of the feature that this component will provide if it loads successfully; this can be queried later with wp_core_test_feature() + + + + optional GCancellable + + + + the callback to call when the operation is done + + + + data to pass to @callback + + + + + + Finishes the operation started by wp_core_load_component(). This is meant to be called in the callback that was passed to that method. + + + TRUE if the requested component was loaded, FALSE otherwise + + + + + the component loader object + + + + the async result + + + + + + Registers @obj with the core, making it appear on WpObjectManager instances as well. + + +The core will also maintain a ref to that object until it is removed. + + + + + + + the core + + + + the object to register + + + + + + Detaches and unrefs the specified object from this core. + + + + + + + the core + + + + a pointer to the object to remove + + + + + + Asks the PipeWire server to call the @callback via an event. + + +Since methods are handled in-order and events are delivered in-order, this can be used as a barrier to ensure all previous methods and the resulting events have been handled. +In both success and error cases, @callback is always called. Use wp_core_sync_finish() from within the @callback to determine whether the operation completed successfully or if an error occurred. + + + TRUE if the sync operation was started, FALSE if an error occurred before returning from this function + + + + + the core + + + + a GCancellable to cancel the operation + + + + a function to call when the operation is done + + + + data to pass to @callback + + + + + + Asks the PipeWire server to invoke the @closure via an event. + + +Since methods are handled in-order and events are delivered in-order, this can be used as a barrier to ensure all previous methods and the resulting events have been handled. +In both success and error cases, @closure is always invoked. Use wp_core_sync_finish() from within the @closure to determine whether the operation completed successfully or if an error occurred. + + + TRUE if the sync operation was started, FALSE if an error occurred before returning from this function + + + + + the core + + + + a GCancellable to cancel the operation + + + + a closure to invoke when the operation is done + + + + + + This function is meant to be called from within the callback of wp_core_sync() in order to determine the success or failure of the operation. + + + TRUE if the operation succeeded, FALSE otherwise + + + + + the core + + + + a GAsyncResult + + + + + + Test if a global feature is provided. + + + TRUE if the feature is provided, FALSE otherwise + + + + + the core + + + + the feature name + + + + + + Adds a timeout callback to be called at regular intervals in the same GMainContext as the one used by this core. + + +The function is called repeatedly until it returns FALSE, at which point the timeout is automatically destroyed and the function will not be called again. The first call to the function will be at the end of the first interval. +This is essentially the same as g_timeout_add_full(), but it adds the created GSource on the GMainContext used by this core instead of the default context. + + + + + + + the core + + + + the source + + + + the timeout in milliseconds + + + + the function to call + + + + data to pass to @function + + + + a function to destroy @data + + + + + + Adds a timeout callback to be called at regular intervals in the same GMainContext as the one used by this core. + + +This is the same as wp_core_timeout_add(), but it allows you to specify a GClosure instead of a C callback. + + + + + + + the core + + + + the source + + + + the timeout in milliseconds + + + + the closure to invoke + + + + + + Updates the properties of @self on the connection, making them appear on the client object that represents this connection. + + +If @self is not connected yet, these properties are stored and passed to pw_context_connect() when connecting. + + + + + + + the core + + + + updates to apply to the properties of @self; this does not need to include properties that have not changed + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + The WpDevice class allows accessing the properties and methods of a PipeWire device object (struct pw_device). +A WpDevice is constructed internally when a new device appears on the PipeWire registry and it is made available through the WpObjectManager API. Alternatively, a WpDevice can also be constructed using wp_device_new_from_factory(), which creates a new device object on the remote PipeWire server by calling into a factory. + + + + Constructs a device on the PipeWire server by asking the remote factory @factory_name to create it. + + +Because of the nature of the PipeWire protocol, this operation completes asynchronously at some point in the future. In order to find out when this is done, you should call wp_object_activate(), requesting at least WP_PROXY_FEATURE_BOUND. When this feature is ready, the device is ready for use on the server. If the device cannot be created, this activation operation will fail. + + + the new device or NULL if the core is not connected and therefore the device cannot be created + + + + + the wireplumber core + + + + the pipewire factory name to construct the device + + + + the properties to pass to the factory + + + + + + + + + + + + + + + + + + + WpEvent describes an event, an event is an entity which can be pushed on to event stack and the event dispatcher is going to pick and dispatch it. + + + Creates a new event. + + + the newly constructed event + + + + + the type of the event + + + + the priority of the event + + + + properties of the event + + + + the source of the event + + + + the object that the event is about + + + + + + Collects all the hooks registered in the @dispatcher that run for this @event. + + + TRUE if at least one hook has been collected, FALSE if no hooks run for this event or an error occurred + + + + + the event + + + + the event dispatcher + + + + + + Returns the internal GCancellable that is used to track whether this event has been stopped by wp_event_stop_processing() + + + the cancellable + + + + + the event + + + + + + Gets the data that was previously associated with @key by wp_event_set_data() + + + the data associated with @key or %NULL + + + + + the event + + + + the key + + + + + + Gets the name of the event. + + + the event name + + + + + the event + + + + + + Gets the priority of the event. + + + the event priority + + + + + the event + + + + + + Gets the properties of the Event. + + + the properties of the event + + + + + the handle + + + + + + Gets the Source Object of the Event. + + + the source of the event + + + + + the handle + + + + + + Gets the Subject Object of the Event. + + + the subject of the event + + + + + the handle + + + + + + Returns an iterator that iterates over all the hooks that were collected by wp_event_collect_hooks() + + + the new iterator + + + + + the event + + + + + + + + + + + + + + + + + Stores @data on the event, associated with the specified @key. + + +This can be used to exchange arbitrary data between hooks that run for this event. + + + + + + + the event + + + + the key to associate @data with + + + + the data element, or %NULL to remove any previous data associated with this @key + + + + + + Stops processing of this event; any further hooks will not be executed from this moment onwards and the event will be discarded from the stack. + + + + + + + the event + + + + + + + + + + + + + + + + + + The event dispatcher holds all the events and hooks and dispatches them. It orchestras the show on event stack. + + + Returns the event dispatcher instance that is associated with the given core. + + +This method will also create the instance and register it with the core, if it had not been created before. + + + the event dispatcher instance + + + + + the core + + + + + + Returns an iterator to iterate over all the registered hooks. + + + a new iterator + + + + + the event dispatcher + + + + + + Pushes a new event onto the event stack for dispatching only if there are any hooks are available for it. + + + + + + + the dispatcher + + + + the new event + + + + + + Registers an event hook. + + + + + + + the event dispatcher + + + + the hook to register + + + + + + Unregisters an event hook. + + + + + + + the event dispatcher + + + + the hook to unregister + + + + + + + + + + + + + The event hook is a structure that describes some executable action that an event dispatcher will run when a matching event has been received. + + + Finishes the async operation that was started by wp_event_hook_run() + + + FALSE if there was an error, TRUE otherwise + + + + + the event hook + + + + the async operation result + + + + + + Runs the hook on the given event. + + + + + + + the event hook + + + + the event that triggered the hook + + + + a GCancellable to cancel the async operation + + + + a callback to fire after execution of the hook has completed + + + + data for the callback + + + + + + Checks if the hook should be executed for a given event. + + + TRUE if the hook should be executed for the given event, FALSE otherwise + + + + + the event hook + + + + the event + + + + + + Finishes the async operation that was started by wp_event_hook_run() + + + FALSE if there was an error, TRUE otherwise + + + + + the event hook + + + + the async operation result + + + + + + Returns the associated event dispatcher. + + + the event dispatcher on which this hook is registered, or NULL if the hook is not registered + + + + + the event hook + + + + + + Returns the name of the hook. + + + the event hook name + + + + + the event hook + + + + + + Returns the names of the hooks that should run before this hook, or in other words, this hook should run after them. + + + a NULL-terminated array of hook names + + + + + + + the event hook + + + + + + Returns the names of the hooks that should run after this hook, or in other words, this hook should run before them. + + + a NULL-terminated array of hook names + + + + + + + the event hook + + + + + + Runs the hook on the given event. + + + + + + + the event hook + + + + the event that triggered the hook + + + + a GCancellable to cancel the async operation + + + + a callback to fire after execution of the hook has completed + + + + data for the callback + + + + + + Checks if the hook should be executed for a given event. + + + TRUE if the hook should be executed for the given event, FALSE otherwise + + + + + the event hook + + + + the event + + + + + + Sets the associated event dispatcher. + + + + + + + the event hook + + + + the event dispatcher on which this hook is registered + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + TRUE if the hook should be executed for the given event, FALSE otherwise + + + + + the event hook + + + + the event + + + + + + + + + + + + + + the event hook + + + + the event that triggered the hook + + + + a GCancellable to cancel the async operation + + + + a callback to fire after execution of the hook has completed + + + + data for the callback + + + + + + + + + + FALSE if there was an error, TRUE otherwise + + + + + the event hook + + + + the async operation result + + + + + + + + + + + + + The WpFactory class allows accessing the properties and methods of PipeWire Factory objects (struct pw_factory). +A WpFactory is constructed internally by wireplumber, when the pipewire constructed factory objects are reported in by PipeWire registry and it is made available for wireplumber clients through the WpObjectManager API. + + + + + + + + + + + A WpTransition that is used by WpObject to implement feature activation. + + + + Gets the features requested to be activated in this transition. + + + the features that were requested to be activated in this transition; this contains the features as they were passed in wp_object_activate() and therefore it may contain unsupported or already active features + + + + + the transition + + + + + + + + + + + + + + + + A proxy that represents a PipeWire global object, i.e. an object that is made available through the PipeWire registry. + + + Binds to the global and creates the underlying pw_proxy. + + +This is mostly meant to be called internally. It will create the pw_proxy and will activate the WP_PROXY_FEATURE_BOUND feature. +This may only be called if there is no pw_proxy associated with this object yet. + + + TRUE on success, FALSE if there is no global to bind to + + + + + the pipewire global + + + + + + Gets the global properties of a pipewire global. + + + the global (immutable) properties of this pipewire object + + + + + the pipewire global + + + + + + Gets the permissions of a pipewire global. + + + the permissions that wireplumber has on this object + + + + + the pipewire global + + + + + + Requests the PipeWire server to destroy the object represented by this proxy. + + +If the server allows it, the object will be destroyed and the WpProxy's pw-proxy-destroyed signal will be emitted. If the server does not allow it, nothing will happen. +This is mostly useful for destroying WpLink objects. + + + + + + + the pipewire global + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Implementation of the metadata object. +Activate this object with at least WP_PROXY_FEATURE_BOUND to export it to PipeWire. + + + Creates a new metadata implementation. + + + a new WpImplMetadata + + + + + the core + + + + + + Creates a new metadata implementation with name and properties. + + + a new WpImplMetadata + + + + + the core + + + + the metadata name + + + + the metadata properties + + + + + + + + + + + + + + + + + + + Used to load PipeWire modules within the WirePlumber process. This is slightly different from other objects in that the module is not exported to PipeWire, but it may create an export objects itself. + + + Loads a PipeWire module into the WirePlumber process. + + + the WpImplModule for the module that was loaded on success, NULL on failure. + + + + + The WirePlumber core + + + + the name of the module to load + + + + arguments to be passed to the module + + + + additional properties to be provided to the module + + + + + + + + + + + + + + + + + + + + + + + + + + + + A WpImplNode allows running a node implementation (struct pw_impl_node) locally, loading the implementation from factory or wrapping a manually constructed pw_impl_node. This object can then be exported to PipeWire by requesting WP_PROXY_FEATURE_BOUND. + + + + Constructs a new node, locally on this process, using the specified @factory_name. + + +To export this node to the PipeWire server, you need to call wp_object_activate() requesting WP_PROXY_FEATURE_BOUND and wait for the operation to complete. + + + A new WpImplNode wrapping the node that was constructed by the factory, or NULL if the factory does not exist or was unable to construct the node + + + + + the wireplumber core + + + + the name of the pipewire factory + + + + properties to be passed to node constructor + + + + + + Constructs a node object from an existing pw_impl_node. + + + A new WpImplNode wrapping @node + + + + + the wireplumber core + + + + an existing pw_impl_node to wrap + + + + + + + + + + + + + + + + + + + + + + + + + + + + An event hook that declares interest in specific events. This subclass implements the WpEventHook.runs_for_event() vmethod and returns TRUE from that method if the given event has properties that match one of the declared interests. + + + Equivalent to: + + + +|[<!-- language="C" --> + WpObjectInterest *i = wp_object_interest_new (WP_TYPE_EVENT, ...); + wp_interest_event_hook_add_interest_full (self, i); +]| +The constraints specified in the variable arguments must follow the rules documented in wp_object_interest_new(). + + + + + + + the event hook + + + + a list of constraints, terminated by NULL + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + A generic iterator API + + + Constructs an iterator that uses the provided @methods to implement its API. + + +The WpIterator structure is internally allocated with @user_size additional space at the end. A pointer to this space can be retrieved with wp_iterator_get_user_data() and is available for implementation-specific storage. + + + a new custom iterator + + + + + method implementations for the new iterator + + + + size of the user_data structure to be allocated + + + + + + Creates an iterator from a pointer array. + + + a new iterator that iterates over @items + + + + + the items to iterate over + + + + + + the type of each item + + + + + + Fold a function over the items of the iterator. + + + TRUE if all the items were processed, FALSE otherwise. + + + + + the iterator + + + + the fold function + + + + the accumulator data + + + + the user data + + + + + + Iterates over all items of the iterator calling a function. + + + TRUE if all the items were processed, FALSE otherwise. + + + + + the iterator + + + + the foreach function + + + + the user data + + + + + + Gets the implementation-specific storage of an iterator. + + +this only for use by implementations of WpIterator + + + a pointer to the implementation-specific storage area + + + + + an iterator object + + + + + + Gets the next item of the iterator. + + + TRUE if next iterator was obtained, FALSE when the iterator has no more items to iterate through. + + + + + the iterator + + + + the next item of the iterator + + + + + + Increases the reference count of an iterator. + + + @self with an additional reference count on it + + + + + an iterator object + + + + + + Resets the iterator so we can iterate again from the beginning. + + + + + + + the iterator + + + + + + Decreases the reference count on @self and frees it when the ref count reaches zero. + + + + + + + an iterator object + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + A custom GLib log level for trace messages (extension of GLogLevelFlags) + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + The WpLink class allows accessing the properties and methods of a PipeWire link object (struct pw_link). +A WpLink is constructed internally when a new link appears on the PipeWire registry and it is made available through the WpObjectManager API. Alternatively, a WpLink can also be constructed using wp_link_new_from_factory(), which creates a new link object on the remote PipeWire server by calling into a factory. + + + + Constructs a link on the PipeWire server by asking the remote factory @factory_name to create it. + + +Because of the nature of the PipeWire protocol, this operation completes asynchronously at some point in the future. In order to find out when this is done, you should call wp_object_activate(), requesting at least WP_PROXY_FEATURE_BOUND. When this feature is ready, the link is ready for use on the server. If the link cannot be created, this activation operation will fail. + + + the new link or NULL if the core is not connected and therefore the link cannot be created + + + + + the wireplumber core + + + + the pipewire factory name to construct the link + + + + the properties to pass to the factory + + + + + + Retrieves the ids of the objects that are linked by this link. + + +Requires WP_PIPEWIRE_OBJECT_FEATURE_INFO + + + + + + + the link + + + + the bound id of the output (source) node + + + + the bound id of the output (source) port + + + + the bound id of the input (sink) node + + + + the bound id of the input (sink) port + + + + + + Gets the current state of the link. + + + the current state of the link + + + + + the link + + + + the error + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + A structure representing a log topic. + + + + + + + + + + + + + + Initializes a log topic. Internal function, don't use it directly. + + + + + + + + + + + + Registers a log topic. + + +The log topic must be unregistered using wp_log_topic_unregister before its lifetime ends. +This function is threadsafe. + + + + + + + + + + + + Unregisters a log topic. + + +This function is threadsafe. + + + + + + + + + + + + + + + + + + + + + The WpMetadata class allows accessing the properties and methods of PipeWire metadata object (struct pw_metadata). +A WpMetadata is constructed internally when a new metadata object appears on the PipeWire registry and it is made available through the WpObjectManager API. + + + Clears permanently all stored metadata. + + + + + + + the metadata object + + + + + + Finds the metadata value given its @subject and @key. + + + the metadata string value, or NULL if not found. + + + + + a metadata object + + + + the metadata subject id + + + + the metadata key name + + + + the metadata type name + + + + + + Iterates over metadata items that matches the given @subject. + + +If no constraints are specified, the returned iterator iterates over all the stored metadata. +Note that this method works on cached metadata. When you change metadata with wp_metadata_set(), this cache will be updated on the next round-trip with the pipewire server. + + + an iterator that iterates over the found metadata. The type of the iterator item is WpMetadataItem. + + + + + a metadata object + + + + the metadata subject id, or -1 (PW_ID_ANY) + + + + + + Sets the metadata associated with the given @subject and @key. Use NULL as a value to unset the given @key and use NULL in both @key and @value to remove all metadata associated with the given @subject. + + + + + + + the metadata object + + + + the subject id for which this metadata property is being set + + + + the key to set, or NULL to remove all metadata for @subject + + + + the type of the value; NULL is synonymous to "string" + + + + the value to set, or NULL to unset the given @key + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + WpMetadataItem holds the subject, key, type and value of a metadata entry. + + + Gets the key from a metadata item. + + + the metadata key of the @item + + + + + the item held by the GValue that was returned from the WpIterator of wp_metadata_new_iterator() + + + + + + Gets the subject from a metadata item. + + + the metadata subject of the @item + + + + + the item held by the GValue that was returned from the WpIterator of wp_metadata_new_iterator() + + + + + + Gets the value from a metadata item. + + + the metadata value of the @item + + + + + the item held by the GValue that was returned from the WpIterator of wp_metadata_new_iterator() + + + + + + Gets the value type from a metadata item. + + + the metadata value type of the @item + + + + + the item held by the GValue that was returned from the WpIterator of wp_metadata_new_iterator() + + + + + + Increases the reference count of a metadata item object. + + + @self with an additional reference count on it + + + + + a metadata item object + + + + + + Decreases the reference count on @self and frees it when the ref count reaches zero. + + + + + + + a metadata item object + + + + + + + The WpNode class allows accessing the properties and methods of a PipeWire node object (struct pw_node). +A WpNode is constructed internally when a new node appears on the PipeWire registry and it is made available through the WpObjectManager API. Alternatively, a WpNode can also be constructed using wp_node_new_from_factory(), which creates a new node object on the remote PipeWire server by calling into a factory. + + + + Constructs a node on the PipeWire server by asking the remote factory @factory_name to create it. + + +Because of the nature of the PipeWire protocol, this operation completes asynchronously at some point in the future. In order to find out when this is done, you should call wp_object_activate(), requesting at least WP_PROXY_FEATURE_BOUND. When this feature is ready, the node is ready for use on the server. If the node cannot be created, this activation operation will fail. + + + the new node or NULL if the core is not connected and therefore the node cannot be created + + + + + the wireplumber core + + + + the pipewire factory name to construct the node + + + + the properties to pass to the factory + + + + + + Gets the number of input ports of this node. + + +Requires WP_PIPEWIRE_OBJECT_FEATURE_INFO + + + the number of input ports of this node, as reported by the node info + + + + + the node + + + + the maximum supported number of input ports + + + + + + Gets the number of output ports of this node. + + +Requires WP_PIPEWIRE_OBJECT_FEATURE_INFO + + + the number of output ports of this node, as reported by the node info + + + + + the node + + + + the maximum supported number of output ports + + + + + + Gets the number of ports of this node. + + +Note that this number may not add up to wp_node_get_n_input_ports() + wp_node_get_n_output_ports() because it is discovered by looking at the number of available ports in the registry, however ports may appear there with a delay or may not appear at all if this client does not have permission to read them +Requires WP_NODE_FEATURE_PORTS + + + the number of ports of this node. + + + + + the node + + + + + + Gets the current state of the node. + + + the current state of the node + + + + + the node + + + + the error + + + + + + Retrieves the first port that matches the constraints. + + +The constraints specified in the variable arguments must follow the rules documented in wp_object_interest_new(). +Requires WP_NODE_FEATURE_PORTS + + + the first port that matches the constraints, or NULL if there is no such port + + + + + the node + + + + a list of constraints, terminated by NULL + + + + + + Retrieves the first port that matches the @interest. + + +Requires WP_NODE_FEATURE_PORTS + + + the first port that matches the @interest, or NULL if there is no such port + + + + + the node + + + + the interest + + + + + + Gets a new iterator that iterates over all the ports that belong to this node and match the constraints. + + +The constraints specified in the variable arguments must follow the rules documented in wp_object_interest_new(). +Requires WP_NODE_FEATURE_PORTS + + + a WpIterator that iterates over WpPort objects + + + + + the node + + + + a list of constraints, terminated by NULL + + + + + + Gets a new iterator that iterates over all the ports that belong to this node and match the @interest. + + +Requires WP_NODE_FEATURE_PORTS + + + a WpIterator that iterates over WpPort objects + + + + + the node + + + + the interest + + + + + + Gets a new iterator that iterates over all the ports that belong to this node. + + +Requires WP_NODE_FEATURE_PORTS + + + a WpIterator that iterates over WpPort objects + + + + + the node + + + + + + Sends a command to a node. + + +Valid commands are the short string reprepsentations of enum spa_node_command. For example, "Suspend" or "Flush" are valid commands + + + + + + + the node + + + + the command + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Special value that can be used to activate all the supported features in any given object. + + + + + + + + + Base class for objects that have activatable features. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Deactivates the given @features, leaving the object in the state it was before they were enabled. + + +This is seldom needed to call manually, but it can be used to save resources if some features are no longer needed. + + + + + + + the object + + + + the features to deactivate + + + + + + Gets the supported features of this object. + + + A bitset containing the supported features of this object; note that supported features may change at runtime + + + + + the object + + + + + + Aborts the current object activation by returning a transition error if any transitions are pending. + + +This is usually used to stop any pending activation if an error happened. + + + + + + + the object + + + + the message used in the transition error + + + + + + Callback version of wp_object_activate_closure() + + + + + + + the object + + + + the features to enable + + + + a cancellable for the async operation + + + + a function to call when activation is complete + + + + data for @callback + + + + + + Activates the requested @features and invokes @closure when this is done. @features may contain unsupported or already active features. The operation will filter them and activate only ones that are supported and inactive. + + +If multiple calls to this method is done, the operations will be executed one after the other to ensure features only get activated once. +@closure may be invoked in sync while this method is being called, if there are no features to activate. + + + + + + + the object + + + + the features to enable + + + + a cancellable for the async operation + + + + the closure to use when activation is completed + + + + + + Finishes the async operation that was started with wp_object_activate() + + + TRUE if the requested features were activated, FALSE if there was an error + + + + + the object + + + + the async operation result + + + + + + Deactivates the given @features, leaving the object in the state it was before they were enabled. + + +This is seldom needed to call manually, but it can be used to save resources if some features are no longer needed. + + + + + + + the object + + + + the features to deactivate + + + + + + Gets the active features of this object. + + + A bitset containing the active features of this object + + + + + the object + + + + + + Gets the core associated with this object. + + + the core associated with this object + + + + + the object + + + + + + Gets the unique wireplumber Id of this object. + + + + + + + the session item + + + + + + Gets the supported features of this object. + + + A bitset containing the supported features of this object; note that supported features may change at runtime + + + + + the object + + + + + + Checks if the given features are active on this object. + + + TRUE if all the given features are active on this object + + + + + the object + + + + the features to check + + + + + + Checks if the given features are supported on this object. + + + TRUE if all the given features are supported on this object + + + + + the object + + + + the features to check + + + + + + Allows subclasses to update the currently active features. + + +@activated should contain new features and @deactivated should contain features that were just deactivated. Calling this method also advances the activation transitions. +Private method to be called by subclasses only. + + + + + + + the object + + + + the features that were activated, or 0 + + + + the features that were deactivated, or 0 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + A bitset containing the supported features of this object; note that supported features may change at runtime + + + + + the object + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + the object + + + + the features to deactivate + + + + + + + + + + + + + An object interest is a helper that is used in WpObjectManager to declare interest in certain kinds of objects. +An interest is defined by a GType and a set of constraints on the object's properties. An object "matches" the interest if it is of the specified GType (either the same type or a descendant of it) and all the constraints are satisfied. + + + Creates a new interest that declares interest in objects of the specified @gtype, with the constraints specified in the variable arguments. + + +The variable arguments should be a list of constraints terminated with NULL, where each constraint consists of the following arguments: + - a WpConstraintType: the constraint type + - a const gchar *: the subject name + - a const gchar *: the format string + - 0 or more arguments according to the format string + +The format string is interpreted as follows: + - the first character is the constraint verb: + - =: WP_CONSTRAINT_VERB_EQUALS + - !: WP_CONSTRAINT_VERB_NOT_EQUALS + - c: WP_CONSTRAINT_VERB_IN_LIST + - ~: WP_CONSTRAINT_VERB_IN_RANGE + - #: WP_CONSTRAINT_VERB_MATCHES + - +: WP_CONSTRAINT_VERB_IS_PRESENT + - -: WP_CONSTRAINT_VERB_IS_ABSENT + + - the rest of the characters are interpreted as a GVariant format string, as it would be used in g_variant_new() + +The rest of this function's arguments up to the start of the next constraint depend on the GVariant format part of the format string and are used to construct a GVariant for the constraint's value argument. +For further reading on the constraint's arguments, see wp_object_interest_add_constraint() +For example, this interest matches objects that are descendants of WpProxy with a "bound-id" between 0 and 100 (inclusive), with a pipewire property called "format.dsp" that contains the string "audio" somewhere in the value and with a pipewire property "port.name" being present (with any value): +|[<!-- language="C" --> + interest = wp_object_interest_new (WP_TYPE_PROXY, + WP_CONSTRAINT_TYPE_G_PROPERTY, "bound-id", "~(uu)", 0, 100, + WP_CONSTRAINT_TYPE_PW_PROPERTY, "format.dsp", "#s", "*audio*", + WP_CONSTRAINT_TYPE_PW_PROPERTY, "port.name", "+", + NULL); +]| + + + the new object interest + + + + + the type of the object to declare interest in + + + + a set of constraints, terminated with NULL + + + + + + Creates a new interest that declares interest in objects of the specified @gtype, without any property constraints. + + +To add property constraints, you can call wp_object_interest_add_constraint() afterwards. + + + the new object interest + + + + + the type of the object to declare interest in + + + + + + va_list version of wp_object_interest_new() + + + the new object interest + + + + + the type of the object to declare interest in + + + + pointer to va_list containing the constraints + + + + + + Adds a constraint to this interest. Constraints consist of a @type, a @subject, a @verb and, depending on the @verb, a @value. + + +Constraints are almost like a spoken language sentence that declare a condition that must be true in order to consider that an object can match this interest. For instance, a constraint can be "pipewire property +'object.id' equals 10". This would be translated to: +|[<!-- language="C" --> + wp_object_interest_add_constraint (i, + WP_CONSTRAINT_TYPE_PW_PROPERTY, "object.id", + WP_CONSTRAINT_VERB_EQUALS, g_variant_new_int (10)); +]| +Some verbs require a @value and some others do not. For those that do, the @value must be of a specific type: + - WP_CONSTRAINT_VERB_EQUALS: @value can be a string, a (u)int32, a (u)int64, a double or a boolean. The @subject value must equal this value for the constraint to be satisfied + - WP_CONSTRAINT_VERB_IN_LIST: @value must be a tuple that contains any number of items of the same type; the items can be string, (u)int32, (u)int64 or double. These items make a list that the @subject's value will be checked against. If any of the items equals the @subject value, the constraint is satisfied + - WP_CONSTRAINT_VERB_IN_RANGE: @value must be a tuple that contains exactly 2 numbers of the same type ((u)int32, (u)int64 or double), meaning the minimum and maximum (inclusive) of the range. If the @subject value is a number within this range, the constraint is satisfied + - WP_CONSTRAINT_VERB_MATCHES: @value must be a string that defines a pattern usable with GPatternSpec If the @subject value matches this pattern, the constraint is satisfied + +In case the type of the @subject value is not the same type as the one requested by the type of the @value, the @subject value is converted. For GObject properties, this conversion is done using g_value_transform(), so limitations of this function apply. In the case of PipeWire properties, which are @always strings, conversion is done as follows: + - to boolean: "true" or "1" means TRUE, "false" or "0" means FALSE + - to int / uint / int64 / uint64: One of the strtol() family of functions is used to convert, using base 10 + - to double: strtod() is used + +This method does not fail if invalid arguments are given. However, wp_object_interest_validate() should be called after adding all the constraints on an interest in order to catch errors. + + + + + + + the object interest + + + + the constraint type + + + + the subject that the constraint applies to + + + + the operation that is performed to check the constraint + + + + the value to check for + + + + + + Checks if the specified @object matches the type and all the constraints that are described in @self. + + +If @self is configured to match GObject subclasses, this is equivalent to wp_object_interest_matches_full (self, G_OBJECT_TYPE (object), object, NULL, NULL) and if it is configured to match WpProperties, this is equivalent to wp_object_interest_matches_full (self, self->gtype, NULL, (WpProperties *) object, NULL); + + + TRUE if the object matches, FALSE otherwise + + + + + the object interest + + + + the target object to check for a match + + + + + + A low-level version of wp_object_interest_matches(). + + +In this version, the object's type is directly given in @object_type and is not inferred from the @object. @object is only used to check for constraints against GObject properties. +@pw_props and @pw_global_props are used to check constraints against PipeWire object properties and global properties, respectively. +@object, @pw_props and @pw_global_props may be NULL, but in case there are any constraints that require them, the match will fail. As a special case, if @object is not NULL and is a subclass of WpProxy, then @pw_props and @pw_global_props, if required, will be internally retrieved from @object by calling wp_pipewire_object_get_properties() and wp_global_proxy_get_global_properties() respectively. +When @flags contains WP_INTEREST_MATCH_FLAGS_CHECK_ALL, all the constraints are checked and the returned value contains accurate information about which types of constraints have failed to match, if any. When this flag is not present, this function returns after the first failure has been encountered. This means that the returned flags set will contain all but one flag, which will indicate the kind of constraint that failed (more could have failed, but they are not checked...) + + + flags that indicate which components of the interest match. WP_INTEREST_MATCH_ALL indicates a fully successful match; any other combination indicates a failure on the component(s) that do not appear on the flag set + + + + + the object interest + + + + flags to alter the behavior of this function + + + + the type to be checked against the interest's type + + + + the object to be used for checking constraints of type WP_CONSTRAINT_TYPE_G_PROPERTY + + + + the properties to be used for checking constraints of type WP_CONSTRAINT_TYPE_PW_PROPERTY + + + + the properties to be used for checking constraints of type WP_CONSTRAINT_TYPE_PW_GLOBAL_PROPERTY + + + + + + Increases the reference count of an object interest. + + + @self with an additional reference count on it + + + + + the object interest to ref + + + + + + Decreases the reference count on @self and frees it when the ref count reaches zero. + + + + + + + the object interest to unref + + + + + + Validates the interest, ensuring that the interest GType is a valid object and that all the constraints have been expressed properly. + + +This is called internally when @self is first used to find a match, so it is not necessary to call it explicitly + + + TRUE if the interest is valid and can be used in a match, FALSE otherwise + + + + + the object interest to validate + + + + + + + The WpObjectManager class provides a way to collect a set of objects and be notified when objects that fulfill a certain set of criteria are created or destroyed. +There are 4 kinds of objects that can be managed by a WpObjectManager: + - remote PipeWire global objects that are advertised on the registry; these are bound locally to subclasses of WpGlobalProxy + - remote PipeWire global objects that are created by calling a remote factory through the WirePlumber API; these are very similar to other global objects but it should be noted that the same WpGlobalProxy instance that created them appears in the WpObjectManager (as soon as its WP_PROXY_FEATURE_BOUND is enabled) + - local PipeWire objects that are being exported to PipeWire (WpImplMetadata, WpImplNode, etc); these appear in the WpObjectManager as soon as they are exported (so, when their WP_PROXY_FEATURE_BOUND is enabled) + - WirePlumber-specific objects, such as plugins, factories and session items + +To start an object manager, you first need to declare interest in a certain kind of object by calling wp_object_manager_add_interest() and then install it on the WpCore with wp_core_install_object_manager(). +Upon installing a WpObjectManager on a WpCore, any pre-existing objects that match the interests of this WpObjectManager will immediately become available to get through wp_object_manager_new_iterator() and the WpObjectManager object-added signal will be emitted for all of them. However, note that if these objects need to be prepared (to activate some features on them), the emission of object-added will be delayed. To know when it is safe to access the initial set of objects, wait until the installed signal has been emitted. That signal is emitted asynchronously after all the initial objects have been prepared. + + + Constructs a new object manager. + + + the newly constructed object manager + + + + + Adds a global object to the object manager. + + +caller must also call wp_object_manager_maybe_objects_changed() after + + + + + + + the object manager + + + + the global object to add + + + + + + Equivalent to: + + + +|[<!-- language="C" --> + WpObjectInterest *i = wp_object_interest_new (gtype, ...); + wp_object_manager_add_interest_full (self, i); +]| +The constraints specified in the variable arguments must follow the rules documented in wp_object_interest_new(). + + + + + + + the object manager + + + + the GType of the objects that we are declaring interest in + + + + a list of constraints, terminated by NULL + + + + + + Declares interest in a certain kind of object. + + +Interest consists of a GType that the object must be an ancestor of (g_type_is_a() must match) and optionally, a set of additional constraints on certain properties of the object. Refer to WpObjectInterest for more details. + + + + + + + the object manager + + + + the interest + + + + + + Adds an object to the object manager. + + +caller must also call wp_object_manager_maybe_objects_changed() after + + + + + + + the object manager + + + + the object to add + + + + + + Gets the number of objects managed by the object manager. + + + the number of objects managed by this WpObjectManager + + + + + the object manager + + + + + + Checks if an object manager is installed. + + + TRUE if the object manager is installed (i.e. the WpObjectManager installed signal has been emitted), FALSE otherwise + + + + + the object manager + + + + + + Equivalent to: + + + +|[<!-- language="C" --> + WpObjectInterest *i = wp_object_interest_new (gtype, ...); + return wp_object_manager_lookup_full (self, i); +]| +The constraints specified in the variable arguments must follow the rules documented in wp_object_interest_new(). + + + the first managed object that matches the lookup interest, or NULL if no object matches + + + + + the object manager + + + + the GType of the object to lookup + + + + a list of constraints, terminated by NULL + + + + + + Searches for an object that matches the specified @interest and returns it, if found. + + +If more than one objects match, only the first one is returned. To find multiple objects that match certain criteria, wp_object_manager_new_filtered_iterator() is more suitable. + + + the first managed object that matches the lookup interest, or NULL if no object matches + + + + + the object manager + + + + the interest + + + + + + Checks if the object manager should emit the 'objects-changed' signal. + + + + + + + the object manager + + + + + + Equivalent to: + + + +|[<!-- language="C" --> + WpObjectInterest *i = wp_object_interest_new (gtype, ...); + return wp_object_manager_new_filtered_iterator_full (self, i); +]| +The constraints specified in the variable arguments must follow the rules documented in wp_object_interest_new(). + + + a WpIterator that iterates over all the matching objects of this object manager + + + + + the object manager + + + + the GType of the objects to iterate through + + + + a list of constraints, terminated by NULL + + + + + + Iterates through all the objects managed by this object manager that match the specified @interest. + + + a WpIterator that iterates over all the matching objects of this object manager + + + + + the object manager + + + + the interest + + + + + + Iterates through all the objects managed by this object manager. + + + a WpIterator that iterates over all the managed objects of this object manager + + + + + the object manager + + + + + + Requests the object manager to automatically prepare the @wanted_features on any managed object that is of the specified @object_type. + + +These features will always be prepared before the object appears on the object manager. + + + + + + + the object manager + + + + the WpProxy descendant type + + + + the features to enable on this kind of object + + + + + + Removes an object from the object manager. + + +caller must also call wp_object_manager_maybe_objects_changed() after + + + + + + + the object manager + + + + the object to remove + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + An interface for standard PipeWire objects. +The common characteristic of all objects that implement this interface is the presence of an "info" structure that contains additional properties for this object (in the form of a spa_dict / pw_properties) and optionally also some parameters that can be enumerated and set on the object. + + + + Enumerate object parameters. + + +This will asynchronously return the result, or an error, by calling the given @callback. The result is going to be a WpIterator containing WpSpaPod objects, which can be retrieved with wp_pipewire_object_enum_params_finish(). + + + + + + + the pipewire object + + + + the parameter id to enumerate or NULL for all parameters + + + + a param filter or NULL + + + + a cancellable for the async operation + + + + a callback to call with the result + + + + data to pass to @callback + + + + + + Finishes an asynchronous parameter enumeration operation. + + + an iterator to iterate over the collected params, or NULL if the operation resulted in error; the items in the iterator are WpSpaPod + + + + + the pipewire object + + + + the async result + + + + + + This method can be used to retrieve object parameters in a synchronous way (in contrast with wp_pipewire_object_enum_params(), which is async). + + +The WP_PIPEWIRE_OBJECT_FEATURE_PARAM_<something> feature that corresponds to the specified @id must have been activated earlier. These features enable monitoring and caching of params underneath, so that they are always available for retrieval with this method. +Note, however, that cached params may be out-of-date if they have changed very recently on the remote object and the caching mechanism hasn't been able to update them yet, so if you really need up-to-date information you should only rely on wp_pipewire_object_enum_params() instead. + + + an iterator to iterate over cached parameters, or NULL if parameters for this @id are not cached; the items in the iterator are WpSpaPod + + + + + the pipewire object + + + + the parameter id to enumerate + + + + a param filter or NULL + + + + + + Retrieves the native info structure of this object (pw_node_info, pw_port_info, etc...) + + +Requires WP_PIPEWIRE_OBJECT_FEATURE_INFO + + + the native pipewire info structure of this object + + + + + the pipewire object + + + + + + Returns the available parameters of this pipewire object. + + +The return value is a GVariant of type a{ss}, where the key of each map entry is a spa param type id (the same ids that you can pass in wp_pipewire_object_enum_params()) and the value is a string that can contain the following letters, each of them representing a flag: + - r: the param is readable (SPA_PARAM_INFO_READ) + - w: the param is writable (SPA_PARAM_INFO_WRITE) + +For params that are readable, you can query them with wp_pipewire_object_enum_params() +Params that are writable can be set with wp_pipewire_object_set_param() +Requires WP_PIPEWIRE_OBJECT_FEATURE_INFO + + + a variant of type a{ss} or NULL if the object does not support params at all + + + + + the pipewire object + + + + + + Retrieves the PipeWire properties of this object. + + +Requires WP_PIPEWIRE_OBJECT_FEATURE_INFO + + + the pipewire properties of this object; normally these are the properties that are part of the info structure + + + + + the pipewire object + + + + + + Sets a parameter on the object. + + + TRUE on success, FALSE if setting the param failed + + + + + the pipewire object + + + + the parameter id to set + + + + optional flags or 0 + + + + the parameter to set + + + + + + Enumerate object parameters. + + +This will asynchronously return the result, or an error, by calling the given @callback. The result is going to be a WpIterator containing WpSpaPod objects, which can be retrieved with wp_pipewire_object_enum_params_finish(). + + + + + + + the pipewire object + + + + the parameter id to enumerate or NULL for all parameters + + + + a param filter or NULL + + + + a cancellable for the async operation + + + + a callback to call with the result + + + + data to pass to @callback + + + + + + Finishes an asynchronous parameter enumeration operation. + + + an iterator to iterate over the collected params, or NULL if the operation resulted in error; the items in the iterator are WpSpaPod + + + + + the pipewire object + + + + the async result + + + + + + This method can be used to retrieve object parameters in a synchronous way (in contrast with wp_pipewire_object_enum_params(), which is async). + + +The WP_PIPEWIRE_OBJECT_FEATURE_PARAM_<something> feature that corresponds to the specified @id must have been activated earlier. These features enable monitoring and caching of params underneath, so that they are always available for retrieval with this method. +Note, however, that cached params may be out-of-date if they have changed very recently on the remote object and the caching mechanism hasn't been able to update them yet, so if you really need up-to-date information you should only rely on wp_pipewire_object_enum_params() instead. + + + an iterator to iterate over cached parameters, or NULL if parameters for this @id are not cached; the items in the iterator are WpSpaPod + + + + + the pipewire object + + + + the parameter id to enumerate + + + + a param filter or NULL + + + + + + Retrieves the native info structure of this object (pw_node_info, pw_port_info, etc...) + + +Requires WP_PIPEWIRE_OBJECT_FEATURE_INFO + + + the native pipewire info structure of this object + + + + + the pipewire object + + + + + + Returns the available parameters of this pipewire object. + + +The return value is a GVariant of type a{ss}, where the key of each map entry is a spa param type id (the same ids that you can pass in wp_pipewire_object_enum_params()) and the value is a string that can contain the following letters, each of them representing a flag: + - r: the param is readable (SPA_PARAM_INFO_READ) + - w: the param is writable (SPA_PARAM_INFO_WRITE) + +For params that are readable, you can query them with wp_pipewire_object_enum_params() +Params that are writable can be set with wp_pipewire_object_set_param() +Requires WP_PIPEWIRE_OBJECT_FEATURE_INFO + + + a variant of type a{ss} or NULL if the object does not support params at all + + + + + the pipewire object + + + + + + Retrieves the PipeWire properties of this object. + + +Requires WP_PIPEWIRE_OBJECT_FEATURE_INFO + + + the pipewire properties of this object; normally these are the properties that are part of the info structure + + + + + the pipewire object + + + + + + Returns the value of a single pipewire property. + + +This is the same as getting the whole properties structure with wp_pipewire_object_get_properties() and accessing a single property with wp_properties_get(), but saves one call and having to clean up the WpProperties reference count afterwards. +The value is owned by the proxy, but it is guaranteed to stay alive until execution returns back to the event loop. +Requires WP_PIPEWIRE_OBJECT_FEATURE_INFO + + + the value of the pipewire property @key or NULL if the property doesn't exist + + + + + the pipewire object + + + + the property name + + + + + + Iterates over the object's PipeWire properties. + + +Requires WP_PIPEWIRE_OBJECT_FEATURE_INFO + + + an iterator that iterates over the pipewire properties of this object. Use wp_properties_iterator_item_get_key() and wp_properties_iterator_item_get_value() to parse the items returned by this iterator. + + + + + the pipewire object + + + + + + Sets a parameter on the object. + + + TRUE on success, FALSE if setting the param failed + + + + + the pipewire object + + + + the parameter id to set + + + + optional flags or 0 + + + + the parameter to set + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + the native pipewire info structure of this object + + + + + the pipewire object + + + + + + + + + + the pipewire properties of this object; normally these are the properties that are part of the info structure + + + + + the pipewire object + + + + + + + + + + a variant of type a{ss} or NULL if the object does not support params at all + + + + + the pipewire object + + + + + + + + + + + + + + the pipewire object + + + + the parameter id to enumerate or NULL for all parameters + + + + a param filter or NULL + + + + a cancellable for the async operation + + + + a callback to call with the result + + + + data to pass to @callback + + + + + + + + + + an iterator to iterate over the collected params, or NULL if the operation resulted in error; the items in the iterator are WpSpaPod + + + + + the pipewire object + + + + the async result + + + + + + + + + + an iterator to iterate over cached parameters, or NULL if parameters for this @id are not cached; the items in the iterator are WpSpaPod + + + + + the pipewire object + + + + the parameter id to enumerate + + + + a param filter or NULL + + + + + + + + + + TRUE on success, FALSE if setting the param failed + + + + + the pipewire object + + + + the parameter id to set + + + + optional flags or 0 + + + + the parameter to set + + + + + + + + + + + + + WpPlugin is a base class for objects that provide functionality to the WirePlumber daemon. +Typically, a plugin is created within a module and then registered to make it available for use by the daemon. The daemon is responsible for calling wp_object_activate() on it after all modules have been loaded, the core is connected and the initial discovery of global objects is done. +Being a WpObject subclass, the plugin inherits WpObject's activation system. For most implementations, there is only need for activating one feature, WP_PLUGIN_FEATURE_ENABLED, and this can be done by implementing only WpPluginClass::enable() and WpPluginClass::disable(). For more advanced plugins that need to have more features, you may implement directly the functions of WpObjectClass and ignore the ones of WpPluginClass. + + + Looks up a plugin. + + + the plugin matching the lookup name + + + + + the core + + + + the lookup name + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Retrieves the name of a plugin. + + + the name of this plugin + + + + + the plugin + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + The WpPort class allows accessing the properties and methods of a PipeWire port object (struct pw_port). +A WpPort is constructed internally when a new port appears on the PipeWire registry and it is made available through the WpObjectManager API. + + + + Gets the current direction of the port. + + +Requires WP_PIPEWIRE_OBJECT_FEATURE_INFO + + + the current direction of the port + + + + + the port + + + + + + + + + + + + + WpProperties is a data structure that contains string key-value pairs, which are used to send/receive/attach arbitrary properties to PipeWire objects. +This could be thought of as a hash table with strings as both keys and values. However, the reason that this class exists instead of using GHashTable directly is that in reality it wraps the PipeWire native struct spa_dict and struct pw_properties and therefore it can be easily passed to PipeWire function calls that require a struct spa_dict * or a struct pw_properties * as arguments. Or alternatively, it can easily wrap a struct spa_dict * or a struct pw_properties * that was given from the PipeWire API without necessarily doing an expensive copy operation. +WpProperties normally wraps a struct pw_properties, unless it was created with wp_properties_new_wrap_dict(), in which case it wraps a struct spa_dict and it is immutable (you cannot add/remove/modify any key-value pair). +In most cases, it actually owns the struct pw_properties internally and manages its lifetime. The exception to that rule is when WpProperties is constructed with wp_properties_new_wrap(), in which case the ownership of the struct pw_properties remains outside. This must be used with care, as the struct pw_properties may be free'ed externally. +WpProperties is reference-counted with wp_properties_ref() and wp_properties_unref(). + + + Constructs a new properties set that contains the given properties. + + + the newly constructed properties set + + + + + a property name + + + + a property value, followed by any number of further property key-value pairs, followed by NULL + + + + + + Constructs a new WpProperties that contains a copy of all the properties contained in the given @props structure. + + + the newly constructed properties set + + + + + a native pw_properties structure to copy + + + + + + Constructs a new WpProperties that contains a copy of all the properties contained in the given @dict structure. + + + the newly constructed properties set + + + + + a native spa_dict structure to copy + + + + + + Creates a new empty properties set. + + + the newly constructed properties set + + + + + Constructs a new properties set that contains the properties that can be parsed from the given JSON object. + + + the newly constructed properties set + + + + + a JSON object + + + + + + Constructs a new properties set that contains the properties that can be parsed from the given string. + + + the newly constructed properties set + + + + + a string containing either a whitespace separated list of key=value pairs (ex. "key1=value1 key2=value2") or a JSON object (ex. '{"key1":"value1"}') + + + + + + Constructs a new WpProperties that wraps the given @props structure, allowing reading & writing properties on that @props structure through the WpProperties API. + + +In contrast with wp_properties_new_wrap(), this function assumes ownership of the @props structure, so it will try to free @props when it is destroyed. + + + the newly constructed properties set + + + + + a native pw_properties structure to wrap + + + + + + This is the va_list version of wp_properties_new() + + + the newly constructed properties set + + + + + a property name + + + + the variable arguments passed to wp_properties_new() + + + + + + Constructs a new WpProperties that wraps the given @props structure, allowing reading properties on that @props structure through the WpProperties API. + + +Care must be taken when using this function, since the returned WpProperties object does not own the @props structure. Therefore, if the owner decides to free @props, the returned WpProperties will crash when used. In addition, the returned WpProperties object will not try to free @props when destroyed. +Furthermore, note that the returned WpProperties object is immutable. That means that you cannot add or modify any properties on it, unless you make a copy first. + + + the newly constructed properties set + + + + + a native pw_properties structure to wrap + + + + + + Constructs a new WpProperties that wraps the given @dict structure, allowing reading properties from that @dict through the WpProperties API. + + +Note that the returned object does not own the @dict, so care must be taken not to free it externally while this WpProperties object is alive. +In addition, note that the returned WpProperties object is immutable. That means that you cannot add or modify any properties on it, since there is no defined method for modifying a struct spa_dict. If you need to change this properties set later, you should make a copy with wp_properties_copy(). + + + the newly constructed properties set + + + + + a native spa_dict structure to wrap + + + + + + Adds new properties in @self, using the given @props as a source. + + +Properties (keys) from @props that are already contained in @self are not modified, unlike what happens with wp_properties_update(). Properties in @self that are not contained in @props are left untouched. + + + the number of properties that were changed + + + + + a properties object + + + + a properties set that contains properties to add + + + + + + Adds new properties in @self, using the given @dict as a source. + + +Properties (keys) from @dict that are already contained in @self are not modified, unlike what happens with wp_properties_update_from_dict(). Properties in @self that are not contained in @dict are left untouched. + + + the number of properties that were changed + + + + + a properties object + + + + a spa_dict that contains properties to add + + + + + + Adds new properties in @self, using the given @props as a source. + + +Unlike wp_properties_add(), this function only adds properties that have one of the specified keys; the rest is left untouched. + + + the number of properties that were changed + + + + + a properties set + + + + a properties set that contains properties to add + + + + a property to add + + + + a list of additional properties to add, followed by NULL + + + + + + The same as wp_properties_add_keys(), using a NULL-terminated array for specifying the keys to add. + + + the number of properties that were changed + + + + + a properties set + + + + a properties set that contains properties to add + + + + the properties to add + + + + + + + + Adds new properties in @self, using the given @dict as a source. + + +Unlike wp_properties_add_from_dict(), this function only adds properties that have one of the specified keys; the rest is left untouched. + + + the number of properties that were changed + + + + + a properties set + + + + a spa_dict that contains properties to add + + + + a property to add + + + + a list of additional properties to add, followed by NULL + + + + + + Constructs and returns a new WpProperties object that contains a copy of all the properties contained in @other. + + + the newly constructed properties set + + + + + a properties object + + + + + + Ensures that the given properties set is uniquely owned. + + +"Uniquely owned" means that: + - its reference count is 1 + - it is not wrapping a native spa_dict or pw_properties object + +If @self is not uniquely owned already, then it is unrefed and a copy of it is returned instead. You should always consider @self as unsafe to use after this call and you should use the returned object instead. + + + the uniquely owned properties object + + + + + a properties object + + + + + + Looks up a given property value from a key. + + + the value of the property identified with @key, or NULL if this property is not contained in @self + + + + + a properties object + + + + a property key + + + + + + Gets the number of properties contained in this object. + + + the number of properties contained in this object + + + + + a properties object + + + + + + Checks if all property values contained in @other are matching with the values in @self. + + +If a property is contained in @other and not in @self, the result is not matched. If a property is contained in both sets, then the value of the property in @other is interpreted as a glob-style pattern (using g_pattern_match_simple()) and the value in @self is checked to see if it matches with this pattern. + + + TRUE if all matches were successful, FALSE if at least one property value did not match + + + + + a properties object + + + + a set of properties to match + + + + + + Iterates through all the properties in the properties object. + + + an iterator that iterates over the properties. The items in the iterator are of type WpPropertiesItem. Use wp_properties_item_get_key() and wp_properties_item_get_value() to retrieve their contents. + + + + + a properties object + + + + + + Gets the dictionary wrapped by a properties object. + + + the internal properties set as a struct spa_dict * + + + + + a properties object + + + + + + + + + + + + + + + + + Sets the given property @key - @value pair on @self. + + +If the property already existed, the value is overwritten with the new one. +If the @value is NULL, then the specified property is removed from @self + + + 1 if the property was changed. 0 if nothing was changed because the property already existed with the same value or because the key to remove did not exist. + + + + + a properties object + + + + a property key + + + + a property value + + + + + + Formats the given @format string with the specified arguments and sets the result as a value of the property specified with @key. + + + 1 if the property was changed. 0 if nothing was changed because the property already existed with the same value + + + + + a properties object + + + + a property key + + + + a printf-style format to be formatted and set as a value for this property @key + + + + arguments for @format + + + + + + This is the va_list version of wp_properties_setf() + + + 1 if the property was changed. 0 if nothing was changed because the property already existed with the same value + + + + + a properties object + + + + a property key + + + + a printf-style format to be formatted and set as a value for this property @key + + + + the variable arguments passed to wp_properties_setf() + + + + + + Sorts the keys in alphabetical order. + + + + + + + a properties object + + + + + + Gets a copy of the properties object as a struct pw_properties + + + a copy of the properties in @self as a struct pw_properties + + + + + a properties object + + + + + + Decreases the reference count on @self and frees it when the ref count reaches zero. + + + + + + + a properties object + + + + + + Similar to wp_properties_to_pw_properties(), but this method avoids making a copy of the properties by returning the struct pw_properties that is stored internally and then freeing the WpProperties wrapper. + + +If @self is not uniquely owned (see wp_properties_ensure_unique_owner()), then this method does make a copy and is the same as wp_properties_to_pw_properties(), performance-wise. + + + the properties in @self as a struct pw_properties + + + + + a properties object + + + + + + Updates (adds new or modifies existing) properties in @self, using the given @props as a source. + + +Any properties that are not contained in @props are left untouched. + + + the number of properties that were changed + + + + + a properties object + + + + a properties set that contains properties to update + + + + + + Updates (adds new or modifies existing) properties in @self, using the given @dict as a source. + + +Any properties that are not contained in @dict are left untouched. + + + the number of properties that were changed + + + + + a properties object + + + + a spa_dict that contains properties to update + + + + + + Updates (adds new or modifies existing) properties in @self, using the given @json as a source. + + +Any properties that are not contained in @json are left untouched. + + + the number of properties that were changed + + + + + a properties object + + + + a JSON object that contains properties to update + + + + + + Updates (adds new or modifies existing) properties in @self, using the given @props as a source. + + +Unlike wp_properties_update(), this function only updates properties that have one of the specified keys; the rest is left untouched. + + + the number of properties that were changed + + + + + a properties set + + + + a properties set that contains properties to update + + + + a property to update + + + + a list of additional properties to update, followed by NULL + + + + + + The same as wp_properties_update_keys(), using a NULL-terminated array for specifying the keys to update. + + + the number of properties that were changed + + + + + a properties set + + + + a properties set that contains properties to update + + + + the properties to update + + + + + + + + Updates (adds new or modifies existing) properties in @self, using the given @dict as a source. + + +Unlike wp_properties_update_from_dict(), this function only updates properties that have one of the specified keys; the rest is left untouched. + + + the number of properties that were changed + + + + + a properties set + + + + a spa_dict that contains properties to update + + + + a property to update + + + + a list of additional properties to update, followed by NULL + + + + + + + + + Gets the key from a properties item. + + + the property key of the @item + + + + + the item held by the GValue that was returned from the WpIterator of wp_properties_new_iterator() + + + + + + Gets the value from a properties item. + + + the property value of the @item + + + + + the item held by the GValue that was returned from the WpIterator of wp_properties_new_iterator() + + + + + + Increases the reference count of a properties item object. + + + @self with an additional reference count on it + + + + + a properties item object + + + + + + Decreases the reference count on @self and frees it when the ref count reaches zero. + + + + + + + a properties item object + + + + + + + Base class for all objects that expose PipeWire objects using pw_proxy underneath. +This base class cannot be instantiated. It provides handling of pw_proxy's events and exposes common functionality. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Returns the proxy bound id. + + +The bound id is the id that this object has on the PipeWire registry (a.k.a. the global id). The object must have the WP_PROXY_FEATURE_BOUND feature before this method can be called. +Requires WP_PROXY_FEATURE_BOUND + + + the bound id of this object + + + + + the proxy + + + + + + Gets the interface type of the proxied object. + + + the PipeWire type of the interface that is being proxied + + + + + the proxy + + + + the version of the interface + + + + + + Gets the pw_proxy wrapped by this proxy object. + + + a pointer to the underlying pw_proxy object + + + + + the proxy + + + + + + Private method to be used by subclasses to set the pw_proxy pointer when it is available. + + +This can be called only if there is no pw_proxy already set. Takes ownership of @proxy. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Type id representing an invalid SPA type. + + + + + Session items are high level objects that wrap underlying PipeWire objects and manage them. For example, a session item may be managing a node, taking responsibility for configuring the PortConfig and Format parameters of the node. Or another may be managing links between two nodes. +All the implementations are provided by modules and instantiated via the WpSiFactory class. + + + Helper callback for sub-classes that defers and unexports the session item. + + +Only meant to be used when the pipewire proxy destroyed signal is triggered. + + + + + + + the proxy that was destroyed by the server + + + + the associated session item + + + + + + Finds the factory associated with the given @name from the @core and uses it to construct a new WpSessionItem. + + + the new session item + + + + + the WpCore + + + + the name of the factory to be used for constructing the object + + + + + + Configures the session item with a set of properties. + + + TRUE on success, FALSE if the item could not be configured + + + + + the session item + + + + the properties used to configure the item + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Resets the session item. + + +This essentially removes the configuration and deactivates all active features. + + + + + + + the session item + + + + + + Configures the session item with a set of properties. + + + TRUE on success, FALSE if the item could not be configured + + + + + the session item + + + + the properties used to configure the item + + + + + + An associated proxy is a WpProxy subclass instance that is somehow related to this item. + + + the associated proxy of the specified @proxy_type, or NULL if there is no association to such a proxy + + + + + the session item + + + + a WpProxy subclass GType + + + + + + Gets the bound id of a proxy associated with the session item. + + + the bound id of the associated proxy of the specified @proxy_type, or SPA_ID_INVALID if there is no association to such a proxy + + + + + the session item + + + + a WpProxy subclass GType + + + + + + Gets the properties of a session item. + + + the item's properties. + + + + + the session item + + + + + + Looks up a named session item property value for a given key. + + + the item property value for the given key. + + + + + the session item + + + + the property key + + + + + + Checks if the session item is configured. + + + TRUE if the item is configured, FALSE otherwise + + + + + the session item + + + + + + Registers the session item to its associated core. + + + + + + + the session item + + + + + + Removes the session item from its associated core. + + + + + + + the session item + + + + + + Resets the session item. + + +This essentially removes the configuration and deactivates all active features. + + + + + + + the session item + + + + + + Sets the item's properties. + + +This should only be done by sub-classes after the configuration has been done. + + + + + + + the session item + + + + the new properties to set + + + + + + + + + + + + + + + + + + + + + + + + + the session item + + + + + + + + + + TRUE on success, FALSE if the item could not be configured + + + + + the session item + + + + the properties used to configure the item + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + WpSettings loads and parses the "sm-settings" (default value) metadata, which contains wireplumber settings, and provides APIs to its clients (modules, lua scripts etc) to access them. +Being a WpObject subclass, the settings inherits WpObject's activation system. + + + Creates a new WpSettings object. + + + a new WpSettings object + + + + + the WpCore + + + + the name of the metadata object to associate with the settings object; NULL means the default "sm-settings" + + + + + + Finds a registered WpSettings object by its metadata name. + + + the WpSettings object, or NULL if not found + + + + + the WpCore + + + + the name of the metadata object that the settings object is associated with; NULL returns the first settings object that is found + + + + + + Deletes a saved setting to not make it persistent after reboot. + + + TRUE if the setting could be deleted, FALSE otherwise + + + + + the settings object + + + + the name of the saved setting to be deleted + + + + + + Deletes all saved setting to not make them persistent after reboot. + + + + + + + the settings object + + + + + + Gets the WpSpaJson value of a setting. + + + The WpSpaJson value of the setting, or NULL if the setting does not exist + + + + + the settings object + + + + the name of the setting + + + + + + Gets the WpSpaJson saved value of a setting. + + + The WpSpaJson saved value of the setting, or NULL if the setting does not exist + + + + + the settings object + + + + the name of the setting + + + + + + Gets the specification of a setting. + + + the specification of the setting + + + + + the settings object + + + + the name of the setting + + + + + + Iterates over settings. + + + an iterator that iterates over the settings. + + + + + the settings object + + + + + + Resets the setting to its default value. + + + TRUE if the setting could be reset, FALSE otherwise + + + + + the settings object + + + + the name of the setting to reset + + + + + + Resets all the settings to their default value. + + + + + + + the settings object + + + + + + Saves a setting to make it persistent after reboot. + + + TRUE if the setting could be saved, FALSE otherwise + + + + + the settings object + + + + the name of the setting to be saved + + + + + + Saves all the settings to make them persistent after reboot. + + + + + + + the settings object + + + + + + Sets a new setting value. + + + TRUE if the setting could be set, FALSE otherwise + + + + + the settings object + + + + the name of the setting + + + + the JSON value of the setting + + + + + + Subscribes callback for a given setting pattern(a glob-style pattern matched using g_pattern_match_simple), this allows clients to look for any changes made in settings through metadata. + + + the subscription ID (always greater than 0 for successful subscriptions) + + + + + the settings object + + + + name of the pattern to match the settings with + + + + the callback triggered when the settings change. + + + + data to pass to @callback + + + + + + Subscribes callback for a given setting pattern(a glob-style pattern matched using g_pattern_match_simple), this allows clients to look for any changes made in settings through metadata. + + + the subscription ID (always greater than 0 for success) + + + + + the settings object + + + + name of the pattern to match the settings with + + + + a GAsyncReadyCallback wrapped in a GClosure + + + + + + Unsubscribes callback for a given subscription_id. + + + TRUE if success, FALSE otherwise + + + + + the settings object + + + + identifies the callback + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + WpSettingsItem holds the key and value of a setting + + + Gets the key from a settings item. + + + the settings key of the @item + + + + + the item held by the GValue that was returned from the WpIterator of wp_settings_new_iterator() + + + + + + Gets the value from a settings item. + + + the settings value of the @item + + + + + the item held by the GValue that was returned from the WpIterator of wp_settings_new_iterator() + + + + + + Increases the reference count of a settings item object. + + + @self with an additional reference count on it + + + + + a settings item object + + + + + + Decreases the reference count on @self and frees it when the ref count reaches zero. + + + + + + + a settings item object + + + + + + + WpSettingSpec holds the specification of a setting. + + + Checks whether a value is compatible with the spec or not. + + + TRUE if the value is compatible with the spec, FALSE otherwise + + + + + the settings spec object + + + + the value to check + + + + + + Gets the default value of a settings spec. + + + the default value of the settings spec + + + + + the settings spec object + + + + + + Gets the description of a settings spec. + + + the description of the settings spec + + + + + the settings spec object + + + + + + Gets the maximum value of a settings spec. + + + the maximum value of the settings spec, or NULL if the spec type is not WP_SETTINGS_SPEC_TYPE_INT or WP_SETTINGS_SPEC_TYPE_FLOAT + + + + + the settings spec object + + + + + + Gets the minimum value of a settings spec. + + + the minimum value of the settings spec, or NULL if the spec type is not WP_SETTINGS_SPEC_TYPE_INT or WP_SETTINGS_SPEC_TYPE_FLOAT + + + + + the settings spec object + + + + + + Gets the type of a settings spec. + + + the type of the settings spec + + + + + the settings spec object + + + + + + Increases the reference count of a settings spec object. + + + @self with an additional reference count on it + + + + + a settings spec object + + + + + + Decreases the reference count on @self and frees it when the ref count reaches zero. + + + + + + + a settings spec object + + + + + + + + + + + + + + + + + + + + + + + This interface provides a way to request an item for linking before doing so. This allows item implementations to apply internal policy rules. +A WpSiAcquisition is associated directly with a WpSiLinkable via wp_si_linkable_get_acquisition(). In order to allow switching policies, it is recommended that port info implementations use a separate session item to implement this interface and allow replacing it. + + + + Acquires the @item for linking by @acquisitor. + + +When a link is not allowed by policy, this operation should return an error. +When a link needs to be delayed for a short amount of time (ex. to apply a fade out effect on another item), this operation should finish with a delay. It is safe to assume that after this operation completes, the item will be linked immediately. + + + + + + + the session item + + + + the link that is trying to acquire a port info item + + + + the item that is being acquired + + + + the callback to call when the operation is done + + + + user data for @callback + + + + + + Finishes the operation started by wp_si_acquisition_acquire(). This is meant to be called in the callback that was passed to that method. + + + TRUE on success, FALSE if there was an error + + + + + the session item + + + + the async result + + + + + + Releases the @item, which means that it is being unlinked. + + + + + + + the session item + + + + the link that had previously acquired the item + + + + the port info that is being released + + + + + + Acquires the @item for linking by @acquisitor. + + +When a link is not allowed by policy, this operation should return an error. +When a link needs to be delayed for a short amount of time (ex. to apply a fade out effect on another item), this operation should finish with a delay. It is safe to assume that after this operation completes, the item will be linked immediately. + + + + + + + the session item + + + + the link that is trying to acquire a port info item + + + + the item that is being acquired + + + + the callback to call when the operation is done + + + + user data for @callback + + + + + + Finishes the operation started by wp_si_acquisition_acquire(). This is meant to be called in the callback that was passed to that method. + + + TRUE on success, FALSE if there was an error + + + + + the session item + + + + the async result + + + + + + Releases the @item, which means that it is being unlinked. + + + + + + + the session item + + + + the link that had previously acquired the item + + + + the port info that is being released + + + + + + + + + + + + + + + + + + + the session item + + + + the link that is trying to acquire a port info item + + + + the item that is being acquired + + + + the callback to call when the operation is done + + + + user data for @callback + + + + + + + + + + TRUE on success, FALSE if there was an error + + + + + the session item + + + + the async result + + + + + + + + + + + + + + the session item + + + + the link that had previously acquired the item + + + + the port info that is being released + + + + + + + + + + + + + An interface for port adapters + + + + Gets the format used to configure the adapter session item's ports. + + + The format used to configure the ports of the adapter session item. Some items automatically choose a format when being activated, others never set a format on activation and the user needs to manually set it externally with wp_si_adapter_set_ports_format(). + + + + + the session item + + + + the mode + + + + + + Gets the ports state. + + + The state of the ports + + + + + the session item + + + + + + Sets the format and configures the adapter session item ports using the given format. + + +The result of the operation can be checked using the wp_si_adapter_set_ports_format_finish() API. If format is NULL, the adapter will be configured with the default format. If mode is NULL, the adapter will use "dsp" mode. + + + + + + + the session item + + + + the format to be set + + + + the mode + + + + the callback to call when the operation is done + + + + user data for @callback + + + + + + Finishes the operation started by wp_si_adapter_set_format(). This is meant to be called in the callback that was passed to that method. + + + TRUE on success, FALSE if there was an error + + + + + the session item + + + + the async result + + + + + + Gets the format used to configure the adapter session item's ports. + + + The format used to configure the ports of the adapter session item. Some items automatically choose a format when being activated, others never set a format on activation and the user needs to manually set it externally with wp_si_adapter_set_ports_format(). + + + + + the session item + + + + the mode + + + + + + Gets the ports state. + + + The state of the ports + + + + + the session item + + + + + + Sets the format and configures the adapter session item ports using the given format. + + +The result of the operation can be checked using the wp_si_adapter_set_ports_format_finish() API. If format is NULL, the adapter will be configured with the default format. If mode is NULL, the adapter will use "dsp" mode. + + + + + + + the session item + + + + the format to be set + + + + the mode + + + + the callback to call when the operation is done + + + + user data for @callback + + + + + + Finishes the operation started by wp_si_adapter_set_format(). This is meant to be called in the callback that was passed to that method. + + + TRUE on success, FALSE if there was an error + + + + + the session item + + + + the async result + + + + + + + + + + + + + + + + + + + + + + + + + + + + The format used to configure the ports of the adapter session item. Some items automatically choose a format when being activated, others never set a format on activation and the user needs to manually set it externally with wp_si_adapter_set_ports_format(). + + + + + the session item + + + + the mode + + + + + + + + + + + + + + the session item + + + + the format to be set + + + + the mode + + + + the callback to call when the operation is done + + + + user data for @callback + + + + + + + + + + TRUE on success, FALSE if there was an error + + + + + the session item + + + + the async result + + + + + + + + + + The state of the ports + + + + + the session item + + + + + + + + + + + + + + + + + + + + + A factory for session items. +The most simple way to register a new item implementation would be: +|[<!-- language="C" --> + wp_si_factory_register (core, + wp_si_factory_new_simple ( +]| +And the most simple way to construct an item from a registered factory: +|[<!-- language="C" --> + item = wp_session_item_make (core, +]| + + + Creates a simple factory that constructs objects of a given GType. + + + the new factory + + + + + the factory name; must be a static string! + + + + the WpSessionItem subclass type to instantiate for constructing items + + + + + + Looks up a factory matching a name. + + + the factory matching the lookup name + + + + + the core + + + + the lookup name + + + + + + Creates a new instance of the session item that is constructed by this factory. + + + a new session item instance + + + + + the factory + + + + the core + + + + + + Creates a new instance of the session item that is constructed by this factory. + + + a new session item instance + + + + + the factory + + + + the core + + + + + + Gets the name of the factory. + + + the factory name + + + + + the factory + + + + + + + + + + + + + + + + + + + + + a new session item instance + + + + + the factory + + + + the core + + + + + + + + + + + + + An interface for session items that provide a PipeWire link. + + + + Gets the input item linked by the link. + + + the input item that is linked by this link + + + + + the session item + + + + + + Gets the output item linked by the link. + + + the output item that is linked by this link + + + + + the session item + + + + + + Gets the properties of the link. + + + the properties of the link + + + + + the session item + + + + + + This should return information that is used for registering the link, as a GVariant of type a{ss} that contains additional properties to be added to the list of global properties. + + + registration info for the link + + + + + the session item + + + + + + Gets the input item linked by the link. + + + the input item that is linked by this link + + + + + the session item + + + + + + Gets the output item linked by the link. + + + the output item that is linked by this link + + + + + the session item + + + + + + Gets the properties of the link. + + + the properties of the link + + + + + the session item + + + + + + This should return information that is used for registering the link, as a GVariant of type a{ss} that contains additional properties to be added to the list of global properties. + + + registration info for the link + + + + + the session item + + + + + + + + + + + + + + + + + + + + registration info for the link + + + + + the session item + + + + + + + + + + the properties of the link + + + + + the session item + + + + + + + + + + the output item that is linked by this link + + + + + the session item + + + + + + + + + + the input item that is linked by this link + + + + + the session item + + + + + + + + + + + + + An interface for retrieving PipeWire port information from a session item. This information is used to create links in the nodes graph. + + + + Gets the acquisition interface associated with the item. + + + the acquisition interface associated with this item, or NULL if this item does not require acquiring items before linking them + + + + + the session item + + + + + + This method returns a variant of type "a(uuu)", where each tuple in the array contains the following information: + + + + - u: (guint32) node id + - u: (guint32) port id (the port must belong on the node specified above) + - u: (guint32) the audio channel (enum spa_audio_channel) that this port makes available, or 0 for non-audio content + +The order in which ports appear in this array is important when no channel information is available. The link implementation should link the ports in the order they appear. This is normally a good enough substitute for channel matching. +The @context argument can be used to get different sets of ports from the item. The following well-known contexts are defined: + - NULL: get the standard ports to be linked + - "monitor": get the monitor ports + - "control": get the control port + - "reverse": get the reverse direction ports, if this item controls a filter node, which would have ports on both directions + +Contexts other than NULL may only be used internally to ease the implementation of more complex item relationships. For example, a WpSessionItem that is in control of an input (sink) adapter node may implement WpSiLinkable where the NULL context will return the standard input ports and the "monitor" context will return the adapter's monitor ports. When linking this item to another item, the NULL context will always be used, but the item may internally spawn a secondary WpSessionItem that implements the "monitor" item. That secondary item may implement WpSiLinkable, chaining calls to the WpSiLinkable of the original item using the "monitor" context. This way, the monitor WpSessionItem does not need to share control of the underlying node; it only proxies calls to satisfy the API. + + + a GVariant containing information about the ports of this item + + + + + the session item + + + + an optional context for the ports + + + + + + Gets the acquisition interface associated with the item. + + + the acquisition interface associated with this item, or NULL if this item does not require acquiring items before linking them + + + + + the session item + + + + + + This method returns a variant of type "a(uuu)", where each tuple in the array contains the following information: + + + + - u: (guint32) node id + - u: (guint32) port id (the port must belong on the node specified above) + - u: (guint32) the audio channel (enum spa_audio_channel) that this port makes available, or 0 for non-audio content + +The order in which ports appear in this array is important when no channel information is available. The link implementation should link the ports in the order they appear. This is normally a good enough substitute for channel matching. +The @context argument can be used to get different sets of ports from the item. The following well-known contexts are defined: + - NULL: get the standard ports to be linked + - "monitor": get the monitor ports + - "control": get the control port + - "reverse": get the reverse direction ports, if this item controls a filter node, which would have ports on both directions + +Contexts other than NULL may only be used internally to ease the implementation of more complex item relationships. For example, a WpSessionItem that is in control of an input (sink) adapter node may implement WpSiLinkable where the NULL context will return the standard input ports and the "monitor" context will return the adapter's monitor ports. When linking this item to another item, the NULL context will always be used, but the item may internally spawn a secondary WpSessionItem that implements the "monitor" item. That secondary item may implement WpSiLinkable, chaining calls to the WpSiLinkable of the original item using the "monitor" context. This way, the monitor WpSessionItem does not need to share control of the underlying node; it only proxies calls to satisfy the API. + + + a GVariant containing information about the ports of this item + + + + + the session item + + + + an optional context for the ports + + + + + + + + + + + + + + + a GVariant containing information about the ports of this item + + + + + the session item + + + + an optional context for the ports + + + + + + + + + + the acquisition interface associated with this item, or NULL if this item does not require acquiring items before linking them + + + + + the session item + + + + + + + + + + + + + An event hook that runs a GClosure, synchronously. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + A WpSpaDevice allows running a spa_device object locally, loading the implementation from a SPA factory. This is useful to run device monitors inside the session manager and have control over creating the actual nodes that the spa_device requests to create. +To enable the spa device, call wp_object_activate() requesting WP_SPA_DEVICE_FEATURE_ENABLED. +For actual devices (not device monitors) it also possible and desirable to export the device to PipeWire, which can be done by requesting WP_PROXY_FEATURE_BOUND from wp_object_activate(). When exporting, the export should be done before enabling the device, by requesting both features at the same time. + + + Constructs a SPA_TYPE_INTERFACE_Device by loading the given SPA @factory_name. + + +To export this device to the PipeWire server, you need to call wp_object_activate() requesting WP_PROXY_FEATURE_BOUND and wait for the operation to complete. + + + A new WpSpaDevice wrapping the device that was constructed by the factory, or NULL if the factory does not exist or was unable to construct the device + + + + + the wireplumber core + + + + the name of the SPA factory + + + + properties to be passed to device constructor + + + + + + Constructs an SPA Device object from an existing device handle. + + + A new WpSpaDevice + + + + + the wireplumber core + + + + the spa device handle + + + + additional properties of the device + + + + + + Gets one of the objects managed by this device. + + + the managed object associated with @id + + + + + the spa device + + + + the (device-internal) id of the object to get + + + + + + Gets the properties of this device. + + + the device properties + + + + + the spa device + + + + + + Iterates through all the objects managed by this device. + + + a WpIterator that iterates over all the objects managed by this device + + + + + the spa device + + + + + + Marks a managed object id pending. + + +When an object id is pending, Props from received ObjectConfig events for the id are saved. When wp_spa_device_store_managed_object later sets an object for the id, the saved Props are immediately set on the object and pending status is cleared. +If an object is already set for the id, this has no effect. + + + + + + + the spa device + + + + the (device-internal) id of the object + + + + + + Stores or removes a managed object into/from a device. + + + + + + + the spa device + + + + the (device-internal) id of the object + + + + the object to store or NULL to remove the managed object associated with @id + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Creates a spa json of type array. + + + The new spa json + + + + + the first value format ("n", "b", "i", "f", "s" or "J") + + + + a list of array types and values, followed by NULL + + + + + + This is the va_list version of wp_spa_json_new_array() + + + The new spa json + + + + + the first value format ("n", "b", "i", "f", "s" or "J") + + + + the variable arguments passed to wp_spa_json_new_array() + + + + + + Creates a spa json of type boolean. + + + The new spa json + + + + + the boolean value + + + + + + Creates a spa json of type float. + + + The new spa json + + + + + the float value + + + + + + Constructs a new WpSpaJson from a JSON string. + + + a new WpSpaJson; unlike the "wrap" variants, this function copies the data in @json_str, so it does not need to stay alive. + + + + + a JSON string + + + + + + Constructs a new WpSpaJson from a JSON string with specific length. + + + a new WpSpaJson; unlike the "wrap" variants, this function copies the data in @json_str, so it does not need to stay alive. + + + + + a JSON string + + + + the specific length of the string + + + + + + Creates a spa json of type int. + + + The new spa json + + + + + the int value + + + + + + Creates a spa json of type NULL. + + + The new spa json + + + + + Creates a spa json of type object. + + + The new spa json + + + + + the first object property key + + + + the first property format ("n", "b", "i", "f", "s" or "J") + + + + a list of object properties and values, followed by NULL + + + + + + This is the va_list version of wp_spa_json_new_object() + + + The new spa json + + + + + the first object property key + + + + the first property format ("n", "b", "i", "f", "s" or "J") + + + + the variable arguments passed to wp_spa_json_new_object() + + + + + + Creates a spa json of type string. + + + The new spa json + + + + + the string value + + + + + + Constructs a new WpSpaJson that wraps the given spa_json. + + + a new WpSpaJson that references the data in @json. @json is not copied, so it needs to stay alive. + + + + + a spa_json + + + + + + Constructs a new WpSpaJson that wraps a JSON string. + + + a new WpSpaJson that references the data in @json_str. @json_str is not copied, so it needs to stay alive. + + + + + a JSON string + + + + + + Constructs a new WpSpaJson that wraps a JSON string with specific length. + + + a new WpSpaJson that references the data in @json_str. @json_str is not copied, so it needs to stay alive. + + + + + a JSON string + + + + the specific length of the string + + + + + + Copies a spa json object. + + + The newly copied spa json + + + + + a spa json object + + + + + + If @self is not uniquely owned already, then it is unrefed and a copy of it is returned instead. You should always consider @self as unsafe to use after this call and you should use the returned object instead. + + + the uniquely owned spa json object which may or may not be the same as @self. + + + + + a spa json object + + + + + + Returns the json data. + + + a const pointer to the json data + + + + + a spa json object + + + + + + Returns the json data size. + + + the json data size + + + + + a spa json object + + + + + + Converts a WpSpaJson pointer to a struct spa_json one, for use with native pipewire & spa functions. The returned pointer is owned by WpSpaJson and may not be modified or freed. + + + a const pointer to the underlying spa_json structure + + + + + a spa json object + + + + + + Checks whether the spa json is of type array or not. + + + TRUE if it is of type array, FALSE otherwise + + + + + the spa json object + + + + + + Checks whether the spa json is of type boolean or not. + + + TRUE if it is of type boolean, FALSE otherwise + + + + + the spa json object + + + + + + Checks whether the spa json is of type container or not. + + + TRUE if it is of type container, FALSE otherwise + + + + + the spa json object + + + + + + Checks whether the spa json is of type float or not. + + + TRUE if it is of type float, FALSE otherwise + + + + + the spa json object + + + + + + Checks whether the spa json is of type int or not. + + + TRUE if it is of type int, FALSE otherwise + + + + + the spa json object + + + + + + Checks whether the spa json is of type null or not. + + + TRUE if it is of type null, FALSE otherwise + + + + + the spa json object + + + + + + Checks whether the spa json is of type object or not. + + + TRUE if it is of type object, FALSE otherwise + + + + + the spa json object + + + + + + Checks whether the spa json is of type string or not. + + + TRUE if it is of type string, FALSE otherwise + + + + + the spa json object + + + + + + Checks if the json is the unique owner of its data or not. + + + TRUE if the json owns the data, FALSE otherwise. + + + + + a spa json object + + + + + + Creates a new iterator for a spa json object. + + + the new spa json iterator + + + + + the spa json object + + + + + + Parses the object property values of a spa json object. + + + TRUE if the properties and values were obtained, FALSE otherwise + + + + + the spa json object + + + + the list of property names, formats and values, followed by NULL + + + + + + This is the va_list version of wp_spa_json_object_get() + + + TRUE if the properties and values were obtained, FALSE otherwise + + + + + the spa json object + + + + the variable arguments passed to wp_spa_json_object_get() + + + + + + Parses the array types and values of a spa json object. + + + TRUE if the types and values were obtained, FALSE otherwise + + + + + the spa json object + + + + the list of array types and values, followed by NULL + + + + + + This is the va_list version of wp_spa_json_parse_array() + + + TRUE if the types and values were obtained, FALSE otherwise + + + + + the spa json object + + + + the variable arguments passed to wp_spa_json_parse_array() + + + + + + Parses the boolean value of a spa json object. + + + TRUE if the value was obtained, FALSE otherwise + + + + + the spa json object + + + + the boolean value + + + + + + Parses the float value of a spa json object. + + + TRUE if the value was obtained, FALSE otherwise + + + + + the spa json object + + + + the float value + + + + + + Parses the int value of a spa json object. + + + TRUE if the value was obtained, FALSE otherwise + + + + + the spa json object + + + + the int value + + + + + + Parses the object properties and values of a spa json object. + + + TRUE if the properties and values were obtained, FALSE otherwise + + + + + the spa json object + + + + the list of object properties and values, followed by NULL + + + + + + This is the va_list version of wp_spa_json_parse_object() + + + TRUE if the properties and values were obtained, FALSE otherwise + + + + + the spa json object + + + + the variable arguments passed to wp_spa_json_parse_object() + + + + + + Parses the string value of a spa json object. + + + The newly allocated parsed string + + + + + the spa json object + + + + + + Increases the reference count of a spa json object. + + + @self with an additional reference count on it + + + + + a spa json object + + + + + + Returns a newly allocated json string with length matching the size. + + + the json string with length matching the size + + + + + a spa json object + + + + + + Decreases the reference count on @self and frees it when the ref count reaches zero. + + + + + + + a spa json object + + + + + + + + + Creates a spa json builder of type array. + + + the new spa json builder + + + + + Creates a spa json builder of type object. + + + the new spa json builder + + + + + Adds values into the builder. + + + + + + + the spa json builder object + + + + the json values + + + + + + Adds a boolean value into the builder. + + + + + + + the spa json builder object + + + + the boolean value + + + + + + Adds a float value into the builder. + + + + + + + the spa json builder object + + + + the float value + + + + + + Adds a json string into the builder. + + + + + + + the spa json builder object + + + + the json string + + + + + + Adds a json string with specific length into the builder. + + + + + + + the spa json builder object + + + + the json string + + + + the specific length of the json string + + + + + + Adds a int value into the builder. + + + + + + + the spa json builder object + + + + the int value + + + + + + Adds a json value into the builder. + + + + + + + the spa json builder object + + + + the json value + + + + + + Adds a null value into the builder. + + + + + + + the spa json builder object + + + + + + Adds a property into the builder. + + + + + + + the spa json builder object + + + + the name of the property + + + + + + Adds a string value into the builder. + + + + + + + the spa json builder object + + + + the string value + + + + + + This is the va_list version of wp_spa_json_builder_add() + + + + + + + the spa json builder object + + + + the variable arguments passed to wp_spa_json_builder_add() + + + + + + Ends the builder process and returns the constructed spa json object. + + + the constructed spa json object + + + + + the spa json builder object + + + + + + Increases the reference count of a spa json builder. + + + @self with an additional reference count on it + + + + + a spa json builder object + + + + + + Decreases the reference count on @self and frees it when the ref count reaches zero. + + + + + + + a spa json builder object + + + + + + + + + Creates a spa json array parser. The @json object must be valid for the entire life-cycle of the returned parser. + + + The new spa json parser + + + + + the spa json array to parse + + + + + + Creates a spa json object parser. The @json object must be valid for the entire life-cycle of the returned parser. + + + The new spa json parser + + + + + the spa json object to parse + + + + + + Creates a new spa json parser for undefined type of data. The @json object must be valid for the entire life-cycle of the returned parser. + + +This function allows creating a parser object for any type of spa json and is mostly useful to parse non-standard JSON data that should be treated as if it were an object or array, but does not start with a '{' or '[' character. Such data can be for instance a comma-separated list of single values (array) or key-value pairs (object). Such data is also the main configuration file, which is an object but doesn't start with a '{' character. +If the data is an array or object, the parser will not enter it and the only token it will be able to parse is the same @json object that is passed in as an argument. Use wp_spa_json_parser_new_array() or wp_spa_json_parser_new_object() to parse arrays or objects. + + + The new spa json parser + + + + + the spa json to parse + + + + + + + + + + + + + + + + + Gets the values from a spa json parser object. + + + TRUE if the value was obtained, FALSE otherwise + + + + + the spa json parser object + + + + a list of values to get, followed by NULL + + + + + + Gets the boolean value from a spa json parser. + + + TRUE if the value was obtained, FALSE otherwise + + + + + the spa json parser object + + + + the boolean value + + + + + + Gets the float value from a spa json parser object. + + + TRUE if the value was obtained, FALSE otherwise + + + + + the spa json parser object + + + + the float value + + + + + + Gets the int value from a spa json parser object. + + + TRUE if the value was obtained, FALSE otherwise + + + + + the spa json parser object + + + + the int value + + + + + + Gets the spa json value from a spa json parser object. + + +the returned spa json object references the original data instead of copying it, therefore the original data must be valid for the entire life-cycle of the returned object + + + The spa json value or NULL if it could not be obtained + + + + + the spa json parser object + + + + + + Gets the null value from a spa json parser. + + + TRUE if the null value is present, FALSE otherwise + + + + + the spa json parser object + + + + + + Gets the string value from a spa json parser object. + + + The newly allocated parsed string + + + + + the spa json parser object + + + + + + This is the va_list version of wp_spa_json_parser_get() + + + TRUE if the value was obtained, FALSE otherwise + + + + + the spa json parser object + + + + the variable arguments passed to wp_spa_json_parser_get() + + + + + + Increases the reference count of a spa json parser. + + + @self with an additional reference count on it + + + + + a spa json parser object + + + + + + Decreases the reference count on @self and frees it when the ref count reaches zero. + + + + + + + a spa json parser object + + + + + + + + + Creates a spa pod of type boolean. + + + The new spa pod + + + + + the boolean value + + + + + + Creates a spa pod of type bytes. + + + The new spa pod + + + + + the bytes value + + + + the length of the bytes value + + + + + + Creates a spa pod of type choice. + + + The new spa pod + + + + + the name of the choice type ("Range", "Step", ...), + + + + a list of choice values, followed by NULL + + + + + + This is the va_list version of wp_spa_pod_new_choice() + + + The new spa pod + + + + + the name of the choice type ("Range", "Step", ...) + + + + the variable arguments passed to wp_spa_pod_new_choice() + + + + + + Creates a spa pod of type double. + + + The new spa pod + + + + + the double value + + + + + + Creates a spa pod of type Fd. + + + The new spa pod + + + + + the Fd value + + + + + + Creates a spa pod of type float. + + + The new spa pod + + + + + the float value + + + + + + Creates a spa pod of type fraction. + + + The new spa pod + + + + + the numerator value of the fraction + + + + the denominator value of the fraction + + + + + + Creates a spa pod of type Id. + + + The new spa pod + + + + + the Id value + + + + + + Creates a spa pod of type int. + + + The new spa pod + + + + + the int value + + + + + + Creates a spa pod of type long. + + + The new spa pod + + + + + the long value + + + + + + Creates a spa pod of type None. + + + The new spa pod + + + + + Creates a spa pod of type object. + + + The new spa pod + + + + + the type name of the object type + + + + the id name of the object, + + + + a list of object properties with their values, followed by NULL + + + + + + This is the va_list version of wp_spa_pod_new_object() + + + The new spa pod + + + + + the type name of the object type + + + + the id name of the object + + + + the variable arguments passed to wp_spa_pod_new_object() + + + + + + Creates a spa pod of type pointer. + + + The new spa pod + + + + + the name of the type of the pointer + + + + the pointer value + + + + + + Creates a spa pod of type rectangle. + + + The new spa pod + + + + + the width value of the rectangle + + + + the height value of the rectangle + + + + + + Creates a spa pod of type sequence. + + + The new spa pod + + + + + the unit of the sequence + + + + a list of sequence controls with their values, followed by NULL + + + + + + This is the va_list version of wp_spa_pod_new_sequence() + + + The new spa pod + + + + + the unit of the sequence + + + + the variable arguments passed to wp_spa_pod_new_sequence() + + + + + + Creates a spa pod of type string. + + + The new spa pod + + + + + the string value + + + + + + Constructs a new WpSpaPod that wraps the given spa_pod. + + + a new WpSpaPod that references the data in @pod. @pod is not copied, so it needs to stay alive. The returned WpSpaPod can be modified by using the setter functions, in which case @pod will be modified underneath. + + + + + a spa_pod + + + + + + Constructs a new immutable WpSpaPod that wraps the given spa_pod. + + + a new WpSpaPod that references the data in @pod. @pod is not copied, so it needs to stay alive. The returned WpSpaPod cannot be modified, unless it's copied first. + + + + + a constant spa_pod + + + + + + Copies a spa pod object. + + + The newly copied spa pod + + + + + a spa pod object + + + + + + If @self is not uniquely owned already, then it is unrefed and a copy of it is returned instead. You should always consider @self as unsafe to use after this call and you should use the returned object instead. + + + the uniquely owned spa pod object which may or may not be the same as @self. + + + + + a spa pod object + + + + + + Checks whether two spa pod objects have the same value or not. + + + TRUE if both spa pod objects have the same values, FALSE othewrise. + + + + + the spa pod object + + + + the pod with the value to be compared with + + + + + + + + + + + + + + + + + + + + Fixates choices in an object pod so that they only have one value. + + + TRUE if the pod was an object and it went through the fixation procedure, FALSE otherwise + + + + + a spa pod + + + + + + Gets the child of a spa pod array object. + + + the child of the spa pod array object + + + + + a spa pod choice object + + + + + + Gets the boolean value of a spa pod object. + + + TRUE if the value was obtained, FALSE otherwise + + + + + the spa pod object + + + + the boolean value + + + + + + Gets the bytes value and its len of a spa pod object. + + + TRUE if the value was obtained, FALSE otherwise + + + + + the spa pod object + + + + the bytes value + + + + the length of the bytes value + + + + + + Gets the child of a spa pod choice object. + + + the child of the spa pod choice object + + + + + a spa pod choice object + + + + + + If the pod is a Choice, this gets the choice type (Range, Step, Enum, ...) + + + the choice type of the choice pod + + + + + a choice pod + + + + + + Gets the offset, type name and spa pod value of a spa pod control. + + + TRUE if the value was obtained, FALSE otherwise + + + + + the spa pod object + + + + the offset of the control + + + + the control type (Properties, Midi, ...) + + + + the spa pod value of the control + + + + + + Gets the double value of a spa pod object. + + + TRUE if the value was obtained, FALSE otherwise + + + + + the spa pod object + + + + the double value + + + + + + Gets the Fd value of a spa pod object. + + + TRUE if the value was obtained, FALSE otherwise + + + + + the spa pod object + + + + the Fd value + + + + + + Gets the float value of a spa pod object. + + + TRUE if the value was obtained, FALSE otherwise + + + + + the spa pod object + + + + the float value + + + + + + Gets the fractions's numerator and denominator value of a spa pod object. + + + TRUE if the value was obtained, FALSE otherwise + + + + + the spa pod object + + + + the fractions's numerator value + + + + the fractions's denominator value + + + + + + Gets the Id value of a spa pod object. + + + TRUE if the value was obtained, FALSE otherwise + + + + + the spa pod object + + + + the Id value + + + + + + Gets the int value of a spa pod object. + + + TRUE if the value was obtained, FALSE otherwise + + + + + the spa pod object + + + + the int value + + + + + + Gets the long value of a spa pod object. + + + TRUE if the value was obtained, FALSE otherwise + + + + + the spa pod object + + + + the long value + + + + + + Gets the object properties values of a spa pod object. + + + TRUE if the object properties values were obtained, FALSE otherwise + + + + + the spa pod object + + + + the id name of the object, + + + + the list of the object properties values, followed by NULL + + + + + + This is the va_list version of wp_spa_pod_get_object() + + + TRUE if the object properties values were obtained, FALSE otherwise + + + + + the spa pod object + + + + the id name of the object + + + + the variable arguments passed to wp_spa_pod_get_object() + + + + + + Gets the pointer value and its type name of a spa pod object. + + + TRUE if the value was obtained, FALSE otherwise + + + + + the spa pod object + + + + the pointer value + + + + + + Gets the name, flags and spa pod value of a spa pod property. + + + TRUE if the value was obtained, FALSE otherwise + + + + + the spa pod object + + + + the name of the property + + + + the spa pod value of the property + + + + + + Gets the rectangle's width and height value of a spa pod object. + + + TRUE if the value was obtained, FALSE otherwise + + + + + the spa pod object + + + + the rectangle's width value + + + + the rectangle's height value + + + + + + Converts a WpSpaPod pointer to a struct spa_pod one, for use with native pipewire & spa functions. The returned pointer is owned by WpSpaPod and may not be modified or freed. + + + a const pointer to the underlying spa_pod structure + + + + + a spa pod object + + + + + + Gets the SPA type of the spa pod. + + +If the pod is an object or pointer, this will return the derived object/pointer type directly. If the pod is an object property or a control, this will return the type of the contained value. + + + the type of the spa pod + + + + + a spa pod + + + + + + Gets the string value of a spa pod object. + + + TRUE if the value was obtained, FALSE otherwise + + + + + the spa pod object + + + + the string value + + + + + + Gets the struct's values of a spa pod object. + + + TRUE if the struct values were obtained, FALSE otherwise + + + + + the spa pod object + + + + the list of the struct values, followed by NULL + + + + + + This is the va_list version of wp_spa_pod_get_struct() + + + TRUE if the struct values were obtained, FALSE otherwise + + + + + the spa pod object + + + + the variable arguments passed to wp_spa_pod_get_struct() + + + + + + Checks whether the spa pod is of type array or not. + + + TRUE if it is of type array, FALSE otherwise + + + + + the spa pod object + + + + + + Checks whether the spa pod is of type boolean or not. + + + TRUE if it is of type boolean, FALSE otherwise + + + + + the spa pod object + + + + + + Checks whether the spa pod is of type bytes or not. + + + TRUE if it is of type bytes, FALSE otherwise + + + + + the spa pod object + + + + + + Checks whether the spa pod is of type choice or not. + + + TRUE if it is of type choice, FALSE otherwise + + + + + the spa pod object + + + + + + Checks whether the spa pod is of type control or not. + + + TRUE if it is of type control, FALSE otherwise + + + + + the spa pod object + + + + + + Checks whether the spa pod is of type double or not. + + + TRUE if it is of type double, FALSE otherwise + + + + + the spa pod object + + + + + + Checks whether the spa pod is of type Fd or not. + + + TRUE if it is of type Fd, FALSE otherwise + + + + + the spa pod object + + + + + + Checks whether the spa pod is of type float or not. + + + TRUE if it is of type float, FALSE otherwise + + + + + the spa pod object + + + + + + Checks whether the spa pod is of type fraction or not. + + + TRUE if it is of type fraction, FALSE otherwise + + + + + the spa pod object + + + + + + Checks whether the spa pod is of type Id or not. + + + TRUE if it is of type Id, FALSE otherwise + + + + + the spa pod object + + + + + + Checks whether the spa pod is of type int or not. + + + TRUE if it is of type int, FALSE otherwise + + + + + the spa pod object + + + + + + Checks whether the spa pod is of type long or not. + + + TRUE if it is of type long, FALSE otherwise + + + + + the spa pod object + + + + + + Checks whether the spa pod is of type none or not. + + + TRUE if it is of type none, FALSE otherwise + + + + + the spa pod object + + + + + + Checks whether the spa pod is of type object or not. + + + TRUE if it is of type object, FALSE otherwise + + + + + the spa pod object + + + + + + Checks whether the spa pod is of type pointer or not. + + + TRUE if it is of type pointer, FALSE otherwise + + + + + the spa pod object + + + + + + Checks whether the spa pod is of type property or not. + + + TRUE if it is of type property, FALSE otherwise + + + + + the spa pod object + + + + + + Checks whether the spa pod is of type rectangle or not. + + + TRUE if it is of type rectangle, FALSE otherwise + + + + + the spa pod object + + + + + + Checks whether the spa pod is of type sequence or not. + + + TRUE if it is of type sequence, FALSE otherwise + + + + + the spa pod object + + + + + + Checks whether the spa pod is of type string or not. + + + TRUE if it is of type string, FALSE otherwise + + + + + the spa pod object + + + + + + Checks whether the spa pod is of type struct or not. + + + TRUE if it is of type struct, FALSE otherwise + + + + + the spa pod object + + + + + + Checks if the pod is the unique owner of its data or not. + + + TRUE if the pod owns the data, FALSE otherwise. + + + + + a spa pod object + + + + + + Creates a new iterator for a spa pod object. + + + the new spa pod iterator + + + + + a spa pod object + + + + + + Increases the reference count of a spa pod object. + + + @self with an additional reference count on it + + + + + a spa pod object + + + + + + Sets a boolean value in the spa pod object. + + + TRUE if the value could be set, FALSE othewrise. + + + + + the spa pod object + + + + the boolean value + + + + + + Sets a double value in the spa pod object. + + + TRUE if the value could be set, FALSE othewrise. + + + + + the spa pod object + + + + the double value + + + + + + Sets a Fd value in the spa pod object. + + + TRUE if the value could be set, FALSE othewrise. + + + + + the spa pod object + + + + the Fd value + + + + + + Sets a float value in the spa pod object. + + + TRUE if the value could be set, FALSE othewrise. + + + + + the spa pod object + + + + the float value + + + + + + Sets the numerator and denominator values of a fraction in the spa pod object. + + + TRUE if the value could be set, FALSE othewrise. + + + + + the spa pod object + + + + the numerator value of the fraction + + + + the denominator value of the fraction + + + + + + Sets an Id value in the spa pod object. + + + TRUE if the value could be set, FALSE othewrise. + + + + + the spa pod object + + + + the Id value + + + + + + Sets an int value in the spa pod object. + + + TRUE if the value could be set, FALSE othewrise. + + + + + the spa pod object + + + + the int value + + + + + + Sets a long value in the spa pod object. + + + TRUE if the value could be set, FALSE othewrise. + + + + + the spa pod object + + + + the long value + + + + + + Sets the value of a spa pod object in the current spa pod object. The spa pod objects must be of the same value. + + + TRUE if the value could be set, FALSE othewrise. + + + + + the spa pod object + + + + the pod with the value to be set + + + + + + Sets a pointer value with its type name in the spa pod object. + + + TRUE if the value could be set, FALSE othewrise. + + + + + the spa pod object + + + + the name of the type of the pointer + + + + the pointer value + + + + + + Sets the width and height values of a rectangle in the spa pod object. + + + TRUE if the value could be set, FALSE othewrise. + + + + + the spa pod object + + + + the width value of the rectangle + + + + the height value of the rectangle + + + + + + Decreases the reference count on @self and frees it when the ref count reaches zero. + + + + + + + a spa pod object + + + + + + + + + Creates a spa pod builder of type array. + + + the new spa pod builder + + + + + Creates a spa pod builder of type choice. + + + the new spa pod builder + + + + + the name of the choice type ("Range", "Step", ...) + + + + + + Creates a spa pod builder of type object. + + + the new spa pod builder + + + + + the type name of the object type + + + + the Id name of the object + + + + + + Creates a spa pod builder of type sequence. + + + the new spa pod builder + + + + + + + + + + Creates a spa pod builder of type struct. + + + the new spa pod builder + + + + + Adds a list of values into the builder. + + + + + + + the spa pod builder object + + + + a list of additional values, followed by NULL + + + + + + Adds a boolean value into the builder. + + + + + + + the spa pod builder object + + + + the boolean value + + + + + + Adds a bytes value with its length into the builder. + + + + + + + the spa pod builder object + + + + the bytes value + + + + the length of the bytes value + + + + + + Adds a control into the builder. + + + + + + + the spa pod builder object + + + + the offset of the control + + + + the type name of the control + + + + + + Adds a double value into the builder. + + + + + + + the spa pod builder object + + + + the double value + + + + + + Adds a Fd value into the builder. + + + + + + + the spa pod builder object + + + + the Fd value + + + + + + Adds a float value into the builder. + + + + + + + the spa pod builder object + + + + the float value + + + + + + Adds the numerator and denominator values of a fraction into the builder. + + + + + + + the spa pod builder object + + + + the numerator value of the fraction + + + + the denominator value of the fraction + + + + + + Adds a Id value into the builder. + + + + + + + the spa pod builder object + + + + the Id value + + + + + + Adds a int value into the builder. + + + + + + + the spa pod builder object + + + + the int value + + + + + + Adds a long value into the builder. + + + + + + + the spa pod builder object + + + + the long value + + + + + + Adds a none value into the builder. + + + + + + + the spa pod builder object + + + + + + Adds a pod value into the builder. + + + + + + + the spa pod builder object + + + + the pod value + + + + + + Adds a pointer value with its type name into the builder. + + + + + + + the spa pod builder object + + + + the type name that the pointer points to + + + + the pointer value + + + + + + Adds a property into the builder. + + + + + + + the spa pod builder object + + + + the name of the property + + + + + + Adds a property into the builder. + + + + + + + the spa pod builder object + + + + the id of the property + + + + + + Adds the width and height values of a rectangle into the builder. + + + + + + + the spa pod builder object + + + + the width value of the rectangle + + + + the height value of the rectangle + + + + + + Adds a string value into the builder. + + + + + + + the spa pod builder object + + + + the string value + + + + + + Adds a list of values into the builder. + + + + + + + the spa pod builder object + + + + the variable arguments passed to wp_spa_pod_builder_add() + + + + + + Ends the builder process and returns the constructed spa pod object. + + + the constructed spa pod object + + + + + the spa pod builder object + + + + + + Increases the reference count of a spa pod builder. + + + @self with an additional reference count on it + + + + + a spa pod builder object + + + + + + Decreases the reference count on @self and frees it when the ref count reaches zero. + + + + + + + a spa pod builder object + + + + + + + + + Creates an object spa pod parser. The @pod object must be valid for the entire life-cycle of the returned parser. + + + The new spa pod parser + + + + + the object spa pod to parse + + + + the Id name of the object + + + + + + Creates an struct spa pod parser. The @pod object must be valid for the entire life-cycle of the returned parser. + + + The new spa pod parser + + + + + the struct spa pod to parse + + + + + + Ends the parser process. + + + + + + + the spa pod parser object + + + + + + Gets a list of values from a spa pod parser object. + + + TRUE if the values were obtained, FALSE otherwise + + + + + the spa pod parser object + + + + a list of values to get, followed by NULL + + + + + + Gets the boolean value from a spa pod parser. + + + TRUE if the value was obtained, FALSE otherwise + + + + + the spa pod parser object + + + + the boolean value + + + + + + Gets the bytes value and its length from a spa pod parser object. + + + TRUE if the value was obtained, FALSE otherwise + + + + + the spa pod parser object + + + + the bytes value + + + + the length of the bytes value + + + + + + Gets the double value from a spa pod parser object. + + + TRUE if the value was obtained, FALSE otherwise + + + + + the spa pod parser object + + + + the double value + + + + + + Gets the Fd value from a spa pod parser object. + + + TRUE if the value was obtained, FALSE otherwise + + + + + the spa pod parser object + + + + the Fd value + + + + + + Gets the float value from a spa pod parser object. + + + TRUE if the value was obtained, FALSE otherwise + + + + + the spa pod parser object + + + + the float value + + + + + + Gets the fractions's numerator and denominator value from a spa pod parser object. + + + TRUE if the value was obtained, FALSE otherwise + + + + + the spa pod parser object + + + + the fractions's numerator value + + + + the fractions's denominator value + + + + + + Gets the Id value from a spa pod parser object. + + + TRUE if the value was obtained, FALSE otherwise + + + + + the spa pod parser object + + + + the Id value + + + + + + Gets the int value from a spa pod parser object. + + + TRUE if the value was obtained, FALSE otherwise + + + + + the spa pod parser object + + + + the int value + + + + + + Gets the long value from a spa pod parser object. + + + TRUE if the value was obtained, FALSE otherwise + + + + + the spa pod parser object + + + + the long value + + + + + + Gets the spa pod value from a spa pod parser object. + + + The spa pod value or NULL if it could not be obtained + + + + + the spa pod parser object + + + + + + Gets the pointer value and its type name from a spa pod parser object. + + + TRUE if the value was obtained, FALSE otherwise + + + + + the spa pod parser object + + + + the pointer value + + + + + + Gets the rectangle's width and height value from a spa pod parser object. + + + TRUE if the value was obtained, FALSE otherwise + + + + + the spa pod parser object + + + + the rectangle's width value + + + + the rectangle's height value + + + + + + Gets the string value from a spa pod parser object. + + + TRUE if the value was obtained, FALSE otherwise + + + + + the spa pod parser object + + + + the string value + + + + + + This is the va_list version of wp_spa_pod_parser_get() + + + TRUE if the values were obtained, FALSE otherwise + + + + + the spa pod parser object + + + + the variable arguments passed to wp_spa_pod_parser_get() + + + + + + Increases the reference count of a spa pod parser. + + + @self with an additional reference count on it + + + + + a spa pod sparser object + + + + + + Decreases the reference count on @self and frees it when the ref count reaches zero. + + + + + + + a spa pod parser object + + + + + + + + Looks up the type id from a given type name. + + + the corresponding type id or WP_SPA_TYPE_INVALID if not found + + + + + the name to look up + + + + + + Gets the table with the values that can be stored in the special "id" field of an object of the given @type. + + +Object pods (see WpSpaPod) always have a special "id" field along with other fields that can be defined. This "id" field can only store values of a specific SPA_TYPE_Id type. This function returns the table that contains the possible values for that field. + + + the table with the values that can be stored in the special "id" field of an object of the given @type + + + + + the type id of an object type + + + + + + Gets the values table of an SPA type. + + + the associated WpSpaIdTable that contains possible values or object fields for this type, or NULL + + + + + a type id + + + + + + Checks if an SPA type is a fundamental type. + + + TRUE if the @type has no parent, FALSE otherwise + + + + + a type id + + + + + + Checks if an SPA type is an Id type. + + + TRUE if the @type is a SPA_TYPE_Id, FALSE otherwise + + + + + a type id + + + + + + Checks if an SPA type is an Object type. + + + TRUE if the @type is a SPA_TYPE_Object, FALSE otherwise + + + + + a type id + + + + + + Gets the name of an SPA type. + + + the complete name of the given @type or NULL if @type is invalid + + + + + a type id + + + + + + Gets the parent type of an SPA type. + + + the direct parent type of the given @type; if the type is fundamental (i.e. has no parent), the returned type is the same as @type + + + + + a type id + + + + + + + The WpState class saves and loads properties from a file + + + Constructs a new state object. + + + the new WpState + + + + + the state name + + + + + + Clears the state removing its file. + + + + + + + the state + + + + + + Gets the location of a state object. + + + the location of this state + + + + + the state + + + + + + Gets the name of a state object. + + + the name of this state + + + + + the state + + + + + + Loads the state data from the file system. + + +This function will never fail. If it cannot load the state, for any reason, it will simply return an empty WpProperties, behaving as if there was no previous state stored. + + + a new WpProperties containing the state data + + + + + the state + + + + + + Saves new properties in the state, overwriting all previous data. + + + TRUE if the properties could be saved, FALSE otherwise + + + + + the state + + + + the properties to save + + + + + + Saves new properties in the state, overwriting all previous data, after a timeout. + + +This is similar to wp_state_save() but it will save the state after a timeout has elapsed. If the state is saved again before the timeout elapses, the timeout is reset. +This function is useful to avoid saving the state too often. When called consecutively, it will save the state only once. Every time it is called, it will cancel the previous timer and start a new one, resulting in timing out only after the last call. + + + + + + + the state + + + + the core, used to add the timeout callback to the main loop + + + + the properties to save. This object will be referenced and kept alive until the timeout elapses, but not deep copied. + + + + + + + + + + + + + + + + + + + A transition is an asynchronous operation, like GTask, that contains an internal state machine, where a series of 'steps' are executed in order to complete the operation. +For every step, _WpTransitionClass::get_next_step() is called in order to determine the next step to execute. Afterwards, _WpTransitionClass::execute_step() is called to perform any actions necessary to complete this step. When execution of the step is done, the operation's code must call wp_transition_advance() in order to continue to the next step. If an error occurs, the operation's code must call wp_transition_return_error() instead, in which case the transition completes immediately and wp_transition_had_error() returns TRUE. +Typically, every step will start an asynchronous operation. Although it is possible, the WpTransition base class does not expect _WpTransitionClass::execute_step() to call wp_transition_advance() directly. Instead, it is expected that wp_transition_advance() will be called from the callback that the step's asynchronous operation will call when it is completed. + + + + Creates a WpTransition acting on @source_object. + + +When the transition is done, @callback will be invoked. +The transition does not automatically start executing steps. You must call wp_transition_advance() after creating it in order to start it. +The transition is automatically unref'ed after the @callback has been executed. If you wish to keep an additional reference on it, you need to ref it explicitly. + + + the new transition + + + + + the GType of the WpTransition subclass to instantiate + + + + the GObject that owns this task, or NULL + + + + optional GCancellable + + + + a GAsyncReadyCallback + + + + user data passed to @callback + + + + + + Creates a WpTransition acting on @source_object. When the transition is done, @closure will be invoked. + + +The transition does not automatically start executing steps. You must call wp_transition_advance() after creating it in order to start it. +Note that the transition is automatically unref'ed after the @closure has been executed. If you wish to keep an additional reference on it, you need to ref it explicitly. + + + the new transition + + + + + the GType of the WpTransition subclass to instantiate + + + + the GObject that owns this task, or NULL + + + + optional GCancellable + + + + a GAsyncReadyCallback wrapped in a GClosure + + + + + + Returns the final return status of the transition and its error, if there was one. + + +This is meant to be called from within the GAsyncReadyCallback that was specified in wp_transition_new(). + + + TRUE if the transition completed successfully, FALSE if there was an error + + + + + a transition, as a GAsyncResult + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Advances the transition to the next step. + + +This initially calls _WpTransitionClass::get_next_step() in order to determine what the next step is. If _WpTransitionClass::get_next_step() returns a step different than the previous one, it calls _WpTransitionClass::execute_step() to execute it. +The very first time that _WpTransitionClass::get_next_step() is called, its @step parameter equals WP_TRANSITION_STEP_NONE. +When _WpTransitionClass::get_next_step() returns WP_TRANSITION_STEP_NONE this function completes the transition, calling the transition's callback and then unref-ing the transition. +When _WpTransitionClass::get_next_step() returns WP_TRANSITION_STEP_ERROR, this function calls wp_transition_return_error(), unless it has already been called directly by _WpTransitionClass::get_next_step(). +In error conditions, _WpTransitionClass::execute_step() is called once with @step being WP_TRANSITION_STEP_ERROR, allowing the implementation to rollback any changes or cancel underlying jobs, if necessary. + + + + + + + the transition + + + + + + Checks if the transition completed. + + + TRUE if the transition has completed (with or without an error), FALSE otherwise + + + + + the transition + + + + + + Gets @self 's data. + + +See wp_transition_set_data(). + + + the transition's data + + + + + the transition + + + + + + Gets the source object from the transition. + + +Like g_async_result_get_source_object(), but does not ref the object. + + + the source object + + + + + the transition + + + + + + Gets @self 's source tag. + + +See wp_transition_set_source_tag(). + + + the transition's source tag + + + + + the transition + + + + + + Checks if the transition completed with an error. + + + TRUE if the transition completed with an error, FALSE otherwise + + + + + the transition + + + + + + Checks if @self has the given @tag (generally a function pointer indicating the function @self was created by). + + + TRUE if @self has the indicated @tag , FALSE if not. + + + + + the transition + + + + a tag + + + + + + Completes the transition with an error. + + +This can be called anytime from within any virtual function or an async job handler. +In most cases this will also unref the transition, so it is not safe to access it after this function has been called. + + + + + + + the transition + + + + a GError + + + + + + Sets @self 's data (freeing the existing data, if any). This can be an arbitrary user structure that holds data associated with this transition. + + + + + + + the transition + + + + transition-specific user data + + + + GDestroyNotify for @data + + + + + + Sets @self 's source tag. + + +You can use this to tag a transition's return value with a particular pointer (usually a pointer to the function doing the tagging) and then later check it using wp_transition_get_source_tag() (or g_async_result_is_tagged()) in the transition's "finish" function, to figure out if the response came from a particular place. + + + + + + + the transition + + + + an opaque pointer indicating the source of this transition + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Searches for @filename in the hierarchy of directories specified by the @flags parameter. + + +Returns the highest priority file found in the hierarchy of directories specified by the @flags parameter. The @subdir parameter is the name of the subdirectory to search in, inside the specified directories. If @subdir is NULL, the base path of each directory is used. +The @filename parameter is the name of the file to search for. If the file is found, its full path is returned. If the file is not found, NULL is returned. The file is considered found if it is a regular file. +If the @filename is an absolute path, it is tested for existence and returned as is, ignoring the lookup directories in @flags as well as the @subdir parameter. + + + A newly allocated string with the absolute, canonicalized file path, or NULL if the file was not found. + + + + + flags to specify the directories to look into and other options specific to the kind of file being looked up + + + + the name of the subdirectory to search in, inside the specified directories + + + + the name of the file to search for + + + + + + Creates an iterator to iterate over all files that match @suffix within the @subdir of the directories specified in @flags. + + +The @subdir parameter is the name of the subdirectory to search in, inside the directories specified by @flags. If @subdir is NULL, the base path of each directory is used. If @subdir is an absolute path, files are only looked up in that directory and the directories in @flags are ignored. +The @suffix parameter is the filename suffix to match. If @suffix is NULL, all files are matched. +The iterator will iterate over the absolute paths of all the files files found, in the order of priority of the directories, starting from the lowest priority directory (e.g. /usr/share/wireplumber) and ending with the highest priority directory (e.g. $XDG_CONFIG_HOME/wireplumber). Files within each directory are also sorted by filename. + + + a new iterator iterating over strings which are absolute & canonicalized paths to the files found + + + + + flags to specify the directories to look into and other options specific to the kind of file being looked up + + + + the name of the subdirectory to search in, inside the configuration directories + + + + The filename suffix, NULL matches all entries + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Gets the WirePlumber library API version. + + + WirePlumber library API version + + + + + Gets the WirePlumber library version. + + + WirePlumber library version + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Initializes WirePlumber and PipeWire underneath. + + +@flags can modify which parts are initialized, in cases where you want to handle part of this initialization externally. + + + + + + + initialization flags + + + + + + Matches the given properties against a set of rules described in JSON and calls the given callback to perform actions on a successful match. + + +The given JSON should be an array of objects, where each object has a "matches" and an "actions" property. The "matches" value should also be an array of objects, where each object is a set of properties to match. Inside such an object, all properties must match to consider a successful match. However, if multiple objects are provided, only one object needs to match. +The "actions" value should be an object where the key is the action name and the value can be any valid JSON. Both the action name and the value are passed as-is on the @callback. + + + FALSE if an error occurred, TRUE otherwise + + + + + a JSON array containing rules in the described format + + + + the properties to match against the rules + + + + a function to call for each action on a successful match + + + + data to be passed to @callback + + + + + + Matches the given properties against a set of rules described in JSON and updates the properties if the rule actions include the "update-props" action. + + + the number of properties that were updated + + + + + a JSON array containing rules in the format accepted by wp_json_utils_match_rules() + + + + the properties to match against the rules and also update, acting on the "update-props" action + + + + + + Merges two JSON containers (objects or arrays) into one. + + +If both @a and @b are objects, the result will be a new object containing all properties from both @a and @b. If a property exists in both @a and @b, the values are recursively merged. If a property exists in both @a and @b and the property name starts with the "override." prefix in either of those, the value from the key with the prefix is used. +If both @a and @b are arrays, the result will be a new array containing all elements from both @a and @b. +If @a and @b are not of the same type, NULL is returned. + + + a new JSON container containing the merged contents of @a and @b or NULL if @a and @b are not of the same type + + + + + a JSON container + + + + a JSON container + + + + + + + + + + + + + + + + + + + + + + + + + + + + Used internally by the debug logging macros. Avoid using it directly. + Use wp_logt_checked instead. + +This assumes that the arguments are correct and that the log_topic is enabled for the given log_level. No additional checks are performed. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + private, called from wp_init() + + + + + + + + + + + + + + + + + + + + + + + WirePlumber's GLogWriterFunc. + + +This is installed automatically when you call wp_init() with WP_INIT_SET_GLIB_LOG set in the flags + + + + + + + + + + + + + + + + + + + + + Used internally by the debug logging macros. Avoid using it directly. + + +This assumes that the arguments are correct and that the log_topic is enabled for the given log_level. No additional checks are performed. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Registers an additional WpSpaIdTable in the spa type system. + + +This is useful to add custom enumeration types. +Note that both @name and @values must be statically allocated, or otherwise guaranteed to be kept in memory until wp_spa_dynamic_type_deinit() is called. No memory copy is done by this function. + + + the new table + + + + + the name of the id table + + + + an array of spa_type_info that contains the values of the table + + + + + + Deinitializes the spa type registry. + + +You do not need to ever call this, unless you want to free memory at the end of the execution of a test, so that it doesn't show as leaked in the memory profiler. + + + + + + + Initializes the spa dynamic type registry. + + +This allows registering new spa types at runtime. The spa type system still works if this function is not called. +Normally called by wp_init() when WP_INIT_SPA_TYPES is passed in its flags. + + + + + + + Registers an additional type in the spa type system. + + +This is useful to add a custom pod object type. +Note that both @name and @values must be statically allocated, or otherwise guaranteed to be kept in memory until wp_spa_dynamic_type_deinit() is called. No memory copy is done by this function. + + + the new type + + + + + the name of the type + + + + the parent type + + + + an array of spa_type_info that contains the values of the type, used only for Object types + + + + + + Finds a value in an SPA Id table. + + + the WpSpaIdValue associated with @value, or NULL + + + + + the id table + + + + a numeric value that is contained in the table + + + + + + Finds a named value in an SPA Id table. + + + the WpSpaIdValue associated with @name, or NULL + + + + + the id table + + + + the full name of a value that is contained in the table + + + + + + Finds a short named value in an SPA Id table. + + + the WpSpaIdValue associated with @short_name, or NULL + + + + + the id table + + + + the short name of a value that is contained in the table + + + + + + Finds a WpSpaIdTable given its name. + + +This name can either be the full type name of an object type, or the name of an enum (which is (!!) a type). For example, "Spa:Pod:Object:Param:Format" and "Spa:Enum:ParamId" are both valid table names. + + + the associated table, or NULL + + + + + the full name of an id table + + + + + + + + + + + + This function returns an iterator that allows you to iterate through the values associated with this table. + + +The items in the iterator are of type WpSpaIdValue. + + + a WpIterator that iterates over WpSpaIdValue items + + + + + the id table + + + + + + If the value type of @id is SPA_TYPE_Array, this function returns the type that is allowed to be contained inside the array. + + +When the returned type is (or is derived from) SPA_TYPE_Id or SPA_TYPE_Object, @table is set to point to the WpSpaIdTable that contains the possible Id values / object fields. + + + the type that is allowed in the array, if @id represents an object field that takes an array as value + + + + + an id value + + + + the associated WpSpaIdTable + + + + + + Looks up an id value (enum, flag or object field) directly from its full name. + + +For instance, "Spa:Enum:Direction:Input" will resolve to the id value that represents "Input" in the "Spa:Enum:Direction" enum. + + + the id value for @name, or NULL if no such id value was found + + + + + the full name of an id value + + + + + + Looks up an id value given its container @table_name and its numeric representation, @id. + + + the id value or NULL if it was not found + + + + + the name of the WpSpaIdTable to look up the value in + + + + the numeric representation of the value to look up + + + + + + Looks up an id value given its container @table_name and its @short_name. + + + the id value or NULL if it was not found + + + + + the name of the WpSpaIdTable to look up the value in + + + + the short name of the value to look up + + + + + + + + + + + + Returns the value type associated with this WpSpaIdValue. + + +This information is useful when @id represents an object field, which can take a value of an arbitrary type. +When the returned type is (or is derived from) SPA_TYPE_Id or SPA_TYPE_Object, @table is set to point to the WpSpaIdTable that contains the possible Id values / object fields. + + + the value type associated with @id + + + + + an id value + + + + the associated WpSpaIdTable + + + + + + Gets the name of an id value. + + + the full name of this id value + + + + + an id value + + + + + + Gets the numeric value of an id value. + + + the numeric representation of this id value + + + + + an id value + + + + + + Gets the short name of an id value. + + + the short name of this id value + + + + + an id value + + + + + + Gets WirePlumber's instance of spa_log + + + WirePlumber's instance of spa_log, which can be used to redirect PipeWire's log messages to the currently installed GLogWriterFunc. This is installed automatically when you call wp_init() with WP_INIT_SET_PW_LOG set in the flags + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/Wp-0.5.metadata b/src/Wp-0.5.metadata new file mode 100644 index 0000000..89b12d9 --- /dev/null +++ b/src/Wp-0.5.metadata @@ -0,0 +1,6 @@ +SPA_TYPE_INVALID skip +Transition.get_source_object skip +SpaPod.get_property + .key unowned +SpaPod.get_string + .value unowned diff --git a/src/application.vala b/src/application.vala index e7f6784..05e928c 100644 --- a/src/application.vala +++ b/src/application.vala @@ -21,6 +21,10 @@ public class PipeTap.Application : Adw.Application { public Settings settings; public bool adjust_overlay_visible { get; set; } + public Ui.SliderOverlay exposure; + public Ui.SliderOverlay focus; + public Ui.MainBar main_bar; + public string device { get; set; } public Application () { Object ( @@ -50,9 +54,18 @@ public class PipeTap.Application : Adw.Application { styling, Gtk.STYLE_PROVIDER_PRIORITY_APPLICATION); - var win = this.active_window ?? new PipeTap.Ui.MainBar (this); - var win2 = new PipeTap.Ui.MainBar (this); - win.present (); + if (exposure == null) + exposure = new Ui.SliderOverlay (this, Logic.Ctrl.CtrlType.Exposure, Logic.Ctrl.CtrlType.ExposureEnable, "exp", "camera-iso-symbolic"); + if (focus == null) + focus = new Ui.SliderOverlay (this, Logic.Ctrl.CtrlType.Focus, Logic.Ctrl.CtrlType.AutoFocusEnable, "focus", "camera-focus-symbolic"); + if (main_bar == null) + main_bar = new Ui.MainBar (this); + + bind_property ("device", main_bar, "visible", GLib.BindingFlags.SYNC_CREATE, (b, v, ref tgt) => { + tgt.set_boolean (device != null); + message ("%s", device); + return true; + }); } private void on_about_action () { diff --git a/src/gui/exposure_slider.vala b/src/gui/exposure_slider.vala new file mode 100644 index 0000000..e69de29 diff --git a/src/gui/main_bar.blp b/src/gui/main_bar.blp index e9fb49c..5ef74cf 100644 --- a/src/gui/main_bar.blp +++ b/src/gui/main_bar.blp @@ -4,8 +4,6 @@ using Adw 1; template $PipeTapUiMainBar: $PipeTapUiFloatingWindow { title: _("PipeTap"); window-name: "main-controls"; - default-width: 60; - default-height: 60; content: Gtk.Box { orientation: bind template.orientation; @@ -13,7 +11,7 @@ template $PipeTapUiMainBar: $PipeTapUiFloatingWindow { homogeneous: true; spacing: 10; - Gtk.Button { + Gtk.ToggleButton exposure { icon-name: "camera-iso-symbolic"; tooltip-text: _("Exposure"); @@ -22,7 +20,7 @@ template $PipeTapUiMainBar: $PipeTapUiFloatingWindow { ] } - Gtk.Button { + Gtk.ToggleButton focus { icon-name: "camera-focus-symbolic"; tooltip-text: _("Focus"); diff --git a/src/gui/main_bar.vala b/src/gui/main_bar.vala index f9709a7..c50e85d 100644 --- a/src/gui/main_bar.vala +++ b/src/gui/main_bar.vala @@ -1,6 +1,21 @@ [GtkTemplate (ui = "/io/gitlab/nekocwd/pipetap/gui/main_bar.ui")] public class PipeTap.Ui.MainBar : PipeTap.Ui.FloatingWindow { - public MainBar (Gtk.Application app) { - base (app); + [GtkChild] + private unowned Gtk.ToggleButton exposure; + [GtkChild] + private new unowned Gtk.ToggleButton focus; + + public MainBar (PipeTap.Application app) { + base (app, "main-controls"); + exposure.bind_property ("active", app.exposure, "visible", BindingFlags.SYNC_CREATE | BindingFlags.BIDIRECTIONAL); + focus.bind_property ("active", app.focus, "visible", BindingFlags.SYNC_CREATE | BindingFlags.BIDIRECTIONAL); + app.exposure.bind_property ("is_available", exposure, "sensitive", GLib.BindingFlags.SYNC_CREATE); + app.focus.bind_property ("is_available", focus, "sensitive", GLib.BindingFlags.SYNC_CREATE); + notify["visible"].connect (() => { + if (visible == true) + return; + app.exposure.visible = false; + app.focus.visible = false; + }); } } \ No newline at end of file diff --git a/src/gui/slider_overlay.blp b/src/gui/slider_overlay.blp new file mode 100644 index 0000000..a9f8889 --- /dev/null +++ b/src/gui/slider_overlay.blp @@ -0,0 +1,46 @@ +using Gtk 4.0; +using Adw 1; + +template $PipeTapUiSliderOverlay: $PipeTapUiFloatingWindow { + title: _("PipeTap Slider"); + + content: Gtk.Box content_box { + orientation: bind template.orientation; + halign: fill; + spacing: 10; + + Separator spacer { + styles [ + "spacer", + ] + } + + Scale scale { + orientation: bind template.orientation; + vexpand: true; + hexpand: true; + halign: fill; + valign: fill; + + adjustment: Adjustment { + lower: 0; + upper: 1000; + step-increment: 1; + value: 500; + }; + + styles [ + "pt-slider", + ] + } + + Gtk.ToggleButton lock_btn { + icon-name: "camera-iso-symbolic"; + tooltip-text: _("Lock"); + + styles [ + "flat", + ] + } + }; +} diff --git a/src/gui/slider_overlay.vala b/src/gui/slider_overlay.vala new file mode 100644 index 0000000..5eb2745 --- /dev/null +++ b/src/gui/slider_overlay.vala @@ -0,0 +1,55 @@ +[GtkTemplate(ui = "/io/gitlab/nekocwd/pipetap/gui/slider_overlay.ui")] +public class PipeTap.Ui.SliderOverlay : PipeTap.Ui.FloatingWindow { + [GtkChild] + private unowned Gtk.Scale scale; + [GtkChild] + private unowned Gtk.ToggleButton lock_btn; + + + public Logic.Ctrl.CtrlType slider_type { get; set; } + public Logic.Ctrl.CtrlType? toggle_type { get; set; } + public bool is_available { get; protected set; } + + public SliderOverlay(PipeTap.Application app, Logic.Ctrl.CtrlType slider_type, Logic.Ctrl.CtrlType toggle_type, string name, string icon_name) { + base(app, name); + this.slider_type = slider_type; + this.toggle_type = toggle_type; + scale.value_changed.connect(value_changed); + lock_btn.toggled.connect(lock_changed); + app.notify["device"].connect(set_ctrls); + lock_btn.icon_name = icon_name; + set_ctrls(); + } + + void set_ctrls() { + var slider_ctrl = Logic.find_ctrl(slider_type); + var lock_ctrl = Logic.find_ctrl(toggle_type); + scale.sensitive = slider_ctrl != null; + lock_btn.sensitive = lock_ctrl != null; + is_available = slider_ctrl != null || lock_ctrl != null; + if (slider_ctrl != null) + scale.set_value(slider_ctrl.value); + if (lock_ctrl != null) + lock_btn.active = lock_ctrl.value == 1; + } + + void value_changed() { + message("Value %f", scale.get_value()); + var ctrl = Logic.find_ctrl(slider_type); + if (ctrl == null) { + message("Slider ctrl not found"); + return; + } + ctrl.value = (int) scale.get_value(); + } + + void lock_changed() { + message("Lock %s", lock_btn.active ? "on" : "off"); + var ctrl = Logic.find_ctrl(toggle_type); + if (ctrl == null) { + message("Toggle ctrl not found"); + return; + } + ctrl.value = (int) lock_btn.active; + } +} \ No newline at end of file diff --git a/src/gui/window.blp b/src/gui/window.blp index dfd6b96..399ae36 100644 --- a/src/gui/window.blp +++ b/src/gui/window.blp @@ -3,8 +3,8 @@ using Adw 1; template $PipeTapUiFloatingWindow: Gtk.Window { title: _("PipeTap"); - default-width: 800; - default-height: 100; + default-width: 60; + default-height: 60; styles [ "pt-transparent", @@ -37,7 +37,7 @@ template $PipeTapUiFloatingWindow: Gtk.Window { "flat", ] } - + Button move { visible: bind template.move-visible; icon-name: "move-tool-symbolic"; diff --git a/src/gui/window.vala b/src/gui/window.vala index aa851b9..16be825 100644 --- a/src/gui/window.vala +++ b/src/gui/window.vala @@ -49,8 +49,9 @@ public class PipeTap.Ui.FloatingWindow : Gtk.Window, Gtk.Orientable { public Gtk.Widget content { get { return content_bin.get_child (); } set { content_bin.set_child (value); } } - public FloatingWindow (Gtk.Application app) { + public FloatingWindow (Gtk.Application app, string name) { Object (application: app); + _window_name = name; GtkLayerShell.init_for_window (this); var move_controller = new Gtk.GestureDrag (); diff --git a/src/logic/ctrl.vala b/src/logic/ctrl.vala new file mode 100644 index 0000000..606a6a7 --- /dev/null +++ b/src/logic/ctrl.vala @@ -0,0 +1,31 @@ +namespace PipeTap.Logic { + public PipeTap.Application app; + + public interface Ctrl : Object { + public enum CtrlType { + Exposure, + ExposureEnable, + Contrast, + Focus, + AutoFocusEnable, + } + public abstract CtrlType ctrl_type { get; } + public abstract int value { get; set; } + } + public HashTable> ctrls; + + public void init() { + ctrls = new HashTable> (str_hash, str_equal); + } + + public Ctrl ? find_ctrl(Ctrl.CtrlType type) { + if (app.device == null) + return null; + foreach (var ctrl in ctrls.get(app.device)) { + message("%u", ctrl.ctrl_type); + if (ctrl.ctrl_type == type) + return ctrl; + } + return null; + } +} \ No newline at end of file diff --git a/src/logic/wireplumber.vala b/src/logic/wireplumber.vala new file mode 100644 index 0000000..b6e4ab7 --- /dev/null +++ b/src/logic/wireplumber.vala @@ -0,0 +1,170 @@ +namespace PipeTap.Logic.WirePlumber { + public Wp.Core core; + public Wp.ObjectManager node_manager; + + public class Ctrl : Logic.Ctrl, Object { + public Wp.Node node; + public uint32 id; + public float min; + public float max; + public int _value = 0; + public string wp_type; + public int value { get { return _value; } set { _value = value; send_value(value); } } + public CtrlType ctrl_type { get; } + + public Ctrl(CtrlType pt_type, Wp.Node node, uint id, string type, float min, float max) { + this.node = node; + this.min = min; + this.max = max; + this.wp_type = type; + this.id = id; + _ctrl_type = pt_type; + } + + private void send_value(int value) { + var pb = new Wp.SpaPodBuilder.object("Spa:Pod:Object:Param:Props", "Props"); + pb.add_property_id(id); + switch (wp_type) { + case "float": + var adjusted = value / 1000.0 * (max - min) + min; + message("Sending float %f", (float) adjusted); + pb.add_float((float) adjusted); + break; + case "bool": + var adjusted = value == 1; + message("Sending bool %s", adjusted ? "true" : "false"); + pb.add_boolean(adjusted); + break; + default: + message("Unknown type %s", wp_type); + break; + } + var pod = pb.end(); + node.set_param("Props", 0, pod); + } + } + + void init_manager() { + message("Core connected"); + node_manager = new Wp.ObjectManager(); + // Use V4L2 ONLY FOR TESTING + var interest_lcam = new Wp.ObjectInterest.type(typeof (Wp.Node)); + var interest_v4l2 = new Wp.ObjectInterest.type(typeof (Wp.Node)); + + interest_lcam.add_constraint(Wp.ConstraintType.PW_PROPERTY, "device.api", Wp.ConstraintVerb.EQUALS, "libcamera"); + interest_v4l2.add_constraint(Wp.ConstraintType.PW_PROPERTY, "device.api", Wp.ConstraintVerb.EQUALS, "v4l2"); + + node_manager.add_interest_full(interest_lcam); + node_manager.add_interest_full(interest_v4l2); + + node_manager.request_object_features(typeof (Wp.Node), Wp.OBJECT_FEATURES_ALL); + + node_manager.object_added.connect((obj) => { + Wp.Node node = obj as Wp.Node; + var name = node.properties["node.nick"]; + message("Found camera %s", name); + node.params_changed.connect((str) => message("%s", str)); + node.state_changed.connect(() => { + message("Camera %s state changed -> %s", name, node.state == Wp.NodeState.RUNNING ? "Running" : "Not running :D"); + if (node.state == Wp.NodeState.RUNNING) { + app.device = name; + return; + } else if (app.device == name) { + app.device = null; + } + }); + message("== Enumerating properties =="); + var found_ctrls = new List (); + var params = node.enum_params_sync("PropInfo", null); + for (Value param_info_val; params.next(out param_info_val); ) { + Wp.SpaPod param_info_pod = (Wp.SpaPod) param_info_val; + var iterator = param_info_pod.new_iterator(); + + string description = "IDK"; + uint32 id = 0; + string type = "IDK"; + + for (Value param_kv_val; iterator.next(out param_kv_val); ) { + Wp.SpaPod param_kv_pod = (Wp.SpaPod) param_kv_val; + string key; + Wp.SpaPod value; + param_kv_pod.get_property(out key, out value); + switch (key) { + case "id": + value.get_id(out id); + break; + case "description": + value.get_string(out description); + break; + case "type": + if (!value.is_choice()) + break; + Wp.SpaPod choice = value.get_choice_child(); + if (choice.is_double()) + type = "double"; + else if (choice.is_float()) + type = "float"; + else if (choice.is_int()) + type = "int"; + else if (choice.is_boolean()) + type = "bool"; + else if (choice.is_rectangle()) + type = "rect (unsupported)"; + break; + default: + warning("Report ME: Unexpected key in property enumeration \"%s\"", key); + break; + } + } + switch (description) { + case "Brightness": + if (type != "float") { + warning("Wrong type"); + break; + } + message("Found EXPOSURE"); + var ctrl = new Ctrl(Logic.Ctrl.CtrlType.Exposure, node, id, type, 0, 2); + found_ctrls.append(ctrl); + break; + case "LensPosition": + if (type != "float") { + warning("Wrong type"); + break; + } + message("Found FOCUS"); + var ctrl = new Ctrl(Logic.Ctrl.CtrlType.Focus, node, id, type, 0, 100); + found_ctrls.append(ctrl); + break; + case "AeEnable": + if (type != "bool") { + warning("Wrong type"); + break; + } + message("Found AE enable"); + var ctrl = new Ctrl(Logic.Ctrl.CtrlType.ExposureEnable, node, id, type, 0, 1); + found_ctrls.append(ctrl); + break; + default: + message("Unknown ctrl %s of %s", description, type); + break; + } + // message("%s: %s -> 0x%lx", description, type, id); + } + message("== End of property enumeration =="); + message("list is %s", found_ctrls == null ? "null" : "not null"); + ctrls[name] = (owned) found_ctrls; + message("%s %s", name, ctrls[name] == null ? "Is nulllll" : "OK"); + foreach (var ctrl in ctrls.get(name)) { + message("CTRL %u", ctrl.ctrl_type); + } + }); + + core.install_object_manager(node_manager); + } + + public void init() { + Wp.init(Wp.InitFlags.PIPEWIRE | Wp.InitFlags.SPA_TYPES); + core = new Wp.Core(null, null, null); + core.activate.begin(Wp.CoreFeatures.CONNECTED, null, init_manager); + } +} \ No newline at end of file diff --git a/src/main.vala b/src/main.vala index efad53f..dc1f8ea 100644 --- a/src/main.vala +++ b/src/main.vala @@ -24,5 +24,8 @@ int main (string[] args) { Intl.textdomain (Config.GETTEXT_PACKAGE); var app = new PipeTap.Application (); + PipeTap.Logic.app = app; + PipeTap.Logic.init (); + PipeTap.Logic.WirePlumber.init (); return app.run (args); } \ No newline at end of file diff --git a/src/meson.build b/src/meson.build index 266a3e1..1d65c77 100644 --- a/src/meson.build +++ b/src/meson.build @@ -3,13 +3,28 @@ pipetap_sources = [ 'application.vala', 'gui/window.vala', 'gui/main_bar.vala', + 'gui/slider_overlay.vala', + 'logic/ctrl.vala', + 'logic/wireplumber.vala', ] +wp_api = gnome.generate_vapi( + 'wireplumber-0.5', + sources: ['Wp-0.5.gir'], + metadata_dirs: srcdir, + packages: ['gio-2.0', 'gobject-2.0', 'glib-2.0'], +) + +# That's for WirePlumber +add_project_arguments(['--vapidir', meson.current_build_dir()], language: 'vala') + pipetap_deps = [ config_dep, dependency('gtk4'), dependency('libadwaita-1', version: '>= 1.4'), dependency('gtk4-layer-shell-0'), + dependency('wireplumber-0.5'), + wp_api, ] blueprints = custom_target( @@ -17,6 +32,7 @@ blueprints = custom_target( input: files( 'gtk/help-overlay.blp', 'gui/main_bar.blp', + 'gui/slider_overlay.blp', 'gui/window.blp', ), output: '.', diff --git a/src/pipetap.gresource.xml b/src/pipetap.gresource.xml index 3d04e2e..4b9903e 100644 --- a/src/pipetap.gresource.xml +++ b/src/pipetap.gresource.xml @@ -3,6 +3,7 @@ gui/window.ui gui/main_bar.ui + gui/slider_overlay.ui gtk/help-overlay.ui style.css diff --git a/src/style.css b/src/style.css index 27a928f..66cdf6a 100644 --- a/src/style.css +++ b/src/style.css @@ -1,3 +1,18 @@ .pt-transparent { border-radius: 10px; +} + +.pt-slider>trough>slider { + padding: 3px; +} + +.pt-slider>trough { + padding: 3px; +} + +.pt-slider>trough>highlight { + box-shadow: none; + outline: none; + background-color: transparent; + background-image: none; } \ No newline at end of file