Skip to content

Commit 985f990

Browse files
author
Andrew Sinclair
committed
Adding base UTCTiming
1 parent 6f016ad commit 985f990

File tree

6 files changed

+15
-2
lines changed

6 files changed

+15
-2
lines changed

examples/live.go

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import (
66
"github.com/zencoder/go-dash/mpd"
77
)
88

9-
func exampleLive() {
9+
func main() {
1010
m := mpd.NewMPD(mpd.DASH_PROFILE_LIVE, "PT6M16S", "PT1.97S")
1111

1212
audioAS, _ := m.AddNewAdaptationSetAudio(mpd.DASH_MIME_TYPE_AUDIO_MP4, true, 1, "und")
@@ -29,6 +29,12 @@ func exampleLive() {
2929
subtitleAS, _ := m.AddNewAdaptationSetSubtitle(mpd.DASH_MIME_TYPE_SUBTITLE_VTT, "en")
3030
subtitleRep, _ := subtitleAS.AddNewRepresentationSubtitle(256, "subtitle_en")
3131
_ = subtitleRep.SetNewBaseURL("http://example.com/content/sintel/subtitles/subtitles_en.vtt")
32+
schemeIDURI := "urn:mpeg:dash:utc:direct:2014"
33+
value := "2019-10-23T15:56:29Z"
34+
m.UTCTiming = &mpd.DescriptorType{
35+
SchemeIDURI: &schemeIDURI,
36+
Value: &value,
37+
}
3238

3339
mpdStr, _ := m.WriteToString()
3440
fmt.Println(mpdStr)

go.mod

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,3 @@
11
module github.com/zencoder/go-dash
2+
3+
go 1.13

mpd/fixtures/live_profile_dynamic.mpd

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,4 +36,5 @@
3636
</Representation>
3737
</AdaptationSet>
3838
</Period>
39+
<UTCTiming></UTCTiming>
3940
</MPD>

mpd/mpd.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,8 @@ type MPD struct {
6969
MinimumUpdatePeriod *string `xml:"minimumUpdatePeriod,attr"`
7070
BaseURL string `xml:"BaseURL,omitempty"`
7171
period *Period
72-
Periods []*Period `xml:"Period,omitempty"`
72+
Periods []*Period `xml:"Period,omitempty"`
73+
UTCTiming *DescriptorType `xml:"UTCTiming,omitempty"`
7374
}
7475

7576
type Period struct {
@@ -478,6 +479,7 @@ func NewDynamicMPD(profile DashProfile, availabilityStartTime, minBufferTime str
478479
MinBufferTime: Strptr(minBufferTime),
479480
period: period,
480481
Periods: []*Period{period},
482+
UTCTiming: &DescriptorType{},
481483
}
482484

483485
for i := range attributes {

mpd/mpd_read_write_test.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ func TestNewDynamicMPDLiveWriteToString(t *testing.T) {
6262
expectedXML := `<?xml version="1.0" encoding="UTF-8"?>
6363
<MPD xmlns="urn:mpeg:dash:schema:mpd:2011" profiles="urn:mpeg:dash:profile:isoff-live:2011" type="dynamic" mediaPresentationDuration="PT6M16S" minBufferTime="PT1.97S" availabilityStartTime="1970-01-01T00:00:00Z" minimumUpdatePeriod="PT5S">
6464
<Period></Period>
65+
<UTCTiming></UTCTiming>
6566
</MPD>
6667
`
6768
require.EqualString(t, expectedXML, xmlStr)

mpd/mpd_test.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,7 @@ func TestNewDynamicMPDLive(t *testing.T) {
8181
MinimumUpdatePeriod: Strptr(VALID_MINIMUM_UPDATE_PERIOD),
8282
period: &Period{},
8383
Periods: []*Period{{}},
84+
UTCTiming: &DescriptorType{},
8485
}
8586

8687
expectedString, err := expectedMPD.WriteToString()

0 commit comments

Comments
 (0)