1
0
Fork 0
mirror of https://github.com/alfg/mp4-rust.git synced 2024-05-09 12:02:52 +00:00

Compare commits

...

3 commits

Author SHA1 Message Date
jensenn c896f64a68
Merge af3b69e6a4 into 35560e94f5 2024-03-26 21:23:07 +00:00
Jensenn af3b69e6a4 Fix clippy issue 2024-03-26 15:22:59 -06:00
Jensenn 1a90e8d6fb Add uuid box reading to read_fragment_header 2024-03-26 15:18:26 -06:00
2 changed files with 9 additions and 4 deletions

View file

@ -145,6 +145,7 @@ impl<R: Read + Seek> Mp4Reader<R> {
let mut moofs = Vec::new();
let mut moof_offsets = Vec::new();
let mut uuids = Vec::new();
let mut current = start;
while current < size {
@ -173,6 +174,10 @@ impl<R: Read + Seek> Mp4Reader<R> {
moofs.push(moof);
moof_offsets.push(moof_offset);
}
BoxType::UuidBox => {
let uuid = UuidBox::read_box(&mut reader, s)?;
uuids.push(uuid);
}
_ => {
// XXX warn!()
skip_box(&mut reader, s)?;
@ -216,8 +221,8 @@ impl<R: Read + Seek> Mp4Reader<R> {
ftyp: self.ftyp.clone(),
moov: self.moov.clone(),
moofs,
emsgs: self.emsgs.clone(),
uuids: self.uuids.clone(),
emsgs: Vec::new(),
uuids,
tracks,
size,
})

View file

@ -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(),