mirror of
https://github.com/jellyfin/jellyfin.git
synced 2024-11-19 20:09:03 -07:00
52 lines
1.3 KiB
C#
52 lines
1.3 KiB
C#
using MediaBrowser.Model.Extensions;
|
|
using System.Collections.Generic;
|
|
using System.Xml.Serialization;
|
|
using MediaBrowser.Model.Dlna;
|
|
|
|
namespace MediaBrowser.Model.Dlna
|
|
{
|
|
public class CodecProfile
|
|
{
|
|
[XmlAttribute("type")]
|
|
public CodecType Type { get; set; }
|
|
|
|
public ProfileCondition[] Conditions { get; set; }
|
|
|
|
public ProfileCondition[] ApplyConditions { get; set; }
|
|
|
|
[XmlAttribute("codec")]
|
|
public string Codec { get; set; }
|
|
|
|
[XmlAttribute("container")]
|
|
public string Container { get; set; }
|
|
|
|
public CodecProfile()
|
|
{
|
|
Conditions = new ProfileCondition[] {};
|
|
ApplyConditions = new ProfileCondition[] { };
|
|
}
|
|
|
|
public string[] GetCodecs()
|
|
{
|
|
return ContainerProfile.SplitValue(Codec);
|
|
}
|
|
|
|
private bool ContainsContainer(string container)
|
|
{
|
|
return ContainerProfile.ContainsContainer(Container, container);
|
|
}
|
|
|
|
public bool ContainsCodec(string codec, string container)
|
|
{
|
|
if (!ContainsContainer(container))
|
|
{
|
|
return false;
|
|
}
|
|
|
|
var codecs = GetCodecs();
|
|
|
|
return codecs.Length == 0 || ListHelper.ContainsIgnoreCase(codecs, ContainerProfile.SplitValue(codec)[0]);
|
|
}
|
|
}
|
|
}
|