From 780a84338399f52214b365d347e2fd65dcbf54ec Mon Sep 17 00:00:00 2001 From: tjjwilson Date: Thu, 1 Feb 2024 17:08:54 -0600 Subject: [PATCH 1/5] Update avp.go --- types/scte224v20200407/avp.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/types/scte224v20200407/avp.go b/types/scte224v20200407/avp.go index 8d17cd2..ee5bafd 100644 --- a/types/scte224v20200407/avp.go +++ b/types/scte224v20200407/avp.go @@ -84,6 +84,7 @@ func (vp *ViewingPolicy) Get2018() scte224_2018.ViewingPolicy { signalPoints2018 = append(signalPoints2018, &scte224_2018.SignalPoint{ Offset: scte224_2018.Duration(signalPoint.Offset), + SegmentationEventId: signalPoint.SegmentationEventId, SegmentationTypeId: signalPoint.SegmentationTypeId, SegmentationUpidType: signalPoint.SegmentationUpidType, SegmentationUpid: signalPoint.SegmentationUpid, @@ -194,6 +195,7 @@ type SignalPointInsertionAction struct { type SignalPoint struct { Offset Duration `xml:"offset,attr,omitempty" json:"offset,omitempty"` + SegmentationEventId string `xml:"segmentationEventId,attr,omitempty" json:"segmentationEventId,omitempty"` SegmentationTypeId *uint `xml:"segmentationTypeId,attr,omitempty" json:"segmentationTypeId,omitempty"` SegmentationUpidType *uint `xml:"segmentationUpidType,attr,omitempty" json:"segmentationUpidType,omitempty"` SegmentationUpid string `xml:"segmentationUpid,attr,omitempty" json:"segmentationUpid,omitempty"` From 62ba08f12abe050271055acf8b9045f3f973e7dd Mon Sep 17 00:00:00 2001 From: tjjwilson Date: Thu, 1 Feb 2024 17:09:30 -0600 Subject: [PATCH 2/5] Update constants_test.go --- types/scte224v20200407/constants_test.go | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/types/scte224v20200407/constants_test.go b/types/scte224v20200407/constants_test.go index 7da23b8..879c149 100644 --- a/types/scte224v20200407/constants_test.go +++ b/types/scte224v20200407/constants_test.go @@ -48,6 +48,13 @@ const vpSignalPointInsertion_w_SpliceInfoSection string = ` ` +const vpPPOStart string = ` + + + + +` + // Same as "vp2020Raw" but without the additional "Allocation" action const vp2018Raw string = ` CONTENT From e8483cb6ee536972755aadf249eb071fd37d1727 Mon Sep 17 00:00:00 2001 From: tjjwilson Date: Thu, 1 Feb 2024 17:10:24 -0600 Subject: [PATCH 3/5] Update avp_test.go --- types/scte224v20200407/avp_test.go | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/types/scte224v20200407/avp_test.go b/types/scte224v20200407/avp_test.go index f0ffe6b..94ba22e 100644 --- a/types/scte224v20200407/avp_test.go +++ b/types/scte224v20200407/avp_test.go @@ -35,6 +35,23 @@ func TestViewingPolicyDowngrade_w_SIS(t *testing.T) { assert.EqualValues(t, vpSignalPointInsertion_w_SpliceInfoSection, string(vp2018Marshaled), "Downgrade failed") } +func TestUnmarhalViewingPolicy_PPOStart(t *testing.T) { + var vp *ViewingPolicy + err := xml.Unmarshal([]byte(vpPPOStart), &vp) + assert.Nil(t, err, "Error unmarshalling viewingpolicy") +} + +func TestViewingPolicyDowngrade_PPOStart(t *testing.T) { + var vp *ViewingPolicy + err := xml.Unmarshal([]byte(vpPPOStart), &vp) + assert.Nil(t, err, "Error unmarshalling viewingpolicy") + + vp2018 := vp.Get2018() + vp2018Marshaled, err := xml.MarshalIndent(vp2018, "", " ") + assert.Nil(t, err, "Error marshaling downgraded viewingpolicy") + assert.EqualValues(t, vpPPOStart, string(vp2018Marshaled), "Downgrade failed") +} + func TestAudienceDowngrade(t *testing.T) { var aud Audience err := xml.Unmarshal([]byte(aud2020Raw), &aud) From 572a9d9adadf58963904049566dff93c4ce27be5 Mon Sep 17 00:00:00 2001 From: tjjwilson Date: Thu, 1 Feb 2024 17:14:34 -0600 Subject: [PATCH 4/5] Update sctestructures.go --- types/scte224v20180501/sctestructures.go | 1 + 1 file changed, 1 insertion(+) diff --git a/types/scte224v20180501/sctestructures.go b/types/scte224v20180501/sctestructures.go index 1098039..32af8a2 100644 --- a/types/scte224v20180501/sctestructures.go +++ b/types/scte224v20180501/sctestructures.go @@ -228,6 +228,7 @@ type SignalPointInsertionAction struct { type SignalPoint struct { Offset Duration `xml:"offset,attr,omitempty" json:"offset,omitempty"` + SegmentationEventId string `xml:"segmentationEventId,attr,omitempty" json:"segmentationEventId,omitempty"` SegmentationTypeId *uint `xml:"segmentationTypeId,attr,omitempty" json:"segmentationTypeId,omitempty"` SegmentationUpidType *uint `xml:"segmentationUpidType,attr,omitempty" json:"segmentationUpidType,omitempty"` SegmentationUpid string `xml:"segmentationUpid,attr,omitempty" json:"segmentationUpid,omitempty"` From 51ae1deaf77fe332634ca6860efbcd2ff669a8e1 Mon Sep 17 00:00:00 2001 From: tjjwilson Date: Thu, 1 Feb 2024 17:16:01 -0600 Subject: [PATCH 5/5] Update sctestructures_test.go --- types/scte224v20180501/sctestructures_test.go | 66 +++++++++++++++++++ 1 file changed, 66 insertions(+) diff --git a/types/scte224v20180501/sctestructures_test.go b/types/scte224v20180501/sctestructures_test.go index a10d5ab..1996504 100644 --- a/types/scte224v20180501/sctestructures_test.go +++ b/types/scte224v20180501/sctestructures_test.go @@ -133,6 +133,13 @@ const spi string = ` + + + + +` + const spd string = ` True @@ -263,3 +270,62 @@ func TestSignalPointInsertion(t *testing.T) { } } } + +func TestSignalPointInsertion_PPOStart(t *testing.T) { + var vpol *ViewingPolicy + err := xml.Unmarshal([]byte(vpPPOStart), &vpol) + if err != nil { + t.Errorf("Error unmarshalling viewingpolicys %v", err) + t.FailNow() + } + action := vpol.SignalPointInsertion + if nil == action { + t.Error("expected non-nil signalPointInsertion") + } else { + if len(action.SignalPoints) == 0 { + t.Error("expected SignalPoints") + } else { + sp := action.SignalPoints[0] + if nil == sp { + t.Error("expected non-nil signalPoint") + } else { + if sp.Offset.GoDuration() != 0 { + t.Error("expected zero offset rather than" + sp.Offset) + } + + if sp.SegmentationEventId != "123456" { + t.Errorf("expected segmentationEventId of \"123456\" rather than \"%s\"", sp.SegmentationEventId) + } + if nil != sp.SegmentationUpidType { + t.Error("expected nil SegmentationUpid") + } + if len(sp.SegmentationUpid) != 0 { + t.Error("expected empty SegmentationUpid") + } + if nil != sp.SegmentationTypeId { + if *sp.SegmentationTypeId != 52 { + t.Error("expected segmentationTypeId of 53 rather than", *sp.SegmentationTypeId) + } + } else { + t.Error("expected non-nil segmentationTypeId") + } + repeatInterval := sp.RepeatInterval.GoDuration() + if time.Second*0 != repeatInterval { + t.Error("expected a 0 second interval rather than", repeatInterval) + } + if nil != sp.RepeatStart { + t.Error("expected nil RepeatStart") + } + if nil != sp.RepeatStop { + t.Error("expected nil RepeatStop") + } + } + } + roundtrip, rerr := xml.MarshalIndent(vpol, "", " ") + if nil != rerr { + t.Error(rerr) + } else { + t.Log(string(roundtrip)) + } + } +}