1
0
Fork 0
mirror of https://github.com/sile/hls_m3u8.git synced 2024-05-18 16:28:20 +00:00

minor protocol_version fixes

This commit is contained in:
Luro02 2019-09-17 15:40:10 +02:00
parent e55113e752
commit 612c3d15be
4 changed files with 12 additions and 2 deletions

View file

@ -158,7 +158,7 @@ impl MasterPlaylistBuilder {
.flatten(),
)
.max()
.unwrap_or(ProtocolVersion::V7)
.unwrap_or(ProtocolVersion::latest())
}
fn validate_stream_inf_tags(&self) -> crate::Result<()> {

View file

@ -200,7 +200,7 @@ impl MediaPlaylistBuilder {
.unwrap_or(ProtocolVersion::V1)
}))
.max()
.unwrap_or(ProtocolVersion::V1)
.unwrap_or(ProtocolVersion::latest())
}
/// Adds a media segment to the resulting playlist.

View file

@ -13,6 +13,7 @@ use crate::Error;
pub struct InitializationVector(pub [u8; 16]);
impl InitializationVector {
/// Converts the initialization vector to a slice.
pub const fn to_slice(&self) -> [u8; 16] {
self.0
}

View file

@ -17,6 +17,14 @@ pub enum ProtocolVersion {
V6,
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 {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
let n = {
@ -33,6 +41,7 @@ impl fmt::Display for ProtocolVersion {
write!(f, "{}", n)
}
}
impl FromStr for ProtocolVersion {
type Err = Error;