4 #include <lib/dvb/idemux.h>
7 class eGTable: public iObject, public Object
10 ePtr<iDVBSectionReader> m_reader;
11 eDVBTableSpec m_table;
17 void sectionRead(const __u8 *data);
19 ePtr<eConnection> m_sectionRead_conn;
21 virtual int createTable(unsigned int nr, const __u8 *data, unsigned int max)=0;
23 Signal1<void, int> tableReady;
25 RESULT start(iDVBSectionReader *reader, const eDVBTableSpec &table);
26 RESULT start(iDVBDemux *reader, const eDVBTableSpec &table);
27 RESULT getSpec(eDVBTableSpec &spec) { spec = m_table; return 0; }
33 template <class Section>
34 class eTable: public eGTable
37 std::vector<Section*> sections;
40 int createTable(unsigned int nr, const __u8 *data, unsigned int max)
42 unsigned int ssize = sections.size();
43 if (max < ssize || nr >= max)
45 eDebug("kaputt max(%d) < ssize(%d) || nr(%d) >= max(%d)",
49 if (avail.find(nr) != avail.end())
53 sections[nr] = new Section(data);
56 for (unsigned int i = 0; i < max; ++i)
57 if (avail.find(i) != avail.end())
62 eDebug(" %d/%d TID %02x", avail.size(), max, data[0]);
64 if (avail.size() == max)
72 std::vector<Section*> &getSections() { return sections; }
78 for (std::set<int>::iterator i(avail.begin()); i != avail.end(); ++i)
83 class eAUGTable: public Object
86 void slotTableReady(int);
88 Signal1<void, int> tableReady;
89 virtual void getNext(int err)=0;
92 template <class Table>
93 class eAUTable: public eAUGTable
95 ePtr<Table> current, next; // current is READY AND ERRORFREE, next is not yet ready
97 ePtr<iDVBDemux> m_demux;
116 int begin(eMainloop *m, const eDVBTableSpec &spec, ePtr<iDVBDemux> demux)
123 CONNECT(next->tableReady, eAUTable::slotTableReady);
124 next->start(demux, spec);
132 /*emit*/ tableReady(0);
136 /*emit*/ tableReady(-1);
142 RESULT getCurrent(ePtr<Table> &ptr)
153 eDebug("eAUTable: aborted!");
166 void inject(Table *t)
172 void getNext(int error)
179 /*emit*/ tableReady(error);
188 assert(current->ready);
190 /*emit*/ tableReady(0);
194 if (current && (!current->getSpec(spec)))
197 CONNECT(next->tableReady, eAUTable::slotTableReady);
198 spec.flags &= ~(eDVBTableSpec::tfAnyVersion|eDVBTableSpec::tfThisVersion|eDVBTableSpec::tfHaveTimeout);
199 next->eGTable::start(m_demux, spec);