I can give a try (although i think i'll fail).
The following are ok, or totally wrong?
1. getEvent in servicemp3.cpp
RESULT eServiceMP3::getEvent(ePtr<eServiceEvent> &evt, int nownext)
{
return m_event_handler.getEvent(evt, nownext);
}
2. m_event_handler,m_nownext_timer,updateEpgCacheNowNext in servicemp3.h
eDVBServiceEITHandler m_event_handler;
ePtr<eTimer> m_nownext_timer;
void updateEpgCacheNowNext();
3. connect m_eit_changed on eServiceMP3 constructor
m_nownext_timer(eTimer::create(eApp))
CONNECT(m_event_handler.m_eit_changed, eServiceMP3::gotNewEvent);
CONNECT(m_nownext_timer->timeout, eServiceMP3::updateEpgCacheNowNext);
4. create getNewEvent on eServiceMP3
void eServiceMP3::gotNewEvent(int error)
{
ePtr<eServiceEvent> event_now;
getEvent(event_now, 0);
#if 0
// debug only
ePtr<eServiceEvent> event_next;
getEvent(event_next, 1);
if (event_now)
eDebug("now running: %s (%d seconds :)", event_now->m_event_name.c_str(), event_now->m_duration);
if (event_next)
eDebug("next running: %s (%d seconds :)", event_next->m_event_name.c_str(), event_next->m_duration);
#endif
if (!error)
{
m_nownext_timer->stop();
m_event((iPlayableService*)this, evUpdatedEventInfo);
}
else
{
/* our eit reader has stopped, we have to take care of our own event updates */
updateEpgCacheNowNext();
}
}
5. create updateEpgCacheNowNext on eServiceMP3
void eServiceMP3::updateEpgCacheNowNext()
{
bool update = false;
ePtr<eServiceEvent> next = 0;
ePtr<eServiceEvent> ptr = 0;
eServiceReference &ref = (eServiceReference&) m_ref;
if (eEPGCache::getInstance() && eEPGCache::getInstance()->lookupEventTime(ref, -1, ptr) >= 0)
{
ePtr<eServiceEvent> current = 0;
m_event_handler.getEvent(current, 0);
if (!current || !ptr || current->getEventId() != ptr->getEventId())
{
update = true;
m_event_handler.inject(ptr, 0);
time_t next_time = ptr->getBeginTime() + ptr->getDuration();
if (eEPGCache::getInstance()->lookupEventTime(ref, next_time, ptr) >= 0)
{
next = ptr;
m_event_handler.inject(ptr, 1);
}
}
}
int refreshtime = 60;
if (!next)
{
m_event_handler.getEvent(next, 1);
}
if (next)
{
time_t now = eDVBLocalTimeHandler::getInstance()->nowTime();
refreshtime = (int)(next->getBeginTime() - now) + 3;
if (refreshtime <= 0 || refreshtime > 60) refreshtime = 60;
}
m_nownext_timer->startLongTimer(refreshtime);
if (update) m_event((iPlayableService*)this, evUpdatedEventInfo);
}
6. Stop timer on eServiceMP3::stop
m_nownext_timer->stop();
Edited by athoik, 24 November 2013 - 14:12.
Wavefield T90: 0.8W - 1.9E - 4.8E - 13E - 16E - 19.2E - 23.5E - 26E - 33E - 39E - 42E - 45E on EMP Centauri DiseqC 16/1
Unamed: 13E Quattro - 9E Quattro on IKUSI MS-0916