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);
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;
}
#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>
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__); */ "
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)
{
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)
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)
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