/// Instantiate a new segment from a `MoofAtom`.
Instantiate a new segment from a `MoofAtom`.
Instantiate a new segment from a ` MoofAtom ` .
pub fn new(moof: MoofAtom, mvex: Rc<MvexAtom>, last: &Box<dyn StreamSegment>) -> MoofSegment {
        let mut seq = Vec::new();
        // Calculate the sequence information for each track of this segment.
        for (track_num, traf) in moof.trafs.iter().enumerate() {
            // Calculate the total duration of all runs in the fragment for the track.
            let mut total_sample_duration = 0;
            for trun in traf.truns.iter() {
                total_sample_duration += if trun.is_sample_duration_present() {
                    trun.total_sample_duration
                }
                else {
                    let duration = traf.tfhd.default_sample_duration.unwrap_or(
                        mvex.trexs[track_num].default_sample_duration);
                    u64::from(trun.sample_count) * u64::from(duration)
                }
            }
            let (_, first_sample) = last.track_sample_range(track_num as u32);
            let (_, first_ts) = last.track_ts_range(track_num as u32);
            seq.push(SequenceInfo { first_sample, first_ts, total_sample_duration });
        }
        MoofSegment { moof, mvex, seq }
    }
pub fn new ( moof : MoofAtom , mvex : Rc < MvexAtom > , last : & Box < dyn StreamSegment > ) -> MoofSegment { let mut seq = Vec :: new ( ) ; // Calculate the sequence information for each track of this segment. for ( track_num , traf ) in moof . trafs . iter ( ) . enumerate ( ) { // Calculate the total duration of all runs in the fragment for the track. let mut total_sample_duration = 0 ; for trun in traf . truns . iter ( ) { total_sample_duration += if trun . is_sample_duration_present ( ) { trun . total_sample_duration } else { let duration = traf . tfhd . default_sample_duration . unwrap_or ( mvex . trexs [ track_num ] . default_sample_duration ) ; u64 :: from ( trun . sample_count ) * u64 :: from ( duration ) } } let ( _ , first_sample ) = last . track_sample_range ( track_num as u32 ) ; let ( _ , first_ts ) = last . track_ts_range ( track_num as u32 ) ; seq . push ( SequenceInfo { first_sample , first_ts , total_sample_duration } ) ; } MoofSegment { moof , mvex , seq } }
Instantiate a new segment from a `MoofAtom`.
Instantiate a new segment from a ` MoofAtom ` .
moof
MoofAtom
mvex
Rc<MvexAtom>
last
&Box<dyn StreamSegment>