mirror of
https://github.com/jellyfin/jellyfin.git
synced 2025-12-19 15:33:03 +03:00
rework handling of original quality
This commit is contained in:
33
MediaBrowser.Server.Implementations/Sync/SyncHelper.cs
Normal file
33
MediaBrowser.Server.Implementations/Sync/SyncHelper.cs
Normal file
@@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user