diff options
| author | Luke Pulverenti <luke.pulverenti@gmail.com> | 2015-03-12 00:55:06 -0400 |
|---|---|---|
| committer | Luke Pulverenti <luke.pulverenti@gmail.com> | 2015-03-12 00:55:06 -0400 |
| commit | 1a81da5a8f2a94e6e9fceb3693c0cbd138c3e7cb (patch) | |
| tree | 3458aa76bda63a601bb06701b0e388dd8a05bbe9 /MediaBrowser.Server.Implementations/Sync/AppSyncProvider.cs | |
| parent | 6384c5bab0dd0c4a896beed4bb55e703c2e93301 (diff) | |
add quality methods
Diffstat (limited to 'MediaBrowser.Server.Implementations/Sync/AppSyncProvider.cs')
| -rw-r--r-- | MediaBrowser.Server.Implementations/Sync/AppSyncProvider.cs | 22 |
1 files changed, 20 insertions, 2 deletions
diff --git a/MediaBrowser.Server.Implementations/Sync/AppSyncProvider.cs b/MediaBrowser.Server.Implementations/Sync/AppSyncProvider.cs index e6af28c7d..c86549cb3 100644 --- a/MediaBrowser.Server.Implementations/Sync/AppSyncProvider.cs +++ b/MediaBrowser.Server.Implementations/Sync/AppSyncProvider.cs @@ -3,6 +3,7 @@ using MediaBrowser.Controller.Sync; using MediaBrowser.Model.Devices; using MediaBrowser.Model.Dlna; using MediaBrowser.Model.Sync; +using System; using System.Collections.Generic; using System.Linq; @@ -31,11 +32,28 @@ namespace MediaBrowser.Server.Implementations.Sync }); } - public DeviceProfile GetDeviceProfile(SyncTarget target) + public DeviceProfile GetDeviceProfile(SyncTarget target, string quality) { var caps = _deviceManager.GetCapabilities(target.Id); - return caps == null || caps.DeviceProfile == null ? new DeviceProfile() : caps.DeviceProfile; + var profile = caps == null || caps.DeviceProfile == null ? new DeviceProfile() : caps.DeviceProfile; + var maxBitrate = profile.MaxStaticBitrate; + + if (maxBitrate.HasValue) + { + if (string.Equals(quality, "medium", StringComparison.OrdinalIgnoreCase)) + { + maxBitrate = Convert.ToInt32(maxBitrate.Value * .75); + } + else if (string.Equals(quality, "low", StringComparison.OrdinalIgnoreCase)) + { + maxBitrate = Convert.ToInt32(maxBitrate.Value * .5); + } + + profile.MaxStaticBitrate = maxBitrate; + } + + return profile; } public string Name |
