+ if (tmp[4] != 0x47)
+ {
+ if (rd > 0) {
+ eDebug("short read at pos %lld async!!", m_current_offset);
+ return rd;
+ }
+ else {
+ int x=0;
+ if (!m_cached)
+ ret = ::read(m_fd, tmp+192, 384);
+ else
+ ret = ::fread(tmp+192, 1, 384, m_file);
+
+#if 0
+ eDebugNoNewLine("m2ts out of sync at pos %lld, real %lld:", offset + m_sync_offset, m_current_offset);
+ for (; x < 192; ++x)
+ eDebugNoNewLine(" %02x", tmp[x]);
+ eDebug("");
+ x=0;
+#else
+ eDebug("m2ts out of sync at pos %lld, real %lld", offset + m_sync_offset, m_current_offset);
+#endif
+ for (; x < 192; ++x)
+ {
+ if (tmp[x] == 0x47 && tmp[x+192] == 0x47)
+ {
+ int add_offs = (x - 4);
+ eDebug("sync found at pos %d, sync_offset is now %d, old was %d", x, add_offs + m_sync_offset, m_sync_offset);
+ m_sync_offset += add_offs;
+ goto sync;
+ }
+ }
+ }
+ }
+
+ memcpy(buf+rd, tmp+4, 188);