2014-03-24 17:54:45 +00:00
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
2014-03-22 20:50:28 +00:00
|
|
|
|
using System.Linq;
|
2014-03-22 20:02:10 +00:00
|
|
|
|
|
|
|
|
|
namespace MediaBrowser.Controller.Dlna
|
|
|
|
|
{
|
|
|
|
|
public class CodecProfile
|
|
|
|
|
{
|
|
|
|
|
public CodecType Type { get; set; }
|
2014-03-23 16:42:02 +00:00
|
|
|
|
public ProfileCondition[] Conditions { get; set; }
|
2014-03-22 20:50:28 +00:00
|
|
|
|
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[] {};
|
2014-03-22 20:50:28 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public List<string> GetCodecs()
|
|
|
|
|
{
|
|
|
|
|
return (Codec ?? string.Empty).Split(',').Where(i => !string.IsNullOrWhiteSpace(i)).ToList();
|
2014-03-22 20:02:10 +00:00
|
|
|
|
}
|
2014-03-24 17:54:45 +00:00
|
|
|
|
|
|
|
|
|
public bool ContainsCodec(string codec)
|
|
|
|
|
{
|
|
|
|
|
var codecs = GetCodecs();
|
|
|
|
|
|
|
|
|
|
return codecs.Count == 0 || codecs.Contains(codec, StringComparer.OrdinalIgnoreCase);
|
|
|
|
|
}
|
2014-03-22 20:02:10 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public enum CodecType
|
|
|
|
|
{
|
|
|
|
|
VideoCodec = 0,
|
|
|
|
|
VideoAudioCodec = 1,
|
|
|
|
|
AudioCodec = 2
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public class ProfileCondition
|
|
|
|
|
{
|
|
|
|
|
public ProfileConditionType Condition { get; set; }
|
|
|
|
|
public ProfileConditionValue Property { get; set; }
|
|
|
|
|
public string Value { get; set; }
|
2014-03-23 00:48:34 +00:00
|
|
|
|
public bool IsRequired { get; set; }
|
|
|
|
|
|
|
|
|
|
public ProfileCondition()
|
|
|
|
|
{
|
|
|
|
|
IsRequired = true;
|
|
|
|
|
}
|
2014-03-22 20:02:10 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public enum ProfileConditionType
|
|
|
|
|
{
|
|
|
|
|
Equals = 0,
|
|
|
|
|
NotEquals = 1,
|
|
|
|
|
LessThanEqual = 2,
|
|
|
|
|
GreaterThanEqual = 3
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public enum ProfileConditionValue
|
|
|
|
|
{
|
|
|
|
|
AudioChannels,
|
|
|
|
|
AudioBitrate,
|
2014-03-23 00:48:34 +00:00
|
|
|
|
AudioProfile,
|
2014-03-22 20:02:10 +00:00
|
|
|
|
Filesize,
|
|
|
|
|
Width,
|
|
|
|
|
Height,
|
2014-03-23 00:48:34 +00:00
|
|
|
|
Has64BitOffsets,
|
2014-03-23 06:07:43 +00:00
|
|
|
|
VideoBitDepth,
|
2014-03-22 20:02:10 +00:00
|
|
|
|
VideoBitrate,
|
|
|
|
|
VideoFramerate,
|
2014-03-23 00:48:34 +00:00
|
|
|
|
VideoLevel,
|
2014-03-23 19:36:25 +00:00
|
|
|
|
VideoPacketLength,
|
|
|
|
|
VideoProfile,
|
|
|
|
|
VideoTimestamp
|
2014-03-22 20:02:10 +00:00
|
|
|
|
}
|
|
|
|
|
}
|