aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorFelix Domke <tmbinc@elitedvb.net>2005-11-09 17:31:11 +0000
committerFelix Domke <tmbinc@elitedvb.net>2005-11-09 17:31:11 +0000
commitc2f1a638b1eb861d1a8e97530adfcefd65ff6ac0 (patch)
treee9dcd978df830b03690a5502362275dc666bddbc /lib
parentefd666f5dfe5a6d355d0ba60683c9457714f75e9 (diff)
downloadenigma2-c2f1a638b1eb861d1a8e97530adfcefd65ff6ac0.tar.gz
enigma2-c2f1a638b1eb861d1a8e97530adfcefd65ff6ac0.zip
differentiate between failures while and after tuning
Diffstat (limited to 'lib')
-rw-r--r--lib/dvb/dvb.cpp14
-rw-r--r--lib/dvb/frontend.cpp10
-rw-r--r--lib/dvb/idvb.h4
-rw-r--r--lib/dvb/pmt.cpp10
-rw-r--r--lib/dvb/pmt.h1
-rw-r--r--lib/dvb/scan.cpp3
-rw-r--r--lib/service/iservice.h1
-rw-r--r--lib/service/servicedvb.cpp7
8 files changed, 38 insertions, 12 deletions
diff --git a/lib/dvb/dvb.cpp b/lib/dvb/dvb.cpp
index 35e5c993..13ae224c 100644
--- a/lib/dvb/dvb.cpp
+++ b/lib/dvb/dvb.cpp
@@ -176,7 +176,6 @@ eDVBResourceManager::~eDVBResourceManager()
{
if (instance == this)
instance = 0;
-
}
void eDVBResourceManager::addAdapter(iDVBAdapter *adapter)
@@ -288,7 +287,7 @@ RESULT eDVBResourceManager::allocateChannel(const eDVBChannelID &channelid, eUse
// return errNoDemux;
RESULT res;
- eDVBChannel *ch;
+ ePtr<eDVBChannel> ch;
ch = new eDVBChannel(this, fe);
ePtr<iDVBFrontend> myfe;
@@ -346,7 +345,6 @@ RESULT eDVBResourceManager::allocatePVRChannel(eUsePtr<iDVBPVRChannel> &channel)
RESULT eDVBResourceManager::addChannel(const eDVBChannelID &chid, eDVBChannel *ch)
{
- eDebug("add channel %p", ch);
m_active_channels.push_back(active_channel(chid, ch));
/* emit */ m_channelAdded(ch);
return 0;
@@ -404,7 +402,6 @@ eDVBChannel::~eDVBChannel()
void eDVBChannel::frontendStateChanged(iDVBFrontend*fe)
{
- eDebug("fe state changed!");
int state, ourstate = 0;
/* if we are already in shutdown, don't change state. */
@@ -422,10 +419,14 @@ void eDVBChannel::frontendStateChanged(iDVBFrontend*fe)
{
eDebug("OURSTATE: tuning");
ourstate = state_tuning;
- } else if (state == iDVBFrontend::stateFailed)
+ } else if (state == iDVBFrontend::stateLostLock)
{
- eDebug("OURSTATE: failed/unavailable");
+ eDebug("OURSTATE: lost lock");
ourstate = state_unavailable;
+ } else if (state == iDVBFrontend::stateFailed)
+ {
+ eDebug("OURSTATE: failed");
+ ourstate = state_failed;
} else
eFatal("state unknown");
@@ -475,7 +476,6 @@ RESULT eDVBChannel::setChannel(const eDVBChannelID &channelid)
eDebug("channel not found!");
return -ENOENT;
}
- eDebug("allocateChannel: channel found..");
if (!m_frontend)
{
diff --git a/lib/dvb/frontend.cpp b/lib/dvb/frontend.cpp
index 37ce13a6..b8debd81 100644
--- a/lib/dvb/frontend.cpp
+++ b/lib/dvb/frontend.cpp
@@ -341,7 +341,12 @@ void eDVBFrontend::feEvent(int w)
if (m_tuning)
state = stateTuning;
else
- state = stateFailed;
+ {
+ state = stateLostLock;
+
+ if (m_state != stateLostLock)
+ eDebug("FIXME: we lost lock, so we might have to retune.");
+ }
}
if (m_state != state)
{
@@ -363,6 +368,7 @@ void eDVBFrontend::timeout()
m_state = state;
m_stateChanged(this);
}
+ m_tuning = 0;
} else
m_tuning = 0;
}
@@ -610,8 +616,6 @@ RESULT eDVBFrontend::tune(const iDVBFrontendParameters &where)
m_sec_sequence.clear();
- eDebug("eDVBFrontend::tune. type: %d", m_type);
-
switch (m_type)
{
case feSatellite:
diff --git a/lib/dvb/idvb.h b/lib/dvb/idvb.h
index d353611d..bd528f06 100644
--- a/lib/dvb/idvb.h
+++ b/lib/dvb/idvb.h
@@ -401,7 +401,8 @@ public:
stateIdle = 0,
stateTuning = 1,
stateFailed = 2,
- stateLock = 3
+ stateLock = 3,
+ stateLostLock = 4,
};
virtual RESULT getState(int &state)=0;
enum {
@@ -438,6 +439,7 @@ public:
{
state_idle, /* not yet tuned */
state_tuning, /* currently tuning (first time) */
+ state_failed, /* tuning failed. */
state_unavailable, /* currently unavailable, will be back without further interaction */
state_ok, /* ok */
state_release /* channel is being shut down. */
diff --git a/lib/dvb/pmt.cpp b/lib/dvb/pmt.cpp
index 538264db..d7186d5c 100644
--- a/lib/dvb/pmt.cpp
+++ b/lib/dvb/pmt.cpp
@@ -44,6 +44,11 @@ void eDVBServicePMTHandler::channelStateChanged(iDVBChannel *channel)
if ( m_service && !m_service->cacheEmpty() )
serviceEvent(eventNewProgramInfo);
}
+ } else if ((m_last_channel_state != iDVBChannel::state_failed) &&
+ (state == iDVBChannel::state_failed))
+ {
+ eDebug("tune failed.");
+ serviceEvent(eventTuneFailed);
}
}
@@ -206,6 +211,7 @@ int eDVBServicePMTHandler::tune(eServiceReferenceDVB &ref)
eDVBChannelID chid;
ref.getChannelID(chid);
res = m_resourceManager->allocateChannel(chid, m_channel);
+ eDebug("allocate Channel: res %d", res);
} else
{
eDVBMetaParser parser;
@@ -230,6 +236,10 @@ int eDVBServicePMTHandler::tune(eServiceReferenceDVB &ref)
m_channelStateChanged_connection);
m_last_channel_state = -1;
channelStateChanged(m_channel);
+ } else
+ {
+ serviceEvent(eventTuneFailed);
+ return res;
}
if (m_pvr_channel)
diff --git a/lib/dvb/pmt.h b/lib/dvb/pmt.h
index b917383b..a60f37b2 100644
--- a/lib/dvb/pmt.h
+++ b/lib/dvb/pmt.h
@@ -75,6 +75,7 @@ public:
enum
{
eventNoResources, // a requested resource couldn't be allocated
+ eventTuneFailed, // tune failed
eventNoPAT, // no pat could be received (timeout)
eventNoPATEntry, // no pat entry for the corresponding SID could be found
eventNoPMT, // no pmt could be received (timeout)
diff --git a/lib/dvb/scan.cpp b/lib/dvb/scan.cpp
index 4188b643..2be8a66d 100644
--- a/lib/dvb/scan.cpp
+++ b/lib/dvb/scan.cpp
@@ -69,11 +69,12 @@ void eDVBScan::stateChange(iDVBChannel *ch)
{
startFilter();
m_channel_state = state;
- } else if (state == iDVBChannel::state_unavailable)
+ } else if (state == iDVBChannel::state_failed)
{
m_ch_unavailable.push_back(m_ch_current);
nextChannel();
}
+ /* unavailable will timeout, anyway. */
}
RESULT eDVBScan::nextChannel()
diff --git a/lib/service/iservice.h b/lib/service/iservice.h
index 92224f80..f9a26722 100644
--- a/lib/service/iservice.h
+++ b/lib/service/iservice.h
@@ -221,6 +221,7 @@ public:
evStart,
evEnd,
+ evTuneFailed,
// when iServiceInformation is implemented:
evUpdatedEventInfo
};
diff --git a/lib/service/servicedvb.cpp b/lib/service/servicedvb.cpp
index 1779d4dc..fdf93d76 100644
--- a/lib/service/servicedvb.cpp
+++ b/lib/service/servicedvb.cpp
@@ -408,6 +408,12 @@ void eDVBServicePlay::serviceEvent(int event)
// eventNoEvent
break;
}
+ case eDVBServicePMTHandler::eventTuneFailed:
+ {
+ eDebug("DVB service failed to tune");
+ m_event((iPlayableService*)this, evTuneFailed);
+ break;
+ }
case eDVBServicePMTHandler::eventNewProgramInfo:
{
int vpid = -1, apid = -1, pcrpid = -1;
@@ -493,6 +499,7 @@ RESULT eDVBServicePlay::start()
int r;
eDebug("starting DVB service");
r = m_service_handler.tune((eServiceReferenceDVB&)m_reference);
+ eDebug("tune result: %d", r);
m_event(this, evStart);
return 0;
}