From fc2f5b2cd655f1391f2abda1b39e37cdec98a951 Mon Sep 17 00:00:00 2001 From: Felix Domke Date: Fri, 17 Oct 2003 15:35:43 +0000 Subject: Initial revision --- main/enigma-dvbtest.cpp | 125 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 125 insertions(+) create mode 100644 main/enigma-dvbtest.cpp (limited to 'main/enigma-dvbtest.cpp') diff --git a/main/enigma-dvbtest.cpp b/main/enigma-dvbtest.cpp new file mode 100644 index 00000000..4fdb6984 --- /dev/null +++ b/main/enigma-dvbtest.cpp @@ -0,0 +1,125 @@ +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include + +class eMain: public eApplication, public Object +{ + ePtr m_mgr; + ePtr m_channel; + ePtr m_demux; + eAUTable > m_table; + + ePtr m_dvbdb; + + ePtr m_state_change_connection; + int m_last_channel_state; +public: + eMain() + { + eDebug("mich gibts nu!"); + + m_mgr = new eDVBResourceManager(); + + m_dvbdb = new eDVBDB(); + m_mgr->setChannelList(m_dvbdb); + + eDVBChannelID chid(1,2,3); + + eDVBFrontendParametersSatellite fesat; + + fesat.frequency = 12070000; + fesat.symbol_rate = 27500000; + fesat.polarisation = eDVBFrontendParametersSatellite::Polarisation::Horizontal; + fesat.fec = eDVBFrontendParametersSatellite::FEC::f3_4; + fesat.inversion = eDVBFrontendParametersSatellite::Inversion::Off; + fesat.orbital_position = 192; + + eDVBFrontendParameters *fe = new eDVBFrontendParameters(); + + fe->setDVBS(fesat); + + m_dvbdb->addChannelToList(chid, fe); + + if (m_mgr->allocateChannel(chid, m_channel)) + eDebug("shit it failed!"); + + if (m_channel) + { + m_channel->connectStateChange(slot(*this, &eMain::channelStateChanged), m_state_change_connection); + channelStateChanged(m_channel); + } + } + + void channelStateChanged(iDVBChannel *channel) + { + int state; + channel->getState(state); + eDebug("channel state is now %d", state); + + if ((m_last_channel_state != iDVBChannel::state_ok) + && (state == iDVBChannel::state_ok) && (!m_demux)) + { + eDebug("we'll start tuning!"); + if (m_channel) + if (m_channel->getDemux(m_demux)) + eDebug("shit it failed.. again."); + + if (m_demux) + { + CONNECT(m_table.tableReady, eMain::tableReady); + m_table.begin(this, eDVBPMTSpec(0x20, 0x33f6), m_demux); + } + } + + m_last_channel_state = state; + } + + void tableReady(int) + { + ePtr > ptr; + if (!m_table.getCurrent(ptr)) + { + ProgramMapTableConstIterator i; + for (i = ptr->getSections().begin(); i != ptr->getSections().end(); ++i) + { + const ProgramMapTable &pmt = **i; + eDebug("pcr pid: %x", pmt.getPcrPid()); + } + eDebug("program map ..."); + quit(0); + } + eDebug("table ready."); + } + + ~eMain() + { + eDebug("... nicht mehr."); + } +}; + +#ifdef OBJECT_DEBUG +int object_total_remaining; + +void object_dump() +{ + printf("%d items left\n", object_total_remaining); +} +#endif + +int main() +{ +#ifdef OBJECT_DEBUG + atexit(object_dump); +#endif + eMain app; + return app.exec(); +} -- cgit v1.2.3