fix more nfiflash media paths to be non-absolute (#620)
[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         int getSource() { return source; }
19         RESULT setSourcePVR(int pvrnum);
20         
21         RESULT createSectionReader(eMainloop *context, ePtr<iDVBSectionReader> &reader);
22         RESULT createPESReader(eMainloop *context, ePtr<iDVBPESReader> &reader);
23         RESULT createTSRecorder(ePtr<iDVBTSRecorder> &recorder);
24         RESULT getMPEGDecoder(ePtr<iTSMPEGDecoder> &reader, int primary);
25         RESULT getSTC(pts_t &pts, int num);
26         RESULT getCADemuxID(uint8_t &id) { id = demux; return 0; }
27         RESULT flush();
28         RESULT connectEvent(const Slot1<void,int> &event, ePtr<eConnection> &conn);
29         
30         int getRefCount() { return ref; }
31 private:
32         int adapter, demux, source;
33         
34         int m_dvr_busy;
35         friend class eDVBSectionReader;
36         friend class eDVBPESReader;
37         friend class eDVBAudio;
38         friend class eDVBVideo;
39         friend class eDVBPCR;
40         friend class eDVBTText;
41         friend class eDVBTSRecorder;
42         friend class eDVBCAService;
43         Signal1<void, int> m_event;
44         
45         int openDemux(void);
46 };
47
48 class eDVBSectionReader: public iDVBSectionReader, public Object
49 {
50         DECLARE_REF(eDVBSectionReader);
51         int fd;
52         Signal1<void, const __u8*> read;
53         ePtr<eDVBDemux> demux;
54         int active;
55         int checkcrc;
56         void data(int);
57         ePtr<eSocketNotifier> notifier;
58 public:
59         eDVBSectionReader(eDVBDemux *demux, eMainloop *context, RESULT &res);
60         virtual ~eDVBSectionReader();
61         RESULT setBufferSize(int size);
62         RESULT start(const eDVBSectionFilterMask &mask);
63         RESULT stop();
64         RESULT connectRead(const Slot1<void,const __u8*> &read, ePtr<eConnection> &conn);
65 };
66
67 class eDVBPESReader: public iDVBPESReader, public Object
68 {
69         DECLARE_REF(eDVBPESReader);
70         int m_fd;
71         Signal2<void, const __u8*, int> m_read;
72         ePtr<eDVBDemux> m_demux;
73         int m_active;
74         void data(int);
75         ePtr<eSocketNotifier> m_notifier;
76 public:
77         eDVBPESReader(eDVBDemux *demux, eMainloop *context, RESULT &res);
78         virtual ~eDVBPESReader();
79         RESULT setBufferSize(int size);
80         RESULT start(int pid);
81         RESULT stop();
82         RESULT connectRead(const Slot2<void,const __u8*, int> &read, ePtr<eConnection> &conn);
83 };
84
85 class eDVBRecordFileThread;
86
87 class eDVBTSRecorder: public iDVBTSRecorder, public Object
88 {
89         DECLARE_REF(eDVBTSRecorder);
90 public:
91         eDVBTSRecorder(eDVBDemux *demux);
92         ~eDVBTSRecorder();
93
94         RESULT setBufferSize(int size);
95         RESULT start();
96         RESULT addPID(int pid);
97         RESULT removePID(int pid);
98         
99         RESULT setTimingPID(int pid, int type);
100         
101         RESULT setTargetFD(int fd);
102         RESULT setTargetFilename(const char *filename);
103         RESULT setBoundary(off_t max);
104         
105         RESULT stop();
106
107         RESULT getCurrentPCR(pts_t &pcr);
108
109         RESULT connectEvent(const Slot1<void,int> &event, ePtr<eConnection> &conn);
110 private:
111         RESULT startPID(int pid);
112         void stopPID(int pid);
113         
114         eDVBRecordFileThread *m_thread;
115         void filepushEvent(int event);
116         
117         std::map<int,int> m_pids;
118         Signal1<void,int> m_event;
119         
120         ePtr<eDVBDemux> m_demux;
121         
122         int m_running, m_target_fd, m_source_fd;
123         std::string m_target_filename;
124 };
125
126 #endif