Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add attrPublishTime, as publishTime must be present for @type='dynamic' #84

Merged
merged 1 commit into from
Feb 23, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions mpd/mpd.go
Original file line number Diff line number Diff line change
Expand Up @@ -521,6 +521,8 @@ func NewDynamicMPD(profile DashProfile, availabilityStartTime, minBufferTime str
mpd.MinimumUpdatePeriod = attr.GetStrptr()
case *attrMediaPresentationDuration:
mpd.MediaPresentationDuration = attr.GetStrptr()
case *attrPublishTime:
mpd.PublishTime = attr.GetStrptr()
}
}

Expand Down
13 changes: 13 additions & 0 deletions mpd/mpd_attr.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,3 +42,16 @@ func (attr *attrMediaPresentationDuration) GetStrptr() *string {
func AttrMediaPresentationDuration(value string) AttrMPD {
return &attrMediaPresentationDuration{strptr: &value}
}

type attrPublishTime struct {
strptr *string
}

func (attr *attrPublishTime) GetStrptr() *string {
return attr.strptr
}

// AttrPublishTime returns AttrMPD object for NewMPD
func AttrPublishTime(value string) AttrMPD {
return &attrPublishTime{strptr: &value}
}
5 changes: 4 additions & 1 deletion mpd/mpd_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ const (
VALID_MEDIA_PRESENTATION_DURATION string = "PT6M16S"
VALID_MIN_BUFFER_TIME string = "PT1.97S"
VALID_AVAILABILITY_START_TIME string = "1970-01-01T00:00:00Z"
VALID_PUBLISH_TIME string = "2020-03-12T10:39:45Z"
VALID_MINIMUM_UPDATE_PERIOD string = "PT5S"
VALID_SCAN_TYPE string = "progressive"
VALID_SEGMENT_ALIGNMENT bool = true
Expand Down Expand Up @@ -71,7 +72,8 @@ func TestNewMPDLive(t *testing.T) {
func TestNewDynamicMPDLive(t *testing.T) {
m := NewDynamicMPD(DASH_PROFILE_LIVE, VALID_AVAILABILITY_START_TIME, VALID_MIN_BUFFER_TIME,
AttrMediaPresentationDuration(VALID_MEDIA_PRESENTATION_DURATION),
AttrMinimumUpdatePeriod(VALID_MINIMUM_UPDATE_PERIOD))
AttrMinimumUpdatePeriod(VALID_MINIMUM_UPDATE_PERIOD),
AttrPublishTime(VALID_PUBLISH_TIME))
require.NotNil(t, m)
expectedMPD := &MPD{
XMLNs: Strptr("urn:mpeg:dash:schema:mpd:2011"),
Expand All @@ -84,6 +86,7 @@ func TestNewDynamicMPDLive(t *testing.T) {
period: &Period{},
Periods: []*Period{{}},
UTCTiming: &DescriptorType{},
PublishTime: Strptr(VALID_PUBLISH_TIME),
}

expectedString, err := expectedMPD.WriteToString()
Expand Down