MCPcopy Create free account
hub / github.com/Audio4Linux/JDSP4Linux / link_nodes

Method link_nodes

src/audio/pipewire/PwPipelineManager.cpp:1706–1807  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1704}
1705
1706auto PwPipelineManager::link_nodes(const uint32_t& output_node_id,
1707 const uint32_t& input_node_id,
1708 const bool& probe_link,
1709 const bool& link_passive) -> std::vector<pw_proxy*> {
1710 std::vector<pw_proxy*> list;
1711 std::vector<PortInfo> list_output_ports;
1712 std::vector<PortInfo> list_input_ports;
1713 auto use_audio_channel = true;
1714
1715 for (const auto& port : list_ports) {
1716 if (port.node_id == output_node_id && port.direction == "out") {
1717 list_output_ports.push_back(port);
1718
1719 if (!probe_link) {
1720 if (port.audio_channel != "FL" && port.audio_channel != "FR") {
1721 use_audio_channel = false;
1722 }
1723 }
1724 }
1725
1726 if (port.node_id == input_node_id && port.direction == "in") {
1727 if (!probe_link) {
1728 list_input_ports.push_back(port);
1729
1730 if (port.audio_channel != "FL" && port.audio_channel != "FR") {
1731 use_audio_channel = false;
1732 }
1733 } else {
1734 if (port.audio_channel == "PROBE_FL" || port.audio_channel == "PROBE_FR") {
1735 list_input_ports.push_back(port);
1736 }
1737 }
1738 }
1739 }
1740
1741 if (list_input_ports.empty()) {
1742 util::debug("node " + util::to_string(input_node_id) + " has no input ports yet. Aborting the link");
1743
1744 return list;
1745 }
1746
1747 if (list_output_ports.empty()) {
1748 util::debug("node " + util::to_string(output_node_id) + " has no output ports yet. Aborting the link");
1749
1750 return list;
1751 }
1752
1753 for (const auto& outp : list_output_ports) {
1754 for (const auto& inp : list_input_ports) {
1755 bool ports_match = false;
1756
1757 if (!probe_link) {
1758 if (use_audio_channel) {
1759 ports_match = outp.audio_channel == inp.audio_channel;
1760 } else {
1761 ports_match = outp.port_id == inp.port_id;
1762 }
1763 } else {

Callers 1

connect_filtersMethod · 0.80

Calls 3

to_stringFunction · 0.85
push_backMethod · 0.80
emptyMethod · 0.45

Tested by

no test coverage detected