aboutsummaryrefslogtreecommitdiff
path: root/MediaBrowser.Server.Implementations/Sync/SyncHelper.cs
diff options
context:
space:
mode:
Diffstat (limited to 'MediaBrowser.Server.Implementations/Sync/SyncHelper.cs')
-rw-r--r--MediaBrowser.Server.Implementations/Sync/SyncHelper.cs33
1 files changed, 33 insertions, 0 deletions
diff --git a/MediaBrowser.Server.Implementations/Sync/SyncHelper.cs b/MediaBrowser.Server.Implementations/Sync/SyncHelper.cs
new file mode 100644
index 000000000..6bcb27328
--- /dev/null
+++ b/MediaBrowser.Server.Implementations/Sync/SyncHelper.cs
@@ -0,0 +1,33 @@
+using System;
+using System.Globalization;
+
+namespace MediaBrowser.Server.Implementations.Sync
+{
+ public class SyncHelper
+ {
+ public static int? AdjustBitrate(int? profileBitrate, string quality)
+ {
+ if (profileBitrate.HasValue)
+ {
+ if (string.Equals(quality, "medium", StringComparison.OrdinalIgnoreCase))
+ {
+ profileBitrate = Convert.ToInt32(profileBitrate.Value * .75);
+ }
+ else if (string.Equals(quality, "low", StringComparison.OrdinalIgnoreCase))
+ {
+ profileBitrate = Convert.ToInt32(profileBitrate.Value*.5);
+ }
+ else
+ {
+ int value;
+ if (int.TryParse(quality, NumberStyles.Any, CultureInfo.InvariantCulture, out value))
+ {
+ profileBitrate = value;
+ }
+ }
+ }
+
+ return profileBitrate;
+ }
+ }
+}