use serde::{Deserialize, Serialize};
use std::time::Duration;
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct LlHlsConfig {
pub enabled: bool,
pub part_duration: Duration,
pub enable_parts: bool,
pub enable_blocking_reload: bool,
pub enable_rendition_reports: bool,
pub enable_preload_hints: bool,
pub part_hold_back: Duration,
}
impl Default for LlHlsConfig {
fn default() -> Self {
Self {
enabled: true,
part_duration: Duration::from_millis(500),
enable_parts: true,
enable_blocking_reload: true,
enable_rendition_reports: true,
enable_preload_hints: true,
part_hold_back: Duration::from_secs(2),
}
}
}
#[derive(Debug, Clone)]
pub struct Part {
pub duration: Duration,
pub uri: String,
pub independent: bool,
}
impl Part {
#[must_use]
pub fn new(duration: Duration, uri: impl Into<String>) -> Self {
Self {
duration,
uri: uri.into(),
independent: false,
}
}
#[must_use]
pub const fn independent(mut self) -> Self {
self.independent = true;
self
}
}