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