mirror of
https://github.com/sile/hls_m3u8.git
synced 2025-01-10 12:15:24 +00:00
improvements to ClosedCaptions
This commit is contained in:
parent
30e8009af1
commit
070a62f9ad
1 changed files with 29 additions and 1 deletions
|
@ -19,7 +19,7 @@ pub enum ClosedCaptions {
|
|||
/// [`ExtXMedia::media_type`]: crate::tags::ExtXMedia::media_type
|
||||
/// [`MediaType::ClosedCaptions`]: crate::types::MediaType::ClosedCaptions
|
||||
GroupId(String),
|
||||
/// [`ClosedCaptions::None`] indicates that there are no closed captions in
|
||||
/// This variant indicates that there are no closed captions in
|
||||
/// any [`VariantStream`] in the [`MasterPlaylist`], therefore all
|
||||
/// [`VariantStream::ExtXStreamInf`] tags must have this attribute with a
|
||||
/// value of [`ClosedCaptions::None`].
|
||||
|
@ -34,6 +34,34 @@ pub enum ClosedCaptions {
|
|||
None,
|
||||
}
|
||||
|
||||
impl ClosedCaptions {
|
||||
/// Creates a [`ClosedCaptions::GroupId`] with the provided [`String`].
|
||||
///
|
||||
/// # Example
|
||||
///
|
||||
/// ```
|
||||
/// use hls_m3u8::types::ClosedCaptions;
|
||||
///
|
||||
/// assert_eq!(
|
||||
/// ClosedCaptions::group_id("vg1"),
|
||||
/// ClosedCaptions::GroupId("vg1".into())
|
||||
/// );
|
||||
/// ```
|
||||
pub fn group_id<I: Into<String>>(value: I) -> Self {
|
||||
//
|
||||
Self::GroupId(value.into())
|
||||
}
|
||||
}
|
||||
|
||||
impl<T: PartialEq<str>> PartialEq<T> for ClosedCaptions {
|
||||
fn eq(&self, other: &T) -> bool {
|
||||
match &self {
|
||||
Self::GroupId(value) => other.eq(value),
|
||||
Self::None => other.eq("NONE"),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl fmt::Display for ClosedCaptions {
|
||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||
match &self {
|
||||
|
|
Loading…
Reference in a new issue