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