1 #ifndef __lib_dvb_iservice_h
2 #define __lib_dvb_iservice_h
4 #include <lib/base/object.h>
5 #include <lib/base/estring.h>
6 #include <connection.h>
9 class eServiceReference
15 idStructure, // service_id == 0 is root
22 int flags; // flags will NOT be compared.
25 isDirectory=1, // SHOULD enter (implies mustDescent)
26 mustDescent=2, // cannot be played directly - often used with "isDirectory" (implies canDescent)
29 normal services have none of them - they can be fed directly into the "play"-handler.
30 normal directories have both of them set - you cannot play a directory directly and the UI should descent into it.
31 playlists have "mustDescent", but not "isDirectory" - you don't want the user to browse inside the playlist (unless he really wants)
32 services with sub-services have none of them, instead the have the "canDecsent" flag (as all of the above)
34 canDescent=4, // supports enterDirectory/leaveDirectory
35 flagDirectory=isDirectory|mustDescent|canDescent,
36 shouldSort=8, // should be ASCII-sorted according to service_name. great for directories.
37 hasSortKey=16, // has a sort key in data[3]. not having a sort key implies 0.
38 sort1=32 // sort key is 1 instead of 0
41 inline int getSortKey() const { return (flags & hasSortKey) ? data[3] : ((flags & sort1) ? 1 : 0); }
47 : type(idInvalid), flags(0)
51 eServiceReference(int type, int flags)
52 : type(type), flags(flags)
54 memset(data, 0, sizeof(data));
56 eServiceReference(int type, int flags, int data0)
57 : type(type), flags(flags)
59 memset(data, 0, sizeof(data));
62 eServiceReference(int type, int flags, int data0, int data1)
63 : type(type), flags(flags)
65 memset(data, 0, sizeof(data));
69 eServiceReference(int type, int flags, int data0, int data1, int data2)
70 : type(type), flags(flags)
72 memset(data, 0, sizeof(data));
77 eServiceReference(int type, int flags, int data0, int data1, int data2, int data3)
78 : type(type), flags(flags)
80 memset(data, 0, sizeof(data));
86 eServiceReference(int type, int flags, int data0, int data1, int data2, int data3, int data4)
87 : type(type), flags(flags)
89 memset(data, 0, sizeof(data));
96 eServiceReference(int type, int flags, const eString &path)
97 : type(type), flags(flags), path(path)
99 memset(data, 0, sizeof(data));
101 eServiceReference(const eString &string);
102 eString toString() const;
103 bool operator==(const eServiceReference &c) const
107 return /* (flags == c.flags) && */ (memcmp(data, c.data, sizeof(int)*8)==0) && (path == c.path);
109 bool operator!=(const eServiceReference &c) const
111 return !(*this == c);
113 bool operator<(const eServiceReference &c) const
121 /* if (flags < c.flags)
126 int r=memcmp(data, c.data, sizeof(int)*8);
129 return path < c.path;
131 operator bool() const
133 return type != idInvalid;
137 class iServiceInformation: public virtual iObject
140 virtual RESULT getName(eString &name)=0;
143 class iPauseableService: public virtual iObject
146 virtual RESULT pause()=0;
147 virtual RESULT unpause()=0;
150 class iPlayableService: public virtual iObject
152 friend class iServiceHandler;
159 virtual RESULT connectEvent(const Slot2<void,iPlayableService*,int> &event, ePtr<eConnection> &connection)=0;
160 virtual RESULT start()=0;
161 virtual RESULT stop()=0;
162 virtual RESULT getIPausableService(ePtr<iPauseableService> &ptr)=0;
163 virtual RESULT getIServiceInformation(ePtr<iServiceInformation> &ptr)=0;
166 class iRecordableService: public virtual iObject
169 virtual RESULT start()=0;
170 virtual RESULT stop()=0;
173 class iListableService: public virtual iObject
176 virtual RESULT getContent(std::list<eServiceReference> &list)=0;
179 class iServiceHandler: public virtual iObject
182 virtual RESULT play(const eServiceReference &, ePtr<iPlayableService> &ptr)=0;
183 virtual RESULT record(const eServiceReference &, ePtr<iRecordableService> &ptr)=0;
184 virtual RESULT list(const eServiceReference &, ePtr<iListableService> &ptr)=0;