From c3b0e56f88a06204c2fc4b47331048dfa081d554 Mon Sep 17 00:00:00 2001 From: Vladislav Smirnov Date: Wed, 31 May 2023 17:33:38 +0000 Subject: [PATCH] Multiple BaseURL --- fixture_vod_with_base_url.mpd | 1 + mpd.go | 6 +++--- mpd_test.go | 2 +- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/fixture_vod_with_base_url.mpd b/fixture_vod_with_base_url.mpd index 4313339..a884126 100644 --- a/fixture_vod_with_base_url.mpd +++ b/fixture_vod_with_base_url.mpd @@ -1,6 +1,7 @@ https://video-1-2/ + https://video-1-3/ diff --git a/mpd.go b/mpd.go index 8586eda..f9f711c 100644 --- a/mpd.go +++ b/mpd.go @@ -78,7 +78,7 @@ type MPD struct { SCTE35 *string `xml:"scte35,attr,omitempty"` XSISchemaLocation *string `xml:"schemaLocation,attr"` ID *string `xml:"id,attr"` - BaseURL *string `xml:"BaseURL,omitempty"` + BaseURL []string `xml:"BaseURL,omitempty"` Period []Period `xml:"Period,omitempty"` } @@ -99,7 +99,7 @@ type mpdMarshal struct { TimeShiftBufferDepth *string `xml:"timeShiftBufferDepth,attr"` Profiles string `xml:"profiles,attr"` SCTE35 *string `xml:"xmlns:scte35,attr,omitempty"` - BaseURL *string `xml:"BaseURL,omitempty"` + BaseURL []string `xml:"BaseURL,omitempty"` Period []periodMarshal `xml:"Period,omitempty"` } @@ -279,7 +279,7 @@ func modifyMPD(mpd *MPD) *mpdMarshal { SCTE35: copyobj.String(mpd.SCTE35), XSISchemaLocation: copyobj.String(mpd.XSISchemaLocation), ID: copyobj.String(mpd.ID), - BaseURL: copyobj.String(mpd.BaseURL), + BaseURL: mpd.BaseURL, Period: modifyPeriod(mpd.Period), } } diff --git a/mpd_test.go b/mpd_test.go index 18a0ae3..56ac5a5 100644 --- a/mpd_test.go +++ b/mpd_test.go @@ -64,7 +64,7 @@ func (s *MPDSuite) TestUnmarshalMarshalVodBaseURL(c *C) { func TestMPDEqual(t *testing.T) { a := &MPD{} b := &mpdMarshal{} - require.Equal(t, 16, reflect.ValueOf(a).Elem().NumField(), + require.Equal(t, 17, reflect.ValueOf(a).Elem().NumField(), "model was updated, need to update this test and function modifyMPD") require.Equal(t, reflect.ValueOf(a).Elem().NumField(), reflect.ValueOf(b).Elem().NumField(), "MPD element count not equal mpdMarshal")