|
@@ -344,7 +344,27 @@ class MultiMPEGTS(FSObject, StorageFolder): |
|
|
if doupdate: |
|
|
if doupdate: |
|
|
StorageFolder.doUpdate(self) |
|
|
StorageFolder.doUpdate(self) |
|
|
|
|
|
|
|
|
|
|
|
def findtsstream(fp, pktsz=188): |
|
|
|
|
|
d = fp.read(200*pktsz) |
|
|
|
|
|
i = 5 |
|
|
|
|
|
pos = 0 |
|
|
|
|
|
while i and pos < len(d) and pos != -1: |
|
|
|
|
|
if d[pos] == 'G': |
|
|
|
|
|
i -= 1 |
|
|
|
|
|
pos += pktsz |
|
|
|
|
|
else: |
|
|
|
|
|
i = 5 |
|
|
|
|
|
pos = d.find('G', pos + 1) |
|
|
|
|
|
|
|
|
|
|
|
if i or pos == -1: |
|
|
|
|
|
return False |
|
|
|
|
|
|
|
|
|
|
|
return True |
|
|
|
|
|
|
|
|
def detectmpegts(path, fobj): |
|
|
def detectmpegts(path, fobj): |
|
|
|
|
|
if not findtsstream(fobj): |
|
|
|
|
|
return None, None |
|
|
|
|
|
|
|
|
f = mpegts.TSPStream(_LimitedFile(path, size= 2*1024*1024)) |
|
|
f = mpegts.TSPStream(_LimitedFile(path, size= 2*1024*1024)) |
|
|
tvct = mpegts.GetTVCT(f) |
|
|
tvct = mpegts.GetTVCT(f) |
|
|
|
|
|
|
|
|