added nims to the about box
[enigma2.git] / lib / dvb / eit.cpp
1 #include <lib/dvb/eit.h>
2 #include <lib/dvb/specs.h>
3 #include <lib/base/eerror.h>
4 #include <lib/service/event.h>
5
6 void eDVBServiceEITHandler::EITready(int error)
7 {
8         if (!error)
9         {
10                 ePtr<eTable<EventInformationSection> > ptr;
11                 if (!m_EIT.getCurrent(ptr))
12                 {
13                         int a = 0;
14                         for (std::vector<EventInformationSection*>::const_iterator i = ptr->getSections().begin();
15                                 i != ptr->getSections().end(); ++i)
16                         {
17                                 for (EventConstIterator ev = (*i)->getEvents()->begin(); ev != (*i)->getEvents()->end(); ++ev)
18                                 {
19                                         ePtr<eServiceEvent> evt = new eServiceEvent();
20                                         evt->parseFrom(*ev);
21                                         if (!a)
22                                                 m_event_now = evt;
23                                         else
24                                                 m_event_next = evt;
25                                         ++a;
26                                 }
27                         }
28                 }
29         }
30
31         m_eit_changed();
32 }
33
34 eDVBServiceEITHandler::eDVBServiceEITHandler()
35 {
36         CONNECT(m_EIT.tableReady, eDVBServiceEITHandler::EITready);
37 }
38
39 void eDVBServiceEITHandler::start(iDVBDemux *demux, int sid)
40 {
41         m_EIT.begin(eApp, eDVBEITSpec(sid), demux);
42 }
43
44 RESULT eDVBServiceEITHandler::getEvent(ePtr<eServiceEvent> &event, int nownext)
45 {
46         event = nownext ? m_event_next : m_event_now;
47         if (!event)
48                 return -1;
49         return 0;
50 }