commit 62075fff1494e7d0497d6e3001df78b975fe2311
parent e0c941281a3edfd9fff650adfc1d09c29725cf64
Author: Oliver Lowe <o@olowe.co>
Date: Tue, 7 May 2024 17:43:01 +1000
internal/scte35: allocate enough bytes on encoding splice info
Diffstat:
1 file changed, 1 insertion(+), 20 deletions(-)
diff --git a/internal/scte35/splice_info.go b/internal/scte35/splice_info.go
@@ -56,7 +56,7 @@ const (
const maxTier uint16 = 0xfff
func encodeSpliceInfo(sis *SpliceInfo) ([]byte, error) {
- buf := make([]byte, 3)
+ buf := make([]byte, 5)
buf[0] = byte(tableID)
// next 2 bits (section_syntax_indicator, private_indicator) must be 0.
// 0b00000000
@@ -131,22 +131,3 @@ func packTier(tier uint16) [2]byte {
a[1] = byte(tier)
return a
}
-
-const DescriptorIDCUEI = 0x43554549 // "CUEI" in ASCII
-
-type SpliceDescriptor struct {
- Tag uint8
- // For private descriptors, this value must not be DescriptorIDCUEI.
- ID uint32
- Data []byte
-}
-
-func encodeSpliceDescriptor(sd *SpliceDescriptor) []byte {
- var buf []byte
- buf = append(buf, byte(sd.Tag))
- buf = append(buf, byte(len(sd.Data)))
- ibuf := make([]byte, 4) // uint32 length
- binary.LittleEndian.PutUint32(ibuf, sd.ID)
- buf = append(buf, ibuf...)
- return append(buf, sd.Data...)
-}