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/base/filepush.h>
12 class eServiceFactoryDVB: public iServiceHandler
14 DECLARE_REF(eServiceFactoryDVB);
17 virtual ~eServiceFactoryDVB();
21 RESULT play(const eServiceReference &, ePtr<iPlayableService> &ptr);
22 RESULT record(const eServiceReference &, ePtr<iRecordableService> &ptr);
23 RESULT list(const eServiceReference &, ePtr<iListableService> &ptr);
24 RESULT info(const eServiceReference &, ePtr<iStaticServiceInformation> &ptr);
25 RESULT offlineOperations(const eServiceReference &, ePtr<iServiceOfflineOperations> &ptr);
27 RESULT lookupService(ePtr<eDVBService> &ptr, const eServiceReference &ref);
32 class eDVBServiceList: public iListableService, public iMutableServiceList
34 DECLARE_REF(eDVBServiceList);
36 virtual ~eDVBServiceList();
37 PyObject *getContent(const char* formatstr, bool sorted=false);
38 RESULT getContent(std::list<eServiceReference> &list, bool sorted=false);
39 RESULT getNext(eServiceReference &ptr);
40 int compareLessEqual(const eServiceReference &a, const eServiceReference &b);
42 RESULT startEdit(ePtr<iMutableServiceList> &);
43 RESULT flushChanges();
44 RESULT addService(eServiceReference &ref);
45 RESULT removeService(eServiceReference &ref);
46 RESULT moveService(eServiceReference &ref, int pos);
47 RESULT setListName(const std::string &name);
50 eServiceReference m_parent;
51 friend class eServiceFactoryDVB;
52 eDVBServiceList(const eServiceReference &parent);
53 ePtr<iDVBChannelListQuery> m_query;
55 /* for editing purposes. WARNING: lifetime issue! */
59 class eDVBServicePlay: public iPlayableService, public iPauseableService,
60 public iSeekableService, public Object, public iServiceInformation,
61 public iAudioTrackSelection, public iFrontendStatusInformation,
62 public iSubserviceList, public iTimeshiftService,
65 DECLARE_REF(eDVBServicePlay);
67 virtual ~eDVBServicePlay();
70 RESULT connectEvent(const Slot2<void,iPlayableService*,int> &event, ePtr<eConnection> &connection);
73 RESULT setTarget(int target);
75 RESULT seek(ePtr<iSeekableService> &ptr);
76 RESULT pause(ePtr<iPauseableService> &ptr);
77 RESULT info(ePtr<iServiceInformation> &ptr);
78 RESULT audioTracks(ePtr<iAudioTrackSelection> &ptr);
79 RESULT frontendStatusInfo(ePtr<iFrontendStatusInformation> &ptr);
80 RESULT subServices(ePtr<iSubserviceList> &ptr);
81 RESULT timeshift(ePtr<iTimeshiftService> &ptr);
82 RESULT cueSheet(ePtr<iCueSheet> &ptr);
87 RESULT setSlowMotion(int ratio);
88 RESULT setFastForward(int ratio);
91 RESULT getLength(pts_t &len);
92 RESULT seekTo(pts_t to);
93 RESULT seekRelative(int direction, pts_t to);
94 RESULT getPlayPosition(pts_t &pos);
95 RESULT setTrickmode(int trick=0);
96 RESULT isCurrentlySeekable();
98 // iServiceInformation
99 RESULT getName(std::string &name);
100 RESULT getEvent(ePtr<eServiceEvent> &evt, int nownext);
102 std::string getInfoString(int w);
103 PyObject *getInfoObject(int w);
105 // iAudioTrackSelection
106 int getNumberOfTracks();
107 RESULT selectTrack(unsigned int i);
108 RESULT getTrackInfo(struct iAudioTrackInfo &, unsigned int n);
110 // iFrontendStatusInformation
111 int getFrontendInfo(int w);
112 PyObject *getFrontendData(bool);
115 int getNumberOfSubservices();
116 RESULT getSubservice(eServiceReference &subservice, unsigned int n);
119 RESULT startTimeshift();
120 RESULT stopTimeshift();
121 int isTimeshiftActive();
122 RESULT activateTimeshift();
125 PyObject *getCutList();
126 void setCutList(PyObject *);
127 void setCutListEnable(int enable);
130 friend class eServiceFactoryDVB;
131 eServiceReference m_reference;
133 ePtr<eDVBService> m_dvb_service;
135 ePtr<iTSMPEGDecoder> m_decoder;
138 /* in timeshift mode, we essentially have two channels, and thus pmt handlers. */
139 eDVBServicePMTHandler m_service_handler, m_service_handler_timeshift;
140 eDVBServiceEITHandler m_event_handler;
142 eDVBServicePlay(const eServiceReference &ref, eDVBService *service);
147 void serviceEvent(int event);
148 void serviceEventTimeshift(int event);
149 Signal2<void,iPlayableService*,int> m_event;
152 int m_is_pvr, m_is_paused, m_timeshift_enabled, m_timeshift_active;
153 int m_first_program_info;
155 std::string m_timeshift_file;
158 ePtr<iDVBDemux> m_decode_demux;
160 int m_current_audio_stream;
161 int selectAudioStream(int n);
164 ePtr<iDVBTSRecorder> m_record;
165 std::set<int> m_pids_active;
167 void updateTimeshiftPids();
169 void switchToTimeshift();
171 void updateDecoder();
177 ePtr<eCueSheet> m_cue;
184 bool operator < (const struct cueEntry &o) const
186 return where < o.where;
188 cueEntry(const pts_t &where, unsigned int what) :
189 where(where), what(what)
194 std::multiset<cueEntry> m_cue_entries;
195 int m_cuesheet_changed, m_cutlist_enabled;
200 void cutlistToCuesheet();
202 /* teletext subtitles */
203 ePtr<eDVBTeletextParser> m_teletext_parser;