def parse_x_daterange(self, aline): # EXT-X-DATERANGE:ID="splice-6FFFFFF0",START-DATE="2014-03-05T11:15:00Z",PLANNED-DURATION=59.993,SCTE35-OUT=0xFC002F0000000000FF000014056FFFFFF000E011622DCAFF000052636200000000000A000829896F50000008700000000 if not aline.startswith('#EXT-X-DATERANGE:'): return values = {} for chunk in line.split(','): k, v = chunk.split('=') if k.startswith('SCTE35'): v = threefive.Splice(v).show()
airid_mpu = '/DCSAAAAAAAAAP/wBQb/RgeVUgB8AhdDVUVJbs6+VX+/CAgAAAAABy0IxzELGQIXQ1VFSW7MmIh/vwgIAAABGDayFhE3AQECHENVRUluzw0If/8AABvLoAgIAAAAAActVhIwDBkCKkNVRUluzw02f78MG1JUTE4xSAEAAAAAMTM3NjkyMDI1NDQ5NUgxAAEAAGnbuXg=' mid = '/DA9AAAAAAAAAACABQb+0fha8wAnAiVDVUVJSAAAv3/PAAD4+mMNEQ4FTEEzMDkICAAAAAAuU4SBNAAAPIaCPw==' ads = '/DBZAAAAAAAA///wBQb+AAAAAABDAkFDVUVJAAAAC3//AAApMuAOLUFEUy1VUElEOmFhODViYmI2LTVjNDMtNGI2YS1iZWJiLWVlM2IxM2ViNzk5ORAAAJd2uP4=' ads2 = '/DBUAAAAAAAA///wBQb+AAAAAAA+AjxDVUVJAAAAC3+/Di1BRFMtVVBJRDphYTg1YmJiNi01YzQzLTRiNmEtYmViYi1lZTNiMTNlYjc5OTkRAACV15uV' uri = '/DBZAAAAAAAA///wBQb+AAAAAABDAkFDVUVJAAAACn//AAApMuAPLXVybjp1dWlkOmFhODViYmI2LTVjNDMtNGI2YS1iZWJiLWVlM2IxM2ViNzk5ORAAAFz7UQA=' uri2 = '/DBUAAAAAAAA///wBQb+AAAAAAA+AjxDVUVJAAAACn+/Dy11cm46dXVpZDphYTg1YmJiNi01YzQzLTRiNmEtYmViYi1lZTNiMTNlYjc5OTkRAAB2c6LA' tid2 = '/DAzAAAAAAAA///wBQb+AAAAAAAdAhtDVUVJAAAAA3+/BwxNVjAwMDQxNDY0MDARAAB2a6fC' adid = '/DA4AAAAAAAA///wBQb+AAAAAAAiAiBDVUVJAAAAA3//AAApPWwDDEFCQ0QwMTIzNDU2SBAAAGgCL9A=' MID = '/DA4AAAAAAAA///wBQb+AAAAAAAiAiBDVUVJAAAAA3//AAApPWwDDEFCQ0QwMTIzNDU2SBAAAGgCL9A=' UMID = '/DA4AAAAAAAA///wBQb+AAAAAAAiAiBDVUVJAAAAA3//AAApPWwDDEFCQ0QwMTIzNDU2SBAAAGgCL9A=' combo = '/DA9AAAAAAAAAACABQb+0fha8wAnAiVDVUVJSAAAv3/PAAD4+mMNEQ4FTEEzMDkICAAAAAAuU4SBNAAAPIaCPw==' ADS = '/DBUAAAAAAAA///wBQb+AAAAAAA+AjxDVUVJAAAAC3+/Di1BRFMtVVBJRDphYTg1YmJiNi01YzQzLTRiNmEtYmViYi1lZTNiMTNlYjc5OTkRAACV15uV' dmesg = [ adid, umid, isan, tid2, airid, adi, eidr, atsc, airid_mpu, mid, ads2, uri ] ids = [] def stuff(t, upid): if t not in ids: ids.append(t) print(f'\033[92m{hex(t)}\033[0m : {upid}') [[ stuff(d.segmentation_upid_type, d.segmentation_upid) for d in threefive.Splice(m).descriptors ] for m in dmesg]
""" Example from the specification 14.2. Splice_Insert """ import threefive Hex = "0xFC302F000000000000FFFFF014054800008F7FEFFE7369C02EFE0052CCF500000000000A0008435545490000013562DBA30A" Base64 = "/DAvAAAAAAAA///wFAVIAACPf+/+c2nALv4AUsz1AAAAAAAKAAhDVUVJAAABNWLbowo=" """ Using Hex """ htf = threefive.Splice(Hex) htf.show_info_section() htf.show_command() htf.show_descriptors() """ Using Base64 auto (output should be the same as above) """ btf = threefive.Splice(Base64) btf.show_info_section() btf.show_command() btf.show_descriptors()
''' Example from the specification 14.3. Time_Signal–Placement_Opportunity_End ''' import threefive Base64 = '/DAvAAAAAAAA///wBQb+dGKQoAAZAhdDVUVJSAAAjn+fCAgAAAAALKChijUCAKnMZ1g=' stuff = threefive.Splice(Base64) stuff.show()
def do(cue): # print( f'cue string: {cue}') tf = threefive.Splice(cue) tf.show_info_section() tf.show_command() tf.show_descriptors()
''' Example from the specification 14.4. Time_Signal–Program Start_End ''' import threefive Base64='/DBIAAAAAAAA///wBQb+ek2ItgAyAhdDVUVJSAAAGH+fCAgAAAAALMvDRBEAAAIXQ1VFSUgAABl/nwgIAAAAACyk26AQAACZcuND' threefive.Splice(Base64).show()
def do(cue): print(f'cue: {cue}') tf = threefive.Splice(cue) tf.show_command() tf.show_descriptors()
l = manifest.readline() if not l: break if l.startswith("#EXT-X-CUE-OUT:"): cue_out = hls_time duration = float(l.split(":")[1]) cue_in = hls_time + duration print(f'hls time: {hls_time}') print(f'cue out: {cue_out}') print(f'duration: {duration}') print(f'cue in: {cue_in}') ##EXTINF:4.000000, if l.startswith("#EXTINF:"): t = l.split(":")[1].split(',')[0] t = float(t) hls_time += t next_segment = manifest.readline()[:-1] print(f'Segment: {next_segment} @ {hls_time}') if l.startswith('#EXT-X-SCTE35'): cue = l.split('CUE=')[1] do(cue) if l.startswith('#EXT-OATCLS-SCTE35:'): cue = l.split('#EXT-OATCLS-SCTE35:')[1] do(cue) ##EXT-X-DATERANGE:ID="splice-6FFFFFF0",START-DATE="2014-03-05T11:15:00Z",PLANNED-DURATION=59.993,SCTE35-OUT=0xFC002F0000000000FF000014056FFFFFF000E011622DCAFF000052636200000000000A000829896F50000008700000000 if l.startswith('#EXT-X-DATERANGE:'): for chunk in line.split(','): k, v = chunk.split('=') if k.startswith('SCTE35'): v = threefive.Splice(v).show()
''' Example from the specification 14.5. Time_Signal–Program_Overlap_Start ''' Hex = '0xFC302F000000000000FFFFF00506FEAEBFFF640019021743554549480000087F9F0808000000002CA56CF5170000951DB0A8' import threefive stuff = threefive.Splice(Hex) stuff.show()