2017-07-14 08:57:44 -07:00
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.Linq;
|
2016-12-09 00:23:09 -07:00
|
|
|
|
using System.Xml.Serialization;
|
2014-03-14 21:14:07 -07:00
|
|
|
|
|
2014-04-01 15:23:07 -07:00
|
|
|
|
namespace MediaBrowser.Model.Dlna
|
2014-03-13 12:08:02 -07:00
|
|
|
|
{
|
|
|
|
|
public class DirectPlayProfile
|
|
|
|
|
{
|
2016-12-09 00:23:09 -07:00
|
|
|
|
[XmlAttribute("container")]
|
2014-03-22 23:07:43 -07:00
|
|
|
|
public string Container { get; set; }
|
2014-03-26 08:06:48 -07:00
|
|
|
|
|
2016-12-09 00:23:09 -07:00
|
|
|
|
[XmlAttribute("audioCodec")]
|
2014-03-22 13:50:28 -07:00
|
|
|
|
public string AudioCodec { get; set; }
|
2014-03-26 08:06:48 -07:00
|
|
|
|
|
2016-12-09 00:23:09 -07:00
|
|
|
|
[XmlAttribute("videoCodec")]
|
2014-03-22 13:50:28 -07:00
|
|
|
|
public string VideoCodec { get; set; }
|
2014-03-14 21:14:07 -07:00
|
|
|
|
|
2016-12-09 00:23:09 -07:00
|
|
|
|
[XmlAttribute("type")]
|
2014-03-13 12:08:02 -07:00
|
|
|
|
public DlnaProfileType Type { get; set; }
|
|
|
|
|
|
2014-03-22 23:07:43 -07:00
|
|
|
|
public List<string> GetContainers()
|
|
|
|
|
{
|
2014-05-08 14:23:24 -07:00
|
|
|
|
List<string> list = new List<string>();
|
|
|
|
|
foreach (string i in (Container ?? string.Empty).Split(','))
|
|
|
|
|
{
|
|
|
|
|
if (!string.IsNullOrEmpty(i)) list.Add(i);
|
|
|
|
|
}
|
|
|
|
|
return list;
|
2014-03-13 12:08:02 -07:00
|
|
|
|
}
|
2014-03-22 13:50:28 -07:00
|
|
|
|
|
2017-07-14 08:57:44 -07:00
|
|
|
|
public bool SupportsContainer(string container)
|
|
|
|
|
{
|
|
|
|
|
var all = GetContainers();
|
|
|
|
|
|
|
|
|
|
// Only allow unknown container if the profile is all inclusive
|
|
|
|
|
if (string.IsNullOrWhiteSpace(container))
|
|
|
|
|
{
|
|
|
|
|
return all.Count == 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return all.Count == 0 || all.Contains(container, StringComparer.OrdinalIgnoreCase);
|
|
|
|
|
}
|
|
|
|
|
|
2014-03-22 13:50:28 -07:00
|
|
|
|
public List<string> GetAudioCodecs()
|
|
|
|
|
{
|
2014-05-08 14:23:24 -07:00
|
|
|
|
List<string> list = new List<string>();
|
|
|
|
|
foreach (string i in (AudioCodec ?? string.Empty).Split(','))
|
|
|
|
|
{
|
|
|
|
|
if (!string.IsNullOrEmpty(i)) list.Add(i);
|
|
|
|
|
}
|
|
|
|
|
return list;
|
2014-03-22 13:50:28 -07:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public List<string> GetVideoCodecs()
|
|
|
|
|
{
|
2014-05-08 14:23:24 -07:00
|
|
|
|
List<string> list = new List<string>();
|
|
|
|
|
foreach (string i in (VideoCodec ?? string.Empty).Split(','))
|
|
|
|
|
{
|
|
|
|
|
if (!string.IsNullOrEmpty(i)) list.Add(i);
|
|
|
|
|
}
|
|
|
|
|
return list;
|
2014-03-22 13:50:28 -07:00
|
|
|
|
}
|
2014-03-13 12:08:02 -07:00
|
|
|
|
}
|
|
|
|
|
}
|