static-endpoints.lua 910 B

12345678910111213141516171819202122232425262728293031323334353637
  1. -- WirePlumber
  2. --
  3. -- Copyright © 2021 Collabora Ltd.
  4. -- @author Julian Bouzas <julian.bouzas@collabora.com>
  5. --
  6. -- SPDX-License-Identifier: MIT
  7. -- Receive script arguments from config.lua
  8. local endpoints_config = ...
  9. function createEndpoint (factory_name, properties)
  10. -- create endpoint
  11. local ep = SessionItem ( factory_name )
  12. if not ep then
  13. Log.warning (ep, "could not create endpoint of type " .. factory_name)
  14. return
  15. end
  16. -- configure endpoint
  17. if not ep:configure(properties) then
  18. Log.warning(ep, "failed to configure endpoint " .. properties.name)
  19. return
  20. end
  21. -- activate and register endpoint
  22. ep:activate (Features.ALL, function (item)
  23. item:register ()
  24. Log.info(item, "registered endpoint " .. properties.name)
  25. end)
  26. end
  27. for name, properties in pairs(endpoints_config) do
  28. properties["name"] = name
  29. createEndpoint ("si-audio-endpoint", properties)
  30. end