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 eServiceFactoryDVB: public iServiceHandler
15 DECLARE_REF(eServiceFactoryDVB);
18 virtual ~eServiceFactoryDVB();
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);
28 RESULT lookupService(ePtr<eDVBService> &ptr, const eServiceReference &ref);
33 class eDVBServiceList: public iListableService, public iMutableServiceList
35 DECLARE_REF(eDVBServiceList);
37 virtual ~eDVBServiceList();
38 PyObject *getContent(const char* formatstr, bool sorted=false);
39 RESULT getContent(std::list<eServiceReference> &list, bool sorted=false);
40 RESULT getNext(eServiceReference &ptr);
41 int compareLessEqual(const eServiceReference &a, const eServiceReference &b);
43 RESULT startEdit(ePtr<iMutableServiceList> &);
44 RESULT flushChanges();
45 RESULT addService(eServiceReference &ref, eServiceReference before);
46 RESULT removeService(eServiceReference &ref);
47 RESULT moveService(eServiceReference &ref, int pos);
48 RESULT setListName(const std::string &name);
51 eServiceReference m_parent;
52 friend class eServiceFactoryDVB;
53 eDVBServiceList(const eServiceReference &parent);
54 ePtr<iDVBChannelListQuery> m_query;
56 /* for editing purposes. WARNING: lifetime issue! */
60 class eDVBServiceBase: public iFrontendInformation
63 eDVBServicePMTHandler m_service_handler ;
65 // iFrontendInformation
66 int getFrontendInfo(int w);
67 PyObject *getFrontendData(bool);
70 class eSubtitleWidget;
72 class eDVBServicePlay: public eDVBServiceBase,
73 public iPlayableService, public iPauseableService,
74 public iSeekableService, public Object, public iServiceInformation,
75 public iAudioTrackSelection, public iAudioChannelSelection,
76 public iSubserviceList, public iTimeshiftService,
77 public iCueSheet, public iSubtitleOutput, public iAudioDelay,
80 DECLARE_REF(eDVBServicePlay);
82 virtual ~eDVBServicePlay();
85 RESULT connectEvent(const Slot2<void,iPlayableService*,int> &event, ePtr<eConnection> &connection);
88 RESULT setTarget(int target);
90 RESULT seek(ePtr<iSeekableService> &ptr);
91 RESULT pause(ePtr<iPauseableService> &ptr);
92 RESULT info(ePtr<iServiceInformation> &ptr);
93 RESULT audioChannel(ePtr<iAudioChannelSelection> &ptr);
94 RESULT audioTracks(ePtr<iAudioTrackSelection> &ptr);
95 RESULT frontendInfo(ePtr<iFrontendInformation> &ptr);
96 RESULT subServices(ePtr<iSubserviceList> &ptr);
97 RESULT timeshift(ePtr<iTimeshiftService> &ptr);
98 RESULT cueSheet(ePtr<iCueSheet> &ptr);
99 RESULT subtitle(ePtr<iSubtitleOutput> &ptr);
100 RESULT audioDelay(ePtr<iAudioDelay> &ptr);
101 RESULT radioText(ePtr<iRadioText> &ptr);
106 RESULT setSlowMotion(int ratio);
107 RESULT setFastForward(int ratio);
110 RESULT getLength(pts_t &len);
111 RESULT seekTo(pts_t to);
112 RESULT seekRelative(int direction, pts_t to);
113 RESULT getPlayPosition(pts_t &pos);
114 RESULT setTrickmode(int trick=0);
115 RESULT isCurrentlySeekable();
117 // iServiceInformation
118 RESULT getName(std::string &name);
119 RESULT getEvent(ePtr<eServiceEvent> &evt, int nownext);
121 std::string getInfoString(int w);
122 PyObject *getInfoObject(int w);
124 // iAudioTrackSelection
125 int getNumberOfTracks();
126 RESULT selectTrack(unsigned int i);
127 RESULT getTrackInfo(struct iAudioTrackInfo &, unsigned int n);
129 // iAudioChannelSelection
130 int getCurrentChannel();
131 RESULT selectChannel(int i);
134 std::string getRadioText(int i=0);
137 int getNumberOfSubservices();
138 RESULT getSubservice(eServiceReference &subservice, unsigned int n);
141 RESULT startTimeshift();
142 RESULT stopTimeshift();
143 int isTimeshiftActive();
144 RESULT activateTimeshift();
147 PyObject *getCutList();
148 void setCutList(PyObject *);
149 void setCutListEnable(int enable);
152 RESULT enableSubtitles(eWidget *parent, PyObject *entry);
153 RESULT disableSubtitles(eWidget *parent);
154 PyObject *getSubtitleList();
159 void setAC3Delay(int);
160 void setPCMDelay(int);
163 friend class eServiceFactoryDVB;
164 eServiceReference m_reference;
166 ePtr<eDVBService> m_dvb_service;
168 ePtr<iTSMPEGDecoder> m_decoder;
170 int m_have_video_pid;
172 /* in timeshift mode, we essentially have two channels, and thus pmt handlers. */
173 eDVBServicePMTHandler m_service_handler_timeshift;
174 eDVBServiceEITHandler m_event_handler;
176 eDVBServicePlay(const eServiceReference &ref, eDVBService *service);
181 void serviceEvent(int event);
182 void serviceEventTimeshift(int event);
183 Signal2<void,iPlayableService*,int> m_event;
186 int m_is_pvr, m_is_paused, m_timeshift_enabled, m_timeshift_active;
187 int m_first_program_info;
189 std::string m_timeshift_file;
192 ePtr<iDVBDemux> m_decode_demux;
194 int m_current_audio_stream;
195 int selectAudioStream(int n);
198 ePtr<iDVBTSRecorder> m_record;
199 std::set<int> m_pids_active;
201 void updateTimeshiftPids();
203 void switchToTimeshift();
205 void updateDecoder();
211 ePtr<eCueSheet> m_cue;
218 bool operator < (const struct cueEntry &o) const
220 return where < o.where;
222 cueEntry(const pts_t &where, unsigned int what) :
223 where(where), what(what)
228 std::multiset<cueEntry> m_cue_entries;
229 int m_cuesheet_changed, m_cutlist_enabled;
234 void cutlistToCuesheet();
236 /* teletext subtitles */
237 void newSubtitlePage(const eDVBTeletextSubtitlePage &p);
238 ePtr<eConnection> m_new_subtitle_page_connection;
240 ePtr<eDVBTeletextParser> m_teletext_parser;
241 ePtr<eDVBRadioTextParser> m_radiotext_parser;
242 eSubtitleWidget *m_subtitle_widget;
243 eTimer m_subtitle_sync_timer;
244 std::list<eDVBTeletextSubtitlePage> m_subtitle_pages;
246 void checkSubtitleTiming();
249 ePtr<eConnection> m_radiotext_updated_connection;
250 void radioTextUpdated();