aboutsummaryrefslogtreecommitdiff
path: root/lib/service/iservice.h
diff options
context:
space:
mode:
authorFelix Domke <tmbinc@elitedvb.net>2003-10-17 15:36:42 +0000
committerFelix Domke <tmbinc@elitedvb.net>2003-10-17 15:36:42 +0000
commitd63d2c3c6cbbd574dda4f8b00ebe6c661735edd5 (patch)
tree84d0cacfd0b6c1241c236c7860f7cbd7f26901bb /lib/service/iservice.h
downloadenigma2-d63d2c3c6cbbd574dda4f8b00ebe6c661735edd5.tar.gz
enigma2-d63d2c3c6cbbd574dda4f8b00ebe6c661735edd5.zip
import of enigma2
Diffstat (limited to 'lib/service/iservice.h')
-rw-r--r--lib/service/iservice.h173
1 files changed, 173 insertions, 0 deletions
diff --git a/lib/service/iservice.h b/lib/service/iservice.h
new file mode 100644
index 00000000..bedb0d6f
--- /dev/null
+++ b/lib/service/iservice.h
@@ -0,0 +1,173 @@
+#ifndef __lib_dvb_iservice_h
+#define __lib_dvb_iservice_h
+
+#include <lib/base/object.h>
+#include <lib/base/estring.h>
+#include <list>
+
+class eServiceReference
+{
+public:
+ enum
+ {
+ idInvalid=-1,
+ idStructure, // service_id == 0 is root
+ idDVB,
+ idFile,
+ idUser=0x1000
+ };
+ int type;
+
+ int flags; // flags will NOT be compared.
+ enum
+ {
+ isDirectory=1, // SHOULD enter (implies mustDescent)
+ mustDescent=2, // cannot be played directly - often used with "isDirectory" (implies canDescent)
+ /*
+ for example:
+ normal services have none of them - they can be fed directly into the "play"-handler.
+ normal directories have both of them set - you cannot play a directory directly and the UI should descent into it.
+ playlists have "mustDescent", but not "isDirectory" - you don't want the user to browse inside the playlist (unless he really wants)
+ services with sub-services have none of them, instead the have the "canDecsent" flag (as all of the above)
+ */
+ canDescent=4, // supports enterDirectory/leaveDirectory
+ flagDirectory=isDirectory|mustDescent|canDescent,
+ shouldSort=8, // should be ASCII-sorted according to service_name. great for directories.
+ hasSortKey=16, // has a sort key in data[3]. not having a sort key implies 0.
+ sort1=32 // sort key is 1 instead of 0
+ };
+
+ inline int getSortKey() const { return (flags & hasSortKey) ? data[3] : ((flags & sort1) ? 1 : 0); }
+
+ int data[8];
+ eString path;
+
+ eServiceReference()
+ : type(idInvalid), flags(0)
+ {
+ }
+
+ eServiceReference(int type, int flags)
+ : type(type), flags(flags)
+ {
+ memset(data, 0, sizeof(data));
+ }
+ eServiceReference(int type, int flags, int data0)
+ : type(type), flags(flags)
+ {
+ memset(data, 0, sizeof(data));
+ data[0]=data0;
+ }
+ eServiceReference(int type, int flags, int data0, int data1)
+ : type(type), flags(flags)
+ {
+ memset(data, 0, sizeof(data));
+ data[0]=data0;
+ data[1]=data1;
+ }
+ eServiceReference(int type, int flags, int data0, int data1, int data2)
+ : type(type), flags(flags)
+ {
+ memset(data, 0, sizeof(data));
+ data[0]=data0;
+ data[1]=data1;
+ data[2]=data2;
+ }
+ eServiceReference(int type, int flags, int data0, int data1, int data2, int data3)
+ : type(type), flags(flags)
+ {
+ memset(data, 0, sizeof(data));
+ data[0]=data0;
+ data[1]=data1;
+ data[2]=data2;
+ data[3]=data3;
+ }
+ eServiceReference(int type, int flags, int data0, int data1, int data2, int data3, int data4)
+ : type(type), flags(flags)
+ {
+ memset(data, 0, sizeof(data));
+ data[0]=data0;
+ data[1]=data1;
+ data[2]=data2;
+ data[3]=data3;
+ data[4]=data4;
+ }
+ eServiceReference(int type, int flags, const eString &path)
+ : type(type), flags(flags), path(path)
+ {
+ memset(data, 0, sizeof(data));
+ }
+ eServiceReference(const eString &string);
+ eString toString() const;
+ bool operator==(const eServiceReference &c) const
+ {
+ if (type != c.type)
+ return 0;
+ return /* (flags == c.flags) && */ (memcmp(data, c.data, sizeof(int)*8)==0) && (path == c.path);
+ }
+ bool operator!=(const eServiceReference &c) const
+ {
+ return !(*this == c);
+ }
+ bool operator<(const eServiceReference &c) const
+ {
+ if (type < c.type)
+ return 1;
+
+ if (type > c.type)
+ return 0;
+
+/* if (flags < c.flags)
+ return 1;
+ if (flags > c.flags)
+ return 0; */
+
+ int r=memcmp(data, c.data, sizeof(int)*8);
+ if (r)
+ return r < 0;
+ return path < c.path;
+ }
+ operator bool() const
+ {
+ return type != idInvalid;
+ }
+};
+
+class iPauseableService: public virtual iObject
+{
+public:
+ virtual RESULT pause()=0;
+ virtual RESULT unpause()=0;
+};
+
+class iPlayableService: public virtual iObject
+{
+ friend class iServiceHandler;
+public:
+ // it's PRIVATE to the class factory
+ virtual RESULT start()=0;
+ virtual RESULT getIPausableService(ePtr<iPauseableService> &ptr)=0;
+};
+
+class iRecordableService: public virtual iObject
+{
+public:
+ virtual RESULT start()=0;
+ virtual RESULT stop()=0;
+};
+
+class iListableService: public virtual iObject
+{
+public:
+ virtual RESULT getContent(std::list<eServiceReference> &list)=0;
+};
+
+class iServiceHandler: public virtual iObject
+{
+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;
+};
+
+#endif