f47c3906012ee31262703fb2e5c73159d9694ea5
[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         RESULT offlineOperations(const eServiceReference &, ePtr<iServiceOfflineOperations> &ptr);
24 private:
25         RESULT lookupService(ePtr<eDVBService> &ptr, const eServiceReference &ref);
26 };
27
28 class eDVBServiceList: public iListableService
29 {
30 DECLARE_REF(eDVBServiceList);
31 public:
32         virtual ~eDVBServiceList();
33         RESULT getContent(std::list<eServiceReference> &list);
34         RESULT getNext(eServiceReference &ptr);
35         int compareLessEqual(const eServiceReference &a, const eServiceReference &b);
36 private:
37         RESULT startQuery();
38         eServiceReference m_parent;
39         friend class eServiceFactoryDVB;
40         eDVBServiceList(const eServiceReference &parent);
41         ePtr<iDVBChannelListQuery> m_query;
42 };
43
44 class eDVBServicePlay: public iPlayableService, public iPauseableService, public iSeekableService, public Object, public iServiceInformation
45 {
46 DECLARE_REF(eDVBServicePlay);
47 public:
48         virtual ~eDVBServicePlay();
49
50                 // iPlayableService
51         RESULT connectEvent(const Slot2<void,iPlayableService*,int> &event, ePtr<eConnection> &connection);
52         RESULT start();
53         RESULT stop();
54         RESULT seek(ePtr<iSeekableService> &ptr);
55         RESULT pause(ePtr<iPauseableService> &ptr);
56         RESULT info(ePtr<iServiceInformation> &ptr);
57         
58                 // iPauseableService
59         RESULT pause();
60         RESULT unpause();
61         
62                 // iSeekableService
63         RESULT getLength(pts_t &len);
64         RESULT seekTo(pts_t to);
65         RESULT getPlayPosition(pts_t &pos);
66
67                 // iServiceInformation
68         RESULT getName(std::string &name);
69         RESULT getEvent(ePtr<eServiceEvent> &evt, int nownext);
70
71 private:
72         friend class eServiceFactoryDVB;
73         eServiceReference m_reference;
74         
75         ePtr<eDVBService> m_dvb_service;
76         
77         ePtr<iTSMPEGDecoder> m_decoder;
78         
79         eDVBServicePMTHandler m_service_handler;
80         eDVBServiceEITHandler m_event_handler;
81         
82         eDVBServicePlay(const eServiceReference &ref, eDVBService *service);
83         
84         void gotNewEvent();
85         
86         void serviceEvent(int event);
87         Signal2<void,iPlayableService*,int> m_event;
88         
89         int m_is_pvr, m_is_paused;
90 };
91
92 #endif