aboutsummaryrefslogtreecommitdiff
path: root/lib/service
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 /lib/service
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
Diffstat (limited to 'lib/service')
-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
10 files changed, 101 insertions, 7 deletions
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