2014-03-24 18:54:45 +01:00
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
2014-03-22 21:50:28 +01:00
|
|
|
|
using System.Linq;
|
2014-03-26 16:06:48 +01:00
|
|
|
|
using System.Xml.Serialization;
|
2014-03-22 21:02:10 +01:00
|
|
|
|
|
2014-04-02 00:23:07 +02:00
|
|
|
|
namespace MediaBrowser.Model.Dlna
|
2014-03-22 21:02:10 +01:00
|
|
|
|
{
|
|
|
|
|
public class CodecProfile
|
|
|
|
|
{
|
2014-03-26 16:06:48 +01:00
|
|
|
|
[XmlAttribute("type")]
|
2014-03-22 21:02:10 +01:00
|
|
|
|
public CodecType Type { get; set; }
|
2014-03-26 16:06:48 +01:00
|
|
|
|
|
2014-03-23 17:42:02 +01:00
|
|
|
|
public ProfileCondition[] Conditions { get; set; }
|
2014-03-26 16:06:48 +01:00
|
|
|
|
|
|
|
|
|
[XmlAttribute("codec")]
|
2014-03-22 21:50:28 +01:00
|
|
|
|
public string Codec { get; set; }
|
2014-03-22 21:02:10 +01:00
|
|
|
|
|
|
|
|
|
public CodecProfile()
|
|
|
|
|
{
|
2014-03-23 17:42:02 +01:00
|
|
|
|
Conditions = new ProfileCondition[] {};
|
2014-03-22 21:50:28 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public List<string> GetCodecs()
|
|
|
|
|
{
|
2014-04-02 00:23:07 +02:00
|
|
|
|
return (Codec ?? string.Empty).Split(',').Where(i => !string.IsNullOrEmpty(i)).ToList();
|
2014-03-22 21:02:10 +01:00
|
|
|
|
}
|
2014-03-24 18:54:45 +01:00
|
|
|
|
|
|
|
|
|
public bool ContainsCodec(string codec)
|
|
|
|
|
{
|
|
|
|
|
var codecs = GetCodecs();
|
|
|
|
|
|
|
|
|
|
return codecs.Count == 0 || codecs.Contains(codec, StringComparer.OrdinalIgnoreCase);
|
|
|
|
|
}
|
2014-03-22 21:02:10 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public enum CodecType
|
|
|
|
|
{
|
2014-03-28 19:17:18 +01:00
|
|
|
|
Video = 0,
|
|
|
|
|
VideoAudio = 1,
|
|
|
|
|
Audio = 2
|
2014-03-22 21:02:10 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public class ProfileCondition
|
|
|
|
|
{
|
2014-03-26 16:06:48 +01:00
|
|
|
|
[XmlAttribute("condition")]
|
2014-03-22 21:02:10 +01:00
|
|
|
|
public ProfileConditionType Condition { get; set; }
|
2014-03-26 16:06:48 +01:00
|
|
|
|
|
|
|
|
|
[XmlAttribute("property")]
|
2014-03-22 21:02:10 +01:00
|
|
|
|
public ProfileConditionValue Property { get; set; }
|
2014-03-26 16:06:48 +01:00
|
|
|
|
|
|
|
|
|
[XmlAttribute("value")]
|
2014-03-22 21:02:10 +01:00
|
|
|
|
public string Value { get; set; }
|
2014-03-26 16:06:48 +01:00
|
|
|
|
|
|
|
|
|
[XmlAttribute("isRequired")]
|
2014-03-23 01:48:34 +01:00
|
|
|
|
public bool IsRequired { get; set; }
|
|
|
|
|
|
|
|
|
|
public ProfileCondition()
|
|
|
|
|
{
|
|
|
|
|
IsRequired = true;
|
|
|
|
|
}
|
2014-03-22 21:02:10 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public enum ProfileConditionType
|
|
|
|
|
{
|
|
|
|
|
Equals = 0,
|
|
|
|
|
NotEquals = 1,
|
|
|
|
|
LessThanEqual = 2,
|
|
|
|
|
GreaterThanEqual = 3
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public enum ProfileConditionValue
|
|
|
|
|
{
|
|
|
|
|
AudioChannels,
|
|
|
|
|
AudioBitrate,
|
2014-03-23 01:48:34 +01:00
|
|
|
|
AudioProfile,
|
2014-03-22 21:02:10 +01:00
|
|
|
|
Width,
|
|
|
|
|
Height,
|
2014-03-23 01:48:34 +01:00
|
|
|
|
Has64BitOffsets,
|
2014-04-24 07:08:10 +02:00
|
|
|
|
PacketLength,
|
2014-03-23 07:07:43 +01:00
|
|
|
|
VideoBitDepth,
|
2014-03-22 21:02:10 +01:00
|
|
|
|
VideoBitrate,
|
|
|
|
|
VideoFramerate,
|
2014-03-23 01:48:34 +01:00
|
|
|
|
VideoLevel,
|
2014-04-24 07:08:10 +02:00
|
|
|
|
VideoProfile,
|
|
|
|
|
VideoTimestamp
|
2014-03-22 21:02:10 +01:00
|
|
|
|
}
|
|
|
|
|
}
|