4 #include <lib/dvb/idemux.h>
7 class eGTable: public iObject, public Object
11 ePtr<iDVBSectionReader> m_reader;
12 eDVBTableSpec m_table;
18 void sectionRead(const __u8 *data);
20 ePtr<eConnection> m_sectionRead_conn;
22 virtual int createTable(unsigned int nr, const __u8 *data, unsigned int max)=0;
24 Signal1<void, int> tableReady;
26 RESULT start(iDVBSectionReader *reader, const eDVBTableSpec &table);
27 RESULT start(iDVBDemux *reader, const eDVBTableSpec &table);
28 RESULT getSpec(eDVBTableSpec &spec) { spec = m_table; return 0; }
34 template <class Section>
35 class eTable: public eGTable
38 std::vector<Section*> sections;
41 int createTable(unsigned int nr, const __u8 *data, unsigned int max)
43 unsigned int ssize = sections.size();
44 if (max < ssize || nr >= max)
46 eDebug("kaputt max(%d) < ssize(%d) || nr(%d) >= max(%d)",
50 if (avail.find(nr) != avail.end())
54 sections[nr] = new Section(data);
57 for (unsigned int i = 0; i < max; ++i)
58 if (avail.find(i) != avail.end())
63 eDebug(" %d/%d TID %02x", avail.size(), max, data[0]);
65 if (avail.size() == max)
73 std::vector<Section*> &getSections() { return sections; }
79 for (std::set<int>::iterator i(avail.begin()); i != avail.end(); ++i)
84 class eAUGTable: public Object
87 void slotTableReady(int);
89 Signal1<void, int> tableReady;
90 virtual void getNext(int err)=0;
93 template <class Table>
94 class eAUTable: public eAUGTable
96 ePtr<Table> current, next; // current is READY AND ERRORFREE, next is not yet ready
98 ePtr<iDVBDemux> m_demux;
117 int begin(eMainloop *m, const eDVBTableSpec &spec, ePtr<iDVBDemux> demux)
124 CONNECT(next->tableReady, eAUTable::slotTableReady);
125 next->start(demux, spec);
133 /*emit*/ tableReady(0);
137 /*emit*/ tableReady(-1);
143 RESULT getCurrent(ePtr<Table> &ptr)
154 eDebug("eAUTable: aborted!");
167 void inject(Table *t)
173 void getNext(int error)
180 /*emit*/ tableReady(error);
189 assert(current->ready);
191 /*emit*/ tableReady(0);
195 if (current && (!current->getSpec(spec)))
198 CONNECT(next->tableReady, eAUTable::slotTableReady);
199 spec.flags &= ~(eDVBTableSpec::tfAnyVersion|eDVBTableSpec::tfThisVersion|eDVBTableSpec::tfHaveTimeout);
200 next->eGTable::start(m_demux, spec);