4 #include <lib/service/iservice.h>
5 #include <lib/dvb/idvb.h>
7 #include <lib/dvb/pmt.h>
8 #include <lib/dvb/eit.h>
10 class eServiceFactoryDVB: public iServiceHandler
12 DECLARE_REF(eServiceFactoryDVB);
15 virtual ~eServiceFactoryDVB();
19 RESULT play(const eServiceReference &, ePtr<iPlayableService> &ptr);
20 RESULT record(const eServiceReference &, ePtr<iRecordableService> &ptr);
21 RESULT list(const eServiceReference &, ePtr<iListableService> &ptr);
22 RESULT info(const eServiceReference &, ePtr<iStaticServiceInformation> &ptr);
23 RESULT offlineOperations(const eServiceReference &, ePtr<iServiceOfflineOperations> &ptr);
25 RESULT lookupService(ePtr<eDVBService> &ptr, const eServiceReference &ref);
30 class eDVBServiceList: public iListableService, public iMutableServiceList
32 DECLARE_REF(eDVBServiceList);
34 virtual ~eDVBServiceList();
35 RESULT getContent(std::list<eServiceReference> &list);
36 RESULT getNext(eServiceReference &ptr);
37 int compareLessEqual(const eServiceReference &a, const eServiceReference &b);
39 RESULT startEdit(ePtr<iMutableServiceList> &);
40 RESULT flushChanges();
41 RESULT addService(eServiceReference &ref);
42 RESULT removeService(eServiceReference &ref);
43 RESULT moveService(eServiceReference &ref, int pos);
46 eServiceReference m_parent;
47 friend class eServiceFactoryDVB;
48 eDVBServiceList(const eServiceReference &parent);
49 ePtr<iDVBChannelListQuery> m_query;
51 /* for editing purposes. WARNING: lifetime issue! */
55 class eDVBServicePlay: public iPlayableService, public iPauseableService,
56 public iSeekableService, public Object, public iServiceInformation,
57 public iAudioTrackSelection, public iFrontendStatusInformation,
58 public iSubserviceList, public iTimeshiftService
60 DECLARE_REF(eDVBServicePlay);
62 virtual ~eDVBServicePlay();
65 RESULT connectEvent(const Slot2<void,iPlayableService*,int> &event, ePtr<eConnection> &connection);
68 RESULT seek(ePtr<iSeekableService> &ptr);
69 RESULT pause(ePtr<iPauseableService> &ptr);
70 RESULT info(ePtr<iServiceInformation> &ptr);
71 RESULT audioTracks(ePtr<iAudioTrackSelection> &ptr);
72 RESULT frontendStatusInfo(ePtr<iFrontendStatusInformation> &ptr);
73 RESULT subServices(ePtr<iSubserviceList> &ptr);
74 RESULT timeshift(ePtr<iTimeshiftService> &ptr);
79 RESULT setSlowMotion(int ratio);
80 RESULT setFastForward(int ratio);
83 RESULT getLength(pts_t &len);
84 RESULT seekTo(pts_t to);
85 RESULT seekRelative(int direction, pts_t to);
86 RESULT getPlayPosition(pts_t &pos);
87 RESULT setTrickmode(int trick=0);
89 // iServiceInformation
90 RESULT getName(std::string &name);
91 RESULT getEvent(ePtr<eServiceEvent> &evt, int nownext);
93 std::string getInfoString(int w);
95 // iAudioTrackSelection
96 int getNumberOfTracks();
97 RESULT selectTrack(unsigned int i);
98 RESULT getTrackInfo(struct iAudioTrackInfo &, unsigned int n);
100 // iFrontendStatusInformation
101 int getFrontendInfo(int w);
104 int getNumberOfSubservices();
105 RESULT getSubservice(eServiceReference &subservice, unsigned int n);
108 RESULT startTimeshift();
109 RESULT stopTimeshift();
110 int isTimeshiftActive();
111 RESULT activateTimeshift();
114 friend class eServiceFactoryDVB;
115 eServiceReference m_reference;
117 ePtr<eDVBService> m_dvb_service;
119 ePtr<iTSMPEGDecoder> m_decoder;
121 /* in timeshift mode, we essentially have two channels, and thus pmt handlers. */
122 eDVBServicePMTHandler m_service_handler, m_service_handler_timeshift;
123 eDVBServiceEITHandler m_event_handler;
125 eDVBServicePlay(const eServiceReference &ref, eDVBService *service);
129 void serviceEvent(int event);
130 void serviceEventTimeshift(int event);
131 Signal2<void,iPlayableService*,int> m_event;
133 int m_is_pvr, m_is_paused, m_timeshift_enabled, m_timeshift_active;
135 std::string m_timeshift_file;
138 ePtr<iDVBDemux> m_decode_demux;
140 int m_current_audio_stream;
141 int selectAudioStream(int n);
143 ePtr<iDVBTSRecorder> m_record;
144 std::set<int> m_pids_active;
146 void updateTimeshiftPids();
148 void switchToTimeshift();
150 void updateDecoder();