diff --git a/CHANGELOG.md b/CHANGELOG.md index 14f887c..9327cd5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,9 +7,15 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +### Added + +- Ed5Amd1 element `` inside mixed XML type `` + ### Fixed - Updated the G16 example +- Avoid escaping XML tab and newline in text to align with DASHSchema test content +- Handle text inside ``element ### Chore diff --git a/mpd/mpd.go b/mpd/mpd.go index e2d9662..8e735f1 100644 --- a/mpd/mpd.go +++ b/mpd/mpd.go @@ -143,7 +143,8 @@ type EventStreamType struct { Events []*EventType `xml:"Event"` } -// EventType is Event. +// EventType is Event. This has settings mixed="true" in the schema, so it can either +// have charData or child elements or both. type EventType struct { XMLName xml.Name `xml:"Event"` PresentationTime uint64 `xml:"presentationTime,attr,omitempty"` // default is 0 @@ -151,6 +152,22 @@ type EventType struct { Id uint32 `xml:"id,attr"` ContentEncoding ContentEncodingType `xml:"contentEncoding,attr,omitempty"` MessageData string `xml:"messageData,attr,omitempty"` + Value string `xml:",chardata"` + SelectionInfo *SelectionInfoType `xml:"SelectionInfo"` +} + +// SelectionInfoType is SelectionInfo +type SelectionInfoType struct { + SelectionInfo string `xml:"selectionInfo,attr,omitempty"` + ContactURL string `xml:"contactURL,attr"` + Selection []*SelectionType `xml:"Selection"` +} + +// SelectionType is Selection +type SelectionType struct { + DataEncoding string `xml:"dataEncoding,attr,omitempty"` + Parameter string `xml:"parameter,attr"` + Data string `xml:"data,attr,omitempty"` } // InitializationSetType is Initialization Set. diff --git a/mpd/testdata/schema-mpds/example_G23.mpd b/mpd/testdata/schema-mpds/example_G23.mpd new file mode 100644 index 0000000..7e04b37 --- /dev/null +++ b/mpd/testdata/schema-mpds/example_G23.mpd @@ -0,0 +1,27 @@ + + + http://liveserver.com/live/live1/ + + + http://acmeadsertver.com/preroll.mpd + + + + + + + + + \ No newline at end of file diff --git a/mpd/testdata/schema-mpds/example_G24.mpd b/mpd/testdata/schema-mpds/example_G24.mpd new file mode 100644 index 0000000..02501af --- /dev/null +++ b/mpd/testdata/schema-mpds/example_G24.mpd @@ -0,0 +1,28 @@ + + + + http://liveserver.com/live/live1/ + + + http://acmeadsertver.com/preroll.mpd + + + + + + + + + diff --git a/mpd/testdata/schema-mpds/example_G25.mpd b/mpd/testdata/schema-mpds/example_G25.mpd new file mode 100644 index 0000000..594af55 --- /dev/null +++ b/mpd/testdata/schema-mpds/example_G25.mpd @@ -0,0 +1,28 @@ + + + + http://liveserver.com/live/live1/ + + http://acmeadsertver.com/preroll.mpd + + + + + + + + + diff --git a/mpd/testdata/schema-mpds/example_G26.mpd b/mpd/testdata/schema-mpds/example_G26.mpd new file mode 100644 index 0000000..eeaed93 --- /dev/null +++ b/mpd/testdata/schema-mpds/example_G26.mpd @@ -0,0 +1,49 @@ + + + http://cdn1.example.com/ + http://cdn2.example.com/ + + + + + + + + + + + + + + + + + 7657412348.mp4 + + + + + + 562465736.mp4 + + + 41325645.mp4 + + + 89045625.mp4 + + + 23536745734.mp4 + + + + \ No newline at end of file diff --git a/mpd/testdata/schema-mpds/example_G27.mpd b/mpd/testdata/schema-mpds/example_G27.mpd new file mode 100644 index 0000000..1efc66f --- /dev/null +++ b/mpd/testdata/schema-mpds/example_G27.mpd @@ -0,0 +1,348 @@ + + + + + + + + ... + + + ... + + + + + + + + + + + + + + + + + ... + + + ... + + + + + + + + + + + + + + + + + + + ... + + + ... + + + + + + + + + + + + + + + + + + + + ... + + + ... + + + + + + + + + + + + + + + + + + + + + + + + + + ... + + + ... + + + + + + + + + + + + + + + + + ... + + + ... + + + + + + + + + + + + + + + + + + + + + + diff --git a/xml/README.md b/xml/README.md index e808ee7..0608351 100644 --- a/xml/README.md +++ b/xml/README.md @@ -13,3 +13,5 @@ space prefixes. This package is a copy of PR#48641. More specifically, commit f68da8a. Hopefully, this code will be merged into the Go standard library at some point. + +Escaping tab and newline led to problems with some DASHSchema test content so this disabled. diff --git a/xml/marshal_test.go b/xml/marshal_test.go index 8f143f5..a3255a9 100644 --- a/xml/marshal_test.go +++ b/xml/marshal_test.go @@ -2079,11 +2079,11 @@ var encodeTokenTests = []struct { }, want: `foo`, }, { - desc: "char data with escaped chars", + desc: "char data but tab and newline not escaped", toks: []Token{ CharData(" \t\n"), }, - want: " \n", + want: " \t\n", }, { desc: "comment", toks: []Token{ diff --git a/xml/xml.go b/xml/xml.go index e3cb913..36dcf03 100644 --- a/xml/xml.go +++ b/xml/xml.go @@ -1927,7 +1927,7 @@ var ( // EscapeText writes to w the properly escaped XML equivalent // of the plain text data s. func EscapeText(w io.Writer, s []byte) error { - return escapeText(w, s, true) + return escapeText(w, s, false) } // escapeText writes to w the properly escaped XML equivalent @@ -1950,8 +1950,6 @@ func escapeText(w io.Writer, s []byte, escapeNewline bool) error { esc = escLT case '>': esc = escGT - case '\t': - esc = escTab case '\n': if !escapeNewline { continue