DlnaMaps.cs 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. #pragma warning disable CS1591
  2. using System.Globalization;
  3. namespace MediaBrowser.Model.Dlna
  4. {
  5. public static class DlnaMaps
  6. {
  7. public static string FlagsToString(DlnaFlags flags)
  8. {
  9. return string.Format(CultureInfo.InvariantCulture, "{0:X8}{1:D24}", (ulong)flags, 0);
  10. }
  11. public static string GetOrgOpValue(bool hasKnownRuntime, bool isDirectStream, TranscodeSeekInfo profileTranscodeSeekInfo)
  12. {
  13. if (hasKnownRuntime)
  14. {
  15. string orgOp = string.Empty;
  16. // Time-based seeking currently only possible when transcoding
  17. orgOp += isDirectStream ? "0" : "1";
  18. // Byte-based seeking only possible when not transcoding
  19. orgOp += isDirectStream || profileTranscodeSeekInfo == TranscodeSeekInfo.Bytes ? "1" : "0";
  20. return orgOp;
  21. }
  22. // No seeking is available if we don't know the content runtime
  23. return "00";
  24. }
  25. public static string GetImageOrgOpValue()
  26. {
  27. string orgOp = string.Empty;
  28. // Time-based seeking currently only possible when transcoding
  29. orgOp += "0";
  30. // Byte-based seeking only possible when not transcoding
  31. orgOp += "0";
  32. return orgOp;
  33. }
  34. }
  35. }