Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
W
wireplumber
Manage
Activity
Members
Labels
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
pkg
wireplumber
Commits
9f77b98b
Commit
9f77b98b
authored
3 years ago
by
Julian Bouzas
Browse files
Options
Downloads
Patches
Plain Diff
src: scripts: add static-endpoints.lua script
parent
b2c90844
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/config/config.lua.d/10-default-policy.lua
+26
-0
26 additions, 0 deletions
src/config/config.lua.d/10-default-policy.lua
src/scripts/static-endpoints.lua
+36
-0
36 additions, 0 deletions
src/scripts/static-endpoints.lua
with
62 additions
and
0 deletions
src/config/config.lua.d/10-default-policy.lua
+
26
−
0
View file @
9f77b98b
...
...
@@ -8,6 +8,28 @@ default_policy.sessions = {
[
"video"
]
=
{
[
"media.type"
]
=
"Video"
},
}
default_policy
.
endpoints
=
{
-- [endpoint name] = { endpoint properties }
[
"endpoint.music"
]
=
{
[
"media.class"
]
=
"Audio/Sink"
,
[
"role"
]
=
"Music"
,
[
"priority"
]
=
0
,
[
"session.name"
]
=
"audio"
,
},
[
"endpoint.notifications"
]
=
{
[
"media.class"
]
=
"Audio/Sink"
,
[
"role"
]
=
"Notifications"
,
[
"priority"
]
=
50
,
[
"session.name"
]
=
"audio"
,
},
[
"endpoint.voice"
]
=
{
[
"media.class"
]
=
"Audio/Source"
,
[
"role"
]
=
"Voice"
,
[
"priority"
]
=
90
,
[
"session.name"
]
=
"audio"
,
},
}
default_policy
.
policy
=
{
move
=
true
,
-- moves session items when metadata target.node changes
follow
=
true
-- moves session items to the default device when it has changed
...
...
@@ -19,10 +41,14 @@ function default_policy.enable()
load_module
(
"si-node"
)
load_module
(
"si-audio-adapter"
)
load_module
(
"si-standard-link"
)
load_module
(
"si-audio-endpoint"
)
-- Create sessions statically at startup
load_script
(
"static-sessions.lua"
,
default_policy
.
sessions
)
-- Create endpoints statically at startup
load_script
(
"static-endpoints.lua"
,
default_policy
.
endpoints
)
-- Create items for nodes that appear in the graph
load_script
(
"create-item.lua"
)
...
...
This diff is collapsed.
Click to expand it.
src/scripts/static-endpoints.lua
0 → 100644
+
36
−
0
View file @
9f77b98b
-- WirePlumber
--
-- Copyright © 2021 Collabora Ltd.
-- @author Julian Bouzas <julian.bouzas@collabora.com>
--
-- SPDX-License-Identifier: MIT
-- Receive script arguments from config.lua
local
endpoints_config
=
...
function
createEndpoint
(
factory_name
,
properties
)
-- create endpoint
local
ep
=
SessionItem
(
factory_name
)
if
not
ep
then
Log
.
warning
(
ep
,
"could not create endpoint of type "
..
factory_name
)
return
end
-- configure endpoint
if
not
ep
:
configure
(
properties
)
then
Log
.
warning
(
ep
,
"failed to configure endpoint "
..
properties
.
name
)
return
end
-- activate and register endpoint
ep
:
activate
(
Features
.
ALL
,
function
(
item
)
ep
:
register
()
Log
.
info
(
ep
,
"registered endpoint "
..
properties
.
name
)
end
)
end
for
name
,
properties
in
pairs
(
endpoints_config
)
do
properties
[
"name"
]
=
name
createEndpoint
(
"si-audio-endpoint"
,
properties
)
end
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment