1 #include <lib/dvb/esection.h>
2 #include <lib/base/eerror.h>
4 void eGTable::sectionRead(const __u8 *d)
6 unsigned int last_section_number = d[7];
7 m_table.flags &= ~eDVBTableSpec::tfAnyVersion;
8 m_table.flags |= eDVBTableSpec::tfThisVersion;
9 m_table.version = (d[5]>>1)&0x1F;
12 if (createTable(d[6], d, last_section_number + 1))
19 } else if ((m_table.flags & eDVBTableSpec::tfHaveTimeout) && m_timeout)
20 m_timeout->start(m_table.timeout, 1); // reset timeout
23 void eGTable::timeout()
33 m_timeout(0), error(0)
39 RESULT eGTable::start(iDVBSectionReader *reader, const eDVBTableSpec &table)
45 m_reader->connectRead(slot(*this, &eGTable::sectionRead), m_sectionRead_conn);
47 // setup filter struct
48 eDVBSectionFilterMask mask;
50 memset(&mask, 0, sizeof(mask));
51 mask.pid = m_table.pid;
54 if (m_table.flags & eDVBTableSpec::tfCheckCRC)
55 mask.flags |= eDVBSectionFilterMask::rfCRC;
57 if (m_table.flags & eDVBTableSpec::tfHaveTID)
59 mask.data[0] = m_table.tid;
60 if (m_table.flags & eDVBTableSpec::tfHaveTIDMask)
61 mask.mask[0] = m_table.tid_mask;
66 if (m_table.flags & eDVBTableSpec::tfHaveTIDExt)
68 mask.data[1] = m_table.tidext >> 8;
69 mask.data[2] = m_table.tidext;
70 if (m_table.flags & eDVBTableSpec::tfHaveTIDExtMask)
72 mask.mask[1] = m_table.tidext_mask >> 8;
73 mask.mask[2] = m_table.tidext_mask;
82 if (!(m_table.flags & eDVBTableSpec::tfAnyVersion))
84 eDebug("doing version filtering");
85 mask.data[3] |= (m_table.version << 1)|1;
87 if (!(m_table.flags & eDVBTableSpec::tfThisVersion))
88 mask.mode[3] |= 0x3e; // negative filtering
90 eDebug("no version filtering");
92 eDebug("%04x: %02x %02x %02x %02x %02x %02x",
94 mask.data[0], mask.data[1], mask.data[2],
95 mask.data[3], mask.data[4], mask.data[5]);
96 eDebug("mask: %02x %02x %02x %02x %02x %02x",
97 mask.mask[0], mask.mask[1], mask.mask[2],
98 mask.mask[3], mask.mask[4], mask.mask[5]);
99 eDebug("mode: %02x %02x %02x %02x %02x %02x",
100 mask.mode[0], mask.mode[1], mask.mode[2],
101 mask.mode[3], mask.mode[4], mask.mode[5]);
103 if ((res = m_reader->start(mask)))
105 eDebug("reader failed to start.");
109 if (m_table.flags & eDVBTableSpec::tfHaveTimeout)
113 m_timeout = new eTimer(eApp);
114 m_timeout->start(m_table.timeout, 1); // begin timeout
115 CONNECT(m_timeout->timeout, eGTable::timeout);
121 RESULT eGTable::start(iDVBDemux *demux, const eDVBTableSpec &table)
124 ePtr<iDVBSectionReader> reader;
125 res = demux->createSectionReader(eApp, reader);
128 return start(reader, table);
137 void eAUGTable::slotTableReady(int error)