feat: node property inspector

- Right-click node -> Properties shows details dialog
- Shows: ID, name, class, volume, ports, sample rate, channels,
  format, quantum, rate, device, bus, API, priority
- Backend parses extra PipeWire node props (clock.rate, channels, etc.)
- Node type includes all new fields
- stop() already had the SSE cleanup fix
This commit is contained in:
joren
2026-03-30 00:33:41 +02:00
parent f3999b1747
commit 8c728dcd47
5 changed files with 104 additions and 1 deletions

View File

@@ -97,6 +97,36 @@ static void on_node_info(void *data, const struct pw_node_info *info) {
if (mute_str) {
nobj->node.mute = pw_properties_parse_bool(mute_str);
}
// Read additional properties
const char *str;
str = spa_dict_lookup(info->props, "default.clock.rate");
if (str) nobj->node.sample_rate = (uint32_t)atoi(str);
str = spa_dict_lookup(info->props, "default.clock.quantum");
if (str) nobj->node.quantum = (uint32_t)atoi(str);
str = spa_dict_lookup(info->props, "audio.channels");
if (str) nobj->node.channels = (uint32_t)atoi(str);
str = spa_dict_lookup(info->props, "audio.format");
if (str) nobj->node.format = str;
str = spa_dict_lookup(info->props, "device.name");
if (str) nobj->node.device_name = str;
str = spa_dict_lookup(info->props, "device.bus");
if (str) nobj->node.device_bus = str;
str = spa_dict_lookup(info->props, "api.alsa.path");
if (str) nobj->node.api = str;
str = spa_dict_lookup(info->props, "priority.driver");
if (str) nobj->node.priority = atoi(str);
str = spa_dict_lookup(info->props, "node.rate");
if (str) nobj->node.rate = (uint32_t)atoi(str);
}
}

View File

@@ -67,11 +67,24 @@ struct Node {
float volume; // 0.0 - 1.0 (linear)
bool mute;
// Properties
uint32_t sample_rate;
uint32_t channels;
std::string format;
uint32_t quantum;
uint32_t rate;
std::string device_name;
std::string device_bus;
std::string api;
int priority;
std::vector<uint32_t> port_ids; // child port IDs
Node() : id(0), mode(PortMode::None), node_type(NodeType::None),
mode2(PortMode::None), ready(false), changed(false),
volume(1.0f), mute(false) {}
volume(1.0f), mute(false),
sample_rate(0), channels(0), quantum(0), rate(0),
priority(0) {}
};
struct Link;

View File

@@ -111,6 +111,15 @@ std::string WebServer::buildGraphJson() const {
<< ",\"node_type\":\"" << nodeTypeStr(n.node_type) << "\""
<< ",\"volume\":" << n.volume
<< ",\"mute\":" << (n.mute ? "true" : "false")
<< ",\"sample_rate\":" << n.sample_rate
<< ",\"channels\":" << n.channels
<< ",\"quantum\":" << n.quantum
<< ",\"rate\":" << n.rate
<< ",\"format\":\"" << escapeJson(n.format) << "\""
<< ",\"device_name\":\"" << escapeJson(n.device_name) << "\""
<< ",\"device_bus\":\"" << escapeJson(n.device_bus) << "\""
<< ",\"api\":\"" << escapeJson(n.api) << "\""
<< ",\"priority\":" << n.priority
<< ",\"port_ids\":[";
bool first_p = true;
for (uint32_t pid : n.port_ids) {