mirror of
https://github.com/jellyfin/jellyfin.git
synced 2026-06-27 18:10:54 +01:00
make model project portable
This commit is contained in:
@@ -6,17 +6,14 @@ 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()
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
using MediaBrowser.Model.Extensions;
|
||||
using MediaBrowser.Model.MediaInfo;
|
||||
using System;
|
||||
using System.Globalization;
|
||||
|
||||
namespace MediaBrowser.Model.Dlna
|
||||
{
|
||||
@@ -86,8 +87,8 @@ namespace MediaBrowser.Model.Dlna
|
||||
}
|
||||
}
|
||||
|
||||
public bool IsVideoAudioConditionSatisfied(ProfileCondition condition,
|
||||
int? audioChannels,
|
||||
public bool IsVideoAudioConditionSatisfied(ProfileCondition condition,
|
||||
int? audioChannels,
|
||||
int? audioBitrate,
|
||||
string audioProfile,
|
||||
bool? isSecondaryTrack)
|
||||
@@ -116,7 +117,7 @@ namespace MediaBrowser.Model.Dlna
|
||||
}
|
||||
|
||||
int expected;
|
||||
if (IntHelper.TryParseCultureInvariant(condition.Value, out expected))
|
||||
if (int.TryParse(condition.Value, NumberStyles.Any, CultureInfo.InvariantCulture, out expected))
|
||||
{
|
||||
switch (condition.Condition)
|
||||
{
|
||||
@@ -149,9 +150,9 @@ namespace MediaBrowser.Model.Dlna
|
||||
switch (condition.Condition)
|
||||
{
|
||||
case ProfileConditionType.EqualsAny:
|
||||
{
|
||||
return ListHelper.ContainsIgnoreCase(expected.Split('|'), currentValue);
|
||||
}
|
||||
{
|
||||
return ListHelper.ContainsIgnoreCase(expected.Split('|'), currentValue);
|
||||
}
|
||||
case ProfileConditionType.Equals:
|
||||
return StringHelper.EqualsIgnoreCase(currentValue, expected);
|
||||
case ProfileConditionType.NotEquals:
|
||||
@@ -214,7 +215,7 @@ namespace MediaBrowser.Model.Dlna
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
private bool IsConditionSatisfied(ProfileCondition condition, double? currentValue)
|
||||
{
|
||||
if (!currentValue.HasValue)
|
||||
@@ -243,7 +244,7 @@ namespace MediaBrowser.Model.Dlna
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
private bool IsConditionSatisfied(ProfileCondition condition, TransportStreamTimestamp? timestamp)
|
||||
{
|
||||
if (!timestamp.HasValue)
|
||||
@@ -251,9 +252,9 @@ namespace MediaBrowser.Model.Dlna
|
||||
// If the value is unknown, it satisfies if not marked as required
|
||||
return !condition.IsRequired;
|
||||
}
|
||||
|
||||
|
||||
TransportStreamTimestamp expected = (TransportStreamTimestamp)Enum.Parse(typeof(TransportStreamTimestamp), condition.Value, true);
|
||||
|
||||
|
||||
switch (condition.Condition)
|
||||
{
|
||||
case ProfileConditionType.Equals:
|
||||
|
||||
@@ -5,11 +5,9 @@ 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()
|
||||
|
||||
@@ -1,11 +1,10 @@
|
||||
using MediaBrowser.Model.Extensions;
|
||||
using MediaBrowser.Model.MediaInfo;
|
||||
using System.Collections.Generic;
|
||||
using System.Xml.Serialization;
|
||||
using MediaBrowser.Model.Serialization;
|
||||
|
||||
namespace MediaBrowser.Model.Dlna
|
||||
{
|
||||
[XmlRoot("Profile")]
|
||||
public class DeviceProfile
|
||||
{
|
||||
/// <summary>
|
||||
@@ -14,10 +13,10 @@ namespace MediaBrowser.Model.Dlna
|
||||
/// <value>The name.</value>
|
||||
public string Name { get; set; }
|
||||
|
||||
[XmlIgnore]
|
||||
[IgnoreDataMember]
|
||||
public string Id { get; set; }
|
||||
|
||||
[XmlIgnore]
|
||||
[IgnoreDataMember]
|
||||
public DeviceProfileType ProfileType { get; set; }
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -1,20 +1,15 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Xml.Serialization;
|
||||
|
||||
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()
|
||||
|
||||
@@ -4,13 +4,10 @@ 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; }
|
||||
}
|
||||
}
|
||||
@@ -4,16 +4,12 @@ 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()
|
||||
|
||||
@@ -5,22 +5,16 @@ 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; }
|
||||
|
||||
@@ -6,6 +6,7 @@ using MediaBrowser.Model.MediaInfo;
|
||||
using MediaBrowser.Model.Session;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
|
||||
namespace MediaBrowser.Model.Dlna
|
||||
{
|
||||
@@ -483,7 +484,7 @@ namespace MediaBrowser.Model.Dlna
|
||||
if (!string.IsNullOrEmpty(transcodingProfile.MaxAudioChannels))
|
||||
{
|
||||
int transcodingMaxAudioChannels;
|
||||
if (IntHelper.TryParseCultureInvariant(transcodingProfile.MaxAudioChannels, out transcodingMaxAudioChannels))
|
||||
if (int.TryParse(transcodingProfile.MaxAudioChannels, NumberStyles.Any, CultureInfo.InvariantCulture, out transcodingMaxAudioChannels))
|
||||
{
|
||||
playlistItem.TranscodingMaxAudioChannels = transcodingMaxAudioChannels;
|
||||
}
|
||||
@@ -1039,7 +1040,7 @@ namespace MediaBrowser.Model.Dlna
|
||||
case ProfileConditionValue.AudioBitrate:
|
||||
{
|
||||
int num;
|
||||
if (IntHelper.TryParseCultureInvariant(value, out num))
|
||||
if (int.TryParse(value, NumberStyles.Any, CultureInfo.InvariantCulture, out num))
|
||||
{
|
||||
item.AudioBitrate = num;
|
||||
}
|
||||
@@ -1048,7 +1049,7 @@ namespace MediaBrowser.Model.Dlna
|
||||
case ProfileConditionValue.AudioChannels:
|
||||
{
|
||||
int num;
|
||||
if (IntHelper.TryParseCultureInvariant(value, out num))
|
||||
if (int.TryParse(value, NumberStyles.Any, CultureInfo.InvariantCulture, out num))
|
||||
{
|
||||
item.MaxAudioChannels = num;
|
||||
}
|
||||
@@ -1069,7 +1070,7 @@ namespace MediaBrowser.Model.Dlna
|
||||
case ProfileConditionValue.RefFrames:
|
||||
{
|
||||
int num;
|
||||
if (IntHelper.TryParseCultureInvariant(value, out num))
|
||||
if (int.TryParse(value, NumberStyles.Any, CultureInfo.InvariantCulture, out num))
|
||||
{
|
||||
item.MaxRefFrames = num;
|
||||
}
|
||||
@@ -1078,7 +1079,7 @@ namespace MediaBrowser.Model.Dlna
|
||||
case ProfileConditionValue.VideoBitDepth:
|
||||
{
|
||||
int num;
|
||||
if (IntHelper.TryParseCultureInvariant(value, out num))
|
||||
if (int.TryParse(value, NumberStyles.Any, CultureInfo.InvariantCulture, out num))
|
||||
{
|
||||
item.MaxVideoBitDepth = num;
|
||||
}
|
||||
@@ -1092,7 +1093,7 @@ namespace MediaBrowser.Model.Dlna
|
||||
case ProfileConditionValue.Height:
|
||||
{
|
||||
int num;
|
||||
if (IntHelper.TryParseCultureInvariant(value, out num))
|
||||
if (int.TryParse(value, NumberStyles.Any, CultureInfo.InvariantCulture, out num))
|
||||
{
|
||||
item.MaxHeight = num;
|
||||
}
|
||||
@@ -1101,7 +1102,7 @@ namespace MediaBrowser.Model.Dlna
|
||||
case ProfileConditionValue.VideoBitrate:
|
||||
{
|
||||
int num;
|
||||
if (IntHelper.TryParseCultureInvariant(value, out num))
|
||||
if (int.TryParse(value, NumberStyles.Any, CultureInfo.InvariantCulture, out num))
|
||||
{
|
||||
item.VideoBitrate = num;
|
||||
}
|
||||
@@ -1119,7 +1120,7 @@ namespace MediaBrowser.Model.Dlna
|
||||
case ProfileConditionValue.VideoLevel:
|
||||
{
|
||||
int num;
|
||||
if (IntHelper.TryParseCultureInvariant(value, out num))
|
||||
if (int.TryParse(value, NumberStyles.Any, CultureInfo.InvariantCulture, out num))
|
||||
{
|
||||
item.VideoLevel = num;
|
||||
}
|
||||
@@ -1128,7 +1129,7 @@ namespace MediaBrowser.Model.Dlna
|
||||
case ProfileConditionValue.Width:
|
||||
{
|
||||
int num;
|
||||
if (IntHelper.TryParseCultureInvariant(value, out num))
|
||||
if (int.TryParse(value, NumberStyles.Any, CultureInfo.InvariantCulture, out num))
|
||||
{
|
||||
item.MaxWidth = num;
|
||||
}
|
||||
|
||||
@@ -6,16 +6,12 @@ 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()
|
||||
|
||||
@@ -5,43 +5,30 @@ 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()
|
||||
|
||||
@@ -4,10 +4,8 @@ namespace MediaBrowser.Model.Dlna
|
||||
{
|
||||
public class XmlAttribute
|
||||
{
|
||||
[XmlAttribute("name")]
|
||||
public string Name { get; set; }
|
||||
|
||||
[XmlAttribute("value")]
|
||||
public string Value { get; set; }
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user