- fixed dvb scan
authorFelix Domke <tmbinc@elitedvb.net>
Mon, 31 Jan 2005 22:51:14 +0000 (22:51 +0000)
committerFelix Domke <tmbinc@elitedvb.net>
Mon, 31 Jan 2005 22:51:14 +0000 (22:51 +0000)
 - 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

27 files changed:
components.py
include/connection.h
lib/base/Makefile.am
lib/base/object.h
lib/dvb/db.cpp
lib/dvb/db.h
lib/dvb/demux.cpp
lib/dvb/esection.cpp
lib/dvb/esection.h
lib/dvb/isection.h
lib/dvb/scan.cpp
lib/dvb/scan.h
lib/gui/elistbox.h
lib/gui/elistboxcontent.h
lib/python/enigma_python.i
lib/service/Makefile.am
lib/service/iservice.h
lib/service/service.cpp
lib/service/service.h
lib/service/servicedvb.cpp
lib/service/servicedvb.h
lib/service/servicefs.cpp
lib/service/servicefs.h
lib/service/servicemp3.cpp
lib/service/servicemp3.h
main/enigma.cpp
screens.py

index bd4c068..8015621 100644 (file)
@@ -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)
index ae799c9..5ae90d5 100644 (file)
@@ -6,11 +6,10 @@
 
 class eConnection: public iObject, public Connection
 {
-       int ref;
+DECLARE_REF;
+private:
        ePtr<iObject> m_owner;
 public:
-DEFINE_REF(eConnection);
-public:
        eConnection(iObject *owner, const Connection &conn): Connection(conn), m_owner(owner) { };
        virtual ~eConnection() { disconnect(); }
 };
index 955d9e4..6094fb4 100644 (file)
@@ -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
index ddb4512..64d9a88 100644 (file)
@@ -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();
index 1a2cd7d..810aba0 100644 (file)
@@ -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<int>::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++;
        }
index 5a67870..e673b9e 100644 (file)
@@ -16,6 +16,8 @@ public:
        std::set<int> m_ca;
        std::map<int,int> m_cache;
        virtual ~eDVBService();
+       
+       eDVBService &operator=(const eDVBService &);
 };
 
 class ServiceDescriptionTable;
index 286821c..191d9c3 100644 (file)
@@ -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);
index 42a056d..dbb9bf7 100644 (file)
@@ -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;
index 78895e7..6b8c878 100644 (file)
@@ -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:
index f44c163..1ed5369 100644 (file)
@@ -48,6 +48,7 @@ public:
        virtual RESULT start(const eDVBSectionFilterMask &mask)=0;
        virtual RESULT stop()=0;
        virtual RESULT connectRead(const Slot1<void,const __u8*> &read, ePtr<eConnection> &conn)=0;
+       virtual ~iDVBSectionReader() { };
 };
 
 #endif
index 5571a81..322f35c 100644 (file)
 #include <lib/base/eerror.h>
 #include <errno.h>
 
+#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<eDVBService> 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;
                        }
                }
index 61a211b..f7cb5d2 100644 (file)
@@ -8,6 +8,8 @@
 
 class eDVBScan: public Object, public iObject
 {
+DECLARE_REF;
+private:
                /* chid helper functions: */
                
                /* heuristically determine if onid/tsid is valid */
index 4c06e28..d546486 100644 (file)
@@ -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
index 6219cec..7ef6011 100644 (file)
@@ -2,11 +2,15 @@
 #define __lib_gui_elistboxcontent_h
 
 #include <lib/python/python.h>
+#include <lib/gui/elistbox.h>
 
 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<std::string> &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<std::string> &list);
 private:
        typedef std::list<std::string> 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
index ae15d0d..8e55b74 100644 (file)
@@ -58,6 +58,7 @@ is usually caused by not marking PSignals as immutable.
 #include <lib/python/connections.h>
 #include <lib/gui/elistbox.h>
 #include <lib/gui/elistboxcontent.h>
+#include <lib/service/listboxservice.h>
 
 extern void runMainloop();
 
@@ -90,6 +91,7 @@ RefCount(eListboxPythonStringContent)
 %include <lib/gui/ewidgetdesktop.h>
 %include <lib/gui/elistbox.h>
 %include <lib/gui/elistboxcontent.h>
+%include <lib/service/listboxservice.h>
 
 template<class R> class PSignal0
 {
index 09ba4ce..a3c05cf 100644 (file)
@@ -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
        
index 766d850..01c61fc 100644 (file)
@@ -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<iServiceInformation> iServiceInformationPtr;
@@ -203,6 +208,7 @@ public:
        virtual RESULT play(const eServiceReference &, ePtr<iPlayableService> &ptr)=0;
        virtual RESULT record(const eServiceReference &, ePtr<iRecordableService> &ptr)=0;
        virtual RESULT list(const eServiceReference &, ePtr<iListableService> &ptr)=0;
+       virtual RESULT info(const eServiceReference &, ePtr<iServiceInformation> &ptr);
 };
 
 typedef ePtr<iServiceHandler> iServiceHandlerPtr;
index d18b8ee..40cbf8d 100644 (file)
@@ -90,6 +90,17 @@ RESULT eServiceCenter::list(const eServiceReference &ref, ePtr<iListableService>
        return i->second->list(ref, ptr);
 }
 
+RESULT eServiceCenter::info(const eServiceReference &ref, ePtr<iServiceInformation> &ptr)
+{
+       std::map<int,ePtr<iServiceHandler> >::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<int,ePtr<iServiceHandler> >(id, hnd));
@@ -102,4 +113,11 @@ RESULT eServiceCenter::removeServiceFactory(int id)
        return 0;
 }
 
+       /* default handlers */
+RESULT iServiceHandler::info(const eServiceReference &, ePtr<iServiceInformation> &ptr)
+{
+       ptr = 0;
+       return -1;
+}
+
 eAutoInitPtr<eServiceCenter> init_eServiceCenter(eAutoInitNumbers::service, "eServiceCenter");
index fbe3427..c3f0c48 100644 (file)
@@ -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<iServiceInformation> &ptr);
        
                // eServiceCenter
        static RESULT getInstance(eServiceCenterPtr &ptr) { ptr = instance; return 0; }
index 3b22ab7..0c6d72b 100644 (file)
@@ -158,7 +158,7 @@ RESULT eDVBServicePlay::getIServiceInformation(ePtr<iServiceInformation> &ptr)
        return 0;
 }
 
-RESULT eDVBServicePlay::getName(std::string &name)
+RESULT eDVBServicePlay::getName(const eServiceReference &ref, std::string &name)
 {
        name = "DVB service";
        return 0;
index 42ca30f..c54eb5c 100644 (file)
@@ -45,7 +45,7 @@ public:
        RESULT getIServiceInformation(ePtr<iServiceInformation> &ptr);
        
                // iServiceInformation
-       RESULT getName(std::string &name);
+       RESULT getName(const eServiceReference &ref, std::string &name);
 };
 
 #endif
index f4a9b73..de75cc6 100644 (file)
 #include <sys/stat.h>
 #include <unistd.h>
 
+
+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<iListableServi
        return 0;
 }
 
+RESULT eServiceFactoryFS::info(const eServiceReference &ref, ePtr<iServiceInformation> &ptr)
+{
+       ptr = m_service_information;
+       return 0;
+}
+
 // eServiceFS
 
 DEFINE_REF(eServiceFS);
index 7e66ba2..d8e7760 100644 (file)
@@ -15,6 +15,9 @@ public:
        RESULT play(const eServiceReference &, ePtr<iPlayableService> &ptr);
        RESULT record(const eServiceReference &, ePtr<iRecordableService> &ptr);
        RESULT list(const eServiceReference &, ePtr<iListableService> &ptr);
+       RESULT info(const eServiceReference &, ePtr<iServiceInformation> &ptr);
+private:
+       ePtr<iServiceInformation> m_service_information;
 };
 
 class eServiceFS: public iListableService
index d1c9001..1f883f9 100644 (file)
@@ -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<iListableService
        return -1;
 }
 
-// eServiceMP3
+RESULT eServiceFactoryMP3::info(const eServiceReference &ref, ePtr<iServiceInformation> &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<iServiceInformation>&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;
index cfca424..7ef8402 100644 (file)
@@ -3,6 +3,8 @@
 
 #include <lib/service/iservice.h>
 
+class eServiceMP3Info ;
+
 class eServiceFactoryMP3: public iServiceHandler
 {
 DECLARE_REF;
@@ -15,6 +17,18 @@ public:
        RESULT play(const eServiceReference &, ePtr<iPlayableService> &ptr);
        RESULT record(const eServiceReference &, ePtr<iRecordableService> &ptr);
        RESULT list(const eServiceReference &, ePtr<iListableService> &ptr);
+       RESULT info(const eServiceReference &, ePtr<iServiceInformation> &ptr);
+private:
+       ePtr<eServiceMP3Info> 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>&);
        
                // iServiceInformation
-       RESULT getName(std::string &name);
+       RESULT getName(const eServiceReference &ref, std::string &name);
 };
 
 #endif
index df28bcd..60bea8f 100644 (file)
@@ -21,6 +21,8 @@
 #include <lib/python/python.h>
 #include <lib/python/connections.h>
 
+#include <lib/gui/elistboxcontent.h>
+
 #include <lib/driver/rc.h>
 
 #ifdef OBJECT_DEBUG
@@ -51,17 +53,6 @@ void dumpRegion(const gRegion &region)
        }
 }
 
-
-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 <lib/dvb/dvb.h>
+#include <lib/dvb/db.h>
+#include <lib/dvb/isection.h>
+#include <lib/dvb/esection.h>
+#include <lib/dvb_si/pmt.h>
+#include <lib/dvb/scan.h>
+#include <unistd.h>
+
+class eMain: public eApplication, public Object
+{
+       eInit init;
+       
+       ePtr<eDVBScan> m_scan;
+
+       ePtr<eDVBResourceManager> m_mgr;
+       ePtr<iDVBChannel> m_channel;
+       ePtr<eDVBDB> m_dvbdb;
+
+       void scanEvent(int evt)
+       {
+               eDebug("scan event %d!", evt);
+               if (evt == eDVBScan::evtFinish)
+               {
+                       m_scan->insertInto(m_dvbdb);
+                       quit(0);
+               }
+       }
+       ePtr<eConnection> 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<ePtr<iDVBFrontendParameters> > 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<gFBDC> 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;
 }
 
index 3dbcb4a..6aa88e8 100644 (file)
@@ -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):