aboutsummaryrefslogtreecommitdiff
path: root/MediaBrowser.Model/Dlna/DeviceProfile.cs
diff options
context:
space:
mode:
Diffstat (limited to 'MediaBrowser.Model/Dlna/DeviceProfile.cs')
-rw-r--r--MediaBrowser.Model/Dlna/DeviceProfile.cs57
1 files changed, 35 insertions, 22 deletions
diff --git a/MediaBrowser.Model/Dlna/DeviceProfile.cs b/MediaBrowser.Model/Dlna/DeviceProfile.cs
index 66ebb867d..821531ed0 100644
--- a/MediaBrowser.Model/Dlna/DeviceProfile.cs
+++ b/MediaBrowser.Model/Dlna/DeviceProfile.cs
@@ -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;