Exemplo n.º 1
0
        public static async Task <DASH> FromTextInternal(string manifestText, string manifestUrl)
        {
            Node.DASH dash = new Node.DASH(manifestUrl);
            System.IO.StringReader reader = new System.IO.StringReader(manifestText);
            await Xml.Parser.ParseAsync(reader, dash, "MPD");

            return(dash);
        }
Exemplo n.º 2
0
        private static DocumentType ParseDashType(Node.DASH dash)
        {
            switch (dash.Type.ToLowerInvariant())
            {
            case "dynamic":
                return(DocumentType.Dynamic);

            case "static":
            default:            // ISO IEC 23009-1 Section 5.3.1.2 Table 3.
                                // Type is optional with default value of "static"
                return(DocumentType.Static);
            }
        }
Exemplo n.º 3
0
        private Document(Node.DASH dash)
        {
            MediaPresentationDuration = dash.MediaPresentationDuration;
            MinBufferTime             = dash.MinBufferTime;
            MinimumUpdatePeriod       = dash.MinimumUpdatePeriod;
            AvailabilityStartTime     = dash.AvailabilityStartTime;
            PublishTime                = dash.PublishTime;
            AvailabilityEndTime        = dash.AvailabilityEndTime;
            MediaPresentationDuration  = dash.MediaPresentationDuration;
            TimeShiftBufferDepth       = dash.TimeShiftBufferDepth;
            SuggestedPresentationDelay = dash.SuggestedPresentationDelay;


            Profiles = Xml.Conv.A2s(dash.Profiles);

            Type = ParseDashType(dash);

            if (Type == DocumentType.Dynamic)
            {
                if (AvailabilityStartTime == null || PublishTime == null)
                {
                    throw new ArgumentException("Malformed MPD. MPD.Type=Dynamic ISO IEC 23009-1 requires" +
                                                $"AvailabilityStartTime is '{AvailabilityStartTime}'" +
                                                $"PublishTime is '{PublishTime}' To be non null");
                }
            }

            foreach (Node.ProgramInformation info in dash.ProgramInformation)
            {
                foreach (string title in info.Titles)
                {
                    if (!string.IsNullOrEmpty(title))
                    {
                        Title = title;
                        break;
                    }
                }
                if (!string.IsNullOrEmpty(Title))
                {
                    break;
                }
            }

            Periods = Period.BuildPeriods(dash.Periods, this);

            Array.Sort(Periods);
        }
Exemplo n.º 4
0
 public Period(DASH doc)
 {
     Document = doc;
 }