Files
zap-stream-core/crates/core/src/pipeline/mod.rs
Copilot e400e969fd
Some checks failed
continuous-integration/drone Build is failing
Implement idle mode with placeholder content when stream disconnects (#3)
* Initial plan for issue

* Implement placeholder frame generation and idle mode logic

Co-authored-by: v0l <1172179+v0l@users.noreply.github.com>

* Add frame rate throttling for idle mode processing

Co-authored-by: v0l <1172179+v0l@users.noreply.github.com>

* Refactor placeholder generation into separate module and simplify idle mode approach

Co-authored-by: v0l <1172179+v0l@users.noreply.github.com>

* Address PR review feedback: improve parameter naming, fix memory leaks, refactor state management, and fix frame generation approach

Co-authored-by: v0l <1172179+v0l@users.noreply.github.com>

* Store demuxer info in PipelineConfig for placeholder generation

Co-authored-by: v0l <1172179+v0l@users.noreply.github.com>

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: v0l <1172179+v0l@users.noreply.github.com>
2025-06-07 16:31:02 +01:00

71 lines
1.8 KiB
Rust

use std::fmt::{Display, Formatter};
use crate::egress::EgressConfig;
use crate::overseer::IngressInfo;
use crate::variant::VariantStream;
use serde::{Deserialize, Serialize};
use uuid::Uuid;
pub mod runner;
pub mod placeholder;
#[derive(Clone, Debug, Serialize, Deserialize)]
pub enum EgressType {
/// HLS output egress
HLS(EgressConfig),
/// Record streams to local disk
Recorder(EgressConfig),
/// Forward streams to another RTMP server
RTMPForwarder(EgressConfig),
}
impl EgressType {
pub fn config(&self) -> &EgressConfig {
match self {
EgressType::HLS(c) => c,
EgressType::Recorder(c) => c,
EgressType::RTMPForwarder(c) => c,
}
}
}
impl Display for EgressType {
fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
match self {
EgressType::HLS(_) => write!(f, "HLS"),
EgressType::Recorder(_) => write!(f, "Recorder"),
EgressType::RTMPForwarder(_) => write!(f, "RTMPForwarder"),
}
}
}
#[derive(Clone, Debug, Serialize, Deserialize, Default)]
pub struct PipelineConfig {
pub id: Uuid,
/// Transcoded/Copied stream config
pub variants: Vec<VariantStream>,
/// Output muxers
pub egress: Vec<EgressType>,
/// Source stream information for placeholder generation
pub ingress_info: Option<IngressInfo>,
}
impl Display for PipelineConfig {
fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
write!(f, "\nPipeline Config ID={}", self.id)?;
write!(f, "\nVariants:")?;
for v in &self.variants {
write!(f, "\n\t{}", v)?;
}
if !self.egress.is_empty() {
write!(f, "\nEgress:")?;
for e in &self.egress {
write!(f, "\n\t{}", e)?;
}
}
Ok(())
}
}