Accepting request 1154974 from home:alarrosa:branches:multimedia:libs

- Update to version 0.4.90 (0.5.0 RC1)
  * Highlights:
    - The configuration system has been changed back to load files
      from the WirePlumber configuration directories, such as
      /etc/wireplumber and $XDG_CONFIG_HOME/wireplumber, unlike in
      the pre-releases. This was done because issues were observed
      with installations that use a different prefix for pipewire
      and wireplumber. If you had a wireplumber.conf file in
      /etc/pipewire or $XDG_CONFIG_HOME/pipewire, you should move
      it to /etc/wireplumber or $XDG_CONFIG_HOME/wireplumber
      respectively (!601)
    - The internal base directories lookup system now also respects
      the XDG_CONFIG_DIRS and XDG_DATA_DIRS environment variables,
      and their default values as per the XDG spec, so it is
      possible to install configuration files also in places like
      /etc/xdg/wireplumber and override system-wide data paths
      (!601)
    - wpctl now has a settings subcommand to show, change and
      delete settings at runtime. This comes with changes in the
      WpSettings system to validate settings using a schema that is
      defined in the configuration file. The schema is also
      exported on a metadata object, so it is available to any
      client that wants to expose WirePlumber settings (!599, !600)
    - The WpConf API has changed to not be a singleton and support
      opening arbitrary config files. The main config file now
      needs to be opened prior to creating a WpCore and passed to
      the core using a property. The core uses that without letting
      the underlying pw_context open and read the default
      client.conf. The core also closes the WpConf after all
      components are loaded, which means all the config loading is

OBS-URL: https://build.opensuse.org/request/show/1154974
OBS-URL: https://build.opensuse.org/package/show/multimedia:libs/wireplumber?expand=0&rev=67
This commit is contained in:
Antonio Larrosa 2024-03-05 06:14:26 +00:00 committed by Git OBS Bridge
parent 71654b8284
commit 9aa2e26fa5
7 changed files with 52 additions and 288 deletions

View File

@ -1,274 +0,0 @@
From bebfc07d84b149a07af1dd2d5d26fafc76237b4e Mon Sep 17 00:00:00 2001
From: Julian Bouzas <julian.bouzas@collabora.com>
Date: Wed, 14 Feb 2024 12:04:01 -0500
Subject: [PATCH] wpctl: add settings subcomand to show, delete or change
settings
---
src/tools/wpctl.c | 196 ++++++++++++++++++++++++++++++++++++----------
1 file changed, 156 insertions(+), 40 deletions(-)
diff --git a/src/tools/wpctl.c b/src/tools/wpctl.c
index 13abe5db..d8b14eb7 100644
--- a/src/tools/wpctl.c
+++ b/src/tools/wpctl.c
@@ -82,7 +82,10 @@ static struct {
struct {
const gchar *key;
- } clear_persistent;
+ const gchar *val;
+ gboolean remove;
+ gboolean save;
+ } settings;
struct {
guint64 id;
@@ -393,7 +396,6 @@ status_run (WpCtl * self)
g_autoptr (WpIterator) it = NULL;
g_auto (GValue) val = G_VALUE_INIT;
g_autoptr (WpPlugin) def_nodes_api = NULL;
- g_autoptr (WpMetadata) persistent_settings = NULL;
struct print_context context = { .self = self };
def_nodes_api = wp_plugin_find (self->core, "default-nodes-api");
@@ -515,23 +517,6 @@ status_run (WpCtl * self)
/* Settings */
printf ("Settings\n");
- persistent_settings = wp_object_manager_lookup (self->om, WP_TYPE_METADATA,
- WP_CONSTRAINT_TYPE_PW_GLOBAL_PROPERTY,
- "metadata.name", "=s", "persistent-sm-settings",
- NULL);
- printf (TREE_INDENT_NODE "Persistent:\n");
- if (persistent_settings) {
- it = wp_metadata_new_iterator (persistent_settings, 0);
- for (; wp_iterator_next (it, &val); g_value_unset (&val)) {
- const gchar *key, *value;
- wp_metadata_iterator_item_extract (&val, NULL, &key, NULL, &value);
- printf (TREE_INDENT_LINE " - %s: %s\n", key, value);
- }
- g_clear_pointer (&it, wp_iterator_unref);
- }
-
- printf (TREE_INDENT_LINE "\n");
-
printf (TREE_INDENT_END "Default Configured Devices:\n");
if (def_nodes_api) {
for (guint i = 0; i < G_N_ELEMENTS (DEFAULT_NODE_MEDIA_CLASSES); i++) {
@@ -1368,21 +1353,30 @@ out:
g_main_loop_quit (self->loop);
}
-/* clear-persistent */
+/* settings */
static gboolean
-clear_persistent_parse_positional (gint argc, gchar ** argv, GError **error)
+settings_parse_positional (gint argc, gchar ** argv, GError **error)
{
- if (argc >= 3)
- cmdline.clear_persistent.key = argv[2];
- else
- cmdline.clear_persistent.key = NULL;
+ cmdline.settings.key = NULL;
+ cmdline.settings.val = NULL;
+ if (argc >= 3) {
+ cmdline.settings.key = argv[2];
+ if (argc >= 4)
+ cmdline.settings.val = argv[3];
+ }
+
+ if (cmdline.settings.remove && cmdline.settings.save) {
+ g_set_error (error, wpctl_error_domain_quark(), 0,
+ "Cannot use --delete and --save flags at the same time");
+ return FALSE;
+ }
return TRUE;
}
static gboolean
-clear_persistent_prepare (WpCtl * self, GError ** error)
+settings_prepare (WpCtl * self, GError ** error)
{
wp_object_manager_add_interest (self->om, WP_TYPE_METADATA, NULL);
wp_object_manager_request_object_features (self->om, WP_TYPE_METADATA,
@@ -1391,10 +1385,21 @@ clear_persistent_prepare (WpCtl * self, GError ** error)
}
static void
-clear_persistent_run (WpCtl * self)
+settings_run (WpCtl * self)
{
+ g_autoptr (WpMetadata) settings = NULL;
g_autoptr (WpMetadata) persistent_settings = NULL;
+ g_autoptr (WpIterator) it = NULL;
+ g_auto (GValue) val = G_VALUE_INIT;
+ settings = wp_object_manager_lookup (self->om, WP_TYPE_METADATA,
+ WP_CONSTRAINT_TYPE_PW_GLOBAL_PROPERTY,
+ "metadata.name", "=s", "sm-settings",
+ NULL);
+ if (!settings) {
+ fprintf (stderr, "Settings metadata not found\n");
+ goto out;
+ }
persistent_settings = wp_object_manager_lookup (self->om, WP_TYPE_METADATA,
WP_CONSTRAINT_TYPE_PW_GLOBAL_PROPERTY,
"metadata.name", "=s", "persistent-sm-settings",
@@ -1404,12 +1409,115 @@ clear_persistent_run (WpCtl * self)
goto out;
}
- if (cmdline.clear_persistent.key)
- wp_metadata_set (persistent_settings, 0, cmdline.clear_persistent.key, NULL,
- NULL);
- else
- wp_metadata_clear (persistent_settings);
-
+ if (!cmdline.settings.key && !cmdline.settings.val) {
+ /* No key or value */
+ if (!cmdline.settings.remove && !cmdline.settings.save) {
+ /* Print all settings */
+ printf ("Settings:\n");
+ it = wp_metadata_new_iterator (settings, 0);
+ for (; wp_iterator_next (it, &val); g_value_unset (&val)) {
+ const gchar *key, *value, *saved_value;
+ wp_metadata_iterator_item_extract (&val, 0, &key, NULL, &value);
+ saved_value = wp_metadata_find (persistent_settings, 0, key, NULL);
+ if (saved_value)
+ printf (" - %s: %s (saved: %s)\n", key, value, saved_value);
+ else
+ printf (" - %s: %s\n", key, value);
+ }
+ g_clear_pointer (&it, wp_iterator_unref);
+ } else if (!cmdline.settings.remove && cmdline.settings.save) {
+ /* Save all current settings */
+ it = wp_metadata_new_iterator (settings, 0);
+ for (; wp_iterator_next (it, &val); g_value_unset (&val)) {
+ const gchar *key, *type, *value;
+ wp_metadata_iterator_item_extract (&val, 0, &key, &type, &value);
+ wp_metadata_set (persistent_settings, 0, key, type, value);
+ fprintf (stderr, "Saved setting %s with value %s\n", key, value);
+ }
+ } else if (cmdline.settings.remove && !cmdline.settings.save) {
+ /* Delete all saved settings */
+ wp_metadata_clear (persistent_settings);
+ fprintf (stderr, "Deleted all saved settings\n");
+ } else {
+ g_assert_not_reached ();
+ }
+ } else if (cmdline.settings.key && !cmdline.settings.val) {
+ /* only key */
+ if (!cmdline.settings.remove && !cmdline.settings.save) {
+ /* Print setting value */
+ const gchar *value, *saved_value;
+ value = wp_metadata_find (settings, 0, cmdline.settings.key, NULL);
+ if (value) {
+ saved_value = wp_metadata_find (persistent_settings, 0,
+ cmdline.settings.key, NULL);
+ if (saved_value)
+ printf ("%s (saved: %s)\n", value, saved_value);
+ else
+ printf ("%s\n", value);
+ } else {
+ printf ("Setting %s not found\n", cmdline.settings.key);
+ }
+ } else if (!cmdline.settings.remove && cmdline.settings.save) {
+ /* Save setting */
+ const gchar *value, *type;
+ value = wp_metadata_find (settings, 0, cmdline.settings.key, &type);
+ if (value) {
+ wp_metadata_set (persistent_settings, 0, cmdline.settings.key, type,
+ value);
+ printf ("Updated and saved setting %s with current value %s\n",
+ cmdline.settings.key, value);
+ } else {
+ printf ("Setting %s not found\n", cmdline.settings.key);
+ }
+ } else if (cmdline.settings.remove && !cmdline.settings.save) {
+ /* Delete saved setting */
+ const gchar *value;
+ value = wp_metadata_find (persistent_settings, 0, cmdline.settings.key,
+ NULL);
+ if (value) {
+ wp_metadata_set (persistent_settings, 0, cmdline.settings.key, NULL,
+ NULL);
+ printf ("Deleted setting %s with value %s\n", cmdline.settings.key,
+ value);
+ } else {
+ printf ("Setting %s is not saved\n", cmdline.settings.key);
+ }
+ } else {
+ g_assert_not_reached ();
+ }
+ } else if (cmdline.settings.key && cmdline.settings.val) {
+ /* key and value */
+ if (!cmdline.settings.remove && !cmdline.settings.save) {
+ /* Set setting value */
+ wp_metadata_set (settings, 0, cmdline.settings.key, NULL,
+ cmdline.settings.val);
+ printf ("Updated setting %s with value %s\n", cmdline.settings.key,
+ cmdline.settings.val);
+ } else if (!cmdline.settings.remove && cmdline.settings.save) {
+ /* Save setting value */
+ wp_metadata_set (persistent_settings, 0, cmdline.settings.key, NULL,
+ cmdline.settings.val);
+ printf ("Updated and saved setting %s with current value %s\n",
+ cmdline.settings.key, cmdline.settings.val);
+ } else if (cmdline.settings.remove && !cmdline.settings.save) {
+ /* Remove saved setting */
+ const gchar *value;
+ value = wp_metadata_find (persistent_settings, 0, cmdline.settings.key,
+ NULL);
+ if (value) {
+ wp_metadata_set (persistent_settings, 0, cmdline.settings.key, NULL,
+ NULL);
+ printf ("Deleted setting %s with value %s\n", cmdline.settings.key,
+ value);
+ } else {
+ printf ("Setting %s is not saved\n", cmdline.settings.key);
+ }
+ } else {
+ g_assert_not_reached ();
+ }
+ } else {
+ g_assert_not_reached ();
+ }
wp_core_sync (self->core, NULL, (GAsyncReadyCallback) async_quit, self);
return;
@@ -1647,14 +1755,22 @@ static const struct subcommand {
.run = clear_default_run,
},
{
- .name = "clear-persistent",
- .positional_args = "[KEY]",
- .summary = "Clears the persistent setting (no KEY means 'all')",
+ .name = "settings",
+ .positional_args = "[KEY] [VAL]",
+ .summary = "Shows, changes or removes settings",
.description = NULL,
- .entries = { { NULL } },
- .parse_positional = clear_persistent_parse_positional,
- .prepare = clear_persistent_prepare,
- .run = clear_persistent_run,
+ .entries = {
+ { "delete", 'd', G_OPTION_FLAG_NONE, G_OPTION_ARG_NONE,
+ &cmdline.settings.remove,
+ "Deletes the saved setting value (no KEY means 'all')", NULL },
+ { "save", 's', G_OPTION_FLAG_NONE, G_OPTION_ARG_NONE,
+ &cmdline.settings.save,
+ "Saves the setting value (no KEY means 'all', no VAL means current value)", NULL },
+ { NULL }
+ },
+ .parse_positional = settings_parse_positional,
+ .prepare = settings_prepare,
+ .run = settings_run,
},
{
.name = "set-log-level",
--
GitLab

View File

@ -3,7 +3,7 @@
<service name="obs_scm" mode="manual">
<param name="scm">git</param>
<param name="url">https://gitlab.freedesktop.org/pipewire/wireplumber.git</param>
<param name="revision">refs/tags/0.4.82</param>
<param name="revision">refs/tags/0.4.90</param>
<param name="versionformat">@PARENT_TAG@</param>
<!--
<param name="revision">master</param>

View File

@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:cfb55189762e5b6de4f3fdcf53029a6da8fdfc04b524e171a82fad1b04aa33a6
size 2630668

View File

@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:65e3633c543715fecaf5435a3e2abb54a346bef5646ce1c8c10cd2ed5469467a
size 2727436

View File

@ -1,3 +1,42 @@
-------------------------------------------------------------------
Tue Mar 5 05:36:27 UTC 2024 - Antonio Larrosa <alarrosa@suse.com>
- Update to version 0.4.90 (0.5.0 RC1)
* Highlights:
- The configuration system has been changed back to load files
from the WirePlumber configuration directories, such as
/etc/wireplumber and $XDG_CONFIG_HOME/wireplumber, unlike in
the pre-releases. This was done because issues were observed
with installations that use a different prefix for pipewire
and wireplumber. If you had a wireplumber.conf file in
/etc/pipewire or $XDG_CONFIG_HOME/pipewire, you should move
it to /etc/wireplumber or $XDG_CONFIG_HOME/wireplumber
respectively (!601)
- The internal base directories lookup system now also respects
the XDG_CONFIG_DIRS and XDG_DATA_DIRS environment variables,
and their default values as per the XDG spec, so it is
possible to install configuration files also in places like
/etc/xdg/wireplumber and override system-wide data paths
(!601)
- wpctl now has a settings subcommand to show, change and
delete settings at runtime. This comes with changes in the
WpSettings system to validate settings using a schema that is
defined in the configuration file. The schema is also
exported on a metadata object, so it is available to any
client that wants to expose WirePlumber settings (!599, !600)
- The WpConf API has changed to not be a singleton and support
opening arbitrary config files. The main config file now
needs to be opened prior to creating a WpCore and passed to
the core using a property. The core uses that without letting
the underlying pw_context open and read the default
client.conf. The core also closes the WpConf after all
components are loaded, which means all the config loading is
done early at startup. Finally, WpConf loads all sections
lazily, keeping the underlying files memory mapped until it
is closed and merging them on demand (!601, !606)
- Remove patch that's already included:
* 0001-wpctl-add-settings-subcomand-to-show_-delete-or-change.patch
-------------------------------------------------------------------
Mon Feb 19 07:29:52 UTC 2024 - Antonio Larrosa <alarrosa@suse.com>

View File

@ -1,4 +1,4 @@
name: wireplumber
version: 0.4.82
mtime: 1707928830
commit: 5826a21456dbdb789dcef63f98e9b84d952eb3fa
version: 0.4.90
mtime: 1709573349
commit: 2249d8d9df121cec987527327050924ba34b3930

View File

@ -22,7 +22,7 @@
%define sover 0
%define libwireplumber libwireplumber-%{apiver_str}-%{sover}
Name: wireplumber
Version: 0.4.82
Version: 0.4.90
Release: 0
Summary: Session / policy manager implementation for PipeWire
License: MIT
@ -30,8 +30,6 @@ Group: Development/Libraries/C and C++
URL: https://gitlab.freedesktop.org/pipewire/wireplumber
Source0: wireplumber-%{version}.tar.xz
Source1: split-config-file.py
# PATCH-FIX-UPSTREAM 0001-wpctl-add-settings-subcomand-to-show_-delete-or-change.patch
Patch0: 0001-wpctl-add-settings-subcomand-to-show_-delete-or-change.patch
# docs
BuildRequires: doxygen
BuildRequires: graphviz
@ -237,14 +235,15 @@ fi
%dir %{_datadir}/doc/wireplumber
%dir %{_datadir}/doc/wireplumber/examples
%{_datadir}/doc/wireplumber/examples/wireplumber.conf.d
%{_datadir}/pipewire/wireplumber.conf
%dir %{_datadir}/pipewire/wireplumber.conf.d
%{_datadir}/pipewire/wireplumber.conf.d/alsa-vm.conf
%{_datadir}/wireplumber/wireplumber.conf
%dir %{_datadir}/wireplumber/wireplumber.conf.d
%exclude %{_datadir}/wireplumber/wireplumber.conf.d/00-device-monitors.conf
%{_datadir}/wireplumber/wireplumber.conf.d/alsa-vm.conf
%files lang -f %{name}.lang
%files audio
%{_datadir}/pipewire/wireplumber.conf.d/00-device-monitors.conf
%{_datadir}/wireplumber/wireplumber.conf.d/00-device-monitors.conf
%files devel
%{_includedir}/wireplumber-%{apiver}