2 #include <libsig_comp.h>
3 #include <lib/base/ebase.h>
4 #include <lib/base/eerror.h>
5 #include <lib/base/init.h>
6 #include <lib/base/init_num.h>
8 #include <lib/dvb/dvb.h>
9 #include <lib/dvb/db.h>
10 #include <lib/dvb/isection.h>
11 #include <lib/dvb/esection.h>
12 #include <dvbsi++/program_map_section.h>
13 #include <lib/dvb/scan.h>
16 #include <lib/service/iservice.h>
17 #include <lib/nav/core.h>
19 class eMain: public eApplication, public Object
23 ePtr<eDVBResourceManager> m_mgr;
24 ePtr<iDVBChannel> m_channel;
27 ePtr<iPlayableService> m_playservice;
28 ePtr<eNavigation> m_nav;
29 ePtr<eConnection> m_conn_event;
30 ePtr<iServiceInformation> m_serviceInformation;
34 init.setRunlevel(eAutoInitNumbers::main);
35 m_dvbdb = new eDVBDB();
36 m_mgr = new eDVBResourceManager();
37 m_mgr->setChannelList(m_dvbdb);
39 ePtr<eServiceCenter> service_center;
40 eServiceCenter::getInstance(service_center);
42 assert(service_center);
43 m_nav = new eNavigation(service_center);
47 eServiceReference ref("2:0:1:0:0:0:0:0:0:0:/");
48 ePtr<iListableService> lst;
49 if (service_center->list(ref, lst))
50 eDebug("no list available!");
53 std::list<eServiceReference> list;
54 if (lst->getContent(list))
55 eDebug("list itself SUCKED AROUND!!!");
57 for (std::list<eServiceReference>::const_iterator i(list.begin());
59 eDebug("%s", i->toString().c_str());
63 m_nav->connectEvent(slot(*this, &eMain::event), m_conn_event);
65 // eServiceReference ref("1:0:1:6de2:44d:1:c00000:0:0:0:");
66 eServiceReference ref("4097:47:0:0:0:0:0:0:0:0:/sine_60s_100.mp3");
67 eServiceReference ref1("4097:47:0:0:0:0:0:0:0:0:/sine_60s_100.mp31");
68 eServiceReference ref2("4097:47:0:0:0:0:0:0:0:0:/sine_60s_100.mp32");
70 if (m_nav->enqueueService(ref))
71 eDebug("play sucked around!");
73 eDebug("play r00lz!");
75 m_nav->enqueueService(ref1);
76 m_nav->enqueueService(ref2);
77 m_nav->enqueueService(ref1);
80 void event(eNavigation *nav, int ev)
84 ePtr<ePlaylist> playlist;
85 nav->getPlaylist(playlist);
89 ePlaylist::iterator i;
90 for (i=playlist->begin(); i != playlist->end(); ++i)
91 eDebug("%s %s", i == playlist->m_current ? "-->" : " ", i->toString().c_str());
96 case eNavigation::evStopService:
97 /* very important: the old service should be deallocated, so clear *all* references to it */
98 m_serviceInformation = 0;
99 eDebug("STOP service!");
101 case eNavigation::evNewService:
103 ePtr<iPlayableService> service;
104 nav->getCurrentService(service);
107 eDebug("no running service!");
110 if (service->getIServiceInformation(m_serviceInformation))
112 eDebug("failed to get iserviceinformation");
116 m_serviceInformation->getName(name);
117 eDebug("NEW running service: %s", name.c_str());
120 case eNavigation::evPlayFailed:
121 eDebug("play failed!");
123 case eNavigation::evPlaylistDone:
124 eDebug("playlist done");
128 eDebug("Navigation event %d", ev);
139 int object_total_remaining;
143 printf("%d items left\n", object_total_remaining);
154 int res = app.exec();
155 eDebug("after exec");