aboutsummaryrefslogtreecommitdiffstats
path: root/alc/backends/pipewire.cpp
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2022-02-16 00:04:11 -0800
committerChris Robinson <[email protected]>2022-02-16 00:04:11 -0800
commita9974d3aa8ae225610302f221bd0a154c110ccbc (patch)
tree07171b9ba9db9955c6f7e4ca9e4c40296470d897 /alc/backends/pipewire.cpp
parentaa19223c65d8693dbaa8d8c9fa0c129d77eed4de (diff)
Trace the actual device form factor in pipewire
Diffstat (limited to 'alc/backends/pipewire.cpp')
-rw-r--r--alc/backends/pipewire.cpp16
1 files changed, 5 insertions, 11 deletions
diff --git a/alc/backends/pipewire.cpp b/alc/backends/pipewire.cpp
index 147a6489..a19dcb61 100644
--- a/alc/backends/pipewire.cpp
+++ b/alc/backends/pipewire.cpp
@@ -818,21 +818,14 @@ void NodeProxy::infoCallback(const pw_node_info *info)
return;
}
- bool isHeadphones{};
- if(const char *form_factor{spa_dict_lookup(info->props, PW_KEY_DEVICE_FORM_FACTOR)})
- {
- if(al::strcasecmp(form_factor, "headphones") == 0
- || al::strcasecmp(form_factor, "headset") == 0)
- isHeadphones = true;
- }
-
const char *devName{spa_dict_lookup(info->props, PW_KEY_NODE_NAME)};
const char *nodeName{spa_dict_lookup(info->props, PW_KEY_NODE_DESCRIPTION)};
if(!nodeName || !*nodeName) nodeName = spa_dict_lookup(info->props, PW_KEY_NODE_NICK);
if(!nodeName || !*nodeName) nodeName = devName;
- TRACE("Got %s device \"%s\"%s\n", AsString(ntype), devName ? devName : "(nil)",
- isHeadphones ? " (headphones)" : "");
+ const char *form_factor{spa_dict_lookup(info->props, PW_KEY_DEVICE_FORM_FACTOR)};
+ TRACE("Got %s device \"%s\"%s%s%s\n", AsString(ntype), devName ? devName : "(nil)",
+ form_factor?" (":"", form_factor?form_factor:"", form_factor?")":"");
TRACE(" \"%s\" = ID %u\n", nodeName ? nodeName : "(nil)", info->id);
DeviceNode &node = DeviceNode::Add(info->id);
@@ -840,7 +833,8 @@ void NodeProxy::infoCallback(const pw_node_info *info)
else node.mName = "PipeWire node #"+std::to_string(info->id);
node.mDevName = devName ? devName : "";
node.mType = ntype;
- node.mIsHeadphones = isHeadphones;
+ node.mIsHeadphones = form_factor && (al::strcasecmp(form_factor, "headphones") == 0
+ || al::strcasecmp(form_factor, "headset") == 0);
}
}