feat: upgrade to ffmpeg-rs-raw (WIP)

This commit is contained in:
2024-11-13 11:43:28 +00:00
parent 96e4a38e09
commit 6f618ef58f
27 changed files with 712 additions and 2372 deletions

View File

@ -1,8 +1,16 @@
use crate::pipeline::runner::PipelineRunner;
use crate::settings::Settings;
use crate::webhook::Webhook;
use anyhow::Result;
use log::{error, info};
use serde::{Deserialize, Serialize};
use std::io::Read;
pub mod file;
#[cfg(feature = "srt")]
pub mod srt;
pub mod tcp;
#[cfg(feature = "test-source")]
pub mod test;
#[derive(Clone, Debug, Serialize, Deserialize)]
@ -13,3 +21,28 @@ pub struct ConnectionInfo {
/// IP address of the connection
pub ip_addr: String,
}
pub(crate) fn spawn_pipeline(
info: ConnectionInfo,
settings: Settings,
reader: Box<dyn Read + Send>,
) {
info!("New client connected: {}", &info.ip_addr);
std::thread::spawn(move || unsafe {
if let Err(e) = spawn_pipeline_inner(info, settings, reader) {
error!("{}", e);
}
});
}
unsafe fn spawn_pipeline_inner(
info: ConnectionInfo,
settings: Settings,
reader: Box<dyn Read + Send>,
) -> Result<()> {
let webhook = Webhook::new(settings.clone());
let mut pl = PipelineRunner::new(info, webhook, reader)?;
loop {
pl.run()?
}
}