mirror of
https://github.com/sile/hls_m3u8.git
synced 2024-06-10 01:09:27 +00:00
improvements to ClosedCaptions
This commit is contained in:
parent
30e8009af1
commit
070a62f9ad
|
@ -19,7 +19,7 @@ pub enum ClosedCaptions {
|
||||||
/// [`ExtXMedia::media_type`]: crate::tags::ExtXMedia::media_type
|
/// [`ExtXMedia::media_type`]: crate::tags::ExtXMedia::media_type
|
||||||
/// [`MediaType::ClosedCaptions`]: crate::types::MediaType::ClosedCaptions
|
/// [`MediaType::ClosedCaptions`]: crate::types::MediaType::ClosedCaptions
|
||||||
GroupId(String),
|
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
|
/// any [`VariantStream`] in the [`MasterPlaylist`], therefore all
|
||||||
/// [`VariantStream::ExtXStreamInf`] tags must have this attribute with a
|
/// [`VariantStream::ExtXStreamInf`] tags must have this attribute with a
|
||||||
/// value of [`ClosedCaptions::None`].
|
/// value of [`ClosedCaptions::None`].
|
||||||
|
@ -34,6 +34,34 @@ pub enum ClosedCaptions {
|
||||||
None,
|
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 {
|
impl fmt::Display for ClosedCaptions {
|
||||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||||
match &self {
|
match &self {
|
||||||
|
|
Loading…
Reference in a new issue