Replies: 32 comments 95 replies
-
@davemevans
<SegmentationUpid name="AiringID" segmentationUpidType="0x8" segmentationUpidFormat="hexbinary" segmentationUpidLength="8"/> |
Beta Was this translation helpful? Give feedback.
-
class Upid:
"""
Upid base class handles URI UPIDS
"""
def __init__(self, bitbin=None, upid_type=0, upid_length=0):
self.bitbin = bitbin
self.upid_type = upid_type
self.upid_name = upid_map[upid_type][0]
self.upid_length = upid_length
self.bit_length = upid_length << 3
self.upid_value = None
def decode(self):
"""
decode Upid
"""
self.upid_value = self.bitbin.as_charset(self.bit_length, charset)
return self.upid_name, self.upid_value
def encode(self, nbin ):
"""
encode Upid
"""
if self.upid.value:
self.upid.value = self.upid.value.encode("utf8")
nbin.add_bites(self.upid.value)
def xml(self):
"""
xml return a upid xml node
"""
ud_attrs = { 'name': self.upid_name, # this is for clarity
'segmentation_upid_type': hex(self.upid_type),
'segmentation_upid_format':'hexbinary',
'segmentation_upid_length':self.upid_length,}
return Node('SegmentationUpid',attrs= ud_attrs, value=self.upid_value) |
Beta Was this translation helpful? Give feedback.
-
This is easy, they all have the same vars
def xml(self):
"""
Create a Node describing a SegmentationDescriptor
"""
....
self.segmentation_upid_type = bitbin.as_int(8)
self.segmentation_upid_length = bitbin.as_int(8)
the_upid = self.mk_the_upid(bitbin=None)
# populate the upid's values
the_upid.upid_name= self.segmentation_upid_type_name # mk_the_upid passes segmentation_upid_type and length in already
the_upid.upid_value= self.segmentation_upid
# call the_upid.xml()
upid_node = the_upid.xml()
if isinstance(upid_node,list):
_=(sd.add_child(node) for node in upid_node)
else:
sd.add_child(upid_node)
......
def xml(self):
"""
xml return a upid xml node
"""
mid_nodes =[]
for u in self.upid_value:
u_attrs = ["upid_type": u['upid_type'],
"name": u['upid_type_name'],}
value= u["segmentation_upid"]
node= Node('SegmentationUpid', attrs=u_attrs, value=value)
mid_nodea.append(node)
return mid_nodes |
Beta Was this translation helpful? Give feedback.
-
Dave, <SpliceInfoSection ptsAdjustment="0" protocolVersion="0" sapType="3" tier="8" xmlns="http://www.scte.org/schemas/35">
<TimeSignal>
<SpliceTime ptsTime="3522714355"/>
</TimeSignal>
<SegmentationDescriptor segmentationEventId="1207959743" segmentationEventCancelIndicator="false" segmentationEventIdComplianceIndicator="true" segmentationTypeId="52" segmentNum="0" segmentsExpected="0" subSegmentNum="0" subSegmentsExpected="0" segmentationDuration="16317027">
<DeliveryRestrictions webDeliveryAllowedFlag="false" noRegionalBlackoutFlag="true" archiveAllowedFlag="true" deviceRestrictions="3"/>
<SegmentationUpid upidType="14" name="ADS Info">LA309</SegmentationUpid>
<SegmentationUpid upidType="8" name="AiringID">0x2e538481</SegmentationUpid>
</SegmentationDescriptor>
</SpliceInfoSection> |
Beta Was this translation helpful? Give feedback.
-
Most of the UPiDa are now working. Upid Xml output0x3 : ABCD0123456H
<SpliceInfoSection ptsAdjustment="0" protocolVersion="0" sapType="3" tier="4095" xmlns="http://www.scte.org/schemas/35">
<TimeSignal>
<SpliceTime ptsTime="0"/>
</TimeSignal>
<SegmentationDescriptor segmentationMessage="Program Start" segmentationEventId="3" segmentationEventCancelIndicator="false" segmentationEventIdComplianceIndicator="true" segmentationTypeId="16" segmentNum="0" segmentsExpected="0" segmentationDuration="2702700">
<SegmentationUpid name="AdID" segmentationUpidType="3" segmentationUpidFormat="hexbinary" segmentationUpidLength="12">ABCD0123456H</SegmentationUpid>
</SegmentationDescriptor>
</SpliceInfoSection>
0x6 : 0x3a8d000000000000
<SpliceInfoSection ptsAdjustment="0" protocolVersion="0" sapType="3" tier="4095" xmlns="http://www.scte.org/schemas/35">
<TimeSignal>
<SpliceTime ptsTime="0"/>
</TimeSignal>
<SegmentationDescriptor segmentationMessage="Program Start" segmentationEventId="6" segmentationEventCancelIndicator="false" segmentationEventIdComplianceIndicator="true" segmentationTypeId="16" segmentNum="0" segmentsExpected="0" segmentationDuration="2702700">
<SegmentationUpid name="ISAN" segmentationUpidType="6" segmentationUpidFormat="hexbinary" segmentationUpidLength="12">0x3a8d000000000000</SegmentationUpid>
</SegmentationDescriptor>
</SpliceInfoSection>
0x7 : MV0004146400
<SpliceInfoSection ptsAdjustment="0" protocolVersion="0" sapType="3" tier="4095" xmlns="http://www.scte.org/schemas/35">
<TimeSignal>
<SpliceTime ptsTime="0"/>
</TimeSignal>
<SegmentationDescriptor segmentationMessage="Program End" segmentationEventId="3" segmentationEventCancelIndicator="false" segmentationEventIdComplianceIndicator="true" segmentationTypeId="17" segmentNum="0" segmentsExpected="0">
<SegmentationUpid name="TID" segmentationUpidType="7" segmentationUpidFormat="hexbinary" segmentationUpidLength="12">MV0004146400</SegmentationUpid>
</SegmentationDescriptor>
</SpliceInfoSection>
0xe : ADS-UPID:aa85bbb6-5c43-4b6a-bebb-ee3b13eb7999
<SpliceInfoSection ptsAdjustment="0" protocolVersion="0" sapType="3" tier="4095" xmlns="http://www.scte.org/schemas/35">
<TimeSignal>
<SpliceTime ptsTime="0"/>
</TimeSignal>
<SegmentationDescriptor segmentationMessage="Program End" segmentationEventId="11" segmentationEventCancelIndicator="false" segmentationEventIdComplianceIndicator="true" segmentationTypeId="17" segmentNum="0" segmentsExpected="0">
<SegmentationUpid name="ADS Info" segmentationUpidType="14" segmentationUpidFormat="hexbinary" segmentationUpidLength="45">ADS-UPID:aa85bbb6-5c43-4b6a-bebb-ee3b13eb7999</SegmentationUpid>
</SegmentationDescriptor>
</SpliceInfoSection>
0x4 : 060a2b34.01010105.01010d20.13000000.d2c9036c.8f195343.ab7014d2
<SpliceInfoSection ptsAdjustment="0" protocolVersion="0" sapType="3" tier="4095" xmlns="http://www.scte.org/schemas/35">
<TimeSignal>
<SpliceTime ptsTime="0"/>
</TimeSignal>
<SegmentationDescriptor segmentationMessage="None" segmentationEventId="3" segmentationEventCancelIndicator="false" segmentationEventIdComplianceIndicator="true" segmentationTypeId="215" segmentNum="None" segmentsExpected="None">
<SegmentationUpid name="UMID" segmentationUpidType="4" segmentationUpidFormat="hexbinary" segmentationUpidLength="32">060a2b34.01010105.01010d20.13000000.d2c9036c.8f195343.ab7014d2</SegmentationUpid>
</SegmentationDescriptor>
</SpliceInfoSection>
0xd : [{'upid_type': 14, 'upid_type_name': 'ADS Info', 'upid_length': 5, 'segmentation_upid': 'LA309'}, {'upid_type': 8, 'upid_type_name': 'AiringID', 'upid_length': 8, 'segmentation_upid': '0x2e538481'}]
<SpliceInfoSection ptsAdjustment="0" protocolVersion="0" sapType="3" tier="8" xmlns="http://www.scte.org/schemas/35">
<TimeSignal>
<SpliceTime ptsTime="3522714355"/>
</TimeSignal>
<SegmentationDescriptor segmentationMessage="Provider Placement Opportunity Start" segmentationEventId="1207959743" segmentationEventCancelIndicator="false" segmentationEventIdComplianceIndicator="true" segmentationTypeId="52" segmentNum="0" segmentsExpected="0" subSegmentNum="0" subSegmentsExpected="0" segmentationDuration="16317027">
<DeliveryRestrictions webDeliveryAllowedFlag="false" noRegionalBlackoutFlag="true" archiveAllowedFlag="true" deviceRestrictions="3"/>
<SegmentationUpid upidType="14" upidTypeName="ADS Info">LA309</SegmentationUpid>
<SegmentationUpid upidType="8" upidTypeName="AiringID">0x2e538481</SegmentationUpid>
</SegmentationDescriptor>
</SpliceInfoSection>
0x8 : 0x072d08c7
0xc : {'format_identifier': 'RTLN', 'private_data': '0x3148010000000031333736393230323534343935483100'}
<SpliceInfoSection ptsAdjustment="0" protocolVersion="0" sapType="3" tier="4095" xmlns="http://www.scte.org/schemas/35">
<TimeSignal>
<SpliceTime ptsTime="5469869394"/>
</TimeSignal>
<SegmentationDescriptor segmentationMessage="Provider Advertisement End" segmentationEventId="1859042901" segmentationEventCancelIndicator="false" segmentationEventIdComplianceIndicator="true" segmentationTypeId="49" segmentNum="11" segmentsExpected="25">
<SegmentationUpid name="AiringID" segmentationUpidType="8" segmentationUpidFormat="hexbinary" segmentationUpidLength="8">0x072d08c7</SegmentationUpid>
</SegmentationDescriptor>
<SegmentationDescriptor segmentationMessage="Distributor Placement Opportunity End" segmentationEventId="1858902152" segmentationEventCancelIndicator="false" segmentationEventIdComplianceIndicator="true" segmentationTypeId="55" segmentNum="1" segmentsExpected="1">
<SegmentationUpid name="AiringID" segmentationUpidType="8" segmentationUpidFormat="hexbinary" segmentationUpidLength="8">0x011836b21611</SegmentationUpid>
</SegmentationDescriptor>
<SegmentationDescriptor segmentationMessage="Provider Advertisement Start" segmentationEventId="1859063048" segmentationEventCancelIndicator="false" segmentationEventIdComplianceIndicator="true" segmentationTypeId="48" segmentNum="12" segmentsExpected="25" subSegmentNum="2" subSegmentsExpected="42" segmentationDuration="1821600">
<SegmentationUpid name="AiringID" segmentationUpidType="8" segmentationUpidFormat="hexbinary" segmentationUpidLength="8">0x072d5612</SegmentationUpid>
</SegmentationDescriptor>
<SegmentationDescriptor segmentationMessage="Content Identification" segmentationEventId="1859063094" segmentationEventCancelIndicator="false" segmentationEventIdComplianceIndicator="true" segmentationTypeId="1" segmentNum="0" segmentsExpected="0">
<SegmentationUpid name="MPU" segmentationUpidType="12" segmentationUpidFormat="hexbinary" segmentationUpidLength="27">{'format_identifier': 'RTLN', 'private_data': '0x3148010000000031333736393230323534343935483100'}</SegmentationUpid>
</SegmentationDescriptor>
</SpliceInfoSection>
0xb : {'TSID': 241, 'reserved': 3, 'end_of_day': 23, 'unique_for': 511, 'content_id': 'human012'}
<SpliceInfoSection ptsAdjustment="0" protocolVersion="0" sapType="3" tier="4095" xmlns="http://www.scte.org/schemas/35">
<TimeSignal>
<SpliceTime ptsTime="0"/>
</TimeSignal>
<SegmentationDescriptor segmentationMessage="Program Start" segmentationEventId="3" segmentationEventCancelIndicator="false" segmentationEventIdComplianceIndicator="true" segmentationTypeId="16" segmentNum="0" segmentsExpected="0" segmentationDuration="2702700">
<SegmentationUpid name="ATSC" segmentationUpidType="11" segmentationUpidFormat="hexbinary" segmentationUpidLength="12">{'TSID': 241, 'reserved': 3, 'end_of_day': 23, 'unique_for': 511, 'content_id': 'human012'}</SegmentationUpid>
</SegmentationDescriptor>
</SpliceInfoSection>
<SpliceInfoSection ptsAdjustment="0" protocolVersion="0" sapType="3" tier="4095" xmlns="http://www.scte.org/schemas/35">
<TimeSignal>
<SpliceTime ptsTime="2832024813"/>
</TimeSignal>
<SegmentationDescriptor segmentationMessage="Provider Placement Opportunity End" segmentationEventId="1207959725" segmentationEventCancelIndicator="false" segmentationEventIdComplianceIndicator="true" segmentationTypeId="53" segmentNum="2" segmentsExpected="0">
<DeliveryRestrictions webDeliveryAllowedFlag="true" noRegionalBlackoutFlag="true" archiveAllowedFlag="true" deviceRestrictions="3"/>
<SegmentationUpid name="AiringID" segmentationUpidType="8" segmentationUpidFormat="hexbinary" segmentationUpidLength="8">0x2cb2d79d</SegmentationUpid>
</SegmentationDescriptor>
<SegmentationDescriptor segmentationMessage="Program End" segmentationEventId="1207959590" segmentationEventCancelIndicator="false" segmentationEventIdComplianceIndicator="true" segmentationTypeId="17" segmentNum="0" segmentsExpected="0">
<DeliveryRestrictions webDeliveryAllowedFlag="true" noRegionalBlackoutFlag="true" archiveAllowedFlag="true" deviceRestrictions="3"/>
<SegmentationUpid name="AiringID" segmentationUpidType="8" segmentationUpidFormat="hexbinary" segmentationUpidLength="8">0x2cb2d79d</SegmentationUpid>
</SegmentationDescriptor>
<SegmentationDescriptor segmentationMessage="Program Start" segmentationEventId="1207959591" segmentationEventCancelIndicator="false" segmentationEventIdComplianceIndicator="true" segmentationTypeId="16" segmentNum="0" segmentsExpected="0">
<DeliveryRestrictions webDeliveryAllowedFlag="true" noRegionalBlackoutFlag="true" archiveAllowedFlag="true" deviceRestrictions="3"/>
<SegmentationUpid name="AiringID" segmentationUpidType="8" segmentationUpidFormat="hexbinary" segmentationUpidLength="8">0x2cb2d7b3</SegmentationUpid>
</SegmentationDescriptor>
</SpliceInfoSection>
0x9 : SIGNAL:3-sQ4NgFT0OjPsG4WqUQow
<SpliceInfoSection ptsAdjustment="0" protocolVersion="0" sapType="3" tier="4095" xmlns="http://www.scte.org/schemas/35">
<TimeSignal>
<SpliceTime ptsTime="5400000"/>
</TimeSignal>
<SegmentationDescriptor segmentationMessage="Provider Placement Opportunity End" segmentationEventId="1644168586" segmentationEventCancelIndicator="false" segmentationEventIdComplianceIndicator="true" segmentationTypeId="53" segmentNum="0" segmentsExpected="0">
<SegmentationUpid name="ADI" segmentationUpidType="9" segmentationUpidFormat="hexbinary" segmentationUpidLength="29">SIGNAL:3-sQ4NgFT0OjPsG4WqUQow</SegmentationUpid>
</SegmentationDescriptor>
</SpliceInfoSection>
0xa : 0x1478f85ae100b0685b8fb1c8
<SpliceInfoSection ptsAdjustment="0" protocolVersion="0" sapType="3" tier="4095" xmlns="http://www.scte.org/schemas/35">
<TimeSignal>
<SpliceTime ptsTime="0"/>
</TimeSignal>
<SegmentationDescriptor segmentationMessage="Program Start" segmentationEventId="3" segmentationEventCancelIndicator="false" segmentationEventIdComplianceIndicator="true" segmentationTypeId="16" segmentNum="0" segmentsExpected="0" segmentationDuration="2702700">
<SegmentationUpid name="EIDR" segmentationUpidType="10" segmentationUpidFormat="hexbinary" segmentationUpidLength="12">0x1478f85ae100b0685b8fb1c8</SegmentationUpid>
</SegmentationDescriptor>
</SpliceInfoSection>
0xf : urn:uuid:aa85bbb6-5c43-4b6a-bebb-ee3b13eb7999
<SpliceInfoSection ptsAdjustment="0" protocolVersion="0" sapType="3" tier="4095" xmlns="http://www.scte.org/schemas/35">
<TimeSignal>
<SpliceTime ptsTime="0"/>
</TimeSignal>
<SegmentationDescriptor segmentationMessage="Program Start" segmentationEventId="10" segmentationEventCancelIndicator="false" segmentationEventIdComplianceIndicator="true" segmentationTypeId="16" segmentNum="0" segmentsExpected="0" segmentationDuration="2700000">
<SegmentationUpid name="URI" segmentationUpidType="15" segmentationUpidFormat="hexbinary" segmentationUpidLength="45">urn:uuid:aa85bbb6-5c43-4b6a-bebb-ee3b13eb7999</SegmentationUpid>
</SegmentationDescriptor>
</SpliceInfoSection> |
Beta Was this translation helpful? Give feedback.
-
@davemevans we still need to do the other Splice Commands, Splice Null, Private, and BandwidthReservatiuon. |
Beta Was this translation helpful? Give feedback.
-
Here's an updated private command class class PrivateCommand(SpliceCommand):
"""
Table 13 - private_command
"""
def __init__(self, bites=None):
super().__init__(bites)
self.command_type = 255
self.name = "Private Command"
self.identifier = None
self.private_bytes = None
def decode(self):
"""
PrivateCommand.decode method
"""
self.identifier = int.from_bytes(
self.bites[0:3], byteorder="big"
) # 3 bytes = 24 bits
self.command_length = len(self.bites)
self.private_bytes = self.bites[3:]
def encode(self, nbin=None):
"""
encode private command
"""
nbin = self._chk_nbin(nbin)
self._chk_var(int, nbin.add_int, "identifier", 24) # 3 bytes = 24 bits
nbin.add_bites(self.private_bytes)
return nbin.bites
|
Beta Was this translation helpful? Give feedback.
-
I need cue.py, where are you at on the comment class? |
Beta Was this translation helpful? Give feedback.
-
@davemevans , going forward, if you see a problem bring it up and let's decide the plan before you do a pull request. |
Beta Was this translation helpful? Give feedback.
-
@davemevans We've added a little over 400 lines of code, xml.py is almost 300 of them. I it's a new ability, it should require code. |
Beta Was this translation helpful? Give feedback.
-
Current Cyclomatic Complexity Scorea@fu:~/build/SCTE35_threefive$ radon cc -sa threefive
threefive/packetdata.py
C 8:0 PacketData - A (3)
M 21:4 PacketData.mk_pcr - A (2)
M 31:4 PacketData.mk_pts - A (2)
M 15:4 PacketData.__init__ - A (1)
threefive/upids.py
C 151:0 Eidr - A (3)
C 201:0 Mid - A (3)
M 242:4 Mid.xml - A (3)
C 303:0 Umid - A (3)
C 23:0 Upid - A (2)
M 43:4 Upid.encode - A (2)
C 63:0 NoUpid - A (2)
C 91:0 AirId - A (2)
C 121:0 Atsc - A (2)
M 156:4 Eidr.decode - A (2)
M 170:4 Eidr.encode - A (2)
C 182:0 Isan - A (2)
M 206:4 Mid.decode - A (2)
M 230:4 Mid.encode - A (2)
C 262:0 Mpu - A (2)
M 280:4 Mpu.decode - A (2)
M 308:4 Umid.decode - A (2)
M 320:4 Umid.encode - A (2)
M 28:4 Upid.__init__ - A (1)
M 36:4 Upid.decode - A (1)
M 51:4 Upid.xml - A (1)
M 68:4 NoUpid.decode - A (1)
M 74:4 NoUpid.encode - A (1)
M 80:4 NoUpid.xml - A (1)
M 96:4 AirId.decode - A (1)
M 103:4 AirId.encode - A (1)
M 109:4 AirId.xml - A (1)
M 126:4 Atsc.decode - A (1)
M 140:4 Atsc.encode - A (1)
M 187:4 Isan.decode - A (1)
M 194:4 Isan.encode - A (1)
M 267:4 Mpu._decode_adfr - A (1)
M 292:4 Mpu.encode - A (1)
threefive/decode.py
F 27:0 _read_stuff - A (3)
F 43:0 decode - A (3)
threefive/encode.py
F 49:0 mk_splice_insert - A (3)
F 24:0 mk_time_signal - A (2)
F 12:0 mk_splice_null - A (1)
threefive/smoketest.py
F 33:0 smoke - A (4)
F 24:0 _decode_test - A (2)
threefive/stream.py
M 544:4 Stream._parse_scte35 - B (8)
M 568:4 Stream._parse_sdt - B (7)
M 332:4 Stream.show - B (6)
M 470:4 Stream._parse_tables - B (6)
M 625:4 Stream._parse_pmt - B (6)
M 220:4 Stream._find_start - A (5)
M 265:4 Stream.decode_fu - A (5)
M 278:4 Stream.decode_next - A (5)
M 352:4 Stream.show_pts - A (5)
M 497:4 Stream._parse - A (5)
M 250:4 Stream.decode - A (4)
M 317:4 Stream.proxy - A (4)
M 431:4 Stream._parse_pts - A (4)
M 604:4 Stream._parse_pat - A (4)
C 39:0 ProgramInfo - A (3)
M 53:4 ProgramInfo.show - A (3)
C 116:0 Stream - A (3)
M 405:4 Stream._unpad - A (3)
M 421:4 Stream._parse_cc - A (3)
M 514:4 Stream._same_as_last - A (3)
M 677:4 Stream._set_scte35_pids - A (3)
C 78:0 Pids - A (2)
C 96:0 Maps - A (2)
M 136:4 Stream.__init__ - A (2)
M 214:4 Stream._split_by_idx - A (2)
M 244:4 Stream._mk_pkts - A (2)
M 309:4 Stream.decode_start_time - A (2)
M 370:4 Stream.pid2prgm - A (2)
M 380:4 Stream.pid2pts - A (2)
M 390:4 Stream.pid2pcr - A (2)
M 400:4 Stream._unpad_afc - A (2)
M 449:4 Stream._parse_pcr - A (2)
M 459:4 Stream._parse_payload - A (2)
M 487:4 Stream._parse_info - A (2)
M 509:4 Stream._chk_partial - A (2)
M 521:4 Stream._section_incomplete - A (2)
M 528:4 Stream._parse_cue - A (2)
M 536:4 Stream._strip_scte35_pes - A (2)
M 652:4 Stream._parse_program_streams - A (2)
F 15:0 no_op - A (1)
F 23:0 show_cue - A (1)
F 31:0 show_cue_stderr - A (1)
M 46:4 ProgramInfo.__init__ - A (1)
M 86:4 Pids.__init__ - A (1)
M 106:4 Maps.__init__ - A (1)
M 160:4 Stream.__repr__ - A (1)
M 164:4 Stream.as_90k - A (1)
M 171:4 Stream._pusi_flag - A (1)
M 175:4 Stream._afc_flag - A (1)
M 179:4 Stream._pcr_flag - A (1)
M 183:4 Stream._spi_flag - A (1)
M 187:4 Stream._pts_flag - A (1)
M 192:4 Stream._parse_length - A (1)
M 199:4 Stream._parse_pid - A (1)
M 207:4 Stream._parse_program - A (1)
M 238:4 Stream.iter_pkts - A (1)
M 292:4 Stream.decode_program - A (1)
M 300:4 Stream.decode_pids - A (1)
M 364:4 Stream.pts - A (1)
M 414:4 Stream._mk_packet_data - A (1)
M 667:4 Stream._parse_stream_type - A (1)
threefive/commands.py
M 203:4 SpliceInsert.decode - A (5)
M 229:4 SpliceInsert.encode - A (5)
M 263:4 SpliceInsert.xml - A (5)
C 172:0 SpliceInsert - A (4)
M 143:4 TimeSignal._encode_splice_time - A (3)
M 295:4 SpliceInsert.from_xml - A (3)
C 10:0 SpliceCommand - A (2)
C 41:0 BandwidthReservation - A (2)
C 57:0 PrivateCommand - A (2)
C 90:0 SpliceNull - A (2)
C 101:0 TimeSignal - A (2)
M 131:4 TimeSignal._splice_time - A (2)
M 157:4 TimeSignal.xml - A (2)
M 167:4 TimeSignal.from_xml - A (2)
M 15:4 SpliceCommand.__init__ - A (1)
M 21:4 SpliceCommand.decode - A (1)
M 26:4 SpliceCommand._set_len - A (1)
M 33:4 SpliceCommand.encode - A (1)
M 46:4 BandwidthReservation.__init__ - A (1)
M 51:4 BandwidthReservation.decode - A (1)
M 62:4 PrivateCommand.__init__ - A (1)
M 69:4 PrivateCommand.decode - A (1)
M 80:4 PrivateCommand.encode - A (1)
M 95:4 SpliceNull.__init__ - A (1)
M 106:4 TimeSignal.__init__ - A (1)
M 113:4 TimeSignal.decode - A (1)
M 122:4 TimeSignal.encode - A (1)
M 177:4 SpliceInsert.__init__ - A (1)
M 194:4 SpliceInsert.decode_break_duration - A (1)
M 254:4 SpliceInsert.encode_break_duration - A (1)
threefive/xml.py
M 130:4 Node.mk - B (6)
F 26:0 un_xml - A (5)
M 217:4 XmlParser._mk_attrs - A (5)
F 42:0 iter_attrs - A (4)
F 17:0 un_camel - A (3)
F 53:0 val2xml - A (3)
C 82:0 Node - A (3)
M 116:4 Node.set_depth - A (3)
C 166:0 Comment - A (3)
C 174:0 XmlParser - A (3)
M 190:4 XmlParser._chk_node_list - A (3)
M 239:4 XmlParser._parse_nodes - A (3)
M 246:4 XmlParser._parse_most - A (3)
F 64:0 key2xml - A (2)
F 74:0 mk_xml_attrs - A (2)
M 104:4 Node.__init__ - A (2)
M 167:4 Comment.mk - A (2)
M 199:4 XmlParser._mk_value - A (2)
M 228:4 XmlParser.parse - A (2)
M 264:4 XmlParser._parse_descriptor - A (2)
F 8:0 t2s - A (1)
M 113:4 Node.__repr__ - A (1)
M 126:4 Node._get_indent - A (1)
M 153:4 Node.add_child - A (1)
M 159:4 Node.add_comment - A (1)
M 186:4 XmlParser.__init__ - A (1)
M 210:4 XmlParser._mk_active - A (1)
threefive/stuff.py
F 8:0 print2 - A (1)
threefive/cue.py
M 144:4 Cue._mk_bits - B (7)
M 103:4 Cue.get - A (5)
M 412:4 Cue.xml - A (5)
M 319:4 Cue.load_descriptors - A (4)
M 334:4 Cue.load - A (4)
M 366:4 Cue._xml_splice_command - A (4)
C 25:0 Cue - A (3)
M 89:4 Cue._descriptor_loop - A (3)
M 280:4 Cue._unloop_descriptors - A (3)
M 306:4 Cue.load_command - A (3)
M 374:4 Cue._xml_splice_descriptor - A (3)
M 387:4 Cue._xml_event_signal - A (3)
M 393:4 Cue.from_xml - A (3)
M 55:4 Cue.__init__ - A (2)
M 74:4 Cue.decode - A (2)
M 121:4 Cue.get_descriptors - A (2)
M 136:4 Cue.fix_bad_b64 - A (2)
M 173:4 Cue._mk_descriptors - A (2)
M 198:4 Cue._set_splice_command - A (2)
M 296:4 Cue.load_info_section - A (2)
M 361:4 Cue._xml_splice_info_section - A (2)
M 69:4 Cue.__repr__ - A (1)
M 128:4 Cue.get_json - A (1)
M 187:4 Cue.mk_info_section - A (1)
M 213:4 Cue.show - A (1)
M 221:4 Cue.encode - A (1)
M 245:4 Cue.encode_as_int - A (1)
M 252:4 Cue.encode2int - A (1)
M 258:4 Cue.encode_as_hex - A (1)
M 265:4 Cue.encode2hex - A (1)
M 272:4 Cue._encode_crc - A (1)
threefive/base.py
M 139:4 SCTE35Base.load - A (5)
M 26:4 SCTE35Base._chk_var - A (3)
M 87:4 SCTE35Base.kv_clean - A (3)
C 9:0 SCTE35Base - A (2)
M 21:4 SCTE35Base._chk_nbin - A (2)
M 54:4 SCTE35Base.as_hms - A (2)
M 105:4 SCTE35Base.has - A (2)
M 126:4 SCTE35Base.idxsplit - A (2)
M 17:4 SCTE35Base.__repr__ - A (1)
M 40:4 SCTE35Base.as_90k - A (1)
M 47:4 SCTE35Base.as_ticks - A (1)
M 68:4 SCTE35Base.fix_hex - A (1)
M 74:4 SCTE35Base.get - A (1)
M 80:4 SCTE35Base.get_json - A (1)
M 113:4 SCTE35Base.xml - A (1)
threefive/segment.py
M 119:4 Segment.decode - B (6)
M 57:4 Segment.__init__ - A (4)
C 16:0 Segment - A (3)
M 109:4 Segment.show_cue - A (2)
M 77:4 Segment.__repr__ - A (1)
M 80:4 Segment._mk_tmp - A (1)
M 84:4 Segment._aes_get_key - A (1)
M 88:4 Segment._aes_decrypt - A (1)
M 95:4 Segment._add_cue - A (1)
M 102:4 Segment.shushed - A (1)
threefive/bitn.py
C 8:0 BitBin - A (2)
M 29:4 BitBin.as_int - A (2)
M 47:4 BitBin.as_charset - A (2)
C 93:0 NBin - A (2)
M 127:4 NBin.add_int - A (2)
M 145:4 NBin.add_hex - A (2)
M 168:4 NBin.reserve - A (2)
M 185:4 NBin.zeroed - A (2)
M 16:4 BitBin.__init__ - A (1)
M 21:4 BitBin.as_90k - A (1)
M 39:4 BitBin.as_hex - A (1)
M 62:4 BitBin.as_bytes - A (1)
M 71:4 BitBin.as_flag - A (1)
M 77:4 BitBin.forward - A (1)
M 84:4 BitBin.negative_shift - A (1)
M 101:4 NBin.__init__ - A (1)
M 106:4 NBin.nbits2bites - A (1)
M 117:4 NBin.add_bites - A (1)
M 136:4 NBin.add_90k - A (1)
M 159:4 NBin.add_flag - A (1)
M 179:4 NBin.forward - A (1)
threefive/descriptors.py
M 469:4 SegmentationDescriptor.xml - B (6)
M 516:4 SegmentationDescriptor.from_xml - A (5)
M 69:4 SpliceDescriptor.encode - A (4)
F 12:0 k_by_v - A (3)
C 22:0 SpliceDescriptor - A (3)
C 299:0 SegmentationDescriptor - A (3)
M 367:4 SegmentationDescriptor._decode_segmentation - A (3)
M 380:4 SegmentationDescriptor._chk_sub_segments - A (3)
M 458:4 SegmentationDescriptor._encode_segments - A (3)
F 551:0 splice_descriptor - A (2)
M 39:4 SpliceDescriptor.parse_tag_and_len - A (2)
M 50:4 SpliceDescriptor.parse_id - A (2)
M 61:4 SpliceDescriptor.decode - A (2)
C 92:0 DVBDASDescriptor - A (2)
M 111:4 DVBDASDescriptor.decode - A (2)
C 142:0 AvailDescriptor - A (2)
M 176:4 AvailDescriptor.from_xml - A (2)
C 184:0 DtmfDescriptor - A (2)
M 207:4 DtmfDescriptor.encode - A (2)
M 234:4 DtmfDescriptor.from_xml - A (2)
C 244:0 TimeDescriptor - A (2)
M 291:4 TimeDescriptor.from_xml - A (2)
M 342:4 SegmentationDescriptor.decode - A (2)
M 355:4 SegmentationDescriptor._decode_flags - A (2)
M 389:4 SegmentationDescriptor._decode_segments - A (2)
M 401:4 SegmentationDescriptor.encode - A (2)
M 419:4 SegmentationDescriptor._encode_flags - A (2)
M 432:4 SegmentationDescriptor.mk_the_upid - A (2)
M 446:4 SegmentationDescriptor._encode_segmentation - A (2)
M 29:4 SpliceDescriptor.__init__ - A (1)
M 83:4 SpliceDescriptor._encode_id - A (1)
M 97:4 DVBDASDescriptor.__init__ - A (1)
M 128:4 DVBDASDescriptor.encode - A (1)
M 147:4 AvailDescriptor.__init__ - A (1)
M 154:4 AvailDescriptor.decode - A (1)
M 161:4 AvailDescriptor.encode - A (1)
M 169:4 AvailDescriptor.xml - A (1)
M 189:4 DtmfDescriptor.__init__ - A (1)
M 198:4 DtmfDescriptor.decode - A (1)
M 221:4 DtmfDescriptor.xml - A (1)
M 249:4 TimeDescriptor.__init__ - A (1)
M 258:4 TimeDescriptor.decode - A (1)
M 267:4 TimeDescriptor.encode - A (1)
M 277:4 TimeDescriptor.xml - A (1)
M 315:4 SegmentationDescriptor.__init__ - A (1)
threefive/streamtypes.py
F 105:0 add_stream_types - A (2)
F 116:0 mk_streamtype_map - A (2)
F 98:0 hex_literal - A (1)
threefive/crc.py
F 16:0 _bytecrc - A (2)
F 25:0 _mk_table - A (2)
F 31:0 crc32 - A (2)
F 44:0 crc32hex - A (1)
threefive/section.py
M 116:4 SpliceInfoSection._encode_encrypted - A (3)
M 150:4 SpliceInfoSection._encode_splice_command - A (3)
M 196:4 SpliceInfoSection.from_xml - A (3)
C 20:0 SpliceInfoSection - A (2)
M 45:4 SpliceInfoSection.decode - A (2)
M 91:4 SpliceInfoSection._encode_sap - A (2)
M 100:4 SpliceInfoSection._encode_section_length - A (2)
M 108:4 SpliceInfoSection._encode_protocol_version - A (2)
M 134:4 SpliceInfoSection._encode_cw_index - A (2)
M 142:4 SpliceInfoSection._encode_tier - A (2)
M 26:4 SpliceInfoSection.__init__ - A (1)
M 70:4 SpliceInfoSection._encode_table_id - A (1)
M 77:4 SpliceInfoSection._encode_section_syntax_indicator - A (1)
M 84:4 SpliceInfoSection._encode_private_flag - A (1)
M 128:4 SpliceInfoSection._encode_pts_adjustment - A (1)
M 162:4 SpliceInfoSection.encode - A (1)
M 182:4 SpliceInfoSection.xml - A (1)
309 blocks (classes, functions, methods) analyzed.
Average complexity: A (2.087378640776699) <------Boom goes the dynamite.,
a@fu:~/build/SCTE35_threefive$ That's a sweet score python 3.11 scored : A (3.076061694485527) . We beat python. |
Beta Was this translation helpful? Give feedback.
-
We need a hard target for the next release. I think Dash is not clear, the info is spread out every, and I'm tired of guessing. What we can do , fairly easily, is meet the SCTE-35 XML spec, so let's finish that up, cool? It's on the way to DASH anyway. If there is something you want to work on, just call it. If you got a question, just ask it. Everybody Cue, InfoSection, all the SpliceCommands, all the Descriptors, and all the UPIDS need a xml() method that returns a Node Instance and a from_xml(stuff) that loads from the dict stuff. |
Beta Was this translation helpful? Give feedback.
-
@davemevans they mention timestamps in ID3tags for TimeDescriptors, I've just about finished that. |
Beta Was this translation helpful? Give feedback.
-
upids with verified working xml()
|
Beta Was this translation helpful? Give feedback.
-
@davemevans , you got to shorten these names up , unescape_special_chars, you sound like a damn dot Net programmer :) unescape and escape or something is fine by me , I mean most of my vars are named "stuff" or "data", |
Beta Was this translation helpful? Give feedback.
-
@davemevans I'm going to do release on Wednesday I think.as long as what is working is stable, even if some of the UPIDs are not complete. |
Beta Was this translation helpful? Give feedback.
-
Upids: with a working from_xml() and xml() 0x0 : No Upid
0x1 : Deprecated
0x2: Deprecated
0x3 : AdID
0x4 : UMID
0x6 : ISAN
0x7 : TID
0x8 : AiringID
0x9 : ADI
0xa : EIDR
0xe : ADS Info
0xf : URI UPIDS with just a working xml() 0xb : ATSC
0xc : MPU
0xd : MID I am okay with that for this release. |
Beta Was this translation helpful? Give feedback.
-
Howw about you tune xml.py ? cyclomatic complexity needs to be closer to 2 , do what you can, don't let it make you crazy. pylint score needs to be over 9.75 python3 -mpip install radon
a@fu:~/build/SCTE35_threefive$ radon cc -sa threefive/xml.py threefive/xml.py
M 160:4 Node.mk - B (6)
F 26:0 un_xml - A (5)
M 248:4 XmlParser.mk_attrs - A (5)
F 42:0 iter_attrs - A (4)
M 271:4 XmlParser._parse_nodes - A (4)
F 17:0 un_camel - A (3)
F 53:0 val2xml - A (3)
F 90:0 escape - A (3)
F 101:0 unescape - A (3)
C 112:0 Node - A (3)
M 146:4 Node.set_depth - A (3)
C 195:0 Comment - A (3)
C 204:0 XmlParser - A (3)
M 220:4 XmlParser.chk_node_list - A (3)
M 280:4 XmlParser._parse_most - A (3)
F 64:0 key2xml - A (2)
F 74:0 mk_xml_attrs - A (2)
M 134:4 Node.__init__ - A (2)
M 196:4 Comment.mk - A (2)
M 229:4 XmlParser.mk_value - A (2)
M 260:4 XmlParser.parse - A (2)
M 299:4 XmlParser._parse_descriptor - A (2)
F 8:0 t2s - A (1)
M 143:4 Node.__repr__ - A (1)
M 156:4 Node.get_indent - A (1)
M 183:4 Node.add_child - A (1)
M 189:4 Node.add_comment - A (1)
M 216:4 XmlParser.__init__ - A (1)
M 241:4 XmlParser.mk_active - A (1)
M 315:4 XmlParser._skip_comment - A (1)
30 blocks (classes, functions, methods) analyzed.
Average complexity: A (2.533333333333333)
a@fu:~/build/SCTE35_threefive$ pylint threefive/xml.py ************* Module threefive.xml
threefive/xml.py:134:4: W0102: Dangerous default value {} as argument (dangerous-default-value) # <---- I don't care about these
threefive/xml.py:156:4: C0116: Missing function or method docstring (missing-function-docstring)
threefive/xml.py:195:0: C0115: Missing class docstring (missing-class-docstring)
threefive/xml.py:204:0: C0115: Missing class docstring (missing-class-docstring)
threefive/xml.py:248:4: R1710: Either all return statements in a function should return an expression, or none of them should. (inconsistent-return-statements)
threefive/xml.py:308:8: W0702: No exception type(s) specified (bare-except) # <---- I don't care about these
------------------------------------------------------------------
Your code has been rated at 9.61/10 (previous run: 9.42/10, +0.19) |
Beta Was this translation helpful? Give feedback.
-
@davemevans when you have a minute, Read the README and and see if the xml stuff makes sense, please. |
Beta Was this translation helpful? Give feedback.
-
@davemevans @wabiloo I can parse mpd filles over the network and convert the data to cues, no problem. a@fu:~/build/SCTE35_threefive$ pypy3 mpdp.py https://demo.unified-streaming.com/k8s/live/stable/scte35-no-splicing.isml/.mpd
{
"info_section": {
"table_id": "0xfc",
"section_syntax_indicator": false,
"private": false,
"sap_type": "0x03",
"sap_details": "No Sap Type",
"section_length": 32,
"protocol_version": 0,
"encrypted_packet": false,
"encryption_algorithm": 0,
"pts_adjustment": 0.0,
"cw_index": "0x00",
"tier": "0x0fff",
"splice_command_length": 15,
"splice_command_type": 5,
"descriptor_loop_length": 0,
"crc": "0xe4612424"
},
"command": {
"command_length": 15,
"command_type": 5,
"name": "Splice Insert",
"break_auto_return": true,
"break_duration": 38.4,
"splice_event_id": 14294827,
"splice_event_cancel_indicator": false,
"out_of_network_indicator": true,
"program_splice_flag": true,
"duration_flag": true,
"splice_immediate_flag": true,
"event_id_compliance_flag": true,
"unique_program_id": 49152,
"avail_num": 0,
"avails_expected": 0
},
"descriptors": []
}
{
"info_section": {
"table_id": "0xfc",
"section_syntax_indicator": false,
"private": false,
"sap_type": "0x03",
"sap_details": "No Sap Type",
"section_length": 32,
"protocol_version": 0,
"encrypted_packet": false,
"encryption_algorithm": 0,
"pts_adjustment": 0.0,
"cw_index": "0x00",
"tier": "0x0fff",
"splice_command_length": 15,
"splice_command_type": 5,
"descriptor_loop_length": 0,
"crc": "0xe4612424"
},
"command": {
"command_length": 15,
"command_type": 5,
"name": "Splice Insert",
"break_auto_return": true,
"break_duration": 38.4,
"splice_event_id": 14294828,
"splice_event_cancel_indicator": false,
"out_of_network_indicator": true,
"program_splice_flag": true,
"duration_flag": true,
"splice_immediate_flag": true,
"event_id_compliance_flag": true,
"unique_program_id": 49152,
"avail_num": 0,
"avails_expected": 0
},
"descriptors": []
}
{
"info_section": {
"table_id": "0xfc",
"section_syntax_indicator": false,
"private": false,
"sap_type": "0x03",
"sap_details": "No Sap Type",
"section_length": 32,
"protocol_version": 0,
"encrypted_packet": false,
"encryption_algorithm": 0,
"pts_adjustment": 0.0,
"cw_index": "0x00",
"tier": "0x0fff",
"splice_command_length": 15,
"splice_command_type": 5,
"descriptor_loop_length": 0,
"crc": "0xe4612424"
},
"command": {
"command_length": 15,
"command_type": 5,
"name": "Splice Insert",
"break_auto_return": true,
"break_duration": 38.4,
"splice_event_id": 14294829,
"splice_event_cancel_indicator": false,
"out_of_network_indicator": true,
"program_splice_flag": true,
"duration_flag": true,
"splice_immediate_flag": true,
"event_id_compliance_flag": true,
"unique_program_id": 49152,
"avail_num": 0,
"avails_expected": 0
},
"descriptors": []
}
{
"info_section": {
"table_id": "0xfc",
"section_syntax_indicator": false,
"private": false,
"sap_type": "0x03",
"sap_details": "No Sap Type",
"section_length": 32,
"protocol_version": 0,
"encrypted_packet": false,
"encryption_algorithm": 0,
"pts_adjustment": 0.0,
"cw_index": "0x00",
"tier": "0x0fff",
"splice_command_length": 15,
"splice_command_type": 5,
"descriptor_loop_length": 0,
"crc": "0xe4612424"
},
"command": {
"command_length": 15,
"command_type": 5,
"name": "Splice Insert",
"break_auto_return": true,
"break_duration": 38.4,
"splice_event_id": 14294830,
"splice_event_cancel_indicator": false,
"out_of_network_indicator": true,
"program_splice_flag": true,
"duration_flag": true,
"splice_immediate_flag": true,
"event_id_compliance_flag": true,
"unique_program_id": 49152,
"avail_num": 0,
"avails_expected": 0
},
"descriptors": []
}
{
"info_section": {
"table_id": "0xfc",
"section_syntax_indicator": false,
"private": false,
"sap_type": "0x03",
"sap_details": "No Sap Type",
"section_length": 32,
"protocol_version": 0,
"encrypted_packet": false,
"encryption_algorithm": 0,
"pts_adjustment": 0.0,
"cw_index": "0x00",
"tier": "0x0fff",
"splice_command_length": 15,
"splice_command_type": 5,
"descriptor_loop_length": 0,
"crc": "0xe4612424"
},
"command": {
"command_length": 15,
"command_type": 5,
"name": "Splice Insert",
"break_auto_return": true,
"break_duration": 38.4,
"splice_event_id": 14294831,
"splice_event_cancel_indicator": false,
"out_of_network_indicator": true,
"program_splice_flag": true,
"duration_flag": true,
"splice_immediate_flag": true,
"event_id_compliance_flag": true,
"unique_program_id": 49152,
"avail_num": 0,
"avails_expected": 0
},
"descriptors": [] |
Beta Was this translation helpful? Give feedback.
-
You can convert them to cues, and the convert the cues back to xml }
a@fu:~/build/SCTE35_threefive$ pypy3 mpdp.py https://demo.unified-streaming.com/k8s/live/stable/scte35-no-splicing.isml/.mpd
{
"info_section": {
"table_id": "0xfc",
"section_syntax_indicator": false,
"private": false,
"sap_type": "0x03",
"sap_details": "No Sap Type",
"section_length": 32,
"protocol_version": 0,
"encrypted_packet": false,
"encryption_algorithm": 0,
"pts_adjustment": 0.0,
"cw_index": "0x00",
"tier": "0x0fff",
"splice_command_length": 15,
"splice_command_type": 5,
"descriptor_loop_length": 0,
"crc": "0xe4612424"
},
"command": {
"command_length": 15,
"command_type": 5,
"name": "Splice Insert",
"break_auto_return": true,
"break_duration": 38.4,
"splice_event_id": 14294830,
"splice_event_cancel_indicator": false,
"out_of_network_indicator": true,
"program_splice_flag": true,
"duration_flag": true,
"splice_immediate_flag": true,
"event_id_compliance_flag": true,
"unique_program_id": 49152,
"avail_num": 0,
"avails_expected": 0
},
"descriptors": []
}
<SpliceInfoSection xmlns="https://scte.org/schemas/35" ptsAdjustment="0" protocolVersion="0" sapType="3" tier="4095">
<SpliceInsert spliceEventId="14294830" spliceEventCancelIndicator="false" spliceImmediateFlag="true" eventIdComplianceFlag="true" availNum="0" availsExpected="0" outOfNetworkIndicator="true" uniqueProgramId="49152">
<BreakDuration autoReturn="true" duration="3456000"/>
</SpliceInsert>
</SpliceInfoSection>
{
"info_section": {
"table_id": "0xfc",
"section_syntax_indicator": false,
"private": false,
"sap_type": "0x03",
"sap_details": "No Sap Type",
"section_length": 32,
"protocol_version": 0,
"encrypted_packet": false,
"encryption_algorithm": 0,
"pts_adjustment": 0.0,
"cw_index": "0x00",
"tier": "0x0fff",
"splice_command_length": 15,
"splice_command_type": 5,
"descriptor_loop_length": 0,
"crc": "0xe4612424"
},
"command": {
"command_length": 15,
"command_type": 5,
"name": "Splice Insert",
"break_auto_return": true,
"break_duration": 38.4,
"splice_event_id": 14294831,
"splice_event_cancel_indicator": false,
"out_of_network_indicator": true,
"program_splice_flag": true,
"duration_flag": true,
"splice_immediate_flag": true,
"event_id_compliance_flag": true,
"unique_program_id": 49152,
"avail_num": 0,
"avails_expected": 0
},
"descriptors": []
}
<SpliceInfoSection xmlns="https://scte.org/schemas/35" ptsAdjustment="0" protocolVersion="0" sapType="3" tier="4095">
<SpliceInsert spliceEventId="14294831" spliceEventCancelIndicator="false" spliceImmediateFlag="true" eventIdComplianceFlag="true" availNum="0" availsExpected="0" outOfNetworkIndicator="true" uniqueProgramId="49152">
<BreakDuration autoReturn="true" duration="3456000"/>
</SpliceInsert>
</SpliceInfoSection>
{
"info_section": {
"table_id": "0xfc",
"section_syntax_indicator": false,
"private": false,
"sap_type": "0x03",
"sap_details": "No Sap Type",
"section_length": 32,
"protocol_version": 0,
"encrypted_packet": false,
"encryption_algorithm": 0,
"pts_adjustment": 0.0,
"cw_index": "0x00",
"tier": "0x0fff",
"splice_command_length": 15,
"splice_command_type": 5,
"descriptor_loop_length": 0,
"crc": "0xe4612424"
},
"command": {
"command_length": 15,
"command_type": 5,
"name": "Splice Insert",
"break_auto_return": true,
"break_duration": 38.4,
"splice_event_id": 14294832,
"splice_event_cancel_indicator": false,
"out_of_network_indicator": true,
"program_splice_flag": true,
"duration_flag": true,
"splice_immediate_flag": true,
"event_id_compliance_flag": true,
"unique_program_id": 49152,
"avail_num": 0,
"avails_expected": 0
},
"descriptors": []
}
<SpliceInfoSection xmlns="https://scte.org/schemas/35" ptsAdjustment="0" protocolVersion="0" sapType="3" tier="4095">
<SpliceInsert spliceEventId="14294832" spliceEventCancelIndicator="false" spliceImmediateFlag="true" eventIdComplianceFlag="true" availNum="0" availsExpected="0" outOfNetworkIndicator="true" uniqueProgramId="49152">
<BreakDuration autoReturn="true" duration="3456000"/>
</SpliceInsert>
</SpliceInfoSection>
{
"info_section": {
"table_id": "0xfc",
"section_syntax_indicator": false,
"private": false,
"sap_type": "0x03",
"sap_details": "No Sap Type",
"section_length": 32,
"protocol_version": 0,
"encrypted_packet": false,
"encryption_algorithm": 0,
"pts_adjustment": 0.0,
"cw_index": "0x00",
"tier": "0x0fff",
"splice_command_length": 15,
"splice_command_type": 5,
"descriptor_loop_length": 0,
"crc": "0xe4612424"
},
"command": {
"command_length": 15,
"command_type": 5,
"name": "Splice Insert",
"break_auto_return": true,
"break_duration": 38.4,
"splice_event_id": 14294833,
"splice_event_cancel_indicator": false,
"out_of_network_indicator": true,
"program_splice_flag": true,
"duration_flag": true,
"splice_immediate_flag": true,
"event_id_compliance_flag": true,
"unique_program_id": 49152,
"avail_num": 0,
"avails_expected": 0
},
"descriptors": []
}
<SpliceInfoSection xmlns="https://scte.org/schemas/35" ptsAdjustment="0" protocolVersion="0" sapType="3" tier="4095">
<SpliceInsert spliceEventId="14294833" spliceEventCancelIndicator="false" spliceImmediateFlag="true" eventIdComplianceFlag="true" availNum="0" availsExpected="0" outOfNetworkIndicator="true" uniqueProgramId="49152">
<BreakDuration autoReturn="true" duration="3456000"/>
</SpliceInsert>
</SpliceInfoSection>
{
"info_section": {
"table_id": "0xfc",
"section_syntax_indicator": false,
"private": false,
"sap_type": "0x03",
"sap_details": "No Sap Type",
"section_length": 32,
"protocol_version": 0,
"encrypted_packet": false,
"encryption_algorithm": 0,
"pts_adjustment": 0.0,
"cw_index": "0x00",
"tier": "0x0fff",
"splice_command_length": 15,
"splice_command_type": 5,
"descriptor_loop_length": 0,
"crc": "0xe4612424"
},
"command": {
"command_length": 15,
"command_type": 5,
"name": "Splice Insert",
"break_auto_return": true,
"break_duration": 38.4,
"splice_event_id": 14294834,
"splice_event_cancel_indicator": false,
"out_of_network_indicator": true,
"program_splice_flag": true,
"duration_flag": true,
"splice_immediate_flag": true,
"event_id_compliance_flag": true,
"unique_program_id": 49152,
"avail_num": 0,
"avails_expected": 0
},
"descriptors": []
}
<SpliceInfoSection xmlns="https://scte.org/schemas/35" ptsAdjustment="0" protocolVersion="0" sapType="3" tier="4095">
<SpliceInsert spliceEventId="14294834" spliceEventCancelIndicator="false" spliceImmediateFlag="true" eventIdComplianceFlag="true" availNum="0" availsExpected="0" outOfNetworkIndicator="true" uniqueProgramId="49152">
<BreakDuration autoReturn="true" duration="3456000"/>
</SpliceInsert>
</SpliceInfoSection>
a@fu:~/build/SCTE35_threefive$ |
Beta Was this translation helpful? Give feedback.
-
For info, I found a small issue with the xml encode functionality, when using UPIDs - #123 |
Beta Was this translation helpful? Give feedback.
-
Starting a little thread about namespace.
Namespaces are one of the best things in XML, and yet one of the most misunderstood ones... First issue: there is more than one namespace for SCTE35. The spec (SCTE35_2023r1) says it should be "http://www.scte.org/schemas/35" Therefore in my (idealistic) view, when converting to xml (with
<SpliceInfoSection xmlns="https://scte.org/schemas/35" ptsAdjustment="0" protocolVersion="0" sapType="3" tier="4095">
<SpliceInsert spliceEventId="14294834" spliceEventCancelIndicator="false" spliceImmediateFlag="true" eventIdComplianceFlag="true" availNum="0" availsExpected="0" outOfNetworkIndicator="true" uniqueProgramId="49152">
<BreakDuration autoReturn="true" duration="3456000"/>
</SpliceInsert>
</SpliceInfoSection>
<SpliceInfoSection xmlns="https://scte.org/schemas/35/2016" ptsAdjustment="0" protocolVersion="0" sapType="3" tier="4095">
<SpliceInsert spliceEventId="14294834" spliceEventCancelIndicator="false" spliceImmediateFlag="true" eventIdComplianceFlag="true" availNum="0" availsExpected="0" outOfNetworkIndicator="true" uniqueProgramId="49152">
<BreakDuration autoReturn="true" duration="3456000"/>
</SpliceInsert>
</SpliceInfoSection>
<SpliceInfoSection ptsAdjustment="0" protocolVersion="0" sapType="3" tier="4095">
<SpliceInsert spliceEventId="14294834" spliceEventCancelIndicator="false" spliceImmediateFlag="true" eventIdComplianceFlag="true" availNum="0" availsExpected="0" outOfNetworkIndicator="true" uniqueProgramId="49152">
<BreakDuration autoReturn="true" duration="3456000"/>
</SpliceInsert>
</SpliceInfoSection> Also fine by me if case 3 (no namespace) is the default, leaving the user to use the After that - as @davemevans said - it fundamentally becomes the responsibility of the developer who wants to take that payload and insert it into a larger document (say: in an MPEG-DASH presentation aka MPD) to do the "right" thing, which is to say not treat it as if it's a text file, but instead use a proper XML writer, which will ensure that it's inserted in the correct way, either as: <MPD>
<!-- ... --->
<EventStream timescale="90000" schemeIdUri="urn:scte:scte35:2013:xml">
<Event>
<SpliceInfoSection xmlns="https://scte.org/schemas/35" ptsAdjustment="0" protocolVersion="0" sapType="3" tier="4095">
<SpliceInsert spliceEventId="14294834" spliceEventCancelIndicator="false" spliceImmediateFlag="true" eventIdComplianceFlag="true" availNum="0" availsExpected="0" outOfNetworkIndicator="true" uniqueProgramId="49152">
<BreakDuration autoReturn="true" duration="3456000"/>
</SpliceInsert>
</SpliceInfoSection>
</Event>
</EventStream>
<!--... --->
</MPD> or as <MPD xmlns:scte35="https://scte.org/schemas/35" >
<!-- ... --->
<EventStream timescale="90000" schemeIdUri="urn:scte:scte35:2013:xml">
<Event>
<scte35:SpliceInfoSection ptsAdjustment="0" protocolVersion="0" sapType="3" tier="4095">
<scte35:SpliceInsert spliceEventId="14294834" spliceEventCancelIndicator="false" spliceImmediateFlag="true" eventIdComplianceFlag="true" availNum="0" availsExpected="0" outOfNetworkIndicator="true" uniqueProgramId="49152">
<scte35:BreakDuration autoReturn="true" duration="3456000"/>
</scte35:SpliceInsert>
</scte35:SpliceInfoSection>
</Event>
</EventStream>
<!--... --->
</MPD> or any other form that is valid XML and applying namespaces in the correct way. Now, if you wanted to be extra-friendly to the people who don't want to have to understand how XML works and want to use is as a text file, you could offer to add a prefix, with something like <scte35:SpliceInfoSection xmlns:scte35="https://scte.org/schemas/35" ptsAdjustment="0" protocolVersion="0" sapType="3" tier="4095">
<scte35:SpliceInsert spliceEventId="14294834" spliceEventCancelIndicator="false" spliceImmediateFlag="true" eventIdComplianceFlag="true" availNum="0" availsExpected="0" outOfNetworkIndicator="true" uniqueProgramId="49152">
<scte35:BreakDuration autoReturn="true" duration="3456000"/>
</scte35:SpliceInsert>
</scte35:SpliceInfoSection> and as before allowing the user to also specify a non-default prefix, and/or non-default namespace (to match whatever garbage their packager does), such as "normal" ones: <SCTE35:SpliceInfoSection ptsAdjustment="0" protocolVersion="0" sapType="3" tier="4095">
<SCTE35:SpliceInsert spliceEventId="14294834" spliceEventCancelIndicator="false" spliceImmediateFlag="true" eventIdComplianceFlag="true" availNum="0" availsExpected="0" outOfNetworkIndicator="true" uniqueProgramId="49152">
<SCTE35:BreakDuration autoReturn="true" duration="3456000"/>
</SCTE35:SpliceInsert>
</SCTE35:SpliceInfoSection> or funky ones (don't laugh, I've seen something not far from that in the real world): <toto:SpliceInfoSection xmlns:toto="ns1" ptsAdjustment="0" protocolVersion="0" sapType="3" tier="4095">
<toto:SpliceInsert spliceEventId="14294834" spliceEventCancelIndicator="false" spliceImmediateFlag="true" eventIdComplianceFlag="true" availNum="0" availsExpected="0" outOfNetworkIndicator="true" uniqueProgramId="49152">
<toto:BreakDuration autoReturn="true" duration="3456000"/>
</toto:SpliceInsert>
</toto:SpliceInfoSection> That's my thoughts on converting to XML. Now, when it comes to parsing from XML, it gets much harder... because there is a lot of junk out there, with all those various namespaces, invalid ones (looking at you MediaKind!), and it would be quite a limitation to want to be normative in this instance. Want an example (again, real life)? <EventStream schemeIdUri="urn:scte:scte35:2014:xml+bin" timescale="90000">
<Event id="289535">
<scte35:Signal>
<Binary>
/DBeAAAAAAAAAP/wBQb+On0tBgBIAhRDVUVJAARqC3//AAAUmXAAADAKEAIfQ1VFSQAEav9/vwwQQURGUgEzoQE0PioEagWwGAIAAAIPQ1VFSQAEagp/vwAAMQkQuJbGZg==</Binary>
<scte35:SpliceInfoSection scte35Point="155399966445254">
<scte35:SegmentationDescriptor segmentationEventId="289291" segmentationTypeId="48" segmentationDuration="PT15S">AhRDVUVJAARqC3__AAAUmXAAADAKEA==</scte35:SegmentationDescriptor>
</scte35:SpliceInfoSection>
</scte35:Signal>
</Event>
</EventStream> |
Beta Was this translation helpful? Give feedback.
-
<EventStream schemeIdUri="urn:scte:scte35:2014:xml+bin" timescale="90000">
<Event id="289535">
<scte35:Signal>
<Binary>
/DBeAAAAAAAAAP/wBQb+On0tBgBIAhRDVUVJAARqC3//AAAUmXAAADAKEAIfQ1VFSQAEav9/vwwQQURGUgEzoQE0PioEagWwGAIAAAIPQ1VFSQAEagp/vwAAMQkQuJbGZg==</Binary>
<scte35:SpliceInfoSection scte35Point="155399966445254">
<scte35:SegmentationDescriptor segmentationEventId="289291" segmentationTypeId="48" segmentationDuration="PT15S">AhRDVUVJAARqC3__AAAUmXAAADAKEA==</scte35:SegmentationDescriptor>
</scte35:SpliceInfoSection>
</scte35:Signal>
</Event>
</EventStream> That is explicitly not allowed by 214,
@wabiloo |
Beta Was this translation helpful? Give feedback.
-
that being said, I just came with a better way to do it, @fu:~/build/SCTE35_threefive$ pypy3
Python 3.9.16 (7.3.11+dfsg-2+deb12u2, May 20 2024, 22:08:06)
[PyPy 7.3.11 with GCC 12.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>>> with open('xml.xml','r') as ex: exemel=ex.read() # Read in the xml from a file
>>>> from threefive import Cue
>>>> cue=Cue(exemel)
>>>> x=cue.xml()
>>>> x.set_ns() # <-------------- clear the "scte35" namespace
>>>> x
<SpliceInfoSection xmlns="https://scte.org/schemas/35" ptsAdjustment="0" protocolVersion="0" sapType="3" tier="4095">
<SpliceInsert spliceEventId="1" spliceEventCancelIndicator="false" spliceImmediateFlag="false" eventIdComplianceFlag="true" availNum="0" availsExpected="0" outOfNetworkIndicator="false" uniqueProgramId="1">
<Program>
<SpliceTime ptsTime="10800000"/>
</Program>
</SpliceInsert>
</SpliceInfoSection>
>>>> x.set_ns("toto") # <--------- set namespace
>>>> x.set_ans("fufu") # <----------set attribute namespace
>>>> x
<toto:SpliceInfoSection fufu:PtsAdjustment="0" fufu:ProtocolVersion="0" fufu:SapType="3" fufu:tier="4095" xmlns:fufu="https://scte.org/schemas/35">
<toto:SpliceInsert fufu:SpliceEventId="1" fufu:SpliceEventCancelIndicator="false" fufu:SpliceImmediateFlag="false" fufu:EventIdComplianceFlag="true" fufu:AvailNum="0" fufu:AvailsExpected="0" fufu:OutOfNetworkIndicator="false" fufu:UniqueProgramId="1">
<toto:Program>
<toto:SpliceTime fufu:ptsTime="10800000"/>
</Program>
</SpliceInsert>
</SpliceInfoSection>
>>>> x.set_ns() # <-------- clear namespace
>>>> x
<SpliceInfoSection fufu:PtsAdjustment="0" fufu:ProtocolVersion="0" fufu:SapType="3" fufu:tier="4095" xmlns:fufu="https://scte.org/schemas/35">
<SpliceInsert fufu:SpliceEventId="1" fufu:SpliceEventCancelIndicator="false" fufu:SpliceImmediateFlag="false" fufu:EventIdComplianceFlag="true" fufu:AvailNum="0" fufu:AvailsExpected="0" fufu:OutOfNetworkIndicator="false" fufu:UniqueProgramId="1">
<Program>
<SpliceTime fufu:ptsTime="10800000"/>
</Program>
</SpliceInsert>
</SpliceInfoSection>
>>>> x.set_ans() # <------------- clear attribute namespace
>>>> x
<SpliceInfoSection xmlns="https://scte.org/schemas/35" ptsAdjustment="0" protocolVersion="0" sapType="3" tier="4095">
<SpliceInsert spliceEventId="1" spliceEventCancelIndicator="false" spliceImmediateFlag="false" eventIdComplianceFlag="true" availNum="0" availsExpected="0" outOfNetworkIndicator="false" uniqueProgramId="1">
<Program>
<SpliceTime ptsTime="10800000"/>
</Program>
</SpliceInsert>
</SpliceInfoSection>
>>>> |
Beta Was this translation helpful? Give feedback.
-
The more I think about, once it's outside of the scte35 namespace, it's outside the scope of threefive, you'll have to deal with that externally. |
Beta Was this translation helpful? Give feedback.
-
SCTE-214
Adrian of Doom and @davemevans and @wabiloo are currently implementing Dash and XML support to threefive, this is where we discuss it. Feel free to join us.
Adrian
Beta Was this translation helpful? Give feedback.
All reactions