2 #include <libsig_comp.h>
3 #include <lib/base/ebase.h>
4 #include <lib/base/eerror.h>
6 #include <lib/dvb/dvb.h>
7 #include <lib/dvb/db.h>
8 #include <lib/dvb/isection.h>
9 #include <lib/dvb/esection.h>
10 #include <lib/dvb_si/pmt.h>
11 #include <lib/dvb/specs.h>
14 class eMain: public eApplication, public Object
16 ePtr<eDVBResourceManager> m_mgr;
17 ePtr<iDVBChannel> m_channel;
18 ePtr<iDVBDemux> m_demux;
19 eAUTable<eTable<ProgramMapTable> > m_table;
23 ePtr<eConnection> m_state_change_connection;
24 int m_last_channel_state;
28 eDebug("mich gibts nu!");
30 /* Resourcemanager erstellen */
31 m_mgr = new eDVBResourceManager();
33 /* Dummy DVB-Channellist anlegen.. */
35 /* Datenbank erstellen */
36 m_dvbdb = new eDVBDB();
37 /* als Primary datenbank setzen */
38 m_mgr->setChannelList(m_dvbdb);
40 /* testtransponder adden */
41 eDVBChannelID chid(1,2,3);
43 /* frontenddaten... */
44 eDVBFrontendParametersSatellite fesat;
46 fesat.frequency = 12070000;
47 fesat.symbol_rate = 27500000;
48 fesat.polarisation = eDVBFrontendParametersSatellite::Polarisation::Horizontal;
49 fesat.fec = eDVBFrontendParametersSatellite::FEC::f3_4;
50 fesat.inversion = eDVBFrontendParametersSatellite::Inversion::Off;
51 fesat.orbital_position = 192;
53 eDVBFrontendParameters *fe = new eDVBFrontendParameters();
56 /* Zur Kanalliste hinzufuegen.. */
57 m_dvbdb->addChannelToList(chid, fe);
59 /* Channel allokieren... tunen startet hier, sofern noetig */
60 if (m_mgr->allocateChannel(chid, m_channel))
61 eDebug("shit it failed!");
65 /* Auf State-Change listenen */
66 m_channel->connectStateChange(slot(*this, &eMain::channelStateChanged), m_state_change_connection);
67 /* Initial provozieren */
68 channelStateChanged(m_channel);
72 void channelStateChanged(iDVBChannel *channel)
75 /* Channelstate holen */
76 channel->getState(state);
77 eDebug("channel state is now %d", state);
79 /* Wenn Wechsel von nicht-ok auf ok (das erste mal) */
80 if ((m_last_channel_state != iDVBChannel::state_ok)
81 && (state == iDVBChannel::state_ok) && (!m_demux))
83 eDebug("we'll start tuning!");
86 if (m_channel->getDemux(m_demux))
87 eDebug("shit it failed.. again.");
91 /* auf table ready connecten */
92 CONNECT(m_table.tableReady, eMain::tableReady);
93 /* und section lesen beginnen */
94 m_table.begin(this, eDVBPMTSpec(0x20, 0x33f6), m_demux);
98 m_last_channel_state = state;
103 /* table "fertig" (wie auch immer) */
104 ePtr<eTable<ProgramMapTable> > ptr;
106 if (!m_table.getCurrent(ptr))
109 ProgramMapTableConstIterator i;
110 for (i = ptr->getSections().begin(); i != ptr->getSections().end(); ++i)
112 const ProgramMapTable &pmt = **i;
113 eDebug("pcr pid: %x", pmt.getPcrPid());
115 eDebug("program map ...");
119 eDebug("table ready.");
124 eDebug("... nicht mehr.");
129 int object_total_remaining;
133 printf("%d items left\n", object_total_remaining);