hlssink3: Update to m3u8-rs 5

This commit is contained in:
Sebastian Dröge 2022-08-09 15:19:38 +03:00 committed by Sebastian Dröge
parent d058c96596
commit cbb55c2322
3 changed files with 13 additions and 7 deletions

View file

@ -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]

View file

@ -46,11 +46,11 @@ impl From<HlsSink3PlaylistType> for Option<MediaPlaylistType> {
}
}
impl From<Option<MediaPlaylistType>> for HlsSink3PlaylistType {
fn from(inner_pl_type: Option<MediaPlaylistType>) -> Self {
impl From<Option<&MediaPlaylistType>> 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(),

View file

@ -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);