Skip to content
Snippets Groups Projects

Spa Json

Merged Julian Bouzas requested to merge julian/wireplumber:spa-json into master

Similar to WpSpaPod, this MR adds a new WpSpaJson API to create and parse Json objects. A Lua API for WpSpaJson is also added.

See tests/wp/spa-json.c and tests/wplua/scripts/json.lua for its usage.

Merge request reports

Loading
Loading

Activity

Filter activity
  • Approvals
  • Assignees & reviewers
  • Comments (from bots)
  • Comments (from users)
  • Commits & branches
  • Edits
  • Labels
  • Lock status
  • Mentions
  • Merge request status
  • Tracking
  • Julian Bouzas requested review from @gkiagia

    requested review from @gkiagia

  • assigned to @gkiagia

  • Julian Bouzas added 4 commits

    added 4 commits

    • 2db8c0a2 - 1 commit from branch pipewire:master
    • e53c9b96 - spa-json: add new WpSpaJson API
    • 1cb81376 - m-lua-scripting: add WpSpaJson API
    • 89f14477 - default-nodes: use WpSpaJson API

    Compare with previous version

  • Julian Bouzas added 6 commits

    added 6 commits

    Compare with previous version

  • Looks great! Two things that I have in mind as I am looking at the code:

    1. it would possibly be useful to have a from_string() constructor in lua
    2. could we figure out a way to use this in the lua config files as well? For example, we currently have things like: ["bluez5.auto-connect"] = "[ hfp_hf hsp_hs a2dp_sink ]",. It would be nice if we could write it as ["bluez5.auto-connect"] = { "hfp_hf", "hsp_hs", "a2dp_sink" }, and encode the array in json before passing it to WpProperties
  • Author Developer
    1. it would possibly be useful to have a from_string() constructor in lua

    This is very easy to add in Lua as there is a wp_spa_json_new_from_string () API in C.

    1. could we figure out a way to use this in the lua config files as well? For example, we currently have things like: ["bluez5.auto-connect"] = "[ hfp_hf hsp_hs a2dp_sink ]",. It would be nice if we could write it as ["bluez5.auto-connect"] = { "hfp_hf", "hsp_hs", "a2dp_sink" }, and encode the array in json before passing it to WpProperties

    You can do this now with just:

    ["bluez5.auto-connect"] = Json.Array { "hfp_hf", "hsp_hs", "a2dp_sink" } : get_data()

    I am not sure if it is a good idea to automatically create a Json array implicitly with just:

    ["bluez5.auto-connect"] = { "hfp_hf", "hsp_hs", "a2dp_sink" }

    Because maybe a user wants to just have a Lua table instead of a Json array.

    Edited by Julian Bouzas
Please register or sign in to reply
Loading