Ejemplo n.º 1
0
        static AdaptationSet LoadAdaptationSet(XElement element)
        {
            var ns     = element.GetDefaultNamespace().NamespaceName;
            var result = new AdaptationSet();

            PopulateRepresentationBase(element, result);

            result.Href                    = (string)element.Attribute("href");
            result.Actuate                 = element.Attribute("actuate").GetNullableEnum <Actuate>().GetValueOrDefault(result.Actuate);
            result.Id                      = element.Attribute("id").GetNullableUInt();
            result.Group                   = element.Attribute("group").GetNullableUInt();
            result.Lang                    = (string)element.Attribute("lang");
            result.ContentType             = (string)element.Attribute("contentType");
            result.Par                     = (string)element.Attribute("par");
            result.MinBandwidth            = element.Attribute("minBandwidth").GetNullableUInt();
            result.MaxBandwidth            = element.Attribute("maxBandwidth").GetNullableUInt();
            result.MinWidth                = element.Attribute("minWidth").GetNullableUInt();
            result.MaxWidth                = element.Attribute("maxWidth").GetNullableUInt();
            result.MinHeight               = element.Attribute("minHeight").GetNullableUInt();
            result.MaxHeight               = element.Attribute("maxHeight").GetNullableUInt();
            result.MinFrameRate            = element.Attribute("minFrameRate").GetConditionalUInt();
            result.MaxFrameRate            = element.Attribute("maxFrameRate").GetConditionalUInt();
            result.SegmentAlignment        = (string)element.Attribute("segmentAlignment") ?? result.SegmentAlignment;
            result.SubsegmentAlignment     = (string)element.Attribute("subsegmentAlignment") ?? result.SubsegmentAlignment;
            result.SubsegmentStartsWithSAP = element.Attribute("subsegmentStartsWithSAP").GetNullableUInt().GetValueOrDefault(result.SubsegmentStartsWithSAP);
            result.BitstreamSwitching      = element.Attribute("bitstreamSwitching").GetNullableBool();

            result.Accessibility.AddRange(element.Elements(XName.Get("Accessibility", ns)).Select(LoadDescriptor));
            result.Role.AddRange(element.Elements(XName.Get("Role", ns)).Select(LoadDescriptor));
            result.Rating.AddRange(element.Elements(XName.Get("Rating", ns)).Select(LoadDescriptor));
            result.Viewpoint.AddRange(element.Elements(XName.Get("Viewpoint", ns)).Select(LoadDescriptor));
            result.ContentComponent.AddRange(element.Elements(XName.Get("ContentComponent", ns)).Select(LoadContentComponent));
            result.BaseURL.AddRange(element.Elements(XName.Get("BaseURL", ns)).Select(LoadBaseURL));
            result.SegmentBase     = element.Elements(XName.Get("SegmentBase", ns)).Select(LoadSegmentBase).SingleOrDefault();
            result.SegmentList     = element.Elements(XName.Get("SegmentList", ns)).Select(LoadSegmentList).SingleOrDefault();
            result.SegmentTemplate = element.Elements(XName.Get("SegmentTemplate", ns)).Select(LoadSegmentTemplate).SingleOrDefault();
            result.Representation.AddRange(element.Elements(XName.Get("Representation", ns)).Select(LoadRepresentation));

            return(result);
        }
Ejemplo n.º 2
0
        static AdaptationSet LoadAdaptationSet(XElement element)
        {
            var ns = element.GetDefaultNamespace().NamespaceName;
            var result = new AdaptationSet();
            PopulateRepresentationBase(element, result);

            result.Href = (string)element.Attribute("href");
            result.Actuate = element.Attribute("actuate").GetNullableEnum<Actuate>().GetValueOrDefault(result.Actuate);
            result.Id = element.Attribute("id").GetNullableUInt();
            result.Group = element.Attribute("group").GetNullableUInt();
            result.Lang = (string)element.Attribute("lang");
            result.ContentType = (string)element.Attribute("contentType");
            result.Par = (string)element.Attribute("par");
            result.MinBandwidth = element.Attribute("minBandwidth").GetNullableUInt();
            result.MaxBandwidth = element.Attribute("maxBandwidth").GetNullableUInt();
            result.MinWidth = element.Attribute("minWidth").GetNullableUInt();
            result.MaxWidth = element.Attribute("maxWidth").GetNullableUInt();
            result.MinHeight = element.Attribute("minHeight").GetNullableUInt();
            result.MaxHeight = element.Attribute("maxHeight").GetNullableUInt();
            result.MinFrameRate = element.Attribute("minFrameRate").GetConditionalUInt();
            result.MaxFrameRate = element.Attribute("maxFrameRate").GetConditionalUInt();
            result.SegmentAlignment = (string)element.Attribute("segmentAlignment") ?? result.SegmentAlignment;
            result.SubsegmentAlignment = (string)element.Attribute("subsegmentAlignment") ?? result.SubsegmentAlignment;
            result.SubsegmentStartsWithSAP = element.Attribute("subsegmentStartsWithSAP").GetNullableUInt().GetValueOrDefault(result.SubsegmentStartsWithSAP);
            result.BitstreamSwitching = element.Attribute("bitstreamSwitching").GetNullableBool();

            result.Accessibility.AddRange(element.Elements(XName.Get("Accessibility", ns)).Select(LoadDescriptor));
            result.Role.AddRange(element.Elements(XName.Get("Role", ns)).Select(LoadDescriptor));
            result.Rating.AddRange(element.Elements(XName.Get("Rating", ns)).Select(LoadDescriptor));
            result.Viewpoint.AddRange(element.Elements(XName.Get("Viewpoint", ns)).Select(LoadDescriptor));
            result.ContentComponent.AddRange(element.Elements(XName.Get("ContentComponent", ns)).Select(LoadContentComponent));
            result.BaseURL.AddRange(element.Elements(XName.Get("BaseURL", ns)).Select(LoadBaseURL));
            result.SegmentBase = element.Elements(XName.Get("SegmentBase", ns)).Select(LoadSegmentBase).SingleOrDefault();
            result.SegmentList = element.Elements(XName.Get("SegmentList", ns)).Select(LoadSegmentList).SingleOrDefault();
            result.SegmentTemplate = element.Elements(XName.Get("SegmentTemplate", ns)).Select(LoadSegmentTemplate).SingleOrDefault();
            result.Representation.AddRange(element.Elements(XName.Get("Representation", ns)).Select(LoadRepresentation));

            return result;
        }