+class eDVBChannel;
+
+ /* we do NOT handle resource conflicts here. instead, the allocateChannel
+ fails, and the application has to see why the channel is allocated
+ (and how to deallocate it). */
+class iDVBAdapter;
+
+class eDVBRegisteredFrontend: public iObject
+{
+DECLARE_REF(eDVBRegisteredFrontend);
+public:
+ iDVBAdapter *m_adapter;
+ ePtr<eDVBFrontend> m_frontend;
+ int m_inuse;
+ eDVBRegisteredFrontend(eDVBFrontend *fe, iDVBAdapter *adap): m_adapter(adap), m_frontend(fe), m_inuse(0) { }
+};
+
+struct eDVBRegisteredDemux
+{
+DECLARE_REF(eDVBRegisteredDemux);
+public:
+ iDVBAdapter *m_adapter;
+ ePtr<eDVBDemux> m_demux;
+ int m_inuse;
+ eDVBRegisteredDemux(eDVBDemux *demux, iDVBAdapter *adap): m_adapter(adap), m_demux(demux), m_inuse(0) { }
+};
+
+class eDVBAllocatedFrontend
+{
+DECLARE_REF(eDVBAllocatedFrontend);
+public:
+
+ eDVBAllocatedFrontend(eDVBRegisteredFrontend *fe);
+ ~eDVBAllocatedFrontend();
+ eDVBFrontend &get() { return *m_fe->m_frontend; }
+ operator eDVBRegisteredFrontend*() { return m_fe; }
+ operator eDVBFrontend*() { return m_fe->m_frontend; }
+
+private:
+ eDVBRegisteredFrontend *m_fe;
+};
+
+class eDVBAllocatedDemux
+{
+DECLARE_REF(eDVBAllocatedDemux);
+public:
+
+ eDVBAllocatedDemux(eDVBRegisteredDemux *demux);
+ ~eDVBAllocatedDemux();
+ eDVBDemux &get() { return *m_demux->m_demux; }
+ operator eDVBRegisteredDemux*() { return m_demux; }
+ operator eDVBDemux*() { return m_demux->m_demux; }
+
+private:
+ eDVBRegisteredDemux *m_demux;
+};
+
+class iDVBAdapter: public iObject
+{
+public:
+ virtual int getNumDemux() = 0;
+ virtual RESULT getDemux(ePtr<eDVBDemux> &demux, int nr) = 0;
+
+ virtual int getNumFrontends() = 0;
+ virtual RESULT getFrontend(ePtr<eDVBFrontend> &fe, int nr) = 0;
+};
+
+class eDVBAdapterLinux: public iDVBAdapter
+{
+DECLARE_REF(eDVBAdapterLinux);
+public:
+ eDVBAdapterLinux(int nr);
+
+ int getNumDemux();
+ RESULT getDemux(ePtr<eDVBDemux> &demux, int nr);
+
+ int getNumFrontends();
+ RESULT getFrontend(ePtr<eDVBFrontend> &fe, int nr);
+
+ static int exist(int nr);
+private:
+ int m_nr;
+ eSmartPtrList<eDVBFrontend> m_frontend;
+ eSmartPtrList<eDVBDemux> m_demux;
+};