- split out meta parser
[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 };
25
26 class eDVBSectionReader: public iDVBSectionReader, public Object
27 {
28         DECLARE_REF(eDVBSectionReader);
29 private:
30         int fd;
31         Signal1<void, const __u8*> read;
32         ePtr<eDVBDemux> demux;
33         int active;
34         int checkcrc;
35         void data(int);
36         eSocketNotifier *notifier;
37 public:
38         
39         eDVBSectionReader(eDVBDemux *demux, eMainloop *context, RESULT &res);
40         virtual ~eDVBSectionReader();
41         RESULT start(const eDVBSectionFilterMask &mask);
42         RESULT stop();
43         RESULT connectRead(const Slot1<void,const __u8*> &read, ePtr<eConnection> &conn);
44 };
45
46 class eFilePushThread;
47
48 class eDVBTSRecorder: public iDVBTSRecorder, public Object
49 {
50         DECLARE_REF(eDVBTSRecorder);
51 public:
52         eDVBTSRecorder(eDVBDemux *demux);
53         ~eDVBTSRecorder();
54
55         RESULT start();
56         RESULT addPID(int pid);
57         RESULT removePID(int pid);
58         
59         RESULT setFormat(int pid);
60         
61         RESULT setTargetFD(int fd);
62         RESULT setBoundary(off_t max);
63         
64         RESULT stop();
65         
66         RESULT connectEvent(const Slot1<void,int> &event, ePtr<eConnection> &conn);
67 private:
68         RESULT startPID(int pid);
69         void stopPID(int pid);
70         
71         eFilePushThread *m_thread;
72         
73         std::map<int,int> m_pids;
74         Signal1<void,int> m_event;
75         
76         ePtr<eDVBDemux> m_demux;
77         
78         int m_running, m_format, m_target_fd, m_source_fd;
79 };
80
81 #endif