X-Git-Url: https://git.cweiske.de/enigma2.git/blobdiff_plain/2d0d9ad2cf4891c5386a3d8ca040c2738b5c2532..c9474b61671ed008fc7f18f8bbaafe0fd0a39dd2:/lib/service/servicedvb.cpp?ds=sidebyside diff --git a/lib/service/servicedvb.cpp b/lib/service/servicedvb.cpp index 4b7d63a0..85961550 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::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; + int tmp=res->canAllocateChannel(chid, chid_ignore); + 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) @@ -197,6 +192,13 @@ int eStaticServiceDVBBouquetInformation::getLength(const eServiceReference &ref) return -1; } +#include + +RESULT eStaticServiceDVBBouquetInformation::getEvent(const eServiceReference &ref, ePtr &ptr, time_t start_time) +{ + return eEPGCache::getInstance()->lookupEventTime(ref, start_time, ptr); +} + class eStaticServiceDVBPVRInformation: public iStaticServiceInformation { DECLARE_REF(eStaticServiceDVBPVRInformation); @@ -207,7 +209,7 @@ public: RESULT getName(const eServiceReference &ref, std::string &name); int getLength(const eServiceReference &ref); RESULT getEvent(const eServiceReference &ref, ePtr &SWIG_OUTPUT, time_t start_time); - + int isPlayable(const eServiceReference &ref, const eServiceReference &ignore) { return 1; } int getInfo(const eServiceReference &ref, int w); std::string getInfoString(const eServiceReference &ref,int w); }; @@ -550,7 +552,7 @@ RESULT eDVBServiceList::getNext(eServiceReference &ref) RESULT eDVBServiceList::startEdit(ePtr &res) { - if (m_parent.flags & eServiceReference::flagDirectory) // bouquet + if (m_parent.flags & eServiceReference::canDescent) // bouquet { ePtr db; ePtr resm; @@ -644,7 +646,7 @@ RESULT eServiceFactoryDVB::list(const eServiceReference &ref, ePtr &ptr) { /* is a listable service? */ - if ((ref.flags & eServiceReference::flagDirectory) == eServiceReference::flagDirectory) // bouquet + if (ref.flags & eServiceReference::canDescent) // bouquet { if ( !ref.name.empty() ) // satellites or providers list ptr = m_StaticServiceDVBInfo; @@ -727,6 +729,8 @@ eDVBServicePlay::eDVBServicePlay(const eServiceReference &ref, eDVBService *serv m_subtitle_widget = 0; + m_tune_state = -1; + CONNECT(m_subtitle_sync_timer.timeout, eDVBServicePlay::checkSubtitleTiming); } @@ -753,6 +757,8 @@ void eDVBServicePlay::gotNewEvent() void eDVBServicePlay::serviceEvent(int event) { + m_tune_state = event; + switch (event) { case eDVBServicePMTHandler::eventTuned: @@ -772,9 +778,12 @@ void eDVBServicePlay::serviceEvent(int event) } break; } + case eDVBServicePMTHandler::eventNoPAT: + case eDVBServicePMTHandler::eventNoPATEntry: + case eDVBServicePMTHandler::eventNoPMT: case eDVBServicePMTHandler::eventTuneFailed: { - eDebug("DVB service failed to tune"); + eDebug("DVB service failed to tune - error %d", event); m_event((iPlayableService*)this, evTuneFailed); break; } @@ -1208,18 +1217,21 @@ RESULT eDVBServicePlay::getEvent(ePtr &evt, int nownext) int eDVBServicePlay::getInfo(int w) { eDVBServicePMTHandler::program program; - + if (w == sCAIDs) return resIsPyObject; eDVBServicePMTHandler &h = m_timeshift_active ? m_service_handler_timeshift : m_service_handler; + int no_program_info = 0; + if (h.getProgramInfo(program)) - return -1; + no_program_info = 1; switch (w) { case sAspect: + if (no_program_info) return -1; if (!program.videoStreams.empty() && program.videoStreams[0].component_tag != -1) { ePtr evt; @@ -1258,19 +1270,20 @@ int eDVBServicePlay::getInfo(int w) } } return -1; - case sIsCrypted: return program.isCrypted(); - case sVideoPID: if (program.videoStreams.empty()) return -1; return program.videoStreams[0].pid; - case sVideoType: if (program.videoStreams.empty()) return -1; return program.videoStreams[0].type; - case sAudioPID: if (program.audioStreams.empty()) return -1; return program.audioStreams[0].pid; - case sPCRPID: return program.pcrPid; - case sPMTPID: return program.pmtPid; - case sTXTPID: return program.textPid; + case sIsCrypted: if (no_program_info) return -1; return program.isCrypted(); + case sVideoPID: if (no_program_info) return -1; if (program.videoStreams.empty()) return -1; return program.videoStreams[0].pid; + case sVideoType: if (no_program_info) return -1; if (program.videoStreams.empty()) return -1; return program.videoStreams[0].type; + case sAudioPID: if (no_program_info) return -1; if (program.audioStreams.empty()) return -1; return program.audioStreams[0].pid; + case sPCRPID: if (no_program_info) return -1; return program.pcrPid; + case sPMTPID: if (no_program_info) return -1; return program.pmtPid; + case sTXTPID: if (no_program_info) return -1; return program.textPid; case sSID: return ((const eServiceReferenceDVB&)m_reference).getServiceID().get(); case sONID: return ((const eServiceReferenceDVB&)m_reference).getOriginalNetworkID().get(); 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; + case sDVBState: return m_tune_state; default: return -1; }