SHA256
1
0
forked from pool/wireplumber

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

- Add patch from upstream to fix a json log issue:
  * 0001-lua-json-fix-error-ouput.patch
- Add patch from upstream to add a method to merge json containers:
  * 0002-lua-json-add-method-to-merge-json-containers.patch
- Add patch from upstream to fix merging a particular case
  of configuration options:
  * 0003-json-utils-fix-overriding-of-non-container-values-when.patch
- Fix wireplumber not starting successfully when audio support is
  not enabled since the main profile now requires it. The best
  option would be to use a video-only profile but it's too late
  to change the way wireplumber is started in SLE/Leap, so the
  solution just makes audio/bluetooth optional for now
  (bsc#1223916)
  * split-config-file.py

OBS-URL: https://build.opensuse.org/request/show/1172110
OBS-URL: https://build.opensuse.org/package/show/multimedia:libs/wireplumber?expand=0&rev=78
This commit is contained in:
Antonio Larrosa 2024-05-06 08:15:35 +00:00 committed by Git OBS Bridge
parent c38e110e74
commit c5b5db5d58
6 changed files with 193 additions and 0 deletions

View File

@ -0,0 +1,34 @@
From 709eecb21f30a157b9a4aa8ab45a4c1ec608d628 Mon Sep 17 00:00:00 2001
From: Stefan Ursella <stefan.ursella@wolfvision.net>
Date: Fri, 26 Apr 2024 07:27:31 +0200
Subject: [PATCH] lua: json: fix error ouput
---
modules/module-lua-scripting/api/json.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/modules/module-lua-scripting/api/json.c b/modules/module-lua-scripting/api/json.c
index 242f0e410..5afa5c914 100644
--- a/modules/module-lua-scripting/api/json.c
+++ b/modules/module-lua-scripting/api/json.c
@@ -281,7 +281,7 @@ spa_json_array_new (lua_State *L)
break;
}
default:
- luaL_error (L, "Json does not support lua type ",
+ luaL_error (L, "Json does not support lua type %s",
lua_typename(L, lua_type(L, -1)));
break;
}
@@ -327,7 +327,7 @@ spa_json_object_new (lua_State *L)
break;
}
default:
- luaL_error (L, "Json does not support lua type ",
+ luaL_error (L, "Json does not support lua type %s",
lua_typename(L, lua_type(L, -1)));
break;
}
--
GitLab

View File

@ -0,0 +1,77 @@
From fd7a1af7ffec4be04348b4807a4a8f95777e2515 Mon Sep 17 00:00:00 2001
From: Stefan Ursella <stefan.ursella@wolfvision.net>
Date: Fri, 26 Apr 2024 07:26:52 +0200
Subject: [PATCH] lua: json: add method to merge json containers
---
modules/module-lua-scripting/api/json.c | 15 +++++++++++++++
tests/wplua/scripts/json.lua | 23 +++++++++++++++++++++++
2 files changed, 38 insertions(+)
diff --git a/modules/module-lua-scripting/api/json.c b/modules/module-lua-scripting/api/json.c
index 39f6b10f0..242f0e410 100644
--- a/modules/module-lua-scripting/api/json.c
+++ b/modules/module-lua-scripting/api/json.c
@@ -167,6 +167,20 @@ push_luajson (lua_State *L, WpSpaJson *json, gint n_recursions)
}
}
+static int
+spa_json_merge (lua_State *L)
+{
+ WpSpaJson *a = wplua_checkboxed (L, 1, WP_TYPE_SPA_JSON);
+ WpSpaJson *b = wplua_checkboxed (L, 2, WP_TYPE_SPA_JSON);
+
+ WpSpaJson *merge = wp_json_utils_merge_containers(a, b);
+ if(!merge)
+ luaL_error (L, "only Json container merge supported");
+
+ wplua_pushboxed (L, WP_TYPE_SPA_JSON, merge);
+ return 1;
+}
+
static int
spa_json_parse (lua_State *L)
{
@@ -340,6 +354,7 @@ static const luaL_Reg spa_json_methods[] = {
{ "is_array", spa_json_is_array },
{ "is_object", spa_json_is_object },
{ "parse", spa_json_parse },
+ { "merge", spa_json_merge },
{ NULL, NULL }
};
diff --git a/tests/wplua/scripts/json.lua b/tests/wplua/scripts/json.lua
index 52a8a3823..03e14ba6d 100644
--- a/tests/wplua/scripts/json.lua
+++ b/tests/wplua/scripts/json.lua
@@ -240,3 +240,26 @@ assert (type (val.args) == "table")
assert (type (val.args.test) == "table")
assert (val.args.test[1] == 0)
assert (val.args.test[2] == 1)
+
+json = Json.Array { "foo" }
+json2 = Json.Array { "bar" }
+json = json:merge(json2)
+assert (json:is_array())
+val = json:parse ()
+assert (val[1] == "foo")
+assert (val[2] == "bar")
+
+table = {}
+table["1"] = 1
+table["2"] = 2
+json = Json.Object (table)
+table = {}
+table["3"] = 3
+table["4"] = 4
+json2 = Json.Object (table)
+json = json:merge(json2)
+val = json:parse ()
+assert (val["1"] == 1)
+assert (val["2"] == 2)
+assert (val["3"] == 3)
+assert (val["4"] == 4)
--
GitLab

View File

@ -0,0 +1,58 @@
From e6a70db254585b2cd9f3265fdafc884a48c3682d Mon Sep 17 00:00:00 2001
From: George Kiagiadakis <george.kiagiadakis@collabora.com>
Date: Fri, 3 May 2024 15:54:37 +0300
Subject: [PATCH] json-utils: fix overriding of non-container values when
merging
Non-container values should always be overriden
Fixes: #653
---
lib/wp/json-utils.c | 4 ++--
tests/wplua/scripts/json.lua | 7 +++++++
2 files changed, 9 insertions(+), 2 deletions(-)
diff --git a/lib/wp/json-utils.c b/lib/wp/json-utils.c
index 53d1b2b1b..936ad449e 100644
--- a/lib/wp/json-utils.c
+++ b/lib/wp/json-utils.c
@@ -211,12 +211,12 @@ merge_json_objects (WpSpaJson *a, WpSpaJson *b)
g_return_val_if_fail (wp_iterator_next (it, &item), NULL);
val = g_value_dup_boxed (&item);
- if (!override &&
+ if (!override && wp_spa_json_is_container (val) &&
(wp_spa_json_object_get (a, key_str, "J", &j, NULL) ||
wp_spa_json_object_get (a, override_key_str, "J", &j, NULL))) {
g_autoptr (WpSpaJson) merged = wp_json_utils_merge_containers (j, val);
if (!merged) {
- wp_warning ("skipping merge of %s as JSON values are not compatible",
+ wp_warning ("skipping merge of %s as JSON values are not compatible containers",
key_str);
continue;
}
diff --git a/tests/wplua/scripts/json.lua b/tests/wplua/scripts/json.lua
index 03e14ba6d..5489bab23 100644
--- a/tests/wplua/scripts/json.lua
+++ b/tests/wplua/scripts/json.lua
@@ -241,6 +241,7 @@ assert (type (val.args.test) == "table")
assert (val.args.test[1] == 0)
assert (val.args.test[2] == 1)
+-- merge
json = Json.Array { "foo" }
json2 = Json.Array { "bar" }
json = json:merge(json2)
@@ -263,3 +264,9 @@ assert (val["1"] == 1)
assert (val["2"] == 2)
assert (val["3"] == 3)
assert (val["4"] == 4)
+
+json = Json.Object { ["a"] = "foo" }
+json2 = Json.Object { ["a"] = "bar" }
+json = json:merge(json2)
+val = json:parse ()
+assert (val["a"] == "bar")
--
GitLab

View File

@ -25,6 +25,9 @@ for line in lines:
if is_in_device_monitor: if is_in_device_monitor:
device_monitors_content += line device_monitors_content += line
else: else:
# Fixes wireplumber running the main profile when not having audio support (bsc#1223916)
if line in [' hardware.audio = required\n', ' hardware.bluetooth = required\n']:
line = line.replace('required', 'optional')
main_config_content += line main_config_content += line
config_sha256 = sha256_from_data(device_monitors_content.encode('utf-8')) config_sha256 = sha256_from_data(device_monitors_content.encode('utf-8'))

View File

@ -1,3 +1,21 @@
-------------------------------------------------------------------
Mon May 6 07:41:23 UTC 2024 - Antonio Larrosa <alarrosa@suse.com>
- Add patch from upstream to fix a json log issue:
* 0001-lua-json-fix-error-ouput.patch
- Add patch from upstream to add a method to merge json containers:
* 0002-lua-json-add-method-to-merge-json-containers.patch
- Add patch from upstream to fix merging a particular case
of configuration options:
* 0003-json-utils-fix-overriding-of-non-container-values-when.patch
- Fix wireplumber not starting successfully when audio support is
not enabled since the main profile now requires it. The best
option would be to use a video-only profile but it's too late
to change the way wireplumber is started in SLE/Leap, so the
solution just makes audio/bluetooth optional for now
(bsc#1223916)
* split-config-file.py
------------------------------------------------------------------- -------------------------------------------------------------------
Tue Apr 23 06:48:06 UTC 2024 - Antonio Larrosa <alarrosa@suse.com> Tue Apr 23 06:48:06 UTC 2024 - Antonio Larrosa <alarrosa@suse.com>

View File

@ -30,6 +30,9 @@ Group: Development/Libraries/C and C++
URL: https://gitlab.freedesktop.org/pipewire/wireplumber URL: https://gitlab.freedesktop.org/pipewire/wireplumber
Source0: wireplumber-%{version}.tar.xz Source0: wireplumber-%{version}.tar.xz
Source1: split-config-file.py Source1: split-config-file.py
Patch0: 0001-lua-json-fix-error-ouput.patch
Patch1: 0002-lua-json-add-method-to-merge-json-containers.patch
Patch2: 0003-json-utils-fix-overriding-of-non-container-values-when.patch
# docs # docs
BuildRequires: doxygen BuildRequires: doxygen
BuildRequires: graphviz BuildRequires: graphviz