mirror of
https://github.com/v0l/zap-stream-core.git
synced 2025-06-17 12:08:46 +00:00
Init demuxer
This commit is contained in:
21
src/pipeline/runner.rs
Normal file
21
src/pipeline/runner.rs
Normal file
@ -0,0 +1,21 @@
|
||||
use crate::pipeline::{PipelinePayload, PipelineStep};
|
||||
|
||||
pub struct PipelineRunner {
|
||||
steps: Vec<Box<dyn PipelineStep + Sync + Send>>,
|
||||
}
|
||||
|
||||
impl PipelineRunner {
|
||||
pub fn new(steps: Vec<Box<dyn PipelineStep + Sync + Send>>) -> Self {
|
||||
Self { steps }
|
||||
}
|
||||
|
||||
pub async fn push(&mut self, bytes: bytes::Bytes) -> Result<(), anyhow::Error> {
|
||||
let mut output = PipelinePayload::Bytes(bytes);
|
||||
for step in &mut self.steps {
|
||||
let output2 = step.process(output).await?;
|
||||
//info!("{} result: {:?}", step.name(), output2);
|
||||
output = output2;
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user