Skip to content

Commit

Permalink
feat: Annex I URL parameters UrlQueryInfo and ExtUrlQueryInfo
Browse files Browse the repository at this point in the history
  • Loading branch information
tobbee committed Dec 20, 2024
1 parent 7ff016f commit 5c50b73
Show file tree
Hide file tree
Showing 4 changed files with 63 additions and 3 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Added

- Ed5Amd1 element `<SelectionInfo>` inside mixed XML type `<Event>`
- UrlQueryInfo and ExtUrlQueryInfo from MPEG-DASH part 1 Annex I

### Fixed

Expand Down
8 changes: 5 additions & 3 deletions mpd/mpd.go
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
30 changes: 30 additions & 0 deletions mpd/testdata/livesim/urlparams.mpd
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
<?xml version="1.0" encoding="utf-8"?>
<MPD xmlns="urn:mpeg:dash:schema:mpd:2011" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" availabilityStartTime="1970-01-01T00:00:00Z"
id="1" maxSegmentDuration="PT2S" minBufferTime="PT2S" minimumUpdatePeriod="PT10M"
profiles="urn:mpeg:dash:profile:isoff-live:2011,http://dashif.org/guidelines/dash-if-simple"
publishTime="1970-01-01T00:00:00Z" timeShiftBufferDepth="PT5M" type="dynamic" xsi:schemaLocation="urn:mpeg:dash:schema:mpd:2011 DASH-MPD.xsd">
<ProgramInformation>
<Title>Media Presentation Description from DASH-IF live simulator</Title>
</ProgramInformation>
<BaseURL availabilityTimeOffset="INF">https://livesim.dashif.org/livesim/sts_1679588477/sid_9c8db005/ato_inf/testpic_2s/</BaseURL>
<Period id="p0" start="PT0S">
<AdaptationSet contentType="audio" lang="en" mimeType="audio/mp4" segmentAlignment="true" startWithSAP="1">
<EssentialProperty schemeIdUri="urn:mpeg:dash:urlparam:2016" xmlns:up="urn:mpeg:dash:schema:urlparam:2016">
<up:ExtendedUrlInfo queryTemplate="$querypart$" useMPDUrlQuery="true" headerParamSource="dashif.org"/>
</EssentialProperty>
<Role schemeIdUri="urn:mpeg:dash:role:2011" value="main" />
<SegmentTemplate duration="2" initialization="$RepresentationID$/init.mp4" media="$RepresentationID$/$Number$.m4s" startNumber="0" />
<Representation audioSamplingRate="48000" bandwidth="48000" codecs="mp4a.40.2" id="A48">
<AudioChannelConfiguration schemeIdUri="urn:mpeg:dash:23003:3:audio_channel_configuration:2011" value="2" />
</Representation>
</AdaptationSet>
<AdaptationSet contentType="video" maxFrameRate="60/2" maxHeight="360" maxWidth="640" mimeType="video/mp4" minHeight="360" minWidth="640" par="16:9" segmentAlignment="true" startWithSAP="1">
<EssentialProperty schemeIdUri="urn:mpeg:dash:urlparam:2014" xmlns:up="urn:mpeg:dash:schema:urlparam:2014">
<up:UrlQueryInfo queryTemplate="$querypart$" useMPDUrlQuery="true"/>
</EssentialProperty>
<Role schemeIdUri="urn:mpeg:dash:role:2011" value="main" />
<SegmentTemplate duration="2" initialization="$RepresentationID$/init.mp4" media="$RepresentationID$/$Number$.m4s" startNumber="0" />
<Representation bandwidth="300000" codecs="avc1.64001e" frameRate="60/2" height="360" id="V300" sar="1:1" width="640" />
</AdaptationSet>
</Period>
</MPD>
27 changes: 27 additions & 0 deletions mpd/up.go
Original file line number Diff line number Diff line change
@@ -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"
}

0 comments on commit 5c50b73

Please sign in to comment.