2020-02-04 00:49:27 +00:00
|
|
|
#pragma warning disable CS1591
|
|
|
|
#pragma warning disable SA1600
|
|
|
|
|
|
|
|
using System;
|
2019-01-13 20:02:23 +00:00
|
|
|
using System.Xml.Serialization;
|
2019-01-13 19:26:15 +00:00
|
|
|
using MediaBrowser.Model.Extensions;
|
2018-12-27 23:27:57 +00:00
|
|
|
|
|
|
|
namespace MediaBrowser.Model.Dlna
|
|
|
|
{
|
|
|
|
public class CodecProfile
|
|
|
|
{
|
|
|
|
[XmlAttribute("type")]
|
|
|
|
public CodecType Type { get; set; }
|
2019-01-07 23:27:46 +00:00
|
|
|
|
2018-12-27 23:27:57 +00:00
|
|
|
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()
|
|
|
|
{
|
2020-02-04 00:49:27 +00:00
|
|
|
Conditions = Array.Empty<ProfileCondition>();
|
|
|
|
ApplyConditions = Array.Empty<ProfileCondition>();
|
2018-12-27 23:27:57 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
public string[] GetCodecs()
|
|
|
|
{
|
|
|
|
return ContainerProfile.SplitValue(Codec);
|
|
|
|
}
|
|
|
|
|
|
|
|
private bool ContainsContainer(string container)
|
|
|
|
{
|
|
|
|
return ContainerProfile.ContainsContainer(Container, container);
|
|
|
|
}
|
|
|
|
|
|
|
|
public bool ContainsAnyCodec(string codec, string container)
|
|
|
|
{
|
|
|
|
return ContainsAnyCodec(ContainerProfile.SplitValue(codec), container);
|
|
|
|
}
|
|
|
|
|
|
|
|
public bool ContainsAnyCodec(string[] codec, string container)
|
|
|
|
{
|
|
|
|
if (!ContainsContainer(container))
|
|
|
|
{
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
var codecs = GetCodecs();
|
|
|
|
if (codecs.Length == 0)
|
|
|
|
{
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
foreach (var val in codec)
|
|
|
|
{
|
|
|
|
if (ListHelper.ContainsIgnoreCase(codecs, val))
|
|
|
|
{
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|