mirror of
https://github.com/sile/hls_m3u8.git
synced 2024-11-15 20:01:01 +00:00
minor protocol_version fixes
This commit is contained in:
parent
e55113e752
commit
612c3d15be
4 changed files with 12 additions and 2 deletions
|
@ -158,7 +158,7 @@ impl MasterPlaylistBuilder {
|
|||
.flatten(),
|
||||
)
|
||||
.max()
|
||||
.unwrap_or(ProtocolVersion::V7)
|
||||
.unwrap_or(ProtocolVersion::latest())
|
||||
}
|
||||
|
||||
fn validate_stream_inf_tags(&self) -> crate::Result<()> {
|
||||
|
|
|
@ -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.
|
||||
|
|
|
@ -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
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
Loading…
Reference in a new issue