From 5c50b73b7c197d0608009db375442b2f699de85a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Torbjo=CC=88rn=20Einarsson?= Date: Fri, 1 Nov 2024 09:19:42 +0100 Subject: [PATCH] feat: Annex I URL parameters UrlQueryInfo and ExtUrlQueryInfo --- CHANGELOG.md | 1 + mpd/mpd.go | 8 +++++--- mpd/testdata/livesim/urlparams.mpd | 30 ++++++++++++++++++++++++++++++ mpd/up.go | 27 +++++++++++++++++++++++++++ 4 files changed, 63 insertions(+), 3 deletions(-) create mode 100644 mpd/testdata/livesim/urlparams.mpd create mode 100644 mpd/up.go diff --git a/CHANGELOG.md b/CHANGELOG.md index 9327cd5..3598f5a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Added - Ed5Amd1 element `` inside mixed XML type `` +- UrlQueryInfo and ExtUrlQueryInfo from MPEG-DASH part 1 Annex I ### Fixed diff --git a/mpd/mpd.go b/mpd/mpd.go index 6763646..59d8669 100644 --- a/mpd/mpd.go +++ b/mpd/mpd.go @@ -805,9 +805,11 @@ type ProgramInformationType struct { // DescriptorType is Descriptor. type DescriptorType struct { - SchemeIdUri AnyURI `xml:"schemeIdUri,attr,omitempty"` - Value string `xml:"value,attr,omitempty"` - Id string `xml:"id,attr,omitempty"` + SchemeIdUri AnyURI `xml:"schemeIdUri,attr,omitempty"` + Value string `xml:"value,attr,omitempty"` + Id string `xml:"id,attr,omitempty"` + UrlQueryInfo *UrlQueryInfoType `xml:"urn:mpeg:dash:schema:urlparam:2014 up:UrlQueryInfo,omitempty"` + ExtUrlQueryInfo *ExtendedUrlInfoType `xml:"urn:mpeg:dash:schema:urlparam:2016 up:ExtendedUrlInfo,omitempty"` } // NewDescriptor returns a new DescriptorType. diff --git a/mpd/testdata/livesim/urlparams.mpd b/mpd/testdata/livesim/urlparams.mpd new file mode 100644 index 0000000..4383831 --- /dev/null +++ b/mpd/testdata/livesim/urlparams.mpd @@ -0,0 +1,30 @@ + + + + Media Presentation Description from DASH-IF live simulator + + https://livesim.dashif.org/livesim/sts_1679588477/sid_9c8db005/ato_inf/testpic_2s/ + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/mpd/up.go b/mpd/up.go new file mode 100644 index 0000000..1a59be4 --- /dev/null +++ b/mpd/up.go @@ -0,0 +1,27 @@ +package mpd + +const ( + UrlParameterNamespace2014 = "urn:mpeg:dash:schema:urlparam:2014" + UrlParameterNamespace2016 = "urn:mpeg:dash:schema:urlparam:2016" +) + +// UrlQueryInfoType is defined in Annex I of ISO/IEC 23009-1. +// Its namespace is UrlParameterNamespace2014. +type UrlQueryInfoType struct { + QueryTemplate string `xml:"queryTemplate,attr,omitempty"` + UseMPDUrlQuery bool `xml:"useMPDUrlQuery,attr,omitempty"` + QueryString string `xml:"queryString,attr,omitempty"` + XlinkHref string `xml:"http://www.w3.org/1999/xlink xlink:href,attr,omitempty"` + XlinkActuate string `xml:"http://www.w3.org/1999/xlink xlink:actuate,attr,omitempty"` // default = "onRequest" + XlinkType string `xml:"http://www.w3.org/1999/xlink xlink:type,attr,omitempty"` // fixed = "simple" + XlinkShow string `xml:"http://www.w3.org/1999/xlink xlink:show,attr,omitempty"` // fixed = "embed" +} + +// ExtendedUrlInfoType is defined in Annex I of ISO/IEC 23009-1. +// Its namespace is UrlParameterNamespace2016. +type ExtendedUrlInfoType struct { + UrlQueryInfoType + IncludeInRequests string `xml:"includeInRequests,attr,omitempty"` // default = "segment" + HeaderParamSource string `xml:"headerParamSource,attr,omitempty"` // default = "segment" + SameOriginPolicy bool `xml:"sameOriginPolicy,attr,omitempty"` // default = "false" +}