futzu/threefive

The SCTE35 "section_length" value is always 3 bytes less than the actual size

Closed this issue · 2 comments

I'm learning SCTE35 staff and I can't figure out one thing. Why is the length of "section_length" always less than 3 bytes from the actual size?
Example:

>>> test_raw = "/DAlAAAAAAAAAP/wFAUAAAZ5f+/+AAAAAH4Ae5igAAAAAAAA5nk27g=="
>>> test_cue = Cue(test_raw)
>>> test_cue.decode()
>>> test_cue.show()
"section_length": 37,

But if I will check len(test_cue.bites) will see 40:

>>> len(test_cue.bites)
40

I've already checked the documentation but did not find answer:

Probably some "header" that is not included in the "section_length". From the source of the lib i see that "section_length" calculation like this - # 11 bytes for info section + command + 2 descriptor loop length + descriptor loop + 4 for crc, but I`m still confused.

Сould someone please explain why we have this 3 byte difference in "section_length" and the actual size ?

Sorry, the question not related to the project

futzu commented

No problem man , that threw me for a while too.

(8 + 1 + 1 + 2 + 12 ) >> 3 = 3 bytes

image

Section Length is the number of bytes immediately following Section Length.
image

Does that make sense?

yep, it is clear now.
@futzu Thank you very much