monitors/bluez: add 'internal' prefix to internal bluez node names.
And name the loopback source node the same as bluez source without 'internal' prefix. This keeps consistency with input/output node names when switching bluetooth profiles.
This commit is contained in:
@@ -181,12 +181,12 @@ function createSetNode(parent, id, type, factory, properties)
|
|||||||
local channels = channels_json:parse ()
|
local channels = channels_json:parse ()
|
||||||
|
|
||||||
if properties["media.class"] == "Audio/Sink" then
|
if properties["media.class"] == "Audio/Sink" then
|
||||||
name = "bluez_output"
|
name = "bluez_output_internal"
|
||||||
args["combine.mode"] = "sink"
|
args["combine.mode"] = "sink"
|
||||||
target_class = "Audio/Sink/Internal"
|
target_class = "Audio/Sink/Internal"
|
||||||
stream_class = "Stream/Output/Audio/Internal"
|
stream_class = "Stream/Output/Audio/Internal"
|
||||||
else
|
else
|
||||||
name = "bluez_input"
|
name = "bluez_input_internal"
|
||||||
args["combine.mode"] = "source"
|
args["combine.mode"] = "source"
|
||||||
target_class = "Audio/Source/Internal"
|
target_class = "Audio/Source/Internal"
|
||||||
stream_class = "Stream/Input/Audio/Internal"
|
stream_class = "Stream/Input/Audio/Internal"
|
||||||
@@ -258,10 +258,18 @@ function createNode(parent, id, type, factory, properties)
|
|||||||
-- sanitize description, replace ':' with ' '
|
-- sanitize description, replace ':' with ' '
|
||||||
properties["node.description"] = desc:gsub("(:)", " ")
|
properties["node.description"] = desc:gsub("(:)", " ")
|
||||||
|
|
||||||
|
local name_prefix = ((factory:find("sink") and "bluez_output") or
|
||||||
|
(factory:find("source") and "bluez_input" or factory))
|
||||||
|
|
||||||
|
-- hide the sco-source node because we use the loopback source instead
|
||||||
|
if factory == "api.bluez5.sco.source" then
|
||||||
|
properties["api.bluez5.internal"] = true
|
||||||
|
-- add 'internal' to name prefix to not be confused with loopback node
|
||||||
|
name_prefix = name_prefix .. "_internal"
|
||||||
|
end
|
||||||
|
|
||||||
-- set the node name
|
-- set the node name
|
||||||
local name =
|
local name = name_prefix .. "." ..
|
||||||
((factory:find("sink") and "bluez_output") or
|
|
||||||
(factory:find("source") and "bluez_input" or factory)) .. "." ..
|
|
||||||
(properties["api.bluez5.address"] or dev_props["device.name"]) .. "." ..
|
(properties["api.bluez5.address"] or dev_props["device.name"]) .. "." ..
|
||||||
tostring(id)
|
tostring(id)
|
||||||
-- sanitize name
|
-- sanitize name
|
||||||
@@ -281,11 +289,6 @@ function createNode(parent, id, type, factory, properties)
|
|||||||
properties["node.autoconnect"] = true
|
properties["node.autoconnect"] = true
|
||||||
end
|
end
|
||||||
|
|
||||||
-- hide the sco-source node because we use the loopback source instead
|
|
||||||
if factory == "api.bluez5.sco.source" then
|
|
||||||
properties["api.bluez5.internal"] = true
|
|
||||||
end
|
|
||||||
|
|
||||||
-- apply properties from the rules in the configuration file
|
-- apply properties from the rules in the configuration file
|
||||||
properties = JsonUtils.match_rules_update_properties (config.rules, properties)
|
properties = JsonUtils.match_rules_update_properties (config.rules, properties)
|
||||||
|
|
||||||
@@ -393,10 +396,10 @@ end
|
|||||||
function CreateDeviceLoopbackSource (dev_name, dec_desc, dev_id)
|
function CreateDeviceLoopbackSource (dev_name, dec_desc, dev_id)
|
||||||
local args = Json.Object {
|
local args = Json.Object {
|
||||||
["capture.props"] = Json.Object {
|
["capture.props"] = Json.Object {
|
||||||
["node.name"] = string.format ("bluez_capture.%s", dev_name),
|
["node.name"] = string.format ("bluez_capture_internal.%s", dev_name),
|
||||||
["media.class"] = "Stream/Input/Audio/Internal",
|
["media.class"] = "Stream/Input/Audio/Internal",
|
||||||
["node.description"] =
|
["node.description"] =
|
||||||
string.format ("Bluetooth capture for %s", dec_desc),
|
string.format ("Bluetooth internal capture stream for %s", dec_desc),
|
||||||
["audio.channels"] = 1,
|
["audio.channels"] = 1,
|
||||||
["audio.position"] = "[MONO]",
|
["audio.position"] = "[MONO]",
|
||||||
["bluez5.loopback"] = true,
|
["bluez5.loopback"] = true,
|
||||||
@@ -406,9 +409,8 @@ function CreateDeviceLoopbackSource (dev_name, dec_desc, dev_id)
|
|||||||
["node.linger"] = true
|
["node.linger"] = true
|
||||||
},
|
},
|
||||||
["playback.props"] = Json.Object {
|
["playback.props"] = Json.Object {
|
||||||
["node.name"] = string.format ("bluez_source.%s", dev_name),
|
["node.name"] = string.format ("bluez_input.%s", dev_name),
|
||||||
["node.description"] =
|
["node.description"] = string.format ("%s", dec_desc),
|
||||||
string.format ("Bluetooth source for %s", dec_desc),
|
|
||||||
["audio.position"] = "[MONO]",
|
["audio.position"] = "[MONO]",
|
||||||
["media.class"] = "Audio/Source",
|
["media.class"] = "Audio/Source",
|
||||||
["device.id"] = dev_id,
|
["device.id"] = dev_id,
|
||||||
|
Reference in New Issue
Block a user