diff options
| author | Luke <luke.pulverenti@gmail.com> | 2016-12-09 21:02:33 -0500 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2016-12-09 21:02:33 -0500 |
| commit | c79706efe543199c7efdaef2bc2afd8dfb9b5e61 (patch) | |
| tree | dcb5dee8328bc50978ec09fb3075d5244faad165 /Emby.Dlna/ProfileSerialization | |
| parent | 003650f2d669d68cd382281daa2d3af8a1a02d30 (diff) | |
| parent | e936f49518bcd6e28d44600d58205fee9c1e21fd (diff) | |
Merge pull request #2334 from MediaBrowser/dev
Dev
Diffstat (limited to 'Emby.Dlna/ProfileSerialization')
| -rw-r--r-- | Emby.Dlna/ProfileSerialization/CodecProfile.cs | 68 | ||||
| -rw-r--r-- | Emby.Dlna/ProfileSerialization/ContainerProfile.cs | 31 | ||||
| -rw-r--r-- | Emby.Dlna/ProfileSerialization/DeviceProfile.cs | 351 | ||||
| -rw-r--r-- | Emby.Dlna/ProfileSerialization/DirectPlayProfile.cs | 51 | ||||
| -rw-r--r-- | Emby.Dlna/ProfileSerialization/HttpHeaderInfo.cs | 17 | ||||
| -rw-r--r-- | Emby.Dlna/ProfileSerialization/ProfileCondition.cs | 39 | ||||
| -rw-r--r-- | Emby.Dlna/ProfileSerialization/ResponseProfile.cs | 64 | ||||
| -rw-r--r-- | Emby.Dlna/ProfileSerialization/SubtitleProfile.cs | 48 | ||||
| -rw-r--r-- | Emby.Dlna/ProfileSerialization/TranscodingProfile.cs | 58 | ||||
| -rw-r--r-- | Emby.Dlna/ProfileSerialization/XmlAttribute.cs | 13 |
10 files changed, 0 insertions, 740 deletions
diff --git a/Emby.Dlna/ProfileSerialization/CodecProfile.cs b/Emby.Dlna/ProfileSerialization/CodecProfile.cs deleted file mode 100644 index 73fbca990..000000000 --- a/Emby.Dlna/ProfileSerialization/CodecProfile.cs +++ /dev/null @@ -1,68 +0,0 @@ -using MediaBrowser.Model.Extensions; -using System.Collections.Generic; -using System.Xml.Serialization; -using MediaBrowser.Model.Dlna; - -namespace Emby.Dlna.ProfileSerialization -{ - 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() - { - Conditions = new ProfileCondition[] {}; - ApplyConditions = new ProfileCondition[] { }; - } - - public List<string> GetCodecs() - { - List<string> list = new List<string>(); - foreach (string i in (Codec ?? string.Empty).Split(',')) - { - if (!string.IsNullOrEmpty(i)) list.Add(i); - } - return list; - } - - public List<string> GetContainers() - { - List<string> list = new List<string>(); - foreach (string i in (Container ?? string.Empty).Split(',')) - { - if (!string.IsNullOrEmpty(i)) list.Add(i); - } - return list; - } - - private bool ContainsContainer(string container) - { - List<string> containers = GetContainers(); - - return containers.Count == 0 || ListHelper.ContainsIgnoreCase(containers, container ?? string.Empty); - } - - public bool ContainsCodec(string codec, string container) - { - if (!ContainsContainer(container)) - { - return false; - } - - List<string> codecs = GetCodecs(); - - return codecs.Count == 0 || ListHelper.ContainsIgnoreCase(codecs, codec); - } - } -} diff --git a/Emby.Dlna/ProfileSerialization/ContainerProfile.cs b/Emby.Dlna/ProfileSerialization/ContainerProfile.cs deleted file mode 100644 index 112f25a7e..000000000 --- a/Emby.Dlna/ProfileSerialization/ContainerProfile.cs +++ /dev/null @@ -1,31 +0,0 @@ -using System.Collections.Generic; -using System.Xml.Serialization; -using MediaBrowser.Model.Dlna; - -namespace Emby.Dlna.ProfileSerialization -{ - public class ContainerProfile - { - [XmlAttribute("type")] - public DlnaProfileType Type { get; set; } - public ProfileCondition[] Conditions { get; set; } - - [XmlAttribute("container")] - public string Container { get; set; } - - public ContainerProfile() - { - Conditions = new ProfileCondition[] { }; - } - - public List<string> GetContainers() - { - List<string> list = new List<string>(); - foreach (string i in (Container ?? string.Empty).Split(',')) - { - if (!string.IsNullOrEmpty(i)) list.Add(i); - } - return list; - } - } -} diff --git a/Emby.Dlna/ProfileSerialization/DeviceProfile.cs b/Emby.Dlna/ProfileSerialization/DeviceProfile.cs deleted file mode 100644 index 3932f647a..000000000 --- a/Emby.Dlna/ProfileSerialization/DeviceProfile.cs +++ /dev/null @@ -1,351 +0,0 @@ -using MediaBrowser.Model.Extensions; -using MediaBrowser.Model.MediaInfo; -using System.Collections.Generic; -using System.Xml.Serialization; - -namespace Emby.Dlna.ProfileSerialization -{ - [XmlRoot("Profile")] - public class DeviceProfile - { - /// <summary> - /// Gets or sets the name. - /// </summary> - /// <value>The name.</value> - public string Name { get; set; } - - [XmlIgnore] - public string Id { get; set; } - - [XmlIgnore] - public MediaBrowser.Model.Dlna.DeviceProfileType ProfileType { get; set; } - - /// <summary> - /// Gets or sets the identification. - /// </summary> - /// <value>The identification.</value> - public MediaBrowser.Model.Dlna.DeviceIdentification Identification { get; set; } - - public string FriendlyName { get; set; } - public string Manufacturer { get; set; } - public string ManufacturerUrl { get; set; } - public string ModelName { get; set; } - public string ModelDescription { get; set; } - public string ModelNumber { get; set; } - public string ModelUrl { get; set; } - public string SerialNumber { get; set; } - - public bool EnableAlbumArtInDidl { get; set; } - public bool EnableSingleAlbumArtLimit { get; set; } - public bool EnableSingleSubtitleLimit { get; set; } - - public string SupportedMediaTypes { get; set; } - - public string UserId { get; set; } - - public string AlbumArtPn { get; set; } - - public int MaxAlbumArtWidth { get; set; } - public int MaxAlbumArtHeight { get; set; } - - public int? MaxIconWidth { get; set; } - public int? MaxIconHeight { get; set; } - - public int? MaxStreamingBitrate { get; set; } - public int? MaxStaticBitrate { get; set; } - - public int? MusicStreamingTranscodingBitrate { get; set; } - public int? MaxStaticMusicBitrate { get; set; } - - /// <summary> - /// Controls the content of the X_DLNADOC element in the urn:schemas-dlna-org:device-1-0 namespace. - /// </summary> - public string XDlnaDoc { get; set; } - /// <summary> - /// Controls the content of the X_DLNACAP element in the urn:schemas-dlna-org:device-1-0 namespace. - /// </summary> - public string XDlnaCap { get; set; } - /// <summary> - /// Controls the content of the aggregationFlags element in the urn:schemas-sonycom:av namespace. - /// </summary> - public string SonyAggregationFlags { get; set; } - - public string ProtocolInfo { get; set; } - - public int TimelineOffsetSeconds { get; set; } - public bool RequiresPlainVideoItems { get; set; } - public bool RequiresPlainFolders { get; set; } - - public bool EnableMSMediaReceiverRegistrar { get; set; } - public bool IgnoreTranscodeByteRangeRequests { get; set; } - - public XmlAttribute[] XmlRootAttributes { get; set; } - - /// <summary> - /// Gets or sets the direct play profiles. - /// </summary> - /// <value>The direct play profiles.</value> - public DirectPlayProfile[] DirectPlayProfiles { get; set; } - - /// <summary> - /// Gets or sets the transcoding profiles. - /// </summary> - /// <value>The transcoding profiles.</value> - public TranscodingProfile[] TranscodingProfiles { get; set; } - - public ContainerProfile[] ContainerProfiles { get; set; } - - public CodecProfile[] CodecProfiles { get; set; } - public ResponseProfile[] ResponseProfiles { get; set; } - - public SubtitleProfile[] SubtitleProfiles { get; set; } - - public DeviceProfile() - { - DirectPlayProfiles = new DirectPlayProfile[] { }; - TranscodingProfiles = new TranscodingProfile[] { }; - ResponseProfiles = new ResponseProfile[] { }; - CodecProfiles = new CodecProfile[] { }; - ContainerProfiles = new ContainerProfile[] { }; - SubtitleProfiles = new SubtitleProfile[] { }; - - XmlRootAttributes = new XmlAttribute[] { }; - - SupportedMediaTypes = "Audio,Photo,Video"; - MaxStreamingBitrate = 8000000; - MaxStaticBitrate = 8000000; - MusicStreamingTranscodingBitrate = 128000; - } - - public List<string> GetSupportedMediaTypes() - { - List<string> list = new List<string>(); - foreach (string i in (SupportedMediaTypes ?? string.Empty).Split(',')) - { - if (!string.IsNullOrEmpty(i)) - list.Add(i); - } - return list; - } - - public TranscodingProfile GetAudioTranscodingProfile(string container, string audioCodec) - { - container = StringHelper.TrimStart(container ?? string.Empty, '.'); - - foreach (var i in TranscodingProfiles) - { - if (i.Type != MediaBrowser.Model.Dlna.DlnaProfileType.Audio) - { - continue; - } - - if (!StringHelper.EqualsIgnoreCase(container, i.Container)) - { - continue; - } - - if (!ListHelper.ContainsIgnoreCase(i.GetAudioCodecs(), audioCodec ?? string.Empty)) - { - continue; - } - - return i; - } - return null; - } - - public TranscodingProfile GetVideoTranscodingProfile(string container, string audioCodec, string videoCodec) - { - container = StringHelper.TrimStart(container ?? string.Empty, '.'); - - foreach (var i in TranscodingProfiles) - { - if (i.Type != MediaBrowser.Model.Dlna.DlnaProfileType.Video) - { - continue; - } - - if (!StringHelper.EqualsIgnoreCase(container, i.Container)) - { - continue; - } - - if (!ListHelper.ContainsIgnoreCase(i.GetAudioCodecs(), audioCodec ?? string.Empty)) - { - continue; - } - - if (!StringHelper.EqualsIgnoreCase(videoCodec, i.VideoCodec ?? string.Empty)) - { - continue; - } - - return i; - } - return null; - } - - public ResponseProfile GetAudioMediaProfile(string container, string audioCodec, int? audioChannels, int? audioBitrate) - { - container = StringHelper.TrimStart(container ?? string.Empty, '.'); - - foreach (var i in ResponseProfiles) - { - if (i.Type != MediaBrowser.Model.Dlna.DlnaProfileType.Audio) - { - continue; - } - - List<string> containers = i.GetContainers(); - if (containers.Count > 0 && !ListHelper.ContainsIgnoreCase(containers, container)) - { - continue; - } - - List<string> audioCodecs = i.GetAudioCodecs(); - if (audioCodecs.Count > 0 && !ListHelper.ContainsIgnoreCase(audioCodecs, audioCodec ?? string.Empty)) - { - continue; - } - - var conditionProcessor = new MediaBrowser.Model.Dlna.ConditionProcessor(); - - var anyOff = false; - foreach (ProfileCondition c in i.Conditions) - { - if (!conditionProcessor.IsAudioConditionSatisfied(GetModelProfileCondition(c), audioChannels, audioBitrate)) - { - anyOff = true; - break; - } - } - - if (anyOff) - { - continue; - } - - return i; - } - 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 != MediaBrowser.Model.Dlna.DlnaProfileType.Photo) - { - continue; - } - - List<string> containers = i.GetContainers(); - if (containers.Count > 0 && !ListHelper.ContainsIgnoreCase(containers, container)) - { - continue; - } - - var conditionProcessor = new MediaBrowser.Model.Dlna.ConditionProcessor(); - - var anyOff = false; - foreach (ProfileCondition c in i.Conditions) - { - if (!conditionProcessor.IsImageConditionSatisfied(GetModelProfileCondition(c), width, height)) - { - anyOff = true; - break; - } - } - - if (anyOff) - { - continue; - } - - return i; - } - return null; - } - - public ResponseProfile GetVideoMediaProfile(string container, - string audioCodec, - string videoCodec, - int? width, - int? height, - int? bitDepth, - int? videoBitrate, - string videoProfile, - double? videoLevel, - float? videoFramerate, - int? packetLength, - TransportStreamTimestamp timestamp, - bool? isAnamorphic, - int? refFrames, - int? numVideoStreams, - int? numAudioStreams, - string videoCodecTag, - bool? isAvc) - { - container = StringHelper.TrimStart(container ?? string.Empty, '.'); - - foreach (var i in ResponseProfiles) - { - if (i.Type != MediaBrowser.Model.Dlna.DlnaProfileType.Video) - { - continue; - } - - List<string> containers = i.GetContainers(); - if (containers.Count > 0 && !ListHelper.ContainsIgnoreCase(containers, container ?? string.Empty)) - { - continue; - } - - List<string> audioCodecs = i.GetAudioCodecs(); - if (audioCodecs.Count > 0 && !ListHelper.ContainsIgnoreCase(audioCodecs, audioCodec ?? string.Empty)) - { - continue; - } - - List<string> videoCodecs = i.GetVideoCodecs(); - if (videoCodecs.Count > 0 && !ListHelper.ContainsIgnoreCase(videoCodecs, videoCodec ?? string.Empty)) - { - continue; - } - - var conditionProcessor = new MediaBrowser.Model.Dlna.ConditionProcessor(); - - var anyOff = false; - foreach (ProfileCondition c in i.Conditions) - { - if (!conditionProcessor.IsVideoConditionSatisfied(GetModelProfileCondition(c), width, height, bitDepth, videoBitrate, videoProfile, videoLevel, videoFramerate, packetLength, timestamp, isAnamorphic, refFrames, numVideoStreams, numAudioStreams, videoCodecTag, isAvc)) - { - anyOff = true; - break; - } - } - - if (anyOff) - { - continue; - } - - return i; - } - return null; - } - } -} diff --git a/Emby.Dlna/ProfileSerialization/DirectPlayProfile.cs b/Emby.Dlna/ProfileSerialization/DirectPlayProfile.cs deleted file mode 100644 index 4976b6844..000000000 --- a/Emby.Dlna/ProfileSerialization/DirectPlayProfile.cs +++ /dev/null @@ -1,51 +0,0 @@ -using System.Collections.Generic; -using System.Xml.Serialization; -using MediaBrowser.Model.Dlna; - -namespace Emby.Dlna.ProfileSerialization -{ - 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() - { - List<string> list = new List<string>(); - foreach (string i in (Container ?? string.Empty).Split(',')) - { - if (!string.IsNullOrEmpty(i)) list.Add(i); - } - return list; - } - - public List<string> GetAudioCodecs() - { - List<string> list = new List<string>(); - foreach (string i in (AudioCodec ?? string.Empty).Split(',')) - { - if (!string.IsNullOrEmpty(i)) list.Add(i); - } - return list; - } - - public List<string> GetVideoCodecs() - { - List<string> list = new List<string>(); - foreach (string i in (VideoCodec ?? string.Empty).Split(',')) - { - if (!string.IsNullOrEmpty(i)) list.Add(i); - } - return list; - } - } -} diff --git a/Emby.Dlna/ProfileSerialization/HttpHeaderInfo.cs b/Emby.Dlna/ProfileSerialization/HttpHeaderInfo.cs deleted file mode 100644 index dce0f3022..000000000 --- a/Emby.Dlna/ProfileSerialization/HttpHeaderInfo.cs +++ /dev/null @@ -1,17 +0,0 @@ -using System.Xml.Serialization; -using MediaBrowser.Model.Dlna; - -namespace Emby.Dlna.ProfileSerialization -{ - public class HttpHeaderInfo - { - [XmlAttribute("name")] - public string Name { get; set; } - - [XmlAttribute("value")] - public string Value { get; set; } - - [XmlAttribute("match")] - public HeaderMatchType Match { get; set; } - } -}
\ No newline at end of file diff --git a/Emby.Dlna/ProfileSerialization/ProfileCondition.cs b/Emby.Dlna/ProfileSerialization/ProfileCondition.cs deleted file mode 100644 index cb0a3de4f..000000000 --- a/Emby.Dlna/ProfileSerialization/ProfileCondition.cs +++ /dev/null @@ -1,39 +0,0 @@ -using System.Xml.Serialization; -using MediaBrowser.Model.Dlna; - -namespace Emby.Dlna.ProfileSerialization -{ - 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() - { - IsRequired = true; - } - - public ProfileCondition(ProfileConditionType condition, ProfileConditionValue property, string value) - : this(condition, property, value, false) - { - - } - - public ProfileCondition(ProfileConditionType condition, ProfileConditionValue property, string value, bool isRequired) - { - Condition = condition; - Property = property; - Value = value; - IsRequired = isRequired; - } - } -}
\ No newline at end of file diff --git a/Emby.Dlna/ProfileSerialization/ResponseProfile.cs b/Emby.Dlna/ProfileSerialization/ResponseProfile.cs deleted file mode 100644 index 6a5a49d79..000000000 --- a/Emby.Dlna/ProfileSerialization/ResponseProfile.cs +++ /dev/null @@ -1,64 +0,0 @@ -using System.Collections.Generic; -using System.Xml.Serialization; -using MediaBrowser.Model.Dlna; - -namespace Emby.Dlna.ProfileSerialization -{ - 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; } - - public ResponseProfile() - { - Conditions = new ProfileCondition[] {}; - } - - public List<string> GetContainers() - { - List<string> list = new List<string>(); - foreach (string i in (Container ?? string.Empty).Split(',')) - { - if (!string.IsNullOrEmpty(i)) list.Add(i); - } - return list; - } - - public List<string> GetAudioCodecs() - { - List<string> list = new List<string>(); - foreach (string i in (AudioCodec ?? string.Empty).Split(',')) - { - if (!string.IsNullOrEmpty(i)) list.Add(i); - } - return list; - } - - public List<string> GetVideoCodecs() - { - List<string> list = new List<string>(); - foreach (string i in (VideoCodec ?? string.Empty).Split(',')) - { - if (!string.IsNullOrEmpty(i)) list.Add(i); - } - return list; - } - } -} diff --git a/Emby.Dlna/ProfileSerialization/SubtitleProfile.cs b/Emby.Dlna/ProfileSerialization/SubtitleProfile.cs deleted file mode 100644 index a2f729108..000000000 --- a/Emby.Dlna/ProfileSerialization/SubtitleProfile.cs +++ /dev/null @@ -1,48 +0,0 @@ -using MediaBrowser.Model.Extensions; -using System.Collections.Generic; -using System.Xml.Serialization; -using MediaBrowser.Model.Dlna; - -namespace Emby.Dlna.ProfileSerialization -{ - 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() - { - List<string> list = new List<string>(); - foreach (string i in (Language ?? string.Empty).Split(',')) - { - if (!string.IsNullOrEmpty(i)) list.Add(i); - } - return list; - } - - public bool SupportsLanguage(string subLanguage) - { - if (string.IsNullOrEmpty(Language)) - { - return true; - } - - if (string.IsNullOrEmpty(subLanguage)) - { - subLanguage = "und"; - } - - List<string> languages = GetLanguages(); - return languages.Count == 0 || ListHelper.ContainsIgnoreCase(languages, subLanguage); - } - } -}
\ No newline at end of file diff --git a/Emby.Dlna/ProfileSerialization/TranscodingProfile.cs b/Emby.Dlna/ProfileSerialization/TranscodingProfile.cs deleted file mode 100644 index 4d7bfee20..000000000 --- a/Emby.Dlna/ProfileSerialization/TranscodingProfile.cs +++ /dev/null @@ -1,58 +0,0 @@ -using System.Collections.Generic; -using System.Xml.Serialization; -using MediaBrowser.Model.Dlna; - -namespace Emby.Dlna.ProfileSerialization -{ - 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() - { - List<string> list = new List<string>(); - foreach (string i in (AudioCodec ?? string.Empty).Split(',')) - { - if (!string.IsNullOrEmpty(i)) list.Add(i); - } - return list; - } - } -} diff --git a/Emby.Dlna/ProfileSerialization/XmlAttribute.cs b/Emby.Dlna/ProfileSerialization/XmlAttribute.cs deleted file mode 100644 index 011eb3b45..000000000 --- a/Emby.Dlna/ProfileSerialization/XmlAttribute.cs +++ /dev/null @@ -1,13 +0,0 @@ -using System.Xml.Serialization; - -namespace Emby.Dlna.ProfileSerialization -{ - public class XmlAttribute - { - [XmlAttribute("name")] - public string Name { get; set; } - - [XmlAttribute("value")] - public string Value { get; set; } - } -}
\ No newline at end of file |
