- beautified network cursor, added 'selected' argument to __call__
[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         int adapter, demux;
10         
11         int m_dvr_busy;
12         friend class eDVBSectionReader;
13         friend class eDVBAudio;
14         friend class eDVBVideo;
15         friend class eDVBPCR;
16         friend class eDVBTSRecorder;
17 public:
18         DECLARE_REF(eDVBDemux);
19         eDVBDemux(int adapter, int demux);
20         virtual ~eDVBDemux();
21         RESULT createSectionReader(eMainloop *context, ePtr<iDVBSectionReader> &reader);
22         RESULT createTSRecorder(ePtr<iDVBTSRecorder> &recorder);
23         RESULT getMPEGDecoder(ePtr<iTSMPEGDecoder> &reader);
24         RESULT getSTC(pts_t &pts);
25 };
26
27 class eDVBSectionReader: public iDVBSectionReader, public Object
28 {
29         DECLARE_REF(eDVBSectionReader);
30 private:
31         int fd;
32         Signal1<void, const __u8*> read;
33         ePtr<eDVBDemux> demux;
34         int active;
35         int checkcrc;
36         void data(int);
37         eSocketNotifier *notifier;
38 public:
39         
40         eDVBSectionReader(eDVBDemux *demux, eMainloop *context, RESULT &res);
41         virtual ~eDVBSectionReader();
42         RESULT start(const eDVBSectionFilterMask &mask);
43         RESULT stop();
44         RESULT connectRead(const Slot1<void,const __u8*> &read, ePtr<eConnection> &conn);
45 };
46
47 class eFilePushThread;
48
49 class eDVBTSRecorder: public iDVBTSRecorder, public Object
50 {
51         DECLARE_REF(eDVBTSRecorder);
52 public:
53         eDVBTSRecorder(eDVBDemux *demux);
54         ~eDVBTSRecorder();
55
56         RESULT start();
57         RESULT addPID(int pid);
58         RESULT removePID(int pid);
59         
60         RESULT setFormat(int pid);
61         
62         RESULT setTargetFD(int fd);
63         RESULT setBoundary(off_t max);
64         
65         RESULT stop();
66         
67         RESULT connectEvent(const Slot1<void,int> &event, ePtr<eConnection> &conn);
68 private:
69         RESULT startPID(int pid);
70         void stopPID(int pid);
71         
72         eFilePushThread *m_thread;
73         
74         std::map<int,int> m_pids;
75         Signal1<void,int> m_event;
76         
77         ePtr<eDVBDemux> m_demux;
78         
79         int m_running, m_format, m_target_fd, m_source_fd;
80 };
81
82 #endif