Expand description
Filter graph pipeline for OxiMedia.
This crate provides a filter graph implementation for processing media data through a pipeline of operations. The graph connects nodes (filters) together to form a processing pipeline.
§Architecture
The filter graph consists of:
- Nodes: Processing units that implement the
node::Nodetrait - Ports: Connection points for data flow between nodes
- Connections: Links between output and input ports
- Frames: Data units passed through the graph
§Example
use oximedia_graph::graph::GraphBuilder;
use oximedia_graph::filters::video::{PassthroughFilter, NullSink};
use oximedia_graph::node::NodeId;
use oximedia_graph::port::PortId;
fn build_graph() -> Result<(), Box<dyn std::error::Error>> {
// Create a simple graph: source -> sink
let source = PassthroughFilter::new_source(NodeId(0), "source");
let sink = NullSink::new(NodeId(0), "sink");
let (builder, source_id) = GraphBuilder::new().add_node(Box::new(source));
let (builder, sink_id) = builder.add_node(Box::new(sink));
let graph = builder
.connect(source_id, PortId(0), sink_id, PortId(0))?
.build()?;
assert_eq!(graph.node_count(), 2);
Ok(())
}
build_graph().expect("graph construction should succeed");§Node Types
Nodes are classified into three types:
- Source: Entry points that produce frames (e.g., decoders)
- Filter: Transform frames (e.g., scalers, color converters)
- Sink: Consume frames (e.g., encoders, displays)
§Frame Flow
Frames flow through the graph following the connections. The graph automatically computes a topological order for execution to ensure correct data flow.
Re-exports§
pub use context::GraphContext;pub use context::ProcessingStats;pub use error::GraphError;pub use error::GraphResult;pub use frame::FilterFrame;pub use frame::FramePool;pub use frame::FrameRef;pub use graph::FilterGraph;pub use graph::GraphBuilder;pub use node::Node;pub use node::NodeConfig;pub use node::NodeId;pub use node::NodeState;pub use node::NodeType;pub use port::Connection;pub use port::InputPort;pub use port::OutputPort;pub use port::PortFormat;pub use port::PortId;pub use port::PortType;
Modules§
- context
- Execution context for filter graphs.
- cycle_
detect - Cycle detection algorithms for directed graphs.
- data_
flow - Graph data flow management: buffered port queues with backpressure.
- dependency_
graph - Dependency analysis for graph nodes.
- dsl
- Graph DSL parser for describing filter pipelines as text.
- edge_
weight - Edge weight types for the filter graph pipeline.
- error
- Error types for the filter graph.
- filters
- Filter implementations for the filter graph.
- frame
- Frame types for passing through the filter graph.
- graph
- Filter graph builder and execution.
- graph_
merge - Graph merging utilities for combining multiple filter graphs.
- graph_
partition - Graph partitioning for parallel execution.
- graph_
stats - Graph statistics and complexity analysis for the filter graph pipeline.
- graph_
validation - Validation of filter/pipeline graphs.
- layout
- Graph layout algorithms.
- metrics_
graph - Graph metrics: diameter, clustering coefficient, and betweenness centrality approximation.
- node
- Node types for the filter graph.
- node_
cache - Caching system for graph node outputs.
- node_
registry - Node registry for the filter graph pipeline.
- optimization
- Graph optimization passes.
- pipeline_
graph - Pipeline-centric graph for media processing.
- port
- Port types for connecting nodes in the filter graph.
- processing_
graph - Media processing graph with nodes, edges, and topological execution ordering.
- profiling
- Graph execution profiling.
- scheduler
- Graph execution scheduler.
- serialize
- Graph serialization: DOT format output, adjacency list, and edge list export.
- subgraph
- Subgraph extraction from a larger pipeline/filter graph.
- topological
- Topological sorting for directed acyclic graphs.
- visualization
- Graph visualization: layout computation and ASCII art rendering.