aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndreas Monzner <andreas.monzner@multimedia-labs.de>2006-11-29 22:11:03 +0000
committerAndreas Monzner <andreas.monzner@multimedia-labs.de>2006-11-29 22:11:03 +0000
commit0ee9e6abfea296a1edced778f5c3ccd9d3f1e67b (patch)
tree61b2fc829278abb01c59cb3f66d9f9edb993606b
parentce9a39dcd70a49c1348b0ffaac61e01d4f9555e2 (diff)
downloadenigma2-0ee9e6abfea296a1edced778f5c3ccd9d3f1e67b.tar.gz
enigma2-0ee9e6abfea296a1edced778f5c3ccd9d3f1e67b.zip
some changes for new service groups
-rw-r--r--lib/dvb/dvb.cpp6
-rw-r--r--lib/python/enigma_python.i10
-rw-r--r--lib/service/servicedvb.cpp31
-rw-r--r--lib/service/servicedvb.h11
4 files changed, 37 insertions, 21 deletions
diff --git a/lib/dvb/dvb.cpp b/lib/dvb/dvb.cpp
index c3c0a026..135d0547 100644
--- a/lib/dvb/dvb.cpp
+++ b/lib/dvb/dvb.cpp
@@ -529,7 +529,7 @@ int eDVBResourceManager::canAllocateFrontend(ePtr<iDVBFrontendParameters> &fepar
int eDVBResourceManager::canAllocateChannel(const eDVBChannelID &channelid, const eDVBChannelID& ignore)
{
- bool ret=true;
+ bool ret=3000;
if (m_cached_channel)
{
eDVBChannel *cache_chan = (eDVBChannel*)&(*m_cached_channel);
@@ -615,14 +615,14 @@ int eDVBResourceManager::canAllocateChannel(const eDVBChannelID &channelid, cons
if (!m_list)
{
eDebug("no channel list set!");
- ret = false;
+ ret = 0;
goto error;
}
if (m_list->getChannelFrontendData(channelid, feparm))
{
eDebug("channel not found!");
- ret = false;
+ ret = 0;
goto error;
}
diff --git a/lib/python/enigma_python.i b/lib/python/enigma_python.i
index 21c0664a..ebe934a5 100644
--- a/lib/python/enigma_python.i
+++ b/lib/python/enigma_python.i
@@ -45,6 +45,7 @@ is usually caused by not marking PSignals as immutable.
#include <lib/service/iservice.h>
#include <lib/service/service.h>
#include <lib/service/event.h>
+#include <lib/service/servicedvb.h>
#include <lib/gdi/fb.h>
#include <lib/gdi/font.h>
#include <lib/gdi/gpixmap.h>
@@ -98,6 +99,14 @@ extern int getPrevAsciiCode();
extern int isUTF8(const std::string &);
extern std::string convertUTF8DVB(const std::string &, int);
extern std::string convertDVBUTF8(const unsigned char *data, int len, int table, int tsidonid);
+PyObject *getBestPlayableServiceReference(const eServiceReference &bouquet_ref, const eServiceReference &ignore)
+{
+ eStaticServiceDVBBouquetInformation info;
+ if (info.isPlayable(bouquet_ref, ignore))
+ return New_eServiceReference(info.getPlayableService());
+ Py_INCREF(Py_None);
+ return Py_None;
+}
%}
%feature("ref") iObject "$this->AddRef(); /* eDebug(\"AddRef (%s:%d)!\", __FILE__, __LINE__); */ "
@@ -273,6 +282,7 @@ int getPrevAsciiCode();
void runMainloop();
void quitMainloop(int exit_code);
eApplication *getApplication();
+PyObject *getBestPlayableServiceReference(const eServiceReference &bouquet_ref, const eServiceReference &ignore);
%{
RESULT SwigFromPython(ePtr<gPixmap> &result, PyObject *obj)
{
diff --git a/lib/service/servicedvb.cpp b/lib/service/servicedvb.cpp
index 4b7d63a0..56a18e48 100644
--- a/lib/service/servicedvb.cpp
+++ b/lib/service/servicedvb.cpp
@@ -106,17 +106,6 @@ int eStaticServiceDVBInformation::isPlayable(const eServiceReference &ref, const
return false;
}
-
-class eStaticServiceDVBBouquetInformation: public iStaticServiceInformation
-{
- DECLARE_REF(eStaticServiceDVBBouquetInformation);
-public:
- eServiceReference m_playable_service;
- RESULT getName(const eServiceReference &ref, std::string &name);
- int getLength(const eServiceReference &ref);
- int isPlayable(const eServiceReference &ref, const eServiceReference &ignore);
-};
-
DEFINE_REF(eStaticServiceDVBBouquetInformation);
RESULT eStaticServiceDVBBouquetInformation::getName(const eServiceReference &ref, std::string &name)
@@ -162,34 +151,40 @@ int eStaticServiceDVBBouquetInformation::isPlayable(const eServiceReference &ref
if (eDVBResourceManager::getInstance(res))
{
eDebug("eStaticServiceDVBBouquetInformation::isPlayable failed.. no resource manager!");
- return false;
+ return 0;
}
if (res->getChannelList(db))
{
eDebug("eStaticServiceDVBBouquetInformation::isPlayable failed.. no channel list!");
- return false;
+ return 0;
}
eBouquet *bouquet=0;
if (db->getBouquet(ref, bouquet))
{
eDebug("eStaticServiceDVBBouquetInformation::isPlayable failed.. getBouquet failed!");
- return false;
+ return 0;
}
+ int cur=0;
eDVBChannelID chid, chid_ignore;
((const eServiceReferenceDVB&)ignore).getChannelID(chid_ignore);
for (std::list<eServiceReference>::iterator it(bouquet->m_services.begin()); it != bouquet->m_services.end(); ++it)
{
- m_playable_service = *it;
+ int tmp=res->canAllocateChannel(chid, chid_ignore);
((const eServiceReferenceDVB&)*it).getChannelID(chid);
- if (res->canAllocateChannel(chid, chid_ignore))
- return true;
+ if (tmp > cur)
+ {
+ m_playable_service = *it;
+ cur = tmp;
+ }
}
+ if (cur)
+ return cur;
}
m_playable_service = eServiceReference();
- return false;
+ return 0;
}
int eStaticServiceDVBBouquetInformation::getLength(const eServiceReference &ref)
diff --git a/lib/service/servicedvb.h b/lib/service/servicedvb.h
index 979a9cab..e12e3e19 100644
--- a/lib/service/servicedvb.h
+++ b/lib/service/servicedvb.h
@@ -268,4 +268,15 @@ private:
void radioTextUpdated();
};
+class eStaticServiceDVBBouquetInformation: public iStaticServiceInformation
+{
+ DECLARE_REF(eStaticServiceDVBBouquetInformation);
+ eServiceReference m_playable_service;
+public:
+ eServiceReference &getPlayableService() { return m_playable_service; }
+ RESULT getName(const eServiceReference &ref, std::string &name);
+ int getLength(const eServiceReference &ref);
+ int isPlayable(const eServiceReference &ref, const eServiceReference &ignore);
+};
+
#endif