Update EPG Cache(thanks to open source community)
[vuplus_dvbapp] / lib / service / iservice.h
1 #ifndef __lib_dvb_iservice_h
2 #define __lib_dvb_iservice_h
3
4 #include <lib/python/swig.h>
5 #include <lib/python/python.h>
6 #include <lib/base/object.h>
7 #include <string>
8 #include <connection.h>
9 #include <list>
10
11 class eServiceEvent;
12
13 class eServiceReference
14 {
15 public:
16         enum
17         {
18                 idInvalid=-1,
19                 idStructure,    // service_id == 0 is root
20                 idDVB,
21                 idFile,
22                 idUser=0x1000,
23                 idServiceMP3=0x1001
24         };
25         int type;
26
27         enum
28         {
29                 isDirectory=1,          // SHOULD enter  (implies mustDescent)
30                 mustDescent=2,          // cannot be played directly - often used with "isDirectory" (implies canDescent)
31                 /*
32                         for example:
33                                 normal services have none of them - they can be fed directly into the "play"-handler.
34                                 normal directories have both of them set - you cannot play a directory directly and the UI should descent into it.
35                                 playlists have "mustDescent", but not "isDirectory" - you don't want the user to browse inside the playlist (unless he really wants)
36                                 services with sub-services have none of them, instead the have the "canDecsent" flag (as all of the above)
37                 */
38                 canDescent=4,                   // supports enterDirectory/leaveDirectory
39                 flagDirectory=isDirectory|mustDescent|canDescent,
40                 shouldSort=8,                   // should be ASCII-sorted according to service_name. great for directories.
41                 hasSortKey=16,          // has a sort key in data[3]. not having a sort key implies 0.
42                 sort1=32,                                       // sort key is 1 instead of 0
43                 isMarker=64,                    // Marker
44                 isGroup=128                     // is a group of services
45         };
46         int flags; // flags will NOT be compared.
47
48         inline int getSortKey() const { return (flags & hasSortKey) ? data[3] : ((flags & sort1) ? 1 : 0); }
49
50 #ifndef SWIG
51         int data[8];
52         std::string path;
53 #endif
54         std::string getPath() { return path; }
55         void setPath( const std::string &n ) { path=n; }
56
57         unsigned int getUnsignedData(unsigned int num) const
58         {
59                 if ( num < sizeof(data)/sizeof(int) )
60                         return data[num];
61                 return 0;
62         }
63
64         int getData(unsigned int num) const
65         {
66                 if ( num < sizeof(data)/sizeof(int) )
67                         return data[num];
68                 return 0;
69         }
70
71         void setUnsignedData(unsigned int num, unsigned int val)
72         {
73                 if ( num < sizeof(data)/sizeof(int) )
74                         data[num] = val;
75         }
76
77         void setData(unsigned int num, int val)
78         {
79                 if ( num < sizeof(data)/sizeof(int) )
80                         data[num] = val;
81         }
82
83 // only for override service names in bouquets or to give servicerefs a name which not have a
84 // real existing service ( for dvb eServiceDVB )
85 #ifndef SWIG
86         std::string name;
87 #endif
88         std::string getName() const { return name; }
89         void setName( const std::string &n ) { name=n; }
90
91         eServiceReference()
92                 : type(idInvalid), flags(0)
93         {
94                 memset(data, 0, sizeof(data));
95         }
96 #ifndef SWIG
97         eServiceReference(int type, int flags)
98                 : type(type), flags(flags)
99         {
100                 memset(data, 0, sizeof(data));
101         }
102         eServiceReference(int type, int flags, int data0)
103                 : type(type), flags(flags)
104         {
105                 memset(data, 0, sizeof(data));
106                 data[0]=data0;
107         }
108         eServiceReference(int type, int flags, int data0, int data1)
109                 : type(type), flags(flags)
110         {
111                 memset(data, 0, sizeof(data));
112                 data[0]=data0;
113                 data[1]=data1;
114         }
115         eServiceReference(int type, int flags, int data0, int data1, int data2)
116                 : type(type), flags(flags)
117         {
118                 memset(data, 0, sizeof(data));
119                 data[0]=data0;
120                 data[1]=data1;
121                 data[2]=data2;
122         }
123         eServiceReference(int type, int flags, int data0, int data1, int data2, int data3)
124                 : type(type), flags(flags)
125         {
126                 memset(data, 0, sizeof(data));
127                 data[0]=data0;
128                 data[1]=data1;
129                 data[2]=data2;
130                 data[3]=data3;
131         }
132         eServiceReference(int type, int flags, int data0, int data1, int data2, int data3, int data4)
133                 : type(type), flags(flags)
134         {
135                 memset(data, 0, sizeof(data));
136                 data[0]=data0;
137                 data[1]=data1;
138                 data[2]=data2;
139                 data[3]=data3;
140                 data[4]=data4;
141         }
142         operator bool() const
143         {
144                 return valid();
145         }
146 #endif
147         eServiceReference(int type, int flags, const std::string &path)
148                 : type(type), flags(flags), path(path)
149         {
150                 memset(data, 0, sizeof(data));
151         }
152         eServiceReference(const std::string &string);
153         std::string toString() const;
154         std::string toCompareString() const;
155         bool operator==(const eServiceReference &c) const
156         {
157                 if (type != c.type)
158                         return 0;
159                 return (memcmp(data, c.data, sizeof(int)*8)==0) && (path == c.path);
160         }
161         bool operator!=(const eServiceReference &c) const
162         {
163                 return !(*this == c);
164         }
165         bool operator<(const eServiceReference &c) const
166         {
167                 if (type < c.type)
168                         return 1;
169
170                 if (type > c.type)
171                         return 0;
172
173                 int r=memcmp(data, c.data, sizeof(int)*8);
174                 if (r)
175                         return r < 0;
176                 return path < c.path;
177         }
178         
179         int valid() const
180         {
181                 return type != idInvalid;
182         }
183 };
184
185 SWIG_ALLOW_OUTPUT_SIMPLE(eServiceReference);
186
187 extern PyObject *New_eServiceReference(const eServiceReference &ref); // defined in enigma_python.i
188
189 #ifndef SWIG
190 #ifdef PYTHON_REFCOUNT_DEBUG
191 inline ePyObject Impl_New_eServiceReference(const char* file, int line, const eServiceReference &ref)
192 {
193         return ePyObject(New_eServiceReference(ref), file, line);
194 }
195 #define NEW_eServiceReference(ref) Impl_New_eServiceReference(__FILE__, __LINE__, ref)
196 #else
197 inline ePyObject Impl_New_eServiceReference(const eServiceReference &ref)
198 {
199         return New_eServiceReference(ref);
200 }
201 #define NEW_eServiceReference(ref) Impl_New_eServiceReference(ref)
202 #endif
203 #endif // SWIG
204
205 typedef long long pts_t;
206
207         /* the reason we have the servicereference as additional argument is
208            that we don't have to create one object for every entry in a possibly
209            large list, provided that no state information is nessesary to deliver
210            the required information. Anyway - ref *must* be the same as the argument
211            to the info() or getIServiceInformation call! */
212
213         /* About the usage of SWIG_VOID:
214            SWIG_VOID(real_returntype_t) hides a return value from swig. This is used for
215            the "superflouus" RESULT return values.
216            
217            Python code has to check the returned pointer against 0. This works,
218            as all functions returning instances in smartpointers AND having a 
219            RESULT have to BOTH return non-zero AND set the pointer to zero.
220            
221            Python code thus can't check for the reason, but the reason isn't
222            user-servicable anyway. If you want to return a real reason which
223            goes beyong "it just doesn't work", use extra variables for this,
224            not the RESULT.
225            
226            Hide the result only if there is another way to check for failure! */
227            
228 class eServiceEvent;
229
230 SWIG_IGNORE(iStaticServiceInformation);
231 class iStaticServiceInformation: public iObject
232 {
233 #ifdef SWIG
234         iStaticServiceInformation();
235         ~iStaticServiceInformation();
236 #endif
237 public:
238         virtual SWIG_VOID(RESULT) getName(const eServiceReference &ref, std::string &SWIG_OUTPUT)=0;
239
240                 // doesn't need to be implemented, should return -1 then.
241         virtual int getLength(const eServiceReference &ref);
242         virtual SWIG_VOID(RESULT) getEvent(const eServiceReference &ref, ePtr<eServiceEvent> &SWIG_OUTPUT, time_t start_time=-1);
243                 // returns true when not implemented
244         virtual int isPlayable(const eServiceReference &ref, const eServiceReference &ignore, bool simulate=false);
245
246         virtual int getInfo(const eServiceReference &ref, int w);
247         virtual std::string getInfoString(const eServiceReference &ref,int w);
248         virtual PyObject *getInfoObject(const eServiceReference &ref, int w);
249
250         virtual int setInfo(const eServiceReference &ref, int w, int v);
251         virtual int setInfoString(const eServiceReference &ref, int w, const char *v);
252 };
253 SWIG_TEMPLATE_TYPEDEF(ePtr<iStaticServiceInformation>, iStaticServiceInformationPtr);
254
255 class iServiceInformation_ENUMS
256 {
257 #ifdef SWIG
258         iServiceInformation_ENUMS();
259         ~iServiceInformation_ENUMS();
260 #endif
261 public:
262         enum {
263                 sIsCrypted,             /* is encrypted (no indication if decrypt was possible) */
264                 sAspect,                /* aspect ratio: 0=4:3, 1=16:9, 2=whatever we need */
265                 sFrameRate,                     /* frame rate */
266                 sProgressive,           /* 0 = interlaced, 1 = progressive */
267                 sIsMultichannel,        /* multichannel *available* (probably not selected) */
268
269                         /* "user serviceable info" - they are not reliable. Don't use them for anything except the service menu!
270                            that's also the reason why they are so globally defined.
271                            again - if somebody EVER tries to use this information for anything else than simply displaying it,
272                            i will change this to return a user-readable text like "zero x zero three three" (and change the
273                            exact spelling in every version) to stop that! */
274
275                 sVideoPID,
276                 sAudioPID,
277                 sPCRPID,
278                 sPMTPID,
279                 sTXTPID,
280
281                 sSID,
282                 sONID,
283                 sTSID,
284                 sNamespace,
285                 sProvider,
286
287                 sDescription,
288                 sServiceref,
289                 sTimeCreate,            /* unix time or string */
290                 sFileSize,
291
292                 sCAIDs,
293                 sCAIDPIDs,
294                 sVideoType,             /* MPEG2 MPEG4 */
295
296                 sTags,                          /* space seperated list of tags */
297
298                 sDVBState,                      /* states as defined in pmt handler (as events there) */
299
300                 sVideoHeight,
301                 sVideoWidth,
302
303                 sTransponderData,       /* transponderdata as python dict */
304
305                 sCurrentChapter,
306                 sCurrentTitle,
307                 sTotalChapters,
308                 sTotalTitles,
309
310                 sTagTitle,
311                 sTagTitleSortname,
312                 sTagArtist,
313                 sTagArtistSortname,
314                 sTagAlbum,
315                 sTagAlbumSortname,
316                 sTagComposer,
317                 sTagDate,
318                 sTagGenre,
319                 sTagComment,
320                 sTagExtendedComment,
321                 sTagTrackNumber,
322                 sTagTrackCount,
323                 sTagAlbumVolumeNumber,
324                 sTagAlbumVolumeCount,
325                 sTagLocation,
326                 sTagHomepage,
327                 sTagDescription,
328                 sTagVersion,
329                 sTagISRC,
330                 sTagOrganization,
331                 sTagCopyright,
332                 sTagCopyrightURI,
333                 sTagContact,
334                 sTagLicense,
335                 sTagLicenseURI,
336                 sTagPerformer,
337                 sTagCodec,
338                 sTagVideoCodec,
339                 sTagAudioCodec,
340                 sTagBitrate,
341                 sTagNominalBitrate,
342                 sTagMinimumBitrate,
343                 sTagMaximumBitrate,
344                 sTagSerial,
345                 sTagEncoder,
346                 sTagEncoderVersion,
347                 sTagTrackGain,
348                 sTagTrackPeak,
349                 sTagAlbumGain,
350                 sTagAlbumPeak,
351                 sTagReferenceLevel,
352                 sTagLanguageCode,
353                 sTagImage,
354                 sTagPreviewImage,
355                 sTagAttachment,
356                 sTagBeatsPerMinute,
357                 sTagKeywords,
358                 sTagCRC,
359                 sTagChannelMode,
360
361                 sTransferBPS,
362
363                 sHBBTVUrl,
364                 sLiveStreamDemuxId,
365                 sIsScrambled,
366
367                 sUser = 0x100
368         };
369         enum {
370                 resNA = -1,
371                 resIsString = -2,
372                 resIsPyObject = -3
373         };
374 };
375
376 /* some words to structs like struct iServiceInformation_ENUMS
377 For some classes we need in python just the SmartPointer Variants.
378 So we prevent building wrapper classes for the non smart pointer classes with the SWIG_IGNORE makro.
379 But now we have the problem that swig do not export enums for smart pointer classes (i dont know why).
380 So we move all enum's to own classes (with _ENUMS as name ending) and let our real
381 class inherit from the *_ENUMS class. This *_ENUMS classes are normally exportet via swig to python.
382 But in the python code we doesn't like to write iServiceInformation_ENUMS.sVideoType....
383 we like to write iServiceInformation.sVideoType.
384 So until swig have no Solution for this Problem we call in lib/python/Makefile.am a python script named
385 enigma_py_patcher.py to remove the "_ENUMS" strings in enigma.py at all needed locations. */
386
387 SWIG_IGNORE(iServiceInformation);
388 class iServiceInformation: public iServiceInformation_ENUMS, public iObject
389 {
390 #ifdef SWIG
391         iServiceInformation();
392         ~iServiceInformation();
393 #endif
394 public:
395         virtual SWIG_VOID(RESULT) getName(std::string &SWIG_OUTPUT)=0;
396         virtual SWIG_VOID(RESULT) getEvent(ePtr<eServiceEvent> &SWIG_OUTPUT, int nownext);
397
398         virtual int getInfo(int w);
399         virtual std::string getInfoString(int w);
400         virtual PyObject *getInfoObject(int w);
401
402         virtual int setInfo(int w, int v);
403         virtual int setInfoString(int w, const char *v);
404 };
405 SWIG_TEMPLATE_TYPEDEF(ePtr<iServiceInformation>, iServiceInformationPtr);
406
407 class iFrontendInformation_ENUMS
408 {
409 #ifdef SWIG
410         iFrontendInformation_ENUMS();
411         ~iFrontendInformation_ENUMS();
412 #endif
413 public:
414         enum {
415                 bitErrorRate,
416                 signalPower,
417                 signalQuality,
418                 lockState,
419                 syncState,
420                 frontendNumber,
421                 signalQualitydB,
422         };
423 };
424
425 SWIG_IGNORE(iFrontendInformation);
426 class iFrontendInformation: public iFrontendInformation_ENUMS, public iObject
427 {
428 #ifdef SWIG
429         iFrontendInformation();
430         ~iFrontendInformation();
431 #endif
432 public:
433         virtual int getFrontendInfo(int w)=0;
434         virtual PyObject *getFrontendData()=0;
435         virtual PyObject *getFrontendStatus()=0;
436         virtual PyObject *getTransponderData(bool original)=0;
437         virtual PyObject *getAll(bool original)=0; // a sum of getFrontendData/Status/TransponderData
438 };
439 SWIG_TEMPLATE_TYPEDEF(ePtr<iFrontendInformation>, iFrontendInformationPtr);
440
441 SWIG_IGNORE(iPauseableService);
442 class iPauseableService: public iObject
443 {
444 #ifdef SWIG
445         iPausableService();
446         ~iPausableService();
447 #endif
448 public:
449
450                 /* this will set the *state* directly. So just call a SINGLE function of those at a time. */
451         virtual RESULT pause()=0;
452         virtual RESULT unpause()=0;
453
454                 /* hm. */
455         virtual RESULT setSlowMotion(int ratio=0)=0;
456         virtual RESULT setFastForward(int ratio=0)=0;
457 };
458 SWIG_TEMPLATE_TYPEDEF(ePtr<iPauseableService>, iPauseableServicePtr);
459
460 class iSeekableService_ENUMS
461 {
462 #ifdef SWIG
463         iSeekableService_ENUMS();
464         ~iSeekableService_ENUMS();
465 #endif
466 public:
467         enum { dirForward = +1, dirBackward = -1 };
468 };
469
470 SWIG_IGNORE(iSeekableService);
471 class iSeekableService: public iSeekableService_ENUMS, public iObject
472 {
473 #ifdef SWIG
474         iSeekableService();
475         ~iSeekableService();
476 #endif
477 public:
478         virtual RESULT getLength(pts_t &SWIG_OUTPUT)=0;
479         virtual RESULT seekTo(pts_t to)=0;
480         virtual RESULT seekRelative(int direction, pts_t to)=0;
481         virtual RESULT getPlayPosition(pts_t &SWIG_OUTPUT)=0;
482                 /* if you want to do several seeks in a row, you can enable the trickmode.
483                    audio will be switched off, sync will be disabled etc. */
484         virtual RESULT setTrickmode(int trick=0)=0;
485         virtual RESULT isCurrentlySeekable()=0;
486         virtual RESULT seekChapter(int) { return -1; }
487         virtual RESULT seekTitle(int) { return -1; }
488 };
489 SWIG_TEMPLATE_TYPEDEF(ePtr<iSeekableService>, iSeekableServicePtr);
490
491 struct iAudioTrackInfo
492 {
493 #ifndef SWIG
494         std::string m_description;
495         std::string m_language; /* iso639 */
496         int m_pid; /* for association with the stream. */
497 #endif
498         std::string getDescription() { return m_description; }
499         std::string getLanguage() { return m_language; }
500         int getPID() { return m_pid; }
501 };
502 SWIG_ALLOW_OUTPUT_SIMPLE(iAudioTrackInfo);
503
504 SWIG_IGNORE(iAudioTrackSelection);
505 class iAudioTrackSelection: public iObject
506 {
507 #ifdef SWIG
508         iAudioTrackSelection();
509         ~iAudioTrackSelection();
510 #endif
511 public:
512         virtual int getNumberOfTracks()=0;
513         virtual RESULT selectTrack(unsigned int i)=0;
514         virtual SWIG_VOID(RESULT) getTrackInfo(struct iAudioTrackInfo &SWIG_OUTPUT, unsigned int n)=0;
515         virtual int getCurrentTrack()=0;
516 };
517 SWIG_TEMPLATE_TYPEDEF(ePtr<iAudioTrackSelection>, iAudioTrackSelectionPtr);
518
519 class iAudioChannelSelection_ENUMS
520 {
521 #ifdef SWIG
522         iAudioChannelSelection_ENUMS();
523         ~iAudioChannelSelection_ENUMS();
524 #endif
525 public:
526         enum { LEFT, STEREO, RIGHT };
527 };
528
529 SWIG_IGNORE(iAudioChannelSelection);
530 class iAudioChannelSelection: public iAudioChannelSelection_ENUMS, public iObject
531 {
532 #ifdef SWIG
533         iAudioChannelSelection();
534         ~iAudioChannelSelection();
535 #endif
536 public:
537         virtual int getCurrentChannel()=0;
538         virtual RESULT selectChannel(int i)=0;
539 };
540 SWIG_TEMPLATE_TYPEDEF(ePtr<iAudioChannelSelection>, iAudioChannelSelectionPtr);
541
542 SWIG_IGNORE(iAudioDelay);
543 class iAudioDelay: public iObject
544 {
545 #ifdef SWIG
546         iAudioDelay();
547         ~iAudioDelay();
548 #endif
549 public:
550         virtual int getAC3Delay()=0;
551         virtual int getPCMDelay()=0;
552         virtual void setAC3Delay(int)=0;
553         virtual void setPCMDelay(int)=0;
554 };
555 SWIG_TEMPLATE_TYPEDEF(ePtr<iAudioDelay>, iAudioDelayPtr);
556
557 class iRdsDecoder_ENUMS
558 {
559 #ifdef SWIG
560         iRdsDecoder_ENUMS();
561         ~iRdsDecoder_ENUMS();
562 #endif
563 public:
564         enum { RadioText, RtpText };
565 };
566
567 SWIG_IGNORE(iRdsDecoder);
568 class iRdsDecoder: public iObject, public iRdsDecoder_ENUMS
569 {
570 #ifdef SWIG
571         iRdsDecoder();
572         ~iRdsDecoder();
573 #endif
574 public:
575         virtual std::string getText(int x=RadioText)=0;
576         virtual void showRassSlidePicture()=0;
577         virtual void showRassInteractivePic(int page, int subpage)=0;
578         virtual SWIG_PYOBJECT(ePyObject) getRassInteractiveMask()=0;
579 };
580 SWIG_TEMPLATE_TYPEDEF(ePtr<iRdsDecoder>, iRdsDecoderPtr);
581
582 SWIG_IGNORE(iSubserviceList);
583 class iSubserviceList: public iObject
584 {
585 #ifdef SWIG
586         iSubserviceList();
587         ~iSubserviceList();
588 #endif
589 public:
590         virtual int getNumberOfSubservices()=0;
591         virtual SWIG_VOID(RESULT) getSubservice(eServiceReference &SWIG_OUTPUT, unsigned int n)=0;
592 };
593 SWIG_TEMPLATE_TYPEDEF(ePtr<iSubserviceList>, iSubserviceListPtr);
594
595 SWIG_IGNORE(iTimeshiftService);
596 class iTimeshiftService: public iObject
597 {
598 #ifdef SWIG
599         iTimeshiftService();
600         ~iTimeshiftService();
601 #endif
602 public:
603         virtual RESULT startTimeshift()=0;
604         virtual RESULT stopTimeshift(bool swToLive=true)=0;
605         virtual RESULT setNextPlaybackFile(const char *fn)=0; // not needed by our internal timeshift.. but external plugin...
606
607         virtual int isTimeshiftActive()=0;
608                         /* this essentially seeks to the relative end of the timeshift buffer */
609         virtual RESULT activateTimeshift()=0;
610 };
611 SWIG_TEMPLATE_TYPEDEF(ePtr<iTimeshiftService>, iTimeshiftServicePtr);
612
613         /* not related to eCueSheet */
614
615 class iCueSheet_ENUMS
616 {
617 #ifdef SWIG
618         iCueSheet_ENUMS();
619         ~iCueSheet_ENUMS();
620 #endif
621 public:
622         enum { cutIn = 0, cutOut = 1, cutMark = 2 };
623 };
624
625 SWIG_IGNORE(iCueSheet);
626 class iCueSheet: public iCueSheet_ENUMS, public iObject
627 {
628 #ifdef SWIG
629         iCueSheet();
630         ~iCueSheet();
631 #endif
632 public:
633         /* returns a list of (pts, what)-tuples */
634         virtual PyObject *getCutList() = 0;
635         virtual void setCutList(SWIG_PYOBJECT(ePyObject) list) = 0;
636         virtual void setCutListEnable(int enable) = 0;
637 };
638 SWIG_TEMPLATE_TYPEDEF(ePtr<iCueSheet>, iCueSheetPtr);
639
640 class eWidget;
641 class PyList;
642
643 SWIG_IGNORE(iSubtitleOutput);
644 class iSubtitleOutput: public iObject
645 {
646 public:
647         virtual RESULT enableSubtitles(eWidget *parent, SWIG_PYOBJECT(ePyObject) entry)=0;
648         virtual RESULT disableSubtitles(eWidget *parent)=0;
649         virtual PyObject *getSubtitleList()=0;
650         virtual PyObject *getCachedSubtitle()=0;
651 };
652 SWIG_TEMPLATE_TYPEDEF(ePtr<iSubtitleOutput>, iSubtitleOutputPtr);
653
654 SWIG_IGNORE(iMutableServiceList);
655 class iMutableServiceList: public iObject
656 {
657 #ifdef SWIG
658         iMutableServiceList();
659         ~iMutableServiceList();
660 #endif
661 public:
662                 /* flush changes */
663         virtual RESULT flushChanges()=0;
664                 /* adds a service to a list */
665         virtual RESULT addService(eServiceReference &ref, eServiceReference before=eServiceReference())=0;
666                 /* removes a service from a list */
667         virtual RESULT removeService(eServiceReference &ref)=0;
668                 /* moves a service in a list, only if list suppports a specific sort method. */
669                 /* pos is the new, absolute position from 0..size-1 */
670         virtual RESULT moveService(eServiceReference &ref, int pos)=0;
671                 /* set name of list, for bouquets this is the visible bouquet name */
672         virtual RESULT setListName(const std::string &name)=0;
673 };
674 SWIG_TEMPLATE_TYPEDEF(ePtr<iMutableServiceList>, iMutableServiceListPtr);
675
676 SWIG_IGNORE(iListableService);
677 class iListableService: public iObject
678 {
679 #ifdef SWIG
680         iListableService();
681         ~iListableService();
682 #endif
683 public:
684 #ifndef SWIG
685                 /* legacy interface: get a list */
686         virtual RESULT getContent(std::list<eServiceReference> &list, bool sorted=false)=0;
687 #endif
688         virtual PyObject *getContent(const char* format, bool sorted=false)=0;
689
690                 /* new, shiny interface: streaming. */
691         virtual SWIG_VOID(RESULT) getNext(eServiceReference &SWIG_OUTPUT)=0;
692
693                 /* use this for sorting. output is not sorted because of either
694                  - performance reasons: the whole list must be buffered or
695                  - the interface would be restricted to a list. streaming
696                    (as well as a future "active" extension) won't be possible.
697                 */
698         virtual int compareLessEqual(const eServiceReference &, const eServiceReference &)=0;
699
700         virtual SWIG_VOID(RESULT) startEdit(ePtr<iMutableServiceList> &SWIG_OUTPUT)=0;
701 };
702 SWIG_TEMPLATE_TYPEDEF(ePtr<iListableService>, iListableServicePtr);
703
704 #ifndef SWIG
705         /* a helper class which can be used as argument to stl's sort(). */
706 class iListableServiceCompare
707 {
708         ePtr<iListableService> m_list;
709 public:
710         iListableServiceCompare(iListableService *list): m_list(list) { }
711         bool operator()(const eServiceReference &a, const eServiceReference &b)
712         {
713                 return m_list->compareLessEqual(a, b);
714         }
715 };
716 #endif
717
718 SWIG_IGNORE(iServiceOfflineOperations);
719 class iServiceOfflineOperations: public iObject
720 {
721 #ifdef SWIG
722         iServiceOfflineOperations();
723         ~iServiceOfflineOperations();
724 #endif
725 public:
726                 /* to delete a service, forever. */
727         virtual RESULT deleteFromDisk(int simulate=1)=0;
728
729                 /* for transferring a service... */
730         virtual SWIG_VOID(RESULT) getListOfFilenames(std::list<std::string> &SWIG_OUTPUT)=0;
731         
732                 /* a blocking call to reindex a file */
733         virtual int reindex() = 0;
734
735                 // TODO: additional stuff, like a conversion interface?
736 };
737 SWIG_TEMPLATE_TYPEDEF(ePtr<iServiceOfflineOperations>, iServiceOfflineOperationsPtr);
738
739 SWIG_IGNORE(iStreamableService);
740 class iStreamableService: public iObject
741 {
742 #ifdef SWIG
743         iStreamableService();
744         ~iStreamableService();
745 #endif
746 public:
747                 /* returns a dict:
748                         { "demux": <n>,
749                           "pids": [(x,type),(y,type),(z,type),..],
750                           ...
751                         }
752                         with type being "video", "audio", "pmt", "pat"...
753                 */
754         virtual PyObject *getStreamingData()=0;
755 };
756 SWIG_TEMPLATE_TYPEDEF(ePtr<iStreamableService>, iStreamableServicePtr);
757
758 SWIG_IGNORE(iStreamedService);
759 class iStreamedService: public iObject
760 {
761 #ifdef SWIG
762         iStreamedService();
763         ~iStreamedService();
764 #endif
765 public:
766         virtual PyObject *getBufferCharge()=0;
767         virtual int setBufferSize(int size)=0;
768 };
769 SWIG_TEMPLATE_TYPEDEF(ePtr<iStreamedService>, iStreamedServicePtr);
770
771 class iServiceKeys_ENUMS
772 {
773 #ifdef SWIG
774         iServiceKeys_ENUMS();
775         ~iServiceKeys_ENUMS();
776 #endif
777 public:
778         enum {
779                 keyLeft,
780                 keyRight,
781                 keyUp,
782                 keyDown,
783                 keyOk,
784                 keyUser = 0x100
785         };
786 };
787
788 SWIG_IGNORE(iServiceKeys);
789 class iServiceKeys: public iServiceKeys_ENUMS, public iObject
790 {
791 #ifdef SWIG
792         iServiceKeys();
793         ~iServiceKeys();
794 #endif
795 public:
796         virtual SWIG_VOID(RESULT) keyPressed(int key)=0;
797 };
798 SWIG_TEMPLATE_TYPEDEF(ePtr<iServiceKeys>, iServiceKeysPtr);
799
800 class iPlayableService_ENUMS
801 {
802 #ifdef SWIG
803         iPlayableService_ENUMS();
804         ~iPlayableService_ENUMS();
805 #endif
806 public:
807         enum {
808                         /* these first two events are magical, and should only
809                            be generated if you know what you're doing. */
810                 evStart,
811                 evEnd,
812
813                 evTunedIn,
814                 evTuneFailed,
815
816                         /* when iServiceInformation is implemented:*/
817                 evUpdatedEventInfo,
818                 evUpdatedInfo,
819
820                         /* when seek() is implemented: */
821                 evSeekableStatusChanged, /* for example when timeshifting */
822
823                 evEOF,
824                 evSOF, /* bounced against start of file (when seeking backwards) */
825
826                         /* when cueSheet is implemented */
827                 evCuesheetChanged,
828
829                         /* when rdsDecoder is implemented */
830                 evUpdatedRadioText,
831                 evUpdatedRtpText,
832
833                         /* Radio Screenshow Support */
834                 evUpdatedRassSlidePic,
835                 evUpdatedRassInteractivePicMask,
836
837                 evVideoSizeChanged,
838                 evVideoFramerateChanged,
839                 evVideoProgressiveChanged,
840
841                 evBuffering,
842
843                 evStopped,
844                 evHBBTVInfo,
845
846                 evFccFailed,
847
848                 evUser = 0x100
849         };
850 };
851
852 SWIG_IGNORE(iPlayableService);
853 class iPlayableService: public iPlayableService_ENUMS, public iObject
854 {
855 #ifdef SWIG
856         iPlayableService();
857         ~iPlaybleService();
858 #endif
859         friend class iServiceHandler;
860 public:
861 #ifndef SWIG
862         virtual RESULT connectEvent(const Slot2<void,iPlayableService*,int> &event, ePtr<eConnection> &connection)=0;
863 #endif
864         virtual RESULT start()=0;
865         virtual RESULT stop()=0;
866                         /* might have to be changed... */
867         virtual RESULT setTarget(int target)=0;
868         virtual SWIG_VOID(RESULT) seek(ePtr<iSeekableService> &SWIG_OUTPUT)=0;
869         virtual SWIG_VOID(RESULT) pause(ePtr<iPauseableService> &SWIG_OUTPUT)=0;
870         virtual SWIG_VOID(RESULT) info(ePtr<iServiceInformation> &SWIG_OUTPUT)=0;
871         virtual SWIG_VOID(RESULT) audioTracks(ePtr<iAudioTrackSelection> &SWIG_OUTPUT)=0;
872         virtual SWIG_VOID(RESULT) audioChannel(ePtr<iAudioChannelSelection> &SWIG_OUTPUT)=0;
873         virtual SWIG_VOID(RESULT) subServices(ePtr<iSubserviceList> &SWIG_OUTPUT)=0;
874         virtual SWIG_VOID(RESULT) frontendInfo(ePtr<iFrontendInformation> &SWIG_OUTPUT)=0;
875         virtual SWIG_VOID(RESULT) timeshift(ePtr<iTimeshiftService> &SWIG_OUTPUT)=0;
876         virtual SWIG_VOID(RESULT) cueSheet(ePtr<iCueSheet> &SWIG_OUTPUT)=0;
877         virtual SWIG_VOID(RESULT) subtitle(ePtr<iSubtitleOutput> &SWIG_OUTPUT)=0;
878         virtual SWIG_VOID(RESULT) audioDelay(ePtr<iAudioDelay> &SWIG_OUTPUT)=0;
879         virtual SWIG_VOID(RESULT) rdsDecoder(ePtr<iRdsDecoder> &SWIG_OUTPUT)=0;
880         virtual SWIG_VOID(RESULT) stream(ePtr<iStreamableService> &SWIG_OUTPUT)=0;
881         virtual SWIG_VOID(RESULT) streamed(ePtr<iStreamedService> &SWIG_OUTPUT)=0;
882         virtual SWIG_VOID(RESULT) keys(ePtr<iServiceKeys> &SWIG_OUTPUT)=0;
883         virtual void setQpipMode(bool value, bool audio)=0;
884 };
885 SWIG_TEMPLATE_TYPEDEF(ePtr<iPlayableService>, iPlayableServicePtr);
886
887 class iRecordableService_ENUMS
888 {
889 #ifdef SWIG
890         iRecordableService_ENUMS();
891         ~iRecordableService_ENUMS();
892 #endif
893 public:
894         enum {
895                 evStart,
896                 evEnd,
897                 evTunedIn,
898                 evTuneFailed,
899                 evRecordRunning,
900                 evRecordStopped,
901                 evNewProgramInfo,
902                 evRecordFailed,
903                 evRecordWriteError,
904                 evNewEventInfo,
905                 evTuneStart,
906                 evPvrTuneStart,
907                 evPvrEof,
908         };
909         enum {
910                 NoError=0,
911                 errOpenRecordFile=-1,
912                 errNoDemuxAvailable=-2,
913                 errNoTsRecorderAvailable=-3,
914                 errDiskFull=-4,
915                 errTuneFailed=-255,
916                 errMisconfiguration = -256,
917                 errNoResources = -257,
918                 errNoCiConnected = -258
919         };
920 };
921
922 SWIG_IGNORE(iRecordableService);
923 class iRecordableService: public iRecordableService_ENUMS, public iObject
924 {
925 #ifdef SWIG
926         iRecordableService();
927         ~iRecordableService();
928 #endif
929 public:
930 #ifndef SWIG
931         virtual RESULT connectEvent(const Slot2<void,iRecordableService*,int> &event, ePtr<eConnection> &connection)=0;
932 #endif
933         virtual SWIG_VOID(RESULT) getError(int &SWIG_OUTPUT)=0;
934         virtual RESULT prepare(const char *filename, time_t begTime=-1, time_t endTime=-1, int eit_event_id=-1, const char *name=0, const char *descr=0, const char *tags=0, bool descramble = true, bool recordecm = false)=0;
935         virtual RESULT prepareStreaming()=0;
936         virtual RESULT start(bool simulate=false)=0;
937         virtual RESULT stop()=0;
938         virtual SWIG_VOID(RESULT) frontendInfo(ePtr<iFrontendInformation> &SWIG_OUTPUT)=0;
939         virtual SWIG_VOID(RESULT) stream(ePtr<iStreamableService> &SWIG_OUTPUT)=0;
940         virtual SWIG_VOID(RESULT) subServices(ePtr<iSubserviceList> &SWIG_OUTPUT)=0;
941         virtual SWIG_VOID(RESULT) getServiceType(int &SWIG_OUTPUT)=0;
942 };
943 SWIG_TEMPLATE_TYPEDEF(ePtr<iRecordableService>, iRecordableServicePtr);
944
945 extern PyObject *New_iRecordableServicePtr(const ePtr<iRecordableService> &ref); // defined in enigma_python.i
946
947 inline PyObject *PyFrom(ePtr<iRecordableService> &c)
948 {
949         return New_iRecordableServicePtr(c);
950 }
951
952 #ifndef SWIG
953 #ifdef PYTHON_REFCOUNT_DEBUG
954 inline ePyObject Impl_New_iRecordableServicePtr(const char* file, int line, const ePtr<iRecordableService> &ptr)
955 {
956         return ePyObject(New_iRecordableServicePtr(ptr), file, line);
957 }
958 #define NEW_iRecordableServicePtr(ptr) Impl_New_iRecordableServicePtr(__FILE__, __LINE__, ptr)
959 #else
960 inline ePyObject Impl_New_iRecordableServicePtr(const ePtr<iRecordableService> &ptr)
961 {
962         return New_iRecordableServicePtr(ptr);
963 }
964 #define NEW_iRecordableServicePtr(ptr) Impl_New_iRecordableServicePtr(ptr)
965 #endif
966 #endif // SWIG
967
968 SWIG_IGNORE(iServiceHandler);
969 class iServiceHandler: public iObject
970 {
971 #ifdef SWIG
972         iServiceHandler();
973         ~iServiceHandler();
974 #endif
975 public:
976         virtual SWIG_VOID(RESULT) play(const eServiceReference &, ePtr<iPlayableService> &SWIG_OUTPUT)=0;
977         virtual SWIG_VOID(RESULT) record(const eServiceReference &, ePtr<iRecordableService> &SWIG_OUTPUT)=0;
978         virtual SWIG_VOID(RESULT) list(const eServiceReference &, ePtr<iListableService> &SWIG_OUTPUT)=0;
979         virtual SWIG_VOID(RESULT) info(const eServiceReference &, ePtr<iStaticServiceInformation> &SWIG_OUTPUT)=0;
980         virtual SWIG_VOID(RESULT) offlineOperations(const eServiceReference &, ePtr<iServiceOfflineOperations> &SWIG_OUTPUT)=0;
981 };
982 SWIG_TEMPLATE_TYPEDEF(ePtr<iServiceHandler>, iServiceHandlerPtr);
983
984 #endif