streaming

Media streaming and broadcast systems in Go
Log | Files | Refs | README | LICENSE

scte35_test.go (4525B)


      1 package scte35
      2 
      3 type sample struct {
      4 	name    string
      5 	encoded string
      6 	want    Splice
      7 }
      8 
      9 var samples = []sample{
     10 	{
     11 		name:    "14.1. time_signal",
     12 		encoded: "/DA0AAAAAAAA///wBQb+cr0AUAAeAhxDVUVJSAAAjn/PAAGlmbAICAAAAAAsoKGKNAIAmsnRfg==",
     13 		want: Splice{
     14 			SAPType: SAPNone,
     15 			Tier:    maxTier,
     16 			CWIndex: 0xff,
     17 			Command: &Command{
     18 				Type:       TimeSignal,
     19 				TimeSignal: newuint64(0x072bd0050),
     20 			},
     21 			Descriptors: []SpliceDescriptor{
     22 				SegmentationDescriptor{
     23 					EventID:      0x4800008e,
     24 					idCompliance: true,
     25 					Restrictions: NoRegionalBlackout | ArchiveAllowed | DeviceRestrictionsNone,
     26 					Duration:     newuint64(0x0001a599b0),
     27 					UPID: UPID{
     28 						Type:  UPIDTI,
     29 						Value: []byte{0x00, 0x00, 0x00, 0x00, 0x2c, 0xa0, 0xa1, 0x8a},
     30 					},
     31 					Type:     ProviderPlacementOppStart,
     32 					Number:   2,
     33 					Expected: 0,
     34 				},
     35 			},
     36 			CRC32: 0x9ac9d17e,
     37 		},
     38 	},
     39 	{
     40 		name:    "14.2. splice_insert",
     41 		encoded: "/DAvAAAAAAAA///wFAVIAACPf+/+c2nALv4AUsz1AAAAAAAKAAhDVUVJAAABNWLbowo=",
     42 		want: Splice{
     43 			SAPType: SAPNone,
     44 			CWIndex: 0xff,
     45 			Tier:    maxTier,
     46 			Command: &Command{
     47 				Type: SpliceInsert,
     48 				Insert: &Insert{
     49 					ID:           0x4800008f,
     50 					idCompliance: true,
     51 					OutOfNetwork: true,
     52 					SpliceTime:   newuint64(0x07369c02e),
     53 					Duration: &BreakDuration{
     54 						AutoReturn: true,
     55 						Duration:   0x00052ccf5,
     56 					},
     57 				},
     58 			},
     59 			Descriptors: []SpliceDescriptor{
     60 				AvailDescriptor(0x00000135),
     61 			},
     62 			CRC32: 0x62dba30a,
     63 		},
     64 	},
     65 	{
     66 		name:    "14.3. time_signal",
     67 		encoded: "/DAvAAAAAAAA///wBQb+dGKQoAAZAhdDVUVJSAAAjn+fCAgAAAAALKChijUCAKnMZ1g=",
     68 		want: Splice{
     69 			SAPType: SAPNone,
     70 			CWIndex: 0xff,
     71 			Tier:    maxTier,
     72 			Command: &Command{
     73 				Type:       TimeSignal,
     74 				TimeSignal: newuint64(0x0746290a0),
     75 			},
     76 			Descriptors: []SpliceDescriptor{
     77 				SegmentationDescriptor{
     78 					EventID:      0x4800008e,
     79 					idCompliance: true,
     80 					Restrictions: WebDeliveryAllowed | NoRegionalBlackout | ArchiveAllowed | DeviceRestrictionsNone,
     81 					UPID: UPID{
     82 						Type:  UPIDTI,
     83 						Value: []byte{0x00, 0x00, 0x00, 0x00, 0x2c, 0xa0, 0xa1, 0x8a},
     84 					},
     85 					Type:   ProviderPlacementOppEnd,
     86 					Number: 2,
     87 				},
     88 			},
     89 			CRC32: 0xa9cc6758,
     90 		},
     91 	},
     92 	{
     93 		name:    "14.4. time_signal",
     94 		encoded: "/DBIAAAAAAAA///wBQb+ek2ItgAyAhdDVUVJSAAAGH+fCAgAAAAALMvDRBEAAAIXQ1VFSUgAABl/nwgIAAAAACyk26AQAACZcuND",
     95 		want: Splice{
     96 			SAPType: SAPNone,
     97 			CWIndex: 0xff,
     98 			Tier:    maxTier,
     99 			Command: &Command{
    100 				Type:       TimeSignal,
    101 				TimeSignal: newuint64(0x07a4d88b6),
    102 			},
    103 			Descriptors: []SpliceDescriptor{
    104 				SegmentationDescriptor{
    105 					EventID:      0x48000018,
    106 					Restrictions: WebDeliveryAllowed | NoRegionalBlackout | ArchiveAllowed | DeviceRestrictionsNone,
    107 					idCompliance: true,
    108 					UPID: UPID{
    109 						Type:  UPIDTI,
    110 						Value: []byte{0, 0, 0, 0, 0x2c, 0xcb, 0xc3, 0x44},
    111 					},
    112 					Type: ProgramEnd,
    113 				},
    114 				SegmentationDescriptor{
    115 					EventID:      0x48000019,
    116 					idCompliance: true,
    117 					Restrictions: WebDeliveryAllowed | NoRegionalBlackout | ArchiveAllowed | DeviceRestrictionsNone,
    118 					UPID: UPID{
    119 						Type:  UPIDTI,
    120 						Value: []byte{0, 0, 0, 0, 0x2c, 0xa4, 0xdb, 0xa0},
    121 					},
    122 					Type: ProgramStart,
    123 				},
    124 			},
    125 			CRC32: 0x9972e343,
    126 		},
    127 	},
    128 	{
    129 		// from "The Essential Guide to SCTE-35" by Bitmovin (https://bitmovin.com/scte-35-guide)
    130 		name:    "dtmf",
    131 		encoded: "/DBcAAAAAAAAAP/wBQb//ciI8QBGAh1DVUVJXQk9EX+fAQ5FUDAxODAzODQwMDY2NiEEZAIZQ1VFSV0JPRF/3wABLit7AQVDMTQ2NDABAQEKQ1VFSQCAMTUwKnPhdcU=",
    132 		want: Splice{
    133 			SAPType: SAPNone,
    134 			Tier:    maxTier,
    135 			Command: &Command{
    136 				Type:       TimeSignal,
    137 				TimeSignal: newuint64(8552745201),
    138 			},
    139 			Descriptors: []SpliceDescriptor{
    140 				SegmentationDescriptor{
    141 					EventID:      1560886545,
    142 					idCompliance: true,
    143 					Restrictions: WebDeliveryAllowed | NoRegionalBlackout | DeviceRestrictionsNone,
    144 					UPID: UPID{
    145 						Type:  UPIDType(1),
    146 						Value: []byte{69, 80, 48, 49, 56, 48, 51, 56, 52, 48, 48, 54, 54, 54},
    147 					},
    148 					Type:     ChapterEnd,
    149 					Number:   4,
    150 					Expected: 100,
    151 				},
    152 				SegmentationDescriptor{
    153 					EventID:      1560886545,
    154 					idCompliance: true,
    155 					Restrictions: WebDeliveryAllowed | NoRegionalBlackout | DeviceRestrictionsNone,
    156 					Duration:     newuint64(19803003),
    157 					UPID: UPID{
    158 						Type:  UPIDType(1),
    159 						Value: []byte{67, 49, 52, 54, 52},
    160 					},
    161 					Type:     ProviderAdStart,
    162 					Number:   1,
    163 					Expected: 1,
    164 				},
    165 				DTMFDescriptor{Chars: []byte("150*")},
    166 			},
    167 			CRC32: 1944155589,
    168 		},
    169 	},
    170 }