aboutsummaryrefslogtreecommitdiff
path: root/MediaBrowser.Model/Dlna/DlnaMaps.cs
blob: 4613bc5427d8e98b37111d8c906e6fafa2a69f9d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#pragma warning disable CS1591

using System.Globalization;

namespace MediaBrowser.Model.Dlna
{
    public static class DlnaMaps
    {
        public static string FlagsToString(DlnaFlags flags)
        {
            return string.Format(CultureInfo.InvariantCulture, "{0:X8}{1:D24}", (ulong)flags, 0);
        }

        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;
        }
    }
}