@@ -48,8 +48,9 @@ use std::io::Read;
48
48
49
49
// Symbols we need from our rust api.
50
50
use 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
+ } ;
53
54
use mp4parse:: AudioCodecSpecific ;
54
55
use mp4parse:: AvifContext ;
55
56
use mp4parse:: CodecType ;
@@ -621,20 +622,19 @@ pub unsafe extern "C" fn mp4parse_get_track_info(
621
622
let track = & context. tracks [ track_index] ;
622
623
623
624
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
625
626
. 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)
628
629
} ) {
629
630
Some ( time) => time. 0 . into ( ) ,
630
631
None => return Mp4parseStatus :: Invalid ,
631
632
} ;
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
+ } ) {
638
638
Some ( time) => time. 0 . into ( ) ,
639
639
None => return Mp4parseStatus :: Invalid ,
640
640
} ;
@@ -644,7 +644,7 @@ pub unsafe extern "C" fn mp4parse_get_track_info(
644
644
} ;
645
645
646
646
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) {
648
648
Some ( duration) => info. duration = duration. 0 ,
649
649
None => return Mp4parseStatus :: Invalid ,
650
650
}
@@ -1114,15 +1114,15 @@ fn get_indice_table(
1114
1114
}
1115
1115
1116
1116
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)
1118
1118
. and_then ( |v| i64:: try_from ( v. 0 ) . ok ( ) )
1119
1119
. map ( Into :: into) ,
1120
1120
_ => None ,
1121
1121
} ;
1122
1122
1123
1123
let empty_duration: Option < CheckedInteger < _ > > =
1124
1124
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)
1126
1126
. and_then ( |v| i64:: try_from ( v. 0 ) . ok ( ) )
1127
1127
. map ( Into :: into) ,
1128
1128
_ => None ,
@@ -1138,7 +1138,7 @@ fn get_indice_table(
1138
1138
_ => 0 . into ( ) ,
1139
1139
} ;
1140
1140
1141
- if let Some ( v) = mp4parse :: unstable :: create_sample_table ( track, offset_time) {
1141
+ if let Some ( v) = create_sample_table ( track, offset_time) {
1142
1142
indices. set_indices ( & v) ;
1143
1143
index_table. insert ( track_id, v) ?;
1144
1144
return Ok ( ( ) ) ;
@@ -1179,7 +1179,7 @@ pub unsafe extern "C" fn mp4parse_get_fragment_info(
1179
1179
} ;
1180
1180
1181
1181
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) {
1183
1183
Some ( time_us) => time_us. 0 as u64 ,
1184
1184
None => return Mp4parseStatus :: Invalid ,
1185
1185
}
0 commit comments