4 #include <lib/dvb/isection.h>
7 class eGTable: public iObject, public Object
11 ePtr<iDVBSectionReader> m_reader;
12 eDVBTableSpec m_table;
16 void sectionRead(const __u8 *data);
18 ePtr<eConnection> m_sectionRead_conn;
20 virtual int createTable(int nr, const __u8 *data, unsigned int max)=0;
22 Signal1<void, int> tableReady;
24 RESULT start(iDVBSectionReader *reader, const eDVBTableSpec &table);
25 RESULT start(iDVBDemux *reader, const eDVBTableSpec &table);
26 RESULT getSpec(eDVBTableSpec &spec) { spec = m_table; return 0; }
32 template <class Section>
33 class eTable: public eGTable
36 std::vector<Section*> sections;
39 int createTable(int nr, const __u8 *data, unsigned int max)
41 if (avail.find(nr) != avail.end())
46 sections[nr] = new Section(data);
49 for (unsigned int i = 0; i < max; ++i)
50 if (avail.find(i) != avail.end())
55 printf(" %d/%d\n", avail.size(), max);
57 if (avail.size() == max)
63 std::vector<Section*> &getSections() { return sections; }
69 for (typename std::vector<Section*>::iterator i(sections.begin()); i != sections.end(); ++i)
74 class eAUGTable: public Object
77 void slotTableReady(int);
79 Signal1<void, int> tableReady;
80 virtual void getNext(int err)=0;
83 template <class Table>
84 class eAUTable: public eAUGTable
86 ePtr<Table> current, next; // current is READY AND ERRORFREE, next is not yet ready
88 ePtr<iDVBDemux> m_demux;
101 int begin(eMainloop *m, const eDVBTableSpec &spec, ePtr<iDVBDemux> demux)
108 CONNECT(next->tableReady, eAUTable::slotTableReady);
109 next->start(demux, spec);
117 /*emit*/ tableReady(0);
121 /*emit*/ tableReady(-1);
127 RESULT getCurrent(ePtr<Table> &ptr)
138 eDebug("eAUTable: aborted!");
151 void inject(Table *t)
157 void getNext(int error)
164 /*emit*/ tableReady(error);
173 assert(current->ready);
175 /*emit*/ tableReady(0);
179 if (current && (!current->getSpec(spec)))
182 CONNECT(next->tableReady, eAUTable::slotTableReady);
183 spec.flags &= ~(eDVBTableSpec::tfAnyVersion|eDVBTableSpec::tfThisVersion|eDVBTableSpec::tfHaveTimeout);
184 next->eGTable::start(m_demux, spec);