make eDVBResourceManager accessible from python (needed for allocate a raw iDVBChannel)
[enigma2.git] / lib / dvb / demux.h
1 #ifndef __dvb_demux_h
2 #define __dvb_demux_h
3
4 #include <lib/dvb/idvb.h>
5 #include <lib/dvb/idemux.h>
6
7 class eDVBDemux: public iDVBDemux
8 {
9         DECLARE_REF(eDVBDemux);
10 public:
11         enum {
12                 evtFlush
13         };
14         eDVBDemux(int adapter, int demux);
15         virtual ~eDVBDemux();
16         
17         RESULT setSourceFrontend(int fenum);
18         RESULT setSourcePVR(int pvrnum);
19         
20         RESULT createSectionReader(eMainloop *context, ePtr<iDVBSectionReader> &reader);
21         RESULT createTSRecorder(ePtr<iDVBTSRecorder> &recorder);
22         RESULT getMPEGDecoder(ePtr<iTSMPEGDecoder> &reader);
23         RESULT getSTC(pts_t &pts, int num);
24         RESULT getCADemuxID(uint8_t &id) { id = demux; return 0; }
25         RESULT flush();
26         RESULT connectEvent(const Slot1<void,int> &event, ePtr<eConnection> &conn);
27 private:
28         int adapter, demux;
29         
30         int m_dvr_busy;
31         friend class eDVBSectionReader;
32         friend class eDVBAudio;
33         friend class eDVBVideo;
34         friend class eDVBPCR;
35         friend class eDVBTText;
36         friend class eDVBTSRecorder;
37         friend class eDVBCAService;
38         Signal1<void, int> m_event;
39         
40         int openDemux(void);
41 };
42
43 class eDVBSectionReader: public iDVBSectionReader, public Object
44 {
45         DECLARE_REF(eDVBSectionReader);
46 private:
47         int fd;
48         Signal1<void, const __u8*> read;
49         ePtr<eDVBDemux> demux;
50         int active;
51         int checkcrc;
52         void data(int);
53         eSocketNotifier *notifier;
54 public:
55         
56         eDVBSectionReader(eDVBDemux *demux, eMainloop *context, RESULT &res);
57         virtual ~eDVBSectionReader();
58         RESULT start(const eDVBSectionFilterMask &mask);
59         RESULT stop();
60         RESULT connectRead(const Slot1<void,const __u8*> &read, ePtr<eConnection> &conn);
61 };
62
63 class eDVBRecordFileThread;
64
65 class eDVBTSRecorder: public iDVBTSRecorder, public Object
66 {
67         DECLARE_REF(eDVBTSRecorder);
68 public:
69         eDVBTSRecorder(eDVBDemux *demux);
70         ~eDVBTSRecorder();
71
72         RESULT start();
73         RESULT addPID(int pid);
74         RESULT removePID(int pid);
75         
76         RESULT setTimingPID(int pid);
77         
78         RESULT setTargetFD(int fd);
79         RESULT setTargetFilename(const char *filename);
80         RESULT setBoundary(off_t max);
81         
82         RESULT stop();
83         
84         RESULT connectEvent(const Slot1<void,int> &event, ePtr<eConnection> &conn);
85 private:
86         RESULT startPID(int pid);
87         void stopPID(int pid);
88         
89         eDVBRecordFileThread *m_thread;
90         
91         std::map<int,int> m_pids;
92         Signal1<void,int> m_event;
93         
94         ePtr<eDVBDemux> m_demux;
95         
96         int m_running, m_target_fd, m_source_fd;
97         std::string m_target_filename;
98 };
99
100 #endif