aboutsummaryrefslogtreecommitdiff
path: root/lib/dvb/dvb.cpp
diff options
context:
space:
mode:
authorFelix Domke <tmbinc@elitedvb.net>2008-11-17 15:35:42 +0100
committerFelix Domke <tmbinc@elitedvb.net>2008-11-17 15:35:42 +0100
commit401863ab3c54d849a22cd0fb677dec487621ab97 (patch)
tree9312aadb0236f3d341d6d5a6757037ade90c18ee /lib/dvb/dvb.cpp
parent638123eeac3874577ca1454c3420b15dd4ccdbc0 (diff)
downloadenigma2-401863ab3c54d849a22cd0fb677dec487621ab97.tar.gz
enigma2-401863ab3c54d849a22cd0fb677dec487621ab97.zip
lock on pids only if video startcode is in a pes header
Diffstat (limited to 'lib/dvb/dvb.cpp')
-rw-r--r--lib/dvb/dvb.cpp16
1 files changed, 13 insertions, 3 deletions
diff --git a/lib/dvb/dvb.cpp b/lib/dvb/dvb.cpp
index 7b05feb4..8afa70db 100644
--- a/lib/dvb/dvb.cpp
+++ b/lib/dvb/dvb.cpp
@@ -1031,10 +1031,20 @@ int eDVBChannelFilePush::filterRecordData(const unsigned char *_data, int len, s
}
} else if ((d[3] & 0xF0) == 0xE0) /* video stream */
{
- if (m_pid != pid)
+ /* verify that this is actually a PES header, not just some ES data */
+ if (ts[1] & 0x40) /* PUSI set */
{
- eDebug("now locked to pid %04x", pid);
- m_pid = pid;
+ int payload_start = 4;
+ if (ts[3] & 0x20) /* adaptation field present */
+ payload_start += ts[4] + 1; /* skip AF */
+ if (payload_start == (offset%184)) /* the 00 00 01 should be directly at the payload start, otherwise it's not a PES header */
+ {
+ if (m_pid != pid)
+ {
+ eDebug("now locked to pid %04x (%02x %02x %02x %02x)", pid, ts[0], ts[1], ts[2], ts[3]);
+ m_pid = pid;
+ }
+ }
}
// m_pid = 0x6e;
d += 4;