mirror of
https://github.com/sile/hls_m3u8.git
synced 2024-12-31 15:58:41 +00:00
rename MediaSegment::inf to MediaSegment::duration
This commit is contained in:
parent
429f3f8c3d
commit
72c0ff9c75
3 changed files with 39 additions and 39 deletions
|
@ -149,7 +149,7 @@ pub struct MediaSegment {
|
|||
/// This field is required.
|
||||
#[shorthand(enable(skip))]
|
||||
#[builder(setter(into))]
|
||||
pub inf: ExtInf,
|
||||
pub duration: ExtInf,
|
||||
/// The URI of a media segment.
|
||||
///
|
||||
/// ## Note
|
||||
|
@ -174,7 +174,7 @@ impl MediaSegment {
|
|||
/// .map(ExtXMap::new("https://www.example.com/"))
|
||||
/// .byte_range(5..25)
|
||||
/// .has_discontinuity(true)
|
||||
/// .inf(Duration::from_secs(4))
|
||||
/// .duration(Duration::from_secs(4))
|
||||
/// .uri("http://www.uri.com/")
|
||||
/// .build()?;
|
||||
/// # Ok::<(), String>(())
|
||||
|
@ -233,7 +233,7 @@ impl fmt::Display for MediaSegment {
|
|||
writeln!(f, "{}", value)?;
|
||||
}
|
||||
|
||||
writeln!(f, "{}", self.inf)?;
|
||||
writeln!(f, "{}", self.duration)?;
|
||||
writeln!(f, "{}", self.uri)?;
|
||||
Ok(())
|
||||
}
|
||||
|
@ -254,7 +254,7 @@ impl RequiredVersion for MediaSegment {
|
|||
}
|
||||
},
|
||||
self.program_date_time,
|
||||
self.inf
|
||||
self.duration
|
||||
]
|
||||
}
|
||||
}
|
||||
|
@ -279,7 +279,7 @@ mod tests {
|
|||
.map(ExtXMap::new("https://www.example.com/"))
|
||||
.byte_range(ExtXByteRange::from(5..25))
|
||||
.has_discontinuity(true)
|
||||
.inf(ExtInf::new(Duration::from_secs(4)))
|
||||
.duration(ExtInf::new(Duration::from_secs(4)))
|
||||
.uri("http://www.uri.com/")
|
||||
.build()
|
||||
.unwrap()
|
||||
|
|
|
@ -30,19 +30,19 @@ generate_tests! {
|
|||
.target_duration(Duration::from_secs(10))
|
||||
.segments(vec![
|
||||
MediaSegment::builder()
|
||||
.inf(ExtInf::new(Duration::from_secs_f64(10.0)))
|
||||
.duration(ExtInf::new(Duration::from_secs_f64(10.0)))
|
||||
.byte_range(ExtXByteRange::from(0..75232))
|
||||
.uri("video.ts")
|
||||
.build()
|
||||
.unwrap(),
|
||||
MediaSegment::builder()
|
||||
.inf(ExtInf::new(Duration::from_secs_f64(10.0)))
|
||||
.duration(ExtInf::new(Duration::from_secs_f64(10.0)))
|
||||
.byte_range(ExtXByteRange::from(752321..82112 + 752321))
|
||||
.uri("video.ts")
|
||||
.build()
|
||||
.unwrap(),
|
||||
MediaSegment::builder()
|
||||
.inf(ExtInf::new(Duration::from_secs_f64(10.0)))
|
||||
.duration(ExtInf::new(Duration::from_secs_f64(10.0)))
|
||||
.byte_range(ExtXByteRange::from(..69864))
|
||||
.uri("video.ts")
|
||||
.build()
|
||||
|
@ -75,22 +75,22 @@ generate_tests! {
|
|||
.target_duration(Duration::from_secs(10))
|
||||
.segments(vec![
|
||||
MediaSegment::builder()
|
||||
.inf(ExtInf::new(Duration::from_secs(10)))
|
||||
.duration(ExtInf::new(Duration::from_secs(10)))
|
||||
.uri("http://example.com/00001.ts")
|
||||
.build()
|
||||
.unwrap(),
|
||||
MediaSegment::builder()
|
||||
.inf(ExtInf::new(Duration::from_secs(10)))
|
||||
.duration(ExtInf::new(Duration::from_secs(10)))
|
||||
.uri("https://example.com/00002.ts")
|
||||
.build()
|
||||
.unwrap(),
|
||||
MediaSegment::builder()
|
||||
.inf(ExtInf::new(Duration::from_secs(10)))
|
||||
.duration(ExtInf::new(Duration::from_secs(10)))
|
||||
.uri("//example.com/00003.ts")
|
||||
.build()
|
||||
.unwrap(),
|
||||
MediaSegment::builder()
|
||||
.inf(ExtInf::new(Duration::from_secs(10)))
|
||||
.duration(ExtInf::new(Duration::from_secs(10)))
|
||||
.uri("http://example.com/00004.ts")
|
||||
.build()
|
||||
.unwrap(),
|
||||
|
@ -125,103 +125,103 @@ generate_tests! {
|
|||
.playlist_type(PlaylistType::Vod)
|
||||
.segments(vec![
|
||||
MediaSegment::builder()
|
||||
.inf(ExtInf::new(Duration::from_secs(10)))
|
||||
.duration(ExtInf::new(Duration::from_secs(10)))
|
||||
.uri("hls_450k_video.ts")
|
||||
.byte_range(0..522_828)
|
||||
.build()
|
||||
.unwrap(),
|
||||
MediaSegment::builder()
|
||||
.inf(ExtInf::new(Duration::from_secs(10)))
|
||||
.duration(ExtInf::new(Duration::from_secs(10)))
|
||||
.byte_range(522_828..1_110_328)
|
||||
.uri("hls_450k_video.ts")
|
||||
.build()
|
||||
.unwrap(),
|
||||
MediaSegment::builder()
|
||||
.inf(ExtInf::new(Duration::from_secs(10)))
|
||||
.duration(ExtInf::new(Duration::from_secs(10)))
|
||||
.byte_range(1_110_328..1_823_412)
|
||||
.uri("hls_450k_video.ts")
|
||||
.build()
|
||||
.unwrap(),
|
||||
MediaSegment::builder()
|
||||
.inf(ExtInf::new(Duration::from_secs(10)))
|
||||
.duration(ExtInf::new(Duration::from_secs(10)))
|
||||
.byte_range(1_823_412..2_299_992)
|
||||
.uri("hls_450k_video.ts")
|
||||
.build()
|
||||
.unwrap(),
|
||||
MediaSegment::builder()
|
||||
.inf(ExtInf::new(Duration::from_secs(10)))
|
||||
.duration(ExtInf::new(Duration::from_secs(10)))
|
||||
.byte_range(2_299_992..2_835_604)
|
||||
.uri("hls_450k_video.ts")
|
||||
.build()
|
||||
.unwrap(),
|
||||
MediaSegment::builder()
|
||||
.inf(ExtInf::new(Duration::from_secs(10)))
|
||||
.duration(ExtInf::new(Duration::from_secs(10)))
|
||||
.byte_range(2_835_604..3_042_780)
|
||||
.uri("hls_450k_video.ts")
|
||||
.build()
|
||||
.unwrap(),
|
||||
MediaSegment::builder()
|
||||
.inf(ExtInf::new(Duration::from_secs(10)))
|
||||
.duration(ExtInf::new(Duration::from_secs(10)))
|
||||
.byte_range(3_042_780..3_498_680)
|
||||
.uri("hls_450k_video.ts")
|
||||
.build()
|
||||
.unwrap(),
|
||||
MediaSegment::builder()
|
||||
.inf(ExtInf::new(Duration::from_secs(10)))
|
||||
.duration(ExtInf::new(Duration::from_secs(10)))
|
||||
.byte_range(3_498_680..4_155_928)
|
||||
.uri("hls_450k_video.ts")
|
||||
.build()
|
||||
.unwrap(),
|
||||
MediaSegment::builder()
|
||||
.inf(ExtInf::new(Duration::from_secs(10)))
|
||||
.duration(ExtInf::new(Duration::from_secs(10)))
|
||||
.byte_range(4_155_928..4_727_636)
|
||||
.uri("hls_450k_video.ts")
|
||||
.build()
|
||||
.unwrap(),
|
||||
MediaSegment::builder()
|
||||
.inf(ExtInf::new(Duration::from_secs(10)))
|
||||
.duration(ExtInf::new(Duration::from_secs(10)))
|
||||
.byte_range(4_727_636..5_212_676)
|
||||
.uri("hls_450k_video.ts")
|
||||
.build()
|
||||
.unwrap(),
|
||||
MediaSegment::builder()
|
||||
.inf(ExtInf::new(Duration::from_secs(10)))
|
||||
.duration(ExtInf::new(Duration::from_secs(10)))
|
||||
.byte_range(5_212_676..5_921_812)
|
||||
.uri("hls_450k_video.ts")
|
||||
.build()
|
||||
.unwrap(),
|
||||
MediaSegment::builder()
|
||||
.inf(ExtInf::new(Duration::from_secs(10)))
|
||||
.duration(ExtInf::new(Duration::from_secs(10)))
|
||||
.byte_range(5_921_812..6_651_816)
|
||||
.uri("hls_450k_video.ts")
|
||||
.build()
|
||||
.unwrap(),
|
||||
MediaSegment::builder()
|
||||
.inf(ExtInf::new(Duration::from_secs(10)))
|
||||
.duration(ExtInf::new(Duration::from_secs(10)))
|
||||
.byte_range(6_651_816..7_108_092)
|
||||
.uri("hls_450k_video.ts")
|
||||
.build()
|
||||
.unwrap(),
|
||||
MediaSegment::builder()
|
||||
.inf(ExtInf::new(Duration::from_secs(10)))
|
||||
.duration(ExtInf::new(Duration::from_secs(10)))
|
||||
.byte_range(7_108_092..7_576_776)
|
||||
.uri("hls_450k_video.ts")
|
||||
.build()
|
||||
.unwrap(),
|
||||
MediaSegment::builder()
|
||||
.inf(ExtInf::new(Duration::from_secs(10)))
|
||||
.duration(ExtInf::new(Duration::from_secs(10)))
|
||||
.byte_range(7_576_776..8_021_772)
|
||||
.uri("hls_450k_video.ts")
|
||||
.build()
|
||||
.unwrap(),
|
||||
MediaSegment::builder()
|
||||
.inf(ExtInf::new(Duration::from_secs(10)))
|
||||
.duration(ExtInf::new(Duration::from_secs(10)))
|
||||
.byte_range(8_021_772..8_353_216)
|
||||
.uri("hls_450k_video.ts")
|
||||
.build()
|
||||
.unwrap(),
|
||||
MediaSegment::builder()
|
||||
.inf(ExtInf::new(Duration::from_secs_f64(1.4167)))
|
||||
.duration(ExtInf::new(Duration::from_secs_f64(1.4167)))
|
||||
.byte_range(8_353_216..8_397_772)
|
||||
.uri("hls_450k_video.ts")
|
||||
.build()
|
||||
|
|
|
@ -25,17 +25,17 @@ generate_tests! {
|
|||
.target_duration(Duration::from_secs(10))
|
||||
.segments(vec![
|
||||
MediaSegment::builder()
|
||||
.inf(ExtInf::new(Duration::from_secs_f64(9.009)))
|
||||
.duration(ExtInf::new(Duration::from_secs_f64(9.009)))
|
||||
.uri("http://media.example.com/first.ts")
|
||||
.build()
|
||||
.unwrap(),
|
||||
MediaSegment::builder()
|
||||
.inf(ExtInf::new(Duration::from_secs_f64(9.009)))
|
||||
.duration(ExtInf::new(Duration::from_secs_f64(9.009)))
|
||||
.uri("http://media.example.com/second.ts")
|
||||
.build()
|
||||
.unwrap(),
|
||||
MediaSegment::builder()
|
||||
.inf(ExtInf::new(Duration::from_secs_f64(3.003)))
|
||||
.duration(ExtInf::new(Duration::from_secs_f64(3.003)))
|
||||
.uri("http://media.example.com/third.ts")
|
||||
.build()
|
||||
.unwrap(),
|
||||
|
@ -62,17 +62,17 @@ generate_tests! {
|
|||
.media_sequence(2680)
|
||||
.segments(vec![
|
||||
MediaSegment::builder()
|
||||
.inf(ExtInf::new(Duration::from_secs_f64(7.975)))
|
||||
.duration(ExtInf::new(Duration::from_secs_f64(7.975)))
|
||||
.uri("https://priv.example.com/fileSequence2680.ts")
|
||||
.build()
|
||||
.unwrap(),
|
||||
MediaSegment::builder()
|
||||
.inf(ExtInf::new(Duration::from_secs_f64(7.941)))
|
||||
.duration(ExtInf::new(Duration::from_secs_f64(7.941)))
|
||||
.uri("https://priv.example.com/fileSequence2681.ts")
|
||||
.build()
|
||||
.unwrap(),
|
||||
MediaSegment::builder()
|
||||
.inf(ExtInf::new(Duration::from_secs_f64(7.975)))
|
||||
.duration(ExtInf::new(Duration::from_secs_f64(7.975)))
|
||||
.uri("https://priv.example.com/fileSequence2682.ts")
|
||||
.build()
|
||||
.unwrap(),
|
||||
|
@ -98,7 +98,7 @@ generate_tests! {
|
|||
.media_sequence(7794)
|
||||
.segments(vec![
|
||||
MediaSegment::builder()
|
||||
.inf(ExtInf::new(Duration::from_secs_f64(2.833)))
|
||||
.duration(ExtInf::new(Duration::from_secs_f64(2.833)))
|
||||
.keys(vec![
|
||||
ExtXKey::new(DecryptionKey::new(
|
||||
EncryptionMethod::Aes128,
|
||||
|
@ -109,7 +109,7 @@ generate_tests! {
|
|||
.build()
|
||||
.unwrap(),
|
||||
MediaSegment::builder()
|
||||
.inf(ExtInf::new(Duration::from_secs_f64(15.0)))
|
||||
.duration(ExtInf::new(Duration::from_secs_f64(15.0)))
|
||||
.keys(vec![
|
||||
ExtXKey::new(DecryptionKey::new(
|
||||
EncryptionMethod::Aes128,
|
||||
|
@ -120,7 +120,7 @@ generate_tests! {
|
|||
.build()
|
||||
.unwrap(),
|
||||
MediaSegment::builder()
|
||||
.inf(ExtInf::new(Duration::from_secs_f64(13.333)))
|
||||
.duration(ExtInf::new(Duration::from_secs_f64(13.333)))
|
||||
.keys(vec![
|
||||
ExtXKey::new(DecryptionKey::new(
|
||||
EncryptionMethod::Aes128,
|
||||
|
@ -131,7 +131,7 @@ generate_tests! {
|
|||
.build()
|
||||
.unwrap(),
|
||||
MediaSegment::builder()
|
||||
.inf(ExtInf::new(Duration::from_secs_f64(15.0)))
|
||||
.duration(ExtInf::new(Duration::from_secs_f64(15.0)))
|
||||
.keys(vec![
|
||||
ExtXKey::new(DecryptionKey::new(
|
||||
EncryptionMethod::Aes128,
|
||||
|
|
Loading…
Reference in a new issue