aboutsummaryrefslogtreecommitdiff
path: root/MediaBrowser.Model/Dlna/ConditionProcessor.cs
diff options
context:
space:
mode:
authorLuke Pulverenti <luke.pulverenti@gmail.com>2014-06-22 12:25:47 -0400
committerLuke Pulverenti <luke.pulverenti@gmail.com>2014-06-22 12:25:47 -0400
commit3b30a2aee09bb045e466486fc0fff8a11cc6de74 (patch)
tree051b157b6509631e077cf3c83153bead3a851ea3 /MediaBrowser.Model/Dlna/ConditionProcessor.cs
parent414b1251c791dd914e51a5cfd7afeeaaf912e8a3 (diff)
detect anamorphic video
Diffstat (limited to 'MediaBrowser.Model/Dlna/ConditionProcessor.cs')
-rw-r--r--MediaBrowser.Model/Dlna/ConditionProcessor.cs30
1 files changed, 29 insertions, 1 deletions
diff --git a/MediaBrowser.Model/Dlna/ConditionProcessor.cs b/MediaBrowser.Model/Dlna/ConditionProcessor.cs
index 64ce2aaba..61428e39b 100644
--- a/MediaBrowser.Model/Dlna/ConditionProcessor.cs
+++ b/MediaBrowser.Model/Dlna/ConditionProcessor.cs
@@ -17,7 +17,8 @@ namespace MediaBrowser.Model.Dlna
double? videoLevel,
double? videoFramerate,
int? packetLength,
- TransportStreamTimestamp? timestamp)
+ TransportStreamTimestamp? timestamp,
+ bool? isAnamorphic)
{
switch (condition.Property)
{
@@ -27,6 +28,8 @@ namespace MediaBrowser.Model.Dlna
case ProfileConditionValue.Has64BitOffsets:
// TODO: Implement
return true;
+ case ProfileConditionValue.IsAnamorphic:
+ return IsConditionSatisfied(condition, isAnamorphic);
case ProfileConditionValue.VideoFramerate:
return IsConditionSatisfied(condition, videoFramerate);
case ProfileConditionValue.VideoLevel:
@@ -147,6 +150,31 @@ namespace MediaBrowser.Model.Dlna
throw new InvalidOperationException("Unexpected ProfileConditionType");
}
}
+
+ private bool IsConditionSatisfied(ProfileCondition condition, bool? currentValue)
+ {
+ if (!currentValue.HasValue)
+ {
+ // If the value is unknown, it satisfies if not marked as required
+ return !condition.IsRequired;
+ }
+
+ bool expected;
+ if (BoolHelper.TryParseCultureInvariant(condition.Value, out expected))
+ {
+ switch (condition.Condition)
+ {
+ case ProfileConditionType.Equals:
+ return currentValue.Value == expected;
+ case ProfileConditionType.NotEquals:
+ return currentValue.Value != expected;
+ default:
+ throw new InvalidOperationException("Unexpected ProfileConditionType");
+ }
+ }
+
+ return false;
+ }
private bool IsConditionSatisfied(ProfileCondition condition, double? currentValue)
{