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 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 class eDVBServiceBase: public iFrontendInformation
69 eDVBServicePMTHandler m_service_handler ;
71 // iFrontendInformation
72 int getFrontendInfo(int w);
73 PyObject *getFrontendData(bool);
76 class eSubtitleWidget;
78 class eDVBServicePlay: public eDVBServiceBase,
79 public iPlayableService, public iPauseableService,
80 public iSeekableService, public Object, public iServiceInformation,
81 public iAudioTrackSelection, public iAudioChannelSelection,
82 public iSubserviceList, public iTimeshiftService,
83 public iCueSheet, public iSubtitleOutput, public iAudioDelay,
86 DECLARE_REF(eDVBServicePlay);
88 virtual ~eDVBServicePlay();
91 RESULT connectEvent(const Slot2<void,iPlayableService*,int> &event, ePtr<eConnection> &connection);
94 RESULT setTarget(int target);
96 RESULT seek(ePtr<iSeekableService> &ptr);
97 RESULT pause(ePtr<iPauseableService> &ptr);
98 RESULT info(ePtr<iServiceInformation> &ptr);
99 RESULT audioChannel(ePtr<iAudioChannelSelection> &ptr);
100 RESULT audioTracks(ePtr<iAudioTrackSelection> &ptr);
101 RESULT frontendInfo(ePtr<iFrontendInformation> &ptr);
102 RESULT subServices(ePtr<iSubserviceList> &ptr);
103 RESULT timeshift(ePtr<iTimeshiftService> &ptr);
104 RESULT cueSheet(ePtr<iCueSheet> &ptr);
105 RESULT subtitle(ePtr<iSubtitleOutput> &ptr);
106 RESULT audioDelay(ePtr<iAudioDelay> &ptr);
107 RESULT radioText(ePtr<iRadioText> &ptr);
112 RESULT setSlowMotion(int ratio);
113 RESULT setFastForward(int ratio);
116 RESULT getLength(pts_t &len);
117 RESULT seekTo(pts_t to);
118 RESULT seekRelative(int direction, pts_t to);
119 RESULT getPlayPosition(pts_t &pos);
120 RESULT setTrickmode(int trick=0);
121 RESULT isCurrentlySeekable();
123 // iServiceInformation
124 RESULT getName(std::string &name);
125 RESULT getEvent(ePtr<eServiceEvent> &evt, int nownext);
127 std::string getInfoString(int w);
128 PyObject *getInfoObject(int w);
130 // iAudioTrackSelection
131 int getNumberOfTracks();
132 RESULT selectTrack(unsigned int i);
133 RESULT getTrackInfo(struct iAudioTrackInfo &, unsigned int n);
135 // iAudioChannelSelection
136 int getCurrentChannel();
137 RESULT selectChannel(int i);
140 std::string getRadioText(int i=0);
143 int getNumberOfSubservices();
144 RESULT getSubservice(eServiceReference &subservice, unsigned int n);
147 RESULT startTimeshift();
148 RESULT stopTimeshift();
149 int isTimeshiftActive();
150 RESULT activateTimeshift();
153 PyObject *getCutList();
154 void setCutList(PyObject *);
155 void setCutListEnable(int enable);
158 RESULT enableSubtitles(eWidget *parent, PyObject *entry);
159 RESULT disableSubtitles(eWidget *parent);
160 PyObject *getSubtitleList();
165 void setAC3Delay(int);
166 void setPCMDelay(int);
169 friend class eServiceFactoryDVB;
170 eServiceReference m_reference;
172 ePtr<eDVBService> m_dvb_service;
174 ePtr<iTSMPEGDecoder> m_decoder;
176 int m_have_video_pid;
178 /* in timeshift mode, we essentially have two channels, and thus pmt handlers. */
179 eDVBServicePMTHandler m_service_handler_timeshift;
180 eDVBServiceEITHandler m_event_handler;
182 eDVBServicePlay(const eServiceReference &ref, eDVBService *service);
187 void serviceEvent(int event);
188 void serviceEventTimeshift(int event);
189 Signal2<void,iPlayableService*,int> m_event;
192 int m_is_pvr, m_is_paused, m_timeshift_enabled, m_timeshift_active;
193 int m_first_program_info;
195 std::string m_timeshift_file;
198 ePtr<iDVBDemux> m_decode_demux;
200 int m_current_audio_stream;
201 int selectAudioStream(int n);
204 ePtr<iDVBTSRecorder> m_record;
205 std::set<int> m_pids_active;
207 void updateTimeshiftPids();
209 void switchToTimeshift();
211 void updateDecoder();
217 ePtr<eCueSheet> m_cue;
224 bool operator < (const struct cueEntry &o) const
226 return where < o.where;
228 cueEntry(const pts_t &where, unsigned int what) :
229 where(where), what(what)
234 std::multiset<cueEntry> m_cue_entries;
235 int m_cuesheet_changed, m_cutlist_enabled;
240 void cutlistToCuesheet();
242 eSubtitleWidget *m_subtitle_widget;
244 /* teletext subtitles */
245 ePtr<eDVBTeletextParser> m_teletext_parser;
246 void newSubtitlePage(const eDVBTeletextSubtitlePage &p);
247 ePtr<eConnection> m_new_subtitle_page_connection;
248 std::list<eDVBTeletextSubtitlePage> m_subtitle_pages;
251 ePtr<eDVBSubtitleParser> m_subtitle_parser;
252 void newDVBSubtitlePage(const eDVBSubtitlePage &p);
253 ePtr<eConnection> m_new_dvb_subtitle_page_connection;
254 std::list<eDVBSubtitlePage> m_dvb_subtitle_pages;
256 eTimer m_subtitle_sync_timer;
257 void checkSubtitleTiming();
260 ePtr<eDVBRadioTextParser> m_radiotext_parser;
261 ePtr<eConnection> m_radiotext_updated_connection;
262 void radioTextUpdated();