X-Git-Url: https://git.cweiske.de/enigma2.git/blobdiff_plain/2c1f4947646d051133197a23a73ee985b56e1713..c31bef10af2174fc72b9e5658edc81681da4e47e:/lib/dvb/dvb.h diff --git a/lib/dvb/dvb.h b/lib/dvb/dvb.h index 355e2469..23dd7778 100644 --- a/lib/dvb/dvb.h +++ b/lib/dvb/dvb.h @@ -1,13 +1,13 @@ #ifndef __dvb_dvb_h #define __dvb_dvb_h +#include #include #include #include #include #include -class eDVBChannel; class eDVBChannel; /* we do NOT handle resource conflicts here. instead, the allocateChannel @@ -15,14 +15,35 @@ class eDVBChannel; (and how to deallocate it). */ class iDVBAdapter; -class eDVBRegisteredFrontend: public iObject +class eDVBRegisteredFrontend: public iObject, public Object { -DECLARE_REF(eDVBRegisteredFrontend); + DECLARE_REF(eDVBRegisteredFrontend); + eTimer *disable; + void closeFrontend() + { + if (!m_inuse && m_frontend->closeFrontend()) // frontend busy + disable->start(60000, true); // retry close in 60secs + } public: + eDVBRegisteredFrontend(eDVBFrontend *fe, iDVBAdapter *adap) + :disable(new eTimer(eApp)), m_adapter(adap), m_frontend(fe), m_inuse(0) + { + disable = new eTimer(eApp); + CONNECT(disable->timeout, eDVBRegisteredFrontend::closeFrontend); + } + void dec_use() + { + if (!--m_inuse) + disable->start(3000, true); + } + void inc_use() + { + if (++m_inuse == 1) + m_frontend->openFrontend(); + } iDVBAdapter *m_adapter; ePtr m_frontend; int m_inuse; - eDVBRegisteredFrontend(eDVBFrontend *fe, iDVBAdapter *adap): m_adapter(adap), m_frontend(fe), m_inuse(0) { } }; struct eDVBRegisteredDemux @@ -98,7 +119,9 @@ class eDVBResourceManager: public iObject { DECLARE_REF(eDVBResourceManager); int avail, busy; - + + eUsePtr m_cached_channel; + eSmartPtrList m_adapter; eSmartPtrList m_demux; @@ -138,10 +161,10 @@ class eDVBResourceManager: public iObject friend class eDVBChannel; RESULT addChannel(const eDVBChannelID &chid, eDVBChannel *ch); RESULT removeChannel(eDVBChannel *ch); - + Signal1 m_channelAdded; - Signal1 m_channelRemoved; - Signal1 m_channelRunning; + + bool canAllocateFrontend(ePtr &feparm); public: eDVBResourceManager(); virtual ~eDVBResourceManager(); @@ -158,13 +181,13 @@ public: }; /* allocate channel... */ - RESULT allocateChannel(const eDVBChannelID &channelid, eUsePtr &channel, bool fake=false); + RESULT allocateChannel(const eDVBChannelID &channelid, eUsePtr &channel); RESULT allocateRawChannel(eUsePtr &channel, int frontend_index); RESULT allocatePVRChannel(eUsePtr &channel); RESULT connectChannelAdded(const Slot1 &channelAdded, ePtr &connection); - RESULT connectChannelRemoved(const Slot1 &channelRemoved, ePtr &connection); - RESULT connectChannelRunning(const Slot1 &channelRemoved, ePtr &connection); + + bool canAllocateChannel(const eDVBChannelID &channelid, const eDVBChannelID &ignore); }; class eFilePushThread; @@ -192,12 +215,13 @@ public: /* iDVBPVRChannel */ RESULT playFile(const char *file); RESULT getLength(pts_t &len); - RESULT getCurrentPosition(iDVBDemux *decoding_demux, pts_t &pos); + RESULT getCurrentPosition(iDVBDemux *decoding_demux, pts_t &pos, int mode); RESULT seekTo(iDVBDemux *decoding_demux, int relative, pts_t &pts); /* seeking to relative positions won't work - there is an unknown amount of buffers in between */ RESULT seekToPosition(iDVBDemux *decoding_demux, const off_t &off); + int getUseCount() { return m_use_count; } private: ePtr m_frontend; ePtr m_demux, m_decoder_demux;