aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFelix Domke <tmbinc@elitedvb.net>2005-01-31 22:51:14 +0000
committerFelix Domke <tmbinc@elitedvb.net>2005-01-31 22:51:14 +0000
commit4bc08995411e21f3564f09e136809be68ddf96a8 (patch)
tree59e2f1babc2b85b61782fe76aadd031faa704f73
parent6b7b7977a92c9a092763bf699cba85347f9f2ec6 (diff)
downloadenigma2-4bc08995411e21f3564f09e136809be68ddf96a8.tar.gz
enigma2-4bc08995411e21f3564f09e136809be68ddf96a8.zip
- 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
-rw-r--r--components.py16
-rw-r--r--include/connection.h5
-rw-r--r--lib/base/Makefile.am2
-rw-r--r--lib/base/object.h10
-rw-r--r--lib/dvb/db.cpp18
-rw-r--r--lib/dvb/db.h2
-rw-r--r--lib/dvb/demux.cpp2
-rw-r--r--lib/dvb/esection.cpp3
-rw-r--r--lib/dvb/esection.h6
-rw-r--r--lib/dvb/isection.h1
-rw-r--r--lib/dvb/scan.cpp39
-rw-r--r--lib/dvb/scan.h2
-rw-r--r--lib/gui/elistbox.h5
-rw-r--r--lib/gui/elistboxcontent.h23
-rw-r--r--lib/python/enigma_python.i2
-rw-r--r--lib/service/Makefile.am2
-rw-r--r--lib/service/iservice.h8
-rw-r--r--lib/service/service.cpp18
-rw-r--r--lib/service/service.h1
-rw-r--r--lib/service/servicedvb.cpp2
-rw-r--r--lib/service/servicedvb.h2
-rw-r--r--lib/service/servicefs.cpp23
-rw-r--r--lib/service/servicefs.h3
-rw-r--r--lib/service/servicemp3.cpp33
-rw-r--r--lib/service/servicemp3.h16
-rw-r--r--main/enigma.cpp95
-rw-r--r--screens.py22
27 files changed, 293 insertions, 68 deletions
diff --git a/components.py b/components.py
index bd4c068f..8015621f 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 ae799c98..5ae90d5b 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<iObject> 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 955d9e4a..6094fb48 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 ddb4512c..64d9a88f 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 1a2cd7df..810aba04 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<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++;
}
diff --git a/lib/dvb/db.h b/lib/dvb/db.h
index 5a67870d..e673b9e6 100644
--- a/lib/dvb/db.h
+++ b/lib/dvb/db.h
@@ -16,6 +16,8 @@ public:
std::set<int> m_ca;
std::map<int,int> m_cache;
virtual ~eDVBService();
+
+ eDVBService &operator=(const eDVBService &);
};
class ServiceDescriptionTable;
diff --git a/lib/dvb/demux.cpp b/lib/dvb/demux.cpp
index 286821c3..191d9c38 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 42a056d2..dbb9bf78 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 78895e76..6b8c8784 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 f44c1632..1ed53699 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<void,const __u8*> &read, ePtr<eConnection> &conn)=0;
+ virtual ~iDVBSectionReader() { };
};
#endif
diff --git a/lib/dvb/scan.cpp b/lib/dvb/scan.cpp
index 5571a810..322f35c3 100644
--- a/lib/dvb/scan.cpp
+++ b/lib/dvb/scan.cpp
@@ -13,10 +13,15 @@
#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;
}
}
diff --git a/lib/dvb/scan.h b/lib/dvb/scan.h
index 61a211ba..f7cb5d26 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 4c06e288..d5464868 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 6219cec6..7ef60116 100644
--- a/lib/gui/elistboxcontent.h
+++ b/lib/gui/elistboxcontent.h
@@ -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
diff --git a/lib/python/enigma_python.i b/lib/python/enigma_python.i
index ae15d0d9..8e55b74f 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 <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
{
diff --git a/lib/service/Makefile.am b/lib/service/Makefile.am
index 09ba4ce8..a3c05cfa 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 766d850e..01c61fcc 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<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;
diff --git a/lib/service/service.cpp b/lib/service/service.cpp
index d18b8eee..40cbf8df 100644
--- a/lib/service/service.cpp
+++ b/lib/service/service.cpp
@@ -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");
diff --git a/lib/service/service.h b/lib/service/service.h
index fbe34278..c3f0c482 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<iServiceInformation> &ptr);
// eServiceCenter
static RESULT getInstance(eServiceCenterPtr &ptr) { ptr = instance; return 0; }
diff --git a/lib/service/servicedvb.cpp b/lib/service/servicedvb.cpp
index 3b22ab7b..0c6d72bd 100644
--- a/lib/service/servicedvb.cpp
+++ b/lib/service/servicedvb.cpp
@@ -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;
diff --git a/lib/service/servicedvb.h b/lib/service/servicedvb.h
index 42ca30f7..c54eb5c0 100644
--- a/lib/service/servicedvb.h
+++ b/lib/service/servicedvb.h
@@ -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
diff --git a/lib/service/servicefs.cpp b/lib/service/servicefs.cpp
index f4a9b737..de75cc67 100644
--- a/lib/service/servicefs.cpp
+++ b/lib/service/servicefs.cpp
@@ -11,6 +11,21 @@
#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);
diff --git a/lib/service/servicefs.h b/lib/service/servicefs.h
index 7e66ba21..d8e77609 100644
--- a/lib/service/servicefs.h
+++ b/lib/service/servicefs.h
@@ -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
diff --git a/lib/service/servicemp3.cpp b/lib/service/servicemp3.cpp
index d1c9001d..1f883f94 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<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;
diff --git a/lib/service/servicemp3.h b/lib/service/servicemp3.h
index cfca4242..7ef84025 100644
--- a/lib/service/servicemp3.h
+++ b/lib/service/servicemp3.h
@@ -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
diff --git a/main/enigma.cpp b/main/enigma.cpp
index df28bcd7..60bea8f5 100644
--- a/main/enigma.cpp
+++ b/main/enigma.cpp
@@ -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;
}
diff --git a/screens.py b/screens.py
index 3dbcb4aa..6aa88e80 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):