7272
7373type MPD struct {
7474 XMLNs * string `xml:"xmlns,attr"`
75- XMLNsDolby * string `xml:"xmlns: dolby,attr"`
76- XMLNsSCTE214 * string `xml:"xmlns: scte214,attr"`
75+ XMLNsDolby * XmlnsAttr `xml:"dolby,attr"`
76+ XMLNsSCTE214 * XmlnsAttr `xml:"scte214,attr"`
7777 Scte35NS * Scte35NS `xml:"scte35,attr,omitempty"`
7878 XsiNS * XmlnsAttr `xml:"xsi,attr,omitempty"`
7979 XsiSchemaLocation * XsiSL `xml:"schemaLocation,attr,omitempty"`
@@ -109,9 +109,27 @@ func (s *XmlnsAttr) UnmarshalXMLAttr(attr xml.Attr) error {
109109}
110110
111111func (s * XmlnsAttr ) MarshalXMLAttr (name xml.Name ) (xml.Attr , error ) {
112+ if s == nil {
113+ return xml.Attr {}, nil
114+ }
112115 return xml.Attr {Name : xml.Name {Local : fmt .Sprintf ("xmlns:%s" , s .XmlName .Local )}, Value : s .Value }, nil
113116}
114117
118+ type Scte214Attr struct {
119+ XmlName xml.Name
120+ Value string
121+ }
122+
123+ func (s * Scte214Attr ) UnmarshalXMLAttr (attr xml.Attr ) error {
124+ s .XmlName = attr .Name
125+ s .Value = attr .Value
126+ return nil
127+ }
128+
129+ func (s * Scte214Attr ) MarshalXMLAttr (name xml.Name ) (xml.Attr , error ) {
130+ return xml.Attr {Name : xml.Name {Local : fmt .Sprintf ("scte214:%s" , s .XmlName .Local )}, Value : s .Value }, nil
131+ }
132+
115133type XsiSL struct {
116134 XmlName xml.Name
117135 Value string
@@ -443,17 +461,17 @@ type Representation struct {
443461 CommonAttributesAndElements
444462 AdaptationSet * AdaptationSet `xml:"-"`
445463 AudioChannelConfiguration * AudioChannelConfiguration `xml:"AudioChannelConfiguration,omitempty"`
446- AudioSamplingRate * int64 `xml:"audioSamplingRate,attr"` // Audio
447- Bandwidth * int64 `xml:"bandwidth,attr"` // Audio + Video
448- Codecs * string `xml:"codecs,attr"` // Audio + Video
449- SupplementalCodecs * string `xml:"scte214: supplementalCodecs,attr,omitempty"` // Video
450- SupplementalProfiles * string `xml:"scte214: supplementalProfiles,attr,omitempty"` // Video
451- FrameRate * string `xml:"frameRate,attr,omitempty"` // Video
452- Height * int64 `xml:"height,attr"` // Video
453- ID * string `xml:"id,attr"` // Audio + Video
454- Width * int64 `xml:"width,attr"` // Video
455- BaseURL []string `xml:"BaseURL,omitempty"` // On-Demand Profile
456- SegmentBase * SegmentBase `xml:"SegmentBase,omitempty"` // On-Demand Profile
464+ AudioSamplingRate * int64 `xml:"audioSamplingRate,attr"` // Audio
465+ Bandwidth * int64 `xml:"bandwidth,attr"` // Audio + Video
466+ Codecs * string `xml:"codecs,attr"` // Audio + Video
467+ SupplementalCodecs * Scte214Attr `xml:"supplementalCodecs,attr,omitempty"` // Video
468+ SupplementalProfiles * Scte214Attr `xml:"supplementalProfiles,attr,omitempty"` // Video
469+ FrameRate * string `xml:"frameRate,attr,omitempty"` // Video
470+ Height * int64 `xml:"height,attr"` // Video
471+ ID * string `xml:"id,attr"` // Audio + Video
472+ Width * int64 `xml:"width,attr"` // Video
473+ BaseURL []string `xml:"BaseURL,omitempty"` // On-Demand Profile
474+ SegmentBase * SegmentBase `xml:"SegmentBase,omitempty"` // On-Demand Profile
457475 SegmentList * SegmentList `xml:"SegmentList,omitempty"`
458476 SegmentTemplate * SegmentTemplate `xml:"SegmentTemplate,omitempty"`
459477}
@@ -471,11 +489,17 @@ type AudioChannelConfiguration struct {
471489}
472490
473491func (m * MPD ) SetDolbyXMLNs () {
474- m .XMLNsDolby = Strptr ("http://www.dolby.com/ns/online/DASH" )
492+ m .XMLNsDolby = & XmlnsAttr {
493+ XmlName : xml.Name {Space : "xmlns" , Local : "dolby" },
494+ Value : "http://www.dolby.com/ns/online/DASH" ,
495+ }
475496}
476497
477498func (m * MPD ) SetScte214XMLNs () {
478- m .XMLNsSCTE214 = Strptr ("urn:scte:dash:scte214-extensions" )
499+ m .XMLNsSCTE214 = & XmlnsAttr {
500+ XmlName : xml.Name {Space : "xmlns" , Local : "scte214" },
501+ Value : "urn:scte:dash:scte214-extensions" ,
502+ }
479503}
480504
481505// Creates a new static MPD object.
@@ -1135,8 +1159,20 @@ func (as *AdaptationSet) AddNewRepresentationVideo(bandwidth int64, codecs strin
11351159func (r * Representation ) AddScte214VideoCodecProperties (supplementalCodecs string , supplementalProfiles string ) (* Representation , error ) {
11361160 // For Dovi 8.1 signaling both supplementalCodecs and supplementalProfiles should be added
11371161 if len (supplementalCodecs ) > 0 && len (supplementalProfiles ) > 0 {
1138- r .SupplementalCodecs = Strptr (supplementalCodecs )
1139- r .SupplementalProfiles = Strptr (supplementalProfiles )
1162+ r .SupplementalCodecs = & Scte214Attr {
1163+ XmlName : xml.Name {
1164+ Space : "scte214" ,
1165+ Local : "supplementalCodecs" ,
1166+ },
1167+ Value : supplementalCodecs ,
1168+ }
1169+ r .SupplementalProfiles = & Scte214Attr {
1170+ XmlName : xml.Name {
1171+ Space : "scte214" ,
1172+ Local : "supplementalProfiles" ,
1173+ },
1174+ Value : supplementalProfiles ,
1175+ }
11401176 }
11411177 return r , nil
11421178}
0 commit comments