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();
161 PyObject *getCachedSubtitle();
166 void setAC3Delay(int);
167 void setPCMDelay(int);
170 friend class eServiceFactoryDVB;
171 eServiceReference m_reference;
173 ePtr<eDVBService> m_dvb_service;
175 ePtr<iTSMPEGDecoder> m_decoder;
177 int m_have_video_pid;
179 /* in timeshift mode, we essentially have two channels, and thus pmt handlers. */
180 eDVBServicePMTHandler m_service_handler_timeshift;
181 eDVBServiceEITHandler m_event_handler;
183 eDVBServicePlay(const eServiceReference &ref, eDVBService *service);
188 void serviceEvent(int event);
189 void serviceEventTimeshift(int event);
190 Signal2<void,iPlayableService*,int> m_event;
193 int m_is_pvr, m_is_paused, m_timeshift_enabled, m_timeshift_active;
194 int m_first_program_info;
196 std::string m_timeshift_file;
199 ePtr<iDVBDemux> m_decode_demux;
201 int m_current_audio_stream;
202 int selectAudioStream(int n);
205 ePtr<iDVBTSRecorder> m_record;
206 std::set<int> m_pids_active;
208 void updateTimeshiftPids();
210 void switchToTimeshift();
212 void updateDecoder();
218 ePtr<eCueSheet> m_cue;
225 bool operator < (const struct cueEntry &o) const
227 return where < o.where;
229 cueEntry(const pts_t &where, unsigned int what) :
230 where(where), what(what)
235 std::multiset<cueEntry> m_cue_entries;
236 int m_cuesheet_changed, m_cutlist_enabled;
241 void cutlistToCuesheet();
243 eSubtitleWidget *m_subtitle_widget;
245 /* teletext subtitles */
246 ePtr<eDVBTeletextParser> m_teletext_parser;
247 void newSubtitlePage(const eDVBTeletextSubtitlePage &p);
248 ePtr<eConnection> m_new_subtitle_page_connection;
249 std::list<eDVBTeletextSubtitlePage> m_subtitle_pages;
252 ePtr<eDVBSubtitleParser> m_subtitle_parser;
253 void newDVBSubtitlePage(const eDVBSubtitlePage &p);
254 ePtr<eConnection> m_new_dvb_subtitle_page_connection;
255 std::list<eDVBSubtitlePage> m_dvb_subtitle_pages;
257 eTimer m_subtitle_sync_timer;
258 void checkSubtitleTiming();
261 ePtr<eDVBRadioTextParser> m_radiotext_parser;
262 ePtr<eConnection> m_radiotext_updated_connection;
263 void radioTextUpdated();