mirror of
https://github.com/sile/hls_m3u8.git
synced 2024-06-10 01:09:27 +00:00
minor protocol_version fixes
This commit is contained in:
parent
e55113e752
commit
612c3d15be
|
@ -158,7 +158,7 @@ impl MasterPlaylistBuilder {
|
||||||
.flatten(),
|
.flatten(),
|
||||||
)
|
)
|
||||||
.max()
|
.max()
|
||||||
.unwrap_or(ProtocolVersion::V7)
|
.unwrap_or(ProtocolVersion::latest())
|
||||||
}
|
}
|
||||||
|
|
||||||
fn validate_stream_inf_tags(&self) -> crate::Result<()> {
|
fn validate_stream_inf_tags(&self) -> crate::Result<()> {
|
||||||
|
|
|
@ -200,7 +200,7 @@ impl MediaPlaylistBuilder {
|
||||||
.unwrap_or(ProtocolVersion::V1)
|
.unwrap_or(ProtocolVersion::V1)
|
||||||
}))
|
}))
|
||||||
.max()
|
.max()
|
||||||
.unwrap_or(ProtocolVersion::V1)
|
.unwrap_or(ProtocolVersion::latest())
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Adds a media segment to the resulting playlist.
|
/// Adds a media segment to the resulting playlist.
|
||||||
|
|
|
@ -13,6 +13,7 @@ use crate::Error;
|
||||||
pub struct InitializationVector(pub [u8; 16]);
|
pub struct InitializationVector(pub [u8; 16]);
|
||||||
|
|
||||||
impl InitializationVector {
|
impl InitializationVector {
|
||||||
|
/// Converts the initialization vector to a slice.
|
||||||
pub const fn to_slice(&self) -> [u8; 16] {
|
pub const fn to_slice(&self) -> [u8; 16] {
|
||||||
self.0
|
self.0
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,6 +17,14 @@ pub enum ProtocolVersion {
|
||||||
V6,
|
V6,
|
||||||
V7,
|
V7,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl ProtocolVersion {
|
||||||
|
/// Returns the newest ProtocolVersion, that is supported by this library.
|
||||||
|
pub const fn latest() -> Self {
|
||||||
|
Self::V7
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
impl fmt::Display for ProtocolVersion {
|
impl fmt::Display for ProtocolVersion {
|
||||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||||
let n = {
|
let n = {
|
||||||
|
@ -33,6 +41,7 @@ impl fmt::Display for ProtocolVersion {
|
||||||
write!(f, "{}", n)
|
write!(f, "{}", n)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl FromStr for ProtocolVersion {
|
impl FromStr for ProtocolVersion {
|
||||||
type Err = Error;
|
type Err = Error;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue