4 #include <lib/service/iservice.h>
5 #include <lib/dvb/idvb.h>
7 #include <lib/dvb/pmt.h>
8 #include <lib/dvb/eit.h>
9 #include <lib/dvb/subtitle.h>
10 #include <lib/dvb/teletext.h>
11 #include <lib/dvb/radiotext.h>
12 #include <lib/base/filepush.h>
14 class eStaticServiceDVBInformation;
15 class eStaticServiceDVBBouquetInformation;
17 class eServiceFactoryDVB: public iServiceHandler
19 DECLARE_REF(eServiceFactoryDVB);
20 ePtr<eStaticServiceDVBInformation> m_StaticServiceDVBInfo;
21 ePtr<eStaticServiceDVBBouquetInformation> m_StaticServiceDVBBouquetInfo;
24 virtual ~eServiceFactoryDVB();
28 RESULT play(const eServiceReference &, ePtr<iPlayableService> &ptr);
29 RESULT record(const eServiceReference &, ePtr<iRecordableService> &ptr);
30 RESULT list(const eServiceReference &, ePtr<iListableService> &ptr);
31 RESULT info(const eServiceReference &, ePtr<iStaticServiceInformation> &ptr);
32 RESULT offlineOperations(const eServiceReference &, ePtr<iServiceOfflineOperations> &ptr);
34 RESULT lookupService(ePtr<eDVBService> &ptr, const eServiceReference &ref);
39 class eDVBServiceList: public iListableService, public iMutableServiceList
41 DECLARE_REF(eDVBServiceList);
43 virtual ~eDVBServiceList();
44 PyObject *getContent(const char* formatstr, bool sorted=false);
45 RESULT getContent(std::list<eServiceReference> &list, bool sorted=false);
46 RESULT getNext(eServiceReference &ptr);
47 inline int compareLessEqual(const eServiceReference &a, const eServiceReference &b);
49 RESULT startEdit(ePtr<iMutableServiceList> &);
50 RESULT flushChanges();
51 RESULT addService(eServiceReference &ref, eServiceReference before);
52 RESULT removeService(eServiceReference &ref);
53 RESULT moveService(eServiceReference &ref, int pos);
54 RESULT setListName(const std::string &name);
57 eServiceReference m_parent;
58 friend class eServiceFactoryDVB;
59 eDVBServiceList(const eServiceReference &parent);
60 ePtr<iDVBChannelListQuery> m_query;
62 /* for editing purposes. WARNING: lifetime issue! */
66 inline int eDVBServiceList::compareLessEqual(const eServiceReference &a, const eServiceReference &b)
68 return m_query->compareLessEqual((const eServiceReferenceDVB&)a, (const eServiceReferenceDVB&)b);
71 class eDVBServiceBase: public iFrontendInformation
74 eDVBServicePMTHandler m_service_handler;
76 // iFrontendInformation
77 int getFrontendInfo(int w);
78 PyObject *getFrontendData();
79 PyObject *getFrontendStatus();
80 PyObject *getTransponderData(bool);
81 PyObject *getAll(bool original); // a sum of getFrontendData/Status/TransponderData
84 class eSubtitleWidget;
86 class eDVBServicePlay: public eDVBServiceBase,
87 public iPlayableService, public iPauseableService,
88 public iSeekableService, public Object, public iServiceInformation,
89 public iAudioTrackSelection, public iAudioChannelSelection,
90 public iSubserviceList, public iTimeshiftService,
91 public iCueSheet, public iSubtitleOutput, public iAudioDelay,
92 public iRdsDecoder, public iStreamableService
94 DECLARE_REF(eDVBServicePlay);
96 virtual ~eDVBServicePlay();
99 RESULT connectEvent(const Slot2<void,iPlayableService*,int> &event, ePtr<eConnection> &connection);
102 RESULT setTarget(int target);
104 RESULT seek(ePtr<iSeekableService> &ptr);
105 RESULT pause(ePtr<iPauseableService> &ptr);
106 RESULT info(ePtr<iServiceInformation> &ptr);
107 RESULT audioChannel(ePtr<iAudioChannelSelection> &ptr);
108 RESULT audioTracks(ePtr<iAudioTrackSelection> &ptr);
109 RESULT frontendInfo(ePtr<iFrontendInformation> &ptr);
110 RESULT subServices(ePtr<iSubserviceList> &ptr);
111 RESULT timeshift(ePtr<iTimeshiftService> &ptr);
112 RESULT cueSheet(ePtr<iCueSheet> &ptr);
113 RESULT subtitle(ePtr<iSubtitleOutput> &ptr);
114 RESULT audioDelay(ePtr<iAudioDelay> &ptr);
115 RESULT rdsDecoder(ePtr<iRdsDecoder> &ptr);
120 RESULT setSlowMotion(int ratio);
121 RESULT setFastForward(int ratio);
124 RESULT getLength(pts_t &len);
125 RESULT seekTo(pts_t to);
126 RESULT seekRelative(int direction, pts_t to);
127 RESULT getPlayPosition(pts_t &pos);
128 RESULT setTrickmode(int trick=0);
129 RESULT isCurrentlySeekable();
131 // iServiceInformation
132 RESULT getName(std::string &name);
133 RESULT getEvent(ePtr<eServiceEvent> &evt, int nownext);
135 std::string getInfoString(int w);
136 PyObject *getInfoObject(int w);
138 // iAudioTrackSelection
139 int getNumberOfTracks();
140 RESULT selectTrack(unsigned int i);
141 RESULT getTrackInfo(struct iAudioTrackInfo &, unsigned int n);
142 int getCurrentTrack();
144 // iAudioChannelSelection
145 int getCurrentChannel();
146 RESULT selectChannel(int i);
149 std::string getText(int i=0);
150 void showRassSlidePicture();
151 void showRassInteractivePic(int page, int subpage);
152 ePyObject getRassInteractiveMask();
155 int getNumberOfSubservices();
156 RESULT getSubservice(eServiceReference &subservice, unsigned int n);
159 RESULT startTimeshift();
160 RESULT stopTimeshift();
161 int isTimeshiftActive();
162 RESULT activateTimeshift();
165 PyObject *getCutList();
166 void setCutList(SWIG_PYOBJECT(ePyObject));
167 void setCutListEnable(int enable);
170 RESULT enableSubtitles(eWidget *parent, SWIG_PYOBJECT(ePyObject) entry);
171 RESULT disableSubtitles(eWidget *parent);
172 PyObject *getSubtitleList();
173 PyObject *getCachedSubtitle();
178 void setAC3Delay(int);
179 void setPCMDelay(int);
181 // iStreamableService
182 RESULT stream(ePtr<iStreamableService> &ptr);
183 PyObject *getStreamingData();
185 friend class eServiceFactoryDVB;
186 eServiceReference m_reference;
188 ePtr<eDVBService> m_dvb_service;
190 ePtr<iTSMPEGDecoder> m_decoder;
192 int m_have_video_pid;
195 /* in timeshift mode, we essentially have two channels, and thus pmt handlers. */
196 eDVBServicePMTHandler m_service_handler_timeshift;
197 eDVBServiceEITHandler m_event_handler;
198 int m_current_audio_pid;
200 eDVBServicePlay(const eServiceReference &ref, eDVBService *service);
205 void serviceEvent(int event);
206 void serviceEventTimeshift(int event);
207 Signal2<void,iPlayableService*,int> m_event;
210 int m_is_pvr, m_is_paused, m_timeshift_enabled, m_timeshift_active;
211 int m_first_program_info;
213 std::string m_timeshift_file;
216 ePtr<iDVBDemux> m_decode_demux;
218 int m_current_audio_stream;
219 int selectAudioStream(int n = -1);
222 ePtr<iDVBTSRecorder> m_record;
223 std::set<int> m_pids_active;
225 void updateTimeshiftPids();
227 void switchToTimeshift();
229 void updateDecoder();
235 ePtr<eCueSheet> m_cue;
242 bool operator < (const struct cueEntry &o) const
244 return where < o.where;
246 cueEntry(const pts_t &where, unsigned int what) :
247 where(where), what(what)
252 std::multiset<cueEntry> m_cue_entries;
253 int m_cuesheet_changed, m_cutlist_enabled;
258 void cutlistToCuesheet();
260 eSubtitleWidget *m_subtitle_widget;
262 /* teletext subtitles */
263 ePtr<eDVBTeletextParser> m_teletext_parser;
264 void newSubtitlePage(const eDVBTeletextSubtitlePage &p);
265 ePtr<eConnection> m_new_subtitle_page_connection;
266 std::list<eDVBTeletextSubtitlePage> m_subtitle_pages;
269 ePtr<eDVBSubtitleParser> m_subtitle_parser;
270 void newDVBSubtitlePage(const eDVBSubtitlePage &p);
271 ePtr<eConnection> m_new_dvb_subtitle_page_connection;
272 std::list<eDVBSubtitlePage> m_dvb_subtitle_pages;
274 eTimer m_subtitle_sync_timer;
275 void checkSubtitleTiming();
278 ePtr<eDVBRdsDecoder> m_rds_decoder;
279 ePtr<eConnection> m_rds_decoder_event_connection;
280 void rdsDecoderEvent(int);
282 ePtr<eConnection> m_video_event_connection;
283 void video_event(struct iTSMPEGDecoder::videoEvent);
284 struct iTSMPEGDecoder::videoEvent m_videoEventData;
287 class eStaticServiceDVBBouquetInformation: public iStaticServiceInformation
289 DECLARE_REF(eStaticServiceDVBBouquetInformation);
290 eServiceReference m_playable_service;
292 eServiceReference &getPlayableService() { return m_playable_service; }
293 RESULT getName(const eServiceReference &ref, std::string &name);
294 int getLength(const eServiceReference &ref);
295 int isPlayable(const eServiceReference &ref, const eServiceReference &ignore);
296 RESULT getEvent(const eServiceReference &ref, ePtr<eServiceEvent> &ptr, time_t start_time);