mirror of
https://github.com/v0l/zap-stream-core.git
synced 2025-06-23 09:11:17 +00:00
refactor: convert to workspace
This commit is contained in:
43
crates/core/src/egress/mod.rs
Normal file
43
crates/core/src/egress/mod.rs
Normal file
@ -0,0 +1,43 @@
|
||||
use anyhow::Result;
|
||||
use ffmpeg_rs_raw::ffmpeg_sys_the_third::AVPacket;
|
||||
use serde::{Deserialize, Serialize};
|
||||
use std::collections::HashSet;
|
||||
use std::path::PathBuf;
|
||||
use uuid::Uuid;
|
||||
|
||||
pub mod hls;
|
||||
pub mod recorder;
|
||||
|
||||
#[derive(Clone, Debug, Serialize, Deserialize)]
|
||||
pub struct EgressConfig {
|
||||
pub name: String,
|
||||
/// Which variants will be used in this muxer
|
||||
pub variants: HashSet<Uuid>,
|
||||
}
|
||||
|
||||
pub trait Egress {
|
||||
unsafe fn process_pkt(&mut self, packet: *mut AVPacket, variant: &Uuid)
|
||||
-> Result<EgressResult>;
|
||||
unsafe fn reset(&mut self) -> Result<()>;
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone)]
|
||||
pub enum EgressResult {
|
||||
/// Nothing to report
|
||||
None,
|
||||
/// A new segment was created
|
||||
NewSegment(NewSegment),
|
||||
}
|
||||
|
||||
/// Basic details of new segment created by a muxer
|
||||
#[derive(Debug, Clone)]
|
||||
pub struct NewSegment {
|
||||
/// The id of the variant (video or audio)
|
||||
pub variant: Uuid,
|
||||
/// Segment index
|
||||
pub idx: u64,
|
||||
/// Duration in seconds
|
||||
pub duration: f32,
|
||||
/// Path on disk to the segment file
|
||||
pub path: PathBuf,
|
||||
}
|
Reference in New Issue
Block a user