mirror of
https://github.com/alfg/mp4-rust.git
synced 2024-12-22 12:06:33 +00:00
Add reading of emsg boxes when reading fragments
This commit is contained in:
parent
35560e94f5
commit
2b9cf97f7a
2 changed files with 8 additions and 3 deletions
|
@ -138,6 +138,7 @@ impl<R: Read + Seek> Mp4Reader<R> {
|
|||
|
||||
let mut moofs = Vec::new();
|
||||
let mut moof_offsets = Vec::new();
|
||||
let mut emsgs = Vec::new();
|
||||
|
||||
let mut current = start;
|
||||
while current < size {
|
||||
|
@ -166,6 +167,10 @@ impl<R: Read + Seek> Mp4Reader<R> {
|
|||
moofs.push(moof);
|
||||
moof_offsets.push(moof_offset);
|
||||
}
|
||||
BoxType::EmsgBox => {
|
||||
let emsg = EmsgBox::read_box(&mut reader, s)?;
|
||||
emsgs.push(emsg);
|
||||
}
|
||||
_ => {
|
||||
// XXX warn!()
|
||||
skip_box(&mut reader, s)?;
|
||||
|
@ -209,7 +214,7 @@ impl<R: Read + Seek> Mp4Reader<R> {
|
|||
ftyp: self.ftyp.clone(),
|
||||
moov: self.moov.clone(),
|
||||
moofs,
|
||||
emsgs: Vec::new(),
|
||||
emsgs,
|
||||
tracks,
|
||||
size,
|
||||
})
|
||||
|
|
|
@ -261,7 +261,7 @@ impl Mp4Track {
|
|||
|
||||
pub fn sequence_parameter_set(&self) -> Result<&[u8]> {
|
||||
if let Some(ref avc1) = self.trak.mdia.minf.stbl.stsd.avc1 {
|
||||
match avc1.avcc.sequence_parameter_sets.get(0) {
|
||||
match avc1.avcc.sequence_parameter_sets.first() {
|
||||
Some(nal) => Ok(nal.bytes.as_ref()),
|
||||
None => Err(Error::EntryInStblNotFound(
|
||||
self.track_id(),
|
||||
|
@ -276,7 +276,7 @@ impl Mp4Track {
|
|||
|
||||
pub fn picture_parameter_set(&self) -> Result<&[u8]> {
|
||||
if let Some(ref avc1) = self.trak.mdia.minf.stbl.stsd.avc1 {
|
||||
match avc1.avcc.picture_parameter_sets.get(0) {
|
||||
match avc1.avcc.picture_parameter_sets.first() {
|
||||
Some(nal) => Ok(nal.bytes.as_ref()),
|
||||
None => Err(Error::EntryInStblNotFound(
|
||||
self.track_id(),
|
||||
|
|
Loading…
Reference in a new issue