diff options
Diffstat (limited to 'lib/service')
| -rw-r--r-- | lib/service/iservice.h | 5 | ||||
| -rw-r--r-- | lib/service/service.cpp | 4 | ||||
| -rw-r--r-- | lib/service/servicedvb.cpp | 62 |
3 files changed, 67 insertions, 4 deletions
diff --git a/lib/service/iservice.h b/lib/service/iservice.h index 0d11dd7e..6cb904e6 100644 --- a/lib/service/iservice.h +++ b/lib/service/iservice.h @@ -39,7 +39,8 @@ public: shouldSort=8, // should be ASCII-sorted according to service_name. great for directories. hasSortKey=16, // has a sort key in data[3]. not having a sort key implies 0. sort1=32, // sort key is 1 instead of 0 - isMarker=64 // Marker + isMarker=64, // Marker + isGroup=128 // is a group of services }; int flags; // flags will NOT be compared. @@ -238,7 +239,7 @@ public: virtual int getLength(const eServiceReference &ref); virtual SWIG_VOID(RESULT) getEvent(const eServiceReference &ref, ePtr<eServiceEvent> &SWIG_OUTPUT, time_t start_time=-1); // returns true when not implemented - virtual bool isPlayable(const eServiceReference &ref, const eServiceReference &ignore); + virtual int isPlayable(const eServiceReference &ref, const eServiceReference &ignore); virtual int getInfo(const eServiceReference &ref, int w); virtual std::string getInfoString(const eServiceReference &ref,int w); diff --git a/lib/service/service.cpp b/lib/service/service.cpp index 181ec22f..82957c81 100644 --- a/lib/service/service.cpp +++ b/lib/service/service.cpp @@ -171,9 +171,9 @@ int iStaticServiceInformation::getLength(const eServiceReference &ref) return -1; } -bool iStaticServiceInformation::isPlayable(const eServiceReference &ref, const eServiceReference &ignore) +int iStaticServiceInformation::isPlayable(const eServiceReference &ref, const eServiceReference &ignore) { - return true; + return 0; } RESULT iServiceInformation::getEvent(ePtr<eServiceEvent> &evt, int m_nownext) diff --git a/lib/service/servicedvb.cpp b/lib/service/servicedvb.cpp index 871a0b26..4b7d63a0 100644 --- a/lib/service/servicedvb.cpp +++ b/lib/service/servicedvb.cpp @@ -39,6 +39,7 @@ class eStaticServiceDVBInformation: public iStaticServiceInformation public: RESULT getName(const eServiceReference &ref, std::string &name); int getLength(const eServiceReference &ref); + int isPlayable(const eServiceReference &ref, const eServiceReference &ignore); }; DEFINE_REF(eStaticServiceDVBInformation); @@ -90,12 +91,30 @@ int eStaticServiceDVBInformation::getLength(const eServiceReference &ref) return -1; } +int eStaticServiceDVBInformation::isPlayable(const eServiceReference &ref, const eServiceReference &ignore) +{ + ePtr<eDVBResourceManager> res_mgr; + if ( eDVBResourceManager::getInstance( res_mgr ) ) + eDebug("isPlayble... no res manager!!"); + else + { + eDVBChannelID chid, chid_ignore; + ((const eServiceReferenceDVB&)ref).getChannelID(chid); + ((const eServiceReferenceDVB&)ignore).getChannelID(chid_ignore); + return res_mgr->canAllocateChannel(chid, chid_ignore); + } + 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); @@ -133,6 +152,46 @@ RESULT eStaticServiceDVBBouquetInformation::getName(const eServiceReference &ref return -1; } +int eStaticServiceDVBBouquetInformation::isPlayable(const eServiceReference &ref, const eServiceReference &ignore) +{ + if (ref.flags & eServiceReference::isGroup) + { + ePtr<iDVBChannelList> db; + ePtr<eDVBResourceManager> res; + + if (eDVBResourceManager::getInstance(res)) + { + eDebug("eStaticServiceDVBBouquetInformation::isPlayable failed.. no resource manager!"); + return false; + } + + if (res->getChannelList(db)) + { + eDebug("eStaticServiceDVBBouquetInformation::isPlayable failed.. no channel list!"); + return false; + } + + eBouquet *bouquet=0; + if (db->getBouquet(ref, bouquet)) + { + eDebug("eStaticServiceDVBBouquetInformation::isPlayable failed.. getBouquet failed!"); + return false; + } + + 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; + ((const eServiceReferenceDVB&)*it).getChannelID(chid); + if (res->canAllocateChannel(chid, chid_ignore)) + return true; + } + } + m_playable_service = eServiceReference(); + return false; +} + int eStaticServiceDVBBouquetInformation::getLength(const eServiceReference &ref) { return -1; @@ -1211,6 +1270,7 @@ int eDVBServicePlay::getInfo(int w) case sTSID: return ((const eServiceReferenceDVB&)m_reference).getTransportStreamID().get(); case sNamespace: return ((const eServiceReferenceDVB&)m_reference).getDVBNamespace().get(); case sProvider: if (!m_dvb_service) return -1; return -2; + case sServiceref: return resIsString; default: return -1; } @@ -1223,6 +1283,8 @@ std::string eDVBServicePlay::getInfoString(int w) case sProvider: if (!m_dvb_service) return ""; return m_dvb_service->m_provider_name; + case sServiceref: + return m_reference.toString(); default: break; } |
