diff --git a/net/hlssink3/Cargo.toml b/net/hlssink3/Cargo.toml index a4ab636b..e150cb1b 100644 --- a/net/hlssink3/Cargo.toml +++ b/net/hlssink3/Cargo.toml @@ -14,7 +14,7 @@ gst-base = { package = "gstreamer-base", git = "https://gitlab.freedesktop.org/g glib = { git = "https://github.com/gtk-rs/gtk-rs-core" } gio = { git = "https://github.com/gtk-rs/gtk-rs-core" } once_cell = "1.7.2" -m3u8-rs = "4.0" +m3u8-rs = "5.0" regex = "1" [dev-dependencies] diff --git a/net/hlssink3/src/imp.rs b/net/hlssink3/src/imp.rs index 96f4076a..2adf4a34 100644 --- a/net/hlssink3/src/imp.rs +++ b/net/hlssink3/src/imp.rs @@ -46,11 +46,11 @@ impl From for Option { } } -impl From> for HlsSink3PlaylistType { - fn from(inner_pl_type: Option) -> Self { +impl From> for HlsSink3PlaylistType { + fn from(inner_pl_type: Option<&MediaPlaylistType>) -> Self { use HlsSink3PlaylistType::*; match inner_pl_type { - None => Unspecified, + None | Some(MediaPlaylistType::Other(_)) => Unspecified, Some(MediaPlaylistType::Event) => Event, Some(MediaPlaylistType::Vod) => Vod, } @@ -124,6 +124,7 @@ impl StartedState { } } +#[allow(clippy::large_enum_variant)] enum State { Stopped, Started(StartedState), @@ -147,7 +148,10 @@ impl HlsSink3 { let (target_duration, playlist_type) = { let settings = self.settings.lock().unwrap(); - (settings.target_duration as f32, settings.playlist_type) + ( + settings.target_duration as f32, + settings.playlist_type.clone(), + ) }; let mut state = self.state.lock().unwrap(); @@ -568,7 +572,7 @@ impl ObjectImpl for HlsSink3 { "target-duration" => settings.target_duration.to_value(), "playlist-length" => settings.playlist_length.to_value(), "playlist-type" => { - let playlist_type: HlsSink3PlaylistType = settings.playlist_type.into(); + let playlist_type: HlsSink3PlaylistType = settings.playlist_type.as_ref().into(); playlist_type.to_value() } "send-keyframe-requests" => settings.send_keyframe_requests.to_value(), diff --git a/net/hlssink3/src/playlist.rs b/net/hlssink3/src/playlist.rs index f3b73c0e..671a1ca6 100644 --- a/net/hlssink3/src/playlist.rs +++ b/net/hlssink3/src/playlist.rs @@ -39,7 +39,7 @@ impl Playlist { }; Self { inner: MediaPlaylist { - version: GST_M3U8_PLAYLIST_VERSION, + version: Some(GST_M3U8_PLAYLIST_VERSION), target_duration, media_sequence: 0, segments: vec![], @@ -49,6 +49,7 @@ impl Playlist { i_frames_only: false, start: None, independent_segments: false, + unknown_tags: vec![], }, playlist_index: 0, status: PlaylistRenderState::Init, @@ -106,6 +107,7 @@ impl Playlist { match &self.inner.playlist_type { None => self.inner.end_list = false, Some(defined) => match defined { + MediaPlaylistType::Other(_) => unreachable!(), MediaPlaylistType::Event => { if self.turn_vod { self.inner.playlist_type = Some(MediaPlaylistType::Vod);