aboutsummaryrefslogtreecommitdiff
path: root/MediaBrowser.MediaEncoding/Probing/ProbeResultNormalizer.cs
diff options
context:
space:
mode:
authorLuke Pulverenti <luke.pulverenti@gmail.com>2015-04-27 13:55:57 -0400
committerLuke Pulverenti <luke.pulverenti@gmail.com>2015-04-27 13:55:57 -0400
commitd274d1d807c8431a1d8b02433629b32d0f529aba (patch)
tree68ebb2cdd816e675be15181e30529e4e31bb768a /MediaBrowser.MediaEncoding/Probing/ProbeResultNormalizer.cs
parent6562824a84c06b586c56b407afd1916bfa38bbb4 (diff)
update library menu
Diffstat (limited to 'MediaBrowser.MediaEncoding/Probing/ProbeResultNormalizer.cs')
-rw-r--r--MediaBrowser.MediaEncoding/Probing/ProbeResultNormalizer.cs39
1 files changed, 38 insertions, 1 deletions
diff --git a/MediaBrowser.MediaEncoding/Probing/ProbeResultNormalizer.cs b/MediaBrowser.MediaEncoding/Probing/ProbeResultNormalizer.cs
index 2ef1c0cbd..2cd855e96 100644
--- a/MediaBrowser.MediaEncoding/Probing/ProbeResultNormalizer.cs
+++ b/MediaBrowser.MediaEncoding/Probing/ProbeResultNormalizer.cs
@@ -146,7 +146,44 @@ namespace MediaBrowser.MediaEncoding.Probing
// string.Equals(stream.AspectRatio, "2.35:1", StringComparison.OrdinalIgnoreCase) ||
// string.Equals(stream.AspectRatio, "2.40:1", StringComparison.OrdinalIgnoreCase);
- stream.IsAnamorphic = string.Equals(streamInfo.sample_aspect_ratio, "0:1", StringComparison.OrdinalIgnoreCase);
+ if (string.Equals(streamInfo.sample_aspect_ratio, "1:1", StringComparison.OrdinalIgnoreCase))
+ {
+ stream.IsAnamorphic = false;
+ }
+ else if (!((string.IsNullOrWhiteSpace(streamInfo.sample_aspect_ratio) || string.Equals(streamInfo.sample_aspect_ratio, "0:1", StringComparison.OrdinalIgnoreCase))))
+ {
+ stream.IsAnamorphic = true;
+ }
+ else if (string.IsNullOrWhiteSpace(streamInfo.display_aspect_ratio) || string.Equals(streamInfo.display_aspect_ratio, "0:1", StringComparison.OrdinalIgnoreCase))
+ {
+ stream.IsAnamorphic = false;
+ }
+ else
+ {
+ var ratioParts = streamInfo.display_aspect_ratio.Split(':');
+ if (ratioParts.Length != 2)
+ {
+ stream.IsAnamorphic = false;
+ }
+ else
+ {
+ int ratio0;
+ int ratio1;
+ if (!Int32.TryParse(ratioParts[0], NumberStyles.Any, CultureInfo.InvariantCulture, out ratio0))
+ {
+ stream.IsAnamorphic = false;
+ }
+ else if (!Int32.TryParse(ratioParts[1], NumberStyles.Any, CultureInfo.InvariantCulture, out ratio1))
+ {
+ stream.IsAnamorphic = false;
+ }
+ else
+ {
+ stream.IsAnamorphic = ((streamInfo.width * ratio1) != (stream.Height * ratio0));
+ }
+ }
+ }
+
}
else
{