mirror of
https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs.git
synced 2024-12-23 18:40:32 +00:00
hlssink3: Update to m3u8-rs 5
This commit is contained in:
parent
d058c96596
commit
cbb55c2322
3 changed files with 13 additions and 7 deletions
|
@ -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" }
|
glib = { git = "https://github.com/gtk-rs/gtk-rs-core" }
|
||||||
gio = { git = "https://github.com/gtk-rs/gtk-rs-core" }
|
gio = { git = "https://github.com/gtk-rs/gtk-rs-core" }
|
||||||
once_cell = "1.7.2"
|
once_cell = "1.7.2"
|
||||||
m3u8-rs = "4.0"
|
m3u8-rs = "5.0"
|
||||||
regex = "1"
|
regex = "1"
|
||||||
|
|
||||||
[dev-dependencies]
|
[dev-dependencies]
|
||||||
|
|
|
@ -46,11 +46,11 @@ impl From<HlsSink3PlaylistType> for Option<MediaPlaylistType> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl From<Option<MediaPlaylistType>> for HlsSink3PlaylistType {
|
impl From<Option<&MediaPlaylistType>> for HlsSink3PlaylistType {
|
||||||
fn from(inner_pl_type: Option<MediaPlaylistType>) -> Self {
|
fn from(inner_pl_type: Option<&MediaPlaylistType>) -> Self {
|
||||||
use HlsSink3PlaylistType::*;
|
use HlsSink3PlaylistType::*;
|
||||||
match inner_pl_type {
|
match inner_pl_type {
|
||||||
None => Unspecified,
|
None | Some(MediaPlaylistType::Other(_)) => Unspecified,
|
||||||
Some(MediaPlaylistType::Event) => Event,
|
Some(MediaPlaylistType::Event) => Event,
|
||||||
Some(MediaPlaylistType::Vod) => Vod,
|
Some(MediaPlaylistType::Vod) => Vod,
|
||||||
}
|
}
|
||||||
|
@ -124,6 +124,7 @@ impl StartedState {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[allow(clippy::large_enum_variant)]
|
||||||
enum State {
|
enum State {
|
||||||
Stopped,
|
Stopped,
|
||||||
Started(StartedState),
|
Started(StartedState),
|
||||||
|
@ -147,7 +148,10 @@ impl HlsSink3 {
|
||||||
|
|
||||||
let (target_duration, playlist_type) = {
|
let (target_duration, playlist_type) = {
|
||||||
let settings = self.settings.lock().unwrap();
|
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();
|
let mut state = self.state.lock().unwrap();
|
||||||
|
@ -568,7 +572,7 @@ impl ObjectImpl for HlsSink3 {
|
||||||
"target-duration" => settings.target_duration.to_value(),
|
"target-duration" => settings.target_duration.to_value(),
|
||||||
"playlist-length" => settings.playlist_length.to_value(),
|
"playlist-length" => settings.playlist_length.to_value(),
|
||||||
"playlist-type" => {
|
"playlist-type" => {
|
||||||
let playlist_type: HlsSink3PlaylistType = settings.playlist_type.into();
|
let playlist_type: HlsSink3PlaylistType = settings.playlist_type.as_ref().into();
|
||||||
playlist_type.to_value()
|
playlist_type.to_value()
|
||||||
}
|
}
|
||||||
"send-keyframe-requests" => settings.send_keyframe_requests.to_value(),
|
"send-keyframe-requests" => settings.send_keyframe_requests.to_value(),
|
||||||
|
|
|
@ -39,7 +39,7 @@ impl Playlist {
|
||||||
};
|
};
|
||||||
Self {
|
Self {
|
||||||
inner: MediaPlaylist {
|
inner: MediaPlaylist {
|
||||||
version: GST_M3U8_PLAYLIST_VERSION,
|
version: Some(GST_M3U8_PLAYLIST_VERSION),
|
||||||
target_duration,
|
target_duration,
|
||||||
media_sequence: 0,
|
media_sequence: 0,
|
||||||
segments: vec![],
|
segments: vec![],
|
||||||
|
@ -49,6 +49,7 @@ impl Playlist {
|
||||||
i_frames_only: false,
|
i_frames_only: false,
|
||||||
start: None,
|
start: None,
|
||||||
independent_segments: false,
|
independent_segments: false,
|
||||||
|
unknown_tags: vec![],
|
||||||
},
|
},
|
||||||
playlist_index: 0,
|
playlist_index: 0,
|
||||||
status: PlaylistRenderState::Init,
|
status: PlaylistRenderState::Init,
|
||||||
|
@ -106,6 +107,7 @@ impl Playlist {
|
||||||
match &self.inner.playlist_type {
|
match &self.inner.playlist_type {
|
||||||
None => self.inner.end_list = false,
|
None => self.inner.end_list = false,
|
||||||
Some(defined) => match defined {
|
Some(defined) => match defined {
|
||||||
|
MediaPlaylistType::Other(_) => unreachable!(),
|
||||||
MediaPlaylistType::Event => {
|
MediaPlaylistType::Event => {
|
||||||
if self.turn_vod {
|
if self.turn_vod {
|
||||||
self.inner.playlist_type = Some(MediaPlaylistType::Vod);
|
self.inner.playlist_type = Some(MediaPlaylistType::Vod);
|
||||||
|
|
Loading…
Reference in a new issue