Init demuxer

This commit is contained in:
2024-03-11 22:19:08 +00:00
commit d3cb7c8bf6
12 changed files with 1576 additions and 0 deletions

21
src/pipeline/runner.rs Normal file
View 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(())
}
}