From 54279504bb190031a73129e2c8e25cd24e0cd8f6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fl=C3=A1vio=20Ribeiro?= Date: Thu, 31 Oct 2019 19:42:33 -0400 Subject: [PATCH 1/3] return element name unrecognized in adaptation set --- mpd/mpd.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mpd/mpd.go b/mpd/mpd.go index e490abb..9fc11f2 100644 --- a/mpd/mpd.go +++ b/mpd/mpd.go @@ -236,7 +236,7 @@ func (as *AdaptationSet) UnmarshalXML(d *xml.Decoder, start xml.StartElement) er } representations = append(representations, rp) default: - return errors.New("Unrecognized element in AdaptationSet") + return errors.New("Unrecognized element in AdaptationSet: " + tt.Name.Local) } case xml.EndElement: if tt == start.End() { From b6bd25ebaa21ff6a5a42fc059decf0ce480aed03 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fl=C3=A1vio=20Ribeiro?= Date: Thu, 31 Oct 2019 20:11:48 -0400 Subject: [PATCH 2/3] extend elements in adaptation set to cover accessibility elements --- mpd/mpd.go | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/mpd/mpd.go b/mpd/mpd.go index 9fc11f2..ba5b670 100644 --- a/mpd/mpd.go +++ b/mpd/mpd.go @@ -235,6 +235,12 @@ func (as *AdaptationSet) UnmarshalXML(d *xml.Decoder, start xml.StartElement) er return err } representations = append(representations, rp) + case "Accessibility": + ac := new(Accessibility) + err = d.DecodeElement(ac, &tt) + if err != nil { + return err + } default: return errors.New("Unrecognized element in AdaptationSet: " + tt.Name.Local) } @@ -430,6 +436,11 @@ type Representation struct { SegmentTemplate *SegmentTemplate `xml:"SegmentTemplate,omitempty"` } +type Accessibility struct { + SchemeIdUri *string `xml:"schemeIdUri,omitempty"` + Value *int64 `xml:"value,omitempty"` +} + type AudioChannelConfiguration struct { SchemeIDURI *string `xml:"schemeIdUri,attr"` // Value will be an int for non-Dolby Schemes, and a hexstring for Dolby Schemes, hence we make it a string From 22110e3d53509673b8438f4cdfe017b12a1089ba Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fl=C3=A1vio=20Ribeiro?= Date: Thu, 19 Dec 2019 13:57:09 -0300 Subject: [PATCH 3/3] mpd: support float durations for SegmentTemplate --- mpd/mpd.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/mpd/mpd.go b/mpd/mpd.go index 42d5658..a19850e 100644 --- a/mpd/mpd.go +++ b/mpd/mpd.go @@ -417,7 +417,7 @@ type SegmentTemplate struct { AdaptationSet *AdaptationSet `xml:"-"` SegmentTimeline *SegmentTimeline `xml:"SegmentTimeline,omitempty"` PresentationTimeOffset *uint64 `xml:"presentationTimeOffset,attr,omitempty"` - Duration *int64 `xml:"duration,attr"` + Duration *float64 `xml:"duration,attr"` Initialization *string `xml:"initialization,attr"` Media *string `xml:"media,attr"` StartNumber *int64 `xml:"startNumber,attr"` @@ -934,9 +934,9 @@ func (as *AdaptationSet) AddContentProtection(cp ContentProtectioner) error { // media - template string for media segments. // startNumber - the number to start segments from ($Number$) (i.e. 0). // timescale - sets the timescale for duration (i.e. 1000, represents milliseconds). -func (as *AdaptationSet) SetNewSegmentTemplate(duration int64, init string, media string, startNumber int64, timescale int64) (*SegmentTemplate, error) { +func (as *AdaptationSet) SetNewSegmentTemplate(duration float64, init string, media string, startNumber int64, timescale int64) (*SegmentTemplate, error) { st := &SegmentTemplate{ - Duration: Int64ptr(duration), + Duration: Float64ptr(duration), Initialization: Strptr(init), Media: Strptr(media), StartNumber: Int64ptr(startNumber),