2014-03-24 13:54:45 -04:00
|
|
|
|
using System;
|
|
|
|
|
|
using System.Collections.Generic;
|
2014-03-22 16:50:28 -04:00
|
|
|
|
using System.Linq;
|
2014-03-26 11:06:48 -04:00
|
|
|
|
using System.Xml.Serialization;
|
2014-03-22 16:02:10 -04:00
|
|
|
|
|
2014-04-01 18:23:07 -04:00
|
|
|
|
namespace MediaBrowser.Model.Dlna
|
2014-03-22 16:02:10 -04:00
|
|
|
|
{
|
|
|
|
|
|
public class CodecProfile
|
|
|
|
|
|
{
|
2014-03-26 11:06:48 -04:00
|
|
|
|
[XmlAttribute("type")]
|
2014-03-22 16:02:10 -04:00
|
|
|
|
public CodecType Type { get; set; }
|
2014-03-26 11:06:48 -04:00
|
|
|
|
|
2014-03-23 12:42:02 -04:00
|
|
|
|
public ProfileCondition[] Conditions { get; set; }
|
2014-03-26 11:06:48 -04:00
|
|
|
|
|
|
|
|
|
|
[XmlAttribute("codec")]
|
2014-03-22 16:50:28 -04:00
|
|
|
|
public string Codec { get; set; }
|
2014-03-22 16:02:10 -04:00
|
|
|
|
|
|
|
|
|
|
public CodecProfile()
|
|
|
|
|
|
{
|
2014-03-23 12:42:02 -04:00
|
|
|
|
Conditions = new ProfileCondition[] {};
|
2014-03-22 16:50:28 -04:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public List<string> GetCodecs()
|
|
|
|
|
|
{
|
2014-05-08 17:23:24 -04: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 16:02:10 -04:00
|
|
|
|
}
|
2014-03-24 13:54:45 -04:00
|
|
|
|
|
|
|
|
|
|
public bool ContainsCodec(string codec)
|
|
|
|
|
|
{
|
2014-05-08 16:44:17 -04:00
|
|
|
|
List<string> codecs = GetCodecs();
|
2014-03-24 13:54:45 -04:00
|
|
|
|
|
|
|
|
|
|
return codecs.Count == 0 || codecs.Contains(codec, StringComparer.OrdinalIgnoreCase);
|
|
|
|
|
|
}
|
2014-03-22 16:02:10 -04:00
|
|
|
|
}
|
|
|
|
|
|
}
|