jellyfin/MediaBrowser.Model/Dlna/CodecProfile.cs

40 lines
1004 B
C#
Raw Normal View History

2014-06-05 02:32:40 +00:00
using MediaBrowser.Model.Extensions;
2014-03-24 17:54:45 +00:00
using System.Collections.Generic;
2014-03-26 15:06:48 +00:00
using System.Xml.Serialization;
2014-03-22 20:02:10 +00:00
2014-04-01 22:23:07 +00:00
namespace MediaBrowser.Model.Dlna
2014-03-22 20:02:10 +00:00
{
public class CodecProfile
{
2014-03-26 15:06:48 +00:00
[XmlAttribute("type")]
2014-03-22 20:02:10 +00:00
public CodecType Type { get; set; }
2014-03-26 15:06:48 +00:00
2014-03-23 16:42:02 +00:00
public ProfileCondition[] Conditions { get; set; }
2014-03-26 15:06:48 +00:00
[XmlAttribute("codec")]
public string Codec { get; set; }
2014-03-22 20:02:10 +00:00
public CodecProfile()
{
2014-03-23 16:42:02 +00:00
Conditions = new ProfileCondition[] {};
}
public List<string> GetCodecs()
{
2014-05-08 21:23:24 +00:00
List<string> list = new List<string>();
foreach (string i in (Codec ?? string.Empty).Split(','))
{
if (!string.IsNullOrEmpty(i)) list.Add(i);
}
return list;
2014-03-22 20:02:10 +00:00
}
2014-03-24 17:54:45 +00:00
public bool ContainsCodec(string codec)
{
List<string> codecs = GetCodecs();
2014-03-24 17:54:45 +00:00
2014-06-05 02:32:40 +00:00
return codecs.Count == 0 || ListHelper.ContainsIgnoreCase(codecs, codec);
2014-03-24 17:54:45 +00:00
}
2014-03-22 20:02:10 +00:00
}
}