pub fn is_valid(&self) -> bool {
        let mut valid = true;
        let track_id = match first_box!(&self.boxes, TrackHeaderBox) {
            Some(th) => th.track_id,
            None => {
                log::error!("TrackBox: no TrackHeaderBox present");
                return false;
            },
        };

        // The must be at least one MediaBox present.
        match first_box!(&self.boxes, MediaBox) {
            Some(m) => {
                if !m.is_valid() {
                    valid = false;
                }
            },
            None => {
                log::error!("TrackBox(id {}): no MediaBox present", track_id);
                valid = false;
            },
        }

        // The must be exactly one MediaBox present.
        match first_box!(&self.boxes, SampleTableBox) {
            Some(m) => {
                if !m.is_valid() {
                    valid = false;
                }
            },
            None => {
                log::error!("TrackBox(id {}): no SampleTableBox present", track_id);
                valid = false;
            },
        }

        // If there is an edit list, the first entry must be valid
        // for the entire track.
        if let Some(elst) = self.edit_list() {
            let tkhd = self.track_header();
            if tkhd.duration.0 != 0 {

                // If the first entry has about the same duration as the track,
                // assume it covers the entire track.
                let entry = &elst.entries[0];
                let x = (entry.segment_duration as f64) / (tkhd.duration.0 as f64);
                if x < 0.95f64 {
                    log::error!("TrackBox(id {}): EditBox: first entry: does not cover entire duration", track_id);
                    valid = false;
                }
                if entry.media_rate != 1 {
                    log::error!("TrackBox(id {}): EditBox: first entry: does not have media_rate 1", track_id);
                    valid = false;
                }
                if entry.media_time > i32::MAX as i64 {
                    log::error!("TrackBox(id {}): EditBox: first entry: media_time too large", track_id);
                    valid = false;
                }
                if entry.media_time < 0 {
                    log::error!("TrackBox(id {}): EditBox: first entry: media_time negative", track_id);
                    valid = false;
                }
            }
        }

        valid
    }
/// Check if this track is valid (has header and media boxes).
Check if this track is valid (has header and media boxes).
Check if this track is valid ( has header and media boxes ) .
pub fn is_valid(&self) -> bool {
        let mut valid = true;
        let track_id = match first_box!(&self.boxes, TrackHeaderBox) {
            Some(th) => th.track_id,
            None => {
                log::error!("TrackBox: no TrackHeaderBox present");
                return false;
            },
        };
        // The must be at least one MediaBox present.
        match first_box!(&self.boxes, MediaBox) {
            Some(m) => {
                if !m.is_valid() {
                    valid = false;
                }
            },
            None => {
                log::error!("TrackBox(id {}): no MediaBox present", track_id);
                valid = false;
            },
        }
        // The must be exactly one MediaBox present.
        match first_box!(&self.boxes, SampleTableBox) {
            Some(m) => {
                if !m.is_valid() {
                    valid = false;
                }
            },
            None => {
                log::error!("TrackBox(id {}): no SampleTableBox present", track_id);
                valid = false;
            },
        }
        // If there is an edit list, the first entry must be valid
        // for the entire track.
        if let Some(elst) = self.edit_list() {
            let tkhd = self.track_header();
            if tkhd.duration.0 != 0 {
                // If the first entry has about the same duration as the track,
                // assume it covers the entire track.
                let entry = &elst.entries[0];
                let x = (entry.segment_duration as f64) / (tkhd.duration.0 as f64);
                if x < 0.95f64 {
                    log::error!("TrackBox(id {}): EditBox: first entry: does not cover entire duration", track_id);
                    valid = false;
                }
                if entry.media_rate != 1 {
                    log::error!("TrackBox(id {}): EditBox: first entry: does not have media_rate 1", track_id);
                    valid = false;
                }
                if entry.media_time > i32::MAX as i64 {
                    log::error!("TrackBox(id {}): EditBox: first entry: media_time too large", track_id);
                    valid = false;
                }
                if entry.media_time < 0 {
                    log::error!("TrackBox(id {}): EditBox: first entry: media_time negative", track_id);
                    valid = false;
                }
            }
        }
        valid
    }
pub fn is_valid ( & self ) -> bool { let mut valid = true ; let track_id = match first_box ! ( self boxes TrackHeaderBox ) { Some ( th ) => th . track_id , None => { log :: error ! ( " " ) ; return false ; } , } ; // The must be at least one MediaBox present. match first_box ! ( self boxes MediaBox ) { Some ( m ) => { if ! m . is_valid ( ) { valid = false ; } } , None => { log :: error ! ( " " track_id ) ; valid = false ; } , } // The must be exactly one MediaBox present. match first_box ! ( self boxes SampleTableBox ) { Some ( m ) => { if ! m . is_valid ( ) { valid = false ; } } , None => { log :: error ! ( " " track_id ) ; valid = false ; } , } // If there is an edit list, the first entry must be valid // for the entire track. if let Some ( elst ) = self . edit_list ( ) { let tkhd = self . track_header ( ) ; if tkhd . duration . 0 != 0 { // If the first entry has about the same duration as the track, // assume it covers the entire track. let entry = & elst . entries [ 0 ] ; let x = ( entry . segment_duration as f64 ) / ( tkhd . duration . 0 as f64 ) ; if x < 0.95f64 { log :: error ! ( " " track_id ) ; valid = false ; } if entry . media_rate != 1 { log :: error ! ( " " track_id ) ; valid = false ; } if entry . media_time > i32 :: MAX as i64 { log :: error ! ( " " track_id ) ; valid = false ; } if entry . media_time < 0 { log :: error ! ( " " track_id ) ; valid = false ; } } } valid }
Check if this track is valid (has header and media boxes).
Check if this track is valid ( has header and media boxes ) .
&self
&self