X-Git-Url: https://git.cweiske.de/enigma2.git/blobdiff_plain/91eaa14c3fa4ca9596b91d1754976108f3882717..462ec6f4ad2051551cb91c75ba614d3b7b17c543:/lib/dvb/dvb.cpp diff --git a/lib/dvb/dvb.cpp b/lib/dvb/dvb.cpp index f20ce8a2..8af8bb0e 100644 --- a/lib/dvb/dvb.cpp +++ b/lib/dvb/dvb.cpp @@ -304,7 +304,7 @@ RESULT eDVBResourceManager::allocateChannel(const eDVBChannelID &channelid, eUse if(channelid==cache_chan->getChannelID()) { eDebug("use cached_channel"); - channel=m_cached_channel; + channel = m_cached_channel; return 0; } m_cached_channel=0; @@ -591,8 +591,18 @@ void eDVBChannel::frontendStateChanged(iDVBFrontend*fe) ourstate = state_tuning; } else if (state == iDVBFrontend::stateLostLock) { - eDebug("OURSTATE: lost lock"); - ourstate = state_unavailable; + /* on managed channels, we try to retune in order to re-acquire lock. */ + if (m_feparm) + { + eDebug("OURSTATE: lost lock, trying to retune"); + ourstate = state_tuning; + m_frontend->get().tune(*m_feparm); + } else + /* on unmanaged channels, we don't do this. the client will do this. */ + { + eDebug("OURSTATE: lost lock, unavailable now."); + ourstate = state_unavailable; + } } else if (state == iDVBFrontend::stateFailed) { eDebug("OURSTATE: failed"); @@ -607,6 +617,17 @@ void eDVBChannel::frontendStateChanged(iDVBFrontend*fe) } } +void eDVBChannel::pvrEvent(int event) +{ + switch (event) + { + case eFilePushThread::evtEOF: + eDebug("eDVBChannel: End of file!"); + m_event(this, evtEOF); + break; + } +} + void eDVBChannel::AddUse() { ++m_use_count; @@ -641,6 +662,7 @@ RESULT eDVBChannel::setChannel(const eDVBChannelID &channelid, ePtrget().tune(*feparm); + m_feparm = feparm; if (res) { @@ -658,6 +680,12 @@ RESULT eDVBChannel::connectStateChange(const Slot1 &stateChan return 0; } +RESULT eDVBChannel::connectEvent(const Slot2 &event, ePtr &connection) +{ + connection = new eConnection((iDVBChannel*)this, m_event.connect(event)); + return 0; +} + RESULT eDVBChannel::getState(int &state) { state = m_state; @@ -732,7 +760,9 @@ RESULT eDVBChannel::playFile(const char *file) m_stateChanged(this); m_pvr_thread = new eFilePushThread(); + m_pvr_thread->enablePVRCommit(1); m_pvr_thread->start(m_pvr_fd_src, m_pvr_fd_dst); + CONNECT(m_pvr_thread->m_event, eDVBChannel::pvrEvent); return 0; }