jellyfin/MediaBrowser.Model/Dlna/CodecProfile.cs

36 lines
880 B
C#
Raw Normal View History

2014-03-24 10:54:45 -07:00
using System;
using System.Collections.Generic;
using System.Linq;
2014-03-26 08:06:48 -07:00
using System.Xml.Serialization;
2014-03-22 13:02:10 -07:00
2014-04-01 15:23:07 -07:00
namespace MediaBrowser.Model.Dlna
2014-03-22 13:02:10 -07:00
{
public class CodecProfile
{
2014-03-26 08:06:48 -07:00
[XmlAttribute("type")]
2014-03-22 13:02:10 -07:00
public CodecType Type { get; set; }
2014-03-26 08:06:48 -07:00
2014-03-23 09:42:02 -07:00
public ProfileCondition[] Conditions { get; set; }
2014-03-26 08:06:48 -07:00
[XmlAttribute("codec")]
public string Codec { get; set; }
2014-03-22 13:02:10 -07:00
public CodecProfile()
{
2014-03-23 09:42:02 -07:00
Conditions = new ProfileCondition[] {};
}
public List<string> GetCodecs()
{
2014-04-01 15:23:07 -07:00
return (Codec ?? string.Empty).Split(',').Where(i => !string.IsNullOrEmpty(i)).ToList();
2014-03-22 13:02:10 -07:00
}
2014-03-24 10:54:45 -07:00
public bool ContainsCodec(string codec)
{
List<string> codecs = GetCodecs();
2014-03-24 10:54:45 -07:00
return codecs.Count == 0 || codecs.Contains(codec, StringComparer.OrdinalIgnoreCase);
}
2014-03-22 13:02:10 -07:00
}
}