@@ -53,7 +53,7 @@ func TestDecodeBase64(t *testing.T) {
5353 EncryptedPacket : scte35.EncryptedPacket {EncryptionAlgorithm : scte35 .EncryptionAlgorithmNone , CWIndex : 255 },
5454 SpliceCommand : & scte35.TimeSignal {
5555 SpliceTime : scte35.SpliceTime {
56- PTSTime : uint64ptr ( 0x072bd0050 ),
56+ PTSTime : ptr ( uint64 ( 0x072bd0050 ) ),
5757 },
5858 },
5959 SpliceDescriptors : []scte35.SpliceDescriptor {
@@ -65,7 +65,7 @@ func TestDecodeBase64(t *testing.T) {
6565 },
6666 SegmentationEventID : uint32 (0x4800008e ),
6767 SegmentationTypeID : scte35 .SegmentationTypeProviderPOStart ,
68- SegmentationDuration : uint64ptr ( 0x0001a599b0 ),
68+ SegmentationDuration : ptr ( uint64 ( 0x0001a599b0 ) ),
6969 SegmentationUPIDs : []scte35.SegmentationUPID {
7070 scte35 .NewSegmentationUPID (scte35 .SegmentationUPIDTypeTI , toBytes (0x000000002ca0a18a )),
7171 },
@@ -89,7 +89,7 @@ func TestDecodeBase64(t *testing.T) {
8989 OutOfNetworkIndicator : true ,
9090 Program : & scte35.SpliceInsertProgram {
9191 SpliceTime : scte35.SpliceTime {
92- PTSTime : uint64ptr ( 0x07369c02e ),
92+ PTSTime : ptr ( uint64 ( 0x07369c02e ) ),
9393 },
9494 },
9595 },
@@ -108,7 +108,7 @@ func TestDecodeBase64(t *testing.T) {
108108 EncryptedPacket : scte35.EncryptedPacket {EncryptionAlgorithm : scte35 .EncryptionAlgorithmNone , CWIndex : 255 },
109109 SpliceCommand : & scte35.TimeSignal {
110110 SpliceTime : scte35.SpliceTime {
111- PTSTime : uint64ptr ( 0x0746290a0 ),
111+ PTSTime : ptr ( uint64 ( 0x0746290a0 ) ),
112112 },
113113 },
114114 SpliceDescriptors : []scte35.SpliceDescriptor {
@@ -137,7 +137,7 @@ func TestDecodeBase64(t *testing.T) {
137137 EncryptedPacket : scte35.EncryptedPacket {EncryptionAlgorithm : scte35 .EncryptionAlgorithmNone , CWIndex : 255 },
138138 SpliceCommand : & scte35.TimeSignal {
139139 SpliceTime : scte35.SpliceTime {
140- PTSTime : uint64ptr ( 0x07a4d88b6 ),
140+ PTSTime : ptr ( uint64 ( 0x07a4d88b6 ) ),
141141 },
142142 },
143143 SpliceDescriptors : []scte35.SpliceDescriptor {
@@ -178,7 +178,7 @@ func TestDecodeBase64(t *testing.T) {
178178 EncryptedPacket : scte35.EncryptedPacket {EncryptionAlgorithm : scte35 .EncryptionAlgorithmNone , CWIndex : 255 },
179179 SpliceCommand : & scte35.TimeSignal {
180180 SpliceTime : scte35.SpliceTime {
181- PTSTime : uint64ptr ( 0x0aebfff64 ),
181+ PTSTime : ptr ( uint64 ( 0x0aebfff64 ) ),
182182 },
183183 },
184184 SpliceDescriptors : []scte35.SpliceDescriptor {
@@ -206,7 +206,7 @@ func TestDecodeBase64(t *testing.T) {
206206 EncryptedPacket : scte35.EncryptedPacket {EncryptionAlgorithm : scte35 .EncryptionAlgorithmNone , CWIndex : 255 },
207207 SpliceCommand : & scte35.TimeSignal {
208208 SpliceTime : scte35.SpliceTime {
209- PTSTime : uint64ptr ( 0x0932e380b ),
209+ PTSTime : ptr ( uint64 ( 0x0932e380b ) ),
210210 },
211211 },
212212 SpliceDescriptors : []scte35.SpliceDescriptor {
@@ -247,7 +247,7 @@ func TestDecodeBase64(t *testing.T) {
247247 EncryptedPacket : scte35.EncryptedPacket {EncryptionAlgorithm : scte35 .EncryptionAlgorithmNone , CWIndex : 255 },
248248 SpliceCommand : & scte35.TimeSignal {
249249 SpliceTime : scte35.SpliceTime {
250- PTSTime : uint64ptr ( 0x0aef17c4c ),
250+ PTSTime : ptr ( uint64 ( 0x0aef17c4c ) ),
251251 },
252252 },
253253 SpliceDescriptors : []scte35.SpliceDescriptor {
@@ -275,7 +275,7 @@ func TestDecodeBase64(t *testing.T) {
275275 EncryptedPacket : scte35.EncryptedPacket {EncryptionAlgorithm : scte35 .EncryptionAlgorithmNone , CWIndex : 255 },
276276 SpliceCommand : & scte35.TimeSignal {
277277 SpliceTime : scte35.SpliceTime {
278- PTSTime : uint64ptr ( 0x0a8cd44ed ),
278+ PTSTime : ptr ( uint64 ( 0x0a8cd44ed ) ),
279279 },
280280 },
281281 SpliceDescriptors : []scte35.SpliceDescriptor {
@@ -460,11 +460,11 @@ func TestDecodeBase64(t *testing.T) {
460460 {
461461 Type : scte35 .SegmentationUPIDTypeMPU ,
462462 Format : scte35 .SegmentationUPIDFormatBase64 ,
463- FormatIdentifier : uint32ptr ( 1145656131 ),
463+ FormatIdentifier : ptr ( uint32 ( 1145656131 ) ),
464464 Value : "WU1XRjA0NTIwMDBI" ,
465465 },
466466 },
467- SegmentationDuration : uint64ptr ( 10800000 ),
467+ SegmentationDuration : ptr ( uint64 ( 10800000 ) ),
468468 SegmentationEventID : 39965 ,
469469 SegmentationTypeID : scte35 .SegmentationTypeProviderAdEnd ,
470470 SegmentNum : 1 ,
@@ -497,7 +497,7 @@ func TestDecodeBase64(t *testing.T) {
497497 Value : "urn:nbcuni.com:brc:499866434" ,
498498 },
499499 },
500- SegmentationDuration : uint64ptr ( 1347087 ),
500+ SegmentationDuration : ptr ( uint64 ( 1347087 ) ),
501501 SegmentationEventID : 4294967295 ,
502502 SegmentationTypeID : scte35 .SegmentationTypeProviderAdEnd ,
503503 SegmentNum : 10 ,
@@ -534,12 +534,47 @@ func TestDecodeBase64(t *testing.T) {
534534 },
535535 legacy : true , // binary wont match because of stuffing
536536 },
537+ "Unused Subsegments Included" : {
538+ binary : "/DCRAAAAAAAAAP/wBQb/9peOEAB7AjhDVUVJAAAAnH+/DilhdmFpbGlkPTkxNDg2NjA2NSZiaXRtYXA9JmluYWN0aXZpdHk9MzEyMDEHCgI/Q1VFSQAAAJ1//wAANu6ADilhdmFpbGlkPTkxMDkwMTM4OSZiaXRtYXA9JmluYWN0aXZpdHk9MzEyMDAICgAAoJMeaA==" ,
539+ expected : scte35.SpliceInfoSection {
540+ SAPType : scte35 .SAPTypeNotSpecified ,
541+ Tier : 4095 ,
542+ SpliceCommand : & scte35.TimeSignal {
543+ SpliceTime : scte35.SpliceTime {
544+ PTSTime : ptr (uint64 (8432094736 )),
545+ },
546+ },
547+ SpliceDescriptors : scte35.SpliceDescriptors {
548+ & scte35.SegmentationDescriptor {
549+ SegmentationEventID : uint32 (156 ),
550+ SegmentationTypeID : scte35 .SegmentationTypeProviderAdEnd ,
551+ SegmentNum : 7 ,
552+ SegmentsExpected : 10 ,
553+ SegmentationUPIDs : []scte35.SegmentationUPID {
554+ {Type : scte35 .SegmentationUPIDTypeADS , Format : scte35 .SegmentationUPIDFormatText , Value : "availid=914866065\u0026 bitmap=\u0026 inactivity=3120" },
555+ },
556+ },
557+ & scte35.SegmentationDescriptor {
558+ SegmentationEventID : uint32 (157 ),
559+ SegmentationTypeID : scte35 .SegmentationTypeProviderAdStart ,
560+ SegmentationDuration : ptr (uint64 (3600000 )),
561+ SegmentNum : 8 ,
562+ SegmentsExpected : 10 ,
563+ SubSegmentNum : ptr (uint32 (0 )),
564+ SubSegmentsExpected : ptr (uint32 (0 )),
565+ SegmentationUPIDs : []scte35.SegmentationUPID {
566+ {Type : scte35 .SegmentationUPIDTypeADS , Format : scte35 .SegmentationUPIDFormatText , Value : "availid=910901389\u0026 bitmap=\u0026 inactivity=3120" },
567+ },
568+ },
569+ },
570+ },
571+ },
537572 "UPID with Valid ASCII Invalid UTF8" : {
538573 binary : "/DDHAAAAABc0AP/wBQb/tVo+agCxAhdDVUVJQA4hwH+fCAgAAAAAPj6IcCMAAAIXQ1VFSUAOI1x/nwgIAAAAAD4+iHARAAACF0NVRUlADiHgf58ICAAAAAA+Poi2EAAAAhxDVUVJQA4hyn/fAABSlKwICAAAAAA+Poi2IgAAAkZDVUVJQA4h1n/PAABSlKwNMgoMFHf5uXs0AAAAAAAADhh0eXBlPUxBJmR1cj02MDAwMCZ0aWVy/DDHAAAAAAAAAP8ABQb/HPCt2w==" ,
539574 expected : scte35.SpliceInfoSection {
540575 SpliceCommand : & scte35.TimeSignal {
541576 SpliceTime : scte35.SpliceTime {
542- PTSTime : uint64ptr ( 7337557610 ),
577+ PTSTime : ptr ( uint64 ( 7337557610 ) ),
543578 },
544579 },
545580 SpliceDescriptors : scte35.SpliceDescriptors {
@@ -584,7 +619,7 @@ func TestDecodeBase64(t *testing.T) {
584619 },
585620 & scte35.SegmentationDescriptor {
586621 SegmentationEventID : uint32 (1074667978 ),
587- SegmentationDuration : uint64ptr ( 5412012 ),
622+ SegmentationDuration : ptr ( uint64 ( 5412012 ) ),
588623 SegmentationTypeID : scte35 .SegmentationTypeBreakStart ,
589624 DeliveryRestrictions : & scte35.DeliveryRestrictions {
590625 ArchiveAllowedFlag : true ,
@@ -599,7 +634,7 @@ func TestDecodeBase64(t *testing.T) {
599634 & scte35.SegmentationDescriptor {
600635 SegmentationEventID : uint32 (1074667990 ),
601636 SegmentationTypeID : 0x05 ,
602- SegmentationDuration : uint64ptr ( 5412012 ),
637+ SegmentationDuration : ptr ( uint64 ( 5412012 ) ),
603638 SegmentNum : 6 ,
604639 SegmentsExpected : 255 ,
605640 DeliveryRestrictions : & scte35.DeliveryRestrictions {
@@ -678,7 +713,7 @@ func TestDecodeHex(t *testing.T) {
678713 EncryptedPacket : scte35.EncryptedPacket {EncryptionAlgorithm : scte35 .EncryptionAlgorithmNone , CWIndex : 255 },
679714 SpliceCommand : & scte35.TimeSignal {
680715 SpliceTime : scte35.SpliceTime {
681- PTSTime : uint64ptr ( 0x072bd0050 ),
716+ PTSTime : ptr ( uint64 ( 0x072bd0050 ) ),
682717 },
683718 },
684719 SpliceDescriptors : []scte35.SpliceDescriptor {
@@ -690,7 +725,7 @@ func TestDecodeHex(t *testing.T) {
690725 },
691726 SegmentationEventID : uint32 (0x4800008e ),
692727 SegmentationTypeID : scte35 .SegmentationTypeProviderPOStart ,
693- SegmentationDuration : uint64ptr ( 0x0001a599b0 ),
728+ SegmentationDuration : ptr ( uint64 ( 0x0001a599b0 ) ),
694729 SegmentationUPIDs : []scte35.SegmentationUPID {
695730 scte35 .NewSegmentationUPID (scte35 .SegmentationUPIDTypeTI , toBytes (0x000000002ca0a18a )),
696731 },
@@ -714,7 +749,7 @@ func TestDecodeHex(t *testing.T) {
714749 OutOfNetworkIndicator : true ,
715750 Program : & scte35.SpliceInsertProgram {
716751 SpliceTime : scte35.SpliceTime {
717- PTSTime : uint64ptr ( 0x07369c02e ),
752+ PTSTime : ptr ( uint64 ( 0x07369c02e ) ),
718753 },
719754 },
720755 },
@@ -803,10 +838,6 @@ func toXML(sis *scte35.SpliceInfoSection) string {
803838 return string (b )
804839}
805840
806- func uint32ptr (i uint32 ) * uint32 {
807- return & i
808- }
809-
810- func uint64ptr (i uint64 ) * uint64 {
841+ func ptr [T any ](i T ) * T {
811842 return & i
812843}
0 commit comments