jellyfin/MediaBrowser.Model/Dlna/DlnaMaps.cs

61 lines
2.0 KiB
C#
Raw Normal View History

2020-02-04 00:49:27 +00:00
#pragma warning disable CS1591
2020-08-07 17:26:28 +00:00
using System.Globalization;
namespace MediaBrowser.Model.Dlna
2018-12-27 23:27:57 +00:00
{
2020-02-04 00:49:27 +00:00
public static class DlnaMaps
2018-12-27 23:27:57 +00:00
{
private static readonly string DefaultStreaming =
2020-08-07 17:26:28 +00:00
FlagsToString(DlnaFlags.StreamingTransferMode |
2018-12-27 23:27:57 +00:00
DlnaFlags.BackgroundTransferMode |
DlnaFlags.ConnectionStall |
DlnaFlags.ByteBasedSeek |
DlnaFlags.DlnaV15);
private static readonly string DefaultInteractive =
2020-08-07 17:26:28 +00:00
FlagsToString(DlnaFlags.InteractiveTransferMode |
2018-12-27 23:27:57 +00:00
DlnaFlags.BackgroundTransferMode |
DlnaFlags.ConnectionStall |
DlnaFlags.ByteBasedSeek |
DlnaFlags.DlnaV15);
public static string FlagsToString(DlnaFlags flags)
{
2020-08-07 17:26:28 +00:00
return string.Format(CultureInfo.InvariantCulture, "{0:X8}{1:D24}", (ulong)flags, 0);
2018-12-27 23:27:57 +00:00
}
public static string GetOrgOpValue(bool hasKnownRuntime, bool isDirectStream, TranscodeSeekInfo profileTranscodeSeekInfo)
{
if (hasKnownRuntime)
{
string orgOp = string.Empty;
// Time-based seeking currently only possible when transcoding
orgOp += isDirectStream ? "0" : "1";
// Byte-based seeking only possible when not transcoding
orgOp += isDirectStream || profileTranscodeSeekInfo == TranscodeSeekInfo.Bytes ? "1" : "0";
return orgOp;
}
// No seeking is available if we don't know the content runtime
return "00";
}
public static string GetImageOrgOpValue()
{
string orgOp = string.Empty;
// Time-based seeking currently only possible when transcoding
orgOp += "0";
// Byte-based seeking only possible when not transcoding
orgOp += "0";
return orgOp;
}
}
}