add playout service: HLS streaming, FFmpeg, SegmentStore port (#9)
This commit is contained in:
34
crates/playout/src/config.rs
Normal file
34
crates/playout/src/config.rs
Normal file
@@ -0,0 +1,34 @@
|
||||
use std::path::PathBuf;
|
||||
|
||||
#[derive(Debug, Clone)]
|
||||
pub struct PlayoutConfig {
|
||||
pub listen_addr: String,
|
||||
pub segment_duration_secs: u32,
|
||||
pub window_size: usize,
|
||||
pub storage_path: PathBuf,
|
||||
pub tick_interval_ms: u64,
|
||||
}
|
||||
|
||||
impl PlayoutConfig {
|
||||
pub fn from_env() -> Self {
|
||||
Self {
|
||||
listen_addr: std::env::var("PLAYOUT_LISTEN_ADDR")
|
||||
.unwrap_or_else(|_| "0.0.0.0:9090".into()),
|
||||
segment_duration_secs: std::env::var("PLAYOUT_SEGMENT_DURATION")
|
||||
.ok()
|
||||
.and_then(|v| v.parse().ok())
|
||||
.unwrap_or(6),
|
||||
window_size: std::env::var("PLAYOUT_WINDOW_SIZE")
|
||||
.ok()
|
||||
.and_then(|v| v.parse().ok())
|
||||
.unwrap_or(10),
|
||||
storage_path: std::env::var("PLAYOUT_STORAGE_PATH")
|
||||
.map(PathBuf::from)
|
||||
.unwrap_or_else(|_| PathBuf::from("/tmp/k-tv-playout")),
|
||||
tick_interval_ms: std::env::var("PLAYOUT_TICK_INTERVAL_MS")
|
||||
.ok()
|
||||
.and_then(|v| v.parse().ok())
|
||||
.unwrap_or(1000),
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user