streaming

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

commit 5dcc7d4da3f8e457161ac23ad852fa6e014a8df5
parent 644fd6ef8abc28c7d2f45510e31c805fbe391592
Author: Oliver Lowe <o@olowe.co>
Date:   Tue, 11 Jun 2024 18:48:29 +1000

scte35: use maxTier where appropriate

One less magic number around the place. And remove the related TODO
comment; we do decode Splice.Tier as expected now.

Diffstat:
Mscte35/codec_test.go | 1-
Mscte35/scte35_test.go | 10+++++-----
Mscte35/splice.go | 2--
3 files changed, 5 insertions(+), 8 deletions(-)

diff --git a/scte35/codec_test.go b/scte35/codec_test.go @@ -39,7 +39,6 @@ func ExampleEncode() { duration := uint64(60 * 90000) // 60 seconds as 90KHz ticks splice := scte35.Splice{ SAPType: scte35.SAPNone, - Tier: 0x0fff, Command: &scte35.Command{ Type: scte35.TimeSignal, TimeSignal: &when, diff --git a/scte35/scte35_test.go b/scte35/scte35_test.go @@ -12,7 +12,7 @@ var samples = []sample{ encoded: "/DA0AAAAAAAA///wBQb+cr0AUAAeAhxDVUVJSAAAjn/PAAGlmbAICAAAAAAsoKGKNAIAmsnRfg==", want: Splice{ SAPType: SAPNone, - Tier: 0x0fff, + Tier: maxTier, CWIndex: 0xff, Command: &Command{ Type: TimeSignal, @@ -42,7 +42,7 @@ var samples = []sample{ want: Splice{ SAPType: SAPNone, CWIndex: 0xff, - Tier: 0x0fff, + Tier: maxTier, Command: &Command{ Type: SpliceInsert, Insert: &Insert{ @@ -68,7 +68,7 @@ var samples = []sample{ want: Splice{ SAPType: SAPNone, CWIndex: 0xff, - Tier: 0x0fff, + Tier: maxTier, Command: &Command{ Type: TimeSignal, TimeSignal: newuint64(0x0746290a0), @@ -95,7 +95,7 @@ var samples = []sample{ want: Splice{ SAPType: SAPNone, CWIndex: 0xff, - Tier: 0x0fff, + Tier: maxTier, Command: &Command{ Type: TimeSignal, TimeSignal: newuint64(0x07a4d88b6), @@ -131,7 +131,7 @@ var samples = []sample{ encoded: "/DBcAAAAAAAAAP/wBQb//ciI8QBGAh1DVUVJXQk9EX+fAQ5FUDAxODAzODQwMDY2NiEEZAIZQ1VFSV0JPRF/3wABLit7AQVDMTQ2NDABAQEKQ1VFSQCAMTUwKnPhdcU=", want: Splice{ SAPType: SAPNone, - Tier: 0x0fff, + Tier: maxTier, Command: &Command{ Type: TimeSignal, TimeSignal: newuint64(8552745201), diff --git a/scte35/splice.go b/scte35/splice.go @@ -177,8 +177,6 @@ func Decode(buf []byte) (*Splice, error) { splice.CWIndex = uint8(buf[6]) // want left-most 12 bits, remaining is used by command length. - // TODO(otl): still not getting expected values here; - // check TestDecode tier := binary.BigEndian.Uint16([]byte{buf[7], buf[8] & 0xf0}) splice.Tier = tier >> 4