update dlna profiles

This commit is contained in:
Luke Pulverenti
2016-12-09 02:23:09 -05:00
parent 56fb08eeed
commit c7d520555b
83 changed files with 2738 additions and 875 deletions

View File

@@ -1,19 +1,23 @@
using MediaBrowser.Model.Extensions;
using System.Collections.Generic;
using System.Xml.Serialization;
using MediaBrowser.Model.Dlna;
namespace MediaBrowser.Model.Dlna
{
public class CodecProfile
{
[XmlAttribute("type")]
public CodecType Type { get; set; }
public ProfileCondition[] Conditions { get; set; }
public ProfileCondition[] ApplyConditions { get; set; }
[XmlAttribute("codec")]
public string Codec { get; set; }
[XmlAttribute("container")]
public string Container { get; set; }
public CodecProfile()

View File

@@ -1,13 +1,16 @@
using System.Collections.Generic;
using System.Xml.Serialization;
using MediaBrowser.Model.Dlna;
namespace MediaBrowser.Model.Dlna
{
public class ContainerProfile
{
[XmlAttribute("type")]
public DlnaProfileType Type { get; set; }
public ProfileCondition[] Conditions { get; set; }
[XmlAttribute("container")]
public string Container { get; set; }
public ContainerProfile()

View File

@@ -1,10 +1,11 @@
using MediaBrowser.Model.Extensions;
using MediaBrowser.Model.MediaInfo;
using System.Collections.Generic;
using MediaBrowser.Model.Serialization;
using System.Xml.Serialization;
namespace MediaBrowser.Model.Dlna
{
[XmlRoot("Profile")]
public class DeviceProfile
{
/// <summary>
@@ -13,16 +14,17 @@ namespace MediaBrowser.Model.Dlna
/// <value>The name.</value>
public string Name { get; set; }
[XmlIgnore]
public string Id { get; set; }
[IgnoreDataMember]
public DeviceProfileType ProfileType { get; set; }
[XmlIgnore]
public MediaBrowser.Model.Dlna.DeviceProfileType ProfileType { get; set; }
/// <summary>
/// Gets or sets the identification.
/// </summary>
/// <value>The identification.</value>
public DeviceIdentification Identification { get; set; }
public MediaBrowser.Model.Dlna.DeviceIdentification Identification { get; set; }
public string FriendlyName { get; set; }
public string Manufacturer { get; set; }
@@ -34,8 +36,8 @@ namespace MediaBrowser.Model.Dlna
public string SerialNumber { get; set; }
public bool EnableAlbumArtInDidl { get; set; }
public bool EnableSingleAlbumArtLimit { get; set; }
public bool EnableSingleSubtitleLimit { get; set; }
public bool EnableSingleAlbumArtLimit { get; set; }
public bool EnableSingleSubtitleLimit { get; set; }
public string SupportedMediaTypes { get; set; }
@@ -97,7 +99,7 @@ namespace MediaBrowser.Model.Dlna
public ResponseProfile[] ResponseProfiles { get; set; }
public SubtitleProfile[] SubtitleProfiles { get; set; }
public DeviceProfile()
{
DirectPlayProfiles = new DirectPlayProfile[] { };
@@ -106,9 +108,9 @@ namespace MediaBrowser.Model.Dlna
CodecProfiles = new CodecProfile[] { };
ContainerProfiles = new ContainerProfile[] { };
SubtitleProfiles = new SubtitleProfile[] { };
XmlRootAttributes = new XmlAttribute[] { };
SupportedMediaTypes = "Audio,Photo,Video";
MaxStreamingBitrate = 8000000;
MaxStaticBitrate = 8000000;
@@ -120,7 +122,7 @@ namespace MediaBrowser.Model.Dlna
List<string> list = new List<string>();
foreach (string i in (SupportedMediaTypes ?? string.Empty).Split(','))
{
if (!string.IsNullOrEmpty(i))
if (!string.IsNullOrEmpty(i))
list.Add(i);
}
return list;
@@ -132,7 +134,7 @@ namespace MediaBrowser.Model.Dlna
foreach (var i in TranscodingProfiles)
{
if (i.Type != DlnaProfileType.Audio)
if (i.Type != MediaBrowser.Model.Dlna.DlnaProfileType.Audio)
{
continue;
}
@@ -158,7 +160,7 @@ namespace MediaBrowser.Model.Dlna
foreach (var i in TranscodingProfiles)
{
if (i.Type != DlnaProfileType.Video)
if (i.Type != MediaBrowser.Model.Dlna.DlnaProfileType.Video)
{
continue;
}
@@ -189,7 +191,7 @@ namespace MediaBrowser.Model.Dlna
foreach (var i in ResponseProfiles)
{
if (i.Type != DlnaProfileType.Audio)
if (i.Type != MediaBrowser.Model.Dlna.DlnaProfileType.Audio)
{
continue;
}
@@ -206,12 +208,12 @@ namespace MediaBrowser.Model.Dlna
continue;
}
ConditionProcessor conditionProcessor = new ConditionProcessor();
var conditionProcessor = new MediaBrowser.Model.Dlna.ConditionProcessor();
var anyOff = false;
foreach (ProfileCondition c in i.Conditions)
{
if (!conditionProcessor.IsAudioConditionSatisfied(c, audioChannels, audioBitrate))
if (!conditionProcessor.IsAudioConditionSatisfied(GetModelProfileCondition(c), audioChannels, audioBitrate))
{
anyOff = true;
break;
@@ -228,13 +230,24 @@ namespace MediaBrowser.Model.Dlna
return null;
}
private MediaBrowser.Model.Dlna.ProfileCondition GetModelProfileCondition(ProfileCondition c)
{
return new MediaBrowser.Model.Dlna.ProfileCondition
{
Condition = c.Condition,
IsRequired = c.IsRequired,
Property = c.Property,
Value = c.Value
};
}
public ResponseProfile GetImageMediaProfile(string container, int? width, int? height)
{
container = StringHelper.TrimStart(container ?? string.Empty, '.');
foreach (var i in ResponseProfiles)
{
if (i.Type != DlnaProfileType.Photo)
if (i.Type != MediaBrowser.Model.Dlna.DlnaProfileType.Photo)
{
continue;
}
@@ -245,12 +258,12 @@ namespace MediaBrowser.Model.Dlna
continue;
}
ConditionProcessor conditionProcessor = new ConditionProcessor();
var conditionProcessor = new MediaBrowser.Model.Dlna.ConditionProcessor();
var anyOff = false;
foreach (ProfileCondition c in i.Conditions)
{
if (!conditionProcessor.IsImageConditionSatisfied(c, width, height))
if (!conditionProcessor.IsImageConditionSatisfied(GetModelProfileCondition(c), width, height))
{
anyOff = true;
break;
@@ -267,7 +280,7 @@ namespace MediaBrowser.Model.Dlna
return null;
}
public ResponseProfile GetVideoMediaProfile(string container,
public ResponseProfile GetVideoMediaProfile(string container,
string audioCodec,
string videoCodec,
int? width,
@@ -290,7 +303,7 @@ namespace MediaBrowser.Model.Dlna
foreach (var i in ResponseProfiles)
{
if (i.Type != DlnaProfileType.Video)
if (i.Type != MediaBrowser.Model.Dlna.DlnaProfileType.Video)
{
continue;
}
@@ -313,12 +326,12 @@ namespace MediaBrowser.Model.Dlna
continue;
}
ConditionProcessor conditionProcessor = new ConditionProcessor();
var conditionProcessor = new MediaBrowser.Model.Dlna.ConditionProcessor();
var anyOff = false;
foreach (ProfileCondition c in i.Conditions)
{
if (!conditionProcessor.IsVideoConditionSatisfied(c, width, height, bitDepth, videoBitrate, videoProfile, videoLevel, videoFramerate, packetLength, timestamp, isAnamorphic, refFrames, numVideoStreams, numAudioStreams, videoCodecTag, isAvc))
if (!conditionProcessor.IsVideoConditionSatisfied(GetModelProfileCondition(c), width, height, bitDepth, videoBitrate, videoProfile, videoLevel, videoFramerate, packetLength, timestamp, isAnamorphic, refFrames, numVideoStreams, numAudioStreams, videoCodecTag, isAvc))
{
anyOff = true;
break;

View File

@@ -1,15 +1,21 @@
using System.Collections.Generic;
using System.Xml.Serialization;
using MediaBrowser.Model.Dlna;
namespace MediaBrowser.Model.Dlna
{
public class DirectPlayProfile
{
[XmlAttribute("container")]
public string Container { get; set; }
[XmlAttribute("audioCodec")]
public string AudioCodec { get; set; }
[XmlAttribute("videoCodec")]
public string VideoCodec { get; set; }
[XmlAttribute("type")]
public DlnaProfileType Type { get; set; }
public List<string> GetContainers()

View File

@@ -1,13 +1,17 @@
using System.Xml.Serialization;
using MediaBrowser.Model.Dlna;
namespace MediaBrowser.Model.Dlna
{
public class HttpHeaderInfo
{
[XmlAttribute("name")]
public string Name { get; set; }
[XmlAttribute("value")]
public string Value { get; set; }
[XmlAttribute("match")]
public HeaderMatchType Match { get; set; }
}
}

View File

@@ -1,15 +1,20 @@
using System.Xml.Serialization;
using MediaBrowser.Model.Dlna;
namespace MediaBrowser.Model.Dlna
{
public class ProfileCondition
{
[XmlAttribute("condition")]
public ProfileConditionType Condition { get; set; }
[XmlAttribute("property")]
public ProfileConditionValue Property { get; set; }
[XmlAttribute("value")]
public string Value { get; set; }
[XmlAttribute("isRequired")]
public bool IsRequired { get; set; }
public ProfileCondition()

View File

@@ -1,20 +1,27 @@
using System.Collections.Generic;
using System.Xml.Serialization;
using MediaBrowser.Model.Dlna;
namespace MediaBrowser.Model.Dlna
{
public class ResponseProfile
{
[XmlAttribute("container")]
public string Container { get; set; }
[XmlAttribute("audioCodec")]
public string AudioCodec { get; set; }
[XmlAttribute("videoCodec")]
public string VideoCodec { get; set; }
[XmlAttribute("type")]
public DlnaProfileType Type { get; set; }
[XmlAttribute("orgPn")]
public string OrgPn { get; set; }
[XmlAttribute("mimeType")]
public string MimeType { get; set; }
public ProfileCondition[] Conditions { get; set; }

View File

@@ -1,17 +1,22 @@
using MediaBrowser.Model.Extensions;
using System.Collections.Generic;
using System.Xml.Serialization;
using MediaBrowser.Model.Dlna;
namespace MediaBrowser.Model.Dlna
{
public class SubtitleProfile
{
[XmlAttribute("format")]
public string Format { get; set; }
[XmlAttribute("method")]
public SubtitleDeliveryMethod Method { get; set; }
[XmlAttribute("didlMode")]
public string DidlMode { get; set; }
[XmlAttribute("language")]
public string Language { get; set; }
public List<string> GetLanguages()

View File

@@ -1,34 +1,48 @@
using System.Collections.Generic;
using System.Xml.Serialization;
using MediaBrowser.Model.Dlna;
namespace MediaBrowser.Model.Dlna
{
public class TranscodingProfile
{
[XmlAttribute("container")]
public string Container { get; set; }
[XmlAttribute("type")]
public DlnaProfileType Type { get; set; }
[XmlAttribute("videoCodec")]
public string VideoCodec { get; set; }
[XmlAttribute("audioCodec")]
public string AudioCodec { get; set; }
[XmlAttribute("protocol")]
public string Protocol { get; set; }
[XmlAttribute("estimateContentLength")]
public bool EstimateContentLength { get; set; }
[XmlAttribute("enableMpegtsM2TsMode")]
public bool EnableMpegtsM2TsMode { get; set; }
[XmlAttribute("transcodeSeekInfo")]
public TranscodeSeekInfo TranscodeSeekInfo { get; set; }
[XmlAttribute("copyTimestamps")]
public bool CopyTimestamps { get; set; }
[XmlAttribute("context")]
public EncodingContext Context { get; set; }
[XmlAttribute("enableSubtitlesInManifest")]
public bool EnableSubtitlesInManifest { get; set; }
[XmlAttribute("enableSplittingOnNonKeyFrames")]
public bool EnableSplittingOnNonKeyFrames { get; set; }
[XmlAttribute("maxAudioChannels")]
public string MaxAudioChannels { get; set; }
public List<string> GetAudioCodecs()

View File

@@ -4,8 +4,10 @@ namespace MediaBrowser.Model.Dlna
{
public class XmlAttribute
{
[XmlAttribute("name")]
public string Name { get; set; }
[XmlAttribute("value")]
public string Value { get; set; }
}
}

View File

@@ -48,12 +48,6 @@ namespace MediaBrowser.Model.System
/// <value><c>true</c> if [supports library monitor]; otherwise, <c>false</c>.</value>
public bool SupportsLibraryMonitor { get; set; }
/// <summary>
/// Gets or sets a value indicating whether this instance is network deployed.
/// </summary>
/// <value><c>true</c> if this instance is network deployed; otherwise, <c>false</c>.</value>
public bool IsNetworkDeployed { get; set; }
/// <summary>
/// Gets or sets the in progress installations.
/// </summary>