bdec483650c30dad80cecc1c6c763b68612ba9cb
[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,
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) { ptr = 0; return -1; }
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 cueSheet(ePtr<iCueSheet> &ptr);
46
47                 // iPlayableService
48         RESULT connectEvent(const Slot2<void,iPlayableService*,int> &event, ePtr<eConnection> &connection);
49         RESULT start();
50         RESULT stop();
51         RESULT setTarget(int target);
52         RESULT info(ePtr<iServiceInformation> &ptr);
53         RESULT pause(ePtr<iPauseableService> &ptr);
54         RESULT subtitle(ePtr<iSubtitleOutput> &ptr);
55         RESULT seek(ePtr<iSeekableService> &ptr);
56         RESULT keys(ePtr<iServiceKeys> &ptr);
57
58                 // iPausableService
59         RESULT pause();
60         RESULT unpause();
61         RESULT setSlowMotion(int ratio);
62         RESULT setFastForward(int ratio);
63
64                 // iSubtitleOutput
65         RESULT enableSubtitles(eWidget *parent, SWIG_PYOBJECT(ePyObject) entry);
66         RESULT disableSubtitles(eWidget *parent);
67         PyObject *getSubtitleList();
68         PyObject *getCachedSubtitle();
69
70                 // iSeekableService
71         RESULT getLength(pts_t &len);
72         RESULT seekTo(pts_t to);
73         RESULT seekRelative(int direction, pts_t to);
74         RESULT getPlayPosition(pts_t &pos);
75         RESULT setTrickmode(int trick=0);
76         RESULT isCurrentlySeekable();
77         RESULT seekChapter(int chapter);
78         RESULT seekTitle(int title);
79
80                 // iServiceInformation
81         RESULT getName(std::string &name);
82         int getInfo(int w);
83         std::string getInfoString(int w);
84         virtual PyObject *getInfoObject(int w);
85
86                 // iCueSheet
87         PyObject *getCutList();
88         void setCutList(SWIG_PYOBJECT(ePyObject));
89         void setCutListEnable(int enable);
90
91                 // iServiceKeys
92         RESULT keyPressed(int key);
93 private:
94         eServiceDVD(const char *filename);
95
96         void gotMessage(int); // message from dvdlib
97         void gotThreadMessage(const int &); // message from dvd thread
98
99                 // eThread
100         void thread();
101         void thread_finished();
102
103         std::string m_filename;
104
105         Signal2<void,iPlayableService*,int> m_event;
106
107         struct ddvd *m_ddvdconfig;
108         ePtr<gPixmap> m_pixmap;
109         eSubtitleWidget *m_subtitle_widget;
110
111         enum
112         {
113                 stIdle, stRunning, stMenu, stStopped
114         };
115
116         int m_state;
117         int m_current_trick;
118
119         char m_ddvd_titlestring[96];
120
121         eSocketNotifier m_sn;
122         eFixedMessagePump<int> m_pump;
123
124         pts_t m_cue_pts;
125         struct ddvd_resume m_resume_info;
126
127         void loadCuesheet();
128         void saveCuesheet();
129 };
130
131 #endif