add standby
[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         friend class eDVBCAService;
18         Signal1<void, int> m_event;
19 public:
20         enum {
21                 evtFlush
22         };
23         DECLARE_REF(eDVBDemux);
24         eDVBDemux(int adapter, int demux);
25         virtual ~eDVBDemux();
26         RESULT createSectionReader(eMainloop *context, ePtr<iDVBSectionReader> &reader);
27         RESULT createTSRecorder(ePtr<iDVBTSRecorder> &recorder);
28         RESULT getMPEGDecoder(ePtr<iTSMPEGDecoder> &reader);
29         RESULT getSTC(pts_t &pts);
30         RESULT getCADemuxID(uint8_t &id) { id = demux; return 0; }
31         RESULT flush();
32         RESULT connectEvent(const Slot1<void,int> &event, ePtr<eConnection> &conn);
33 };
34
35 class eDVBSectionReader: public iDVBSectionReader, public Object
36 {
37         DECLARE_REF(eDVBSectionReader);
38 private:
39         int fd;
40         Signal1<void, const __u8*> read;
41         ePtr<eDVBDemux> demux;
42         int active;
43         int checkcrc;
44         void data(int);
45         eSocketNotifier *notifier;
46 public:
47         
48         eDVBSectionReader(eDVBDemux *demux, eMainloop *context, RESULT &res);
49         virtual ~eDVBSectionReader();
50         RESULT start(const eDVBSectionFilterMask &mask);
51         RESULT stop();
52         RESULT connectRead(const Slot1<void,const __u8*> &read, ePtr<eConnection> &conn);
53 };
54
55 class eFilePushThread;
56
57 class eDVBTSRecorder: public iDVBTSRecorder, public Object
58 {
59         DECLARE_REF(eDVBTSRecorder);
60 public:
61         eDVBTSRecorder(eDVBDemux *demux);
62         ~eDVBTSRecorder();
63
64         RESULT start();
65         RESULT addPID(int pid);
66         RESULT removePID(int pid);
67         
68         RESULT setFormat(int pid);
69         
70         RESULT setTargetFD(int fd);
71         RESULT setBoundary(off_t max);
72         
73         RESULT stop();
74         
75         RESULT connectEvent(const Slot1<void,int> &event, ePtr<eConnection> &conn);
76 private:
77         RESULT startPID(int pid);
78         void stopPID(int pid);
79         
80         eFilePushThread *m_thread;
81         
82         std::map<int,int> m_pids;
83         Signal1<void,int> m_event;
84         
85         ePtr<eDVBDemux> m_demux;
86         
87         int m_running, m_format, m_target_fd, m_source_fd;
88 };
89
90 #endif