mirror of
https://github.com/alfg/mp4-rust.git
synced 2024-06-10 17:09:22 +00:00
Merge 9d8bfc9d54
into 35560e94f5
This commit is contained in:
commit
ed1960e918
11
src/track.rs
11
src/track.rs
|
@ -261,7 +261,7 @@ impl Mp4Track {
|
||||||
|
|
||||||
pub fn sequence_parameter_set(&self) -> Result<&[u8]> {
|
pub fn sequence_parameter_set(&self) -> Result<&[u8]> {
|
||||||
if let Some(ref avc1) = self.trak.mdia.minf.stbl.stsd.avc1 {
|
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()),
|
Some(nal) => Ok(nal.bytes.as_ref()),
|
||||||
None => Err(Error::EntryInStblNotFound(
|
None => Err(Error::EntryInStblNotFound(
|
||||||
self.track_id(),
|
self.track_id(),
|
||||||
|
@ -276,7 +276,7 @@ impl Mp4Track {
|
||||||
|
|
||||||
pub fn picture_parameter_set(&self) -> Result<&[u8]> {
|
pub fn picture_parameter_set(&self) -> Result<&[u8]> {
|
||||||
if let Some(ref avc1) = self.trak.mdia.minf.stbl.stsd.avc1 {
|
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()),
|
Some(nal) => Ok(nal.bytes.as_ref()),
|
||||||
None => Err(Error::EntryInStblNotFound(
|
None => Err(Error::EntryInStblNotFound(
|
||||||
self.track_id(),
|
self.track_id(),
|
||||||
|
@ -520,12 +520,15 @@ impl Mp4Track {
|
||||||
)?;
|
)?;
|
||||||
}
|
}
|
||||||
let duration = trun.sample_durations[sample_idx];
|
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;
|
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 {
|
} else {
|
||||||
let stts = &self.trak.mdia.minf.stbl.stts;
|
let stts = &self.trak.mdia.minf.stbl.stts;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue