introduce option that allows limiting recording filename character set to legacy...
[vuplus_dvbapp] / lib / service / servicedvbrecord.h
1 #ifndef __servicedvbrecord_h
2 #define __servicedvbrecord_h
3
4 #include <lib/service/iservice.h>
5 #include <lib/dvb/idvb.h>
6
7 #include <lib/dvb/pmt.h>
8 #include <lib/dvb/eit.h>
9 #include <set>
10
11 #include <lib/service/servicedvb.h>
12
13 class eDVBServiceRecord: public eDVBServiceBase,
14         public iRecordableService, 
15         public iStreamableService,
16         public Object
17 {
18         DECLARE_REF(eDVBServiceRecord);
19 public:
20         RESULT connectEvent(const Slot2<void,iRecordableService*,int> &event, ePtr<eConnection> &connection);
21         RESULT prepare(const char *filename, time_t begTime, time_t endTime, int eit_event_id);
22         RESULT prepareStreaming();
23         RESULT start(bool simulate=false);
24         RESULT stop();
25         RESULT stream(ePtr<iStreamableService> &ptr);
26         RESULT getError(int &error) { error = m_error; return 0; }
27         RESULT frontendInfo(ePtr<iFrontendInformation> &ptr);
28
29                 /* streamable service */
30         PyObject *getStreamingData();
31
32 private:
33         enum { stateIdle, statePrepared, stateRecording };
34         bool m_simulate;
35         int m_state, m_want_record;
36         friend class eServiceFactoryDVB;
37         eDVBServiceRecord(const eServiceReferenceDVB &ref);
38         
39         eDVBServiceEITHandler m_event_handler;
40         
41         eServiceReferenceDVB m_ref;
42         
43         ePtr<iDVBTSRecorder> m_record;
44         ePtr<eConnection>       m_con_record_event;
45         
46         int m_recording, m_tuned, m_error;
47         std::set<int> m_pids_active;
48         std::string m_filename;
49
50         std::map<int,pts_t> m_event_timestamps;
51         int m_target_fd;
52         int m_streaming;
53         int m_last_event_id;
54         
55         int doPrepare();
56         int doRecord();
57
58                         /* events */
59         void serviceEvent(int event);
60         Signal2<void,iRecordableService*,int> m_event;
61         
62                         /* recorder events */
63         void recordEvent(int event);
64
65                         /* eit updates */
66         void gotNewEvent();
67         void saveCutlist();
68 };
69
70 #endif