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); }
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); } }
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); }
public Period(DASH doc) { Document = doc; }