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;
11 /* if a section is missing, we retry reading the
12 whole data up to 5 times. if after that the
13 section is still missing, we timeout. */
14 if (m_tries > 5 * (last_section_number+1))
22 if (createTable(d[6], d, last_section_number + 1))
34 } else if ((m_table.flags & eDVBTableSpec::tfHaveTimeout) && m_timeout)
35 m_timeout->start(m_table.timeout, 1); // reset timeout
38 void eGTable::timeout()
40 eDebug("timeout %04x!", m_table.pid);
53 m_timeout(0), error(0)
59 RESULT eGTable::start(iDVBSectionReader *reader, const eDVBTableSpec &table)
65 m_reader->connectRead(slot(*this, &eGTable::sectionRead), m_sectionRead_conn);
69 // setup filter struct
70 eDVBSectionFilterMask mask;
72 memset(&mask, 0, sizeof(mask));
73 mask.pid = m_table.pid;
76 if (m_table.flags & eDVBTableSpec::tfCheckCRC)
77 mask.flags |= eDVBSectionFilterMask::rfCRC;
79 if (m_table.flags & eDVBTableSpec::tfHaveTID)
81 mask.data[0] = m_table.tid;
82 if (m_table.flags & eDVBTableSpec::tfHaveTIDMask)
83 mask.mask[0] = m_table.tid_mask;
88 if (m_table.flags & eDVBTableSpec::tfHaveTIDExt)
90 mask.data[1] = m_table.tidext >> 8;
91 mask.data[2] = m_table.tidext;
92 if (m_table.flags & eDVBTableSpec::tfHaveTIDExtMask)
94 mask.mask[1] = m_table.tidext_mask >> 8;
95 mask.mask[2] = m_table.tidext_mask;
104 if (!(m_table.flags & eDVBTableSpec::tfAnyVersion))
106 eDebug("doing version filtering");
107 mask.data[3] |= (m_table.version << 1)|1;
108 mask.mask[3] |= 0x3f;
109 if (!(m_table.flags & eDVBTableSpec::tfThisVersion))
110 mask.mode[3] |= 0x3e; // negative filtering
112 eDebug("no version filtering");
114 eDebug("%04x: %02x %02x %02x %02x %02x %02x",
116 mask.data[0], mask.data[1], mask.data[2],
117 mask.data[3], mask.data[4], mask.data[5]);
118 eDebug("mask: %02x %02x %02x %02x %02x %02x",
119 mask.mask[0], mask.mask[1], mask.mask[2],
120 mask.mask[3], mask.mask[4], mask.mask[5]);
121 eDebug("mode: %02x %02x %02x %02x %02x %02x",
122 mask.mode[0], mask.mode[1], mask.mode[2],
123 mask.mode[3], mask.mode[4], mask.mode[5]);
125 if ((res = m_reader->start(mask)))
127 eDebug("reader failed to start.");
131 if (m_table.flags & eDVBTableSpec::tfHaveTimeout)
135 m_timeout = new eTimer(eApp);
136 m_timeout->start(m_table.timeout, 1); // begin timeout
137 CONNECT(m_timeout->timeout, eGTable::timeout);
143 RESULT eGTable::start(iDVBDemux *demux, const eDVBTableSpec &table)
146 ePtr<iDVBSectionReader> reader;
147 res = demux->createSectionReader(eApp, reader);
150 return start(reader, table);
159 void eAUGTable::slotTableReady(int error)