public static MPD LoadMPD(XElement element)
        {
            var ns = element.GetDefaultNamespace().NamespaceName;
            var result = new MPD();

            result.Id = (string)element.Attribute("id");
            result.Profiles = (string)element.Attribute("profiles");
            result.Type = element.Attribute("type").GetEnum<Presentation>();
            result.AvailabilityStartTime = element.Attribute("availabilityStartTime").GetNullableDateTime();
            result.AvailabilityEndTime = element.Attribute("availabilityEndTime").GetNullableDateTime();
            result.MediaPresentationDuration = element.Attribute("mediaPresentationDuration").GetNullableDuration();
            result.MinimumUpdatePeriod = element.Attribute("minimumUpdatePeriod").GetNullableDuration();
            result.MinBufferTime = element.Attribute("minBufferTime").GetNullableDuration();
            result.TimeShiftBufferDepth = element.Attribute("timeShiftBufferDepth").GetNullableDuration();
            result.SuggestedPresentationDelay = element.Attribute("suggestedPresentationDelay").GetNullableDuration();
            result.MaxSegmentDuration = element.Attribute("maxSegmentDuration").GetNullableDuration();
            result.MaxSubsegmentDuration = element.Attribute("maxSubsegmentDuration").GetNullableDuration();
            result.AnyAttr.AddRange(element.Attributes());

            result.ProgramInformation.AddRange(element.Elements(XName.Get("ProgramInformation", ns)).Select(LoadProgramInformation));
            result.BaseURL.AddRange(element.Elements(XName.Get("BaseURL", ns)).Select(LoadBaseURL));
            result.Location.AddRange(element.Elements(XName.Get("Location", ns)).Select(e => e.Value));
            result.Period.AddRange(element.Elements(XName.Get("Period", ns)).Select(LoadPeriod));
            result.Metrics.AddRange(element.Elements(XName.Get("Metrics", ns)).Select(LoadMetrics));
            result.Any.AddRange(element.Elements());

            return result;
        }
示例#2
0
        public static MPD LoadMPD(XElement element)
        {
            var ns     = element.GetDefaultNamespace().NamespaceName;
            var result = new MPD();

            result.Id       = (string)element.Attribute("id");
            result.Profiles = (string)element.Attribute("profiles");
            result.Type     = element.Attribute("type").GetEnum <Presentation>();
            result.AvailabilityStartTime      = element.Attribute("availabilityStartTime").GetNullableDateTime();
            result.AvailabilityEndTime        = element.Attribute("availabilityEndTime").GetNullableDateTime();
            result.MediaPresentationDuration  = element.Attribute("mediaPresentationDuration").GetNullableDuration();
            result.MinimumUpdatePeriod        = element.Attribute("minimumUpdatePeriod").GetNullableDuration();
            result.MinBufferTime              = element.Attribute("minBufferTime").GetNullableDuration();
            result.TimeShiftBufferDepth       = element.Attribute("timeShiftBufferDepth").GetNullableDuration();
            result.SuggestedPresentationDelay = element.Attribute("suggestedPresentationDelay").GetNullableDuration();
            result.MaxSegmentDuration         = element.Attribute("maxSegmentDuration").GetNullableDuration();
            result.MaxSubsegmentDuration      = element.Attribute("maxSubsegmentDuration").GetNullableDuration();
            result.AnyAttr.AddRange(element.Attributes());

            result.ProgramInformation.AddRange(element.Elements(XName.Get("ProgramInformation", ns)).Select(LoadProgramInformation));
            result.BaseURL.AddRange(element.Elements(XName.Get("BaseURL", ns)).Select(LoadBaseURL));
            result.Location.AddRange(element.Elements(XName.Get("Location", ns)).Select(e => e.Value));
            result.Period.AddRange(element.Elements(XName.Get("Period", ns)).Select(LoadPeriod));
            result.Metrics.AddRange(element.Elements(XName.Get("Metrics", ns)).Select(LoadMetrics));
            result.Any.AddRange(element.Elements());

            return(result);
        }