Skip to content

Commit

Permalink
SCTE-35 spec 2023 (11/30) updates
Browse files Browse the repository at this point in the history
  • Loading branch information
futzu authored Dec 21, 2023
1 parent d8992ce commit 3c02dc3
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions threefive/descriptors.py
Original file line number Diff line number Diff line change
Expand Up @@ -243,6 +243,7 @@ def __init__(self, bites=None):
self.name = "Segmentation Descriptor"
self.segmentation_event_id = None
self.segmentation_event_cancel_indicator = None
self.segmentation_event_id_compliance_indicator = None
self.component_count = None
self.components = []
self.program_segmentation_flag = None
Expand Down Expand Up @@ -272,7 +273,8 @@ def decode(self):
bitbin = BitBin(self.bites)
self.segmentation_event_id = bitbin.as_hex(32) # 4 bytes
self.segmentation_event_cancel_indicator = bitbin.as_flag(1)
bitbin.forward(7) # 1 byte
self.segmentation_event_id_compliance_indicator = bitbin.as_flag(1)
bitbin.forward(6) # 1 byte
if not self.segmentation_event_cancel_indicator:
self._decode_flags(bitbin) # 1 byte
if not self.program_segmentation_flag:
Expand Down Expand Up @@ -318,7 +320,7 @@ def _decode_segmentation(self, bitbin):
def _decode_segments(self, bitbin):
self.segment_num = bitbin.as_int(8) # 1 byte
self.segments_expected = bitbin.as_int(8) # 1 byte
if self.segmentation_type_id in [0x34, 0x36, 0x38, 0x3A]:
if self.segmentation_type_id in [0x30,0x32,0x34, 0x36,0x38,0x3A,0x44,0x46]:
# if sub_segment_num and sub_segments_expected
# are not available set both of them to zero
# This has been an issue at CBS and CNN just recently.
Expand All @@ -337,7 +339,9 @@ def encode(self, nbin=None):
nbin = super().encode(nbin)
self._chk_var(str, nbin.add_hex, "segmentation_event_id", 32) # 4 bytes
self._chk_var(bool, nbin.add_flag, "segmentation_event_cancel_indicator", 1)
nbin.forward(7) # 1 byte
self._chk_var(bool, nbin.add_flag, "segmentation_event_id_compliance_indicator", 1)

nbin.forward(6) # 1 byte
if not self.segmentation_event_cancel_indicator:
self._encode_flags(nbin) # 1 byte
if not self.program_segmentation_flag:
Expand Down

0 comments on commit 3c02dc3

Please sign in to comment.