Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow sample_time to wrap #134

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 7 additions & 4 deletions src/track.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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(),
Expand All @@ -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(),
Expand Down Expand Up @@ -520,12 +520,15 @@ impl Mp4Track {
)?;
}
let duration = trun.sample_durations[sample_idx];
return Ok((base_start_time + start_offset, duration));
return Ok((base_start_time.wrapping_add(start_offset), duration));
}
}
}
let start_offset = ((sample_id - 1) * default_sample_duration) as u64;
Ok((base_start_time + start_offset, default_sample_duration))
Ok((
base_start_time.wrapping_add(start_offset),
default_sample_duration,
))
} else {
let stts = &self.trak.mdia.minf.stbl.stts;

Expand Down
Loading