aboutsummaryrefslogtreecommitdiff
path: root/lib/dvb/pvrparse.cpp
diff options
context:
space:
mode:
authorFelix Domke <tmbinc@elitedvb.net>2006-03-22 18:20:41 +0000
committerFelix Domke <tmbinc@elitedvb.net>2006-03-22 18:20:41 +0000
commit1b8e84020a1eb7f270042d9cfd065255411474a0 (patch)
treed1025c81785c160422d900c40f7e65ff21bcaf26 /lib/dvb/pvrparse.cpp
parentbbfe3b4c706d6e9cf6a9e07188454b5fd6a802e0 (diff)
downloadenigma2-1b8e84020a1eb7f270042d9cfd065255411474a0.tar.gz
enigma2-1b8e84020a1eb7f270042d9cfd065255411474a0.zip
emergency resync code for pvrparse
Diffstat (limited to 'lib/dvb/pvrparse.cpp')
-rw-r--r--lib/dvb/pvrparse.cpp24
1 files changed, 24 insertions, 0 deletions
diff --git a/lib/dvb/pvrparse.cpp b/lib/dvb/pvrparse.cpp
index 65e599c3..4b8da890 100644
--- a/lib/dvb/pvrparse.cpp
+++ b/lib/dvb/pvrparse.cpp
@@ -362,6 +362,30 @@ void eMPEGStreamParserTS::parseData(off_t offset, const void *data, unsigned int
/* sorry for the redundant code here, but there are too many special cases... */
while (len)
{
+ /* emergency resync. usually, this should not happen, because the data should
+ be sync-aligned.
+
+ to make this code work for non-strictly-sync-aligned data, (for example, bad
+ files) we fix a possible resync here by skipping data until the next 0x47.
+
+ if this is a false 0x47, the packet will be dropped by wantPacket, and the
+ next time, sync will be re-established. */
+ int skipped = 0;
+ while (!m_pktptr && len)
+ {
+ if (packet[0] == 0x47)
+ break;
+ len--;
+ packet++;
+ skipped++;
+ }
+
+ if (skipped)
+ eDebug("SYNC LOST: skipped %d bytes.", skipped);
+
+ if (!len)
+ break;
+
if (m_pktptr)
{
/* skip last packet */