pid-count.py: improve sync

This commit is contained in:
Jaroslav Kysela 2015-03-30 17:03:56 +02:00
parent e4cdd3ca0f
commit 3e4c8e7314

View file

@ -14,6 +14,9 @@ pids_cc_err = {}
fp = open(sys.argv[1])
while True:
tsb = fp.read(188)
while tsb and tsb[0] != '\x47':
tsb = tsb[1:] + fp.read(1)
print 'skip1'
if len(tsb) < 16:
break
tsb = map(ord, tsb[:16])
@ -26,6 +29,8 @@ while True:
pids[pid] = 1
else:
pids[pid] += 1
if pid == 0x1fff:
continue
cc = tsb[3]
if cc & 0x10:
cc &= 0x0f