pipeline: fix multiple input pads

Can now generate a pipeline with multiple input
pads such as a compositor.
This commit is contained in:
Stéphane Cerveau 2022-01-10 14:17:08 +01:00
parent 81ca9ca3a3
commit e8259f3773

View file

@ -372,10 +372,12 @@ impl Pipeline {
&self,
graphview: &GraphView,
node: &Node,
elements: &mut HashMap<String, String>,
mut description: String,
) -> String {
let unique_name = node.unique_name();
description.push_str(&format!("{} name={} ", node.name(), unique_name));
elements.insert(unique_name.clone(), unique_name.clone());
for (name, value) in node.properties().iter() {
description.push_str(&format!("{}={}", name, value));
}
@ -390,7 +392,12 @@ impl Pipeline {
description.push_str("! ");
}
if let Some(node) = graphview.node(&node_to) {
description = self.process_node(graphview, &node, description.clone());
if elements.contains_key(&node.unique_name()) {
description.push_str(&format!("{}. ", node.unique_name()));
} else {
description =
self.process_node(graphview, &node, elements, description.clone());
}
}
}
}
@ -398,10 +405,12 @@ impl Pipeline {
}
pub fn render_gst_launch(&self, graphview: &GraphView) -> String {
let nodes = graphview.all_nodes(NodeType::Source);
let source_nodes = graphview.all_nodes(NodeType::Source);
let mut elements: HashMap<String, String> = HashMap::new();
let mut description = String::from("");
for node in nodes {
description = self.process_node(graphview, &node, description.clone());
for source_node in source_nodes {
description =
self.process_node(graphview, &source_node, &mut elements, description.clone());
}
description
}