feat: HLS-LL
Some checks reported errors
continuous-integration/drone Build was killed

This commit is contained in:
2025-06-13 11:30:52 +01:00
parent cc973f0d9b
commit ca70bf964c
9 changed files with 533 additions and 176 deletions

View File

@ -1,24 +1,51 @@
use anyhow::Result;
use ffmpeg_rs_raw::ffmpeg_sys_the_third::AVPacket;
use ffmpeg_rs_raw::Encoder;
use std::path::PathBuf;
use uuid::Uuid;
use crate::egress::{Egress, EgressResult};
use crate::mux::HlsMuxer;
use crate::mux::{HlsMuxer, SegmentType};
use crate::variant::VariantStream;
/// Alias the muxer directly
pub type HlsEgress = HlsMuxer;
pub struct HlsEgress {
mux: HlsMuxer,
}
impl Egress for HlsMuxer {
impl HlsEgress {
pub const PATH: &'static str = "hls";
pub fn new<'a>(
id: &Uuid,
out_dir: &str,
segment_length: f32,
encoders: impl Iterator<Item = (&'a VariantStream, &'a Encoder)>,
segment_type: SegmentType,
) -> Result<Self> {
Ok(Self {
mux: HlsMuxer::new(
id,
PathBuf::from(out_dir).join(Self::PATH).to_str().unwrap(),
segment_length,
encoders,
segment_type,
)?,
})
}
}
impl Egress for HlsEgress {
unsafe fn process_pkt(
&mut self,
packet: *mut AVPacket,
variant: &Uuid,
) -> Result<EgressResult> {
self.mux_packet(packet, variant)
self.mux.mux_packet(packet, variant)
}
unsafe fn reset(&mut self) -> Result<()> {
for var in &mut self.variants {
for var in &mut self.mux.variants {
var.reset()?
}
Ok(())