From: Felix Domke Date: Mon, 31 Jan 2005 22:51:14 +0000 (+0000) Subject: - fixed dvb scan X-Git-Url: http://code.vuplus.com/gitweb/?p=vuplus_dvbapp;a=commitdiff_plain;h=4bc08995411e21f3564f09e136809be68ddf96a8 - fixed dvb scan - fixed dvbdb (reading/writing lamedb) - fixed (i.e. disallow) operator= in iObject (destroyed refcounts before) - implemented listboxcontent for servicelists - implemented getServiceInformation for non-playing services (still not happy with the result, though) - implemented first try of serviceSelector component --- diff --git a/components.py b/components.py index bd4c068..8015621 100644 --- a/components.py +++ b/components.py @@ -241,3 +241,19 @@ class MenuList(HTMLComponent, GUIComponent): def GUIdeleteInstance(self, g): g.setContent(None) + +class ServiceList(HTMLComponent, GUIComponent): + def __init__(self): + GUIComponent.__init__(self) + self.l = eListboxServiceContent() + + def GUIcreateInstance(self, priv, parent, skindata): + g = eListbox(parent) + g.setContent(self.l) + return g + + def GUIdeleteInstance(self, g): + g.setContent(None) + + def setRoot(self, root): + self.l.setRoot(root) diff --git a/include/connection.h b/include/connection.h index ae799c9..5ae90d5 100644 --- a/include/connection.h +++ b/include/connection.h @@ -6,11 +6,10 @@ class eConnection: public iObject, public Connection { - int ref; +DECLARE_REF; +private: ePtr m_owner; public: -DEFINE_REF(eConnection); -public: eConnection(iObject *owner, const Connection &conn): Connection(conn), m_owner(owner) { }; virtual ~eConnection() { disconnect(); } }; diff --git a/lib/base/Makefile.am b/lib/base/Makefile.am index 955d9e4..6094fb4 100644 --- a/lib/base/Makefile.am +++ b/lib/base/Makefile.am @@ -6,4 +6,4 @@ noinst_LIBRARIES = libenigma_base.a libenigma_base_a_SOURCES = \ buffer.cpp ebase.cpp econfig.cpp eerror.cpp elock.cpp \ init.cpp message.cpp thread.cpp \ - smartptr.cpp estring.cpp + smartptr.cpp estring.cpp connection.cpp diff --git a/lib/base/object.h b/lib/base/object.h index ddb4512..64d9a88 100644 --- a/lib/base/object.h +++ b/lib/base/object.h @@ -14,6 +14,11 @@ typedef int RESULT; class iObject { +private: + /* we don't allow the default operator here, as it would break the refcount. */ + void operator=(const iObject &); +protected: + virtual ~iObject() { } public: virtual void AddRef()=0; virtual void Release()=0; @@ -25,6 +30,11 @@ class oRefCount public: oRefCount(): ref(0) { } operator int&() { return ref; } + ~oRefCount() { +#ifdef OBJECT_DEBUG + if (ref) eDebug("OBJECT_DEBUG FATAL: %p has %d references!", this, ref); else eDebug("OBJECT_DEBUG refcount ok! (%p)", this); +#endif + } }; #define DECLARE_REF private: oRefCount ref; public: void AddRef(); void Release(); diff --git a/lib/dvb/db.cpp b/lib/dvb/db.cpp index 1a2cd7d..810aba0 100644 --- a/lib/dvb/db.cpp +++ b/lib/dvb/db.cpp @@ -17,6 +17,16 @@ eDVBService::~eDVBService() { } +eDVBService &eDVBService::operator=(const eDVBService &s) +{ + m_service_name = s.m_service_name; + m_provider_name = s.m_provider_name; + m_flags = s.m_flags; + m_ca = s.m_ca; + m_cache = s.m_cache; + return *this; +} + DEFINE_REF(eDVBDB); eDVBDB::eDVBDB() @@ -67,7 +77,7 @@ eDVBDB::eDVBDB() { eDVBFrontendParametersSatellite sat; int frequency, symbol_rate, polarisation, fec, orbital_position, inversion; - sscanf(line+2, "%d:%d:%d:%d:%d:%d", &frequency, &symbol_rate, &polarisation, &fec, &orbital_position, &inversion); + sscanf(line+2, "%d:%d:%d:%d:%d:%d", &frequency, &symbol_rate, &polarisation, &fec, &inversion, &orbital_position); sat.frequency = frequency; sat.symbol_rate = symbol_rate; sat.polarisation = polarisation; @@ -209,15 +219,15 @@ eDVBDB::~eDVBDB() const eServiceReferenceDVB &s = i->first; fprintf(f, "%04x:%08x:%04x:%04x:%d:%d\n", s.getServiceID().get(), s.getDVBNamespace().get(), - s.getOriginalNetworkID().get(), s.getTransportStreamID().get(), + s.getTransportStreamID().get(),s.getOriginalNetworkID().get(), s.getServiceType(), 0); fprintf(f, "%s\n", i->second->m_service_name.c_str()); - fprintf(f, "p=%s", i->second->m_provider_name.c_str()); + fprintf(f, "p:%s", i->second->m_provider_name.c_str()); for (std::set::const_iterator ca(i->second->m_ca.begin()); ca != i->second->m_ca.end(); ++ca) - fprintf(f, ",C=%04x", *ca); + fprintf(f, ",C:%04x", *ca); fprintf(f, "\n"); services++; } diff --git a/lib/dvb/db.h b/lib/dvb/db.h index 5a67870..e673b9e 100644 --- a/lib/dvb/db.h +++ b/lib/dvb/db.h @@ -16,6 +16,8 @@ public: std::set m_ca; std::map m_cache; virtual ~eDVBService(); + + eDVBService &operator=(const eDVBService &); }; class ServiceDescriptionTable; diff --git a/lib/dvb/demux.cpp b/lib/dvb/demux.cpp index 286821c..191d9c3 100644 --- a/lib/dvb/demux.cpp +++ b/lib/dvb/demux.cpp @@ -74,6 +74,8 @@ eDVBSectionReader::eDVBSectionReader(eDVBDemux *demux, eMainloop *context, RESUL #endif fd = ::open(filename, O_RDWR); + eDebug("eDVBSectionReader has fd %d", fd); + if (fd >= 0) { notifier=new eSocketNotifier(context, fd, eSocketNotifier::Read); diff --git a/lib/dvb/esection.cpp b/lib/dvb/esection.cpp index 42a056d..dbb9bf7 100644 --- a/lib/dvb/esection.cpp +++ b/lib/dvb/esection.cpp @@ -22,7 +22,8 @@ void eGTable::sectionRead(const __u8 *d) void eGTable::timeout() { - eDebug("timeout!"); + printf("timeout!\n"); +// eDebug("timeout!"); m_reader->stop(); ready = 1; error = -1; diff --git a/lib/dvb/esection.h b/lib/dvb/esection.h index 78895e7..6b8c878 100644 --- a/lib/dvb/esection.h +++ b/lib/dvb/esection.h @@ -52,11 +52,13 @@ protected: else printf("-"); - printf(" %d/%d\n", avail.size(), max); + printf(" %d/%d TID %02x\n", avail.size(), max, data[0]); if (avail.size() == max) + { + printf("done!\n"); return 1; - else + } else return 0; } public: diff --git a/lib/dvb/isection.h b/lib/dvb/isection.h index f44c163..1ed5369 100644 --- a/lib/dvb/isection.h +++ b/lib/dvb/isection.h @@ -48,6 +48,7 @@ public: virtual RESULT start(const eDVBSectionFilterMask &mask)=0; virtual RESULT stop()=0; virtual RESULT connectRead(const Slot1 &read, ePtr &conn)=0; + virtual ~iDVBSectionReader() { }; }; #endif diff --git a/lib/dvb/scan.cpp b/lib/dvb/scan.cpp index 5571a81..322f35c 100644 --- a/lib/dvb/scan.cpp +++ b/lib/dvb/scan.cpp @@ -13,10 +13,15 @@ #include #include +#define SCAN_eDebug(x...) +#define SCAN_eDebugNoNewLine(x...) + +DEFINE_REF(eDVBScan); + eDVBScan::eDVBScan(iDVBChannel *channel): m_channel(channel) { if (m_channel->getDemux(m_demux)) - eDebug("scan: failed to allocate demux!"); + SCAN_eDebug("scan: failed to allocate demux!"); m_channel->connectStateChange(slot(*this, &eDVBScan::stateChange), m_stateChanged_connection); } @@ -126,7 +131,7 @@ RESULT eDVBScan::startFilter() void eDVBScan::SDTready(int err) { - eDebug("got sdt"); + SCAN_eDebug("got sdt"); m_ready |= readySDT; if (!err) m_ready |= validSDT; @@ -135,7 +140,7 @@ void eDVBScan::SDTready(int err) void eDVBScan::NITready(int err) { - eDebug("got nit, err %d", err); + SCAN_eDebug("got nit, err %d", err); m_ready |= readyNIT; if (!err) m_ready |= validNIT; @@ -144,7 +149,7 @@ void eDVBScan::NITready(int err) void eDVBScan::BATready(int err) { - eDebug("got bat"); + SCAN_eDebug("got bat"); m_ready |= readyBAT; if (!err) m_ready |= validBAT; @@ -204,7 +209,7 @@ void eDVBScan::channelDone() (**m_SDT->getSections().begin()).getTransportStreamId(), hash); - eDebug("SDT: "); + SCAN_eDebug("SDT: "); ServiceDescriptionTableConstIterator i; for (i = m_SDT->getSections().begin(); i != m_SDT->getSections().end(); ++i) processSDT(dvbnamespace, **i); @@ -213,7 +218,7 @@ void eDVBScan::channelDone() if (m_ready & validNIT) { - eDebug("dumping NIT"); + SCAN_eDebug("dumping NIT"); NetworkInformationTableConstIterator i; for (i = m_NIT->getSections().begin(); i != m_NIT->getSections().end(); ++i) { @@ -222,7 +227,7 @@ void eDVBScan::channelDone() for (TransportStreamInfoConstIterator tsinfo(tsinfovec.begin()); tsinfo != tsinfovec.end(); ++tsinfo) { - eDebug("TSID: %04x ONID: %04x", (*tsinfo)->getTransportStreamId(), + SCAN_eDebug("TSID: %04x ONID: %04x", (*tsinfo)->getTransportStreamId(), (*tsinfo)->getOriginalNetworkId()); eOriginalNetworkID onid = (*tsinfo)->getOriginalNetworkId(); @@ -237,7 +242,7 @@ void eDVBScan::channelDone() case SATELLITE_DELIVERY_SYSTEM_DESCRIPTOR: { SatelliteDeliverySystemDescriptor &d = (SatelliteDeliverySystemDescriptor&)**desc; - eDebug("%d kHz, %d%d%d.%d%c %s MOD:%d %d symb/s, fec %d", + SCAN_eDebug("%d kHz, %d%d%d.%d%c %s MOD:%d %d symb/s, fec %d", d.getFrequency(), (d.getOrbitalPosition()>>12)&0xF, (d.getOrbitalPosition()>>8)&0xF, @@ -265,7 +270,7 @@ void eDVBScan::channelDone() break; } default: - eDebug("descr<%x>", (*desc)->getTag()); + SCAN_eDebug("descr<%x>", (*desc)->getTag()); break; } } @@ -277,7 +282,7 @@ void eDVBScan::channelDone() if ((m_ready & readyAll) != readyAll) return; - eDebug("channel done!"); + SCAN_eDebug("channel done!"); m_ch_scanned.push_back(m_ch_current); nextChannel(); } @@ -312,12 +317,12 @@ void eDVBScan::insertInto(eDVBDB *db) RESULT eDVBScan::processSDT(eDVBNamespace dvbnamespace, const ServiceDescriptionTable &sdt) { const ServiceDescriptionVector &services = *sdt.getDescriptions(); - eDebug("ONID: %04x", sdt.getOriginalNetworkId()); + SCAN_eDebug("ONID: %04x", sdt.getOriginalNetworkId()); eDVBChannelID chid(dvbnamespace, sdt.getTransportStreamId(), sdt.getOriginalNetworkId()); for (ServiceDescriptionConstIterator s(services.begin()); s != services.end(); ++s) { - eDebugNoNewLine("SID %04x: ", (*s)->getServiceId()); + SCAN_eDebugNoNewLine("SID %04x: ", (*s)->getServiceId()); eServiceReferenceDVB ref; ePtr service = new eDVBService; @@ -338,7 +343,7 @@ RESULT eDVBScan::processSDT(eDVBNamespace dvbnamespace, const ServiceDescription case SERVICE_DESCRIPTOR: { ServiceDescriptor &d = (ServiceDescriptor&)**desc; - eDebug("name '%s', provider_name '%s'", d.getServiceName().c_str(), d.getServiceProviderName().c_str()); + SCAN_eDebug("name '%s', provider_name '%s'", d.getServiceName().c_str(), d.getServiceProviderName().c_str()); service->m_service_name = d.getServiceName(); service->m_provider_name = d.getServiceProviderName(); break; @@ -347,17 +352,17 @@ RESULT eDVBScan::processSDT(eDVBNamespace dvbnamespace, const ServiceDescription { CaIdentifierDescriptor &d = (CaIdentifierDescriptor&)**desc; const CaSystemIdVector &caids = *d.getCaSystemIds(); - eDebugNoNewLine("CA "); + SCAN_eDebugNoNewLine("CA "); for (CaSystemIdVector::const_iterator i(caids.begin()); i != caids.end(); ++i) { - eDebugNoNewLine("%04x ", *i); + SCAN_eDebugNoNewLine("%04x ", *i); service->m_ca.insert(*i); } - eDebug(""); + SCAN_eDebug(""); break; } default: - eDebug("descr<%x>", (*desc)->getTag()); + SCAN_eDebug("descr<%x>", (*desc)->getTag()); break; } } diff --git a/lib/dvb/scan.h b/lib/dvb/scan.h index 61a211b..f7cb5d2 100644 --- a/lib/dvb/scan.h +++ b/lib/dvb/scan.h @@ -8,6 +8,8 @@ class eDVBScan: public Object, public iObject { +DECLARE_REF; +private: /* chid helper functions: */ /* heuristically determine if onid/tsid is valid */ diff --git a/lib/gui/elistbox.h b/lib/gui/elistbox.h index 4c06e28..d546486 100644 --- a/lib/gui/elistbox.h +++ b/lib/gui/elistbox.h @@ -19,7 +19,9 @@ public: to stay on the same data, however when the current item is removed, this won't work. you'll be notified anyway. */ - +#ifndef SWIG +protected: + friend class eListbox; virtual void cursorHome()=0; virtual void cursorEnd()=0; virtual int cursorMove(int count=1)=0; @@ -39,6 +41,7 @@ public: /* the following functions always refer to the selected item */ virtual void paint(gPainter &painter, eWindowStyle &style, const ePoint &offset, int selected)=0; +#endif }; class eListbox: public eWidget diff --git a/lib/gui/elistboxcontent.h b/lib/gui/elistboxcontent.h index 6219cec..7ef6011 100644 --- a/lib/gui/elistboxcontent.h +++ b/lib/gui/elistboxcontent.h @@ -2,11 +2,15 @@ #define __lib_gui_elistboxcontent_h #include +#include class eListboxTestContent: public virtual iListboxContent { DECLARE_REF; public: + +#ifndef SWIG +protected: void cursorHome(); void cursorEnd(); int cursorMove(int count=1); @@ -28,6 +32,7 @@ public: private: int m_cursor, m_saved_cursor; eSize m_size; +#endif }; class eListboxStringContent: public virtual iListboxContent @@ -35,6 +40,9 @@ class eListboxStringContent: public virtual iListboxContent DECLARE_REF; public: eListboxStringContent(); + void setList(std::list &list); +#ifndef SWI +protected: void cursorHome(); void cursorEnd(); @@ -54,8 +62,6 @@ public: /* the following functions always refer to the selected item */ void paint(gPainter &painter, eWindowStyle &style, const ePoint &offset, int selected); - - void setList(std::list &list); private: typedef std::list list; @@ -66,6 +72,7 @@ private: int m_size; eSize m_itemsize; +#endif }; class eListboxPythonStringContent: public virtual iListboxContent @@ -74,6 +81,11 @@ class eListboxPythonStringContent: public virtual iListboxContent public: eListboxPythonStringContent(); ~eListboxPythonStringContent(); + + void setList(PyObject *list); + PyObject *getCurrentSelection(); +#ifndef SWIG +protected: void cursorHome(); void cursorEnd(); int cursorMove(int count=1); @@ -92,15 +104,12 @@ public: /* the following functions always refer to the selected item */ void paint(gPainter &painter, eWindowStyle &style, const ePoint &offset, int selected); - - void setList(PyObject *list); - - PyObject *getCurrentSelection(); - + private: PyObject *m_list; int m_cursor, m_saved_cursor; eSize m_itemsize; +#endif }; #endif diff --git a/lib/python/enigma_python.i b/lib/python/enigma_python.i index ae15d0d..8e55b74 100644 --- a/lib/python/enigma_python.i +++ b/lib/python/enigma_python.i @@ -58,6 +58,7 @@ is usually caused by not marking PSignals as immutable. #include #include #include +#include extern void runMainloop(); @@ -90,6 +91,7 @@ RefCount(eListboxPythonStringContent) %include %include %include +%include template class PSignal0 { diff --git a/lib/service/Makefile.am b/lib/service/Makefile.am index 09ba4ce..a3c05cf 100644 --- a/lib/service/Makefile.am +++ b/lib/service/Makefile.am @@ -4,5 +4,5 @@ INCLUDES = \ noinst_LIBRARIES = libenigma_service.a libenigma_service_a_SOURCES = \ - service.cpp servicemp3.cpp servicedvb.cpp servicefs.cpp + listboxservice.cpp service.cpp servicemp3.cpp servicedvb.cpp servicefs.cpp diff --git a/lib/service/iservice.h b/lib/service/iservice.h index 766d850..01c61fc 100644 --- a/lib/service/iservice.h +++ b/lib/service/iservice.h @@ -142,10 +142,15 @@ public: } }; + /* the reason we have the servicereference as additional argument is + that we don't have to create one object for every entry in a possibly + large list, provided that no state information is nessesary to deliver + the required information. Anyway - ref *must* be the same as the argument + to the info() or getIServiceInformation call! */ class iServiceInformation: public iObject { public: - virtual RESULT getName(std::string &name)=0; + virtual RESULT getName(const eServiceReference &ref, std::string &name)=0; }; typedef ePtr iServiceInformationPtr; @@ -203,6 +208,7 @@ public: virtual RESULT play(const eServiceReference &, ePtr &ptr)=0; virtual RESULT record(const eServiceReference &, ePtr &ptr)=0; virtual RESULT list(const eServiceReference &, ePtr &ptr)=0; + virtual RESULT info(const eServiceReference &, ePtr &ptr); }; typedef ePtr iServiceHandlerPtr; diff --git a/lib/service/service.cpp b/lib/service/service.cpp index d18b8ee..40cbf8d 100644 --- a/lib/service/service.cpp +++ b/lib/service/service.cpp @@ -90,6 +90,17 @@ RESULT eServiceCenter::list(const eServiceReference &ref, ePtr return i->second->list(ref, ptr); } +RESULT eServiceCenter::info(const eServiceReference &ref, ePtr &ptr) +{ + std::map >::iterator i = handler.find(ref.type); + if (i == handler.end()) + { + ptr = 0; + return -1; + } + return i->second->info(ref, ptr); +} + RESULT eServiceCenter::addServiceFactory(int id, iServiceHandler *hnd) { handler.insert(std::pair >(id, hnd)); @@ -102,4 +113,11 @@ RESULT eServiceCenter::removeServiceFactory(int id) return 0; } + /* default handlers */ +RESULT iServiceHandler::info(const eServiceReference &, ePtr &ptr) +{ + ptr = 0; + return -1; +} + eAutoInitPtr init_eServiceCenter(eAutoInitNumbers::service, "eServiceCenter"); diff --git a/lib/service/service.h b/lib/service/service.h index fbe3427..c3f0c48 100644 --- a/lib/service/service.h +++ b/lib/service/service.h @@ -23,6 +23,7 @@ public: RESULT play(const eServiceReference &, iPlayableServicePtr &ptr); RESULT record(const eServiceReference &, iRecordableServicePtr &ptr); RESULT list(const eServiceReference &, iListableServicePtr &ptr); + RESULT info(const eServiceReference &, ePtr &ptr); // eServiceCenter static RESULT getInstance(eServiceCenterPtr &ptr) { ptr = instance; return 0; } diff --git a/lib/service/servicedvb.cpp b/lib/service/servicedvb.cpp index 3b22ab7..0c6d72b 100644 --- a/lib/service/servicedvb.cpp +++ b/lib/service/servicedvb.cpp @@ -158,7 +158,7 @@ RESULT eDVBServicePlay::getIServiceInformation(ePtr &ptr) return 0; } -RESULT eDVBServicePlay::getName(std::string &name) +RESULT eDVBServicePlay::getName(const eServiceReference &ref, std::string &name) { name = "DVB service"; return 0; diff --git a/lib/service/servicedvb.h b/lib/service/servicedvb.h index 42ca30f..c54eb5c 100644 --- a/lib/service/servicedvb.h +++ b/lib/service/servicedvb.h @@ -45,7 +45,7 @@ public: RESULT getIServiceInformation(ePtr &ptr); // iServiceInformation - RESULT getName(std::string &name); + RESULT getName(const eServiceReference &ref, std::string &name); }; #endif diff --git a/lib/service/servicefs.cpp b/lib/service/servicefs.cpp index f4a9b73..de75cc6 100644 --- a/lib/service/servicefs.cpp +++ b/lib/service/servicefs.cpp @@ -11,6 +11,21 @@ #include #include + +class eServiceFSInformation: public iServiceInformation +{ + DECLARE_REF; +public: + RESULT getName(const eServiceReference &ref, std::string &name); +}; + +DEFINE_REF(eServiceFSInformation); + +RESULT eServiceFSInformation::getName(const eServiceReference &ref, std::string &name) +{ + name = ref.path; +} + // eServiceFactoryFS eServiceFactoryFS::eServiceFactoryFS() @@ -20,6 +35,8 @@ eServiceFactoryFS::eServiceFactoryFS() eServiceCenter::getInstance(sc); if (sc) sc->addServiceFactory(eServiceFactoryFS::id, this); + + m_service_information = new eServiceFSInformation(); } eServiceFactoryFS::~eServiceFactoryFS() @@ -52,6 +69,12 @@ RESULT eServiceFactoryFS::list(const eServiceReference &ref, ePtr &ptr) +{ + ptr = m_service_information; + return 0; +} + // eServiceFS DEFINE_REF(eServiceFS); diff --git a/lib/service/servicefs.h b/lib/service/servicefs.h index 7e66ba2..d8e7760 100644 --- a/lib/service/servicefs.h +++ b/lib/service/servicefs.h @@ -15,6 +15,9 @@ public: RESULT play(const eServiceReference &, ePtr &ptr); RESULT record(const eServiceReference &, ePtr &ptr); RESULT list(const eServiceReference &, ePtr &ptr); + RESULT info(const eServiceReference &, ePtr &ptr); +private: + ePtr m_service_information; }; class eServiceFS: public iListableService diff --git a/lib/service/servicemp3.cpp b/lib/service/servicemp3.cpp index d1c9001..1f883f9 100644 --- a/lib/service/servicemp3.cpp +++ b/lib/service/servicemp3.cpp @@ -16,6 +16,8 @@ eServiceFactoryMP3::eServiceFactoryMP3() eServiceCenter::getInstance(sc); if (sc) sc->addServiceFactory(eServiceFactoryMP3::id, this); + + m_service_info = new eServiceMP3Info(); } eServiceFactoryMP3::~eServiceFactoryMP3() @@ -49,8 +51,35 @@ RESULT eServiceFactoryMP3::list(const eServiceReference &, ePtr &ptr) +{ + ptr = m_service_info; + return 0; +} + +// eServiceMP3Info + + +// eServiceMP3Info is seperated from eServiceMP3 to give information +// about unopened files. + +// probably eServiceMP3 should use this class as well, and eServiceMP3Info +// should have a database backend where ID3-files etc. are cached. +// this would allow listing the mp3 database based on certain filters. +DEFINE_REF(eServiceMP3Info) + +eServiceMP3Info::eServiceMP3Info() +{ +} + +RESULT eServiceMP3Info::getName(const eServiceReference &ref, std::string &name) +{ + name = "MP3 file: " + ref.path; + return 0; +} + +// eServiceMP3 void eServiceMP3::test_end() { @@ -113,7 +142,7 @@ RESULT eServiceMP3::unpause() { printf("mp3 unpauses!\n"); return 0; } RESULT eServiceMP3::getIServiceInformation(ePtr&i) { i = this; return 0; } -RESULT eServiceMP3::getName(std::string &name) +RESULT eServiceMP3::getName(const eServiceReference &ref, std::string &name) { name = "MP3 File: " + filename; return 0; diff --git a/lib/service/servicemp3.h b/lib/service/servicemp3.h index cfca424..7ef8402 100644 --- a/lib/service/servicemp3.h +++ b/lib/service/servicemp3.h @@ -3,6 +3,8 @@ #include +class eServiceMP3Info ; + class eServiceFactoryMP3: public iServiceHandler { DECLARE_REF; @@ -15,6 +17,18 @@ public: RESULT play(const eServiceReference &, ePtr &ptr); RESULT record(const eServiceReference &, ePtr &ptr); RESULT list(const eServiceReference &, ePtr &ptr); + RESULT info(const eServiceReference &, ePtr &ptr); +private: + ePtr m_service_info; +}; + +class eServiceMP3Info: public iServiceInformation +{ + DECLARE_REF; + friend class eServiceFactoryMP3; + eServiceMP3Info(); +public: + RESULT getName(const eServiceReference &ref, std::string &name); }; class eServiceMP3: public iPlayableService, public iPauseableService, public iServiceInformation, public Object @@ -48,7 +62,7 @@ public: RESULT getIServiceInformation(ePtr&); // iServiceInformation - RESULT getName(std::string &name); + RESULT getName(const eServiceReference &ref, std::string &name); }; #endif diff --git a/main/enigma.cpp b/main/enigma.cpp index df28bcd..60bea8f 100644 --- a/main/enigma.cpp +++ b/main/enigma.cpp @@ -21,6 +21,8 @@ #include #include +#include + #include #ifdef OBJECT_DEBUG @@ -51,17 +53,6 @@ void dumpRegion(const gRegion ®ion) } } - -class eMain: public eApplication, public Object -{ - eInit init; -public: - eMain() - { - init.setRunlevel(eAutoInitNumbers::main); - } -}; - eWidgetDesktop *wdsk; // typedef struct _object PyObject; @@ -84,6 +75,81 @@ void keyEvent(const eRCKey &key) keyPressed(key.code); } +/************************************************/ +#include +#include +#include +#include +#include +#include +#include + +class eMain: public eApplication, public Object +{ + eInit init; + + ePtr m_scan; + + ePtr m_mgr; + ePtr m_channel; + ePtr m_dvbdb; + + void scanEvent(int evt) + { + eDebug("scan event %d!", evt); + if (evt == eDVBScan::evtFinish) + { + m_scan->insertInto(m_dvbdb); + quit(0); + } + } + ePtr m_scan_event_connection; +public: + eMain() + { + init.setRunlevel(eAutoInitNumbers::main); + +#if 0 + m_dvbdb = new eDVBDB(); + m_mgr = new eDVBResourceManager(); + + eDVBFrontendParametersSatellite fesat; + + fesat.frequency = 11817000; // 12070000; + fesat.symbol_rate = 27500000; + fesat.polarisation = eDVBFrontendParametersSatellite::Polarisation::Vertical; + fesat.fec = eDVBFrontendParametersSatellite::FEC::f3_4; + fesat.inversion = eDVBFrontendParametersSatellite::Inversion::Off; + fesat.orbital_position = 192; + + eDVBFrontendParameters *fe = new eDVBFrontendParameters(); + + fe->setDVBS(fesat); + + if (m_mgr->allocateRawChannel(m_channel)) + eDebug("shit it failed!"); + + eDebug("starting scan..."); + + std::list > list; + + list.push_back(fe); + + m_scan = new eDVBScan(m_channel); + m_scan->start(list); + m_scan->connectEvent(slot(*this, &eMain::scanEvent), m_scan_event_connection); +#endif + } + + ~eMain() + { + m_scan = 0; + } +}; + +/************************************************/ + + int main(int argc, char **argv) { #ifdef OBJECT_DEBUG @@ -91,9 +157,10 @@ int main(int argc, char **argv) #endif -#if 1 + ePython python; eMain main; +#if 1 ePtr my_dc; gFBDC::getInstance(my_dc); @@ -129,11 +196,11 @@ int main(int argc, char **argv) eRCInput::getInstance()->keyEvent.connect(slot(keyEvent)); - ePython python; - printf("executing main\n"); python.execute("mytest", "__main__"); +// eApp->exec(); + return 0; } diff --git a/screens.py b/screens.py index 3dbcb4a..6aa88e8 100644 --- a/screens.py +++ b/screens.py @@ -25,15 +25,12 @@ class testDialog(Screen): self.session.open(screens["mainMenu"]()) def goEmu(self): -# self.close(1) self["title"].setText("EMUs ARE ILLEGAL AND NOT SUPPORTED!") def goTimeshift(self): -# self.close(2) self["title"].setText("JUST PRESS THE YELLOW BUTTON!") def goHDTV(self): -# self.close(3) self["title"].setText("HDTV GREEN FLASHES: ENABLED") def goClock(self): @@ -45,14 +42,17 @@ class testDialog(Screen): b.onClick = [ self.testDialogClick ] self["okbutton"] = b self["title"] = Header("Test Dialog - press ok to leave!") - self["menu"] = MenuList( - [ - ("MAIN MENU", self.goMain), - ("EMU SETUP", self.goEmu), - ("TIMESHIFT SETUP", self.goTimeshift), - ("HDTV PIP CONFIG", self.goHDTV), - ("wie spaet ists?!", self.goClock) - ]) +# self["menu"] = MenuList( +# [ +# ("MAIN MENU", self.goMain), +# ("EMU SETUP", self.goEmu), +# ("TIMESHIFT SETUP", self.goTimeshift), +# ("HDTV PIP CONFIG", self.goHDTV), +# ("wie spaet ists?!", self.goClock) +# ]) + self["menu"] = ServiceList() + + self["menu"].setRoot(eServiceReference("2:0:1:0:0:0:0:0:0:0:/")) class mainMenu(Screen): def __init__(self):