diff --git a/src/muxer/hls/mp4/mod.rs b/src/muxer/hls/mp4/mod.rs index 3cbbad5..9ca103b 100644 --- a/src/muxer/hls/mp4/mod.rs +++ b/src/muxer/hls/mp4/mod.rs @@ -1,5 +1,6 @@ mod mp4muxer; mod atoms; +mod samples; use std::sync::{mpsc, Arc}; use std::error::Error; @@ -8,9 +9,9 @@ use crate::util; pub struct MP4Muxer { v: mpsc::Receiver, - v_samples: Vec>, + v_samples: samples::SampleQueue, a: mpsc::Receiver, - a_samples: Vec>, + a_samples: samples::SampleQueue, metadata: Arc, err_in: mpsc::Sender>, } @@ -21,8 +22,14 @@ pub fn new_muxer(v: mpsc::Receiver, a: mpsc::Receiver { - self.v_samples.push(v_cc.packet_data.clone()); + self.v_samples.push(v_cc.packet_data.clone(), 0x02000000); Ok(get_av1_stsd(v_cc.packet_data, &self.metadata)) }, _ => Err(Box::new(util::MuxerError::InvalidCodec)) diff --git a/src/muxer/hls/mp4/samples.rs b/src/muxer/hls/mp4/samples.rs new file mode 100644 index 0000000..db5c512 --- /dev/null +++ b/src/muxer/hls/mp4/samples.rs @@ -0,0 +1,20 @@ +pub struct Sample { + pub data: Vec, + pub size: u32, + pub flags: u32, +} + +pub struct SampleQueue { + pub queue: Vec, + pub default_duration: u32, +} + +impl SampleQueue { + pub fn push(&mut self, data: Vec, flags: u32) { + self.queue.push(Sample { + size: data.len() as u32, + data: data, + flags: flags, + }) + } +}