aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorAndreas Monzner <andreas.monzner@multimedia-labs.de>2005-07-12 21:10:02 +0000
committerAndreas Monzner <andreas.monzner@multimedia-labs.de>2005-07-12 21:10:02 +0000
commitaa3d1162bef321bd2d0effdafce6eb080660a7ca (patch)
tree746d044753c2c2c8b90f48ccb7adab4d7eb472cc /lib
parentb47c326aad25626034d14ffb630628da2f0e8b97 (diff)
downloadenigma2-aa3d1162bef321bd2d0effdafce6eb080660a7ca.tar.gz
enigma2-aa3d1162bef321bd2d0effdafce6eb080660a7ca.zip
remove unneeded signals ( eDVBChannel::m_stateChanged give us the same informations )
Diffstat (limited to 'lib')
-rw-r--r--lib/dvb/demux.cpp8
-rw-r--r--lib/dvb/dvb.cpp13
-rw-r--r--lib/dvb/dvb.h3
-rw-r--r--lib/dvb/dvbtime.cpp77
-rw-r--r--lib/dvb/dvbtime.h13
-rw-r--r--lib/dvb/epgcache.cpp2
6 files changed, 55 insertions, 61 deletions
diff --git a/lib/dvb/demux.cpp b/lib/dvb/demux.cpp
index f6bdbd7b..f50f4bb2 100644
--- a/lib/dvb/demux.cpp
+++ b/lib/dvb/demux.cpp
@@ -76,7 +76,10 @@ void eDVBSectionReader::data(int)
if ((c = crc32((unsigned)-1, data, r)))
eFatal("crc32 failed! is %x\n", c);
}
- read(data);
+ if (active)
+ read(data);
+ else
+ eDebug("data.. but not active");
}
eDVBSectionReader::eDVBSectionReader(eDVBDemux *demux, eMainloop *context, RESULT &res): demux(demux)
@@ -166,7 +169,8 @@ RESULT eDVBSectionReader::stop()
{
if (!active)
return -1;
-
+
+ active=0;
::ioctl(fd, DMX_STOP);
return 0;
diff --git a/lib/dvb/dvb.cpp b/lib/dvb/dvb.cpp
index 35849b4c..ea51d6a1 100644
--- a/lib/dvb/dvb.cpp
+++ b/lib/dvb/dvb.cpp
@@ -334,7 +334,6 @@ RESULT eDVBResourceManager::removeChannel(eDVBChannel *ch)
{
i = m_active_channels.erase(i);
++cnt;
- /* emit */ m_channelRemoved(ch);
} else
++i;
}
@@ -350,18 +349,6 @@ RESULT eDVBResourceManager::connectChannelAdded(const Slot1<void,eDVBChannel*> &
return 0;
}
-RESULT eDVBResourceManager::connectChannelRemoved(const Slot1<void,eDVBChannel*> &channelRemoved, ePtr<eConnection> &connection)
-{
- connection = new eConnection((eDVBResourceManager*)this, m_channelRemoved.connect(channelRemoved));
- return 0;
-}
-
-RESULT eDVBResourceManager::connectChannelRunning(const Slot1<void,iDVBChannel*> &channelRunning, ePtr<eConnection> &connection)
-{
- connection = new eConnection((eDVBResourceManager*)this, m_channelRunning.connect(channelRunning));
- return 0;
-}
-
DEFINE_REF(eDVBChannel);
eDVBChannel::eDVBChannel(eDVBResourceManager *mgr, eDVBAllocatedFrontend *frontend, eDVBAllocatedDemux *demux): m_state(state_idle), m_mgr(mgr)
diff --git a/lib/dvb/dvb.h b/lib/dvb/dvb.h
index bb9e2689..d0deb2fc 100644
--- a/lib/dvb/dvb.h
+++ b/lib/dvb/dvb.h
@@ -182,7 +182,8 @@ private:
void frontendStateChanged(iDVBFrontend*fe);
ePtr<eConnection> m_conn_frontendStateChanged;
-
+
+ friend class eUsePtr<eDVBChannel>;
/* use count */
oRefCount m_use_count;
void AddUse();
diff --git a/lib/dvb/dvbtime.cpp b/lib/dvb/dvbtime.cpp
index 5167a01e..c8bdd01e 100644
--- a/lib/dvb/dvbtime.cpp
+++ b/lib/dvb/dvbtime.cpp
@@ -129,18 +129,14 @@ eDVBLocalTimeHandler::eDVBLocalTimeHandler()
if (!res_mgr)
eDebug("[eDVBLocalTimerHandler] no resource manager !!!!!!!");
else
- {
res_mgr->connectChannelAdded(slot(*this,&eDVBLocalTimeHandler::DVBChannelAdded), m_chanAddedConn);
- res_mgr->connectChannelRemoved(slot(*this,&eDVBLocalTimeHandler::DVBChannelRemoved), m_chanRemovedConn);
- res_mgr->connectChannelRunning(slot(*this,&eDVBLocalTimeHandler::DVBChannelRunning), m_chanRunningConn);
- }
}
eDVBLocalTimeHandler::~eDVBLocalTimeHandler()
{
instance=0;
- for (std::map<iDVBChannel*, TDT*>::iterator it=m_active_tables.begin(); it != m_active_tables.end(); ++it)
- delete it->second;
+ for (std::map<iDVBChannel*, channel_data>::iterator it=m_knownChannels.begin(); it != m_knownChannels.end(); ++it)
+ delete it->second.tdt;
}
void eDVBLocalTimeHandler::readTimeOffsetData( const char* filename )
@@ -347,52 +343,55 @@ void eDVBLocalTimeHandler::updateTime( time_t tp_time, eDVBChannel *chan )
if ( restart_tdt )
{
- std::map<iDVBChannel*, TDT*>::iterator it =
- m_active_tables.find(chan);
- if ( it != m_active_tables.end() )
+ std::map<iDVBChannel*, channel_data>::iterator it =
+ m_knownChannels.find(chan);
+ if ( it != m_knownChannels.end() )
{
- delete it->second;
- it->second = new TDT(chan);
- it->second->startTimer(60*60*1000); // restart TDT for this transponder in 60min
+ delete it->second.tdt;
+ it->second.tdt = new TDT(chan);
+ it->second.tdt->startTimer(60*1000); // restart TDT for this transponder in 60min
}
}
-
}
void eDVBLocalTimeHandler::DVBChannelAdded(eDVBChannel *chan)
{
- eDebug("[eDVBLocalTimerHandler] add channel %p", chan);
if ( chan )
{
- std::map<iDVBChannel*, TDT*>::iterator it =
- m_active_tables.find(chan);
- if ( it != m_active_tables.end() )
- {
- delete it->second;
- it->second = new TDT(chan);
- }
- else
- m_active_tables[chan] = new TDT(chan);
+ eDebug("[eDVBLocalTimerHandler] add channel %p", chan);
+ std::pair<std::map<iDVBChannel*, channel_data>::iterator, bool> tmp =
+ m_knownChannels.insert( std::pair<iDVBChannel*, channel_data>(chan, channel_data()) );
+ tmp.first->second.tdt = new TDT(chan);
+ tmp.first->second.channel = chan;
+ chan->connectStateChange(slot(*this, &eDVBLocalTimeHandler::DVBChannelStateChanged), tmp.first->second.m_stateChangedConn);
}
}
-void eDVBLocalTimeHandler::DVBChannelRemoved(eDVBChannel *chan)
+void eDVBLocalTimeHandler::DVBChannelStateChanged(iDVBChannel *chan)
{
- eDebug("[eDVBLocalTimerHandler] remove channel %p", chan);
- std::map<iDVBChannel*, TDT*>::iterator it =
- m_active_tables.find(chan);
- if ( it != m_active_tables.end() )
+ std::map<iDVBChannel*, channel_data>::iterator it =
+ m_knownChannels.find(chan);
+ if ( it != m_knownChannels.end() )
{
- delete it->second;
- m_active_tables.erase(it);
+ int state=0;
+ chan->getState(state);
+ switch (state)
+ {
+ case iDVBChannel::state_idle:
+ break;
+ case iDVBChannel::state_tuning:
+ break;
+ case iDVBChannel::state_unavailable:
+ break;
+ case iDVBChannel::state_ok:
+ eDebug("[eDVBLocalTimerHandler] channel %p running", chan);
+ it->second.tdt->start();
+ break;
+ case iDVBChannel::state_release:
+ eDebug("[eDVBLocalTimerHandler] remove channel %p", chan);
+ delete it->second.tdt;
+ m_knownChannels.erase(it);
+ break;
+ }
}
}
-
-void eDVBLocalTimeHandler::DVBChannelRunning(iDVBChannel *chan)
-{
- eDebug("[eDVBLocalTimerHandler] start channel %p", chan);
- std::map<iDVBChannel*, TDT*>::iterator it =
- m_active_tables.find(chan);
- if ( it != m_active_tables.end() )
- it->second->start();
-}
diff --git a/lib/dvb/dvbtime.h b/lib/dvb/dvbtime.h
index 59a26c21..3b92fd1e 100644
--- a/lib/dvb/dvbtime.h
+++ b/lib/dvb/dvbtime.h
@@ -33,19 +33,22 @@ public:
class eDVBLocalTimeHandler: public Object
{
+ struct channel_data
+ {
+ TDT *tdt;
+ ePtr<eDVBChannel> channel;
+ ePtr<eConnection> m_stateChangedConn;
+ };
friend class TDT;
DECLARE_REF(eDVBLocalTimeHandler)
- std::map<iDVBChannel*, TDT*> m_active_tables;
+ std::map<iDVBChannel*, channel_data> m_knownChannels;
std::map<eDVBChannelID,int> m_timeOffsetMap;
ePtr<eConnection> m_chanAddedConn;
- ePtr<eConnection> m_chanRemovedConn;
- ePtr<eConnection> m_chanRunningConn;
bool m_time_ready;
int m_time_difference;
int m_last_tp_time_difference;
void DVBChannelAdded(eDVBChannel*);
- void DVBChannelRemoved(eDVBChannel*);
- void DVBChannelRunning(iDVBChannel*);
+ void DVBChannelStateChanged(iDVBChannel*);
void readTimeOffsetData(const char*);
void writeTimeOffsetData(const char*);
void updateTime(time_t tp_time, eDVBChannel*);
diff --git a/lib/dvb/epgcache.cpp b/lib/dvb/epgcache.cpp
index 41635b03..634aead3 100644
--- a/lib/dvb/epgcache.cpp
+++ b/lib/dvb/epgcache.cpp
@@ -641,7 +641,7 @@ void eEPGCache::startCache(const eServiceReferenceDVB& ref)
else
{
ePtr<iDVBDemux> demux;
- res_mgr->allocateChannel(chid, m_currentChannel);
+// res_mgr->allocateChannel(chid, m_currentChannel);
if ( m_currentChannel->getDemux(demux) )
{
eDebug("[eEPGCache] no demux!!");