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/teletext.h>
10 #include <lib/dvb/radiotext.h>
11 #include <lib/base/filepush.h>
13 class eStaticServiceDVBInformation;
14 class eStaticServiceDVBBouquetInformation;
16 class eServiceFactoryDVB: public iServiceHandler
18 DECLARE_REF(eServiceFactoryDVB);
19 ePtr<eStaticServiceDVBInformation> m_StaticServiceDVBInfo;
20 ePtr<eStaticServiceDVBBouquetInformation> m_StaticServiceDVBBouquetInfo;
23 virtual ~eServiceFactoryDVB();
27 RESULT play(const eServiceReference &, ePtr<iPlayableService> &ptr);
28 RESULT record(const eServiceReference &, ePtr<iRecordableService> &ptr);
29 RESULT list(const eServiceReference &, ePtr<iListableService> &ptr);
30 RESULT info(const eServiceReference &, ePtr<iStaticServiceInformation> &ptr);
31 RESULT offlineOperations(const eServiceReference &, ePtr<iServiceOfflineOperations> &ptr);
33 RESULT lookupService(ePtr<eDVBService> &ptr, const eServiceReference &ref);
38 class eDVBServiceList: public iListableService, public iMutableServiceList
40 DECLARE_REF(eDVBServiceList);
42 virtual ~eDVBServiceList();
43 PyObject *getContent(const char* formatstr, bool sorted=false);
44 RESULT getContent(std::list<eServiceReference> &list, bool sorted=false);
45 RESULT getNext(eServiceReference &ptr);
46 int compareLessEqual(const eServiceReference &a, const eServiceReference &b);
48 RESULT startEdit(ePtr<iMutableServiceList> &);
49 RESULT flushChanges();
50 RESULT addService(eServiceReference &ref, eServiceReference before);
51 RESULT removeService(eServiceReference &ref);
52 RESULT moveService(eServiceReference &ref, int pos);
53 RESULT setListName(const std::string &name);
56 eServiceReference m_parent;
57 friend class eServiceFactoryDVB;
58 eDVBServiceList(const eServiceReference &parent);
59 ePtr<iDVBChannelListQuery> m_query;
61 /* for editing purposes. WARNING: lifetime issue! */
65 class eDVBServiceBase: public iFrontendInformation
68 eDVBServicePMTHandler m_service_handler ;
70 // iFrontendInformation
71 int getFrontendInfo(int w);
72 PyObject *getFrontendData(bool);
75 class eSubtitleWidget;
77 class eDVBServicePlay: public eDVBServiceBase,
78 public iPlayableService, public iPauseableService,
79 public iSeekableService, public Object, public iServiceInformation,
80 public iAudioTrackSelection, public iAudioChannelSelection,
81 public iSubserviceList, public iTimeshiftService,
82 public iCueSheet, public iSubtitleOutput, public iAudioDelay,
85 DECLARE_REF(eDVBServicePlay);
87 virtual ~eDVBServicePlay();
90 RESULT connectEvent(const Slot2<void,iPlayableService*,int> &event, ePtr<eConnection> &connection);
93 RESULT setTarget(int target);
95 RESULT seek(ePtr<iSeekableService> &ptr);
96 RESULT pause(ePtr<iPauseableService> &ptr);
97 RESULT info(ePtr<iServiceInformation> &ptr);
98 RESULT audioChannel(ePtr<iAudioChannelSelection> &ptr);
99 RESULT audioTracks(ePtr<iAudioTrackSelection> &ptr);
100 RESULT frontendInfo(ePtr<iFrontendInformation> &ptr);
101 RESULT subServices(ePtr<iSubserviceList> &ptr);
102 RESULT timeshift(ePtr<iTimeshiftService> &ptr);
103 RESULT cueSheet(ePtr<iCueSheet> &ptr);
104 RESULT subtitle(ePtr<iSubtitleOutput> &ptr);
105 RESULT audioDelay(ePtr<iAudioDelay> &ptr);
106 RESULT radioText(ePtr<iRadioText> &ptr);
111 RESULT setSlowMotion(int ratio);
112 RESULT setFastForward(int ratio);
115 RESULT getLength(pts_t &len);
116 RESULT seekTo(pts_t to);
117 RESULT seekRelative(int direction, pts_t to);
118 RESULT getPlayPosition(pts_t &pos);
119 RESULT setTrickmode(int trick=0);
120 RESULT isCurrentlySeekable();
122 // iServiceInformation
123 RESULT getName(std::string &name);
124 RESULT getEvent(ePtr<eServiceEvent> &evt, int nownext);
126 std::string getInfoString(int w);
127 PyObject *getInfoObject(int w);
129 // iAudioTrackSelection
130 int getNumberOfTracks();
131 RESULT selectTrack(unsigned int i);
132 RESULT getTrackInfo(struct iAudioTrackInfo &, unsigned int n);
134 // iAudioChannelSelection
135 int getCurrentChannel();
136 RESULT selectChannel(int i);
139 std::string getRadioText(int i=0);
142 int getNumberOfSubservices();
143 RESULT getSubservice(eServiceReference &subservice, unsigned int n);
146 RESULT startTimeshift();
147 RESULT stopTimeshift();
148 int isTimeshiftActive();
149 RESULT activateTimeshift();
152 PyObject *getCutList();
153 void setCutList(PyObject *);
154 void setCutListEnable(int enable);
157 RESULT enableSubtitles(eWidget *parent, PyObject *entry);
158 RESULT disableSubtitles(eWidget *parent);
159 PyObject *getSubtitleList();
164 void setAC3Delay(int);
165 void setPCMDelay(int);
168 friend class eServiceFactoryDVB;
169 eServiceReference m_reference;
171 ePtr<eDVBService> m_dvb_service;
173 ePtr<iTSMPEGDecoder> m_decoder;
175 int m_have_video_pid;
177 /* in timeshift mode, we essentially have two channels, and thus pmt handlers. */
178 eDVBServicePMTHandler m_service_handler_timeshift;
179 eDVBServiceEITHandler m_event_handler;
181 eDVBServicePlay(const eServiceReference &ref, eDVBService *service);
186 void serviceEvent(int event);
187 void serviceEventTimeshift(int event);
188 Signal2<void,iPlayableService*,int> m_event;
191 int m_is_pvr, m_is_paused, m_timeshift_enabled, m_timeshift_active;
192 int m_first_program_info;
194 std::string m_timeshift_file;
197 ePtr<iDVBDemux> m_decode_demux;
199 int m_current_audio_stream;
200 int selectAudioStream(int n);
203 ePtr<iDVBTSRecorder> m_record;
204 std::set<int> m_pids_active;
206 void updateTimeshiftPids();
208 void switchToTimeshift();
210 void updateDecoder();
216 ePtr<eCueSheet> m_cue;
223 bool operator < (const struct cueEntry &o) const
225 return where < o.where;
227 cueEntry(const pts_t &where, unsigned int what) :
228 where(where), what(what)
233 std::multiset<cueEntry> m_cue_entries;
234 int m_cuesheet_changed, m_cutlist_enabled;
239 void cutlistToCuesheet();
241 /* teletext subtitles */
242 void newSubtitlePage(const eDVBTeletextSubtitlePage &p);
243 ePtr<eConnection> m_new_subtitle_page_connection;
245 ePtr<eDVBTeletextParser> m_teletext_parser;
246 ePtr<eDVBRadioTextParser> m_radiotext_parser;
247 eSubtitleWidget *m_subtitle_widget;
248 eTimer m_subtitle_sync_timer;
249 std::list<eDVBTeletextSubtitlePage> m_subtitle_pages;
251 void checkSubtitleTiming();
254 ePtr<eConnection> m_radiotext_updated_connection;
255 void radioTextUpdated();