Ejemplo n.º 1
0
        public string BuildImageHeader(string container,
                                       int?width,
                                       int?height)
        {
            string orgOp = ";DLNA.ORG_OP=" + DlnaMaps.GetImageOrgOpValue();

            // 0 = native, 1 = transcoded
            const string orgCi = ";DLNA.ORG_CI=0";

            DlnaFlags flagValue = DlnaFlags.StreamingTransferMode |
                                  DlnaFlags.BackgroundTransferMode |
                                  DlnaFlags.DlnaV15;

            string dlnaflags = string.Format(";DLNA.ORG_FLAGS={0}",
                                             DlnaMaps.FlagsToString(flagValue));

            ResponseProfile mediaProfile = _profile.GetImageMediaProfile(container,
                                                                         width,
                                                                         height);

            string orgPn = mediaProfile == null ? null : mediaProfile.OrgPn;

            if (string.IsNullOrEmpty(orgPn))
            {
                orgPn = GetImageOrgPnValue(container, width, height);
            }

            string contentFeatures = string.IsNullOrEmpty(orgPn) ? string.Empty : "DLNA.ORG_PN=" + orgPn;

            return((contentFeatures + orgOp + orgCi + dlnaflags).Trim(';'));
        }
Ejemplo n.º 2
0
        public static string BuildImageHeader(
            DeviceProfile profile,
            string container,
            int?width,
            int?height,
            bool isDirectStream,
            string orgPn = null)
        {
            string orgOp = ";DLNA.ORG_OP=" + DlnaMaps.GetImageOrgOpValue();

            // 0 = native, 1 = transcoded
            var orgCi = isDirectStream ? ";DLNA.ORG_CI=0" : ";DLNA.ORG_CI=1";

            var flagValue = DlnaFlags.BackgroundTransferMode |
                            DlnaFlags.InteractiveTransferMode |
                            DlnaFlags.DlnaV15;

            string dlnaflags = string.Format(
                CultureInfo.InvariantCulture,
                ";DLNA.ORG_FLAGS={0}",
                DlnaMaps.FlagsToString(flagValue));

            if (string.IsNullOrEmpty(orgPn))
            {
                ResponseProfile mediaProfile = profile.GetImageMediaProfile(
                    container,
                    width,
                    height);

                orgPn = mediaProfile?.OrgPn;

                if (string.IsNullOrEmpty(orgPn))
                {
                    orgPn = GetImageOrgPnValue(container, width, height);
                }
            }

            if (string.IsNullOrEmpty(orgPn))
            {
                return(orgOp.TrimStart(';') + orgCi + dlnaflags);
            }

            return("DLNA.ORG_PN=" + orgPn + orgOp + orgCi + dlnaflags);
        }