1 #ifndef __lib_dvb_iservice_h
2 #define __lib_dvb_iservice_h
4 #include <lib/base/object.h>
5 #include <lib/base/estring.h>
8 class eServiceReference
14 idStructure, // service_id == 0 is root
21 int flags; // flags will NOT be compared.
24 isDirectory=1, // SHOULD enter (implies mustDescent)
25 mustDescent=2, // cannot be played directly - often used with "isDirectory" (implies canDescent)
28 normal services have none of them - they can be fed directly into the "play"-handler.
29 normal directories have both of them set - you cannot play a directory directly and the UI should descent into it.
30 playlists have "mustDescent", but not "isDirectory" - you don't want the user to browse inside the playlist (unless he really wants)
31 services with sub-services have none of them, instead the have the "canDecsent" flag (as all of the above)
33 canDescent=4, // supports enterDirectory/leaveDirectory
34 flagDirectory=isDirectory|mustDescent|canDescent,
35 shouldSort=8, // should be ASCII-sorted according to service_name. great for directories.
36 hasSortKey=16, // has a sort key in data[3]. not having a sort key implies 0.
37 sort1=32 // sort key is 1 instead of 0
40 inline int getSortKey() const { return (flags & hasSortKey) ? data[3] : ((flags & sort1) ? 1 : 0); }
46 : type(idInvalid), flags(0)
50 eServiceReference(int type, int flags)
51 : type(type), flags(flags)
53 memset(data, 0, sizeof(data));
55 eServiceReference(int type, int flags, int data0)
56 : type(type), flags(flags)
58 memset(data, 0, sizeof(data));
61 eServiceReference(int type, int flags, int data0, int data1)
62 : type(type), flags(flags)
64 memset(data, 0, sizeof(data));
68 eServiceReference(int type, int flags, int data0, int data1, int data2)
69 : type(type), flags(flags)
71 memset(data, 0, sizeof(data));
76 eServiceReference(int type, int flags, int data0, int data1, int data2, int data3)
77 : type(type), flags(flags)
79 memset(data, 0, sizeof(data));
85 eServiceReference(int type, int flags, int data0, int data1, int data2, int data3, int data4)
86 : type(type), flags(flags)
88 memset(data, 0, sizeof(data));
95 eServiceReference(int type, int flags, const eString &path)
96 : type(type), flags(flags), path(path)
98 memset(data, 0, sizeof(data));
100 eServiceReference(const eString &string);
101 eString toString() const;
102 bool operator==(const eServiceReference &c) const
106 return /* (flags == c.flags) && */ (memcmp(data, c.data, sizeof(int)*8)==0) && (path == c.path);
108 bool operator!=(const eServiceReference &c) const
110 return !(*this == c);
112 bool operator<(const eServiceReference &c) const
120 /* if (flags < c.flags)
125 int r=memcmp(data, c.data, sizeof(int)*8);
128 return path < c.path;
130 operator bool() const
132 return type != idInvalid;
136 class iPauseableService: public virtual iObject
139 virtual RESULT pause()=0;
140 virtual RESULT unpause()=0;
143 class iPlayableService: public virtual iObject
145 friend class iServiceHandler;
147 // it's PRIVATE to the class factory
148 virtual RESULT start()=0;
149 virtual RESULT getIPausableService(ePtr<iPauseableService> &ptr)=0;
152 class iRecordableService: public virtual iObject
155 virtual RESULT start()=0;
156 virtual RESULT stop()=0;
159 class iListableService: public virtual iObject
162 virtual RESULT getContent(std::list<eServiceReference> &list)=0;
165 class iServiceHandler: public virtual iObject
168 virtual RESULT play(const eServiceReference &, ePtr<iPlayableService> &ptr)=0;
169 virtual RESULT record(const eServiceReference &, ePtr<iRecordableService> &ptr)=0;
170 virtual RESULT list(const eServiceReference &, ePtr<iListableService> &ptr)=0;