commit bc72cfd4e08026c5399b8e62231a837b517737b2
parent 386a8f0c0352952344a54b7cb170ee67d693b2be
Author: Oliver Lowe <o@olowe.co>
Date: Fri, 10 May 2024 17:07:28 +1000
internal/scte35: finish first working splice info decode
Only set CW Index when we're meant to (when packet is encrypted), and
extract the 12-bit tier value correctly; before we were setting a
whole uint16.
Diffstat:
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/internal/scte35/splice_info.go b/internal/scte35/splice_info.go
@@ -167,13 +167,15 @@ func decodeSpliceInfo(buf []byte) (*SpliceInfo, error) {
pts[4] = buf[5]
info.PTSAdjustment = binary.BigEndian.Uint64(pts)
- info.CWIndex = uint8(buf[6])
+ if info.Encrypted {
+ info.CWIndex = uint8(buf[6])
+ }
// want left-most 12 bits, remaining is used by command length.
// TODO(otl): still not getting expected values here;
// check TestDecodeSpliceInfo
tier := binary.BigEndian.Uint16([]byte{buf[7], buf[8] & 0xf0})
- info.Tier = tier
+ info.Tier = tier >> 4
// 4-bits out of buf[8], then all of buf[9] for a 12-bit integer.
cmdlen := binary.BigEndian.Uint16([]byte{buf[8] & 0x0f, buf[9]})