mirror of
https://github.com/rutgersc/m3u8-rs.git
synced 2025-01-02 19:28:40 +00:00
Merge pull request #73 from rutgersc/fix/targetduration
#EXT-X-TARGETDURATION:<s> is supposed to be a decimal-integer
This commit is contained in:
commit
7f322675eb
5 changed files with 7 additions and 7 deletions
|
@ -1,6 +1,6 @@
|
|||
[package]
|
||||
name = "m3u8-rs"
|
||||
version = "5.0.5"
|
||||
version = "6.0.0"
|
||||
authors = ["Rutger"]
|
||||
readme = "README.md"
|
||||
repository = "https://github.com/rutgersc/m3u8-rs"
|
||||
|
|
|
@ -42,7 +42,7 @@
|
|||
//!
|
||||
//! let playlist = MediaPlaylist {
|
||||
//! version: Some(6),
|
||||
//! target_duration: 3.0,
|
||||
//! target_duration: 3,
|
||||
//! media_sequence: 338559,
|
||||
//! discontinuity_sequence: 1234,
|
||||
//! end_list: true,
|
||||
|
|
|
@ -344,7 +344,7 @@ fn parse_media_playlist_tags(i: &[u8]) -> IResult<&[u8], Vec<MediaPlaylistTag>>
|
|||
enum MediaPlaylistTag {
|
||||
Version(usize),
|
||||
Segment(SegmentTag),
|
||||
TargetDuration(f32),
|
||||
TargetDuration(u64),
|
||||
MediaSequence(u64),
|
||||
DiscontinuitySequence(u64),
|
||||
EndList,
|
||||
|
@ -361,7 +361,7 @@ fn media_playlist_tag(i: &[u8]) -> IResult<&[u8], MediaPlaylistTag> {
|
|||
alt((
|
||||
map(version_tag, MediaPlaylistTag::Version),
|
||||
map(
|
||||
pair(tag("#EXT-X-TARGETDURATION:"), float),
|
||||
pair(tag("#EXT-X-TARGETDURATION:"), number),
|
||||
|(_, duration)| MediaPlaylistTag::TargetDuration(duration),
|
||||
),
|
||||
map(
|
||||
|
|
|
@ -713,7 +713,7 @@ impl SessionData {
|
|||
pub struct MediaPlaylist {
|
||||
pub version: Option<usize>,
|
||||
/// `#EXT-X-TARGETDURATION:<s>`
|
||||
pub target_duration: f32,
|
||||
pub target_duration: u64,
|
||||
/// `#EXT-X-MEDIA-SEQUENCE:<number>`
|
||||
pub media_sequence: u64,
|
||||
pub segments: Vec<MediaSegment>,
|
||||
|
|
|
@ -304,7 +304,7 @@ fn create_and_parse_media_playlist_empty() {
|
|||
#[test]
|
||||
fn create_and_parse_media_playlist_single_segment() {
|
||||
let mut playlist_original = Playlist::MediaPlaylist(MediaPlaylist {
|
||||
target_duration: 2.0,
|
||||
target_duration: 2,
|
||||
segments: vec![MediaSegment {
|
||||
uri: "20140311T113819-01-338559live.ts".into(),
|
||||
duration: 2.002,
|
||||
|
@ -321,7 +321,7 @@ fn create_and_parse_media_playlist_single_segment() {
|
|||
fn create_and_parse_media_playlist_full() {
|
||||
let mut playlist_original = Playlist::MediaPlaylist(MediaPlaylist {
|
||||
version: Some(4),
|
||||
target_duration: 3.0,
|
||||
target_duration: 3,
|
||||
media_sequence: 338559,
|
||||
discontinuity_sequence: 1234,
|
||||
end_list: true,
|
||||
|
|
Loading…
Reference in a new issue