Commits

nneonneo  committed 1786e44

hachoir-parser/video/mpeg_ts: always try to find sync bytes in case of a broken file

  • Participants
  • Parent commits fba4c06

Comments (0)

Files changed (1)

File hachoir-parser/hachoir_parser/video/mpeg_ts.py

         return True
 
     def createFields(self):
-        sync = self.stream.searchBytes("\x47", 0, 204*8)
-        if sync is None:
-            raise ParserError("Unable to find synchronization byte")
-        elif sync:
-            yield RawBytes(self, "incomplete_packet", sync//8)
         while not self.eof:
+            sync = self.stream.searchBytes("\x47", self.current_size, self.current_size+204*8)
+            if sync is None:
+                raise ParserError("Unable to find synchronization byte")
+            elif sync:
+                yield RawBytes(self, "incomplete_packet[]", (sync-self.current_size)//8)
             yield Packet(self, "packet[]")