- add iSeekableService, implement it for serviceDvb
[enigma2.git] / lib / service / servicedvb.h
1 #ifndef __servicedvb_h
2 #define __servicedvb_h
3
4 #include <lib/service/iservice.h>
5 #include <lib/dvb/idvb.h>
6
7 #include <lib/dvb/pmt.h>
8 #include <lib/dvb/eit.h>
9
10 class eServiceFactoryDVB: public iServiceHandler
11 {
12 DECLARE_REF(eServiceFactoryDVB);
13 public:
14         eServiceFactoryDVB();
15         virtual ~eServiceFactoryDVB();
16         enum { id = 0x1 };
17
18                 // iServiceHandler
19         RESULT play(const eServiceReference &, ePtr<iPlayableService> &ptr);
20         RESULT record(const eServiceReference &, ePtr<iRecordableService> &ptr);
21         RESULT list(const eServiceReference &, ePtr<iListableService> &ptr);
22         RESULT info(const eServiceReference &, ePtr<iStaticServiceInformation> &ptr);
23 private:
24         RESULT lookupService(ePtr<eDVBService> &ptr, const eServiceReference &ref);
25 };
26
27 class eDVBServiceList: public iListableService
28 {
29 DECLARE_REF(eDVBServiceList);
30 private:
31         eServiceReference m_parent;
32         friend class eServiceFactoryDVB;
33         eDVBServiceList(const eServiceReference &parent);
34 public:
35         virtual ~eDVBServiceList();
36         RESULT getContent(std::list<eServiceReference> &list);
37         RESULT getNext(eServiceReference &ptr);
38 };
39
40 class eDVBServicePlay: public iPlayableService, iSeekableService, public Object, public iServiceInformation
41 {
42 DECLARE_REF(eDVBServicePlay);
43 private:
44         friend class eServiceFactoryDVB;
45         eServiceReference m_reference;
46         
47         ePtr<eDVBService> m_dvb_service;
48         
49         ePtr<iTSMPEGDecoder> m_decoder;
50         
51         eDVBServicePMTHandler m_service_handler;
52         eDVBServiceEITHandler m_event_handler;
53         
54         eDVBServicePlay(const eServiceReference &ref, eDVBService *service);
55         
56         void gotNewEvent();
57         
58         void serviceEvent(int event);
59         Signal2<void,iPlayableService*,int> m_event;
60         
61         int m_is_pvr;
62 public:
63         virtual ~eDVBServicePlay();
64
65                 // iPlayableService
66         RESULT connectEvent(const Slot2<void,iPlayableService*,int> &event, ePtr<eConnection> &connection);
67         RESULT start();
68         RESULT stop();
69         RESULT seek(ePtr<iSeekableService> &ptr);
70         RESULT pause(ePtr<iPauseableService> &ptr);
71         RESULT info(ePtr<iServiceInformation> &ptr);
72         
73                 // iSeekableService
74         RESULT getLength(pts_t &len);
75         RESULT seekTo(pts_t to);
76         RESULT getPlayPosition(pts_t &pos);
77
78                 // iServiceInformation
79         RESULT getName(std::string &name);
80         RESULT getEvent(ePtr<eServiceEvent> &evt, int nownext);
81 };
82
83 #endif