Add QuadPiP plugin.
[vuplus_dvbapp] / lib / python / Plugins / Extensions / DVDPlayer / src / servicedvd.h
1 #ifndef __servicedvd_h
2 #define __servicedvd_h
3
4 #include <lib/base/message.h>
5 #include <lib/base/ebase.h>
6 #include <lib/base/thread.h>
7 #include <lib/service/iservice.h>
8
9 class eSubtitleWidget;
10 class gPixmap;
11 class eStaticServiceDVDInfo;
12
13 class eServiceFactoryDVD: public iServiceHandler
14 {
15         DECLARE_REF(eServiceFactoryDVD);
16 public:
17         eServiceFactoryDVD();
18         virtual ~eServiceFactoryDVD();
19         enum { id = 0x1111 };
20
21                 // iServiceHandler
22         RESULT play(const eServiceReference &, ePtr<iPlayableService> &ptr);
23         RESULT record(const eServiceReference &, ePtr<iRecordableService> &ptr);
24         RESULT list(const eServiceReference &, ePtr<iListableService> &ptr);
25         RESULT info(const eServiceReference &, ePtr<iStaticServiceInformation> &ptr);
26         RESULT offlineOperations(const eServiceReference &, ePtr<iServiceOfflineOperations> &ptr);
27 };
28
29 class eServiceDVD: public iPlayableService, public iPauseableService, public iSeekableService, public iAudioTrackSelection,
30         public iServiceInformation, public iSubtitleOutput, public iServiceKeys, public iCueSheet, public eThread, public Object
31 {
32         friend class eServiceFactoryDVD;
33         DECLARE_REF(eServiceDVD);
34 public:
35         virtual ~eServiceDVD();
36                 // not implemented (yet)
37         RESULT audioChannel(ePtr<iAudioChannelSelection> &ptr) { ptr = 0; return -1; }
38         RESULT audioTracks(ePtr<iAudioTrackSelection> &ptr);
39         RESULT frontendInfo(ePtr<iFrontendInformation> &ptr) { ptr = 0; return -1; }
40         RESULT subServices(ePtr<iSubserviceList> &ptr) { ptr = 0; return -1; }
41         RESULT timeshift(ePtr<iTimeshiftService> &ptr) { ptr = 0; return -1; }
42         RESULT audioDelay(ePtr<iAudioDelay> &ptr) { ptr = 0; return -1; }
43         RESULT rdsDecoder(ePtr<iRdsDecoder> &ptr) { ptr = 0; return -1; }
44         RESULT stream(ePtr<iStreamableService> &ptr) { ptr = 0; return -1; }
45         RESULT streamed(ePtr<iStreamedService> &ptr) { ptr = 0; return -1; }
46         RESULT cueSheet(ePtr<iCueSheet> &ptr);
47
48         void setQpipMode(bool value, bool audio) { }
49
50                 // iPlayableService
51         RESULT connectEvent(const Slot2<void,iPlayableService*,int> &event, ePtr<eConnection> &connection);
52         RESULT start();
53         RESULT stop();
54         RESULT setTarget(int target);
55         RESULT info(ePtr<iServiceInformation> &ptr);
56         RESULT pause(ePtr<iPauseableService> &ptr);
57         RESULT subtitle(ePtr<iSubtitleOutput> &ptr);
58         RESULT seek(ePtr<iSeekableService> &ptr);
59         RESULT keys(ePtr<iServiceKeys> &ptr);
60
61                 // iPausableService
62         RESULT pause();
63         RESULT unpause();
64         RESULT setSlowMotion(int ratio);
65         RESULT setFastForward(int ratio);
66
67                 // iSubtitleOutput
68         RESULT enableSubtitles(eWidget *parent, SWIG_PYOBJECT(ePyObject) entry);
69         RESULT disableSubtitles(eWidget *parent);
70         PyObject *getSubtitleList();
71         PyObject *getCachedSubtitle();
72
73                 // iSeekableService
74         RESULT getLength(pts_t &len);
75         RESULT seekTo(pts_t to);
76         RESULT seekRelative(int direction, pts_t to);
77         RESULT getPlayPosition(pts_t &pos);
78         RESULT setTrickmode(int trick=0);
79         RESULT isCurrentlySeekable();
80         RESULT seekChapter(int chapter);
81         RESULT seekTitle(int title);
82
83                 // iServiceInformation
84         RESULT getName(std::string &name);
85         int getInfo(int w);
86         std::string getInfoString(int w);
87         virtual PyObject *getInfoObject(int w);
88
89                 // iCueSheet
90         PyObject *getCutList();
91         void setCutList(SWIG_PYOBJECT(ePyObject));
92         void setCutListEnable(int enable);
93
94                         // iAudioTrackSelection 
95         int getNumberOfTracks();
96         RESULT selectTrack(unsigned int i);
97         RESULT getTrackInfo(struct iAudioTrackInfo &, unsigned int n);
98         int getCurrentTrack();
99
100         // iServiceKeys
101         RESULT keyPressed(int key);
102
103 private:
104         eServiceDVD(eServiceReference ref);
105
106         void gotMessage(int); // message from dvdlib
107         void gotThreadMessage(const int &); // message from dvd thread
108
109                 // eThread
110         void thread();
111         void thread_finished();
112
113         eServiceReference m_ref;
114
115         Signal2<void,iPlayableService*,int> m_event;
116
117         struct ddvd *m_ddvdconfig;
118         ePtr<gPixmap> m_pixmap;
119         eSubtitleWidget *m_subtitle_widget;
120
121         enum
122         {
123                 stIdle, stRunning, stMenu, stStopped
124         };
125
126         int m_state;
127         int m_current_trick;
128
129         char m_ddvd_titlestring[96];
130
131         ePtr<eSocketNotifier> m_sn;
132         eFixedMessagePump<int> m_pump;
133
134         pts_t m_cue_pts;
135         struct ddvd_resume m_resume_info;
136
137         void loadCuesheet();
138         void saveCuesheet();
139
140         int m_width, m_height, m_aspect, m_framerate, m_progressive;
141 };
142
143 #endif