X-Git-Url: https://git.cweiske.de/enigma2.git/blobdiff_plain/d59ce3f9c60c4466006ad1e148cec9a6e3a29cb2..cd548f05df305c56f7919685499c85998d7c0067:/lib/dvb/dvb.h diff --git a/lib/dvb/dvb.h b/lib/dvb/dvb.h index 5fc2f043..e09f0fae 100644 --- a/lib/dvb/dvb.h +++ b/lib/dvb/dvb.h @@ -1,7 +1,11 @@ #ifndef __dvb_dvb_h #define __dvb_dvb_h +#ifndef SWIG + #include +#include +#include #include #include #include @@ -19,6 +23,7 @@ class eDVBRegisteredFrontend: public iObject, public Object { DECLARE_REF(eDVBRegisteredFrontend); eTimer *disable; + Signal0 stateChanged; void closeFrontend() { if (!m_inuse && m_frontend->closeFrontend()) // frontend busy @@ -28,18 +33,27 @@ 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); } + ~eDVBRegisteredFrontend() + { + delete disable; + } void dec_use() { if (!--m_inuse) + { + /* emit */ stateChanged(); disable->start(3000, true); + } } void inc_use() { if (++m_inuse == 1) + { m_frontend->openFrontend(); + /* emit */ stateChanged(); + } } iDVBAdapter *m_adapter; ePtr m_frontend; @@ -114,14 +128,14 @@ private: eSmartPtrList m_frontend; eSmartPtrList m_demux; }; +#endif // SWIG -class eDVBResourceManager: public iObject +SWIG_IGNORE(eDVBResourceManager); +class eDVBResourceManager: public iObject, public Object { DECLARE_REF(eDVBResourceManager); int avail, busy; - eUsePtr m_cached_channel; - eSmartPtrList m_adapter; eSmartPtrList m_demux; @@ -138,7 +152,7 @@ class eDVBResourceManager: public iObject combinations. this will be evaluated here. */ RESULT allocateFrontend(ePtr &fe, ePtr &feparm); - RESULT allocateFrontendByIndex(ePtr &fe, int index); + RESULT allocateFrontendByIndex(ePtr &fe, int slot_index); /* allocate a demux able to filter on the selected frontend. */ RESULT allocateDemux(eDVBRegisteredFrontend *fe, ePtr &demux, int cap); @@ -164,13 +178,20 @@ class eDVBResourceManager: public iObject Signal1 m_channelAdded; - bool canAllocateFrontend(ePtr &feparm); + int canAllocateFrontend(ePtr &feparm); + + eUsePtr m_cached_channel; + Connection m_cached_channel_state_changed_conn; + eTimer m_releaseCachedChannelTimer; + void DVBChannelStateChanged(iDVBChannel*); + void feStateChanged(); +#ifndef SWIG public: +#endif + void releaseCachedChannel(); eDVBResourceManager(); virtual ~eDVBResourceManager(); - - static RESULT getInstance(ePtr &ptr) { if (instance) { ptr = instance; return 0; } return -1; } - + RESULT setChannelList(iDVBChannelList *list); RESULT getChannelList(ePtr &list); @@ -179,23 +200,39 @@ public: errNoDemux = -2, errChidNotFound = -3 }; + + RESULT connectChannelAdded(const Slot1 &channelAdded, ePtr &connection); + int canAllocateChannel(const eDVBChannelID &channelid, const eDVBChannelID &ignore); /* allocate channel... */ 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); - - bool canAllocateChannel(const eDVBChannelID &channelid, const eDVBChannelID &ignore); + static RESULT getInstance(ePtr &); +#ifdef SWIG +public: +#endif + PSignal1 frontendUseMaskChanged; + SWIG_VOID(RESULT) allocateRawChannel(eUsePtr &SWIG_OUTPUT, int slot_index); + PyObject *setFrontendSlotInformations(SWIG_PYOBJECT(ePyObject) list); }; +SWIG_TEMPLATE_TYPEDEF(ePtr, eDVBResourceManager); +SWIG_EXTEND(ePtr, + static ePtr getInstance() + { + extern ePtr NewResourceManagerPtr(void); + return NewResourceManagerPtr(); + } +); + +#ifndef SWIG -class eFilePushThread; +class eDVBChannelFilePush; /* iDVBPVRChannel includes iDVBChannel. don't panic. */ -class eDVBChannel: public iDVBPVRChannel, public Object +class eDVBChannel: public iDVBPVRChannel, public iFilePushScatterGather, public Object { DECLARE_REF(eDVBChannel); + friend class eDVBResourceManager; public: eDVBChannel(eDVBResourceManager *mgr, eDVBAllocatedFrontend *frontend); virtual ~eDVBChannel(); @@ -213,19 +250,19 @@ public: RESULT setCIRouting(const eDVBCIRouting &routing); RESULT getDemux(ePtr &demux, int cap); RESULT getFrontend(ePtr &frontend); - + RESULT getCurrentFrontendParameters(ePtr ¶m); + /* iDVBPVRChannel */ RESULT playFile(const char *file); + void stopFile(); + + void setCueSheet(eCueSheet *cuesheet); + RESULT getLength(pts_t &len); 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_feparm; // for retune on lostlock ePtr m_frontend; ePtr m_demux, m_decoder_demux; @@ -242,11 +279,23 @@ private: ePtr m_conn_frontendStateChanged; /* for PVR playback */ - eFilePushThread *m_pvr_thread; + eDVBChannelFilePush *m_pvr_thread; void pvrEvent(int event); - int m_pvr_fd_src, m_pvr_fd_dst; + int m_pvr_fd_dst; eDVBTSTools m_tstools; + + ePtr m_cue; + + void cueSheetEvent(int event); + ePtr m_conn_cueSheetEvent; + int m_skipmode_m, m_skipmode_n; + + std::list > m_source_span; + void getNextSourceSpan(off_t current_offset, size_t bytes_read, off_t &start, size_t &size); + void flushPVR(iDVBDemux *decoding_demux=0); + + eSingleLock m_cuesheet_lock; friend class eUsePtr; /* use count */ @@ -254,5 +303,6 @@ private: void AddUse(); void ReleaseUse(); }; +#endif // SWIG #endif