aboutsummaryrefslogtreecommitdiff
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
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
-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
-rw-r--r--lib/service/iservice.h4
-rw-r--r--lib/service/listboxservice.cpp21
-rw-r--r--lib/service/listboxservice.h5
-rw-r--r--lib/service/service.cpp11
-rw-r--r--lib/service/servicedvb.cpp14
11 files changed, 128 insertions, 54 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();
diff --git a/lib/service/iservice.h b/lib/service/iservice.h
index e4127fb9..ab95ef79 100644
--- a/lib/service/iservice.h
+++ b/lib/service/iservice.h
@@ -3,6 +3,7 @@
#include <lib/python/swig.h>
#include <lib/base/object.h>
+#include <lib/service/event.h>
#include <string>
#include <connection.h>
#include <list>
@@ -172,7 +173,8 @@ public:
virtual SWIG_VOID(RESULT) getName(const eServiceReference &ref, std::string &SWIG_OUTPUT)=0;
// doesn't need to be implemented, should return -1 then.
- virtual int getLength(const eServiceReference &ref)=0;
+ virtual int getLength(const eServiceReference &ref);
+ virtual SWIG_VOID(RESULT) getEvent(const eServiceReference &ref, ePtr<eServiceEvent> &SWIG_OUTPUT);
};
TEMPLATE_TYPEDEF(ePtr<iStaticServiceInformation>, iStaticServiceInformationPtr);
diff --git a/lib/service/listboxservice.cpp b/lib/service/listboxservice.cpp
index 9d68a5e8..4e20fcb7 100644
--- a/lib/service/listboxservice.cpp
+++ b/lib/service/listboxservice.cpp
@@ -166,12 +166,10 @@ void eListboxServiceContent::sort()
DEFINE_REF(eListboxServiceContent);
eListboxServiceContent::eListboxServiceContent()
- :m_epgcache(eEPGCache::getInstance()), m_visual_mode(visModeSimple), m_size(0), m_current_marked(false), m_numberoffset(0)
+ :m_visual_mode(visModeSimple), m_size(0), m_current_marked(false), m_numberoffset(0)
{
cursorHome();
eServiceCenter::getInstance(m_service_center);
- if (eDVBResourceManager::getInstance(m_res_mgr))
- eDebug("no resource manager");
}
void eListboxServiceContent::cursorHome()
@@ -339,17 +337,15 @@ void eListboxServiceContent::paint(gPainter &painter, eWindowStyle &style, const
bool tuneable=true;
+#if 0
if (m_res_mgr && cursorValid() && !((m_cursor->flags & eServiceReference::flagDirectory) == eServiceReference::flagDirectory))
{
- if ( eDVBServicePMTHandler::getCount() > 1 )
- {
- eServiceReferenceDVB &ref = (eServiceReferenceDVB&) *m_cursor;
- eUsePtr<iDVBChannel> channel;
- eDVBChannelID chid;
- ref.getChannelID(chid);
- tuneable = !m_res_mgr->allocateChannel(chid, channel, true); // no real allocate channel..just fake
- }
+ eServiceReferenceDVB &ref = (eServiceReferenceDVB&) *m_cursor;
+ eDVBChannelID chid;
+ ref.getChannelID(chid);
+ tuneable = m_res_mgr->canAllocateChannel(chid);
}
+#endif
if (m_current_marked && selected)
style.setStyle(painter, eWindowStyle::styleListboxMarked);
@@ -401,8 +397,7 @@ void eListboxServiceContent::paint(gPainter &painter, eWindowStyle &style, const
case celServiceInfo:
{
ePtr<eServiceEvent> evt;
- time_t t=-1;
- if ( !m_epgcache->lookupEventTime(*m_cursor, t, evt) )
+ if ( !service_info->getEvent(*m_cursor, evt) )
text = '(' + evt->getEventName() + ')';
else
continue;
diff --git a/lib/service/listboxservice.h b/lib/service/listboxservice.h
index 6e8d5017..b1cc249b 100644
--- a/lib/service/listboxservice.h
+++ b/lib/service/listboxservice.h
@@ -1,18 +1,13 @@
#ifndef __lib_service_listboxservice_h
#define __lib_service_listboxservice_h
-#include <lib/dvb/dvb.h>
#include <lib/gui/elistbox.h>
#include <lib/service/iservice.h>
#include <set>
-class eEPGCache;
-
class eListboxServiceContent: public virtual iListboxContent
{
DECLARE_REF(eListboxServiceContent);
- eEPGCache *m_epgcache;
- ePtr<eDVBResourceManager> m_res_mgr;
public:
eListboxServiceContent();
void setRoot(const eServiceReference &ref);
diff --git a/lib/service/service.cpp b/lib/service/service.cpp
index 62bbe12d..a7f6e529 100644
--- a/lib/service/service.cpp
+++ b/lib/service/service.cpp
@@ -133,6 +133,17 @@ RESULT iServiceHandler::info(const eServiceReference &, ePtr<iStaticServiceInfor
#include <lib/service/event.h>
+RESULT iStaticServiceInformation::getEvent(const eServiceReference &ref, ePtr<eServiceEvent> &evt)
+{
+ evt = 0;
+ return -1;
+}
+
+int iStaticServiceInformation::getLength(const eServiceReference &ref)
+{
+ return -1;
+}
+
RESULT iServiceInformation::getEvent(ePtr<eServiceEvent> &evt, int m_nownext)
{
evt = 0;
diff --git a/lib/service/servicedvb.cpp b/lib/service/servicedvb.cpp
index 14326914..96f942ab 100644
--- a/lib/service/servicedvb.cpp
+++ b/lib/service/servicedvb.cpp
@@ -25,7 +25,7 @@ DEFINE_REF(eStaticServiceDVBInformation);
RESULT eStaticServiceDVBInformation::getName(const eServiceReference &ref, std::string &name)
{
- if ( ref.name.length() )
+ if ( !ref.name.empty() )
{
name = ref.name;
return 0;
@@ -358,25 +358,25 @@ RESULT eServiceFactoryDVB::list(const eServiceReference &ref, ePtr<iListableServ
RESULT eServiceFactoryDVB::info(const eServiceReference &ref, ePtr<iStaticServiceInformation> &ptr)
{
- /* do we have a PVR service? */
+ /* is a listable service? */
if ((ref.flags & eServiceReference::flagDirectory) == eServiceReference::flagDirectory) // bouquet
{
- if ( !ref.name.empty() )
+ if ( !ref.name.empty() ) // satellites or providers list
ptr = new eStaticServiceDVBInformation;
- else
+ else // a dvb bouquet
ptr = new eStaticServiceDVBBouquetInformation;
return 0;
}
- else if (!ref.path.empty())
+ else if (!ref.path.empty()) /* do we have a PVR service? */
{
ptr = new eStaticServiceDVBPVRInformation(ref);
return 0;
}
- else
+ else // normal dvb service
{
ePtr<eDVBService> service;
int r = lookupService(service, ref);
- if (r)
+ if (r) // no eDVBService avail for this reference ( Linkage Services... )
ptr = new eStaticServiceDVBInformation;
else
/* eDVBService has the iStaticServiceInformation interface, so we pass it here. */