@@ -48,8 +48,9 @@ use std::io::Read;
4848
4949// Symbols we need from our rust api.
5050use mp4parse:: serialize_opus_header;
51- use mp4parse:: unstable:: CheckedInteger ;
52- use mp4parse:: unstable:: Indice ;
51+ use mp4parse:: unstable:: {
52+ create_sample_table, media_time_to_us, track_time_to_us, CheckedInteger , Indice , Microseconds ,
53+ } ;
5354use mp4parse:: AudioCodecSpecific ;
5455use mp4parse:: AvifContext ;
5556use mp4parse:: CodecType ;
@@ -621,20 +622,19 @@ pub unsafe extern "C" fn mp4parse_get_track_info(
621622 let track = & context. tracks [ track_index] ;
622623
623624 if let ( Some ( track_timescale) , Some ( context_timescale) ) = ( track. timescale , context. timescale ) {
624- let media_time: CheckedInteger < u64 > = match track
625+ let media_time: CheckedInteger < _ > = match track
625626 . media_time
626- . map_or ( Some ( mp4parse :: unstable :: Microseconds ( 0 ) ) , |media_time| {
627- mp4parse :: unstable :: track_time_to_us ( media_time, track_timescale)
627+ . map_or ( Some ( Microseconds ( 0 ) ) , |media_time| {
628+ track_time_to_us ( media_time, track_timescale)
628629 } ) {
629630 Some ( time) => time. 0 . into ( ) ,
630631 None => return Mp4parseStatus :: Invalid ,
631632 } ;
632- let empty_duration: CheckedInteger < u64 > = match track. empty_duration . map_or (
633- Some ( mp4parse:: unstable:: Microseconds ( 0 ) ) ,
634- |empty_duration| {
635- mp4parse:: unstable:: media_time_to_us ( empty_duration, context_timescale)
636- } ,
637- ) {
633+ let empty_duration: CheckedInteger < _ > = match track
634+ . empty_duration
635+ . map_or ( Some ( Microseconds ( 0 ) ) , |empty_duration| {
636+ media_time_to_us ( empty_duration, context_timescale)
637+ } ) {
638638 Some ( time) => time. 0 . into ( ) ,
639639 None => return Mp4parseStatus :: Invalid ,
640640 } ;
@@ -644,7 +644,7 @@ pub unsafe extern "C" fn mp4parse_get_track_info(
644644 } ;
645645
646646 if let Some ( track_duration) = track. duration {
647- match mp4parse :: unstable :: track_time_to_us ( track_duration, track_timescale) {
647+ match track_time_to_us ( track_duration, track_timescale) {
648648 Some ( duration) => info. duration = duration. 0 ,
649649 None => return Mp4parseStatus :: Invalid ,
650650 }
@@ -1114,15 +1114,15 @@ fn get_indice_table(
11141114 }
11151115
11161116 let media_time = match ( & track. media_time , & track. timescale ) {
1117- ( & Some ( t) , & Some ( s) ) => mp4parse :: unstable :: track_time_to_us ( t, s)
1117+ ( & Some ( t) , & Some ( s) ) => track_time_to_us ( t, s)
11181118 . and_then ( |v| i64:: try_from ( v. 0 ) . ok ( ) )
11191119 . map ( Into :: into) ,
11201120 _ => None ,
11211121 } ;
11221122
11231123 let empty_duration: Option < CheckedInteger < _ > > =
11241124 match ( & track. empty_duration , & context. timescale ) {
1125- ( & Some ( e) , & Some ( s) ) => mp4parse :: unstable :: media_time_to_us ( e, s)
1125+ ( & Some ( e) , & Some ( s) ) => media_time_to_us ( e, s)
11261126 . and_then ( |v| i64:: try_from ( v. 0 ) . ok ( ) )
11271127 . map ( Into :: into) ,
11281128 _ => None ,
@@ -1138,7 +1138,7 @@ fn get_indice_table(
11381138 _ => 0 . into ( ) ,
11391139 } ;
11401140
1141- if let Some ( v) = mp4parse :: unstable :: create_sample_table ( track, offset_time) {
1141+ if let Some ( v) = create_sample_table ( track, offset_time) {
11421142 indices. set_indices ( & v) ;
11431143 index_table. insert ( track_id, v) ?;
11441144 return Ok ( ( ) ) ;
@@ -1179,7 +1179,7 @@ pub unsafe extern "C" fn mp4parse_get_fragment_info(
11791179 } ;
11801180
11811181 if let ( Some ( time) , Some ( scale) ) = ( duration, context. timescale ) {
1182- info. fragment_duration = match mp4parse :: unstable :: media_time_to_us ( time, scale) {
1182+ info. fragment_duration = match media_time_to_us ( time, scale) {
11831183 Some ( time_us) => time_us. 0 as u64 ,
11841184 None => return Mp4parseStatus :: Invalid ,
11851185 }
0 commit comments