3c04652f0b868fe16665dd904909f46cca1655dc
[AGL/meta-agl.git] / meta-pipewire / recipes-multimedia / wireplumber / wireplumber-config-agl / 10-default-policy.lua
1 -- Default policy config file --
2
3 default_policy = {}
4
5 default_policy.sessions = {
6   -- [session name] = { session properties }
7   ["audio"] = { ["media.type"] = "Audio" },
8   --["video"] = { ["media.type"] = "Video" },
9 }
10
11 default_policy.endpoints = {
12   -- [endpoint name] = { endpoint properties }
13
14   ["endpoint.multimedia"] = {
15     ["media.class"] = "Audio/Sink",
16     ["role"] = "Multimedia",
17   },
18   ["endpoint.speech_low"] = {
19     ["media.class"] = "Audio/Sink",
20     ["role"] = "Speech-Low",
21   },
22   ["endpoint.custom_low"] = {
23     ["media.class"] = "Audio/Sink",
24     ["role"] = "Custom-Low",
25   },
26   ["endpoint.navigation"] = {
27     ["media.class"] = "Audio/Sink",
28     ["role"] = "Navigation",
29   },
30   ["endpoint.speech_high"] = {
31     ["media.class"] = "Audio/Sink",
32     ["role"] = "Speech-High",
33   },
34   ["endpoint.custom_high"] = {
35     ["media.class"] = "Audio/Sink",
36     ["role"] = "Custom-High",
37   },
38   ["endpoint.communication"] = {
39     ["media.class"] = "Audio/Sink",
40     ["role"] = "Communication",
41   },
42   ["endpoint.emergency"] = {
43     ["media.class"] = "Audio/Sink",
44     ["role"] = "Emergency",
45   },
46 }
47
48 default_policy.policy = {
49   ["move"] = false,  -- moves session items when metadata target.node changes
50   ["follow"] = true, -- moves session items to the default device when it has changed
51
52   ["roles"] = {
53     ["Multimedia"] = {
54       ["alias"] = { "Movie", "Music", "Game" },
55       ["priority"] = 25,
56       ["action.default"] = "cork",
57     },
58     ["Speech-Low"] = {
59       ["priority"] = 30,
60       ["action.default"] = "cork",
61       ["action.Speech-Low"] = "mix",
62     },
63     ["Custom-Low"] = {
64       ["priority"] = 35,
65       ["action.default"] = "cork",
66       ["action.Custom-Low"] = "mix",
67     },
68     ["Navigation"] = {
69       ["priority"] = 50,
70       ["action.default"] = "cork",
71       ["action.Navigation"] = "mix",
72     },
73     ["Speech-High"] = {
74       ["priority"] = 60,
75       ["action.default"] = "cork",
76       ["action.Speech-High"] = "mix",
77     },
78     ["Custom-High"] = {
79       ["priority"] = 65,
80       ["action.default"] = "cork",
81       ["action.Custom-High"] = "mix",
82     },
83     ["Communication"] = {
84       ["priority"] = 75,
85       ["action.default"] = "cork",
86       ["action.Communication"] = "mix",
87     },
88     ["Emergency"] = {
89       ["alias"] = { "Alert" },
90       ["priority"] = 99,
91       ["action.default"] = "cork",
92       ["action.Emergency"] = "mix",
93     },
94   },
95 }
96
97 function default_policy.enable()
98   -- Session item factories, building blocks for the session management graph
99   -- Do not disable these unless you really know what you are doing
100   load_module("si-node")
101   load_module("si-audio-adapter")
102   load_module("si-standard-link")
103   load_module("si-audio-endpoint")
104
105   -- Create sessions statically at startup
106   load_script("static-sessions.lua", default_policy.sessions)
107
108
109   -- Create endpoints statically at startup
110   load_script("static-endpoints.lua", default_policy.endpoints)
111
112   -- Create session items for nodes that appear in the graph
113   load_script("create-item.lua")
114
115   -- Link nodes to each other to make media flow in the graph
116   load_script("policy-node.lua", default_policy.policy)
117
118   -- Link client nodes with endpoints to make media flow in the graph
119   load_script("policy-endpoint-client.lua", default_policy.policy)
120   load_script("policy-endpoint-client-links.lua", default_policy.policy)
121
122   -- Link endpoints with device nodes to make media flow in the graph
123   load_script("policy-endpoint-device.lua", default_policy.policy)
124 end