futzu / SCTE35_threefive

threefive is the one you want. threefive is the best SCTE-35 tool available. SCTE-35 Decoder, SCTE-35 Encoder, SCTE-35 Parser.
https://slow.golf
MIT License
136 stars 26 forks source link

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

Closed ishakhrai closed 1 year ago

ishakhrai commented 1 year ago

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 1 year ago

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?

ishakhrai commented 1 year ago

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