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/base/filepush.h>
11 class eServiceFactoryDVB: public iServiceHandler
13 DECLARE_REF(eServiceFactoryDVB);
16 virtual ~eServiceFactoryDVB();
20 RESULT play(const eServiceReference &, ePtr<iPlayableService> &ptr);
21 RESULT record(const eServiceReference &, ePtr<iRecordableService> &ptr);
22 RESULT list(const eServiceReference &, ePtr<iListableService> &ptr);
23 RESULT info(const eServiceReference &, ePtr<iStaticServiceInformation> &ptr);
24 RESULT offlineOperations(const eServiceReference &, ePtr<iServiceOfflineOperations> &ptr);
26 RESULT lookupService(ePtr<eDVBService> &ptr, const eServiceReference &ref);
31 class eDVBServiceList: public iListableService, public iMutableServiceList
33 DECLARE_REF(eDVBServiceList);
35 virtual ~eDVBServiceList();
36 RESULT getContent(std::list<eServiceReference> &list, bool sorted=false);
37 RESULT getContent(PyObject *list, bool sorted=false);
38 RESULT getNext(eServiceReference &ptr);
39 int compareLessEqual(const eServiceReference &a, const eServiceReference &b);
41 RESULT startEdit(ePtr<iMutableServiceList> &);
42 RESULT flushChanges();
43 RESULT addService(eServiceReference &ref);
44 RESULT removeService(eServiceReference &ref);
45 RESULT moveService(eServiceReference &ref, int pos);
46 RESULT setListName(const std::string &name);
49 eServiceReference m_parent;
50 friend class eServiceFactoryDVB;
51 eDVBServiceList(const eServiceReference &parent);
52 ePtr<iDVBChannelListQuery> m_query;
54 /* for editing purposes. WARNING: lifetime issue! */
58 class eDVBServicePlay: public iPlayableService, public iPauseableService,
59 public iSeekableService, public Object, public iServiceInformation,
60 public iAudioTrackSelection, public iFrontendStatusInformation,
61 public iSubserviceList, public iTimeshiftService,
64 DECLARE_REF(eDVBServicePlay);
66 virtual ~eDVBServicePlay();
69 RESULT connectEvent(const Slot2<void,iPlayableService*,int> &event, ePtr<eConnection> &connection);
72 RESULT setTarget(int target);
74 RESULT seek(ePtr<iSeekableService> &ptr);
75 RESULT pause(ePtr<iPauseableService> &ptr);
76 RESULT info(ePtr<iServiceInformation> &ptr);
77 RESULT audioTracks(ePtr<iAudioTrackSelection> &ptr);
78 RESULT frontendStatusInfo(ePtr<iFrontendStatusInformation> &ptr);
79 RESULT subServices(ePtr<iSubserviceList> &ptr);
80 RESULT timeshift(ePtr<iTimeshiftService> &ptr);
81 RESULT cueSheet(ePtr<iCueSheet> &ptr);
86 RESULT setSlowMotion(int ratio);
87 RESULT setFastForward(int ratio);
90 RESULT getLength(pts_t &len);
91 RESULT seekTo(pts_t to);
92 RESULT seekRelative(int direction, pts_t to);
93 RESULT getPlayPosition(pts_t &pos);
94 RESULT setTrickmode(int trick=0);
95 RESULT isCurrentlySeekable();
97 // iServiceInformation
98 RESULT getName(std::string &name);
99 RESULT getEvent(ePtr<eServiceEvent> &evt, int nownext);
101 std::string getInfoString(int w);
102 PyObject *getInfoObject(int w);
104 // iAudioTrackSelection
105 int getNumberOfTracks();
106 RESULT selectTrack(unsigned int i);
107 RESULT getTrackInfo(struct iAudioTrackInfo &, unsigned int n);
109 // iFrontendStatusInformation
110 int getFrontendInfo(int w);
111 PyObject *getFrontendData(bool);
114 int getNumberOfSubservices();
115 RESULT getSubservice(eServiceReference &subservice, unsigned int n);
118 RESULT startTimeshift();
119 RESULT stopTimeshift();
120 int isTimeshiftActive();
121 RESULT activateTimeshift();
124 PyObject *getCutList();
125 void setCutList(PyObject *);
126 void setCutListEnable(int enable);
129 friend class eServiceFactoryDVB;
130 eServiceReference m_reference;
132 ePtr<eDVBService> m_dvb_service;
134 ePtr<iTSMPEGDecoder> m_decoder;
137 /* in timeshift mode, we essentially have two channels, and thus pmt handlers. */
138 eDVBServicePMTHandler m_service_handler, m_service_handler_timeshift;
139 eDVBServiceEITHandler m_event_handler;
141 eDVBServicePlay(const eServiceReference &ref, eDVBService *service);
145 void serviceEvent(int event);
146 void serviceEventTimeshift(int event);
147 Signal2<void,iPlayableService*,int> m_event;
149 int m_is_pvr, m_is_paused, m_timeshift_enabled, m_timeshift_active;
150 int m_first_program_info;
152 std::string m_timeshift_file;
155 ePtr<iDVBDemux> m_decode_demux;
157 int m_current_audio_stream;
158 int selectAudioStream(int n);
160 ePtr<iDVBTSRecorder> m_record;
161 std::set<int> m_pids_active;
163 void updateTimeshiftPids();
165 void switchToTimeshift();
167 void updateDecoder();
171 ePtr<eCueSheet> m_cue;
178 bool operator < (const struct cueEntry &o) const
180 return where < o.where;
182 cueEntry(const pts_t &where, unsigned int what) :
183 where(where), what(what)
188 std::multiset<cueEntry> m_cue_entries;
189 int m_cuesheet_changed, m_cutlist_enabled;
194 void cutlistToCuesheet();