pipewire: update to pw 0.3.40 and wp 0.4.5
[AGL/meta-agl.git] / meta-pipewire / recipes-multimedia / wireplumber / wireplumber-config-agl / 30-bluez-monitor.lua
1 -- Bluez monitor config file --
2
3 bluez_monitor = {}
4
5 bluez_monitor.properties = {
6   -- These features do not work on all headsets, so they are enabled
7   -- by default based on the hardware database. They can also be
8   -- forced on/off for all devices by the following options:
9
10   --["bluez5.enable-sbc-xq"] = true,
11   --["bluez5.enable-msbc"] = true,
12   --["bluez5.enable-hw-volume"] = true,
13
14   -- See bluez-hardware.conf for the hardware database.
15
16   -- Enabled headset roles (default: [ hsp_hs hfp_ag ]), this
17   -- property only applies to native backend. Currently some headsets
18   -- (Sony WH-1000XM3) are not working with both hsp_ag and hfp_ag
19   -- enabled, disable either hsp_ag or hfp_ag to work around it.
20   --
21   -- Supported headset roles: hsp_hs (HSP Headset),
22   --                          hsp_ag (HSP Audio Gateway),
23   --                          hfp_hf (HFP Hands-Free),
24   --                          hfp_ag (HFP Audio Gateway)
25   ["bluez5.headset-roles"] = "[ hsp_hs hsp_ag hfp_hf hfp_ag ]",
26
27   -- Enabled A2DP codecs (default: all).
28   --["bluez5.codecs"] = "[ sbc sbc_xq aac ldac aptx aptx_hd aptx_ll aptx_ll_duplex faststream faststream_duplex ]",
29
30   -- HFP/HSP backend (default: native).
31   -- Available values: any, none, hsphfpd, ofono, native
32   ["bluez5.hfphsp-backend"] = "ofono",
33
34   -- Properties for the A2DP codec configuration
35   --["bluez5.default.rate"] = 48000,
36   --["bluez5.default.channels"] = 2,
37 }
38
39 bluez_monitor.rules = {
40   -- An array of matches/actions to evaluate.
41   {
42     -- Rules for matching a device or node. It is an array of
43     -- properties that all need to match the regexp. If any of the
44     -- matches work, the actions are executed for the object.
45     matches = {
46       {
47         -- This matches all cards.
48         { "device.name", "matches", "bluez_card.*" },
49       },
50     },
51     -- Apply properties on the matched object.
52     apply_properties = {
53       -- Auto-connect device profiles on start up or when only partial
54       -- profiles have connected. Disabled by default if the property
55       -- is not specified.
56       --["bluez5.auto-connect"] = "[ hfp_hf hsp_hs a2dp_sink hfp_ag hsp_ag a2dp_source ]",
57       ["bluez5.auto-connect"]  = "[ hfp_hf hsp_hs a2dp_sink ]",
58
59       -- Hardware volume control (default: [ hfp_ag hsp_ag a2dp_source ])
60       --["bluez5.hw-volume"] = "[ hfp_hf hsp_hs a2dp_sink hfp_ag hsp_ag a2dp_source ]",
61
62       -- LDAC encoding quality
63       -- Available values: auto (Adaptive Bitrate, default)
64       --                   hq   (High Quality, 990/909kbps)
65       --                   sq   (Standard Quality, 660/606kbps)
66       --                   mq   (Mobile use Quality, 330/303kbps)
67       --["bluez5.a2dp.ldac.quality"] = "auto",
68
69       -- AAC variable bitrate mode
70       -- Available values: 0 (cbr, default), 1-5 (quality level)
71       --["bluez5.a2dp.aac.bitratemode"] = 0,
72
73       -- Profile connected first
74       -- Available values: a2dp-sink (default), headset-head-unit
75       --["device.profile"] = "a2dp-sink",
76     },
77   },
78   {
79     -- Make output hsp/hfp stream nodes go through the Communication endpoint
80     -- Unfortunately we cannot match on "media.class" because this property
81     -- is not known before the node is created
82     matches = {
83       {
84         { "api.bluez5.profile", "equals", "headset-audio-gateway" },
85         { "factory.name", "matches", "*source*" },
86       },
87     },
88     apply_properties = {
89       ["media.role"]  = "Communication",
90     },
91   },
92   {
93     -- Make output a2dp stream nodes go through the Multimedia endpoint
94     -- Unfortunately we cannot match on "media.class" because this property
95     -- is not known before the node is created
96     matches = {
97       {
98         { "api.bluez5.profile", "equals", "a2dp-source" },
99       },
100     },
101     apply_properties = {
102       ["media.role"]  = "Multimedia",
103     },
104   },
105 }
106
107 function bluez_monitor.enable()
108   load_monitor("bluez", {
109     properties = bluez_monitor.properties,
110     rules = bluez_monitor.rules,
111   })
112 end