Skip to content

Commit

Permalink
fmt
Browse files Browse the repository at this point in the history
  • Loading branch information
sagudev committed Jan 22, 2022
1 parent adef5e1 commit 9e4c80a
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 22 deletions.
12 changes: 8 additions & 4 deletions symphonia-core/src/formats.rs
Original file line number Diff line number Diff line change
Expand Up @@ -398,7 +398,8 @@ pub mod util {
// simply append it to the index.
if ts > last_ts {
self.points.push(seek_point)
} else if ts < last_ts {
}
else if ts < last_ts {
// If the seek point has a timestamp less-than the last entry in the index, then the
// insertion point must be found. This case should rarely occur.

Expand Down Expand Up @@ -441,7 +442,8 @@ pub mod util {

if frame_ts < mid_ts {
upper = mid;
} else {
}
else {
lower = mid;
}
}
Expand All @@ -462,7 +464,8 @@ pub mod util {
packet.ts = 0;
packet.dur -= trim;
trim as u32
} else {
}
else {
packet.ts -= u64::from(delay);
0
};
Expand All @@ -472,7 +475,8 @@ pub mod util {
let trim = (packet.ts + packet.dur - num_frames).min(packet.dur);
packet.dur -= trim;
trim as u32
} else {
}
else {
0
};
}
Expand Down
54 changes: 36 additions & 18 deletions symphonia-format-isomp4/src/stream.rs
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,8 @@ impl MoofSegment {
for trun in traf.truns.iter() {
total_sample_duration += if trun.is_sample_duration_present() {
trun.total_sample_duration
} else {
}
else {
let duration = traf
.tfhd
.default_sample_duration
Expand Down Expand Up @@ -129,7 +130,8 @@ impl StreamSegment for MoofSegment {
let dur = trun.sample_duration[sample_num_rel as usize];

SampleTiming { ts: trun_ts_offset + ts, dur }
} else {
}
else {
let dur = traf
.tfhd
.default_sample_duration
Expand All @@ -146,7 +148,8 @@ impl StreamSegment for MoofSegment {
let trun_duration = if trun.is_sample_duration_present() {
// The size of the entire track fragment run is known.
trun.total_sample_duration
} else {
}
else {
let duration = traf
.tfhd
.default_sample_duration
Expand Down Expand Up @@ -177,7 +180,8 @@ impl StreamSegment for MoofSegment {
// Get the total duration of this track run.
let trun_duration = if trun.is_sample_duration_present() {
trun.total_sample_duration
} else {
}
else {
let duration = traf
.tfhd
.default_sample_duration
Expand All @@ -200,7 +204,8 @@ impl StreamSegment for MoofSegment {
ts_delta -= u64::from(duration);
sample_num += 1;
}
} else {
}
else {
// If the sample durations are not present, then get the sample duration from
// the track fragment header or track extends atom. Then, calculate the number
// of samples are needed to reach the desired timestamp.
Expand Down Expand Up @@ -254,7 +259,8 @@ impl StreamSegment for MoofSegment {
// fragment header.
trun_offset = if offset.is_negative() {
traf_base_pos - u64::from(offset.wrapping_abs() as u32)
} else {
}
else {
traf_base_pos + offset as u64
};
}
Expand All @@ -263,7 +269,8 @@ impl StreamSegment for MoofSegment {
// Get the size of the sample.
let size = if trun.is_sample_size_present() {
trun.sample_size[sample_num_rel as usize]
} else {
}
else {
traf.tfhd
.default_sample_size
.unwrap_or(self.mvex.trexs[track_num as usize].default_sample_size)
Expand All @@ -273,10 +280,12 @@ impl StreamSegment for MoofSegment {
if trun.is_sample_size_present() {
let sample_sizes = &trun.sample_size[..sample_num_rel as usize];
Some(sample_sizes.iter().map(|&s| u64::from(s)).sum::<u64>())
} else {
}
else {
Some(u64::from(sample_num_rel) * u64::from(size))
}
} else {
}
else {
None
};

Expand All @@ -287,7 +296,8 @@ impl StreamSegment for MoofSegment {
let trun_size = if trun.is_sample_size_present() {
// The size of the entire track fragment run is known.
trun.total_sample_size
} else {
}
else {
let size = traf
.tfhd
.default_sample_size
Expand Down Expand Up @@ -324,17 +334,21 @@ fn get_chunk_offset(
// 32-bit offset
if let Some(offset) = stco.chunk_offsets.get(chunk) {
Ok(Some(u64::from(*offset)))
} else {
}
else {
decode_error("isomp4: missing stco entry")
}
} else if let Some(co64) = co64.as_ref() {
}
else if let Some(co64) = co64.as_ref() {
// 64-bit offset
if let Some(offset) = co64.chunk_offsets.get(chunk) {
Ok(Some(*offset))
} else {
}
else {
decode_error("isomp4: missing co64 entry")
}
} else {
}
else {
// This should never happen because it is mandatory to have either a stco or co64 atom.
decode_error("isomp4: missing stco or co64 atom")
}
Expand Down Expand Up @@ -370,7 +384,8 @@ impl StreamSegment for MoovSegment {

if let Some((ts, dur)) = timing {
Ok(Some(SampleTiming { ts, dur }))
} else {
}
else {
Ok(None)
}
}
Expand Down Expand Up @@ -442,14 +457,16 @@ impl StreamSegment for MoovSegment {

if let Some(samples) = entries.get(chunk_first_sample..sample_num as usize) {
samples.iter().map(|&size| u64::from(size)).sum()
} else {
}
else {
return decode_error("isomp4: missing one or more stsz entries");
}
}
};

Some(offset)
} else {
}
else {
None
};

Expand All @@ -459,7 +476,8 @@ impl StreamSegment for MoovSegment {
SampleSize::Variable(ref entries) => {
if let Some(size) = entries.get(sample_num as usize) {
*size
} else {
}
else {
return decode_error("isomp4: missing stsz entry");
}
}
Expand Down

0 comments on commit 9e4c80a

Please sign in to comment.