using System.Xml.Serialization;
using MediaBrowser.Model.Extensions;
namespace MediaBrowser.Model.Dlna;
///
/// Defines the .
///
public class DirectPlayProfile
{
///
/// Gets or sets the container.
///
[XmlAttribute("container")]
public string Container { get; set; } = string.Empty;
///
/// Gets or sets the audio codec.
///
[XmlAttribute("audioCodec")]
public string? AudioCodec { get; set; }
///
/// Gets or sets the video codec.
///
[XmlAttribute("videoCodec")]
public string? VideoCodec { get; set; }
///
/// Gets or sets the Dlna profile type.
///
[XmlAttribute("type")]
public DlnaProfileType Type { get; set; }
///
/// Returns whether the supports the .
///
/// The container to match against.
/// True if supported.
public bool SupportsContainer(string? container)
{
return ContainerHelper.ContainsContainer(Container, container);
}
///
/// Returns whether the supports the .
///
/// The codec to match against.
/// True if supported.
public bool SupportsVideoCodec(string? codec)
{
return Type == DlnaProfileType.Video && ContainerHelper.ContainsContainer(VideoCodec, codec);
}
///
/// Returns whether the supports the .
///
/// The codec to match against.
/// True if supported.
public bool SupportsAudioCodec(string? codec)
{
// Video profiles can have audio codec restrictions too, therefore incude Video as valid type.
return (Type == DlnaProfileType.Audio || Type == DlnaProfileType.Video) && ContainerHelper.ContainsContainer(AudioCodec, codec);
}
}