aboutsummaryrefslogtreecommitdiff
path: root/lib/dvb
diff options
context:
space:
mode:
authorAndreas Monzner <andreas.monzner@multimedia-labs.de>2005-12-03 12:37:40 +0000
committerAndreas Monzner <andreas.monzner@multimedia-labs.de>2005-12-03 12:37:40 +0000
commit20fdb2a2af40da98427a702a03a79b1fbec3d7af (patch)
treeb0c7cbc1d6bda798795c27e23383436277189f01 /lib/dvb
parent738b4b576eee308b08d3769f6139f989f970a62d (diff)
downloadenigma2-20fdb2a2af40da98427a702a03a79b1fbec3d7af.tar.gz
enigma2-20fdb2a2af40da98427a702a03a79b1fbec3d7af.zip
remove non working indication of playable services in servicelist
get current event in listboxservicecontent via iStaticServiceInformation instead of use directly eEPGCache
Diffstat (limited to 'lib/dvb')
-rw-r--r--lib/dvb/db.cpp10
-rw-r--r--lib/dvb/dvb.cpp102
-rw-r--r--lib/dvb/dvb.h7
-rw-r--r--lib/dvb/idvb.h2
-rw-r--r--lib/dvb/pmt.cpp4
-rw-r--r--lib/dvb/pmt.h2
6 files changed, 99 insertions, 28 deletions
diff --git a/lib/dvb/db.cpp b/lib/dvb/db.cpp
index 8892e4e1..38a062a2 100644
--- a/lib/dvb/db.cpp
+++ b/lib/dvb/db.cpp
@@ -1,6 +1,7 @@
#include <errno.h>
#include <lib/dvb/db.h>
#include <lib/dvb/frontend.h>
+#include <lib/dvb/epgcache.h>
#include <lib/base/eerror.h>
#include <lib/base/estring.h>
#include <dvbsi++/service_description_section.h>
@@ -138,8 +139,8 @@ void eDVBService::genSortName()
RESULT eDVBService::getName(const eServiceReference &ref, std::string &name)
{
- if (!ref.name.empty())
- name = ref.name;
+ if (!ref.name.empty())
+ name = ref.name; // use renamed service name..
else if (!m_service_name.empty())
name = m_service_name;
else
@@ -147,9 +148,10 @@ RESULT eDVBService::getName(const eServiceReference &ref, std::string &name)
return 0;
}
-int eDVBService::getLength(const eServiceReference &ref)
+RESULT eDVBService::getEvent(const eServiceReference &ref, ePtr<eServiceEvent> &ptr)
{
- return -1;
+ time_t t=-1;
+ return eEPGCache::getInstance()->lookupEventTime(ref, t, ptr);
}
int eDVBService::checkFilter(const eServiceReferenceDVB &ref, const eDVBChannelQuery &query)
diff --git a/lib/dvb/dvb.cpp b/lib/dvb/dvb.cpp
index 676c0633..4107c22d 100644
--- a/lib/dvb/dvb.cpp
+++ b/lib/dvb/dvb.cpp
@@ -296,8 +296,7 @@ RESULT eDVBResourceManager::getChannelList(ePtr<iDVBChannelList> &list)
return -ENOENT;
}
-
-RESULT eDVBResourceManager::allocateChannel(const eDVBChannelID &channelid, eUsePtr<iDVBChannel> &channel, bool fake)
+RESULT eDVBResourceManager::allocateChannel(const eDVBChannelID &channelid, eUsePtr<iDVBChannel> &channel)
{
/* first, check if a channel is already existing. */
@@ -335,21 +334,18 @@ RESULT eDVBResourceManager::allocateChannel(const eDVBChannelID &channelid, eUse
if (allocateFrontend(fe, feparm))
return errNoFrontend;
- if (!fake)
- {
- RESULT res;
- ePtr<eDVBChannel> ch;
- ch = new eDVBChannel(this, fe);
+ RESULT res;
+ ePtr<eDVBChannel> ch;
+ ch = new eDVBChannel(this, fe);
- res = ch->setChannel(channelid, feparm);
- if (res)
- {
- channel = 0;
- return errChidNotFound;
- }
-
- channel = ch;
+ res = ch->setChannel(channelid, feparm);
+ if (res)
+ {
+ channel = 0;
+ return errChidNotFound;
}
+ channel = ch;
+
return 0;
}
@@ -410,6 +406,82 @@ RESULT eDVBResourceManager::connectChannelAdded(const Slot1<void,eDVBChannel*> &
return 0;
}
+bool eDVBResourceManager::canAllocateFrontend(ePtr<iDVBFrontendParameters> &feparm, int used_tuner_mask)
+{
+ eDebug("canAllocateFrontend mask %08x", used_tuner_mask);
+ ePtr<eDVBRegisteredFrontend> best;
+ int bestval = 0;
+
+ for (eSmartPtrList<eDVBRegisteredFrontend>::iterator i(m_frontend.begin()); i != m_frontend.end(); ++i)
+ if ( !(used_tuner_mask & (1<<i->m_frontend->getID())) )
+ {
+ int c = i->m_frontend->isCompatibleWith(feparm);
+ if (c > bestval)
+ bestval = c;
+ }
+
+ return bestval>0;
+}
+
+bool eDVBResourceManager::canAllocateChannel(const eDVBChannelID &channelid)
+{
+ return true;
+#if 0
+ int used_tuner_mask=0;
+
+ /* first, check if a channel is already existing. */
+// eDebug("allocate channel.. %04x:%04x", channelid.transport_stream_id.get(), channelid.original_network_id.get());
+ int cnt=0;
+ for (std::list<active_channel>::iterator i(m_active_channels.begin()); i != m_active_channels.end(); ++i, ++cnt)
+ {
+// eDebug("available channel.. %04x:%04x", i->m_channel_id.transport_stream_id.get(), i->m_channel_id.original_network_id.get());
+ if (i->m_channel_id == channelid)
+ {
+// eDebug("found shared channel..");
+ return true;
+ }
+
+ eDebug("activeChannel %d, NonDecoderDemux %p, DecoderDemux %p",
+ cnt, i->m_channel->getNonDecoderDemux(), i->m_channel->getDecoderDemux() );
+ if ( i->m_channel->getNonDecoderDemux() )
+ {
+ ePtr<iDVBFrontend> fe;
+ if (!i->m_channel->getFrontend(fe))
+ {
+ if (fe)
+ {
+ for (eSmartPtrList<eDVBRegisteredFrontend>::iterator ii(m_frontend.begin()); ii != m_frontend.end(); ++ii)
+ {
+ if ( &(*fe) == &(*ii->m_frontend) )
+ {
+ used_tuner_mask |= (1 << ii->m_frontend->getID());
+ break;
+ }
+ }
+ }
+ else
+ eDebug("fe kaputt");
+ }
+ }
+ }
+
+ if (!m_list)
+ {
+ eDebug("no channel list set!");
+ return false;
+ }
+
+ ePtr<iDVBFrontendParameters> feparm;
+ if (m_list->getChannelFrontendData(channelid, feparm))
+ {
+ eDebug("channel not found!");
+ return false;
+ }
+
+ return canAllocateFrontend(feparm, used_tuner_mask);
+#endif
+}
+
DEFINE_REF(eDVBChannel);
eDVBChannel::eDVBChannel(eDVBResourceManager *mgr, eDVBAllocatedFrontend *frontend): m_state(state_idle), m_mgr(mgr)
diff --git a/lib/dvb/dvb.h b/lib/dvb/dvb.h
index 355e2469..5c3c5150 100644
--- a/lib/dvb/dvb.h
+++ b/lib/dvb/dvb.h
@@ -8,7 +8,6 @@
#include <connection.h>
class eDVBChannel;
-class eDVBChannel;
/* we do NOT handle resource conflicts here. instead, the allocateChannel
fails, and the application has to see why the channel is allocated
@@ -142,6 +141,8 @@ class eDVBResourceManager: public iObject
Signal1<void,eDVBChannel*> m_channelAdded;
Signal1<void,eDVBChannel*> m_channelRemoved;
Signal1<void,iDVBChannel*> m_channelRunning;
+
+ bool canAllocateFrontend(ePtr<iDVBFrontendParameters> &feparm, int used_tuner_mask);
public:
eDVBResourceManager();
virtual ~eDVBResourceManager();
@@ -158,13 +159,15 @@ public:
};
/* allocate channel... */
- RESULT allocateChannel(const eDVBChannelID &channelid, eUsePtr<iDVBChannel> &channel, bool fake=false);
+ RESULT allocateChannel(const eDVBChannelID &channelid, eUsePtr<iDVBChannel> &channel);
RESULT allocateRawChannel(eUsePtr<iDVBChannel> &channel, int frontend_index);
RESULT allocatePVRChannel(eUsePtr<iDVBPVRChannel> &channel);
RESULT connectChannelAdded(const Slot1<void,eDVBChannel*> &channelAdded, ePtr<eConnection> &connection);
RESULT connectChannelRemoved(const Slot1<void,eDVBChannel*> &channelRemoved, ePtr<eConnection> &connection);
RESULT connectChannelRunning(const Slot1<void,iDVBChannel*> &channelRemoved, ePtr<eConnection> &connection);
+
+ bool canAllocateChannel(const eDVBChannelID &channelid);
};
class eFilePushThread;
diff --git a/lib/dvb/idvb.h b/lib/dvb/idvb.h
index 119b6e37..c7e22397 100644
--- a/lib/dvb/idvb.h
+++ b/lib/dvb/idvb.h
@@ -218,7 +218,7 @@ public:
// iStaticServiceInformation
RESULT getName(const eServiceReference &ref, std::string &name);
- int getLength(const eServiceReference &ref);
+ RESULT getEvent(const eServiceReference &ref, ePtr<eServiceEvent> &ptr);
/* for filtering: */
int checkFilter(const eServiceReferenceDVB &ref, const eDVBChannelQuery &query);
diff --git a/lib/dvb/pmt.cpp b/lib/dvb/pmt.cpp
index 0fc05240..5a1b7c5c 100644
--- a/lib/dvb/pmt.cpp
+++ b/lib/dvb/pmt.cpp
@@ -9,8 +9,6 @@
#include <dvbsi++/iso639_language_descriptor.h>
#include <dvbsi++/component_descriptor.h>
-int eDVBServicePMTHandler::m_count;
-
eDVBServicePMTHandler::eDVBServicePMTHandler(int record)
:m_ca_servicePtr(0)
{
@@ -19,7 +17,6 @@ eDVBServicePMTHandler::eDVBServicePMTHandler(int record)
CONNECT(m_PMT.tableReady, eDVBServicePMTHandler::PMTready);
CONNECT(m_PAT.tableReady, eDVBServicePMTHandler::PATready);
eDebug("new PMT handler record: %d", m_record);
- ++m_count;
}
eDVBServicePMTHandler::~eDVBServicePMTHandler()
@@ -35,7 +32,6 @@ eDVBServicePMTHandler::~eDVBServicePMTHandler()
eDVBCAService::unregister_service(m_reference, demux_num, ptr);
eDVBCIInterfaces::getInstance()->removePMTHandler(this);
}
- --m_count;
}
void eDVBServicePMTHandler::channelStateChanged(iDVBChannel *channel)
diff --git a/lib/dvb/pmt.h b/lib/dvb/pmt.h
index b8ed76f9..5f3d4777 100644
--- a/lib/dvb/pmt.h
+++ b/lib/dvb/pmt.h
@@ -66,9 +66,7 @@ class eDVBServicePMTHandler: public Object
void PATready(int error);
int m_record;
- static int m_count;
public:
- static int getCount() { return m_count; }
eDVBServicePMTHandler(int record);
~eDVBServicePMTHandler();