123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566 |
- using System.Xml.Serialization;
- using MediaBrowser.Model.Extensions;
- 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 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;
- }
- }
- }
|